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
Removing invalidated units
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 {
private enum ColumnExpressionPanelType {
ColumnFilter, ColumnRule;
MultiColumnFilter, ColumnFilter, ColumnRule;
}
protected ColumnExpressionPanelType type;
@ -44,6 +44,8 @@ public class ColumnExpressionPanel extends FramedPanel {
protected ColumnExpressionDialog parentRuleDialog;
protected ColumnFilterDialog parentFilterDialog;
protected MultiColumnFilterTabPanel parentMultiColumnFilterTabPanel;
protected ColumnData column;
protected ConditionWidget conditionWidget;
@ -53,13 +55,25 @@ public class ColumnExpressionPanel extends FramedPanel {
private TextButton btnSave;
private TextButton btnClose;
public ColumnExpressionPanel(ColumnFilterDialog parentFilterDialog, ColumnData column, EventBus eventBus) {
type = ColumnExpressionPanelType.ColumnFilter;
this.parentFilterDialog=parentFilterDialog;
this.column=column;
this.eventBus=eventBus;
public ColumnExpressionPanel(MultiColumnFilterTabPanel parentMultiColumnFilterTabPanel,
ColumnData column, EventBus eventBus) {
type = ColumnExpressionPanelType.MultiColumnFilter;
this.parentMultiColumnFilterTabPanel = parentMultiColumnFilterTabPanel;
this.column = column;
this.eventBus = eventBus;
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();
}
@ -86,14 +100,18 @@ public class ColumnExpressionPanel extends FramedPanel {
VerticalLayoutContainer basicLayout = new VerticalLayoutContainer();
basicLayout.setScrollMode(ScrollMode.AUTO);
basicLayout.setAdjustForScroll(true);
FieldSet properties = null;
VerticalLayoutContainer propertiesLayout;
TextField columnName;
FieldSet properties=null;
if (type == ColumnExpressionPanelType.ColumnRule) {
switch (type) {
case ColumnRule:
properties = new FieldSet();
properties.setHeadingText("Properties");
properties.setCollapsible(false);
VerticalLayoutContainer propertiesLayout = new VerticalLayoutContainer();
propertiesLayout = new VerticalLayoutContainer();
properties.add(propertiesLayout);
TextField columnType = new TextField();
@ -110,7 +128,42 @@ public class ColumnExpressionPanel extends FramedPanel {
propertiesLayout.add(new FieldLabel(dataType, "Data Type"),
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();
conditions.setHeadingText("Conditions");
conditions.setCollapsible(false);
@ -122,76 +175,119 @@ public class ColumnExpressionPanel extends FramedPanel {
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
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());
} 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.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");
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)));
if (type == ColumnExpressionPanelType.ColumnRule) {
basicLayout.add(properties, new VerticalLayoutData(-1, -1,
new Margins(1)));
}
basicLayout.add(properties, new VerticalLayoutData(-1, -1, new Margins(
1)));
basicLayout.add(conditions, new VerticalLayoutData(-1, -1, new Margins(
1)));
basicLayout.add(flowButton, new VerticalLayoutData(-1, -1, new Margins(
5, 2, 5, 2)));
add(basicLayout);
show();
@ -199,14 +295,16 @@ public class ColumnExpressionPanel extends FramedPanel {
protected void applyRule() {
C_Expression exp = conditionWidget.getExpression();
if (type == ColumnExpressionPanelType.ColumnRule) {
switch (type) {
case ColumnRule:
parentRuleDialog.setExpression(exp);
ExpressionEvent expressionEvent = new ExpressionEvent(
ExpressionType.CREATECOLUMNEXPRESSION);
C_ExpressionContainer container = new C_ExpressionContainer();
container.setId(C_ExpressionContainer.Contains.C_Expression);
container.setExp(exp);
container.setReadableExpression(conditionWidget.getReadableExpression());
container.setReadableExpression(conditionWidget
.getReadableExpression());
expressionEvent.setC_ExpressionContainer(container);
expressionEvent.setTrId(column.getTrId());
expressionEvent.setColumnId(column.getColumnId());
@ -214,9 +312,21 @@ public class ColumnExpressionPanel extends FramedPanel {
Log.debug(expressionEvent.toString());
parentRuleDialog.hide();
eventBus.fireEvent(expressionEvent);
} else {
break;
case ColumnFilter:
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() {
if (type == ColumnExpressionPanelType.ColumnRule) {
switch (type) {
case ColumnRule:
ExpressionEvent expressionEvent = new ExpressionEvent(
ExpressionType.EXPRESSIONNULL);
Log.debug(expressionEvent.toString());
parentRuleDialog.hide();
eventBus.fireEvent(expressionEvent);
} else {
break;
case ColumnFilter:
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 {
protected String WIDTH = "650px";
protected String HEIGHT = "334px";
protected String HEIGHT = "400px";
protected ColumnExpressionPanel columnExpressionPanel;
protected C_Expression exp = null;
protected ColumnData column = null;
@ -80,12 +80,7 @@ public class ColumnFilterDialog extends Window {
columnExpressionPanel = new ColumnExpressionPanel(this, column,
eventBus);
add(columnExpressionPanel);
if (columnExpressionPanel.getBtnSave() != null) {
columnExpressionPanel.getBtnSave().setVisible(false);
}
if (columnExpressionPanel.getBtnSearch() != null) {
columnExpressionPanel.getBtnSearch().setVisible(false);
}
} else {
HTML errorMessage = new HTML(
"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);
}
}