Updated Column Expression Panel
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@90281 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e1419a2309
commit
27a8746cf0
|
@ -1,14 +1,25 @@
|
|||
package org.gcube.portlets.user.td.expressionwidget.client;
|
||||
|
||||
import java.awt.FlowLayout;
|
||||
|
||||
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 com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.widget.client.TextButton;
|
||||
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||
import com.sencha.gxt.widget.core.client.container.FlowLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldSet;
|
||||
|
@ -17,25 +28,28 @@ import com.sencha.gxt.widget.core.client.form.TextField;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ColumnExpressionPanel extends FramedPanel {
|
||||
protected TRId trId;
|
||||
protected String columnName=null;
|
||||
protected ColumnData column;
|
||||
|
||||
protected String WIDTH = "550px";
|
||||
protected String HEIGHT = "520px";
|
||||
|
||||
protected TRId trId;
|
||||
protected String columnName = null;
|
||||
protected ColumnData column;
|
||||
protected ConditionWidget conditionWidget;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param columnTypeCode
|
||||
* @param dataTypeName
|
||||
*/
|
||||
public ColumnExpressionPanel(String columnId, String columnTypeCode, String dataTypeName) {
|
||||
column=new ColumnData();
|
||||
public ColumnExpressionPanel(String columnId, String columnTypeCode,
|
||||
String dataTypeName) {
|
||||
column = new ColumnData();
|
||||
column.setColumnId(columnId);
|
||||
column.setDataTypeName(dataTypeName);
|
||||
column.setTypeCode(columnTypeCode);
|
||||
|
@ -48,8 +62,8 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
* @param columnName
|
||||
*/
|
||||
public ColumnExpressionPanel(TRId trId, String columnName) {
|
||||
this.trId=trId;
|
||||
this.columnName=columnName;
|
||||
this.trId = trId;
|
||||
this.columnName = columnName;
|
||||
load(trId, columnName);
|
||||
}
|
||||
|
||||
|
@ -60,72 +74,116 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
setHeight(HEIGHT);
|
||||
setResize(true);
|
||||
setHeadingText("New Rule");
|
||||
|
||||
|
||||
|
||||
VerticalLayoutContainer basicLayout = new VerticalLayoutContainer();
|
||||
basicLayout.setScrollMode(ScrollMode.AUTO);
|
||||
basicLayout.setAdjustForScroll(true);
|
||||
|
||||
FieldSet properties = new FieldSet();
|
||||
properties.setHeadingText("Properties");
|
||||
properties.setCollapsible(false);
|
||||
|
||||
VerticalLayoutContainer propertiesLayout = new VerticalLayoutContainer();
|
||||
//propertiesLayout.setScrollMode(ScrollMode.AUTO);
|
||||
//propertiesLayout.setAdjustForScroll(true);
|
||||
properties.add(propertiesLayout);
|
||||
|
||||
TextField name= new TextField();
|
||||
name.setToolTip("The name of rule");
|
||||
propertiesLayout.add(new FieldLabel(name, "Name"), new VerticalLayoutData(1, -1));
|
||||
|
||||
TextArea description= new TextArea();
|
||||
description.setHeight("100px");
|
||||
description.setToolTip("The description of rule");
|
||||
propertiesLayout.add(new FieldLabel(description, "Description"), new VerticalLayoutData(1, -1));
|
||||
|
||||
TextField type= new TextField();
|
||||
type.setToolTip("The type of column");
|
||||
type.setValue(column.getDataTypeName());
|
||||
propertiesLayout.add(new FieldLabel(type, "Type"), new VerticalLayoutData(1, -1));
|
||||
|
||||
FieldSet conditions = new FieldSet();
|
||||
conditions.setHeadingText("Conditions");
|
||||
conditions.setCollapsible(false);
|
||||
|
||||
ConditionWidget conditionWidget =new ConditionWidget(column.getColumnId(), column.getTypeCode(), column.getDataTypeName());
|
||||
conditions.add(conditionWidget);
|
||||
|
||||
basicLayout.add(properties);
|
||||
basicLayout.add(conditions);
|
||||
|
||||
|
||||
add(basicLayout);
|
||||
show();
|
||||
basicLayout.setScrollMode(ScrollMode.AUTO);
|
||||
basicLayout.setAdjustForScroll(true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
FieldSet properties = new FieldSet();
|
||||
properties.setHeadingText("Properties");
|
||||
properties.setCollapsible(false);
|
||||
|
||||
protected void load(TRId trId, String columnName) {
|
||||
TDGWTServiceAsync.INSTANCE.getColumn(trId,columnName, new AsyncCallback<ColumnData>(){
|
||||
VerticalLayoutContainer propertiesLayout = new VerticalLayoutContainer();
|
||||
// propertiesLayout.setScrollMode(ScrollMode.AUTO);
|
||||
// propertiesLayout.setAdjustForScroll(true);
|
||||
properties.add(propertiesLayout);
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
Log.error("Error retrieving column: "+caught.getMessage());
|
||||
|
||||
TextField name = new TextField();
|
||||
name.setToolTip("The name of rule");
|
||||
propertiesLayout.add(new FieldLabel(name, "Name"),
|
||||
new VerticalLayoutData(1, -1));
|
||||
|
||||
TextArea description = new TextArea();
|
||||
description.setHeight("100px");
|
||||
description.setToolTip("The description of rule");
|
||||
propertiesLayout.add(new FieldLabel(description, "Description"),
|
||||
new VerticalLayoutData(1, -1));
|
||||
|
||||
TextField type = new TextField();
|
||||
type.setToolTip("The type of column");
|
||||
type.setReadOnly(true);
|
||||
type.setValue(column.getDataTypeName());
|
||||
propertiesLayout.add(new FieldLabel(type, "Type"),
|
||||
new VerticalLayoutData(1, -1));
|
||||
|
||||
FieldSet conditions = new FieldSet();
|
||||
conditions.setHeadingText("Conditions");
|
||||
conditions.setCollapsible(false);
|
||||
|
||||
ConditionWidget conditionWidget = new ConditionWidget(
|
||||
column.getColumnId(), column.getTypeCode(),
|
||||
column.getDataTypeName());
|
||||
conditions.add(conditionWidget);
|
||||
|
||||
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
|
||||
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||
flowButton.setPack(BoxLayoutPack.CENTER);
|
||||
|
||||
TextButton save = new TextButton("Save");
|
||||
save.setTitle("Save rule");
|
||||
save.addClickHandler(new ClickHandler() {
|
||||
|
||||
public void onClick(ClickEvent event) {
|
||||
Log.debug("Pressed Save");
|
||||
saveRule();
|
||||
}
|
||||
|
||||
public void onSuccess(ColumnData result) {
|
||||
Log.debug("Retrived column: "+result);
|
||||
column=result;
|
||||
create();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
TextButton cancel = new TextButton("Cancel");
|
||||
cancel.setTitle("Cancel rule");
|
||||
cancel.addClickHandler(new ClickHandler() {
|
||||
|
||||
public void onClick(ClickEvent event) {
|
||||
Log.debug("Pressed Cancel");
|
||||
cancelRule();
|
||||
}
|
||||
});
|
||||
|
||||
flowButton.add(save, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||
flowButton.add(cancel, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||
|
||||
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(
|
||||
2)));
|
||||
|
||||
add(basicLayout);
|
||||
show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void load(TRId trId, String columnName) {
|
||||
TDGWTServiceAsync.INSTANCE.getColumn(trId, columnName,
|
||||
new AsyncCallback<ColumnData>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
Log.error("Error retrieving column: "
|
||||
+ caught.getMessage());
|
||||
|
||||
}
|
||||
|
||||
public void onSuccess(ColumnData result) {
|
||||
Log.debug("Retrived column: " + result);
|
||||
column = result;
|
||||
create();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void saveRule() {
|
||||
|
||||
}
|
||||
|
||||
protected void cancelRule() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ public class ConditionWidget extends SimpleContainer {
|
|||
btnAdd.addClickHandler(new ClickHandler() {
|
||||
|
||||
public void onClick(ClickEvent event) {
|
||||
Log.debug("Clicked btnCust");
|
||||
Log.debug("Clicked btnAdd");
|
||||
addCondition();
|
||||
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public class ConditionWidget extends SimpleContainer {
|
|||
|
||||
|
||||
horiz.add(comboOp,new BoxLayoutData(new Margins(0)));
|
||||
horiz.add(btnAdd,new BoxLayoutData(new Margins(0)));
|
||||
horiz.add(btnAdd,new BoxLayoutData(new Margins(2,0,2,0)));
|
||||
|
||||
vert.add(horiz,new VerticalLayoutData(-1, -1, new Margins(1)));
|
||||
add(vert);
|
||||
|
@ -176,8 +176,8 @@ public class ConditionWidget extends SimpleContainer {
|
|||
|
||||
|
||||
horiz.add(comboOp,new BoxLayoutData(new Margins(0)));
|
||||
horiz.add(btnAdd,new BoxLayoutData(new Margins(0)));
|
||||
horiz.add(btnDel,new BoxLayoutData(new Margins(0)));
|
||||
horiz.add(btnAdd,new BoxLayoutData(new Margins(2,0,2,0)));
|
||||
horiz.add(btnDel,new BoxLayoutData(new Margins(2,0,2,0)));
|
||||
|
||||
vert.add(horiz,new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||
|
||||
|
|
|
@ -57,15 +57,7 @@ public class DefaultAppearance implements IconButtonAppearance {
|
|||
XElement element = parent.selectNode("." + style.getIconButtonImage());
|
||||
Image image=new Image(icon);
|
||||
Element img=image.getElement();
|
||||
img.setClassName("iconButtonRef");
|
||||
|
||||
/*
|
||||
<img src="immagine1.jpg"
|
||||
onmouseover="this.src='immagine 2.gif'"
|
||||
onmouseout="this.src='immagine1.gif'">
|
||||
//img.setClassName(style.get);*/
|
||||
//XElement ref=XDOM.create("<a class='iconButtonRef'></a>");
|
||||
//ref.appendChild(img);
|
||||
img.setClassName(style.getIconButtonRef());
|
||||
element.appendChild(img);
|
||||
|
||||
}
|
||||
|
|
|
@ -34,21 +34,3 @@ h1 {
|
|||
}
|
||||
|
||||
|
||||
.iconButton {
|
||||
border: none;
|
||||
font-size: 12px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.iconButton .iconButtonImage {
|
||||
vertical-align: center;
|
||||
}
|
||||
|
||||
.iconButtonRef {
|
||||
vertical-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue