Java Code Examples for com.smartgwt.client.widgets.form.DynamicForm#getValueAsString()

The following examples show how to use com.smartgwt.client.widgets.form.DynamicForm#getValueAsString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DigitalObjectAdministrationEditor.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private void saveBatchEditor() {
    DynamicForm form = getBatchEditor().getForm();
    String device = form.getValueAsString(DigitalObjectAdministrationDataSource.FIELD_DEVICE);
    String[] pids = DigitalObject.toPidArray(digitalObjects);
    Record update = new Record();
    update.setAttribute(DigitalObjectAdministrationDataSource.FIELD_PID, pids);
    String batchId = digitalObjects[0].getBatchId();
    if (batchId != null) {
        update.setAttribute(DigitalObjectResourceApi.ATM_ITEM_BATCHID, batchId);
    }
    update.setAttribute(DigitalObjectAdministrationDataSource.FIELD_DEVICE, device);
    DigitalObjectAdministrationDataSource.getInstance().updateData(update, new DSCallback() {

        @Override
        public void execute(DSResponse response, Object rawData, DSRequest request) {
            if (RestConfig.isStatusOk(response)) {
                StatusView.getInstance().show(i18n.SaveAction_Done_Msg());
            }
        }
    });
}
 
Example 2
Source File: WorkflowMaterialView.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private void save(DynamicForm form) {
    final String type = form.getValueAsString(WorkflowMaterialDataSource.FIELD_TYPE);
    form.saveData(new DSCallback() {

        @Override
        public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) {
            if (RestConfig.isStatusOk(dsResponse)) {
                if (MaterialType.PHYSICAL_DOCUMENT.name().equals(type)) {
                    // the name of job might be changed, refresh the job and task
                    DSResponse resetCache = new DSResponse();
                    resetCache.setInvalidateCache(true);
                    resetCache.setOperationType(DSOperationType.UPDATE);
                    WorkflowTaskDataSource.getInstance().updateCaches(resetCache);
                    WorkflowJobDataSource.getInstance().updateCaches(resetCache);
                }
            }
        }
    });
}
 
Example 3
Source File: IdentifierDataSource.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected boolean condition(Object value) {
    boolean valid = true;
    if (value instanceof String) {
        String svalue = (String) value;
        svalue = svalue.trim();
        setResultingValue(svalue);
        FormItem fi = getFormItem();
        DynamicForm form = fi.getForm();
        String type = form.getValueAsString(FIELD_TYPE);
        if (TYPE_UUID.equals(type)) {
            if (!RE_UUID.test(svalue)) {
                valid = false;
                setErrorMessage(i18n.Validation_Invalid_UUID_Msg());
            }
        } else if (TYPE_ISSN.equals(type)) {
            if (!RE_ISSN.test(svalue)) {
                valid = false;
                setErrorMessage(i18n.Validation_Invalid_ISSN_Msg());
            }
        } else if (TYPE_ISBN.equals(type)) {
            if (!RE_ISBN.test(svalue)) {
                valid = false;
                setErrorMessage(i18n.Validation_Invalid_ISBN_Msg());
            }
        } else if (TYPE_CCNB.equals(type)) {
            if (!RE_CCNB.test(svalue)) {
                valid = false;
                setErrorMessage(i18n.Validation_Invalid_CCNB_Msg());
            }
        } else if (svalue.isEmpty()) {
            valid = false;
            setErrorMessage(i18nSmartGwt.validator_requiredField());
        }
    } else {
        valid = false;
        setErrorMessage(i18nSmartGwt.validator_requiredField());
    }
    return valid;
}
 
Example 4
Source File: NsesssV2Form.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
/** Switches form members according to selected subject type. */
private void resetDorucenyDokumentOdesilatelForm(DynamicForm form, Field group, String subjectTypeValue, boolean clear) {
    String value = subjectTypeValue != null ? subjectTypeValue : form.getValueAsString("subjectType");
    boolean isPravnickaOsoba = "PravnickaOsoba".equals(value);
    resetField(form.getField("PostovniAdresa"), clear && isPravnickaOsoba, !isPravnickaOsoba, !isPravnickaOsoba);
    resetIdentifierField(form.getField("IdentifikatorOrganizace"), clear && !isPravnickaOsoba, isPravnickaOsoba, isPravnickaOsoba);
    resetIdentifierField(form.getField("IdentifikatorFyzickeOsoby"), false, true, false);
    resetField(form.getField("NazevFyzickeOsoby"),  false, true, !isPravnickaOsoba);
    resetField(form.getField("NazevOrganizace"), clear && !isPravnickaOsoba, isPravnickaOsoba, isPravnickaOsoba);
    resetField(form.getField("OrganizacniUtvar"), clear && !isPravnickaOsoba, isPravnickaOsoba, false);
    resetField(form.getField("PracovniPozice"), clear && !isPravnickaOsoba, isPravnickaOsoba, false);
    resetField(form.getField("SidloOrganizace"), clear && !isPravnickaOsoba, isPravnickaOsoba, isPravnickaOsoba);
    resetField(form.getField("ElektronickyKontakt"), false, true, !isPravnickaOsoba);
}
 
Example 5
Source File: NsesssV2Form.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
/** Switches form members according to selected subject type. */
private void resetDokumentPrijemceForm(DynamicForm form, Field group, String subjectTypeValue, boolean clear) {
    String value = subjectTypeValue != null ? subjectTypeValue : form.getValueAsString("subjectType");
    boolean isPravnickaOsoba = "PravnickaOsoba".equals(value);
    resetField(form.getField("PostovniAdresa"), clear && isPravnickaOsoba, !isPravnickaOsoba, !isPravnickaOsoba);
    resetIdentifierField(form.getField("IdentifikatorOrganizace"), clear && !isPravnickaOsoba, isPravnickaOsoba, isPravnickaOsoba);
    resetIdentifierField(form.getField("IdentifikatorFyzickeOsoby"), false, true, !isPravnickaOsoba);
    resetField(form.getField("NazevOrganizace"), clear && !isPravnickaOsoba, isPravnickaOsoba, isPravnickaOsoba);
    resetField(form.getField("OrganizacniUtvar"), clear && !isPravnickaOsoba, isPravnickaOsoba, isPravnickaOsoba);
    resetField(form.getField("PracovniPozice"), clear && !isPravnickaOsoba, isPravnickaOsoba, isPravnickaOsoba);
    resetField(form.getField("SidloOrganizace"), clear && !isPravnickaOsoba, isPravnickaOsoba, isPravnickaOsoba);
}
 
Example 6
Source File: WorkflowTasksEditor.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public void onSave(WorkflowTaskFormView taskFormView) {
    if (taskFormView.validate()) {
        view.setExpectUpdateOperation(true);
        DSRequest req = new DSRequest();
        req.setWillHandleError(true);
        final DynamicForm taskForm = taskFormView.getTask();
        Object oldState = taskForm.getOldValues().get(WorkflowTaskDataSource.FIELD_STATE);
        String newState = taskForm.getValueAsString(WorkflowTaskDataSource.FIELD_STATE);
        final boolean stateChanged = !newState.equals(oldState);
        taskForm.saveData(new DSCallback() {

            @Override
            public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) {
                boolean statusOk = RestConfig.isStatusOk(dsResponse);
                if (statusOk) {
                    view.refreshState();
                    String taskId = taskForm.getValueAsString(WorkflowTaskDataSource.FIELD_ID);
                    view.refreshParameters(taskId);
                    if (stateChanged) {
                        StatusView.getInstance().show(i18n.SaveAction_Done_Msg());
                        DSResponse reset = new DSResponse();
                        reset.setOperationType(DSOperationType.UPDATE);
                        reset.setInvalidateCache(true);
                        WorkflowTaskDataSource.getInstance().updateCaches(reset);
                        WorkflowJobDataSource.getInstance().updateCaches(reset);
                    }
                } else if (RestConfig.isConcurrentModification(dsResponse)) {
                    SC.ask(i18n.SaveAction_ConcurrentErrorAskReload_Msg(), new BooleanCallback() {

                        @Override
                        public void execute(Boolean value) {
                            if (value != null && value) {
                                view.editSelection();
                            }
                        }
                    });
                } else {
                    ErrorHandler.warn(dsResponse, dsRequest);
                }
                taskForm.focus();
            }
        }, req);
    }
}