diff --git a/src/main/java/org/gcube/portlets/widgets/wsexplorer/client/view/gcubeitem/DialogShowGcubeItem.java b/src/main/java/org/gcube/portlets/widgets/wsexplorer/client/view/gcubeitem/DialogShowGcubeItem.java index 032a4e6..3d5112c 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsexplorer/client/view/gcubeitem/DialogShowGcubeItem.java +++ b/src/main/java/org/gcube/portlets/widgets/wsexplorer/client/view/gcubeitem/DialogShowGcubeItem.java @@ -5,10 +5,12 @@ package org.gcube.portlets.widgets.wsexplorer.client.view.gcubeitem; import java.util.Map; +import org.gcube.portlets.widgets.wsexplorer.client.Util; import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerConstants; import org.gcube.portlets.widgets.wsexplorer.client.resources.WorkspaceExplorerResources; import org.gcube.portlets.widgets.wsexplorer.shared.Item; +import com.google.gwt.core.shared.GWT; import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; @@ -38,23 +40,27 @@ public class DialogShowGcubeItem extends DialogBox implements ClickHandler { private DockPanel dock = new DockPanel(); private Button yesButton; - private VerticalPanel vpContainer; + private VerticalPanel vpCenterContainer; private ImageResource loading = WorkspaceExplorerResources.ICONS.loading(); private HorizontalPanel hpButtons = new HorizontalPanel(); - /** * Instantiates a new dialog show gcube items related to WorkspaceItemId. * * @param caption the caption * @param text the text * @param item the worksapce item id + * @param autoHide the auto hide */ - public DialogShowGcubeItem(String caption, String text, Item item) { + public DialogShowGcubeItem(String caption, String text, Item item, boolean autoHide) { getElement().setClassName("gwt-DialogBoxNew"); dock.setSpacing(4); dock.setWidth("100%"); - setText(caption); + + String title = Util.ellipsis(caption, 70, false); + setText(title); + setTitle(caption); + setAutoHideEnabled(autoHide); yesButton = new Button("Ok"); yesButton.addClickHandler(new ClickHandler() { @@ -65,9 +71,9 @@ public class DialogShowGcubeItem extends DialogBox implements ClickHandler { } }); - vpContainer = new VerticalPanel(); + vpCenterContainer = new VerticalPanel(); // vpContainer.getElement().getStyle().setMargin(5.0, Unit.PX); - vpContainer.add(new HTML(text)); + vpCenterContainer.add(new HTML(text)); hpButtons = new HorizontalPanel(); hpButtons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); hpButtons.setSpacing(3); @@ -77,31 +83,31 @@ public class DialogShowGcubeItem extends DialogBox implements ClickHandler { dock.add(hpButtons, DockPanel.SOUTH); dock.setCellHorizontalAlignment(hpButtons, DockPanel.ALIGN_CENTER); - dock.add(vpContainer, DockPanel.CENTER); + dock.add(vpCenterContainer, DockPanel.CENTER); setWidget(dock); - if(item.getGcubeProperties()!=null){ + /*if(item.getGcubeProperties()!=null){ FlexTable table = buildGcubeItemView(item.getGcubeProperties()); addToCenterPanel(table); - }else{ - addLoader("Re-loading Gcube Properties Info..."); + }else{*/ + showLoader("Loading Gcube Properties..."); WorkspaceExplorerConstants.workspaceNavigatorService.getGcubePropertiesForWorspaceId(item.getId(), new AsyncCallback>() { @Override public void onSuccess(Map result) { FlexTable table = buildGcubeItemView(result); - removeLoader(); + clearCenterContainer(); addToCenterPanel(table); } @Override public void onFailure(Throwable caught) { - removeLoader(); + clearCenterContainer(); } }); - } + //} } /** @@ -127,13 +133,14 @@ public class DialogShowGcubeItem extends DialogBox implements ClickHandler { table.setHTML(0, 2, "Value"); table.getRowFormatter().getElement(0).addClassName("gcube-item-table-header"); - int i = 0; + int index = 1; + GWT.log("Properties are: "+map.keySet().size()); for (String key : map.keySet()) { String value = map.get(key); - int index = i+1; - table.setHTML(index, 0, index+"-"); + table.setHTML(index, 0, index+""); table.setHTML(index, 1, key); table.setHTML(index, 2, value); + index++; } return table; @@ -152,32 +159,30 @@ public class DialogShowGcubeItem extends DialogBox implements ClickHandler { } + /** - * Adds the loader. + * Show loader. * * @param message the message */ - private void addLoader(String message){ - try{ - dock.remove(hpButtons); - }catch(Exception e){} - vpContainer.clear(); + private void showLoader(String message){ + vpCenterContainer.clear(); HorizontalPanel hpMask = new HorizontalPanel(); hpMask.add(new Image(loading)); HTML html = new HTML(message); html.getElement().getStyle().setMarginLeft(5, Unit.PX); hpMask.add(html); - vpContainer.add(hpMask); + vpCenterContainer.add(hpMask); } + /** - * Removes the loader. + * Clear center container. */ - private void removeLoader(){ + private void clearCenterContainer(){ try{ - dock.add(hpButtons); + vpCenterContainer.clear(); }catch(Exception e){} - vpContainer.clear(); } /** @@ -186,7 +191,7 @@ public class DialogShowGcubeItem extends DialogBox implements ClickHandler { * @param w the w */ public void addToCenterPanel(Widget w) { - vpContainer.add(w); + vpCenterContainer.add(w); } /** diff --git a/src/main/java/org/gcube/portlets/widgets/wsexplorer/client/view/grid/ItemsTable.java b/src/main/java/org/gcube/portlets/widgets/wsexplorer/client/view/grid/ItemsTable.java index 82b0971..0122ce5 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsexplorer/client/view/grid/ItemsTable.java +++ b/src/main/java/org/gcube/portlets/widgets/wsexplorer/client/view/grid/ItemsTable.java @@ -145,7 +145,7 @@ public class ItemsTable extends AbstractItemsCellTable implem }; icon.setSortable(false); cellTable.addColumn(icon, ""); - cellTable.setColumnWidth(icon, 10.0, Unit.PCT); + cellTable.setColumnWidth(icon, 25.0, Unit.PX); } if(this.displayFields.contains(DISPLAY_FIELD.NAME)){ @@ -307,41 +307,16 @@ public class ItemsTable extends AbstractItemsCellTable implem super.onBrowserEvent(context, elem, object, event); if ("click".equals(event.getType())) { Item item = object; - DialogShowGcubeItem dg = new DialogShowGcubeItem("Gcube Properties for: "+item.getName(), null, item); - dg.setPopupPosition(event.getClientX(), event.getClientY()); - dg.show(); + DialogShowGcubeItem dg = new DialogShowGcubeItem("Gcube Properties for: "+item.getName(), null, item, true); +// dg.setPopupPosition(event.getClientX()-Integer.parseInt(dg.getElement().getStyle().getWidth()), event.getClientY()); + dg.center(); } } }; - /*Column showGcubeInfoClm = new Column(showGcubeInfo) { - @Override - public ImageResource getValue(T dataObj) { - return info; - } - - - @Override - public void render(Context context, T object, SafeHtmlBuilder sb) { - super.render(context, object, sb); - } - - - @Override - public void onBrowserEvent(Context context, Element elem, T object, NativeEvent event) { - - super.onBrowserEvent(context, elem, object, event); - if ("click".equals(event.getType())) { - Item item = object; - DialogShowGcubeItem dg = new DialogShowGcubeItem("Gcube Properties for: "+item.getName(), null, item); - dg.show(); - } - } - };*/ - showGcubeInfoClm.setSortable(false); cellTable.addColumn(showGcubeInfoClm, ""); - cellTable.setColumnWidth(showGcubeInfoClm, 10.0, Unit.PCT); + cellTable.setColumnWidth(showGcubeInfoClm, 32.0, Unit.PX); } /*final SingleSelectionModel selectionModel = new SingleSelectionModel(); diff --git a/src/main/java/org/gcube/portlets/widgets/wsexplorer/resources/css/gwt-bootstrap.css b/src/main/java/org/gcube/portlets/widgets/wsexplorer/resources/css/gwt-bootstrap.css index 7434ae4..145f484 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsexplorer/resources/css/gwt-bootstrap.css +++ b/src/main/java/org/gcube/portlets/widgets/wsexplorer/resources/css/gwt-bootstrap.css @@ -171,19 +171,20 @@ } .gcube-item-table{ - margin: 5px; + margin-top: 10px; + margin-bottom: 10px; } .gcube-item-table td{ - border-bottom: 1px solid #EEE; + border-bottom: 1px solid #EEEEEE; height: 50%; - vertical-align: middle; text-align: center; + vertical-align: middle; + padding: 5px; } - .gcube-item-table-header{ - background-color: #dedede; text-align: center; + font-weight: bold; } /******* END TABLE ********/ \ No newline at end of file