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

The following examples show how to use com.smartgwt.client.widgets.form.DynamicForm#setAlign() . 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: KeystoreUploader.java    From document-management-software with GNU Lesser General Public License v3.0 6 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 localCAalias = ItemFactory.newSimpleTextItem("localCAalias", "localcaalias",
			keystorePanel.getKeystore() != null ? keystorePanel.getKeystore().getOrganizationAlias() : null);
	localCAalias.setRequired(true);
	localCAalias.setSelectOnFocus(true);
	localCAalias.setWrapTitle(false);

	TextItem password = ItemFactory.newPasswordItem("password", "keystorepasswd",
			keystorePanel.getKeystore() != null ? keystorePanel.getKeystore().getPassword() : null);
	password.setRequired(false);
	password.setWrapTitle(false);

	form.setItems(localCAalias, password);
}
 
Example 2
Source File: ZonalOCRTemplateSettings.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);

	final StaticTextItem fileNameWaring = ItemFactory.newStaticTextItem("fileNameWarning",
			I18N.message("attention"), I18N.message("filenamewarning"));
	fileNameWaring.setRequired(true);

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

	StaticTextItem id = ItemFactory.newStaticTextItem("id", I18N.message("id"),
			"" + ocrPanel.getSelectedOcrTemplate().getId());
	id.setVisible(ocrPanel.getSelectedOcrTemplate().getId() != 0L);

	SpinnerItem batch = ItemFactory.newSpinnerItem("batch", "batch",
			Session.get().getConfigAsInt("zonalocr.batch"));
	batch.setStep(50);
	batch.setMin(1);

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

	if (Session.get().isDefaultTenant())
		form.setItems(id, name, description, batch);
	else
		form.setItems(id, name, description);
}
 
Example 3
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 4
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 5
Source File: AntivirusPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void initGUI(GUIParameter[] settings) {
	final DynamicForm form = new DynamicForm();
	form.setTitleOrientation(TitleOrientation.LEFT);
	form.setAlign(Alignment.LEFT);

	RadioGroupItem enabled = ItemFactory.newBooleanSelector("enabled", I18N.message("enabled"));
	enabled.setWrapTitle(false);
	enabled.setRequired(true);

	TextItem command = ItemFactory.newTextItem("command", "ClamAV", null);
	command.setWidth(400);

	TextItem includes = ItemFactory.newTextItem("includes", "include", null);
	includes.setWidth(400);

	TextItem excludes = ItemFactory.newTextItem("excludes", "exclude", null);
	excludes.setWidth(400);

	TextItem timeout = ItemFactory.newSpinnerItem("timeout", "timeout", (Integer) null);
	timeout.setHint(I18N.message("seconds"));

	for (GUIParameter setting : settings) {
		if ((Session.get().getTenantName() + ".antivirus.enabled").equals(setting.getName()))
			enabled.setValue("true".equals(setting.getValue()) ? "yes" : "no");
		else if ("antivirus.command".equals(setting.getName()))
			command.setValue(setting.getValue());
		else if ((Session.get().getTenantName() + ".antivirus.excludes").equals(setting.getName()))
			excludes.setValue(setting.getValue());
		else if ((Session.get().getTenantName() + ".antivirus.includes").equals(setting.getName()))
			includes.setValue(setting.getValue());
		else if ((Session.get().getTenantName() + ".antivirus.timeout").equals(setting.getName()))
			timeout.setValue(Integer.parseInt(setting.getValue()));
	}

	IButton save = new IButton();
	save.setTitle(I18N.message("save"));
	save.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			if (form.validate()) {
				GUIParameter[] params = new GUIParameter[Session.get().isDefaultTenant() ? 4 : 3];
				params[0] = new GUIParameter(Session.get().getTenantName() + ".antivirus.enabled",
						"" + ("yes".equals(form.getValueAsString("enabled"))));
				params[1] = new GUIParameter(Session.get().getTenantName() + ".antivirus.excludes",
						form.getValueAsString("excludes").trim());
				params[2] = new GUIParameter(Session.get().getTenantName() + ".antivirus.includes",
						form.getValueAsString("includes").trim());
				params[3] = new GUIParameter(Session.get().getTenantName() + ".antivirus.timeout",
						form.getValueAsString("timeout").trim());

				if (Session.get().isDefaultTenant())
					params[4] = new GUIParameter("antivirus.command", form.getValueAsString("command").trim());

				SettingService.Instance.get().saveSettings(params, new AsyncCallback<Void>() {

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

					@Override
					public void onSuccess(Void ret) {
						Log.info(I18N.message("settingssaved"), null);
					}
				});
			}
		}
	});
	if (Session.get().isDefaultTenant())
		form.setFields(enabled, command, includes, excludes, timeout);
	else
		form.setFields(enabled, includes, excludes, timeout);

	Tab tab = new Tab();
	tab.setTitle(I18N.message("antivirus"));
	tab.setPane(form);

	TabSet tabs = new TabSet();
	tabs.setWidth100();
	tabs.setHeight100();
	tabs.setTabs(tab);

	setMembers(tabs, save);
}
 
Example 6
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);
	}
}