2013-05-27 18:25:10 +02:00
|
|
|
package org.gcube.portlets.user.workspace.client.view.windows.accounting;
|
2013-05-23 19:03:43 +02:00
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
2013-05-24 18:18:14 +02:00
|
|
|
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
|
|
|
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
2013-05-23 19:03:43 +02:00
|
|
|
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
|
|
|
|
2013-05-24 18:18:14 +02:00
|
|
|
import com.extjs.gxt.ui.client.event.Events;
|
|
|
|
import com.extjs.gxt.ui.client.event.Listener;
|
|
|
|
import com.extjs.gxt.ui.client.event.WindowEvent;
|
2013-05-23 19:03:43 +02:00
|
|
|
import com.extjs.gxt.ui.client.widget.Window;
|
2013-05-24 18:18:14 +02:00
|
|
|
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
2013-05-23 19:03:43 +02:00
|
|
|
|
2015-11-10 15:48:36 +01:00
|
|
|
|
2013-05-23 19:03:43 +02:00
|
|
|
/**
|
2015-11-10 15:48:36 +01:00
|
|
|
* The Class WindowAccountingInfo.
|
|
|
|
*
|
2019-02-22 14:40:20 +01:00
|
|
|
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
2015-11-10 15:48:36 +01:00
|
|
|
* Nov 10, 2015
|
2013-05-23 19:03:43 +02:00
|
|
|
*/
|
2013-05-24 18:18:14 +02:00
|
|
|
public class WindowAccountingInfo extends Window {
|
|
|
|
|
2013-05-23 19:03:43 +02:00
|
|
|
private List<GxtAccountingField> accountingsFields;
|
|
|
|
private AccoutingInfoContainer accountingsContainers;
|
|
|
|
|
2015-11-10 15:48:36 +01:00
|
|
|
/**
|
|
|
|
* Instantiates a new window accounting info.
|
|
|
|
*/
|
2013-05-24 18:18:14 +02:00
|
|
|
public WindowAccountingInfo() {
|
|
|
|
initAccounting();
|
|
|
|
}
|
|
|
|
|
2015-11-10 15:48:36 +01:00
|
|
|
/**
|
|
|
|
* Instantiates a new window accounting info.
|
|
|
|
*
|
|
|
|
* @param fileModel the file model
|
|
|
|
* @param title the title
|
|
|
|
*/
|
2013-05-24 18:18:14 +02:00
|
|
|
public WindowAccountingInfo(FileModel fileModel, String title) {
|
|
|
|
initAccounting();
|
|
|
|
setIcon(fileModel.getAbstractPrototypeIcon());
|
|
|
|
setHeading(title);
|
|
|
|
}
|
|
|
|
|
2015-11-10 15:48:36 +01:00
|
|
|
/**
|
|
|
|
* Adds the resize listner.
|
|
|
|
*/
|
2013-05-24 18:18:14 +02:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2015-11-10 15:48:36 +01:00
|
|
|
/**
|
|
|
|
* Instantiates a new window accounting info.
|
|
|
|
*
|
|
|
|
* @param accountingsFields the accountings fields
|
|
|
|
*/
|
2013-05-23 19:03:43 +02:00
|
|
|
public WindowAccountingInfo(List<GxtAccountingField> accountingsFields) {
|
2013-05-24 18:18:14 +02:00
|
|
|
updateInfoContainer(accountingsFields);
|
|
|
|
}
|
|
|
|
|
2015-11-10 15:48:36 +01:00
|
|
|
/**
|
|
|
|
* Inits the accounting.
|
|
|
|
*/
|
2013-05-24 18:18:14 +02:00
|
|
|
private void initAccounting() {
|
2013-05-23 19:03:43 +02:00
|
|
|
setModal(true);
|
2013-05-24 18:18:14 +02:00
|
|
|
setLayout(new FitLayout());
|
|
|
|
setSize(700, 350);
|
|
|
|
setResizable(true);
|
|
|
|
setMaximizable(true);
|
|
|
|
// setCollapsible(true);
|
|
|
|
this.accountingsContainers = new AccoutingInfoContainer();
|
2013-05-23 19:03:43 +02:00
|
|
|
add(accountingsContainers);
|
|
|
|
}
|
2013-05-24 18:18:14 +02:00
|
|
|
|
2015-11-10 15:48:36 +01:00
|
|
|
/**
|
|
|
|
* Sets the window title.
|
|
|
|
*
|
|
|
|
* @param title the new window title
|
|
|
|
*/
|
2013-05-23 19:03:43 +02:00
|
|
|
public void setWindowTitle(String title) {
|
|
|
|
this.setHeading(title);
|
2013-05-24 18:18:14 +02:00
|
|
|
|
2013-05-23 19:03:43 +02:00
|
|
|
}
|
2013-05-24 18:18:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-11-10 15:48:36 +01:00
|
|
|
/**
|
|
|
|
* Update info container.
|
|
|
|
*
|
|
|
|
* @param accountingsFields the accountings fields
|
|
|
|
*/
|
2013-05-24 18:18:14 +02:00
|
|
|
public void updateInfoContainer(List<GxtAccountingField> accountingsFields) {
|
2013-05-23 19:03:43 +02:00
|
|
|
|
2013-05-24 18:18:14 +02:00
|
|
|
this.accountingsContainers.resetStore();
|
|
|
|
this.accountingsFields = accountingsFields;
|
|
|
|
this.accountingsContainers.updateListAccounting(accountingsFields);
|
|
|
|
}
|
2013-05-23 19:03:43 +02:00
|
|
|
|
2015-11-10 15:48:36 +01:00
|
|
|
/**
|
|
|
|
* Gets the accountings fields.
|
|
|
|
*
|
|
|
|
* @return the accountings fields
|
|
|
|
*/
|
2013-05-23 19:03:43 +02:00
|
|
|
public List<GxtAccountingField> getAccountingsFields() {
|
|
|
|
return accountingsFields;
|
|
|
|
}
|
2013-05-24 18:18:14 +02:00
|
|
|
|
2015-11-10 15:48:36 +01:00
|
|
|
/**
|
|
|
|
* Mask accounting info.
|
|
|
|
*
|
|
|
|
* @param bool the bool
|
|
|
|
*/
|
2013-05-24 18:18:14 +02:00
|
|
|
public void maskAccountingInfo(boolean bool){
|
|
|
|
|
|
|
|
if(bool)
|
|
|
|
this.mask(ConstantsExplorer.LOADING, ConstantsExplorer.LOADINGSTYLE);
|
|
|
|
else
|
|
|
|
this.unmask();
|
|
|
|
}
|
2013-05-23 19:03:43 +02:00
|
|
|
}
|