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

The following examples show how to use com.smartgwt.client.widgets.form.DynamicForm#setItems() . 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: UserPropertiesPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void prepareGroupsForm(boolean readOnly) {
	DynamicForm form2 = new DynamicForm();
	form2.setValuesManager(vm);

	List<String> groupIds = new ArrayList<String>();
	GUIGroup[] groups = user.getGroups();
	if (groups != null && groups.length > 0) {
		for (int i = 0; i < groups.length; i++)
			if (groups[i].getType() == 0)
				groupIds.add(Long.toString(groups[i].getId()));
	}

	groupsItem = ItemFactory.newMultiComboBoxItem("groups", "groups", new GroupsDS(),
			groupIds.toArray(new String[0]));
	groupsItem.setDisabled(readOnly || "admin".equals(user.getUsername())
			|| ("admin" + Session.get().getTenantName()).equals(user.getUsername()));
	groupsItem.setValueField("id");
	groupsItem.setDisplayField("name");
	groupsItem.addChangedHandler(changedHandler);

	form2.setItems(groupsItem);
	addMember(form2, 2);
}
 
Example 2
Source File: DesaExportAction.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private DynamicForm createLogForm() {
    DynamicForm form = new DynamicForm();
    form.setBrowserSpellCheck(false);
    form.setCanEdit(false);
    form.setWidth100();
    form.setHeight("40%");
    TextAreaItem textAreaItem = new TextAreaItem(ExportResourceApi.RESULT_ERROR_LOG);
    textAreaItem.setColSpan("*");
    textAreaItem.setHeight("*");
    textAreaItem.setWrap(TextAreaWrap.OFF);
    textAreaItem.setShowTitle(false);
    textAreaItem.setWidth("*");
    textAreaItem.setCanEdit(false);
    form.setItems(textAreaItem);
    return form;
}
 
Example 3
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 4
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 5
Source File: BarcodeTemplateSettings.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.setWidth100();
	form.setAlign(Alignment.LEFT);
	form.setColWidths("1px, 100%");
	vm = new ValuesManager();
	form.setValuesManager(vm);

	TextItem name = ItemFactory.newTextItem("name", "name", template.getName());
	name.setRequired(true);
	name.setDisabled(template.getId() != 0L);

	StaticTextItem id = ItemFactory.newStaticTextItem("id", I18N.message("id"), "" + template.getId());
	id.setVisible(template != null && template.getId() != 0L);

	TextAreaItem description = ItemFactory.newTextAreaItem("description", "description", template.getDescription());
	description.setHeight(200);

	// The optional batch
	SpinnerItem batch = ItemFactory.newSpinnerItem("batch", "batch", template.getBatch());
	batch.setRequired(true);
	batch.setMin(1);
	batch.setStep(10);
	batch.setHintStyle("hint");

	// The image threshold
	SpinnerItem resolutionThreshold = ItemFactory.newSpinnerItem("resolutionthreshold",
			I18N.message("resolutionthreshold"), template.getImageThreshold());
	resolutionThreshold.setRequired(true);
	resolutionThreshold.setWrapTitle(false);
	resolutionThreshold.setMin(50);
	resolutionThreshold.setStep(100);
	resolutionThreshold.setHint("pixels");

	if (Session.get().isDefaultTenant() && template.getId() != 0L)
		form.setItems(id, name, description, batch, resolutionThreshold);
	else
		form.setItems(id, name, description);
}
 
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: GDriveCheckin.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public GDriveCheckin(final GUIDocument document, final GDriveEditor parentDialog) {
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("checkin"));
	setWidth(400);
	setHeight(140);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setMembersMargin(2);

	DynamicForm form = new DynamicForm();
	vm = new ValuesManager();
	form.setValuesManager(vm);

	BooleanItem versionItem = new BooleanItem();
	versionItem.setName("majorversion");
	versionItem.setTitle(I18N.message("majorversion"));

	TextItem commentItem = ItemFactory.newTextItem("comment", "comment", null);
	commentItem.setRequired(true);
	commentItem.setWidth(240);

	checkin = new SubmitItem();
	checkin.setTitle(I18N.message("checkin"));
	checkin.setAlign(Alignment.RIGHT);
	checkin.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			onCheckin(document, parentDialog);
		}
	});

	form.setItems(versionItem, commentItem, checkin);

	addItem(form);
}
 
Example 8
Source File: YubiKeySetup.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public YubiKeySetup(GUIUser user) {
	super();
	setWidth100();
	setHeight100();
	setMembersMargin(5);
	setMargin(5);

	this.user = user;

	// Prepare the form with account informations
	TextItem keyItem = ItemFactory.newTextItem("key", I18N.message("key"), null);
	keyItem.setWidth(300);
	keyItem.addKeyPressHandler(new KeyPressHandler() {
		@Override
		public void onKeyPress(KeyPressEvent event) {
			if (event.getKeyName() != null && "enter".equals(event.getKeyName().toLowerCase())) {
				onSubmitKey();
			}
		}
	});

	form = new DynamicForm();
	form.setTitleOrientation(TitleOrientation.LEFT);
	form.setNumCols(4);
	form.setItems(keyItem);

	hint = new Label(I18N.message(Constants.TWOFA_YUBIKEY + ".hint1"));

	setMembers(hint, form);
}
 
Example 9
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 10
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 11
Source File: ReplaceVersionFile.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public ReplaceVersionFile(GUIDocument document, String fileVersion) {
	this.document = document;
	this.fileVersion = fileVersion;
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("replacefile"));
	setWidth(420);
	
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	setAutoSize(true);
	centerInPage();

	DynamicForm form = new DynamicForm();
	vm = new ValuesManager();
	form.setValuesManager(vm);

	TextItem commentItem = ItemFactory.newTextItem("comment", "comment", null);
	commentItem.setRequired(true);
	commentItem.setWidth(250);

	form.setItems(commentItem);

	// Create a new uploader panel and attach it to the window
	multiUploader = new MultiUploader();
	multiUploader.setStyleName("upload");
	multiUploader.setWidth("300px");
	multiUploader.setHeight("60px");
	multiUploader.setFileInputPrefix("LDOC");
	multiUploader.setMaximumFiles(1);
	multiUploader.addOnFinishUploadHandler(onFinishUploaderHandler);
	multiUploader.reset();

	saveButton = new IButton(I18N.message("save"));
	saveButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {

		@Override
		public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
			onSave();
		}
	});
	saveButton.setDisabled(true);

	VLayout layout = new VLayout();
	layout.setMembersMargin(5);
	layout.setMargin(2);

	layout.addMember(form);
	layout.addMember(multiUploader);
	layout.addMember(saveButton);

	addItem(layout);
}
 
Example 12
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 13
Source File: TaskNotificationPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void onDraw() {
	VLayout notificationsPane = new VLayout();
	setMembers(notificationsPane);

	final DynamicForm notificationsForm = new DynamicForm();
	notificationsForm.setColWidths(1, "*");
	notificationsForm.setMargin(3);

	List<FormItem> items = new ArrayList<FormItem>();

	// Enable/Disable notifications
	CheckboxItem sendReport = new CheckboxItem();
	sendReport.setName("sendReport");
	sendReport.setTitle(I18N.message("sendactivityreport"));
	sendReport.setRedrawOnChange(true);
	sendReport.setWidth(50);
	sendReport.setValue(task.isSendActivityReport());
	sendReport.addChangedHandler(new ChangedHandler() {

		@Override
		public void onChanged(ChangedEvent event) {
			task.setSendActivityReport("true".equals(notificationsForm.getValue("sendReport").toString()));

			// Notify the external handler
			changedHandler.onChanged(event);
		}
	});

	items.add(sendReport);

	Long[] ids = new Long[task.getReportRecipients().length];
	for (int i = 0; i < ids.length; i++)
		ids[i] = task.getReportRecipients()[i].getId();

	recipients = ItemFactory.newMultiComboBoxItem("recipients", "recipients", new UsersDS(null, false), ids);
	recipients.setValueField("id");
	recipients.setDisplayField("username");
	recipients.addChangedHandler(changedHandler);
	items.add(recipients);

	notificationsForm.setItems(items.toArray(new FormItem[0]));
	notificationsPane.setMembers(notificationsForm);
}
 
Example 14
Source File: ContactsUploader.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public ContactsUploader() {
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("uploadcontacts"));
	setWidth(400);
	setHeight(125);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();

	form = new DynamicForm();
	vm = new ValuesManager();
	form.setValuesManager(vm);

	sendButton = new SubmitItem();
	sendButton.setTitle(I18N.message("send"));
	sendButton.setDisabled(true);
	sendButton.setAlign(Alignment.RIGHT);
	sendButton.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			onSend();
		}
	});

	form.setItems(sendButton);

	// Create a new uploader panel and attach it to the window
	uploader = new MultiUploader();
	uploader.setMaximumFiles(1);
	uploader.setStyleName("upload");
	uploader.setFileInputPrefix("LDOC_CNT");
	uploader.setHeight("30px");
	uploader.reset();

	// Add a finish handler which will load the image once the upload
	// finishes
	uploader.addOnFinishUploadHandler(onFinishUploaderHandler);

	addItem(uploader);
	addItem(form);
}
 
Example 15
Source File: DigitalObjectAdministrationEditor.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public PlainEditor(ClientMessages i18n) {
    widget = new VLayout();
    form = new DynamicForm();
    form.setDataSource(DigitalObjectAdministrationDataSource.getInstance());
    form.setBrowserSpellCheck(false);

    TextItem pid = new TextItem(DigitalObjectAdministrationDataSource.FIELD_PID,
            i18n.DigitalObjectEditor_AdministrationEditor_Pid_Title());
    pid.setWidth("*");
    pid.setCanEdit(Boolean.FALSE);
    TextItem model = new TextItem(DigitalObjectAdministrationDataSource.FIELD_MODEL,
            i18n.DigitalObjectEditor_AdministrationEditor_Model_Title());
    model.setCanEdit(Boolean.FALSE);
    TextItem owner = new TextItem(DigitalObjectAdministrationDataSource.FIELD_OWNER,
            i18n.DigitalObjectEditor_AdministrationEditor_Owner_Title());
    owner.setCanEdit(Boolean.FALSE);
    TextItem creationDate = new TextItem(DigitalObjectAdministrationDataSource.FIELD_CREATED,
            i18n.DigitalObjectEditor_AdministrationEditor_Created_Title());
    creationDate.setCanEdit(Boolean.FALSE);
    TextItem modificationDate = new TextItem(DigitalObjectAdministrationDataSource.FIELD_MODIFIED,
            i18n.DigitalObjectEditor_AdministrationEditor_Modified_Title());
    modificationDate.setCanEdit(Boolean.FALSE);

    SelectItem device = new SelectItem(DigitalObjectAdministrationDataSource.FIELD_DEVICE,
            i18n.DigitalObjectEditor_AdministrationEditor_Device_Title());
    device.setWidth(250);
    DeviceDataSource.setOptionDataSource(device);
    device.setAllowEmptyValue(true);
    device.setEmptyDisplayValue(ClientUtils.format("<i>&lt;%s&gt;</i>",
            i18n.DigitalObjectEditor_AdministrationEditor_NoDeviceSelection_Title()));

    TextItem filename = new TextItem(DigitalObjectAdministrationDataSource.FIELD_FILENAME,
            i18n.DigitalObjectEditor_AdministrationEditor_File_Title());
    filename.setWidth("*");
    filename.setCanEdit(Boolean.FALSE);

    TextItem export = new TextItem(DigitalObjectAdministrationDataSource.FIELD_EXPORT,
            i18n.DigitalObjectEditor_AdministrationEditor_Export_Title());
    export.setWidth("*");
    export.setCanEdit(Boolean.FALSE);

    TextItem ndkExport = new TextItem(DigitalObjectAdministrationDataSource.FIELD_NDK_EXPORT,
            i18n.DigitalObjectEditor_AdministrationEditor_Ndk_Export_Title());
    ndkExport.setWidth("*");
    ndkExport.setCanEdit(Boolean.FALSE);

    TextItem archiveExport = new TextItem(DigitalObjectAdministrationDataSource.FIELD_ARCHIVE_EXPORT,
            i18n.DigitalObjectEditor_AdministrationEditor_Archive_Export_Title());
    archiveExport.setWidth("*");
    archiveExport.setCanEdit(Boolean.FALSE);

    TextItem krameriusExport = new TextItem(DigitalObjectAdministrationDataSource.FIELD_KRAMERIUS_EXPORT,
            i18n.DigitalObjectEditor_AdministrationEditor_Kramerius_Export_Title());
    krameriusExport.setWidth("*");
    krameriusExport.setCanEdit(Boolean.FALSE);

    TextItem crossrefExport = new TextItem(DigitalObjectAdministrationDataSource.FIELD_CROSSREF_EXPORT,
            i18n.DigitalObjectEditor_AdministrationEditor_Crossref_Export_Title());
    crossrefExport.setWidth("*");
    crossrefExport.setCanEdit(Boolean.FALSE);

    ComboBoxItem organization = new ComboBoxItem(DigitalObjectAdministrationDataSource.FIELD_ORGANIZATION,
            i18n.UsersView_ListHeader_Organization_Title());
    organization.setWidth(250);
    organization.setValueMap(Organization.getMap());

    ComboBoxItem user = new ComboBoxItem(DigitalObjectAdministrationDataSource.FIELD_USER,
            i18n.UsersView_ListHeader_Proccesor_Title());
    user.setWidth(250);
    user.setOptionDataSource(UserDataSource.getInstance());
    user.setValueField(UserDataSource.FIELD_USERNAME);
    user.setDisplayField(UserDataSource.FIELD_USERNAME);

    ComboBoxItem status = new ComboBoxItem(DigitalObjectAdministrationDataSource.FIELD_STATUS,
            i18n.DigitalObjectEditor_AdministrationEditor_Status_Title());
    status.setWidth(250);
    status.setValueMap(DigitalObjectState.getMap(i18n));

    form.setItems(pid, model, owner, creationDate, modificationDate, device, filename, export,  ndkExport, krameriusExport, archiveExport, crossrefExport, organization, user, status);
    widget.setMembers(form);
}
 
Example 16
Source File: GoogleAuthenticatorSetup.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void init(String account, String key, String qrUrl) {
	// Prepare the form with account informations
	StaticTextItem accountItem = ItemFactory.newStaticTextItem("account", I18N.message("account"), account);
	accountItem.setWrap(false);
	accountItem.setWrapTitle(false);

	StaticTextItem keyItem = ItemFactory.newStaticTextItem("key", I18N.message("key"), key);
	keyItem.setWrap(false);
	keyItem.setWrapTitle(false);

	DynamicForm form = new DynamicForm();
	form.setTitleOrientation(TitleOrientation.LEFT);
	form.setItems(accountItem, keyItem);

	Label formTitle = new Label("<b>" + I18N.message(Constants.TWOFA_GOOGLE_AUTHENTICATOR+".hint1") + "</b>");
	formTitle.setWrap(true);
	formTitle.setMinWidth(250);

	VLayout formLayout = new VLayout();
	formLayout.setMembersMargin(2);
	formLayout.setMembers(formTitle, form);
	formLayout.setAlign(VerticalAlignment.TOP);

	// Prepare the QR Code
	HTMLFlow qrCode = new HTMLFlow("<img width='200' height='200' src='" + qrUrl + "'/>");
	qrCode.setOverflow(Overflow.VISIBLE);

	Label qrCodeTitle = new Label("<b>" + I18N.message(Constants.TWOFA_GOOGLE_AUTHENTICATOR+".hint2") + "</b>");
	qrCodeTitle.setWrap(true);
	qrCodeTitle.setMinWidth(250);

	VLayout qrCodeLayout = new VLayout();
	qrCodeLayout.setWidth100();
	qrCodeLayout.setHeight100();
	qrCodeLayout.setMembers(qrCodeTitle, qrCode);

	VLayout separator = new VLayout();
	separator.setWidth(20);

	HLayout body = new HLayout();
	body.setMembersMargin(2);
	body.setMembers(formLayout, separator, qrCodeLayout);

	setMembers(body);
}
 
Example 17
Source File: FolderExtendedPropertiesPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public FolderExtendedPropertiesPanel(GUIFolder folder, ChangedHandler changedHandler,
		ChangedHandler templateChangedHandler) {
	super(folder, changedHandler);
	setWidth100();
	setHeight100();
	setMembersMargin(1);

	RadioGroupItem locked = ItemFactory.newBooleanSelector("locked", "templatelocked");
	locked.setValue(folder.getTemplateLocked() == 1 ? "yes" : "no");
	locked.addChangedHandler(changedHandler);
	locked.setEndRow(true);

	ButtonItem applyMetadata = new ButtonItem(I18N.message("applytosubfolders"));
	applyMetadata.setAutoFit(true);
	applyMetadata.setEndRow(true);
	applyMetadata.setDisabled(!folder.isWrite());
	applyMetadata.setColSpan(1);
	applyMetadata.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			ContactingServer.get().show();
			FolderService.Instance.get().applyMetadata(folder.getId(), new AsyncCallback<Void>() {

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

				@Override
				public void onSuccess(Void v) {
					ContactingServer.get().hide();
				}
			});
		}
	});

	form1 = new DynamicForm();
	form1.setWidth(200);
	form1.setNumCols(1);
	form1.setTitleOrientation(TitleOrientation.TOP);
	form1.setItems(locked, applyMetadata);

	propertiesPanel = new ExtendedPropertiesPanel(folder, changedHandler, templateChangedHandler, folder.isWrite(), false, true);
	setMembers(form1, propertiesPanel);
}
 
Example 18
Source File: SubscriptionListGrid.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
private Canvas createActivateForm(final ListGridRecord ruleRecord) {
    DynamicForm form = new DynamicForm();
    form.setItems(createActivateCheckboxItem(ruleRecord));
    form.setAutoWidth();
    return form;
}
 
Example 19
Source File: TemplatePropertiesPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
protected void prepareTemplateForm() {
	templateForm = new DynamicForm();
	templateForm.setNumCols(1);
	templateForm.setValuesManager(vm);
	templateForm.setTitleOrientation(TitleOrientation.LEFT);

	StaticTextItem id = ItemFactory.newStaticTextItem("id", "id", Long.toString(template.getId()));
	id.setDisabled(true);

	TextItem name = ItemFactory.newSimpleTextItem("name", I18N.message("name"), template.getName());
	name.setRequired(true);
	name.setDisabled(template.isReadonly());
	if (!template.isReadonly())
		name.addChangedHandler(changedHandler);

	TextAreaItem description = ItemFactory.newTextAreaItem("description", "description", template.getDescription());
	description.setDisabled(template.isReadonly());

	PickerIcon computeStat = new PickerIcon(PickerIconName.REFRESH, new FormItemClickHandler() {
		public void onFormItemClick(final FormItemIconClickEvent event) {
			event.getItem().setValue(I18N.message("computing") + "...");
			TemplateService.Instance.get().countDocuments(template.getId(), new AsyncCallback<Long>() {

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

				@Override
				public void onSuccess(Long count) {
					event.getItem().setValue(Util.formatLong(count));
				}
			});
		}
	});
	computeStat.setPrompt(I18N.message("calculatestats"));

	StaticTextItem docs = ItemFactory.newStaticTextItem("docs", "documents", "-");
	docs.setIconHSpace(2);
	docs.setIconWidth(16);
	docs.setIconHeight(16);
	docs.setIcons(computeStat);
	docs.setWidth("1%");

	if (!template.isReadonly())
		description.addChangedHandler(changedHandler);

	templateForm.setItems(id, name, description, docs);

	container.addMember(templateForm);
}
 
Example 20
Source File: OptionsUploader.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public OptionsUploader(Options options) {
	this.options = options;
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("uploadoptions"));
	setWidth(400);
	setHeight(125);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();

	form = new DynamicForm();
	vm = new ValuesManager();
	form.setValuesManager(vm);

	sendButton = new SubmitItem();
	sendButton.setTitle(I18N.message("send"));
	sendButton.setDisabled(true);
	sendButton.setAlign(Alignment.RIGHT);
	sendButton.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			onSend();
		}
	});

	form.setItems(sendButton);

	// Create a new uploader panel and attach it to the window
	uploader = new MultiUploader();
	uploader.setMaximumFiles(1);
	uploader.setStyleName("upload");
	uploader.setFileInputPrefix("LDOC_OPT");
	uploader.setHeight("30px");
	uploader.reset();

	// Add a finish handler which will load the image once the upload
	// finishes
	uploader.addOnFinishUploadHandler(onFinishUploaderHandler);

	addItem(uploader);
	addItem(form);
}