package org.gcube.portlets.user.workspace.client.view.windows.accounting; 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 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() { @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 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 accountingsFields) { this.accountingsContainers.resetStore(); this.accountingsFields = accountingsFields; this.accountingsContainers.updateListAccounting(accountingsFields); } public List 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(); } }