start of accounting integration

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@75306 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-05-23 17:03:22 +00:00
parent ab791b61e4
commit 70153d12a8
7 changed files with 209 additions and 30 deletions

View File

@ -7,6 +7,10 @@ import java.util.List;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer.ViewSwitchType;
import org.gcube.portlets.user.workspace.client.ConstantsPortlet.ViewSwitchTypeInResult;
import org.gcube.portlets.user.workspace.client.event.AccountingHistoryEvent;
import org.gcube.portlets.user.workspace.client.event.AccountingHistoryEventHandler;
import org.gcube.portlets.user.workspace.client.event.AccountingReadersEvent;
import org.gcube.portlets.user.workspace.client.event.AccountingReadersEventHandler;
import org.gcube.portlets.user.workspace.client.event.ActiveGroupingView;
import org.gcube.portlets.user.workspace.client.event.ActiveGroupingViewHandler;
import org.gcube.portlets.user.workspace.client.event.AddFolderEvent;
@ -152,6 +156,33 @@ public class AppController implements SubscriberInterface {
}
});
eventBus.addHandler(AccountingHistoryEvent.TYPE, new AccountingHistoryEventHandler() {
@Override
public void onAccountingHistoryShow(AccountingHistoryEvent accountingHistoryEvent) {
FileGridModel fileItem = getGridSelectedItem();
if(fileItem!=null){
AppControllerExplorer.getEventBus().fireEvent(new AccountingHistoryEvent(fileItem.getIdentifier()));
}
}
});
eventBus.addHandler(AccountingReadersEvent.TYPE, new AccountingReadersEventHandler() {
@Override
public void onAccountingReadersShow(AccountingReadersEvent accountingReadersEvent) {
FileGridModel fileItem = getGridSelectedItem();
if(fileItem!=null){
AppControllerExplorer.getEventBus().fireEvent(new AccountingReadersEvent(fileItem.getIdentifier()));
}
}
});
eventBus.addHandler(GetInfoEvent.TYPE, new GetInfoEventHandler() {
@Override
@ -231,9 +262,17 @@ public class AppController implements SubscriberInterface {
@Override
public void onGridElementSelected(GridElementSelectedEvent event) {
doElementGridSelected(true, event.getSourceFile());
FileGridModel fileItem = getGridSelectedItem();
if(fileItem!=null){
accountingSetItemAsRead(fileItem.isMarkAsRead());
}
//setFileDetailsInView(event.getSourceFile().getIdentifier());
}
});
eventBus.addHandler(LoadAllScopeEvent.TYPE, new LoadAllScopeEventHandler() {
@ -515,6 +554,10 @@ public class AppController implements SubscriberInterface {
}
});
}
private void accountingSetItemAsRead(boolean read) {
wsPortlet.getToolBarItemDetails().setRead(read);
}
private void doElementGridSelected(boolean isSelected, FileModel target) {
@ -537,6 +580,10 @@ public class AppController implements SubscriberInterface {
}
}
private FileGridModel getGridSelectedItem(){
return wsPortlet.getGridGroupContainer().getSelectedItem();
}
/**

View File

@ -6,6 +6,7 @@ import org.gcube.portlets.user.workspace.client.view.panels.GxtBorderLayoutPanel
import org.gcube.portlets.user.workspace.client.view.panels.GxtCardLayoutResultPanel;
import org.gcube.portlets.user.workspace.client.view.panels.GxtSeachAndFilterPanel;
import org.gcube.portlets.user.workspace.client.view.toolbars.GxtPathPanel;
import org.gcube.portlets.user.workspace.client.view.toolbars.GxtToolBarItemAccounting;
/**
@ -18,7 +19,7 @@ public class WorskpacePortlet {
private GxtBasicTabPanel basicTabContainer = null;
// private GxtToolBarFunctionsPanel toolbarPanelContainer = null;
private ExplorerPanel explorerPanel = null;
private GxtDetailsContainer detailsContainer;
private GxtToolBarItemAccounting toolBarItemDetails;
private GxtListView listViewContainer;
private GxtPathPanel toolBarPathPanel;
private GxtGridFilterGroupPanel gridFilterGroupContainer;
@ -34,10 +35,10 @@ public class WorskpacePortlet {
this.gridFilterGroupContainer = new GxtGridFilterGroupPanel(activeGroup);
this.listViewContainer = new GxtListView();
this.detailsContainer = new GxtDetailsContainer();
this.toolBarItemDetails = new GxtToolBarItemAccounting();
this.gxtCardLayoutResultPanel = new GxtCardLayoutResultPanel(gridFilterGroupContainer, listViewContainer, detailsContainer);
this.gxtCardLayoutResultPanel = new GxtCardLayoutResultPanel(gridFilterGroupContainer, listViewContainer, toolBarItemDetails);
}
@ -45,7 +46,7 @@ public class WorskpacePortlet {
this(activeGroup);
this.explorerPanel = expPanel;
this.borderLayoutContainer = new GxtBorderLayoutPanel(this.searchAndFilterContainer, this.explorerPanel, this.gxtCardLayoutResultPanel, this.detailsContainer);
this.borderLayoutContainer = new GxtBorderLayoutPanel(this.searchAndFilterContainer, this.explorerPanel, this.gxtCardLayoutResultPanel, this.toolBarItemDetails);
}
public GxtBorderLayoutPanel getBorderLayoutContainer() {
@ -56,8 +57,8 @@ public class WorskpacePortlet {
return basicTabContainer;
}
public GxtDetailsContainer getDetailsContainer() {
return detailsContainer;
public GxtToolBarItemAccounting getDetailsContainer() {
return toolBarItemDetails;
}
@ -83,4 +84,8 @@ public class WorskpacePortlet {
public GxtCardLayoutResultPanel getGxtCardLayoutResultPanel() {
return gxtCardLayoutResultPanel;
}
public GxtToolBarItemAccounting getToolBarItemDetails() {
return toolBarItemDetails;
}
}

View File

@ -3,6 +3,7 @@ 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;
import org.gcube.portlets.user.workspace.client.view.GxtDetailsContainer;
import org.gcube.portlets.user.workspace.client.view.toolbars.GxtToolBarItemAccounting;
import com.extjs.gxt.ui.client.Style.LayoutRegion;
import com.extjs.gxt.ui.client.Style.Scroll;
@ -26,7 +27,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
private ContentPanel center = new ContentPanel();
private ContentPanel east = new ContentPanel();
private ContentPanel south = new ContentPanel();
private GxtDetailsContainer detailsContainer = null;
private GxtToolBarItemAccounting toolBarItemDetails = null;
private ExplorerPanel expPanel = null; //TODO change position
private GxtSeachAndFilterPanel searchAndFilterContainer;
private GxtCardLayoutResultPanel gxtCardLayoutResultPanel;
@ -36,12 +37,12 @@ public class GxtBorderLayoutPanel extends ContentPanel {
GxtSeachAndFilterPanel searchAndFilterContainer2,
ExplorerPanel explorerPanel,
GxtCardLayoutResultPanel gxtCardLayoutResultPanel,
GxtDetailsContainer detailsContainer2) {
GxtToolBarItemAccounting detailsContainer2) {
this.searchAndFilterContainer = searchAndFilterContainer2;
this.expPanel = explorerPanel;
this.gxtCardLayoutResultPanel = gxtCardLayoutResultPanel;
this.detailsContainer = detailsContainer2;
this.toolBarItemDetails = detailsContainer2;
this.initLayout();
this.createLayouts();
@ -62,12 +63,14 @@ public class GxtBorderLayoutPanel extends ContentPanel {
north.setHeaderVisible(false);
west.setHeading(ConstantsPortlet.EXPLORER);
south.setHeading(ConstantsPortlet.DETAILS);
south.setHeading(ConstantsPortlet.DETAILS);
south.setHeaderVisible(false);
south.setLayout(new FitLayout());
east.setVisible(false);
south.setVisible(false);
// south.setVisible(false);
this.createLayouts();
}
@ -104,9 +107,9 @@ public class GxtBorderLayoutPanel extends ContentPanel {
eastData.setCollapsible(true);
eastData.setMargins(new Margins(0,0,0,1));
BorderLayoutData southData = new BorderLayoutData(LayoutRegion.SOUTH, 140,140,140);
BorderLayoutData southData = new BorderLayoutData(LayoutRegion.SOUTH, 30,30,30);
southData.setSplit(true);
southData.setCollapsible(true);
southData.setCollapsible(false);
southData.setMargins(new Margins(1, 0, 0, 0));
north.add(this.searchAndFilterContainer);
@ -116,7 +119,7 @@ public class GxtBorderLayoutPanel extends ContentPanel {
center.add(this.gxtCardLayoutResultPanel);
south.add(this.detailsContainer);
// south.add(this.toolBarItemDetails);
west.addListener(Events.Resize, new Listener<BoxComponentEvent>(){
@ -136,5 +139,6 @@ public class GxtBorderLayoutPanel extends ContentPanel {
add(west, westData);
add(center, centerData);
add(east, eastData);
// add(south, southData);
}
}

View File

@ -4,7 +4,8 @@ import org.gcube.portlets.user.workspace.client.ConstantsPortlet.ViewSwitchTypeI
import org.gcube.portlets.user.workspace.client.view.GxtDetailsContainer;
import org.gcube.portlets.user.workspace.client.view.GxtListView;
import org.gcube.portlets.user.workspace.client.view.grids.GxtGridFilterGroupPanel;
import org.gcube.portlets.user.workspace.client.view.toolbars.GxtToolBarItem;
import org.gcube.portlets.user.workspace.client.view.toolbars.GxtToolBarItemAccounting;
import org.gcube.portlets.user.workspace.client.view.toolbars.GxtToolBarItemFunctionality;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
@ -23,23 +24,24 @@ public class GxtCardLayoutResultPanel extends LayoutContainer{
private GxtListView iconsViewContainer;
private GxtGridFilterGroupPanel gridGroupViewContainer;
private ContentPanel activePanel = null;
private GxtToolBarItem toolBarItem;
private GxtToolBarItemFunctionality toolBarItemFunct;
private GxtToolBarItemAccounting toolBarItemDetails;
public GxtCardLayoutResultPanel(
GxtGridFilterGroupPanel gridFilterGroupContainer,
GxtListView listViewContainer,
GxtDetailsContainer detailsContainer) {
GxtToolBarItemAccounting toolBarItemDetails) {
this.iconsViewContainer = listViewContainer;
this.gridGroupViewContainer = gridFilterGroupContainer;
this.toolBarItemDetails = toolBarItemDetails;
instanceItemsPanel();
}
private void instanceItemsPanel(){
this.toolBarItem = new GxtToolBarItem(gridGroupViewContainer); //instance toolbar
this.itemPanel = new GxtItemsPanel(iconsViewContainer, gridGroupViewContainer, toolBarItem);
this.toolBarItemFunct = new GxtToolBarItemFunctionality(gridGroupViewContainer); //instance toolbar
this.itemPanel = new GxtItemsPanel(iconsViewContainer, gridGroupViewContainer, toolBarItemFunct, toolBarItemDetails);
}
@ -85,8 +87,8 @@ public class GxtCardLayoutResultPanel extends LayoutContainer{
}
public GxtToolBarItem getToolBarItem() {
return toolBarItem;
public GxtToolBarItemFunctionality getToolBarItem() {
return toolBarItemFunct;
}
public ContentPanel getActivePanel(){

View File

@ -2,7 +2,8 @@ package org.gcube.portlets.user.workspace.client.view.panels;
import org.gcube.portlets.user.workspace.client.view.GxtListView;
import org.gcube.portlets.user.workspace.client.view.grids.GxtGridFilterGroupPanel;
import org.gcube.portlets.user.workspace.client.view.toolbars.GxtToolBarItem;
import org.gcube.portlets.user.workspace.client.view.toolbars.GxtToolBarItemAccounting;
import org.gcube.portlets.user.workspace.client.view.toolbars.GxtToolBarItemFunctionality;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
@ -12,25 +13,49 @@ import com.extjs.gxt.ui.client.widget.layout.FitLayout;
*
*/
public class GxtItemsPanel extends ContentPanel{
private GxtToolBarItem toolBarItem;
private GxtToolBarItemFunctionality toolBarItemFunct;
private GxtListView iconsViewContainer;
private GxtGridFilterGroupPanel gridGroupViewContainer;
private GxtToolBarItemAccounting toolBarItemDetails;
public GxtItemsPanel(GxtListView iconsViewContainer, GxtGridFilterGroupPanel gridGroupViewContainer, GxtToolBarItem toolBarItem) {
public GxtItemsPanel(GxtListView iconsViewContainer, GxtGridFilterGroupPanel gridGroupViewContainer, GxtToolBarItemFunctionality toolBarItem, GxtToolBarItemAccounting toolBarItemDetails) {
this.iconsViewContainer = iconsViewContainer;
this.gridGroupViewContainer = gridGroupViewContainer;
this.toolBarItem = toolBarItem;
this.toolBarItemFunct = toolBarItem;
this.toolBarItemDetails = toolBarItemDetails;
setBorders(false);
setBodyBorder(false);
setHeaderVisible(false);
this.setLayout(new FitLayout());
setTopComponent(this.toolBarItem.getToolBar());
setTopComponent(this.toolBarItemFunct.getToolBar());
add(gridGroupViewContainer);
setBottomComponent(this.toolBarItemDetails);
}
public GxtToolBarItemFunctionality getToolBarItemFunct() {
return toolBarItemFunct;
}
public GxtListView getIconsViewContainer() {
return iconsViewContainer;
}
public GxtGridFilterGroupPanel getGridGroupViewContainer() {
return gridGroupViewContainer;
}
public GxtToolBarItemAccounting getToolBarItemDetails() {
return toolBarItemDetails;
}
}

View File

@ -0,0 +1,96 @@
package org.gcube.portlets.user.workspace.client.view.toolbars;
import org.gcube.portlets.user.workspace.client.AppController;
import org.gcube.portlets.user.workspace.client.event.AccountingHistoryEvent;
import org.gcube.portlets.user.workspace.client.event.AccountingReadersEvent;
import org.gcube.portlets.user.workspace.client.resources.Resources;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.Text;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class GxtToolBarItemAccounting extends ToolBar{
private TextField<String> txfName = new TextField<String>();
private Text txtOwner = new Text("Empty");
private Text txtCreationTime = new Text("Empty");
private Text txtDimension = new Text("Empty");
private Button bHistory;
private Button bRead;
public GxtToolBarItemAccounting(){
super();
initToolbar();
}
private void initToolbar(){
bHistory = new Button("History");
bHistory.setIcon(Resources.getIconHistory());
bHistory.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
AppController.getEventBus().fireEvent(new AccountingHistoryEvent(null));
}
});
bRead = new Button("Read");
bRead.setIcon(Resources.getIconNotRead());
bRead.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
AppController.getEventBus().fireEvent(new AccountingReadersEvent(null));
}
});
add(bHistory);
add(new SeparatorToolItem());
add(bRead);
}
public void resetDetails(){
this.txtDimension.setText("");
this.txtCreationTime.setText("");
this.txfName.reset();
this.txtOwner.setText("");
}
public void setDetails(String itemName, String description, String dimension, String creationTime, String owner){
this.resetDetails();
this.txtDimension.setText(dimension);
this.txtCreationTime.setText(creationTime);
this.txfName.setValue(itemName);
this.txtOwner.setText(owner);
}
/**
* @param markAsRead
*/
public void setRead(boolean markAsRead) {
if(markAsRead)
bRead.setIcon(Resources.getIconRead());
else
bRead.setIcon(Resources.getIconNotRead());
}
}

View File

@ -36,7 +36,7 @@ import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class GxtToolBarItem {
public class GxtToolBarItemFunctionality {
private Button btnAddFolder = null;
private Button btnRemoveItem = null;
@ -56,12 +56,12 @@ public class GxtToolBarItem {
private ToggleButton btnGridView;
private Button btnGetInfo;
public GxtToolBarItem() {
public GxtToolBarItemFunctionality() {
initToolBar();
addSelectionListenersOnToolBar();
}
public GxtToolBarItem(GxtGridFilterGroupPanel gridFilterGroupContainer) {
public GxtToolBarItemFunctionality(GxtGridFilterGroupPanel gridFilterGroupContainer) {
this();
this.gridGroupViewContainer = gridFilterGroupContainer;
}