Minor Updated

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@91902 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-02-19 11:21:51 +00:00
parent d3d32ebb7a
commit e7acb6c45f
5 changed files with 391 additions and 100 deletions

View File

@ -158,3 +158,35 @@ Compiling...
Compilation completed in 0.00 seconds Compilation completed in 0.00 seconds
Removing invalidated units Removing invalidated units
Finding entry point classes Finding entry point classes
Public resources found in...
Translatable source found in...
Found 0 cached/archived units. Used 0 / 2719 units from cache.
Compiling...
30% complete (ETR: 11 seconds)
30% complete (ETR: 11 seconds)
30% complete (ETR: 11 seconds)
30% complete (ETR: 11 seconds)
40% complete (ETR: 9 seconds)
50% complete (ETR: 6 seconds)
60% complete (ETR: 5 seconds)
70% complete (ETR: 3 seconds)
80% complete (ETR: 2 seconds)
90% complete (ETR: 1 seconds)
100% complete (ETR: 0 seconds)
Compilation completed in 18.75 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes
Public resources found in...
Translatable source found in...
Found 2719 cached/archived units. Used 2719 / 2719 units from cache.
Compiling...
Compilation completed in 0.00 seconds
Removing invalidated units
Finding entry point classes

View File

@ -34,7 +34,7 @@ import com.sencha.gxt.widget.core.client.form.TextField;
*/ */
public class ColumnExpressionPanel extends FramedPanel { public class ColumnExpressionPanel extends FramedPanel {
private enum ColumnExpressionPanelType { private enum ColumnExpressionPanelType {
ColumnFilter, ColumnRule; MultiColumnFilter, ColumnFilter, ColumnRule;
} }
protected ColumnExpressionPanelType type; protected ColumnExpressionPanelType type;
@ -44,6 +44,8 @@ public class ColumnExpressionPanel extends FramedPanel {
protected ColumnExpressionDialog parentRuleDialog; protected ColumnExpressionDialog parentRuleDialog;
protected ColumnFilterDialog parentFilterDialog; protected ColumnFilterDialog parentFilterDialog;
protected MultiColumnFilterTabPanel parentMultiColumnFilterTabPanel;
protected ColumnData column; protected ColumnData column;
protected ConditionWidget conditionWidget; protected ConditionWidget conditionWidget;
@ -53,13 +55,25 @@ public class ColumnExpressionPanel extends FramedPanel {
private TextButton btnSave; private TextButton btnSave;
private TextButton btnClose; private TextButton btnClose;
public ColumnExpressionPanel(ColumnFilterDialog parentFilterDialog, ColumnData column, EventBus eventBus) { public ColumnExpressionPanel(MultiColumnFilterTabPanel parentMultiColumnFilterTabPanel,
type = ColumnExpressionPanelType.ColumnFilter; ColumnData column, EventBus eventBus) {
this.parentFilterDialog=parentFilterDialog; type = ColumnExpressionPanelType.MultiColumnFilter;
this.column=column; this.parentMultiColumnFilterTabPanel = parentMultiColumnFilterTabPanel;
this.eventBus=eventBus; this.column = column;
this.eventBus = eventBus;
Log.debug(column.toString()); Log.debug(column.toString());
create();
}
public ColumnExpressionPanel(ColumnFilterDialog parentFilterDialog,
ColumnData column, EventBus eventBus) {
type = ColumnExpressionPanelType.ColumnFilter;
this.parentFilterDialog = parentFilterDialog;
this.column = column;
this.eventBus = eventBus;
Log.debug(column.toString());
create(); create();
} }
@ -86,14 +100,18 @@ public class ColumnExpressionPanel extends FramedPanel {
VerticalLayoutContainer basicLayout = new VerticalLayoutContainer(); VerticalLayoutContainer basicLayout = new VerticalLayoutContainer();
basicLayout.setScrollMode(ScrollMode.AUTO); basicLayout.setScrollMode(ScrollMode.AUTO);
basicLayout.setAdjustForScroll(true); basicLayout.setAdjustForScroll(true);
FieldSet properties = null;
VerticalLayoutContainer propertiesLayout;
TextField columnName;
FieldSet properties=null; switch (type) {
if (type == ColumnExpressionPanelType.ColumnRule) { case ColumnRule:
properties = new FieldSet(); properties = new FieldSet();
properties.setHeadingText("Properties"); properties.setHeadingText("Properties");
properties.setCollapsible(false); properties.setCollapsible(false);
VerticalLayoutContainer propertiesLayout = new VerticalLayoutContainer(); propertiesLayout = new VerticalLayoutContainer();
properties.add(propertiesLayout); properties.add(propertiesLayout);
TextField columnType = new TextField(); TextField columnType = new TextField();
@ -110,7 +128,42 @@ public class ColumnExpressionPanel extends FramedPanel {
propertiesLayout.add(new FieldLabel(dataType, "Data Type"), propertiesLayout.add(new FieldLabel(dataType, "Data Type"),
new VerticalLayoutData(1, -1)); new VerticalLayoutData(1, -1));
break;
case ColumnFilter:
properties = new FieldSet();
properties.setHeadingText("Properties");
properties.setCollapsible(false);
propertiesLayout = new VerticalLayoutContainer();
properties.add(propertiesLayout);
columnName = new TextField();
columnName.setToolTip("Column");
columnName.setReadOnly(true);
columnName.setValue(column.getLabel());
propertiesLayout.add(new FieldLabel(columnName, "Column"),
new VerticalLayoutData(1, -1));
break;
case MultiColumnFilter:
properties = new FieldSet();
properties.setHeadingText("Properties");
properties.setCollapsible(false);
propertiesLayout = new VerticalLayoutContainer();
properties.add(propertiesLayout);
columnName = new TextField();
columnName.setToolTip("Column");
columnName.setReadOnly(true);
columnName.setValue(column.getLabel());
propertiesLayout.add(new FieldLabel(columnName, "Column"),
new VerticalLayoutData(1, -1));
break;
default:
break;
} }
FieldSet conditions = new FieldSet(); FieldSet conditions = new FieldSet();
conditions.setHeadingText("Conditions"); conditions.setHeadingText("Conditions");
conditions.setCollapsible(false); conditions.setCollapsible(false);
@ -122,76 +175,119 @@ public class ColumnExpressionPanel extends FramedPanel {
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE); flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
flowButton.setPack(BoxLayoutPack.CENTER); flowButton.setPack(BoxLayoutPack.CENTER);
btnApply = new TextButton("Apply");
if (type == ColumnExpressionPanelType.ColumnRule) { switch (type) {
case ColumnRule:
btnApply = new TextButton("Apply");
btnApply.setIcon(ExpressionResources.INSTANCE.apply()); btnApply.setIcon(ExpressionResources.INSTANCE.apply());
} else { btnApply.setIconAlign(IconAlign.RIGHT);
btnApply.setTitle("Apply rule");
btnApply.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
Log.debug("Pressed Apply");
applyRule();
}
});
btnSearch = new TextButton("Search");
btnSearch.setIcon(ExpressionResources.INSTANCE.search());
btnSearch.setIconAlign(IconAlign.RIGHT);
btnSearch.setTitle("Search rule");
btnSearch.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
Log.debug("Pressed Search");
searchRule();
}
});
btnSave = new TextButton("Save");
btnSave.setIcon(ExpressionResources.INSTANCE.save());
btnSave.setIconAlign(IconAlign.RIGHT);
btnSave.setTitle("Save rule");
btnSave.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
Log.debug("Pressed Save");
saveRule();
}
});
btnClose = new TextButton("Close");
btnClose.setIcon(ExpressionResources.INSTANCE.close());
btnClose.setIconAlign(IconAlign.RIGHT);
btnClose.setTitle("Cancel rule");
btnClose.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
Log.debug("Pressed Close");
close();
}
});
flowButton.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
flowButton.add(btnSave, new BoxLayoutData(new Margins(2, 4, 2, 4)));
flowButton.add(btnSearch,
new BoxLayoutData(new Margins(2, 4, 2, 4)));
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
break;
case ColumnFilter:
btnApply = new TextButton("Apply");
btnApply.setIcon(ExpressionResources.INSTANCE.applyFilter()); btnApply.setIcon(ExpressionResources.INSTANCE.applyFilter());
btnApply.setIconAlign(IconAlign.RIGHT);
btnApply.setTitle("Apply Filter");
btnApply.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
Log.debug("Pressed Apply");
applyRule();
}
});
btnClose = new TextButton("Close");
btnClose.setIcon(ExpressionResources.INSTANCE.close());
btnClose.setIconAlign(IconAlign.RIGHT);
btnClose.setTitle("Cancel filter");
btnClose.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
Log.debug("Pressed Close");
close();
}
});
flowButton.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
break;
case MultiColumnFilter:
btnApply = new TextButton("Add");
btnApply.setIcon(ExpressionResources.INSTANCE.applyFilter());
btnApply.setIconAlign(IconAlign.RIGHT);
btnApply.setTitle("Add Filter");
btnApply.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
Log.debug("Pressed Add Filter");
applyRule();
}
});
flowButton.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
break;
default:
break;
} }
btnApply.setIconAlign(IconAlign.RIGHT);
btnApply.setTitle("Apply rule"); basicLayout.add(properties, new VerticalLayoutData(-1, -1, new Margins(
btnApply.addSelectHandler(new SelectHandler() { 1)));
public void onSelect(SelectEvent event) {
Log.debug("Pressed Apply");
applyRule();
}
});
btnSearch = new TextButton("Search");
btnSearch.setIcon(ExpressionResources.INSTANCE.search());
btnSearch.setIconAlign(IconAlign.RIGHT);
btnSearch.setTitle("Search rule");
btnSearch.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
Log.debug("Pressed Search");
searchRule();
}
});
btnSave = new TextButton("Save");
btnSave.setIcon(ExpressionResources.INSTANCE.save());
btnSave.setIconAlign(IconAlign.RIGHT);
btnSave.setTitle("Save rule");
btnSave.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
Log.debug("Pressed Save");
saveRule();
}
});
btnClose = new TextButton("Close");
btnClose.setIcon(ExpressionResources.INSTANCE.close());
btnClose.setIconAlign(IconAlign.RIGHT);
btnClose.setTitle("Cancel rule");
btnClose.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
Log.debug("Pressed Close");
close();
}
});
flowButton.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
flowButton.add(btnSave, new BoxLayoutData(new Margins(2, 4, 2, 4)));
flowButton.add(btnSearch, new BoxLayoutData(new Margins(2, 4, 2, 4)));
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
if (type == ColumnExpressionPanelType.ColumnRule) {
basicLayout.add(properties, new VerticalLayoutData(-1, -1,
new Margins(1)));
}
basicLayout.add(conditions, new VerticalLayoutData(-1, -1, new Margins( basicLayout.add(conditions, new VerticalLayoutData(-1, -1, new Margins(
1))); 1)));
basicLayout.add(flowButton, new VerticalLayoutData(-1, -1, new Margins( basicLayout.add(flowButton, new VerticalLayoutData(-1, -1, new Margins(
5, 2, 5, 2))); 5, 2, 5, 2)));
add(basicLayout); add(basicLayout);
show(); show();
@ -199,14 +295,16 @@ public class ColumnExpressionPanel extends FramedPanel {
protected void applyRule() { protected void applyRule() {
C_Expression exp = conditionWidget.getExpression(); C_Expression exp = conditionWidget.getExpression();
if (type == ColumnExpressionPanelType.ColumnRule) { switch (type) {
case ColumnRule:
parentRuleDialog.setExpression(exp); parentRuleDialog.setExpression(exp);
ExpressionEvent expressionEvent = new ExpressionEvent( ExpressionEvent expressionEvent = new ExpressionEvent(
ExpressionType.CREATECOLUMNEXPRESSION); ExpressionType.CREATECOLUMNEXPRESSION);
C_ExpressionContainer container = new C_ExpressionContainer(); C_ExpressionContainer container = new C_ExpressionContainer();
container.setId(C_ExpressionContainer.Contains.C_Expression); container.setId(C_ExpressionContainer.Contains.C_Expression);
container.setExp(exp); container.setExp(exp);
container.setReadableExpression(conditionWidget.getReadableExpression()); container.setReadableExpression(conditionWidget
.getReadableExpression());
expressionEvent.setC_ExpressionContainer(container); expressionEvent.setC_ExpressionContainer(container);
expressionEvent.setTrId(column.getTrId()); expressionEvent.setTrId(column.getTrId());
expressionEvent.setColumnId(column.getColumnId()); expressionEvent.setColumnId(column.getColumnId());
@ -214,9 +312,21 @@ public class ColumnExpressionPanel extends FramedPanel {
Log.debug(expressionEvent.toString()); Log.debug(expressionEvent.toString());
parentRuleDialog.hide(); parentRuleDialog.hide();
eventBus.fireEvent(expressionEvent); eventBus.fireEvent(expressionEvent);
} else { break;
case ColumnFilter:
parentFilterDialog.applyFilter(exp); parentFilterDialog.applyFilter(exp);
break;
case MultiColumnFilter:
parentMultiColumnFilterTabPanel.applyFilter(column,exp);
break;
default:
break;
} }
} }
@ -229,32 +339,25 @@ public class ColumnExpressionPanel extends FramedPanel {
} }
protected void close() { protected void close() {
if (type == ColumnExpressionPanelType.ColumnRule) { switch (type) {
case ColumnRule:
ExpressionEvent expressionEvent = new ExpressionEvent( ExpressionEvent expressionEvent = new ExpressionEvent(
ExpressionType.EXPRESSIONNULL); ExpressionType.EXPRESSIONNULL);
Log.debug(expressionEvent.toString()); Log.debug(expressionEvent.toString());
parentRuleDialog.hide(); parentRuleDialog.hide();
eventBus.fireEvent(expressionEvent); eventBus.fireEvent(expressionEvent);
} else { break;
case ColumnFilter:
parentFilterDialog.close(); parentFilterDialog.close();
break;
case MultiColumnFilter:
break;
default:
break;
} }
} }
public TextButton getBtnApply() {
return btnApply;
}
public TextButton getBtnSearch() {
return btnSearch;
}
public TextButton getBtnSave() {
return btnSave;
}
public TextButton getBtnClose() {
return btnClose;
}
} }

View File

@ -22,7 +22,7 @@ import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
public class ColumnFilterDialog extends Window { public class ColumnFilterDialog extends Window {
protected String WIDTH = "650px"; protected String WIDTH = "650px";
protected String HEIGHT = "334px"; protected String HEIGHT = "400px";
protected ColumnExpressionPanel columnExpressionPanel; protected ColumnExpressionPanel columnExpressionPanel;
protected C_Expression exp = null; protected C_Expression exp = null;
protected ColumnData column = null; protected ColumnData column = null;
@ -80,12 +80,7 @@ public class ColumnFilterDialog extends Window {
columnExpressionPanel = new ColumnExpressionPanel(this, column, columnExpressionPanel = new ColumnExpressionPanel(this, column,
eventBus); eventBus);
add(columnExpressionPanel); add(columnExpressionPanel);
if (columnExpressionPanel.getBtnSave() != null) {
columnExpressionPanel.getBtnSave().setVisible(false);
}
if (columnExpressionPanel.getBtnSearch() != null) {
columnExpressionPanel.getBtnSearch().setVisible(false);
}
} else { } else {
HTML errorMessage = new HTML( HTML errorMessage = new HTML(
"This type of column is not supported for now!"); "This type of column is not supported for now!");

View File

@ -0,0 +1,68 @@
package org.gcube.portlets.user.td.expressionwidget.client;
import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
import com.sencha.gxt.widget.core.client.event.HideEvent;
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
public class MultiColumnFilterDialog extends Window {
protected String WIDTH = "650px";
protected String HEIGHT = "400px";
protected C_Expression exp = null;
protected TRId trId;
protected EventBus eventBus;
protected ArrayList<ColumnData> columns;
public MultiColumnFilterDialog(TRId trId, EventBus eventBus) {
this.eventBus = eventBus;
this.trId = trId;
load(trId);
}
protected void create(){
}
protected void load(TRId trId) {
TDGWTServiceAsync.INSTANCE.getColumns(trId,
new AsyncCallback<ArrayList<ColumnData>>() {
@Override
public void onFailure(Throwable caught) {
Log.error("Error retrieving columns: "
+ caught.getMessage());
AlertMessageBox d = new AlertMessageBox(
"Error retrieving columns", caught.getMessage());
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
hide();
}
});
d.show();
}
@Override
public void onSuccess(ArrayList<ColumnData> result) {
Log.debug("Retrived column: " + result);
columns = result;
create();
}
});
}
}

View File

@ -0,0 +1,93 @@
package org.gcube.portlets.user.td.expressionwidget.client;
import java.util.ArrayList;
import java.util.HashMap;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
import com.allen_sauer.gwt.log.client.Log;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.TabItemConfig;
import com.sencha.gxt.widget.core.client.TabPanel;
public class MultiColumnFilterTabPanel extends TabPanel {
protected EventBus eventBus;
protected MultiColumnFilterDialog multiColumnFilterDialog;
protected ArrayList<ColumnData> columns;
protected HashMap<ColumnData,C_Expression> cexpressionList;
public MultiColumnFilterTabPanel(
MultiColumnFilterDialog multiColumnFilterDialog, String name,
EventBus eventBus) {
super();
Log.debug("Create MultiColumnFilterTabPanel");
this.eventBus = eventBus;
this.columns= multiColumnFilterDialog.columns;
setId(name);
setBodyBorder(false);
setBorders(false);
setAnimScroll(true);
setTabScroll(true);
setCloseContextMenu(true);
}
public void startTabs() {
Log.debug("Start MultiColumnFilterTabPanel Tabs");
addFilterColumnsPanel();
setActiveWidget(getWidget(0));
}
protected void addFilterColumnsPanel() {
cexpressionList= new HashMap<ColumnData,C_Expression>();
ColumnExpressionPanel columnExpressionPanel;
TabItemConfig columnFilterItemConf;
for (ColumnData col : columns) {
columnFilterItemConf = new TabItemConfig(
col.getLabel(), false);
if (col.getTypeCode()
.compareTo(ColumnTypeCode.ANNOTATION.toString()) == 0
|| col.getTypeCode().compareTo(
ColumnTypeCode.ATTRIBUTE.toString()) == 0
|| col.getTypeCode().compareTo(
ColumnTypeCode.CODE.toString()) == 0
|| col.getTypeCode().compareTo(
ColumnTypeCode.CODEDESCRIPTION.toString()) == 0
|| col.getTypeCode().compareTo(
ColumnTypeCode.CODENAME.toString()) == 0
|| col.getTypeCode().compareTo(
ColumnTypeCode.MEASURE.toString()) == 0) {
columnExpressionPanel = new ColumnExpressionPanel(this,
col, eventBus);
add(columnExpressionPanel, columnFilterItemConf);
} else {
}
/*addBeforeCloseHandler(new BeforeCloseHandler<Widget>() {
public void onBeforeClose(BeforeCloseEvent<Widget> event) {
if (columnExpressionPanel == event.getItem()) {
remove(columnExpressionPanel);
}
}
});*/
}
};
protected void applyFilter(ColumnData column,C_Expression exp){
cexpressionList.put(column, exp);
}
}