diff --git a/src/main/java/org/gcube/portlets/user/td/openwidget/client/TabResourceInfoDialog.java b/src/main/java/org/gcube/portlets/user/td/openwidget/client/TabResourceInfoDialog.java new file mode 100644 index 0000000..fb986ab --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/openwidget/client/TabResourceInfoDialog.java @@ -0,0 +1,277 @@ +package org.gcube.portlets.user.td.openwidget.client; + +import java.util.ArrayList; +import java.util.Date; + +import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; +import org.gcube.portlets.user.td.gwtservice.shared.licenses.LicenceData; +import org.gcube.portlets.user.td.gwtservice.shared.share.Contacts; +import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; +import org.gcube.portlets.user.td.openwidget.client.custom.IconButton; +import org.gcube.portlets.user.td.openwidget.client.resources.ResourceBundleTDOpen; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; +import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3; + +import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.core.client.GWT; +import com.google.web.bindery.event.shared.EventBus; +import com.google.gwt.i18n.client.DateTimeFormat; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.sencha.gxt.core.client.util.Margins; +import com.sencha.gxt.widget.core.client.Dialog; +import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack; +import com.sencha.gxt.widget.core.client.container.MarginData; +import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; +import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData; +import com.sencha.gxt.widget.core.client.form.CheckBox; +import com.sencha.gxt.widget.core.client.form.DateField; +import com.sencha.gxt.widget.core.client.form.FieldLabel; +import com.sencha.gxt.widget.core.client.form.FieldSet; +import com.sencha.gxt.widget.core.client.form.TextArea; +import com.sencha.gxt.widget.core.client.form.TextField; + +/** + * + * @author giancarlo email: g.panichi@isti.cnr.it + * + */ +public class TabResourceInfoDialog extends Dialog { + private static final int HEIGHT = 500; + private static final int WIDTH = 500; + private DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd"); + private TabResource tabResource; + private TabResourcesInfoDialogPropertiesMessages msgs; + private EventBus eventBus; + private ArrayList licencesList; + + public TabResourceInfoDialog(TabResource tabResource, EventBus eventBus) { + this.tabResource = tabResource; + this.eventBus=eventBus; + this.msgs = GWT.create(TabResourcesInfoDialogPropertiesMessages.class); + initWindow(); + retrieveLicencesList(); + } + + protected void initWindow() { + setModal(true); + setHeadingText(msgs.tabResourceInfoDialogHeadingText()); + getHeader().setIcon(ResourceBundleTDOpen.INSTANCE.information()); + setPredefinedButtons(PredefinedButton.OK); + setHideOnButtonClick(true); + setButtonAlign(BoxLayoutPack.CENTER); + setWidth(WIDTH); + setHeight(HEIGHT); + + + } + + protected void create() { + FieldSet configurationFieldSet = new FieldSet(); + configurationFieldSet.setHeadingText(msgs.tabResourceDetailFieldSet()); + configurationFieldSet.setCollapsible(false); + configurationFieldSet.setBorders(true); + + VerticalLayoutContainer configurationFieldSetLayout = new VerticalLayoutContainer(); + configurationFieldSet.add(configurationFieldSetLayout, + new MarginData(0)); + + TextField trName = new TextField(); + trName.setValue(tabResource.getName()); + trName.setReadOnly(true); + FieldLabel trNameLabel = new FieldLabel(trName, msgs.nameLabel()); + configurationFieldSetLayout.add(trNameLabel, new VerticalLayoutData( + 1, -1, new Margins(0))); + + IconButton trBtnLock = new IconButton(); + if(tabResource.isLocked()){ + trBtnLock.setIcon(ResourceBundleTDOpen.INSTANCE.lock()); + } else { + trBtnLock.setIcon(ResourceBundleTDOpen.INSTANCE.lockOpen()); + } + + FieldLabel trLockLabel = new FieldLabel(trBtnLock, msgs.lockLabel()); + + configurationFieldSetLayout.add(trLockLabel, new VerticalLayoutData( + -1, -1, new Margins(0))); + + + TextArea trDescription = new TextArea(); + trDescription.setValue(tabResource.getDescription()); + trDescription.setReadOnly(true); + FieldLabel trDescriptionLabel = new FieldLabel(trDescription, + msgs.descriptionLabel()); + configurationFieldSetLayout.add(trDescriptionLabel, + new VerticalLayoutData(1, -1, new Margins(0))); + + + TextField trType = new TextField(); + trType.setValue(tabResource.getTabResourceType()); + trType.setReadOnly(true); + FieldLabel trTypeLabel = new FieldLabel(trType, msgs.typeLabel()); + configurationFieldSetLayout.add(trTypeLabel, new VerticalLayoutData( + 1, -1, new Margins(0))); + + TextField trAgency = new TextField(); + trAgency.setValue(tabResource.getAgency()); + trAgency.setReadOnly(true); + FieldLabel trAgencyLabel = new FieldLabel(trAgency, msgs.agencyLabel()); + configurationFieldSetLayout.add(trAgencyLabel, new VerticalLayoutData( + 1, -1, new Margins(0))); + + TextField trCreationDate = new TextField(); + trCreationDate.setValue(tabResource.getDate()); + trCreationDate.setReadOnly(true); + FieldLabel trCreationDateLabel = new FieldLabel(trCreationDate, + msgs.dateLabel()); + configurationFieldSetLayout.add(trCreationDateLabel, + new VerticalLayoutData(1, -1, new Margins(0))); + + + TextField trTableType = new TextField(); + trTableType.setValue(tabResource.getTableTypeName()); + trTableType.setReadOnly(true); + FieldLabel trTableTypeLabel = new FieldLabel(trTableType, msgs.tableTypeNameLabel()); + configurationFieldSetLayout.add(trTableTypeLabel, new VerticalLayoutData( + 1, -1, new Margins(0))); + + TextArea trRight = new TextArea(); + trRight.setValue(tabResource.getRight()); + trRight.setReadOnly(true); + FieldLabel trRightLabel = new FieldLabel(trRight, msgs.rightLabel()); + configurationFieldSetLayout.add(trRightLabel, new VerticalLayoutData( + 1, -1, new Margins(0))); + + DateField trValidFromField = new DateField(); + trValidFromField.setReadOnly(true); + FieldLabel trValidFromLabel=new FieldLabel(trValidFromField, msgs.validFromLabel()); + trValidFromField.clear(); + if (tabResource.getValidFrom() == null + || tabResource.getValidFrom().isEmpty()) { + Log.debug("ValidFrom null or empty"); + } else { + Date vFrom; + try { + vFrom = sdf.parse(tabResource.getValidFrom()); + trValidFromField.setValue(vFrom); + } catch (IllegalArgumentException e) { + Log.error("Error Parsing Valid From for Tabular Resource: " + + tabResource); + e.printStackTrace(); + } + } + configurationFieldSetLayout.add(trValidFromLabel, + new VerticalLayoutData(1, -1, new Margins(0))); + + + DateField trValidUntilToField = new DateField(); + trValidUntilToField.setReadOnly(true); + FieldLabel trValidUntilToLabel= new FieldLabel(trValidUntilToField, + msgs.validUntilToLabel()); + trValidUntilToField.clear(); + if (tabResource.getValidUntilTo() == null + || tabResource.getValidUntilTo().isEmpty()) { + Log.debug("ValidUntilTo null or empty"); + } else { + Date vUntilTo; + try { + vUntilTo = sdf.parse(tabResource.getValidUntilTo()); + trValidUntilToField.setValue(vUntilTo); + } catch (IllegalArgumentException e) { + Log.error("Error Parsing Valid Until To for Tabular Resource: " + + tabResource); + e.printStackTrace(); + } + } + configurationFieldSetLayout.add(trValidUntilToLabel, + new VerticalLayoutData(1, -1, new Margins(0))); + + String licence=""; + for(LicenceData licenceData:licencesList){ + if(licenceData.getLicenceId().compareTo(tabResource.getLicence())==0){ + licence=licenceData.getLicenceName(); + break; + } + } + + TextField trLicence = new TextField(); + trLicence.setValue(licence); + trLicence.setReadOnly(true); + FieldLabel trLicenceLabel = new FieldLabel(trLicence, msgs.licencesLabel()); + configurationFieldSetLayout.add(trLicenceLabel, new VerticalLayoutData( + 1, -1, new Margins(0))); + + + TextField trOwner = new TextField(); + trOwner.setValue(tabResource.getOwnerLogin()); + trOwner.setReadOnly(true); + FieldLabel trOwnerLabel = new FieldLabel(trOwner, msgs.ownerLabel()); + configurationFieldSetLayout.add(trOwnerLabel, new VerticalLayoutData( + 1, -1, new Margins(0))); + + + + IconButton trBtnShare = new IconButton(); + trBtnShare.setIcon(ResourceBundleTDOpen.INSTANCE.share()); + FieldLabel trShareLabel = new FieldLabel(trBtnShare, msgs.shareLabel()); + ArrayList contacts = tabResource.getContacts(); + if (contacts != null && contacts.size() > 0) { + trShareLabel.setVisible(true); + } else { + trShareLabel.setVisible(false); + } + configurationFieldSetLayout.add(trShareLabel, new VerticalLayoutData( + -1, -1, new Margins(0))); + + + CheckBox trValidField = new CheckBox(); + trValidField.setValue(tabResource.isValid()); + trValidField.setReadOnly(true); + FieldLabel trValidLabel=new FieldLabel(trValidField, msgs.validLabel()); + configurationFieldSetLayout.add(trValidLabel, new VerticalLayoutData( + -1, -1, new Margins(0))); + + + CheckBox trFinalizedField = new CheckBox(); + trFinalizedField.setValue(tabResource.isFinalized()); + trFinalizedField.setReadOnly(true); + FieldLabel trFinalizedLabel=new FieldLabel(trFinalizedField, msgs.finalizedLabel()); + configurationFieldSetLayout.add(trFinalizedLabel, new VerticalLayoutData( + -1, -1, new Margins(0))); + + add(configurationFieldSet, new MarginData(0)); + + } + + protected void retrieveLicencesList() { + TDGWTServiceAsync.INSTANCE + .getLicences(new AsyncCallback>() { + + public void onFailure(Throwable caught) { + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.error("Error retrieving licences:" + + caught.getLocalizedMessage()); + UtilsGXT3.alert("Error", + "Error retrieving licences."); + } + + } + + public void onSuccess(ArrayList result) { + Log.trace("loaded " + result.size() + " LicenceData"); + licencesList = result; + create(); + + } + + }); + + } + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/openwidget/client/TabResourcesInfoDialogPropertiesMessages.java b/src/main/java/org/gcube/portlets/user/td/openwidget/client/TabResourcesInfoDialogPropertiesMessages.java new file mode 100644 index 0000000..4a065f0 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/openwidget/client/TabResourcesInfoDialogPropertiesMessages.java @@ -0,0 +1,129 @@ +package org.gcube.portlets.user.td.openwidget.client; + +import com.google.gwt.i18n.client.Messages; + +/** + * + * @author giancarlo + * email: g.panichi@isti.cnr.it + * + */ +public interface TabResourcesInfoDialogPropertiesMessages extends Messages { + + @DefaultMessage("Tabular Resource Info") + String tabResourceInfoDialogHeadingText(); + + @DefaultMessage("Detail") + String tabResourceDetailFieldSet(); + + // + @DefaultMessage("Name") + String nameLabel(); + + @DefaultMessage("Lock") + String lockLabel(); + + @DefaultMessage("Name of tabular resource") + String nameLabelToolTip(); + + @DefaultMessage("Description") + String descriptionLabel(); + + @DefaultMessage("Description of tabular resource") + String descriptionLabelToolTip(); + + @DefaultMessage("Type") + String typeLabel(); + + @DefaultMessage("Type of tabular resource") + String typeLabelToolTip(); + + @DefaultMessage("Agency") + String agencyLabel(); + + @DefaultMessage("Agency") + String agencyLabelToolTip(); + + @DefaultMessage("Creation Date") + String dateLabel(); + + @DefaultMessage("Creation Date") + String dateLabelToolTip(); + + @DefaultMessage("Table Type") + String tableTypeNameLabel(); + + @DefaultMessage("Table Type") + String tableTypeNameLabelToolTip(); + + @DefaultMessage("Rights") + String rightLabel(); + + @DefaultMessage("Rights") + String rightLabelToolTip(); + + @DefaultMessage("Valid From") + String validFromLabel(); + + @DefaultMessage("Valid From") + String validFromLabelToolTip(); + + @DefaultMessage("Valid Until To") + String validUntilToLabel(); + + @DefaultMessage("Valid Until To") + String validUntilToLabelToolTip(); + + @DefaultMessage("Licence") + String licencesLabel(); + + @DefaultMessage("Licence") + String licencesLabelToolTip(); + + @DefaultMessage("Owner") + String ownerLabel(); + + @DefaultMessage("Owner") + String ownerLabelToolTip(); + + @DefaultMessage("Share") + String shareLabel(); + + @DefaultMessage("Share") + String shareLabelToolTip(); + + @DefaultMessage("Valid") + String validLabel(); + + @DefaultMessage("Valid") + String validLabelToolTip(); + + @DefaultMessage("Final") + String finalizedLabel(); + + @DefaultMessage("Final") + String finalizedLabelToolTip(); + + @DefaultMessage("Save") + String saveButton(); + + @DefaultMessage("Save") + String saveButtonToolTip(); + + @DefaultMessage("Validations") + String validationsButton(); + + @DefaultMessage("Validations") + String validationsButtonToolTip(); + + @DefaultMessage("Resources") + String resourcesButton(); + + @DefaultMessage("Resources") + String resourcesButtonToolTip(); + + + + + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/td/openwidget/client/TabResourcesSelectionPanel.java b/src/main/java/org/gcube/portlets/user/td/openwidget/client/TabResourcesSelectionPanel.java index 3da9342..3854c80 100644 --- a/src/main/java/org/gcube/portlets/user/td/openwidget/client/TabResourcesSelectionPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/openwidget/client/TabResourcesSelectionPanel.java @@ -82,7 +82,6 @@ public class TabResourcesSelectionPanel extends ContentPanel implements } - private Grid grid; private ResourceBundle res; private Menu contextMenu; @@ -105,7 +104,7 @@ public class TabResourcesSelectionPanel extends ContentPanel implements } try { buildPanel(); - + } catch (Throwable e) { Log.debug("Error building panel:" + e.getMessage()); e.printStackTrace(); @@ -132,10 +131,10 @@ public class TabResourcesSelectionPanel extends ContentPanel implements IdentityValueProvider identity = new IdentityValueProvider(); final CheckBoxSelectionModel sm = new CheckBoxSelectionModel( identity); - + TabResourcesProperties properties = GWT .create(TabResourcesProperties.class); - + final ExtendedListStore store = new ExtendedListStore( properties.id()); @@ -160,37 +159,28 @@ public class TabResourcesSelectionPanel extends ContentPanel implements store.setEnableFilters(true); - - - ColumnConfig nameColumn = new ColumnConfig( properties.name(), 90, "Name"); - - + /* - nameColumn.setCell( - new AbstractCell() { + * nameColumn.setCell( new AbstractCell() { + * + * @Override public void render(Context context, String value, + * SafeHtmlBuilder sb) { TabResource + * tabResource=store.get(context.getIndex()); + * + * final NameTooltipTemplates nameToolTipTemplates = GWT + * .create(NameTooltipTemplates.class); String valueSafe=""; String + * descriptionSafe=""; + * + * if(value!=null){ valueSafe=SafeHtmlUtils.htmlEscape(value); } + * if(tabResource!=null && tabResource.getAgency()!=null){ + * descriptionSafe=SafeHtmlUtils.htmlEscape(tabResource.getAgency()); } + * sb.append(nameToolTipTemplates.format(valueSafe, descriptionSafe)); + * + * } }); + */ - @Override - public void render(Context context, String value, SafeHtmlBuilder sb) { - TabResource tabResource=store.get(context.getIndex()); - - final NameTooltipTemplates nameToolTipTemplates = GWT - .create(NameTooltipTemplates.class); - String valueSafe=""; - String descriptionSafe=""; - - if(value!=null){ - valueSafe=SafeHtmlUtils.htmlEscape(value); - } - if(tabResource!=null && tabResource.getAgency()!=null){ - descriptionSafe=SafeHtmlUtils.htmlEscape(tabResource.getAgency()); - } - sb.append(nameToolTipTemplates.format(valueSafe, descriptionSafe)); - - } - });*/ - ColumnConfig typeColumn = new ColumnConfig( properties.tabResourceType(), 30, "Type"); ColumnConfig tableTypeNameColumn = new ColumnConfig( @@ -217,14 +207,14 @@ public class TabResourcesSelectionPanel extends ContentPanel implements } else { sb.appendHtmlConstant("true"); + + ResourceBundleTDOpen.INSTANCE.lockOpen() + .getSafeUri().asString() + "' alt='true'>"); } } }); - - List> columns=new ArrayList>(); + + List> columns = new ArrayList>(); columns.add(nameColumn); columns.add(typeColumn); columns.add(tableTypeNameColumn); @@ -232,11 +222,9 @@ public class TabResourcesSelectionPanel extends ContentPanel implements columns.add(ownerColumn); columns.add(agencyColumn); columns.add(dateColumn); - + ColumnModel cm = new ColumnModel(columns); - - RpcProxy> proxy = new RpcProxy>() { public void load(ListLoadConfig loadConfig, @@ -262,9 +250,6 @@ public class TabResourcesSelectionPanel extends ContentPanel implements }); } }; - - - sm.setSelectionMode(SelectionMode.SINGLE); grid.setLoader(loader); @@ -337,6 +322,71 @@ public class TabResourcesSelectionPanel extends ContentPanel implements }); contextMenu.add(deleteTRItem); + MenuItem infoItem = new MenuItem(); + infoItem.setText("Info"); + infoItem.setIcon(ResourceBundleTDOpen.INSTANCE.information()); + infoItem.addSelectionHandler(new SelectionHandler() { + + @Override + public void onSelection(SelectionEvent event) { + if (grid != null) { + TabResource tabResource = getSelectedItem(); + requestInfo(tabResource); + } + + } + }); + + contextMenu.add(infoItem); + + } + + protected void openInfoDialog(TabResource tabResource) { + final TabResourceInfoDialog tabResourceInfoDialog = new TabResourceInfoDialog( + tabResource, parent.getEventBus()); + tabResourceInfoDialog.show(); + } + + protected void requestInfo(TabResource tabResource) { + if(tabResource.isLocked()){ + UtilsGXT3.alert("Attention", "Tabular Resource is locked no info available!"); + return; + } + + TDGWTServiceAsync.INSTANCE.getTabResourceInformation( + tabResource.getTrId(), new AsyncCallback() { + + public void onSuccess(TabResource result) { + Log.info("Retrived TR: " + result.getTrId()); + openInfoDialog(result); + } + + public void onFailure(Throwable caught) { + if (caught instanceof TDGWTSessionExpiredException) { + parent.getEventBus() + .fireEvent( + new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + if (caught instanceof TDGWTIsLockedException) { + Log.error("Tabular Resource is Locked: " + + caught.getLocalizedMessage()); + parent.showErrorAndHide("Error", + caught.getLocalizedMessage(), "", caught); + + + } else { + Log.error("Error: " + + caught.getLocalizedMessage()); + parent.showErrorAndHide("Error", + caught.getLocalizedMessage(), "", caught); + + } + + } + } + + }); } protected boolean select(TabResource item, String searchTerm) { @@ -377,9 +427,8 @@ public class TabResourcesSelectionPanel extends ContentPanel implements } else { Log.error("Error retrieving tabular resource: " + caught.getLocalizedMessage()); - parent.showErrorAndHide( - "Error", - caught.getLocalizedMessage(),"", caught); + parent.showErrorAndHide("Error", + caught.getLocalizedMessage(), "", caught); } callback.onFailure(caught); } @@ -389,9 +438,9 @@ public class TabResourcesSelectionPanel extends ContentPanel implements + " TabularResources"); ArrayList avaibles = new ArrayList(); for (TabResource tResource : result) { - //if (!tResource.isLocked()) { + // if (!tResource.isLocked()) { avaibles.add(tResource); - //} + // } } /* @@ -486,7 +535,7 @@ public class TabResourcesSelectionPanel extends ContentPanel implements Log.error("Error on delete TabResource: " + caught.getLocalizedMessage()); UtilsGXT3.alert("Error", - caught.getLocalizedMessage()); + caught.getLocalizedMessage()); } } } diff --git a/src/main/java/org/gcube/portlets/user/td/openwidget/client/custom/DefaultAppearance.java b/src/main/java/org/gcube/portlets/user/td/openwidget/client/custom/DefaultAppearance.java new file mode 100644 index 0000000..bdd9878 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/openwidget/client/custom/DefaultAppearance.java @@ -0,0 +1,75 @@ +package org.gcube.portlets.user.td.openwidget.client.custom; + + +import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Element; +import com.google.gwt.resources.client.ClientBundle; +import com.google.gwt.resources.client.CssResource; +import com.google.gwt.resources.client.ImageResource; +import com.google.gwt.safehtml.shared.SafeHtml; +import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.google.gwt.user.client.ui.Image; +import com.sencha.gxt.core.client.XTemplates; +import com.sencha.gxt.core.client.dom.XElement; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class DefaultAppearance implements IconButtonAppearance { + + public interface Template extends XTemplates { + @XTemplate(source = "IconButton.html") + SafeHtml template(IconButtonStyle style); + } + + public interface IconButtonStyle extends CssResource { + @ClassName("iconButton") + public String getIconButton(); + + @ClassName("iconButtonImage") + public String getIconButtonImage(); + + @ClassName("iconButtonRef") + public String getIconButtonRef(); + + } + + private final IconButtonStyle style; + private final Template template; + + public interface IconButtonResources extends ClientBundle { + public static final IconButtonResources INSTANCE = GWT.create(IconButtonResources.class); + + @Source("IconButtonStyle.css") + IconButtonStyle style(); + } + + public DefaultAppearance() { + this(IconButtonResources.INSTANCE); + } + + public DefaultAppearance(IconButtonResources resources) { + this.style = resources.style(); + this.style.ensureInjected(); + + this.template = GWT.create(Template.class); + } + + + + public void onUpdateIcon(XElement parent, ImageResource icon) { + XElement element = parent.selectNode("." + style.getIconButtonImage()); + Image image=new Image(icon); + Element img=image.getElement(); + img.setClassName(style.getIconButtonRef()); + element.appendChild(img); + + } + + public void render(SafeHtmlBuilder sb) { + sb.append(template.template(style)); + } +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/td/openwidget/client/custom/IconButton.html b/src/main/java/org/gcube/portlets/user/td/openwidget/client/custom/IconButton.html new file mode 100644 index 0000000..9b36b96 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/openwidget/client/custom/IconButton.html @@ -0,0 +1,4 @@ + +
+
+
\ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/td/openwidget/client/custom/IconButton.java b/src/main/java/org/gcube/portlets/user/td/openwidget/client/custom/IconButton.java new file mode 100644 index 0000000..531c53c --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/openwidget/client/custom/IconButton.java @@ -0,0 +1,50 @@ +package org.gcube.portlets.user.td.openwidget.client.custom; + + +import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Element; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.dom.client.HasClickHandlers; +import com.google.gwt.event.shared.HandlerRegistration; +import com.google.gwt.resources.client.ImageResource; +import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.google.gwt.user.client.Event; +import com.sencha.gxt.core.client.dom.XDOM; +import com.sencha.gxt.core.client.dom.XElement; +import com.sencha.gxt.widget.core.client.Component; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public class IconButton extends Component implements HasClickHandlers { + + private IconButtonAppearance appearance; + + public IconButton() { + this((IconButtonAppearance) GWT.create(DefaultAppearance.class)); + } + + public IconButton(IconButtonAppearance appearance) { + this.appearance = appearance; + + SafeHtmlBuilder sb = new SafeHtmlBuilder(); + this.appearance.render(sb); + + XElement element=XDOM.create(sb.toSafeHtml()); + setElement((Element)element); + sinkEvents(Event.ONCLICK); + } + + public HandlerRegistration addClickHandler(ClickHandler handler) { + return addDomHandler(handler, ClickEvent.getType()); + } + + + public void setIcon(ImageResource icon) { + appearance.onUpdateIcon(getElement(), icon); + } +} diff --git a/src/main/java/org/gcube/portlets/user/td/openwidget/client/custom/IconButtonAppearance.java b/src/main/java/org/gcube/portlets/user/td/openwidget/client/custom/IconButtonAppearance.java new file mode 100644 index 0000000..0ab89f9 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/openwidget/client/custom/IconButtonAppearance.java @@ -0,0 +1,16 @@ +package org.gcube.portlets.user.td.openwidget.client.custom; + +import com.google.gwt.resources.client.ImageResource; +import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.sencha.gxt.core.client.dom.XElement; + +/** + * + * @author "Giancarlo Panichi" + * g.panichi@isti.cnr.it + * + */ +public interface IconButtonAppearance { + void render(SafeHtmlBuilder sb); + void onUpdateIcon(XElement parent, ImageResource icon); +} diff --git a/src/main/java/org/gcube/portlets/user/td/openwidget/client/custom/IconButtonStyle.css b/src/main/java/org/gcube/portlets/user/td/openwidget/client/custom/IconButtonStyle.css new file mode 100644 index 0000000..354f7dc --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/openwidget/client/custom/IconButtonStyle.css @@ -0,0 +1,17 @@ +@CHARSET "UTF-8"; + +.iconButton { + border: none; + font-size: 12px; + margin: 0px; + padding: 0px; +} + +.iconButton .iconButtonImage { + vertical-align: center; +} + +.iconButtonRef { + vertical-align: center; + cursor: pointer; +} diff --git a/src/main/java/org/gcube/portlets/user/td/openwidget/client/resources/ResourceBundleTDOpen.java b/src/main/java/org/gcube/portlets/user/td/openwidget/client/resources/ResourceBundleTDOpen.java index ac03cad..4231c31 100644 --- a/src/main/java/org/gcube/portlets/user/td/openwidget/client/resources/ResourceBundleTDOpen.java +++ b/src/main/java/org/gcube/portlets/user/td/openwidget/client/resources/ResourceBundleTDOpen.java @@ -3,6 +3,7 @@ package org.gcube.portlets.user.td.openwidget.client.resources; import com.google.gwt.core.client.GWT; import com.google.gwt.resources.client.ClientBundle; import com.google.gwt.resources.client.ImageResource; +import com.google.gwt.resources.client.ClientBundle.Source; /** * @@ -33,8 +34,17 @@ public interface ResourceBundleTDOpen extends ClientBundle { @Source("lock-open-green_32.png") ImageResource lockOpen32(); + @Source("page-white-share.png") + ImageResource share(); + @Source("page-white-share_32.png") + ImageResource share32(); + @Source("information.png") + ImageResource information(); + + @Source("information_32.png") + ImageResource information32(); } \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/td/openwidget/client/resources/information.png b/src/main/java/org/gcube/portlets/user/td/openwidget/client/resources/information.png new file mode 100644 index 0000000..fd2adea Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/td/openwidget/client/resources/information.png differ diff --git a/src/main/java/org/gcube/portlets/user/td/openwidget/client/resources/information_32.png b/src/main/java/org/gcube/portlets/user/td/openwidget/client/resources/information_32.png new file mode 100644 index 0000000..95e0dd3 Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/td/openwidget/client/resources/information_32.png differ diff --git a/src/main/java/org/gcube/portlets/user/td/openwidget/client/resources/page-white-share.png b/src/main/java/org/gcube/portlets/user/td/openwidget/client/resources/page-white-share.png new file mode 100644 index 0000000..13c4a51 Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/td/openwidget/client/resources/page-white-share.png differ diff --git a/src/main/java/org/gcube/portlets/user/td/openwidget/client/resources/page-white-share_32.png b/src/main/java/org/gcube/portlets/user/td/openwidget/client/resources/page-white-share_32.png new file mode 100644 index 0000000..0080258 Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/td/openwidget/client/resources/page-white-share_32.png differ diff --git a/src/main/resources/org/gcube/portlets/user/td/openwidget/client/Messages.properties b/src/main/resources/org/gcube/portlets/user/td/openwidget/client/Messages.properties deleted file mode 100644 index c222555..0000000 --- a/src/main/resources/org/gcube/portlets/user/td/openwidget/client/Messages.properties +++ /dev/null @@ -1,2 +0,0 @@ -sendButton = Send -nameField = Enter your name \ No newline at end of file diff --git a/src/main/resources/org/gcube/portlets/user/td/openwidget/client/Messages_fr.properties b/src/main/resources/org/gcube/portlets/user/td/openwidget/client/Messages_fr.properties deleted file mode 100644 index b4a7627..0000000 --- a/src/main/resources/org/gcube/portlets/user/td/openwidget/client/Messages_fr.properties +++ /dev/null @@ -1,2 +0,0 @@ -sendButton = Envoyer -nameField = Entrez votre nom \ No newline at end of file diff --git a/src/main/resources/org/gcube/portlets/user/td/openwidget/client/TabResourcesInfoDialogPropertiesMessages.properties b/src/main/resources/org/gcube/portlets/user/td/openwidget/client/TabResourcesInfoDialogPropertiesMessages.properties new file mode 100644 index 0000000..b8f4057 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/openwidget/client/TabResourcesInfoDialogPropertiesMessages.properties @@ -0,0 +1,37 @@ +tabResourceInfoDialogHeadingText = Tabular Resource Info +tabResourceDetailFieldSet = Detail +nameLabel = Name +lockLabel = Lock +nameLabelToolTip = Name of tabular resource +descriptionLabel = Description +descriptionLabelToolTip = Description of tabular resource +typeLabel = Type +typeLabelToolTip = Type of tabular resource +agencyLabel = Agency +agencyLabelToolTip = Agency +dateLabel = Creation Date +dateLabelToolTip = Creation Date +tableTypeNameLabel = Table Type +tableTypeNameLabelToolTip = Table Type +rightLabel = Rights +rightLabelToolTip = Rights +validFromLabel = Valid From +validFromLabelToolTip = Valid From +validUntilToLabel = Valid Until To +validUntilToLabelToolTip = Valid Until To +licencesLabel = Licence +licencesLabelToolTip = Licence +ownerLabel = Owner +ownerLabelToolTip = Owner +shareLabel = Share +shareLabelToolTip = Share +validLabel = Valid +validLabelToolTip = Valid +finalizedLabel = Final +finalizedLabelToolTip = Final +saveButton = Save +saveButtonToolTip = Save +validationsButton = Validations +validationsButtonToolTip = Validations +resourcesButton = Resources +resourcesButtonToolTip = Resources \ No newline at end of file diff --git a/src/main/resources/org/gcube/portlets/user/td/openwidget/client/TabResourcesInfoDialogPropertiesMessages_es.properties b/src/main/resources/org/gcube/portlets/user/td/openwidget/client/TabResourcesInfoDialogPropertiesMessages_es.properties new file mode 100644 index 0000000..af3c871 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/openwidget/client/TabResourcesInfoDialogPropertiesMessages_es.properties @@ -0,0 +1,37 @@ +tabResourceInfoDialogHeadingText = Tabular Resource Información +tabResourceDetailFieldSet = Detalle +nameLabel = Nombre +lockLabel = Lock +nameLabelToolTip = Nombre de la tabular resource +descriptionLabel = Descripción +descriptionLabelToolTip = Descripción de la tabular resource +typeLabel = Tipo +typeLabelToolTip = Tipo de tabular resource +agencyLabel = Agencia +agencyLabelToolTip = Agencia +dateLabel = Fecha Creacion +dateLabelToolTip = Fecha Creacion +tableTypeNameLabel = Tipo Tabla +tableTypeNameLabelToolTip = Tipo Tabla +rightLabel = Derechos +rightLabelToolTip = Derechos +validFromLabel = Válida Desde +validFromLabelToolTip = Válida Desde +validUntilToLabel = Válido Hasta +validUntilToLabelToolTip = Válido Hasta +licencesLabel = Licencia +licencesLabelToolTip = Licencia +ownerLabel = Propietario +ownerLabelToolTip = Propietario +shareLabel = Cuota +shareLabelToolTip = Cuota +validLabel = Válido +validLabelToolTip = Válido +finalizedLabel = Final +finalizedLabelToolTip = Final +saveButton = Guardar +saveButtonToolTip = Guardar +validationsButton = Validaciones +validationsButtonToolTip = Validaciones +resourcesButton = Recursos +resourcesButtonToolTip = Recursos \ No newline at end of file diff --git a/src/main/resources/org/gcube/portlets/user/td/openwidget/client/TabResourcesInfoDialogPropertiesMessages_it.properties b/src/main/resources/org/gcube/portlets/user/td/openwidget/client/TabResourcesInfoDialogPropertiesMessages_it.properties new file mode 100644 index 0000000..f53db87 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/openwidget/client/TabResourcesInfoDialogPropertiesMessages_it.properties @@ -0,0 +1,37 @@ +tabResourceInfoDialogHeadingText = Tabular Resource Informazioni +tabResourceDetailFieldSet = Dettagli +nameLabel = Nome +lockLabel = Lock +nameLabelToolTip = Nome della tabular resource +descriptionLabel = Descrizione +descriptionLabelToolTip = Descrizione della tabular resource +typeLabel = Tipo +typeLabelToolTip = Tipo di tabular resource +agencyLabel = Agenzia +agencyLabelToolTip = Agenzia +dateLabel = Data Creazione +dateLabelToolTip = Data Creazione +tableTypeNameLabel = Tipo Tabella +tableTypeNameLabelToolTip = Tipo Tabella +rightLabel = Diritti +rightLabelToolTip = Diritti +validFromLabel = Valida Da +validFromLabelToolTip = Valida Da +validUntilToLabel = Valida Fino Al +validUntilToLabelToolTip = Valida Fino Al +licencesLabel = Licenza +licencesLabelToolTip = Licenza +ownerLabel = Proprietario +ownerLabelToolTip = Proprietario +shareLabel = Condivisione +shareLabelToolTip = Condivisione +validLabel = Valida +validLabelToolTip = Valida +finalizedLabel = Finale +finalizedLabelToolTip = Finale +saveButton = Salva +saveButtonToolTip = Salva +validationsButton = Validazioni +validationsButtonToolTip = Validazioni +resourcesButton = Risorse +resourcesButtonToolTip = Risorse \ No newline at end of file diff --git a/src/main/resources/org/gcube/portlets/user/td/openwidget/client/custom/IconButton.html b/src/main/resources/org/gcube/portlets/user/td/openwidget/client/custom/IconButton.html new file mode 100644 index 0000000..9b36b96 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/openwidget/client/custom/IconButton.html @@ -0,0 +1,4 @@ + +
+
+
\ No newline at end of file diff --git a/src/main/resources/org/gcube/portlets/user/td/openwidget/client/custom/IconButtonStyle.css b/src/main/resources/org/gcube/portlets/user/td/openwidget/client/custom/IconButtonStyle.css new file mode 100644 index 0000000..354f7dc --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/openwidget/client/custom/IconButtonStyle.css @@ -0,0 +1,17 @@ +@CHARSET "UTF-8"; + +.iconButton { + border: none; + font-size: 12px; + margin: 0px; + padding: 0px; +} + +.iconButton .iconButtonImage { + vertical-align: center; +} + +.iconButtonRef { + vertical-align: center; + cursor: pointer; +} diff --git a/src/main/resources/org/gcube/portlets/user/td/openwidget/client/resources/information.png b/src/main/resources/org/gcube/portlets/user/td/openwidget/client/resources/information.png new file mode 100644 index 0000000..fd2adea Binary files /dev/null and b/src/main/resources/org/gcube/portlets/user/td/openwidget/client/resources/information.png differ diff --git a/src/main/resources/org/gcube/portlets/user/td/openwidget/client/resources/information_32.png b/src/main/resources/org/gcube/portlets/user/td/openwidget/client/resources/information_32.png new file mode 100644 index 0000000..95e0dd3 Binary files /dev/null and b/src/main/resources/org/gcube/portlets/user/td/openwidget/client/resources/information_32.png differ diff --git a/src/main/resources/org/gcube/portlets/user/td/openwidget/client/resources/page-white-share.png b/src/main/resources/org/gcube/portlets/user/td/openwidget/client/resources/page-white-share.png new file mode 100644 index 0000000..13c4a51 Binary files /dev/null and b/src/main/resources/org/gcube/portlets/user/td/openwidget/client/resources/page-white-share.png differ diff --git a/src/main/resources/org/gcube/portlets/user/td/openwidget/client/resources/page-white-share_32.png b/src/main/resources/org/gcube/portlets/user/td/openwidget/client/resources/page-white-share_32.png new file mode 100644 index 0000000..0080258 Binary files /dev/null and b/src/main/resources/org/gcube/portlets/user/td/openwidget/client/resources/page-white-share_32.png differ