added new event, freeze method is parametric
This commit is contained in:
parent
0de955cf4f
commit
dd1ab08224
|
@ -99,6 +99,9 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
|
|||
|
||||
/** The create button. */
|
||||
@UiField Button createButton;
|
||||
|
||||
/** The create button. */
|
||||
@UiField Button editButton;
|
||||
|
||||
/** The info block. */
|
||||
// @UiField Button resetButton;
|
||||
|
@ -178,7 +181,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
|
|||
protected static final String PRODUCT_CREATED_OK = "Item correctly published!";
|
||||
|
||||
/** The Constant TRYING_TO_CREATE_PRODUCT. */
|
||||
private static final String TRYING_TO_CREATE_PRODUCT = "Trying to publish the item, please wait...";
|
||||
private static final String DATA_FORM_FILLED_IN_CORRECTLY = "Data form filled in correclty";
|
||||
|
||||
/** The Constant MISSING_PUBLISH_RIGHTS. */
|
||||
protected static final String MISSING_PUBLISH_RIGHTS = "It seems you are not authorized to publish on catalogue. Request it to the VRE manager or the portal administrator.";
|
||||
|
@ -236,6 +239,9 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
|
|||
/** The metadata profiles. */
|
||||
private List<MetaDataProfileBean> metadataProfiles;
|
||||
|
||||
/** The form data bean. */
|
||||
private GenericDatasetBean formDataBean;
|
||||
|
||||
/**
|
||||
* Invoked in the most general case.
|
||||
*
|
||||
|
@ -630,18 +636,35 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
|
|||
gdb.setMetadataList(metadataProfiles);
|
||||
gdb.setCustomFields(customFieldsMap);
|
||||
gdb.setFilesUploaded(listFilesUploaded);
|
||||
formDataBean = gdb;
|
||||
|
||||
// alert
|
||||
//alertOnCreate(TRYING_TO_CREATE_PRODUCT, AlertType.INFO, false);
|
||||
alertOnCreate(DATA_FORM_FILLED_IN_CORRECTLY, AlertType.SUCCESS, false);
|
||||
|
||||
// invoke the create method
|
||||
createButton.setEnabled(false);
|
||||
|
||||
createButton.setVisible(false);
|
||||
editButton.setVisible(true);
|
||||
disableDatasetFields(true);
|
||||
notifyValidForm(gdb);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits the button click handler.
|
||||
*
|
||||
* @param e the e
|
||||
*/
|
||||
@UiHandler("editButton")
|
||||
void editButtonClickHandler(ClickEvent e){
|
||||
formDataBean = null;
|
||||
createButton.setEnabled(true);
|
||||
createButton.setVisible(true);
|
||||
editButton.setVisible(false);
|
||||
onCreateAlertBlock.setVisible(false);
|
||||
disableDatasetFields(false);
|
||||
notifyOnEditForm();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if is form data valid.
|
||||
|
@ -651,6 +674,16 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
|
|||
public boolean isFormDataValid() {
|
||||
return areProfileDataValid() == null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the form data bean.
|
||||
*
|
||||
* @return the form data bean
|
||||
*/
|
||||
public GenericDatasetBean getFormDataBean() {
|
||||
return formDataBean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the info icons of all core metadata info.
|
||||
|
@ -743,6 +776,8 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
|
|||
|
||||
/**
|
||||
* Reset form event.
|
||||
*
|
||||
* @param bool the bool
|
||||
*/
|
||||
/*@UiHandler("resetButton")
|
||||
void resetFormEvent(ClickEvent e){
|
||||
|
@ -757,26 +792,26 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
|
|||
/**
|
||||
* Disable dataset editable fields once the dataset has been successfully created.
|
||||
*/
|
||||
protected void disableDatasetFields() {
|
||||
protected void disableDatasetFields(boolean bool) {
|
||||
|
||||
//tagsPanel.freeze();
|
||||
addCustomFieldButton.setEnabled(false);
|
||||
metadataTypeListbox.setEnabled(false);
|
||||
addCustomFieldButton.setEnabled(!bool);
|
||||
metadataTypeListbox.setEnabled(!bool);
|
||||
|
||||
for(CustomFieldEntry ce: customFieldEntriesList)
|
||||
ce.freeze();
|
||||
ce.freeze(!bool);
|
||||
|
||||
// disable profile fields
|
||||
for (MetaDataField metaField : listOfMetadataFields) {
|
||||
for (MetaDataFieldSkeleton field : metaField.getListOfMetadataFields()) {
|
||||
field.freeze();
|
||||
field.freeze(bool);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// freeze table of resources
|
||||
if(resourcesTwinPanel != null)
|
||||
resourcesTwinPanel.freeze();
|
||||
resourcesTwinPanel.freeze(bool);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -860,6 +895,17 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify valid form.
|
||||
*
|
||||
* @param genericDatasetBean the generic dataset bean
|
||||
*/
|
||||
private void notifyOnEditForm(){
|
||||
for (GenericFormEventsListener listener : listenersGenericFormEvents) {
|
||||
listener.onFormDataEdit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notify validation error.
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
<u:LoaderIcon ui:field="loaderProfiles" visible="false"></u:LoaderIcon>
|
||||
<b:Form type="HORIZONTAL" styleName="{style.form-main-style}"
|
||||
ui:field="formFirstStep" visible="true">
|
||||
|
||||
|
||||
<b:Fieldset styleName="{style.fieldset-border-style}">
|
||||
<b:Legend styleName="{style.legend-style}">
|
||||
Choose a Profile
|
||||
|
@ -178,6 +178,10 @@
|
|||
<b:Button title="Create Item" ui:field="createButton"
|
||||
type="PRIMARY" block="true">Create</b:Button>
|
||||
|
||||
<b:Button title="Edit Item" ui:field="editButton"
|
||||
type="PRIMARY" block="true" visible="false">Edit</b:Button>
|
||||
|
||||
|
||||
<!-- <b:Button title="Go Back" ui:field="goBackButtonSecondStep" -->
|
||||
<!-- block="true">Go -->
|
||||
<!-- Back</b:Button> -->
|
||||
|
|
|
@ -35,12 +35,17 @@ public class GenericFormEvents {
|
|||
* @param genericDatasetBean the generic dataset bean
|
||||
*/
|
||||
void onFormDataValid(GenericDatasetBean genericDatasetBean);
|
||||
|
||||
/**
|
||||
* On form data edit.
|
||||
*/
|
||||
void onFormDataEdit();
|
||||
|
||||
|
||||
/**
|
||||
* On aborted form.
|
||||
* On form aborted.
|
||||
*/
|
||||
void onAbortedForm();
|
||||
|
||||
void onFormAborted();
|
||||
|
||||
/**
|
||||
* On validation error.
|
||||
|
@ -49,8 +54,6 @@ public class GenericFormEvents {
|
|||
* @param errorMsg the error msg
|
||||
*/
|
||||
void onValidationError(Throwable throwable, String errorMsg);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -98,9 +98,9 @@ public class CustomFieldEntry extends Composite {
|
|||
/**
|
||||
* Remove delete button
|
||||
*/
|
||||
public void freeze() {
|
||||
public void freeze(boolean bool) {
|
||||
|
||||
removeCustomField.setEnabled(false);
|
||||
removeCustomField.setEnabled(bool);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -828,55 +828,56 @@ public class MetaDataFieldSkeleton extends Composite {
|
|||
/**
|
||||
* Freeze this widget (after on create)
|
||||
*/
|
||||
public void freeze() {
|
||||
public void freeze(boolean bool) {
|
||||
|
||||
switch (field.getType()) {
|
||||
|
||||
case Boolean:
|
||||
|
||||
((CheckBox) holder).setEnabled(false);
|
||||
((CheckBox) holder).setEnabled(!bool);
|
||||
break;
|
||||
|
||||
case GeoJSON:
|
||||
case Text:
|
||||
|
||||
((TextArea) holder).setEnabled(false);
|
||||
((TextArea) holder).setEnabled(!bool);
|
||||
break;
|
||||
|
||||
case Time:
|
||||
|
||||
((DataTimeBox) holder).freeze();
|
||||
((DataTimeBox) holder).freeze(!bool);
|
||||
break;
|
||||
|
||||
case Time_Interval:
|
||||
|
||||
rangesList.get(0).freeze();
|
||||
rangesList.get(0).freeze(!bool);
|
||||
break;
|
||||
|
||||
case Times_ListOf:
|
||||
|
||||
for (DataTimeBox el : rangesList)
|
||||
el.freeze();
|
||||
el.freeze(bool);
|
||||
|
||||
break;
|
||||
|
||||
case Number:
|
||||
|
||||
((TextBox) holder).setEnabled(false);
|
||||
((TextBox) holder).setEnabled(!bool);
|
||||
break;
|
||||
|
||||
case String:
|
||||
|
||||
if (holder.getClass().equals(ListBox.class))
|
||||
((ListBox) holder).setEnabled(false);
|
||||
((ListBox) holder).setEnabled(!bool);
|
||||
else
|
||||
((TextBox) holder).setEnabled(false);
|
||||
((TextBox) holder).setEnabled(!bool);
|
||||
break;
|
||||
|
||||
case File:
|
||||
GWT.log("here");
|
||||
if (holder.getClass().equals(MultipleDilaogUpload.class) || holder.getClass().equals(DialogUpload.class)) {
|
||||
DialogUpload dUpload = (DialogUpload) holder;
|
||||
dUpload.getElement().setPropertyString("disabled", "true");
|
||||
dUpload.enableUpload(!bool);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -129,10 +129,10 @@ public class DataTimeBox extends Composite{
|
|||
/**
|
||||
* Freeze the inputs
|
||||
*/
|
||||
public void freeze(){
|
||||
startRangeDate.setEnabled(false);
|
||||
startRangeTime.setEnabled(false);
|
||||
endRangeDate.setEnabled(false);
|
||||
endRangeTime.setEnabled(false);
|
||||
public void freeze(boolean bool){
|
||||
startRangeDate.setEnabled(bool);
|
||||
startRangeTime.setEnabled(bool);
|
||||
endRangeDate.setEnabled(bool);
|
||||
endRangeTime.setEnabled(bool);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -475,21 +475,21 @@ public class TwinColumnSelectionMainPanel extends Composite{
|
|||
/**
|
||||
* Freeze the panel
|
||||
*/
|
||||
public void freeze() {
|
||||
public void freeze(boolean bool) {
|
||||
|
||||
frozen = true;
|
||||
frozen = bool;
|
||||
|
||||
Iterator<Widget> iteratorOverPath = breadcrumbs.iterator();
|
||||
while (iteratorOverPath.hasNext()) {
|
||||
Widget widget = iteratorOverPath.next();
|
||||
if(widget instanceof NavLink)
|
||||
((NavLink)widget).setActive(false);
|
||||
((NavLink)widget).setActive(!bool);
|
||||
}
|
||||
|
||||
allToRightButton.setEnabled(false);
|
||||
toRightButton.setEnabled(false);
|
||||
allToLeftButton.setEnabled(false);
|
||||
toLeftButton.setEnabled(false);
|
||||
allToRightButton.setEnabled(!bool);
|
||||
toRightButton.setEnabled(!bool);
|
||||
allToLeftButton.setEnabled(!bool);
|
||||
toLeftButton.setEnabled(!bool);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -65,7 +65,7 @@ public class DialogUpload extends FormPanel implements HasWorskpaceUploadNotific
|
|||
//protected String clientUploadKey;
|
||||
|
||||
/** The purged uploading file name. */
|
||||
private String purgedUploadingFileName;
|
||||
private String purgedUploadingFileName;
|
||||
|
||||
/** The upv. */
|
||||
private UploaderProgressView upv;
|
||||
|
@ -361,5 +361,15 @@ private String purgedUploadingFileName;
|
|||
public void removeWorkspaceUploadNotificationListener(WorskpaceUploadNotificationListener handler) {
|
||||
controller.removeWorkspaceUploadListener(handler);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enable upload.
|
||||
*
|
||||
* @param bool the bool
|
||||
*/
|
||||
public void enableUpload(boolean bool){
|
||||
fileUpload.setEnabled(bool);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue