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

The following examples show how to use com.smartgwt.client.widgets.form.DynamicForm#setNumCols() . 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: AutomationDialog.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
private Tab prepareScriptTab() {
	scriptForm = new DynamicForm();
	scriptForm.setWidth100();
	scriptForm.setHeight100();
	scriptForm.setTitleOrientation(TitleOrientation.TOP);
	scriptForm.setNumCols(1);

	final TextAreaItem automation = ItemFactory.newTextAreaItemForAutomation("automation", "automation", null, null,
			false);
	automation.setShowTitle(false);
	automation.setStartRow(false);
	automation.setRequired(true);
	automation.setWidth("*");
	automation.setHeight("*");
	scriptForm.setItems(automation);

	Tab tab = new Tab(I18N.message("script"));
	tab.setPane(scriptForm);
	return tab;
}
 
Example 2
Source File: ComparatorAssociationsDialog.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ComparatorAssociationsDialog(final ListGrid srcGrid) {
	this.srcGrid = srcGrid;

	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("associations"));
	setWidth(320);
	setHeight(360);

	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();

	comparator = ItemFactory.newComparatorSelector();
	comparator.setWidth(290);
	comparator.setRequired(true);
	comparator.setValue(DEFAULT_COMPARATOR);
	comparator.addChangedHandler(new ChangedHandler() {

		@Override
		public void onChanged(ChangedEvent event) {
			refresh();
		}
	});

	DynamicForm form = new DynamicForm();
	form.setTitleOrientation(TitleOrientation.TOP);
	form.setNumCols(1);
	form.setItems(comparator);

	addItem(form);

	refresh();
}
 
Example 3
Source File: WorkflowTaskFormView.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private DynamicForm createParameterForm(Record[] records) {
    if (records == null || records.length == 0) {
        return createDefaultParameterForm();
    }
    DynamicForm df = new DynamicForm();
    df.setUseFlatFields(true);
    df.setWrapItemTitles(false);
    df.setTitleOrientation(TitleOrientation.TOP);
    df.setNumCols(3);
    df.setColWidths("*", "*", "*");
    df.setItemHoverWidth(300);
    FormItem[] items = new FormItem[records.length];
    Record values = new Record();
    for (int i = 0; i < records.length; i++) {
        Record record = records[i];
        ValueType valueType = ValueType.fromString(
                record.getAttribute(WorkflowModelConsts.PARAMETER_VALUETYPE));
        DisplayType displayType = DisplayType.fromString(
                record.getAttribute(WorkflowModelConsts.PARAMETER_DISPLAYTYPE));
        displayType = valueType == ValueType.DATETIME ? DisplayType.DATETIME : displayType;

        String paramName = record.getAttribute(WorkflowParameterDataSource.FIELD_NAME);
        String fieldName = "f" + i;
        items[i] = createFormItem(record, valueType, displayType);
        items[i].setName(fieldName);
        // use dataPath to solve cases where the valid JSON name is not a valid javascript ID (param.id).
        items[i].setDataPath("/" + paramName);
        items[i].setTitle(record.getAttribute(WorkflowModelConsts.PARAMETER_PROFILELABEL));
        items[i].setTooltip(record.getAttribute(WorkflowModelConsts.PARAMETER_PROFILEHINT));
        Object val = getParameterValue(record, valueType, displayType);
        if (val != null) {
            values.setAttribute(paramName, val);
        }
    }
    df.setItems(items);
    df.editRecord(values);
    df.addItemChangedHandler(itemChangedHandler);
    return df;
}
 
Example 4
Source File: TaskEditor.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private VLayout prepareAutomationPanel() {
	VLayout automationPanel = new VLayout();
	automationPanel.setWidth100();
	automationPanel.setHeight100();

	DynamicForm automationForm = new DynamicForm();
	automationForm.setTitleOrientation(TitleOrientation.TOP);
	automationForm.setNumCols(1);
	automationForm.setValuesManager(vm);

	TextAreaItem onCreation = ItemFactory.newTextAreaItemForAutomation("onCreation",
			state.getType() == GUIWFState.TYPE_TASK ? "execscriptontaskreached" : "execscriptonenstatusreached",
			state.getOnCreation(), null, false);
	onCreation.setWidth("*");
	onCreation.setHeight(200);
	onCreation.setWrapTitle(false);

	TextAreaItem onAssignment = ItemFactory.newTextAreaItemForAutomation("onAssignment",
			"execscriptontaskassignment", state.getOnAssignment(), null, false);
	onAssignment.setWidth("*");
	onAssignment.setHeight(200);
	onAssignment.setWrapTitle(false);

	if (state.getType() == GUIWFState.TYPE_TASK)
		automationForm.setItems(onCreation, onAssignment);
	else {
		onCreation.setHeight(400);
		automationForm.setItems(onCreation);
	}

	automationPanel.addMember(automationForm);

	return automationPanel;
}
 
Example 5
Source File: DownloadTicketDialog.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void prepareForm() {
	form = new DynamicForm();
	form.setAlign(Alignment.LEFT);
	form.setNumCols(4);

	SelectItem type = ItemFactory.newAliasTypeSelector();
	type.setName("type");
	type.setValue("");
	type.setEndRow(true);
	type.setColSpan(4);
	type.setWrapTitle(false);

	DateItem date = ItemFactory.newDateItem("date", I18N.message("expireson"));
	date.setEndRow(true);
	date.setColSpan(4);
	date.setWrapTitle(false);

	SpinnerItem maxDownloads = ItemFactory.newSpinnerItem("maxDownloads", I18N.message("maxdownloads"),
			(Integer) null);
	maxDownloads.setEndRow(true);
	maxDownloads.setColSpan(4);
	maxDownloads.setWrapTitle(false);
	maxDownloads.setRequired(false);
	maxDownloads.setMin(0);

	SpinnerItem duedateTimeItem = ItemFactory.newSpinnerItem("duedateNumber", I18N.message("expiresin"), 24);
	duedateTimeItem.setWrapTitle(false);
	duedateTimeItem.setDefaultValue(24);
	duedateTimeItem.setMin(0);
	SelectItem duedateTime = ItemFactory.newDueTimeSelector("duedateTime", "");
	LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
	map.put("hour", I18N.message("hours"));
	map.put("day", I18N.message("ddays"));
	duedateTime.setValueMap(map);
	duedateTime.setValue("hour");

	form.setItems(type, duedateTimeItem, duedateTime, date, maxDownloads);
}
 
Example 6
Source File: FormCreate.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public FormCreate(FormsPanel grid) {
	this.grid = grid;

	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("createform"));
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setAutoSize(true);

	DynamicForm form = new DynamicForm();
	vm = new ValuesManager();
	form.setValuesManager(vm);
	form.setTitleOrientation(TitleOrientation.TOP);
	form.setNumCols(1);

	TextItem name = ItemFactory.newSimpleTextItem("name", "name", null);
	name.setRequired(true);
	name.setWidth(200);

	SelectItem template = ItemFactory.newTemplateSelector(true, null);

	create = new SubmitItem();
	create.setTitle(I18N.message("create"));
	create.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			onCreate();
		}
	});

	form.setItems(name, template, create);

	addItem(form);
}
 
Example 7
Source File: RepeatableFormItem.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
@Override
public DynamicForm create() {
    final DynamicForm form = new DynamicForm();
    form.setNumCols(formPrototype.getNumCols());
    form.setDataSource(dataSource);
    if (formPrototype.getUseAllDataSourceFields()) {
        form.setUseAllDataSourceFields(true);
    }
    return form;
}
 
Example 8
Source File: ConverterAssociationsDialog.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ConverterAssociationsDialog(final ListGrid srcGrid) {
	this.srcGrid = srcGrid;

	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("associations"));
	setWidth(320);
	setHeight(360);
	
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();

	converter = ItemFactory.newFormatConverterSelector();
	converter.setWidth(290);
	converter.setRequired(true);
	converter.setValue(DEFAULT_CONVERTER);
	converter.addChangedHandler(new ChangedHandler() {

		@Override
		public void onChanged(ChangedEvent event) {
			refresh();
		}
	});

	DynamicForm form = new DynamicForm();
	form.setTitleOrientation(TitleOrientation.TOP);
	form.setNumCols(1);
	form.setItems(converter);

	addItem(form);

	refresh();
}
 
Example 9
Source File: AutomationRoutineProperties.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void refresh() {
	vm.clearValues();
	vm.clearErrors(false);

	if (formsContainer.getMembers() != null)
		formsContainer.removeMembers(formsContainer.getMembers());

	DynamicForm form2 = new DynamicForm();
	form2.setWidth100();
	form2.setTitleOrientation(TitleOrientation.TOP);
	form2.setValuesManager(vm);
	form2.setNumCols(1);

	final TextAreaItem automation = ItemFactory.newTextAreaItemForAutomation("automation", "automation",
			routine.getAutomation(), changedHandler, false);
	automation.setStartRow(false);
	automation.setRequired(true);
	automation.setWidth("*");

	form2.setItems(automation);

	DynamicForm form1 = new DynamicForm();
	form1.setNumCols(1);
	form1.setTitleOrientation(TitleOrientation.TOP);
	form1.setValuesManager(vm);

	TextItem name = ItemFactory.newSimpleTextItem("name", I18N.message("name"), routine.getName());
	name.addChangedHandler(changedHandler);
	name.setDisabled(routine.getId() != 0L);

	TextItem description = ItemFactory.newTextItem("description", I18N.message("description"),
			routine.getDescription());
	description.addChangedHandler(changedHandler);
	description.setWidth(200);

	form1.setItems(name, description);

	formsContainer.setMembers(form1, form2);
}
 
Example 10
Source File: WebcontentCreate.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public WebcontentCreate() {
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("createwebcontent"));
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	setAutoSize(true);
	centerInPage();
	
	
	DynamicForm form = new DynamicForm();
	vm = new ValuesManager();
	form.setValuesManager(vm);
	form.setTitleOrientation(TitleOrientation.TOP);
	form.setNumCols(1);

	TextItem title = ItemFactory.newSimpleTextItem("title", "title", null);
	title.setRequired(true);
	title.setWidth(200);

	SelectItem template = ItemFactory.newTemplateSelector(true, null);

	create = new SubmitItem();
	create.setTitle(I18N.message("create"));
	create.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			onCreate();
		}
	});

	form.setItems(title, template, create);

	addItem(form);
}
 
Example 11
Source File: DataControlsTimeSeries.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
private Canvas createJumpToTimeIntervalForm() {
   	ComboBoxItem jumpToCombo = new ComboBoxItem();
       jumpToCombo.setTitle(i18n.jumpTo());
   	jumpToCombo.setDefaultToFirstOption(true);
       jumpToCombo.setWrapTitle(false);
       jumpToCombo.setShowTitle(true);
       jumpToCombo.setWidth(100);

       String[] jumpToTypes = i18n.jumpToTypes().split(",");
       LinkedHashMap<String, String> jumpToValues = new LinkedHashMap<String, String>();
       for (int i = 0; i < jumpToTypes.length; i += 2) {
           jumpToValues.put(jumpToTypes[i], jumpToTypes[i + 1]);
       }
       jumpToCombo.setValueMap(jumpToValues);
       jumpToCombo.addChangedHandler(new ChangedHandler() {
           public void onChanged(ChangedEvent event) {
               RecentTimeTerm type = RecentTimeTerm.valueOf((String) event.getValue());
               final Date now = new Date();
               long interval = 1000 * 60;
               // FIXME validierung mit overview
               switch (type) {
               case TODAY:
				long dayInMillis = 1000 * 60 * 60 * 24;
               	long lastmidnight = now.getTime() / dayInMillis * dayInMillis;
               	EventBus.getMainEventBus().fireEvent(new DatesChangedEvent(lastmidnight, lastmidnight + (dayInMillis)));
				return;
               case LASTHOUR:
                   interval *= 60;
                   break;
               case LASTFIVEHOURS:
                   interval *= 60 * 5;
                   break;
               case LASTDAY:
                   interval *= 60 * 24;
                   break;
               case LASTMONTH:
                   interval *= 60 * 24 * 30;
                   break;
               case LASTWEEK:
                   interval *= 60 * 24 * 7;
                   break;
               default:
                   break;
               }
               final long start = now.getTime() - interval;
               final long end = now.getTime();

               EventBus.getMainEventBus().fireEvent(new DatesChangedEvent(start,end));
           }
       });
       
   	DynamicForm jumpToForm = new DynamicForm();
   	jumpToForm.setStyleName("n52_sensorweb_client_jumpToTimeIntervalForm");
       jumpToForm.setNumCols(2);
       jumpToForm.setFields(jumpToCombo);
       jumpToForm.setHeight("*");
       return jumpToForm;
}
 
Example 12
Source File: ExternalAppsPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
private Tab prepareExternalCall(GUIParameter[] settings) {
	VLayout pane = new VLayout();

	Tab extCall = new Tab();
	extCall.setTitle(I18N.message("externalcall"));
	DynamicForm extCallForm = new DynamicForm();
	extCallForm.setWidth(400);
	extCallForm.setIsGroup(true);
	extCallForm.setNumCols(2);
	extCallForm.setPadding(2);
	extCallForm.setGroupTitle(I18N.message("externalcall"));
	extCallForm.setValuesManager(vm);
	extCallForm.setTitleOrientation(TitleOrientation.LEFT);
	final RadioGroupItem extCallEnabled = ItemFactory.newBooleanSelector("extCallEnabled", "enabled");
	extCallEnabled.setRequired(true);
	extCallEnabled.setRedrawOnChange(true);
	extCallEnabled.setValue("no");

	TextItem extCallName = ItemFactory.newTextItem("extCallName", I18N.message("name"), null);
	TextItem extCallBaseUrl = ItemFactory.newTextItem("extCallBaseUrl", I18N.message("baseurl"), null);
	extCallBaseUrl.setWidth(300);
	TextItem extCallSuffix = ItemFactory.newTextItem("extCallSuffix", I18N.message("suffix"), null);
	extCallSuffix.setWidth(300);
	TextItem extCallWindow = ItemFactory.newTextItem("extCallWindow", I18N.message("targetwindow"), "_blank");

	extCallForm.setItems(extCallEnabled, extCallName, extCallBaseUrl, extCallSuffix, extCallWindow);

	// Use a second form to group the parameters section
	DynamicForm parametersForm = new DynamicForm();
	parametersForm.setWidth(400);
	parametersForm.setIsGroup(true);
	parametersForm.setGroupTitle(I18N.message("parameters"));
	parametersForm.setNumCols(4);
	extCallForm.setPadding(2);
	parametersForm.setValuesManager(vm);
	extCallParamUser = ItemFactory.newCheckbox("extCallParamUser", "user");
	extCallParamTitle = ItemFactory.newCheckbox("extCallParamTitle", "filename");
	parametersForm.setItems(extCallParamUser, extCallParamTitle);

	pane.setMembers(extCallForm, parametersForm);
	extCall.setPane(pane);

	String tenant = Session.get().getTenantName();
	for (GUIParameter s : settings) {
		if ((tenant + ".extcall.enabled").equals(s.getName()))
			extCallEnabled.setValue("true".equals(s.getValue()) ? "yes" : "no");
		else if ((tenant + ".extcall.name").equals(s.getName()))
			extCallName.setValue(s.getValue());
		else if ((tenant + ".extcall.baseurl").equals(s.getName()))
			extCallBaseUrl.setValue(s.getValue());
		else if ((tenant + ".extcall.suffix").equals(s.getName()))
			extCallSuffix.setValue(s.getValue());
		else if ((tenant + ".extcall.window").equals(s.getName()))
			extCallWindow.setValue(s.getValue());
		else if ((tenant + ".extcall.params").equals(s.getName())) {
			String[] tokens = s.getValue().split(",");
			for (String param : tokens) {
				if ("user".equals(param.trim()))
					extCallParamUser.setValue("true");
				else if ("filename".equals(param.trim()))
					extCallParamTitle.setValue("true");
			}
		}
	}

	return extCall;
}
 
Example 13
Source File: AutomationTriggerProperties.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void refresh() {
	vm.clearValues();
	vm.clearErrors(false);

	if (formsContainer.getMembers() != null)
		formsContainer.removeMembers(formsContainer.getMembers());

	DynamicForm form2 = new DynamicForm();
	form2.setWidth100();
	form2.setTitleOrientation(TitleOrientation.TOP);
	form2.setValuesManager(vm);
	form2.setNumCols(1);

	final TextAreaItem automation = ItemFactory.newTextAreaItemForAutomation("automation", "automation",
			trigger.getAutomation(), changedHandler, false);
	automation.setStartRow(false);
	automation.setWidth("*");
	automation.setDisabled(trigger.getRoutine()!=null);
	
	form2.setItems(automation);
	
	DynamicForm form1 = new DynamicForm();
	form1.setNumCols(2);
	form1.setTitleOrientation(TitleOrientation.TOP);
	form1.setValuesManager(vm);
	form1.setHeight100();

	SelectItem events = ItemFactory.newEventsSelector("events", I18N.message("triggeron"), changedHandler, true, true,
			true);
	events.setRowSpan(3);
	events.setValues(trigger.getEventsArray());

	SpacerItem spacer = new SpacerItem();
	spacer.setHeight(100);

	SelectItem routine = ItemFactory.newAutomationRoutineSelector("routine",
			trigger.getRoutine() != null ? trigger.getRoutine().getId() : null, changedHandler, true);
	routine.setEndRow(true);
	routine.addChangedHandler(changedHandler);
	ChangedHandler cngHandler = new ChangedHandler() {
		@Override
		public void onChanged(ChangedEvent event) {
			if (event == null) {
				automation.setDisabled(false);
			} else {
				automation.setDisabled(event.getValue() != null && !event.getValue().toString().isEmpty());
			}
		}
	};
	routine.addChangedHandler(cngHandler);
	
	form1.setItems(events, folderSelector, routine, spacer);

	formsContainer.setMembers(form1, form2);
}
 
Example 14
Source File: SubscriptionTemplate.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
protected DynamicForm assembleEditConditionForm(FormItem... formItems) {
    DynamicForm form = new DynamicForm();
    form.setNumCols(formItems.length + 1);
    form.setFields(formItems);
    return form;
}
 
Example 15
Source File: NdkAudioPageForm.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
/**
     * Create a new form.
     * @param i18n I18N
     * @param typeValueMapId {@link ValueMapDataSource#getOptionDataSource}
     *          reference to bundle with page types.
     */
    public NdkAudioPageForm(ClientMessages i18n, String typeValueMapId) {
        // save on Enter is supposed mainly for ImportBatchItemEditor
        // see submit handler in ModsMultiEditor
        setSaveOnEnter(true);
        setWidth100();
        setHeight100();
        setTitleOrientation(TitleOrientation.TOP);

        TextItem pageType = new TextItem(ModsCustomDataSource.FIELD_PAGE_TYPE);
        pageType.setTitle(i18n.PageForm_PageType_Title());
        pageType.setEndRow(true);
        pageType.setRequired(true);
        pageType.setReadOnly();
        pageType.disable();

        IntegerItem pageIndex = new IntegerItem(ModsCustomDataSource.FIELD_PAGE_INDEX);
        pageIndex.setTitle(i18n.PageForm_PageIndex_Title());
        pageIndex.setValidators(new IsIntegerValidator());
        pageIndex.setRequired(true);
        pageIndex.setEndRow(true);

        TextItem pageNumber = new TextItem(ModsCustomDataSource.FIELD_PAGE_NUMBER);
        pageNumber.setTitle(i18n.PageForm_PageNumber_Title());
        pageNumber.setEndRow(true);
        pageNumber.setRequired(true);
        pageNumber.setValidators(new StringTrimValidator());
//        pageNumber.setLength(5);

        final RepeatableFormItem identifiers = new RepeatableFormItem(ModsCustomDataSource.FIELD_IDENTIFIERS,
                i18n.PageForm_Identifiers_Title());
        identifiers.setDataSource(IdentifierDataSource.getInstance());
        identifiers.setRequired(true);
        identifiers.setValidators(
                new IdentifiersValidator(i18n, Arrays.asList(IdentifierDataSource.TYPE_UUID)));
        DynamicForm identifierForm = new DynamicForm();
        identifierForm.setUseAllDataSourceFields(true);
        identifierForm.setNumCols(4);
        identifiers.setFormPrototype(identifierForm);
        identifiers.setEndRow(true);
        identifiers.setColSpan("3");

//        TextAreaItem note = new AutoFitTextAreaItem(ModsCustomDataSource.FIELD_NOTE, "Note");
        TextAreaItem note = new TextAreaItem(ModsCustomDataSource.FIELD_NOTE, i18n.PageForm_Note_Title());
        note.setWidth("*");
        //https://github.com/proarc/proarc/issues/645 GWT v.6.0-p20161023 form draw issue
        note.setHeight("*");
        note.setColSpan("*");

        setFields(pageType, pageIndex, pageNumber, identifiers, note);

        IntegerRangeValidator integerRangeValidator = new IntegerRangeValidator();
        integerRangeValidator.setMin(0);
        integerRangeValidator.setMax(Integer.MAX_VALUE);

        pageIndex.setValidators(integerRangeValidator);
    }
 
Example 16
Source File: RetentionPolicyDetailsPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void refresh() {

		/*
		 * Prepare the standard properties tab
		 */
		if (tabSet != null) {
			tabSet.hideSave();
			removeMember(tabSet);
		}

		tabSet = new EditingTabSet(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				onSave();
			}
		}, new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				if (policy.getId() != 0) {
					RetentionPoliciesService.Instance.get().getPolicy(policy.getId(),
							new AsyncCallback<GUIRetentionPolicy>() {
								@Override
								public void onFailure(Throwable caught) {
									Log.serverError(caught);
								}

								@Override
								public void onSuccess(GUIRetentionPolicy policy) {
									setPolicy(policy);
								}
							});
				} else {
					GUIRetentionPolicy newsPolicy = new GUIRetentionPolicy();
					setPolicy(newsPolicy);
				}
				tabSet.hideSave();
			}
		});

		Tab propertiesTab = new Tab(I18N.message("properties"));
		propertiesTabPanel = new HLayout();
		propertiesTabPanel.setWidth100();
		propertiesTabPanel.setHeight100();
		propertiesTab.setPane(propertiesTabPanel);
		tabSet.addTab(propertiesTab);

		addMember(tabSet);

		ChangedHandler changedHandler = new ChangedHandler() {
			@Override
			public void onChanged(ChangedEvent event) {
				onModified();
			}
		};

		form = new DynamicForm();
		form.setNumCols(2);
		form.setTitleOrientation(TitleOrientation.TOP);

		TextItem name = ItemFactory.newSimpleTextItem("name", "name", policy.getName());
		name.addChangedHandler(changedHandler);
		name.setWidth(200);
		name.setRequired(true);

		IntegerItem days = ItemFactory.newIntegerItem("days", "retentiondays", policy.getRetentionDays());
		days.addChangedHandler(changedHandler);
		days.setWidth(100);
		days.setRequired(true);

		SelectItem dateOption = ItemFactory.newRetentionDateOption(policy.getDateOption());
		dateOption.addChangedHandler(changedHandler);

		SelectItem template = ItemFactory.newTemplateSelector(true, policy.getTemplateId());
		template.addChangedHandler(changedHandler);

		folder = new FolderSelector(null, true);
		folder.setFolder(policy.getFolderId(), policy.getFolderName());
		folder.addFolderChangeListener(RetentionPolicyDetailsPanel.this);

		SelectItem action = ItemFactory.newRetentionAction(policy.getAction());
		action.addChangedHandler(changedHandler);

		form.setItems(name, days, dateOption, template, action, folder);

		propertiesTab.setPane(form);
	}
 
Example 17
Source File: CreateComplexRuleLayout.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
private void addSingle(String op, String ruleName){
    // get all members from mainLayout and clear the layout
    Canvas[] members = this.ruleBlockLayout.getMembers();
    this.ruleBlockLayout.removeMembers(this.ruleBlockLayout.getMembers());
    
    LinkedHashMap<String, String> operatorHashMap = getLogicalOperators();

    VLayout v2 = new VLayout();
    v2.setWidth("70%");
    v2.addMember(members[0]);
    v2.addMember(createSingle(ruleName));
    
    DynamicForm block1 = new DynamicForm();
    block1.setWidth("30%");
    block1.setNumCols(1);
    
    this.singleOperator = new SelectItem();
    this.singleOperator.setShowTitle(false);
    this.singleOperator.setWidth(this.operatorWidth);
    this.singleOperator.setValueMap(operatorHashMap);
    this.singleOperator.setTextAlign(Alignment.CENTER);
    if (op != null) {
        this.singleOperator.setValue(op);
    } else {
        this.singleOperator.setValue(LogicalOperator.AND.toString());
    }
    
    SpacerItem spacerItem = new SpacerItem();
    spacerItem.setShowTitle(false);
    spacerItem.setHeight(20);
    
    block1.setFields(spacerItem, spacerItem, this.singleOperator);

    HLayout layout = new HLayout();
    layout.setWidth(200);
    layout.setHeight(25);
    layout.setEdgeMarginSize(1);
    layout.setEdgeSize(2);
    layout.setShowEdges(true);
    layout.addMember(block1);
    layout.addMember(v2);

    this.ruleBlockLayout.addMember(layout);
}
 
Example 18
Source File: StatusDialog.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public StatusDialog(StateWidget widget) {
	this.widget = widget;

	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("editworkflowstate", I18N.message("task")));
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	setMargin(3);
	setAutoSize(true);
	setWidth(400);
	centerInPage();

	form = new DynamicForm();
	form.setTitleOrientation(TitleOrientation.TOP);
	form.setNumCols(1);
	form.setValuesManager(vm);

	TextItem name = ItemFactory.newTextItem("name", "name", widget.getTransition().getText());
	name.setRequired(true);

	ButtonItem save = new ButtonItem("save", I18N.message("save"));
	save.setAutoFit(true);
	save.addClickHandler(new ClickHandler() {
		@SuppressWarnings("unchecked")
		public void onClick(ClickEvent event) {
			Map<String, Object> values = (Map<String, Object>) vm.getValues();

			if (vm.validate()) {
				if (vm.validate()) {
					StatusDialog.this.widget.getWfState().setName((String) values.get("name"));

					StatusDialog.this.widget.setContents("<b>" + (String) values.get("name") + "</b>");
					StatusDialog.this.widget.getDrawingPanel().getDiagramController().update();

					destroy();
				}
			}
		}
	});

	form.setItems(name, save);
	addItem(form);
}
 
Example 19
Source File: TwoFactorsAuthenticationSettings.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void init(GUIParameter[] parameters) {
	DynamicForm form = new DynamicForm();
	form.setWidth(1);
	form.setValuesManager(vm);
	form.setTitleOrientation(TitleOrientation.LEFT);
	form.setNumCols(1);

	Map<String, String> settings = Util.convertToMap(parameters);
	final RadioGroupItem enable2fa = ItemFactory.newBooleanSelector("enable2fa", I18N.message("enable2fa"));
	enable2fa.setValue("true".equals(settings.get("enabled")) ? "yes" : "no");
	enable2fa.setWrapTitle(false);
	enable2fa.setWrap(false);
	enable2fa.setRequired(true);
	enable2fa.setDisabled(Session.get().isDemo());
	form.setFields(enable2fa);

	/*
	 * GoogleAuthenticator section
	 */
	DynamicForm googleForm = new DynamicForm();
	googleForm.setValuesManager(vm);
	googleForm.setTitleOrientation(TitleOrientation.TOP);
	googleForm.setIsGroup(true);
	googleForm.setGroupTitle("Google Authenticator");
	googleForm.setNumCols(1);

	final RadioGroupItem enableGoolge = ItemFactory.newBooleanSelector("enableGoolge",
			I18N.message("enablegoogleauthenticator"));
	enableGoolge.setValue("true".equals(settings.get(Constants.TWOFA_GOOGLE_AUTHENTICATOR + ".enabled")) ? "yes"
			: "no");
	enableGoolge.setWrapTitle(false);
	enableGoolge.setWrap(false);
	enableGoolge.setRequired(true);
	enableGoolge.setDisabled(Session.get().isDemo());
	googleForm.setFields(enableGoolge);

	/*
	 * Yubikey section
	 */
	DynamicForm yubikeyForm = new DynamicForm();
	yubikeyForm.setValuesManager(vm);
	yubikeyForm.setTitleOrientation(TitleOrientation.TOP);
	yubikeyForm.setIsGroup(true);
	yubikeyForm.setGroupTitle("YubiKey");
	yubikeyForm.setNumCols(1);

	final RadioGroupItem enableYubikey = ItemFactory.newBooleanSelector("enableYubikey",
			I18N.message("enableyubikey"));
	enableYubikey.setValue("true".equals(settings.get("yubikey.enabled")) ? "yes" : "no");
	enableYubikey.setWrapTitle(false);
	enableYubikey.setWrap(false);
	enableYubikey.setRequired(true);
	enableYubikey.setDisabled(Session.get().isDemo());
	yubikeyForm.setFields(enableYubikey);

	IButton save = new IButton();
	save.setTitle(I18N.message("save"));
	save.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			if (vm.validate()) {
				String tenant = Session.get().getTenantName();
				final List<GUIParameter> params = new ArrayList<GUIParameter>();
				params.add(new GUIParameter(tenant + ".2fa.enabled",
						vm.getValueAsString("enable2fa").equals("yes") ? "true" : "false"));
				params.add(new GUIParameter(tenant + ".2fa." + Constants.TWOFA_GOOGLE_AUTHENTICATOR + ".enabled",
						vm.getValueAsString("enableGoolge").equals("yes") ? "true" : "false"));
				params.add(new GUIParameter(tenant + ".2fa." + Constants.TWOFA_YUBIKEY + ".enabled",
						vm.getValueAsString("enableYubikey").equals("yes") ? "true" : "false"));
				SettingService.Instance.get().saveSettings(params.toArray(new GUIParameter[0]),
						new AsyncCallback<Void>() {

							@Override
							public void onFailure(Throwable caught) {
								Log.serverError(caught);
							}

							@Override
							public void onSuccess(Void arg) {
								Session.get().updateConfig(params);
								Log.info(I18N.message("settingssaved"), null);
							}
						});
			}
		}
	});

	VLayout panel = new VLayout();
	panel.setWidth100();
	panel.setMembers(form, googleForm, yubikeyForm);

	body.setMembers(panel);
	addMember(save);
}
 
Example 20
Source File: PeriodicalIssueForm.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public PeriodicalIssueForm(ClientMessages i18n) {
    setWidth100();
    setHeight100();
    setTitleOrientation(TitleOrientation.TOP);
    setNumCols(1);

    ComboBoxItem issueSequenceNumber = new ComboBoxItem(ModsCustomDataSource.FIELD_PER_ISSUE_NUMBER_SORTING,
            i18n.PeriodicalIssueForm_NumberSorting_Title());
    issueSequenceNumber.setRequired(true);
    issueSequenceNumber.setValidators(new StringTrimValidator(), new RegExpValidator(
            "^([1-9]\\d{0,4}(-[1-9]\\d{0,4})?|mimořádné|zvláštní|na ukázku)$"));
    issueSequenceNumber.setValueMap("mimořádné", "na ukázku", "zvláštní");
    issueSequenceNumber.setHideEmptyPickList(true);

    TextItem date = new TextItem(ModsCustomDataSource.FIELD_PER_ISSUE_DATE, i18n.PeriodicalIssueForm_Date_Title());
    date.setRequired(true);
    // issue 43, see https://docs.google.com/document/d/1zSriHPdnUY5d_tKv0M8a6nEym560DKh2H6XZ24tGAEw/edit?pli=1
    // YYYY|YYYY-YYYY|MM.YYYY|MM.-MM.YYYY|DD.MM.YYYY|DD.-DD.MM.YYYY
    // javascript regex ^([1-9]\d{3}(-[1-9]\d{3})?|(1\d|[1-9])\.(-(1\d|[1-9])\.)?[1-9]\d{3}|([123]\d|[1-9])\.(1\d|[1-9])\.(-([123]\d|[1-9])\.(1\d|[1-9])\.)?[1-9]\d{3})$
    date.setValidators(new StringTrimValidator(), new RegExpValidator(
            "^([1-9]\\d{3}(-[1-9]\\d{3})?|(1\\d|[1-9])\\.(-(1\\d|[1-9])\\.)?[1-9]\\d{3}|([123]\\d|[1-9])\\.(1\\d|[1-9])\\.(-([123]\\d|[1-9])\\.(1\\d|[1-9])\\.)?[1-9]\\d{3})$"));

    // identifiers
    final RepeatableFormItem identifiers = new RepeatableFormItem(ModsCustomDataSource.FIELD_IDENTIFIERS,
            i18n.PeriodicalIssueForm_Identifiers_Title());
    identifiers.setDataSource(IdentifierDataSource.getInstance());
    identifiers.setValidators(
            new IdentifiersValidator(i18n, Arrays.asList(IdentifierDataSource.TYPE_UUID)));
    DynamicForm identifierForm = new DynamicForm();
    identifierForm.setUseAllDataSourceFields(true);
    identifierForm.setNumCols(4);
    identifiers.setFormPrototype(identifierForm);
    identifiers.setEndRow(true);
    identifiers.setColSpan("2");

    TextAreaItem note = new TextAreaItem(ModsCustomDataSource.FIELD_NOTE, i18n.PeriodicalIssueForm_Note_Title());
    note.setWidth("*");
    note.setHeight("*");
    note.setColSpan("*");

    setFields(issueSequenceNumber, date, identifiers, note);
}