Skip to content
Snippets Groups Projects
Commit 86af512c authored by izabel's avatar izabel
Browse files

[LMS-780] reorganize edit form fields order

SVN: 10256
parent 9a39795e
No related branches found
No related tags found
No related merge requests found
......@@ -29,7 +29,7 @@ import com.extjs.gxt.ui.client.widget.form.FileUploadField;
*/
public class AttachmentManager
{
private static final String FIELD_LABEL_TEMPLATE = "Attachment";
private final String fieldLabel;
private static final String FIELD_NAME_TEMPLATE = "{0}_{1}";
......@@ -37,9 +37,10 @@ public class AttachmentManager
private final String sessionKey;
public AttachmentManager(String sessionKey, int initialNumberOfAttachments)
public AttachmentManager(String sessionKey, int initialNumberOfAttachments, String fieldLabel)
{
this.sessionKey = sessionKey;
this.fieldLabel = fieldLabel;
attachmentFields = new ArrayList<FileUploadField>();
for (int i = 0; i < initialNumberOfAttachments; i++)
{
......@@ -78,7 +79,7 @@ public class AttachmentManager
{
final FileUploadField file = new FileUploadField();
final int number = counter + 1;
file.setFieldLabel(FIELD_LABEL_TEMPLATE);
file.setFieldLabel(fieldLabel);
file.setName(Format.substitute(FIELD_NAME_TEMPLATE, sessionKey, number));
return file;
}
......
......@@ -68,7 +68,8 @@ public final class GenericExperimentEditForm
super(viewContext, entity, editMode);
this.viewContext = viewContext;
sessionKey = createSimpleId(EntityKind.EXPERIMENT, entity.getId() + "");
attachmentManager = new AttachmentManager(sessionKey, DEFAULT_NUMBER_OF_ATTACHMENTS);
attachmentManager =
new AttachmentManager(sessionKey, DEFAULT_NUMBER_OF_ATTACHMENTS, "New Attachment");
addUploadFeatures(formPanel, sessionKey);
formPanel.addListener(Events.Submit, new FormPanelListener(infoBox)
{
......
......@@ -68,7 +68,7 @@ public final class GenericExperimentRegistrationForm
private ProjectSelectionWidget projectSelectionWidget;
private AttachmentManager attachmentManager =
new AttachmentManager(SESSION_KEY, DEFAULT_NUMBER_OF_ATTACHMENTS);
new AttachmentManager(SESSION_KEY, DEFAULT_NUMBER_OF_ATTACHMENTS, "Attachment");
private TextArea samplesArea;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment