Updated EditRow to manage to more than one row

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@111341 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-01-13 11:24:17 +00:00 committed by Giancarlo Panichi
parent c8e081d048
commit aa253072c4
2 changed files with 29 additions and 22 deletions

View File

@ -20,7 +20,7 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
* *
*/ */
public class EditRowDialog extends Window { public class EditRowDialog extends Window {
protected String WIDTH = "600px"; protected String WIDTH = "690px";
protected String HEIGHT = "456px"; protected String HEIGHT = "456px";
protected TRId trId; protected TRId trId;
protected EventBus eventBus; protected EventBus eventBus;

View File

@ -51,6 +51,7 @@ import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutD
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack; import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer; import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign; import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
import com.sencha.gxt.widget.core.client.container.MarginData;
import com.sencha.gxt.widget.core.client.container.SimpleContainer; import com.sencha.gxt.widget.core.client.container.SimpleContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer; 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.container.VerticalLayoutContainer.VerticalLayoutData;
@ -77,10 +78,11 @@ public class EditRowPanel extends FramedPanel implements MonitorDialogListener {
private static final String GEOMETRY_REGEXPR = "(\\s*POINT\\s*\\(\\s*(-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*\\)\\s*$)" private static final String GEOMETRY_REGEXPR = "(\\s*POINT\\s*\\(\\s*(-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*\\)\\s*$)"
+ "|(\\s*LINESTRING\\s*\\((\\s*(-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*,)+\\s*((-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*)\\)\\s*$)"; + "|(\\s*LINESTRING\\s*\\((\\s*(-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*,)+\\s*((-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*)\\)\\s*$)";
private static final String WIDTH = "510px"; private static final String WIDTH = "600px";
private static final String HEIGHT = "370px"; private static final String HEIGHT = "370px";
private static final String FIELDSHEIGHT = "370px"; private static final String CONTAINERHEIGHT = "370px";
private static final int LABELSIZE = 120; private static final int LABELSIZE = 120;
private static final String FIELDSETWIDTH = "640px";
private EditRowDialog parent; private EditRowDialog parent;
private TRId trId; private TRId trId;
@ -153,11 +155,11 @@ public class EditRowPanel extends FramedPanel implements MonitorDialogListener {
protected void create() { protected void create() {
SimpleContainer container = new SimpleContainer(); SimpleContainer container = new SimpleContainer();
container.setHeight(FIELDSHEIGHT); container.setHeight(CONTAINERHEIGHT);
v = new VerticalLayoutContainer(); v = new VerticalLayoutContainer();
v.setScrollMode(ScrollMode.AUTO); v.setScrollMode(ScrollMode.AUTO);
container.add(v); v.setAdjustForScroll(true);
btnSave = new TextButton("Save"); btnSave = new TextButton("Save");
btnSave.setIcon(ResourceBundle.INSTANCE.save()); btnSave.setIcon(ResourceBundle.INSTANCE.save());
@ -202,16 +204,18 @@ public class EditRowPanel extends FramedPanel implements MonitorDialogListener {
FieldSet fieldSet = new FieldSet(); FieldSet fieldSet = new FieldSet();
fieldSet.setCollapsible(false); fieldSet.setCollapsible(false);
fieldSet.setItemId(rowRaw.getRowId()); fieldSet.setItemId(rowRaw.getRowId());
fieldSet.setHeadingText(rowRaw.getRowId());
fieldSet.setWidth(FIELDSETWIDTH);
rowsId.add(rowRaw.getRowId()); rowsId.add(rowRaw.getRowId());
VerticalLayoutContainer fieldSetLayout = new VerticalLayoutContainer(); VerticalLayoutContainer fieldSetLayout = new VerticalLayoutContainer();
fieldSetLayout.setScrollMode(ScrollMode.AUTO); // fieldSetLayout.setScrollMode(ScrollMode.AUTO);
fieldSet.add(fieldSetLayout); fieldSet.add(fieldSetLayout, new MarginData(0));
ArrayList<FieldLabel> fields = generateFields(rowRaw); ArrayList<FieldLabel> fields = generateFields(rowRaw);
for (FieldLabel fl : fields) { for (FieldLabel fl : fields) {
fieldSetLayout.add(fl, new VerticalLayoutData(1, -1, fieldSetLayout.add(fl, new VerticalLayoutData(1, -1,
new Margins(1))); new Margins(0)));
} }
v.add(fieldSet, new VerticalLayoutData(1, -1, new Margins(1))); v.add(fieldSet, new VerticalLayoutData(1, -1, new Margins(1)));
@ -222,21 +226,25 @@ public class EditRowPanel extends FramedPanel implements MonitorDialogListener {
FieldSet fieldSet = new FieldSet(); FieldSet fieldSet = new FieldSet();
fieldSet.setCollapsible(false); fieldSet.setCollapsible(false);
fieldSet.setItemId(ITEM_CREATE_ROW); fieldSet.setItemId(ITEM_CREATE_ROW);
fieldSet.setHeadingText("New");
fieldSet.setWidth(FIELDSETWIDTH);
rowsId.add(ITEM_CREATE_ROW); rowsId.add(ITEM_CREATE_ROW);
VerticalLayoutContainer fieldSetLayout = new VerticalLayoutContainer(); VerticalLayoutContainer fieldSetLayout = new VerticalLayoutContainer();
fieldSetLayout.setScrollMode(ScrollMode.AUTO); // fieldSetLayout.setScrollMode(ScrollMode.AUTO);
fieldSet.add(fieldSetLayout); fieldSet.add(fieldSetLayout);
ArrayList<FieldLabel> fields = generateFields(null); ArrayList<FieldLabel> fields = generateFields(null);
for (FieldLabel fl : fields) { for (FieldLabel fl : fields) {
fieldSetLayout.add(fl, new VerticalLayoutData(1, -1, fieldSetLayout.add(fl, new VerticalLayoutData(1, -1,
new Margins(1))); new Margins(0)));
} }
v.add(fieldSet, new VerticalLayoutData(1, -1, new Margins(1))); v.add(fieldSet, new VerticalLayoutData(1, -1, new Margins(1)));
} }
container.add(v, new MarginData(0));
container.forceLayout(); container.forceLayout();
VerticalLayoutContainer vPanel = new VerticalLayoutContainer(); VerticalLayoutContainer vPanel = new VerticalLayoutContainer();
@ -716,8 +724,7 @@ public class EditRowPanel extends FramedPanel implements MonitorDialogListener {
EditRowSession editRowSession; EditRowSession editRowSession;
if (editRow) { if (editRow) {
editRowSession = new EditRowSession(trId, columns, rowsMaps, editRowSession = new EditRowSession(trId, columns, rowsMaps, rowsId);
rowsId);
} else { } else {
editRowSession = new EditRowSession(trId, columns, rowsMaps); editRowSession = new EditRowSession(trId, columns, rowsMaps);
} }