diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/AbstractRegistrationForm.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/AbstractRegistrationForm.java index 661f8ff5911f5b18058194ccb9e8810a25ed2089..6515b55e877e7563cf10738d43f62754ce235a45 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/AbstractRegistrationForm.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/AbstractRegistrationForm.java @@ -82,7 +82,7 @@ public abstract class AbstractRegistrationForm extends ContentPanel implements public static final int SECTION_DEFAULT_FIELD_WIDTH = DEFAULT_FIELD_WIDTH;// -15 - public static final int SECTION_WIDTH = SECTION_FIELD_WIDTH + SECTION_LABEL_WIDTH + 70;// +16 + public static final int SECTION_WIDTH = SECTION_FIELD_WIDTH + SECTION_LABEL_WIDTH + 80;// +16 protected IMessageProvider messageProvider; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ManagedPropertyField.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ManagedPropertyField.java index a80f86cb3e9deb20f3a39fb57c32408f2813c2e8..be634ee10de195b4013486122683cd90730e0abf 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ManagedPropertyField.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ManagedPropertyField.java @@ -81,12 +81,12 @@ public class ManagedPropertyField extends Field<List<Map<String, String>>> @Override public void componentSelected(ButtonEvent ce) { - addNewSection(); + addNewSection(sections.size()); } }); addButton.setToolTip("Add a new section."); verticalPanel.add(addButton); - addNewSection(); + addNewSection(0); } public Widget getWidget() @@ -110,7 +110,7 @@ public class ManagedPropertyField extends Field<List<Map<String, String>>> return list; } - private void addNewSection() + private void addNewSection(int sectionIndex) { FormPanel formPanel = new FormPanel(); formPanel.setLabelWidth(AbstractRegistrationForm.DEFAULT_LABEL_WIDTH - SPACING - 2); @@ -123,9 +123,21 @@ public class ManagedPropertyField extends Field<List<Map<String, String>>> final HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setSpacing(SPACING); horizontalPanel.add(formPanel); + final Section section = new Section(inputFieldsByCode); + Button addBeforeButton = new Button("+"); + addBeforeButton.setToolTip("Add a new section before this section."); + addBeforeButton.addSelectionListener(new SelectionListener<ButtonEvent>() + { + @Override + public void componentSelected(ButtonEvent ce) + { + int index = sections.indexOf(section); + addNewSection(index); + } + }); + horizontalPanel.add(addBeforeButton); Button removeButton = new Button("-"); removeButton.setToolTip("Delete this section."); - final Section section = new Section(inputFieldsByCode); removeButton.addSelectionListener(new SelectionListener<ButtonEvent>() { @Override @@ -150,8 +162,8 @@ public class ManagedPropertyField extends Field<List<Map<String, String>>> } }); horizontalPanel.add(removeButton); - sections.add(section); - verticalPanel.insert(horizontalPanel, verticalPanel.getItemCount() - 1); + sections.add(sectionIndex, section); + verticalPanel.insert(horizontalPanel, sectionIndex); verticalPanel.layout(); } }