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:
parent
c8e081d048
commit
aa253072c4
|
@ -20,7 +20,7 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
|||
*
|
||||
*/
|
||||
public class EditRowDialog extends Window {
|
||||
protected String WIDTH = "600px";
|
||||
protected String WIDTH = "690px";
|
||||
protected String HEIGHT = "456px";
|
||||
protected TRId trId;
|
||||
protected EventBus eventBus;
|
||||
|
|
|
@ -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.HBoxLayoutContainer;
|
||||
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.VerticalLayoutContainer;
|
||||
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*$)"
|
||||
+ "|(\\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 FIELDSHEIGHT = "370px";
|
||||
private static final String CONTAINERHEIGHT = "370px";
|
||||
private static final int LABELSIZE = 120;
|
||||
private static final String FIELDSETWIDTH = "640px";
|
||||
|
||||
private EditRowDialog parent;
|
||||
private TRId trId;
|
||||
|
@ -90,9 +92,9 @@ public class EditRowPanel extends FramedPanel implements MonitorDialogListener {
|
|||
private boolean editRow;
|
||||
|
||||
private VerticalLayoutContainer v;
|
||||
|
||||
|
||||
private ArrayList<String> rowsId;
|
||||
|
||||
|
||||
private TextButton btnSave;
|
||||
private TextButton btnClose;
|
||||
|
||||
|
@ -153,11 +155,11 @@ public class EditRowPanel extends FramedPanel implements MonitorDialogListener {
|
|||
|
||||
protected void create() {
|
||||
SimpleContainer container = new SimpleContainer();
|
||||
container.setHeight(FIELDSHEIGHT);
|
||||
container.setHeight(CONTAINERHEIGHT);
|
||||
|
||||
v = new VerticalLayoutContainer();
|
||||
v.setScrollMode(ScrollMode.AUTO);
|
||||
container.add(v);
|
||||
v.setAdjustForScroll(true);
|
||||
|
||||
btnSave = new TextButton("Save");
|
||||
btnSave.setIcon(ResourceBundle.INSTANCE.save());
|
||||
|
@ -196,22 +198,24 @@ public class EditRowPanel extends FramedPanel implements MonitorDialogListener {
|
|||
flowButton.add(btnSave, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||
|
||||
rowsId=new ArrayList<String>();
|
||||
if (editRow) {
|
||||
rowsId = new ArrayList<String>();
|
||||
if (editRow) {
|
||||
for (RowRaw rowRaw : rowsRaw) {
|
||||
FieldSet fieldSet = new FieldSet();
|
||||
fieldSet.setCollapsible(false);
|
||||
fieldSet.setItemId(rowRaw.getRowId());
|
||||
fieldSet.setHeadingText(rowRaw.getRowId());
|
||||
fieldSet.setWidth(FIELDSETWIDTH);
|
||||
rowsId.add(rowRaw.getRowId());
|
||||
|
||||
|
||||
VerticalLayoutContainer fieldSetLayout = new VerticalLayoutContainer();
|
||||
fieldSetLayout.setScrollMode(ScrollMode.AUTO);
|
||||
fieldSet.add(fieldSetLayout);
|
||||
// fieldSetLayout.setScrollMode(ScrollMode.AUTO);
|
||||
fieldSet.add(fieldSetLayout, new MarginData(0));
|
||||
|
||||
ArrayList<FieldLabel> fields = generateFields(rowRaw);
|
||||
for (FieldLabel fl : fields) {
|
||||
fieldSetLayout.add(fl, new VerticalLayoutData(1, -1,
|
||||
new Margins(1)));
|
||||
new Margins(0)));
|
||||
}
|
||||
|
||||
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.setCollapsible(false);
|
||||
fieldSet.setItemId(ITEM_CREATE_ROW);
|
||||
fieldSet.setHeadingText("New");
|
||||
fieldSet.setWidth(FIELDSETWIDTH);
|
||||
rowsId.add(ITEM_CREATE_ROW);
|
||||
|
||||
|
||||
VerticalLayoutContainer fieldSetLayout = new VerticalLayoutContainer();
|
||||
fieldSetLayout.setScrollMode(ScrollMode.AUTO);
|
||||
// fieldSetLayout.setScrollMode(ScrollMode.AUTO);
|
||||
fieldSet.add(fieldSetLayout);
|
||||
|
||||
ArrayList<FieldLabel> fields = generateFields(null);
|
||||
for (FieldLabel fl : fields) {
|
||||
fieldSetLayout.add(fl, new VerticalLayoutData(1, -1,
|
||||
new Margins(1)));
|
||||
new Margins(0)));
|
||||
}
|
||||
|
||||
|
||||
v.add(fieldSet, new VerticalLayoutData(1, -1, new Margins(1)));
|
||||
}
|
||||
|
||||
|
||||
container.add(v, new MarginData(0));
|
||||
container.forceLayout();
|
||||
|
||||
VerticalLayoutContainer vPanel = new VerticalLayoutContainer();
|
||||
|
@ -546,7 +554,7 @@ public class EditRowPanel extends FramedPanel implements MonitorDialogListener {
|
|||
int lenght = v.getWidgetCount();
|
||||
|
||||
HashMap<String, HashMap<String, String>> rowsMaps = new HashMap<String, HashMap<String, String>>();
|
||||
|
||||
|
||||
for (; i < lenght; i++) {
|
||||
FieldSet fieldSet = (FieldSet) v.getWidget(i);
|
||||
VerticalLayoutContainer fieldSetLayout = (VerticalLayoutContainer) fieldSet
|
||||
|
@ -709,15 +717,14 @@ public class EditRowPanel extends FramedPanel implements MonitorDialogListener {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rowsMaps.put(fieldSet.getItemId(), maps);
|
||||
|
||||
|
||||
}
|
||||
|
||||
EditRowSession editRowSession;
|
||||
if (editRow) {
|
||||
editRowSession = new EditRowSession(trId, columns, rowsMaps,
|
||||
rowsId);
|
||||
editRowSession = new EditRowSession(trId, columns, rowsMaps, rowsId);
|
||||
} else {
|
||||
editRowSession = new EditRowSession(trId, columns, rowsMaps);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue