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

The following examples show how to use com.smartgwt.client.widgets.form.DynamicForm#setTitleOrientation() . 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: DcEditor.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private DynamicForm createFullForm() {
    DynamicForm f = new DynamicForm();
    f.setWidth100();
    f.setNumCols(2);
    f.setBrowserSpellCheck(false);
    f.setWrapItemTitles(false);
    f.setTitleOrientation(TitleOrientation.TOP);
    ArrayList<FormItem> items = new ArrayList<FormItem>();
    addElement(items, DcConstants.CONTRIBUTOR, null, true);
    addElement(items, DcConstants.COVERAGE, null, true);
    addElement(items, DcConstants.CREATOR, null, true);
    addElement(items, DcConstants.DATE, null, true);
    addElement(items, DcConstants.DESCRIPTION, null, true);
    addElement(items, DcConstants.FORMAT, null, true);
    addElement(items, DcConstants.IDENTIFIER, null, true);
    addElement(items, DcConstants.LANGUAGE, null, true);
    addElement(items, DcConstants.PUBLISHER, null, true);
    addElement(items, DcConstants.RELATION, null, true);
    addElement(items, DcConstants.RIGHTS, null, true);
    addElement(items, DcConstants.SOURCE, null, true);
    addElement(items, DcConstants.SUBJECT, null, true);
    addElement(items, DcConstants.TITLE, null, true);
    addElement(items, DcConstants.TYPE, null, true);
    f.setFields(items.toArray(new FormItem[items.size()]));
    return f;
}
 
Example 2
Source File: UrnNbnAction.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private DynamicForm createOptionResolver() {
    DynamicForm form = new DynamicForm();
    SelectItem selection = new SelectItem(UrnNbnResourceApi.FIND_RESOLVER_PARAM,
            i18n.UrnNbnAction_Window_Select_Title());
    selection.setRequired(true);
    selection.setOptionDataSource(UrnNbnResolverDataSource.getInstance());
    selection.setValueField(UrnNbnResourceApi.RESOLVER_ID);
    selection.setDisplayField(UrnNbnResourceApi.RESOLVER_NAME);
    selection.setAutoFetchData(true);
    selection.setDefaultToFirstOption(true);
    selection.setWidth(350);
    selection.setAutoFetchData(true);
    form.setFields(selection);
    form.setBrowserSpellCheck(false);
    form.setWrapItemTitles(false);
    form.setTitleOrientation(TitleOrientation.TOP);
    return form;
}
 
Example 3
Source File: AttributeSetPropertiesPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
protected void addMetadata() {
	form1 = new DynamicForm();
	form1.setNumCols(1);
	form1.setValuesManager(vm);
	form1.setTitleOrientation(TitleOrientation.LEFT);

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

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

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

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

	form1.setItems(id, name, description);

	form1.setWidth(200);
}
 
Example 4
Source File: SearchIndexCheckStatus.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public SearchIndexCheckStatus(String result) {
	super();
	
	setWidth100();
	setHeight100();

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


	final DynamicForm form = new DynamicForm();
	form.setHeight100();
	form.setWidth100();
	form.setTitleOrientation(TitleOrientation.TOP);

	final TextAreaItem status = new TextAreaItem();
	status.setWidth(700);
	status.setHeight("100%");
	status.setValue(result);
	status.setShowTitle(false);

	form.setFields(status);
	addItem(form);
}
 
Example 5
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 6
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 7
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 8
Source File: ContactDetails.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public ContactDetails(final GUIContact contact, final Contacts parent) {
	super();

	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("contact"));
	setWidth(500);
	setAutoHeight();
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setAutoSize(true);

	final ValuesManager vm = new ValuesManager();
	final DynamicForm form = new DynamicForm();
	form.setValuesManager(vm);
	form.setMargin(5);
	form.setNumCols(3);
	form.setTitleOrientation(TitleOrientation.TOP);

	TextItem firstName = ItemFactory.newTextItem("firstname", "firstname", contact.getFirstName());
	TextItem lastName = ItemFactory.newTextItem("lastname", "lastname", contact.getLastName());
	TextItem email = ItemFactory.newEmailItem("email", "email", false);
	email.setRequired(true);
	email.setValue(contact.getEmail());
	TextItem address = ItemFactory.newTextItem("address", "address", contact.getAddress());
	TextItem phone = ItemFactory.newTextItem("phone", "phone", contact.getPhone());
	TextItem cell = ItemFactory.newTextItem("cell", "cell", contact.getMobile());
	TextItem company = ItemFactory.newTextItem("company", "company", contact.getCompany());
	company.setWidth(180);

	ButtonItem save = new ButtonItem();
	save.setTitle(I18N.message("save"));
	save.setAutoFit(true);
	save.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			vm.validate();
			if (!vm.hasErrors()) {

				GUIContact c = new GUIContact();
				c.setId(contact.getId());
				c.setUserId(Session.get().getUser().getId());
				c.setFirstName(vm.getValueAsString("firstname"));
				c.setLastName(vm.getValueAsString("lastname"));
				c.setEmail(vm.getValueAsString("email"));
				c.setAddress(vm.getValueAsString("address"));
				c.setPhone(vm.getValueAsString("phone"));
				c.setMobile(vm.getValueAsString("cell"));
				c.setCompany(vm.getValueAsString("company"));

				ContactService.Instance.get().save(c, new AsyncCallback<Void>() {
					@Override
					public void onFailure(Throwable caught) {
						SC.warn(caught.getMessage());
					}

					@Override
					public void onSuccess(Void ret) {
						ContactDetails.this.destroy();
						if (parent != null)
							parent.refresh();
					}
				});
			}
		}
	});

	form.setFields(email, firstName, lastName, company, address, phone, cell, save);

	addItem(form);
}
 
Example 9
Source File: Registration.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public Registration(String[] reg) {
	super();

	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("registration"));
	setWidth(350);
	setHeight(150);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setAutoSize(true);

	final DynamicForm form = new DynamicForm();
	form.setValuesManager(vm);
	form.setMargin(5);
	form.setNumCols(2);
	form.setTitleOrientation(TitleOrientation.TOP);

	TextItem regName = ItemFactory.newTextItem("reg_name", "name", null);
	regName.setWrapTitle(false);
	regName.setValue(reg[0]);

	TextItem regEmail = ItemFactory.newEmailItem("reg_email", "email", false);
	regEmail.setWrapTitle(false);
	regEmail.setValue(reg[1]);

	TextItem regOrganization = ItemFactory.newTextItem("reg_organization", "organization", null);
	regOrganization.setWrapTitle(false);
	regOrganization.setValue(reg[2]);

	TextItem regWebsite = ItemFactory.newTextItem("reg_website", "website", null);
	regWebsite.setWidth(180);
	regWebsite.setWrapTitle(false);
	regWebsite.setValue(reg[3]);

	ButtonItem apply = new ButtonItem();
	apply.setTitle(I18N.message("apply"));
	apply.setAutoFit(true);
	apply.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			vm.validate();
			if (!vm.hasErrors()) {
				SettingService.Instance.get().saveRegistration(form.getValueAsString("reg_name"),
						form.getValueAsString("reg_email"), form.getValueAsString("reg_organization"),
						form.getValueAsString("reg_website"), new AsyncCallback<Void>() {
							@Override
							public void onFailure(Throwable caught) {
								SC.warn(caught.getMessage());
							}

							@Override
							public void onSuccess(Void ret) {
								afterSave();
								Registration.this.destroy();
							}
						});
			}
		}
	});

	form.setFields(regName, regEmail, regOrganization, regWebsite, apply);

	addItem(form);
}
 
Example 10
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 11
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 12
Source File: TagsSettingsPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void onDraw() {
	DynamicForm parametersForm = new DynamicForm();
	parametersForm.setValuesManager(vm);
	parametersForm.setTitleOrientation(TitleOrientation.LEFT);
	parametersForm.setNumCols(2);
	parametersForm.setColWidths(1, "*");
	parametersForm.setPadding(5);

	SelectItem mode = ItemFactory.newTagInputMode("mode", "inputmode");

	SpinnerItem maxsize = ItemFactory.newSpinnerItem("maxsize", I18N.message("maxsize"), (Long) null);
	maxsize.setRequired(true);

	SpinnerItem minsize = ItemFactory.newSpinnerItem("minsize", I18N.message("minsize"), (Long) null);
	minsize.setRequired(true);

	SpinnerItem cloudElements = ItemFactory.newSpinnerItem("cloudElements", I18N.message("tagcloudelements"),
			(Long) null);
	cloudElements.setRequired(true);
	cloudElements.setWrapTitle(false);

	TextItem vocabulary = ItemFactory.newTextItem("vocabulary", I18N.message("vocabulary"), null);
	vocabulary.setRequired(true);
	vocabulary.setWidth(300);

	parametersForm.setItems(mode, maxsize, minsize, cloudElements, vocabulary);
	addMember(parametersForm);

	for (GUIParameter p : settings) {
		if (p.getName().endsWith("tag.mode"))
			mode.setValue(p.getValue());
		if (p.getName().endsWith("tag.maxsize"))
			maxsize.setValue(p.getValue());
		if (p.getName().endsWith("tag.minsize"))
			minsize.setValue(p.getValue());
		if (p.getName().endsWith("tag.vocabulary"))
			vocabulary.setValue(p.getValue());
		if (p.getName().endsWith("tagcloud.maxtags"))
			cloudElements.setValue(p.getValue());
	}

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

			if (vm.validate()) {
				List<GUIParameter> params = new ArrayList<GUIParameter>();

				params.add(new GUIParameter(Session.get().getTenantName() + ".tag.mode", values.get("mode")
						.toString()));
				params.add(new GUIParameter(Session.get().getTenantName() + ".tag.maxsize", values.get("maxsize")
						.toString()));
				params.add(new GUIParameter(Session.get().getTenantName() + ".tag.minsize", values.get("minsize")
						.toString()));
				params.add(new GUIParameter(Session.get().getTenantName() + ".tag.vocabulary", values.get(
						"vocabulary").toString()));
				params.add(new GUIParameter(Session.get().getTenantName() + ".tagcloud.maxtags", values.get(
						"cloudElements").toString()));

				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 ret) {
								Session.get()
										.getInfo()
										.setConfig(Session.get().getTenantName() + ".tag.mode",
												values.get("mode").toString());
								Session.get()
										.getInfo()
										.setConfig(Session.get().getTenantName() + ".tag.maxsize",
												values.get("maxsize").toString());

								Session.get()
										.getInfo()
										.setConfig(Session.get().getTenantName() + ".tag.minsize",
												values.get("minsize").toString());

								Session.get()
										.getInfo()
										.setConfig(Session.get().getTenantName() + ".tagcloud.maxtags",
												values.get("cloudElements").toString());

								Log.info(I18N.message("settingssaved"), null);
							}
						});
			}
		}
	});

	addMember(save);
}
 
Example 13
Source File: SystemMenu.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void addInformations() {
	DynamicForm form1 = new DynamicForm();
	form1.setWidth(300);
	form1.setColWidths(1, "*");

	StaticTextItem productName = ItemFactory.newStaticTextItem("productName", "",
			"<b>" + Session.get().getInfo().getBranding().getProductName() + "</b>");
	productName.setShouldSaveValue(false);
	productName.setShowTitle(false);
	productName.setWrapTitle(false);
	productName.setWrap(false);
	productName.setEndRow(true);

	StaticTextItem version = ItemFactory.newStaticTextItem("version", "",
			I18N.message("version") + " " + Session.get().getInfo().getRelease());
	version.setShouldSaveValue(false);
	version.setShowTitle(false);
	version.setWrap(false);
	version.setEndRow(true);

	StaticTextItem vendor = ItemFactory.newStaticTextItem("vendor", "",
			"&copy; " + Session.get().getInfo().getBranding().getVendor());
	vendor.setShouldSaveValue(false);
	vendor.setShowTitle(false);
	vendor.setEndRow(true);

	String userno = Session.get().getInfo().getUserNo();
	String installationId = Session.get().getInfo().getInstallationId();

	DynamicForm form2 = new DynamicForm();
	form2.setAlign(Alignment.LEFT);
	form2.setTitleOrientation(TitleOrientation.TOP);
	form2.setColWidths(1);
	form2.setWrapItemTitles(false);
	form2.setNumCols(1);

	LinkItem support = new LinkItem();
	support.setName(I18N.message("support"));
	support.setLinkTitle(Session.get().getInfo().getBranding().getSupport());

	String mailTo = "mailto:" + Session.get().getInfo().getBranding().getSupport() + "?subject="
			+ Session.get().getInfo().getBranding().getProductName() + " Support - ";
	if (userno != null)
		mailTo += "UserNo(" + userno + ")";
	else
		mailTo += "ID(" + Session.get().getInfo().getInstallationId() + ")";
	support.setValue(mailTo);
	support.setRequired(true);
	support.setShouldSaveValue(false);

	StaticTextItem installationID = ItemFactory.newStaticTextItem("installid", "installid", installationId);
	installationID.setWidth(250);
	installationID.setRequired(true);
	installationID.setShouldSaveValue(false);
	installationID.setWrap(true);
	installationID.setWrapTitle(false);

	StaticTextItem usernoItem = ItemFactory.newStaticTextItem("userno", "userno", userno);
	usernoItem.setWidth(250);
	usernoItem.setRequired(true);
	usernoItem.setShouldSaveValue(false);
	usernoItem.setWrap(true);
	usernoItem.setWrapTitle(false);

	StaticTextItem hostName = ItemFactory.newStaticTextItem("hostname", "hostname",
			Session.get().getInfo().getHostName());
	hostName.setWidth(250);
	hostName.setRequired(true);
	hostName.setShouldSaveValue(false);
	hostName.setWrap(true);
	hostName.setWrapTitle(false);
	hostName.setVisible(!Session.get().isDemo());

	form1.setItems(productName, version, vendor);

	if (userno != null)
		form2.setItems(support, usernoItem, installationID, hostName);
	else
		form2.setItems(support, installationID, hostName);

	if (!Session.get().isDemo()) {
		addMember(form1);
		addMember(form2);
	}
}
 
Example 14
Source File: TaskEditor.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
private VLayout prepareMessagesPanel() {
	VLayout messagesPanel = new VLayout();
	messagesPanel.setWidth100();
	messagesPanel.setHeight100();

	DynamicForm messagesForm = new DynamicForm();
	messagesForm.setTitleOrientation(TitleOrientation.TOP);
	messagesForm.setNumCols(2);
	messagesForm.setTitleOrientation(TitleOrientation.LEFT);
	messagesForm.setValuesManager(vm);

	SelectItem creationMessageTemplate = ItemFactory.newSelectItem("creationMessageTemplate",
			state.getType() == GUIWFState.TYPE_TASK ? "messageontaskreached" : "messageonendstatusreached");
	creationMessageTemplate.setWrapTitle(false);

	SelectItem assignmentMessageTemplate = ItemFactory.newSelectItem("assignmentMessageTemplate",
			"messageontaskassignment");
	assignmentMessageTemplate.setWrapTitle(false);

	SelectItem reminderMessageTemplate = ItemFactory.newSelectItem("reminderMessageTemplate", "messageonremind");
	reminderMessageTemplate.setWrapTitle(false);

	if (state.getType() == GUIWFState.TYPE_TASK)
		messagesForm.setItems(creationMessageTemplate, assignmentMessageTemplate, reminderMessageTemplate);
	else
		messagesForm.setItems(creationMessageTemplate);

	messagesPanel.addMember(messagesForm);

	MessageService.Instance.get().loadTemplates(I18N.getLocale(), "user",
			new AsyncCallback<GUIMessageTemplate[]>() {

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

				@Override
				public void onSuccess(GUIMessageTemplate[] templates) {
					LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
					map.put("", "");
					for (GUIMessageTemplate t : templates)
						map.put("" + t.getName(), t.getName());

					creationMessageTemplate.setValueMap(map);
					creationMessageTemplate.setValue("");
					creationMessageTemplate.setValue(state.getCreationMessageTemplate());

					assignmentMessageTemplate.setValueMap(map);
					assignmentMessageTemplate.setValue("");
					assignmentMessageTemplate.setValue(state.getAssignmentMessageTemplate());

					reminderMessageTemplate.setValueMap(map);
					reminderMessageTemplate.setValue("");
					reminderMessageTemplate.setValue(state.getReminderMessageTemplate());
				}
			});

	return messagesPanel;
}
 
Example 15
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 16
Source File: GDriveCreate.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public GDriveCreate() {
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("createdoc"));
	setWidth(300);
	setHeight(120);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setPadding(5);
	setMembersMargin(3);

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

	TextItem fileName = ItemFactory.newTextItem("fileName", "filename", null);
	fileName.setRequired(true);
	fileName.setWidth(200);

	SelectItem type = ItemFactory.newSelectItem("type", I18N.message("type"));
	LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
	map.put("doc", "doc");
	map.put("docx", "docx");
	map.put("odt", "odt");
	map.put("txt", "txt");
	map.put("xls", "xls");
	map.put("xlsx", "xlsx");
	map.put("ods", "ods");
	map.put("ppt", "ppt");
	map.put("pptx", "pptx");
	map.put("odp", "odp");
	type.setValueMap(map);
	type.setValue("doc");
	type.setWidth(50);
	type.setEndRow(true);
	type.setRequired(true);

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

	form.setItems(fileName, type, create);

	addItem(form);
}
 
Example 17
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 18
Source File: ParametersPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public ParametersPanel(GUIParameter[] settings) {
	super("parameters");
	this.settings = settings;

	setWidth100();
	setHeight100();
	setMembersMargin(5);
	setMargin(5);

	DynamicForm form = new DynamicForm();
	form.setValuesManager(vm);
	form.setTitleOrientation(TitleOrientation.TOP);
	form.setNumCols(4);
	form.setColWidths(100, 100, 100, 100);

	TextItem[] items = new TextItem[settings.length];

	int i = 0;
	for (GUIParameter parameter : settings) {
		TextItem item = ItemFactory.newTextItem(parameter.getName(), parameter.getName(), parameter.getValue());
		items[i] = item;
		i++;
	}

	form.setItems(items);

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

			if (vm.validate()) {
				for (GUIParameter param : ParametersPanel.this.settings) {
					param.setValue((String) values.get(ItemFactory.filterItemName(param.getName())));
					Session.get().getInfo().setConfig(param.getName(), param.getValue());
				}

				SettingService.Instance.get().saveSettings(ParametersPanel.this.settings,
						new AsyncCallback<Void>() {

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

							@Override
							public void onSuccess(Void ret) {
								Log.info(I18N.message("settingssaved"), null);
							}
						});
			}
		}
	});
	save.setDisabled(Session.get().isDemo() && Session.get().getUser().getId() == 1);

	body.setMembers(form);
	addMember(save);
}
 
Example 19
Source File: TwoFactorsAuthenticationPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public TwoFactorsAuthenticationPanel(GUIUser user, boolean withNotify) {
	super();
	this.user = user;

	DynamicForm form = new DynamicForm();
	form.setWidth100();
	form.setValuesManager(vm);
	form.setTitleOrientation(TitleOrientation.LEFT);

	notify = ItemFactory.newCheckbox("notify", "notifyuser");
	notify.setValue(false);
	notify.setDisabled(true);

	SelectItem method = ItemFactory.new2AFMethodSelector("factor", user.getSecondFactor());
	method.setWidth(250);
	method.addChangedHandler(new ChangedHandler() {

		@Override
		public void onChanged(ChangedEvent event) {
			removeMember(setupPanel);
			if (event.getValue() == null || event.getValue().toString().isEmpty()) {
				setupPanel = new TwoFactorsAuthenticationSetup();
				TwoFactorsAuthenticationPanel.this.user.setKey(null);
				TwoFactorsAuthenticationPanel.this.user.setSecondFactor(null);
				notify.setValue(false);
				notify.setDisabled(true);
			} else if (Constants.TWOFA_GOOGLE_AUTHENTICATOR.equals(event.getValue().toString())) {
				setupPanel = new GoogleAuthenticatorSetup(TwoFactorsAuthenticationPanel.this.user);
				notify.setValue(true);
				notify.setDisabled(false);
			} else if (Constants.TWOFA_YUBIKEY.equals(event.getValue().toString())) {
				setupPanel = new YubiKeySetup(TwoFactorsAuthenticationPanel.this.user);
				notify.setValue(false);
				notify.setDisabled(true);
			}
			addMember(setupPanel);
		}
	});

	if (withNotify)
		form.setItems(method, notify);
	else
		form.setItems(method);
	setMembers(form);
}
 
Example 20
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;
}