2013-02-08 10:56:27 +01:00
|
|
|
package org.gcube.portlets.user.workspace.client.view.panels;
|
|
|
|
|
|
|
|
import org.gcube.portlets.user.workspace.client.ConstantsPortlet;
|
|
|
|
import org.gcube.portlets.user.workspace.client.view.ExplorerPanel;
|
2014-01-14 14:40:25 +01:00
|
|
|
import org.gcube.portlets.user.workspace.client.view.toolbars.GxtBottomToolBarItem;
|
2015-10-22 18:52:12 +02:00
|
|
|
import org.gcube.portlets.widgets.workspaceuploader.client.uploader.DialogUpload.UPLOAD_TYPE;
|
2015-10-28 17:13:31 +01:00
|
|
|
import org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload;
|
2013-02-08 10:56:27 +01:00
|
|
|
|
|
|
|
import com.extjs.gxt.ui.client.Style.LayoutRegion;
|
|
|
|
import com.extjs.gxt.ui.client.Style.Scroll;
|
2015-10-22 18:52:12 +02:00
|
|
|
import com.extjs.gxt.ui.client.event.BaseEvent;
|
2013-02-08 10:56:27 +01:00
|
|
|
import com.extjs.gxt.ui.client.event.BoxComponentEvent;
|
|
|
|
import com.extjs.gxt.ui.client.event.Events;
|
|
|
|
import com.extjs.gxt.ui.client.event.Listener;
|
|
|
|
import com.extjs.gxt.ui.client.util.Margins;
|
|
|
|
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
|
|
|
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
|
|
|
|
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
|
|
|
|
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
2018-07-04 16:34:11 +02:00
|
|
|
import com.google.gwt.dom.client.Style.Overflow;
|
2015-10-22 18:52:12 +02:00
|
|
|
import com.google.gwt.user.client.Random;
|
2017-04-13 13:57:13 +02:00
|
|
|
import com.google.gwt.user.client.Window;
|
|
|
|
import com.google.gwt.user.client.ui.RootPanel;
|
2013-02-08 10:56:27 +01:00
|
|
|
|
|
|
|
/**
|
2015-11-10 15:49:00 +01:00
|
|
|
* The Class GxtBorderLayoutPanel.
|
2013-02-08 10:56:27 +01:00
|
|
|
*
|
2019-02-22 14:40:30 +01:00
|
|
|
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
2015-11-10 15:49:00 +01:00
|
|
|
* Nov 10, 2015
|
2013-02-08 10:56:27 +01:00
|
|
|
*/
|
|
|
|
public class GxtBorderLayoutPanel extends ContentPanel {
|
2016-06-01 14:54:58 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2013-02-08 10:56:27 +01:00
|
|
|
private ContentPanel north = new ContentPanel();
|
|
|
|
private ContentPanel west = new ContentPanel();
|
|
|
|
private ContentPanel center = new ContentPanel();
|
|
|
|
private ContentPanel east = new ContentPanel();
|
|
|
|
private ContentPanel south = new ContentPanel();
|
2014-01-14 14:40:25 +01:00
|
|
|
private GxtBottomToolBarItem toolBarItemDetails = null;
|
2013-02-08 10:56:27 +01:00
|
|
|
private ExplorerPanel expPanel = null; //TODO change position
|
|
|
|
private GxtSeachAndFilterPanel searchAndFilterContainer;
|
|
|
|
private GxtCardLayoutResultPanel gxtCardLayoutResultPanel;
|
2015-10-28 17:13:31 +01:00
|
|
|
private MultipleDNDUpload dnd;
|
2013-02-08 10:56:27 +01:00
|
|
|
|
2016-06-01 14:54:58 +02:00
|
|
|
|
2015-11-10 15:49:00 +01:00
|
|
|
/**
|
|
|
|
* Instantiates a new gxt border layout panel.
|
|
|
|
*
|
|
|
|
* @param searchAndFilterContainer2 the search and filter container2
|
|
|
|
* @param explorerPanel the explorer panel
|
|
|
|
* @param gxtCardLayoutResultPanel the gxt card layout result panel
|
|
|
|
* @param detailsContainer2 the details container2
|
|
|
|
* @param dnd the dnd
|
|
|
|
*/
|
2013-02-08 10:56:27 +01:00
|
|
|
public GxtBorderLayoutPanel(
|
|
|
|
GxtSeachAndFilterPanel searchAndFilterContainer2,
|
|
|
|
ExplorerPanel explorerPanel,
|
|
|
|
GxtCardLayoutResultPanel gxtCardLayoutResultPanel,
|
2015-10-28 17:13:31 +01:00
|
|
|
GxtBottomToolBarItem detailsContainer2, MultipleDNDUpload dnd) {
|
2016-06-01 14:54:58 +02:00
|
|
|
|
2013-02-08 10:56:27 +01:00
|
|
|
this.searchAndFilterContainer = searchAndFilterContainer2;
|
|
|
|
this.expPanel = explorerPanel;
|
|
|
|
this.gxtCardLayoutResultPanel = gxtCardLayoutResultPanel;
|
2013-05-23 19:03:22 +02:00
|
|
|
this.toolBarItemDetails = detailsContainer2;
|
2015-10-23 16:01:23 +02:00
|
|
|
this.dnd = dnd;
|
2016-06-01 14:54:58 +02:00
|
|
|
|
2013-02-08 10:56:27 +01:00
|
|
|
this.initLayout();
|
|
|
|
this.createLayouts();
|
|
|
|
}
|
|
|
|
|
2015-11-10 15:49:00 +01:00
|
|
|
/**
|
|
|
|
* Inits the layout.
|
|
|
|
*/
|
2013-02-08 10:56:27 +01:00
|
|
|
private void initLayout(){
|
2016-06-01 14:54:58 +02:00
|
|
|
|
2013-02-08 10:56:27 +01:00
|
|
|
north.setId("NorthPanel");
|
2016-06-01 14:54:58 +02:00
|
|
|
|
2013-02-08 10:56:27 +01:00
|
|
|
north.setLayout(new FitLayout());
|
2018-07-04 16:34:11 +02:00
|
|
|
north.getElement().getStyle().setOverflowY(Overflow.HIDDEN);
|
2013-02-08 10:56:27 +01:00
|
|
|
west.setId("WestPanel");
|
|
|
|
west.setLayout(new FitLayout());
|
|
|
|
center.setId("CenterPanel");
|
|
|
|
center.setLayout(new FitLayout());
|
|
|
|
center.setHeaderVisible(false);
|
|
|
|
east.setId("EastPanel");
|
|
|
|
center.setScrollMode(Scroll.AUTOX);
|
|
|
|
center.setBorders(false);
|
2016-06-01 14:54:58 +02:00
|
|
|
|
2013-02-08 10:56:27 +01:00
|
|
|
north.setHeaderVisible(false);
|
2013-09-12 11:38:09 +02:00
|
|
|
west.setHeaderVisible(false);
|
2016-06-01 14:54:58 +02:00
|
|
|
|
2013-05-23 19:03:22 +02:00
|
|
|
south.setHeading(ConstantsPortlet.DETAILS);
|
|
|
|
south.setHeaderVisible(false);
|
2013-02-08 10:56:27 +01:00
|
|
|
south.setLayout(new FitLayout());
|
2016-06-01 14:54:58 +02:00
|
|
|
|
2013-02-08 10:56:27 +01:00
|
|
|
east.setVisible(false);
|
2013-05-23 19:03:22 +02:00
|
|
|
// south.setVisible(false);
|
2013-02-08 10:56:27 +01:00
|
|
|
}
|
2016-06-01 14:54:58 +02:00
|
|
|
|
2015-11-10 15:49:00 +01:00
|
|
|
/**
|
|
|
|
* Creates the layouts.
|
|
|
|
*/
|
2015-11-10 11:25:13 +01:00
|
|
|
private void createLayouts(){
|
2016-06-01 14:54:58 +02:00
|
|
|
|
2013-02-08 10:56:27 +01:00
|
|
|
final BorderLayout borderLayout = new BorderLayout();
|
|
|
|
setLayout(borderLayout);
|
|
|
|
//setStyleAttribute("padding", "10px");
|
|
|
|
setHeaderVisible(false);
|
|
|
|
// center.add(this.gridFilter);
|
|
|
|
|
2018-07-04 16:34:11 +02:00
|
|
|
BorderLayoutData northData = new BorderLayoutData(LayoutRegion.NORTH, ConstantsPortlet.NORTH_HEIGHT, ConstantsPortlet.NORTH_HEIGHT, ConstantsPortlet.NORTH_HEIGHT);
|
2016-06-01 14:54:58 +02:00
|
|
|
|
2017-04-13 13:57:13 +02:00
|
|
|
int treePanelWidth = 330;
|
|
|
|
|
|
|
|
//it makes appear the collapse header for mobiles
|
|
|
|
int leftBorder = RootPanel.get(ConstantsPortlet.WORKSPACEDIV).getAbsoluteLeft();
|
|
|
|
int rootWidth = Window.getClientWidth() - 2* leftBorder;
|
|
|
|
if (rootWidth < ConstantsPortlet.HIDE_TREE_PANEL_WHEN_WIDTH_LESS_THAN) {
|
|
|
|
west.setHeaderVisible(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, treePanelWidth,treePanelWidth,treePanelWidth+70);
|
2016-06-01 14:54:58 +02:00
|
|
|
westData.setSplit(true);
|
|
|
|
westData.setCollapsible(true);
|
2013-02-08 10:56:27 +01:00
|
|
|
westData.setMargins(new Margins(0,1,0,0));
|
2016-06-01 14:54:58 +02:00
|
|
|
|
|
|
|
BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
|
2013-02-08 10:56:27 +01:00
|
|
|
centerData.setMargins(new Margins(0));
|
2016-06-01 14:54:58 +02:00
|
|
|
|
|
|
|
BorderLayoutData eastData = new BorderLayoutData(LayoutRegion.EAST, 150,50,150);
|
|
|
|
eastData.setSplit(true);
|
|
|
|
eastData.setCollapsible(true);
|
|
|
|
eastData.setMargins(new Margins(0,0,0,1));
|
2017-04-13 13:57:13 +02:00
|
|
|
|
|
|
|
|
2016-06-01 14:54:58 +02:00
|
|
|
|
|
|
|
BorderLayoutData southData = new BorderLayoutData(LayoutRegion.SOUTH, 30,30,30);
|
|
|
|
southData.setSplit(true);
|
|
|
|
southData.setCollapsible(false);
|
|
|
|
southData.setMargins(new Margins(1, 0, 0, 0));
|
|
|
|
|
2013-02-08 10:56:27 +01:00
|
|
|
north.add(this.searchAndFilterContainer);
|
2014-07-28 16:21:45 +02:00
|
|
|
north.setScrollMode(Scroll.AUTOY);
|
2013-02-08 10:56:27 +01:00
|
|
|
west.add(this.expPanel);
|
2017-04-13 13:57:13 +02:00
|
|
|
|
2017-04-12 17:44:15 +02:00
|
|
|
|
2014-05-16 17:44:31 +02:00
|
|
|
north.addListener(Events.Resize, new Listener<BoxComponentEvent>(){
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void handleEvent(BoxComponentEvent be) {
|
|
|
|
|
|
|
|
searchAndFilterContainer.getToolbarPathPanel().refreshSize();
|
|
|
|
}
|
2016-06-01 14:54:58 +02:00
|
|
|
|
2014-05-16 17:44:31 +02:00
|
|
|
});
|
2016-06-01 14:54:58 +02:00
|
|
|
|
2014-05-23 15:07:50 +02:00
|
|
|
center.addListener(Events.Resize,new Listener<BoxComponentEvent>(){
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void handleEvent(BoxComponentEvent be) {
|
2015-11-02 18:53:30 +01:00
|
|
|
toolBarItemDetails.setItemsNumberToCenter();
|
2015-10-23 16:01:23 +02:00
|
|
|
updateSizeCard();
|
|
|
|
updateSizeGrid();
|
2014-05-23 15:07:50 +02:00
|
|
|
}
|
|
|
|
});
|
2016-06-01 14:54:58 +02:00
|
|
|
|
2015-10-22 18:52:12 +02:00
|
|
|
gxtCardLayoutResultPanel.addListener(Events.Render, new Listener<BaseEvent>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void handleEvent(BaseEvent be) {
|
2015-10-23 16:01:23 +02:00
|
|
|
updateSizeCard();
|
2015-10-22 18:52:12 +02:00
|
|
|
}
|
|
|
|
});
|
2016-06-01 14:54:58 +02:00
|
|
|
|
2015-10-22 18:52:12 +02:00
|
|
|
gxtCardLayoutResultPanel.getGridGroupViewContainer().addListener(Events.Render, new Listener<BaseEvent>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void handleEvent(BaseEvent be) {
|
2015-10-23 16:01:23 +02:00
|
|
|
updateSizeGrid();
|
2015-10-22 18:52:12 +02:00
|
|
|
}
|
|
|
|
});
|
2013-02-08 10:56:27 +01:00
|
|
|
// center.add(this.toolbarContainer);
|
2015-10-22 18:52:12 +02:00
|
|
|
center.setId("Center Panel "+Random.nextInt());
|
|
|
|
dnd.addUniqueContainer(this.gxtCardLayoutResultPanel);
|
|
|
|
center.add(dnd);
|
2013-05-23 19:03:22 +02:00
|
|
|
// south.add(this.toolBarItemDetails);
|
2013-02-08 10:56:27 +01:00
|
|
|
west.addListener(Events.Resize, new Listener<BoxComponentEvent>(){
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void handleEvent(BoxComponentEvent be) {
|
2018-07-03 18:10:16 +02:00
|
|
|
expPanel.getAsycTreePanel().setSizeTreePanel(expPanel.getWidth()-13, expPanel.getHeight()-10);
|
|
|
|
// if(expPanel.getSmartFolderPanel()!=null)
|
|
|
|
// expPanel.getSmartFolderPanel().setSizeSmartPanel(expPanel.getWidth()-2, expPanel.getHeight()-29);
|
2013-02-08 10:56:27 +01:00
|
|
|
}
|
|
|
|
});
|
2017-04-13 13:57:13 +02:00
|
|
|
|
2013-02-08 10:56:27 +01:00
|
|
|
|
2016-06-01 14:54:58 +02:00
|
|
|
add(north, northData);
|
|
|
|
add(west, westData);
|
|
|
|
add(center, centerData);
|
2013-02-08 10:56:27 +01:00
|
|
|
add(east, eastData);
|
|
|
|
}
|
2016-06-01 14:54:58 +02:00
|
|
|
|
2015-11-10 15:49:00 +01:00
|
|
|
/**
|
|
|
|
* Update size card.
|
|
|
|
*/
|
2015-10-23 16:01:23 +02:00
|
|
|
private void updateSizeCard(){
|
|
|
|
gxtCardLayoutResultPanel.setSize(center.getWidth()-2, center.getHeight());
|
|
|
|
}
|
2016-06-01 14:54:58 +02:00
|
|
|
|
2015-11-10 15:49:00 +01:00
|
|
|
/**
|
|
|
|
* Update size grid.
|
|
|
|
*/
|
2015-10-23 16:01:23 +02:00
|
|
|
private void updateSizeGrid(){
|
2016-06-01 14:54:58 +02:00
|
|
|
gxtCardLayoutResultPanel.getGridGroupViewContainer().refreshSize(center.getWidth()-5+"px", center.getHeight()-75+"px");
|
2015-10-23 16:01:23 +02:00
|
|
|
}
|
2015-11-10 15:49:00 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Update parent id.
|
|
|
|
*
|
|
|
|
* @param parentId the parent id
|
|
|
|
*/
|
2016-01-08 12:37:14 +01:00
|
|
|
public void updateDnDParentId(String parentId){
|
2016-11-25 01:37:28 +01:00
|
|
|
dnd.setParameters(parentId, UPLOAD_TYPE.File);
|
2015-10-22 18:52:12 +02:00
|
|
|
}
|
2017-04-12 17:44:15 +02:00
|
|
|
|
|
|
|
public void collapseTreePanel() {
|
|
|
|
west.collapse();
|
|
|
|
}
|
2013-02-08 10:56:27 +01:00
|
|
|
}
|