Added Tabular Resource Information Dialog
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-open-widget@115366 82a268e6-3cf1-43bd-a215-b396298e98cf
|
@ -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: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
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<LicenceData> 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> 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<ArrayList<LicenceData>>() {
|
||||||
|
|
||||||
|
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<LicenceData> result) {
|
||||||
|
Log.trace("loaded " + result.size() + " LicenceData");
|
||||||
|
licencesList = result;
|
||||||
|
create();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,129 @@
|
||||||
|
package org.gcube.portlets.user.td.openwidget.client;
|
||||||
|
|
||||||
|
import com.google.gwt.i18n.client.Messages;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
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();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -82,7 +82,6 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private Grid<TabResource> grid;
|
private Grid<TabResource> grid;
|
||||||
private ResourceBundle res;
|
private ResourceBundle res;
|
||||||
private Menu contextMenu;
|
private Menu contextMenu;
|
||||||
|
@ -160,36 +159,27 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
|
|
||||||
store.setEnableFilters(true);
|
store.setEnableFilters(true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ColumnConfig<TabResource, String> nameColumn = new ColumnConfig<TabResource, String>(
|
ColumnConfig<TabResource, String> nameColumn = new ColumnConfig<TabResource, String>(
|
||||||
properties.name(), 90, "Name");
|
properties.name(), 90, "Name");
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
nameColumn.setCell(
|
* nameColumn.setCell( new AbstractCell<String>() {
|
||||||
new AbstractCell<String>() {
|
*
|
||||||
|
* @Override public void render(Context context, String value,
|
||||||
@Override
|
* SafeHtmlBuilder sb) { TabResource
|
||||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
* tabResource=store.get(context.getIndex());
|
||||||
TabResource tabResource=store.get(context.getIndex());
|
*
|
||||||
|
* final NameTooltipTemplates nameToolTipTemplates = GWT
|
||||||
final NameTooltipTemplates nameToolTipTemplates = GWT
|
* .create(NameTooltipTemplates.class); String valueSafe=""; String
|
||||||
.create(NameTooltipTemplates.class);
|
* descriptionSafe="";
|
||||||
String valueSafe="";
|
*
|
||||||
String descriptionSafe="";
|
* if(value!=null){ valueSafe=SafeHtmlUtils.htmlEscape(value); }
|
||||||
|
* if(tabResource!=null && tabResource.getAgency()!=null){
|
||||||
if(value!=null){
|
* descriptionSafe=SafeHtmlUtils.htmlEscape(tabResource.getAgency()); }
|
||||||
valueSafe=SafeHtmlUtils.htmlEscape(value);
|
* sb.append(nameToolTipTemplates.format(valueSafe, descriptionSafe));
|
||||||
}
|
*
|
||||||
if(tabResource!=null && tabResource.getAgency()!=null){
|
* } });
|
||||||
descriptionSafe=SafeHtmlUtils.htmlEscape(tabResource.getAgency());
|
*/
|
||||||
}
|
|
||||||
sb.append(nameToolTipTemplates.format(valueSafe, descriptionSafe));
|
|
||||||
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
|
|
||||||
ColumnConfig<TabResource, String> typeColumn = new ColumnConfig<TabResource, String>(
|
ColumnConfig<TabResource, String> typeColumn = new ColumnConfig<TabResource, String>(
|
||||||
properties.tabResourceType(), 30, "Type");
|
properties.tabResourceType(), 30, "Type");
|
||||||
|
@ -217,8 +207,8 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
sb.appendHtmlConstant("<img style='margin:auto;padding:auto;display:block;' src='"
|
sb.appendHtmlConstant("<img style='margin:auto;padding:auto;display:block;' src='"
|
||||||
+ ResourceBundleTDOpen.INSTANCE.lockOpen().getSafeUri()
|
+ ResourceBundleTDOpen.INSTANCE.lockOpen()
|
||||||
.asString() + "' alt='true'>");
|
.getSafeUri().asString() + "' alt='true'>");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -235,8 +225,6 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
|
|
||||||
ColumnModel<TabResource> cm = new ColumnModel<TabResource>(columns);
|
ColumnModel<TabResource> cm = new ColumnModel<TabResource>(columns);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RpcProxy<ListLoadConfig, ListLoadResult<TabResource>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<TabResource>>() {
|
RpcProxy<ListLoadConfig, ListLoadResult<TabResource>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<TabResource>>() {
|
||||||
|
|
||||||
public void load(ListLoadConfig loadConfig,
|
public void load(ListLoadConfig loadConfig,
|
||||||
|
@ -263,9 +251,6 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sm.setSelectionMode(SelectionMode.SINGLE);
|
sm.setSelectionMode(SelectionMode.SINGLE);
|
||||||
grid.setLoader(loader);
|
grid.setLoader(loader);
|
||||||
grid.setSelectionModel(sm);
|
grid.setSelectionModel(sm);
|
||||||
|
@ -337,6 +322,71 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
});
|
});
|
||||||
contextMenu.add(deleteTRItem);
|
contextMenu.add(deleteTRItem);
|
||||||
|
|
||||||
|
MenuItem infoItem = new MenuItem();
|
||||||
|
infoItem.setText("Info");
|
||||||
|
infoItem.setIcon(ResourceBundleTDOpen.INSTANCE.information());
|
||||||
|
infoItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelection(SelectionEvent<Item> 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<TabResource>() {
|
||||||
|
|
||||||
|
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) {
|
protected boolean select(TabResource item, String searchTerm) {
|
||||||
|
@ -377,8 +427,7 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
|
||||||
} else {
|
} else {
|
||||||
Log.error("Error retrieving tabular resource: "
|
Log.error("Error retrieving tabular resource: "
|
||||||
+ caught.getLocalizedMessage());
|
+ caught.getLocalizedMessage());
|
||||||
parent.showErrorAndHide(
|
parent.showErrorAndHide("Error",
|
||||||
"Error",
|
|
||||||
caught.getLocalizedMessage(), "", caught);
|
caught.getLocalizedMessage(), "", caught);
|
||||||
}
|
}
|
||||||
callback.onFailure(caught);
|
callback.onFailure(caught);
|
||||||
|
|
|
@ -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"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
<!-- file: ./IconButton.html -->
|
||||||
|
<div class="{style.iconButton}">
|
||||||
|
<div class="{style.iconButtonImage}"></div>
|
||||||
|
</div>
|
|
@ -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"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface IconButtonAppearance {
|
||||||
|
void render(SafeHtmlBuilder sb);
|
||||||
|
void onUpdateIcon(XElement parent, ImageResource icon);
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.user.td.openwidget.client.resources;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.resources.client.ClientBundle;
|
import com.google.gwt.resources.client.ClientBundle;
|
||||||
import com.google.gwt.resources.client.ImageResource;
|
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")
|
@Source("lock-open-green_32.png")
|
||||||
ImageResource lockOpen32();
|
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();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
After Width: | Height: | Size: 695 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 830 B |
After Width: | Height: | Size: 1.7 KiB |
|
@ -1,2 +0,0 @@
|
||||||
sendButton = Send
|
|
||||||
nameField = Enter your name
|
|
|
@ -1,2 +0,0 @@
|
||||||
sendButton = Envoyer
|
|
||||||
nameField = Entrez votre nom
|
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -0,0 +1,4 @@
|
||||||
|
<!-- file: ./IconButton.html -->
|
||||||
|
<div class="{style.iconButton}">
|
||||||
|
<div class="{style.iconButtonImage}"></div>
|
||||||
|
</div>
|
|
@ -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;
|
||||||
|
}
|
After Width: | Height: | Size: 695 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 830 B |
After Width: | Height: | Size: 1.7 KiB |