Fixed TR Description fields
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-csv-import-widget@86496 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
6fb3d595d6
commit
b3df0fdb3e
|
@ -3,22 +3,19 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.td.csvimportwidget.client;
|
package org.gcube.portlets.user.td.csvimportwidget.client;
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||||
|
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
import com.google.gwt.user.client.Command;
|
import com.google.gwt.user.client.Command;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||||
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
||||||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
|
||||||
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;
|
||||||
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
||||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
|
||||||
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
||||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
|
||||||
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||||
import com.sencha.gxt.widget.core.client.form.FieldSet;
|
import com.sencha.gxt.widget.core.client.form.FieldSet;
|
||||||
import com.sencha.gxt.widget.core.client.form.TextArea;
|
import com.sencha.gxt.widget.core.client.form.TextArea;
|
||||||
|
@ -46,11 +43,7 @@ public class CSVTableDetailCard extends WizardCard {
|
||||||
protected TextArea description;
|
protected TextArea description;
|
||||||
protected TextArea rights;
|
protected TextArea rights;
|
||||||
|
|
||||||
protected TextButton checkButton;
|
protected TabResource detail = new TabResource();
|
||||||
|
|
||||||
// protected ComboBox<Agencies> combo=null;
|
|
||||||
|
|
||||||
TabResource detail = new TabResource();
|
|
||||||
|
|
||||||
public CSVTableDetailCard(final CSVImportSession importSession) {
|
public CSVTableDetailCard(final CSVImportSession importSession) {
|
||||||
super("Tabular Resource Detail", "");
|
super("Tabular Resource Detail", "");
|
||||||
|
@ -96,47 +89,14 @@ public class CSVTableDetailCard extends WizardCard {
|
||||||
rights.setAllowBlank(false);
|
rights.setAllowBlank(false);
|
||||||
p.add(new FieldLabel(rights, "Rights"), new VerticalLayoutData(1, -1));
|
p.add(new FieldLabel(rights, "Rights"), new VerticalLayoutData(1, -1));
|
||||||
|
|
||||||
checkButton = new TextButton("Save");
|
|
||||||
checkButton.addSelectHandler(new SelectHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSelect(SelectEvent event) {
|
|
||||||
checkData();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
form.addButton(checkButton);
|
|
||||||
tableDetailPanel.add(form);
|
tableDetailPanel.add(form);
|
||||||
|
|
||||||
setContent(tableDetailPanel);
|
setContent(tableDetailPanel);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkData() {
|
protected void checkField() {
|
||||||
if (name.getValue() == null || name.getValue().isEmpty()||!name.isValid()
|
|
||||||
|| description.getValue() == null
|
|
||||||
|| description.getValue().isEmpty()||!description.isValid()
|
|
||||||
|| rights.getValue() == null || rights.getValue().isEmpty()||!rights.isValid()
|
|
||||||
|
|
||||||
) {
|
|
||||||
AlertMessageBox d = new AlertMessageBox("Attention!",
|
|
||||||
"Fill in all fields");
|
|
||||||
d.addHideHandler(new HideHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onHide(HideEvent event) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
d.show();
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
name.setReadOnly(true);
|
|
||||||
description.setReadOnly(true);
|
|
||||||
rights.setReadOnly(true);
|
|
||||||
checkButton.disable();
|
|
||||||
getWizardWindow().setEnableNextButton(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -145,18 +105,7 @@ public class CSVTableDetailCard extends WizardCard {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
detail.setName(name.getCurrentValue());
|
checkData();
|
||||||
detail.setDescription(description.getCurrentValue());
|
|
||||||
detail.setRight(rights.getCurrentValue());
|
|
||||||
|
|
||||||
importSession.setTabResource(detail);
|
|
||||||
|
|
||||||
CSVOperationInProgressCard csvOperationInProgressCard = new CSVOperationInProgressCard(
|
|
||||||
importSession);
|
|
||||||
getWizardWindow().addCard(csvOperationInProgressCard);
|
|
||||||
Log.info("NextCard CSVOperationInProgressCard");
|
|
||||||
getWizardWindow().nextCard();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -176,8 +125,58 @@ public class CSVTableDetailCard extends WizardCard {
|
||||||
};
|
};
|
||||||
|
|
||||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||||
getWizardWindow().setEnableNextButton(false);
|
getWizardWindow().setEnableNextButton(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void checkData() {
|
||||||
|
getWizardWindow().setEnableNextButton(false);
|
||||||
|
getWizardWindow().setEnableBackButton(false);
|
||||||
|
AlertMessageBox d;
|
||||||
|
HideHandler hideHandler = new HideHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHide(HideEvent event) {
|
||||||
|
getWizardWindow().setEnableNextButton(true);
|
||||||
|
getWizardWindow().setEnableBackButton(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (name.getValue() == null || name.getValue().isEmpty()
|
||||||
|
|| !name.isValid() || description.getValue() == null
|
||||||
|
|| description.getValue().isEmpty() || !description.isValid()
|
||||||
|
|| rights.getValue() == null || rights.getValue().isEmpty()
|
||||||
|
|| !rights.isValid()
|
||||||
|
|
||||||
|
) {
|
||||||
|
d = new AlertMessageBox("Attention!", "Fill in all fields");
|
||||||
|
d.addHideHandler(hideHandler);
|
||||||
|
d.show();
|
||||||
|
} else {
|
||||||
|
name.setReadOnly(true);
|
||||||
|
description.setReadOnly(true);
|
||||||
|
rights.setReadOnly(true);
|
||||||
|
goNext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void goNext() {
|
||||||
|
try {
|
||||||
|
detail.setName(name.getCurrentValue());
|
||||||
|
detail.setDescription(description.getCurrentValue());
|
||||||
|
detail.setRight(rights.getCurrentValue());
|
||||||
|
|
||||||
|
importSession.setTabResource(detail);
|
||||||
|
|
||||||
|
CSVOperationInProgressCard csvOperationInProgressCard = new CSVOperationInProgressCard(
|
||||||
|
importSession);
|
||||||
|
getWizardWindow().addCard(csvOperationInProgressCard);
|
||||||
|
Log.info("NextCard CSVOperationInProgressCard");
|
||||||
|
getWizardWindow().nextCard();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.error("sayNextCard :" + e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue