workspace-tree-widget/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/WindowAccountingInfo.java

106 lines
2.6 KiB
Java

package org.gcube.portlets.user.workspace.client.view.windows;
import java.util.List;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.WindowEvent;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @May 23, 2013
*
*/
public class WindowAccountingInfo extends Window {
private List<GxtAccountingField> accountingsFields;
private AccoutingInfoContainer accountingsContainers;
public WindowAccountingInfo() {
initAccounting();
// addResizeListner();
}
public WindowAccountingInfo(FileModel fileModel, String title) {
initAccounting();
setIcon(fileModel.getAbstractPrototypeIcon());
setHeading(title);
// addResizeListner();
}
public void addResizeListner(){
this.addListener(Events.Resize, new Listener<WindowEvent>() {
@Override
public void handleEvent(WindowEvent we )
{
if(accountingsContainers!=null){
// System.out.println("Size in event: " + we.getWidth() + "x" + we.getHeight() );
// accountingsContainers.setPanelSize(we.getWidth()-14, we.getHeight()-30);
}
}
});
}
public WindowAccountingInfo(List<GxtAccountingField> accountingsFields) {
updateInfoContainer(accountingsFields);
}
private void initAccounting() {
setModal(true);
setLayout(new FitLayout());
setSize(700, 350);
setResizable(true);
setMaximizable(true);
// setCollapsible(true);
this.accountingsContainers = new AccoutingInfoContainer();
add(accountingsContainers);
}
public void setWindowTitle(String title) {
this.setHeading(title);
}
public void updateInfoContainer(List<GxtAccountingField> accountingsFields) {
this.accountingsContainers.resetStore();
this.accountingsFields = accountingsFields;
this.accountingsContainers.updateListAccounting(accountingsFields);
}
public List<GxtAccountingField> getAccountingsFields() {
return accountingsFields;
}
public void maskAccountingInfo(boolean bool){
// if(accountingsContainers!=null){
//
// if(bool)
// accountingsContainers.mask(ConstantsExplorer.LOADING, ConstantsExplorer.LOADINGSTYLE);
// else
// accountingsContainers.unmask();
// }
if(bool)
this.mask(ConstantsExplorer.LOADING, ConstantsExplorer.LOADINGSTYLE);
else
this.unmask();
}
}