diff --git a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleActivePanel.java b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleActivePanel.java index 03c3c5f..d376db7 100644 --- a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleActivePanel.java +++ b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleActivePanel.java @@ -12,7 +12,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedExcep import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.rule.AppliedRulesResponseData; import org.gcube.portlets.user.td.gwtservice.shared.rule.DetachColumnRulesSession; -import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData; +import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData; import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; diff --git a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleApplyPanel.java b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleApplyPanel.java index 8397a41..0d18f77 100644 --- a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleApplyPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleApplyPanel.java @@ -13,7 +13,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedExcep import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.rule.AppliedRulesResponseData; import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyAndDetachColumnRulesSession; -import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData; +import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData; import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; diff --git a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleDeleteDialog.java b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleDeleteDialog.java index 153449a..21d8025 100644 --- a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleDeleteDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleDeleteDialog.java @@ -5,7 +5,7 @@ import java.util.ArrayList; import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync; import org.gcube.portlets.user.td.expressionwidget.client.utils.UtilsGXT3; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; -import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData; +import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData; import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; diff --git a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleDeletePanel.java b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleDeletePanel.java index d79e14c..4410583 100644 --- a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleDeletePanel.java +++ b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleDeletePanel.java @@ -6,8 +6,8 @@ import java.util.List; import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync; import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionDataProperties; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; -import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData; import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType; +import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData; import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; diff --git a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleInfoDialog.java b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleInfoDialog.java index 4e6fdd9..f629e1b 100644 --- a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleInfoDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleInfoDialog.java @@ -1,6 +1,6 @@ package org.gcube.portlets.user.td.rulewidget.client; -import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData; +import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData; import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle; import com.sencha.gxt.core.client.util.Margins; diff --git a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleOpenDialog.java b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleOpenDialog.java index 38a0801..4211bdf 100644 --- a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleOpenDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleOpenDialog.java @@ -3,7 +3,7 @@ package org.gcube.portlets.user.td.rulewidget.client; import org.gcube.portlets.user.td.expressionwidget.client.RuleEditDialog; import org.gcube.portlets.user.td.expressionwidget.client.notification.RuleEditDialogNotification; import org.gcube.portlets.user.td.expressionwidget.client.notification.RuleEditDialogNotification.RuleEditDialogNotificationListener; -import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData; +import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData; import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle; import com.allen_sauer.gwt.log.client.Log; diff --git a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleOpenPanel.java b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleOpenPanel.java index cde304a..7dc942d 100644 --- a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleOpenPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleOpenPanel.java @@ -6,8 +6,8 @@ import java.util.List; import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync; import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionDataProperties; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; -import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData; import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType; +import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData; import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; diff --git a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleShareDialog.java b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleShareDialog.java index 0e58702..8638807 100644 --- a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleShareDialog.java +++ b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleShareDialog.java @@ -1,6 +1,6 @@ package org.gcube.portlets.user.td.rulewidget.client; -import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData; +import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData; import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.sharewidget.client.RuleShare; diff --git a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleSharePanel.java b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleSharePanel.java index 272ddd8..2a273de 100644 --- a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleSharePanel.java +++ b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/RuleSharePanel.java @@ -6,8 +6,8 @@ import java.util.List; import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync; import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionDataProperties; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; -import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData; import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType; +import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData; import org.gcube.portlets.user.td.rulewidget.client.RuleDeletePanel.RuleDeleteTemplates; import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; diff --git a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/multicolumn/CreateRuleOnTableDefinitionCard.java b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/multicolumn/CreateRuleOnTableDefinitionCard.java new file mode 100644 index 0000000..15aa6dc --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/multicolumn/CreateRuleOnTableDefinitionCard.java @@ -0,0 +1,296 @@ +package org.gcube.portlets.user.td.rulewidget.client.multicolumn; + +import java.util.ArrayList; + +import org.gcube.portlets.user.td.expressionwidget.client.properties.RuleColumnPlaceHolderDescriptorProperties; +import org.gcube.portlets.user.td.gwtservice.shared.chart.ChartTopRatingSession; +import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleColumnPlaceHolderDescriptor; +import org.gcube.portlets.user.td.gwtservice.shared.rule.type.TDRuleTableType; +import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.TableType; +import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType; +import org.gcube.portlets.user.td.wizardwidget.client.WizardCard; + +import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.Command; +import com.sencha.gxt.core.client.util.Padding; +import com.sencha.gxt.data.shared.ListStore; +import com.sencha.gxt.widget.core.client.box.AlertMessageBox; +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.event.HideEvent; +import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler; +import com.sencha.gxt.widget.core.client.form.FormPanel; +import com.sencha.gxt.widget.core.client.grid.ColumnConfig; +import com.sencha.gxt.widget.core.client.grid.ColumnModel; +import com.sencha.gxt.widget.core.client.grid.Grid; + +/** + * + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it + * + */ +public class CreateRuleOnTableDefinitionCard extends WizardCard { + + private CreateRuleOnTableDefinitionCard thisCard; + private TDRuleTableType tdRuleTableType; + private Grid grid; + + public CreateRuleOnTableDefinitionCard() { + super("Columns Definition", ""); + this.thisCard = this; + FormPanel panel = createPanel(); + setCenterWidget(panel, new MarginData(0)); + + } + + protected FormPanel createPanel() { + FormPanel panel = new FormPanel(); + panel.setLabelWidth(90); + panel.getElement().setPadding(new Padding(5)); + + VerticalLayoutContainer content = new VerticalLayoutContainer(); + panel.add(content); + + RuleColumnPlaceHolderDescriptorProperties props = GWT + .create(RuleColumnPlaceHolderDescriptorProperties.class); + // + ColumnConfig labelColumn = new ColumnConfig( + props.label(), 220, "Label"); + ColumnConfig columnDataTypeColumn = new ColumnConfig( + props.columnDataType(), 130, "Data Type"); + + ArrayList> l = new ArrayList>(); + l.add(labelColumn); + l.add(columnDataTypeColumn); + + ColumnModel columns = new ColumnModel( + l); + + final ListStore store = new ListStore( + props.id()); + + grid = new Grid(store, columns); + grid.getView().setStripeRows(true); + grid.getView().setColumnLines(true); + grid.getView().setAutoFill(true); + grid.setBorders(false); + grid.setLoadMask(true); + grid.setColumnReordering(false); + grid.getView().setAutoExpandColumn(labelColumn); + + // EDITING // + /* + SimpleComboBox comboColumnDataType = new SimpleComboBox( + new StringLabelProvider()); + comboColumnDataType.setClearValueOnParseError(false); + comboColumnDataType.setPropertyEditor(new PropertyEditor() { + @Override + public Light parse(CharSequence text) throws ParseException { + return Light.parseString(text.toString()); + } + + @Override + public String render(ColumnDataType object) { + return object == null ? Light.SUNNY.toString() : object + .toString(); + } + }); + comboColumnDataType.setTriggerAction(TriggerAction.ALL); + comboColumnDataType.add(Light.SUNNY); + comboColumnDataType.add(Light.MOSTLYSUNNY); + comboColumnDataType.add(Light.SUNORSHADE); + comboColumnDataType.add(Light.MOSTLYSHADY); + comboColumnDataType.add(Light.SHADE); + + Converter lightConverter = new Converter() { + @Override + public String convertFieldValue(Light object) { + return object == null ? "" : object.toString(); + } + + @Override + public Light convertModelValue(String object) { + try { + return Light.parseString(object); + } catch (ParseException e) { + return null; + } + } + }; + + DateTimeFormat dateFormat = DateTimeFormat + .getFormat(PredefinedFormat.DATE_SHORT); + DateField dateField = new DateField(new DateTimePropertyEditor( + dateFormat)); + dateField.setClearValueOnParseError(false); + + final GridEditing editing = createGridEditing(grid); + editing.addEditor(labelColumn, new TextField()); + editing.addEditor(columnDataTypeColumn, lightConverter, comboColumnDataType); + + + // EDITING // + customizeGrid(grid); + + TextButton addButton = new TextButton("Add Plant"); + addButton.addSelectHandler(new SelectHandler() { + @Override + public void onSelect(SelectEvent event) { + Plant plant = new Plant(); + plant.setName("New Plant 1"); + plant.setLight("Mostly Shady"); + plant.setPrice(0); + plant.setAvailable(new DateWrapper().clearTime().asDate()); + plant.setIndoor(false); + + editing.cancelEditing(); + store.add(0, plant); + + int row = store.indexOf(plant); + editing.startEditing(new GridCell(row, 0)); + } + }); + + ToolBar toolBar = new ToolBar(); + toolBar.add(addButton); + + VerticalLayoutContainer verticalLayoutContainer = new VerticalLayoutContainer(); + verticalLayoutContainer.setBorders(true); + verticalLayoutContainer.add(toolBar, new VerticalLayoutData(1, -1)); + verticalLayoutContainer.add(grid, new VerticalLayoutData(1, 1)); + + panel = new FramedPanel(); + panel.setHeadingText("Editable Grid Example"); + panel.setPixelSize(600, 400); + panel.addStyleName("margin-10"); + panel.setWidget(verticalLayoutContainer); + + panel.setButtonAlign(BoxLayoutPack.CENTER); + panel.addButton(new TextButton("Reset", new SelectHandler() { + @Override + public void onSelect(SelectEvent event) { + store.rejectChanges(); + } + })); + + panel.addButton(new TextButton("Save", new SelectHandler() { + @Override + public void onSelect(SelectEvent event) { + store.commitChanges(); + } + }));*/ + + return panel; + } + + @Override + public void setup() { + Log.debug("ChartSelectionCard Setup"); + Command sayNextCard = new Command() { + + public void execute() { + Log.debug("ChartSelectionCard Call sayNextCard"); + checkData(); + } + + }; + + Command sayPreviousCard = new Command() { + public void execute() { + try { + getWizardWindow().previousCard(); + getWizardWindow().removeCard(thisCard); + Log.info("Remove ChartSelectionCard"); + } catch (Exception e) { + Log.error("sayPreviousCard :" + e.getLocalizedMessage()); + } + } + }; + + getWizardWindow().setPreviousButtonCommand(sayPreviousCard); + getWizardWindow().setNextButtonCommand(sayNextCard); + + setEnableBackButton(false); + setEnableNextButton(true); + } + + protected void checkData() { + getWizardWindow().setEnableNextButton(false); + getWizardWindow().setEnableBackButton(false); + + HideHandler hideHandler = new HideHandler() { + + public void onHide(HideEvent event) { + getWizardWindow().setEnableNextButton(true); + getWizardWindow().setEnableBackButton(false); + + } + }; + + /* + if (chartTypeSelected == null) { + AlertMessageBox d = new AlertMessageBox("Attention", + "No chart selected"); + d.addHideHandler(hideHandler); + d.setModal(false); + d.show(); + return; + } + + switch (chartTypeSelected) { + case TopRating: + checkTopRating(); + break; + default: + AlertMessageBox d = new AlertMessageBox("Attention", + "No chart selected"); + d.addHideHandler(hideHandler); + d.setModal(false); + d.show(); + break; + + } + */ + + } + + /* + protected void checkTopRating() { + String tableTypeName = chartSession.getTrId().getTableTypeName(); + if (tableTypeName.compareTo(TableType.DATASET.toString()) == 0) { + try { + ChartTopRatingSession chartTopRatingSession = new ChartTopRatingSession(); + chartTopRatingSession.setTrId(chartSession.getTrId()); + TopRatingColumnSelectionCard topRatingColumnSelectionCard = new TopRatingColumnSelectionCard( + chartSession, chartTopRatingSession); + getWizardWindow().addCard(topRatingColumnSelectionCard); + getWizardWindow().nextCard(); + + } catch (Exception e) { + Log.error("sayNextCard :" + e.getLocalizedMessage()); + } + } else { + AlertMessageBox d = new AlertMessageBox("Attention", + "Chart not applicable, table is not a Dataset!"); + d.addHideHandler(new HideHandler() { + + public void onHide(HideEvent event) { + getWizardWindow().setEnableNextButton(true); + getWizardWindow().setEnableBackButton(false); + + } + }); + d.setModal(false); + d.show(); + } + + }*/ + + @Override + public void dispose() { + + } + +} diff --git a/src/main/java/org/gcube/portlets/user/td/rulewidget/client/multicolumn/CreateRuleOnTableWizard.java b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/multicolumn/CreateRuleOnTableWizard.java new file mode 100644 index 0000000..c8114f8 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/rulewidget/client/multicolumn/CreateRuleOnTableWizard.java @@ -0,0 +1,42 @@ +package org.gcube.portlets.user.td.rulewidget.client.multicolumn; + + + +import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData; +import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow; + +import com.allen_sauer.gwt.log.client.Log; +import com.google.web.bindery.event.shared.EventBus; + + + +/** + * + * @author giancarlo + * email: g.panichi@isti.cnr.it + * + */ +public class CreateRuleOnTableWizard extends WizardWindow { + + + /** + * + * @param title + * @param eventBus + */ + public CreateRuleOnTableWizard(EventBus eventBus) { + super("Create Rule On Table",eventBus); + Log.debug("CreateRuleOnMultiColumnWizard"); + create(); + } + + + private void create() { + CreateRuleOnTableDefinitionCard createRuleOnTableDefinitionCard=new CreateRuleOnTableDefinitionCard(); + addCard(createRuleOnTableDefinitionCard); + createRuleOnTableDefinitionCard.setup(); + show(); + } + + +} \ No newline at end of file