com.smartgwt.client.widgets.form.fields.events.ClickHandler Java Examples

The following examples show how to use com.smartgwt.client.widgets.form.fields.events.ClickHandler. 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: RegisterLayout.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
void createAcceptTermsOfUse() {
    // linkItem for terms of use
    this.linkTerms = new LinkItem("termsOfUse");
    this.linkTerms.setLinkTitle(i18n.termsOfUse());
    this.linkTerms.setShouldSaveValue(false);
    this.linkTerms.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            EventBus.getMainEventBus().fireEvent(new GetTermsOfUseEvent(PropertiesManager.language));
        }
    });

    this.acceptBox = new CheckboxItem();
    this.acceptBox.setName("acceptTerms");
    this.acceptBox.setTitle(i18n.acceptTermsOfUse());
    this.acceptBox.setValue(false);
    this.acceptBox.setRequired(true);
}
 
Example #2
Source File: TextContentCreate.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public TextContentCreate() {
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("createtextcontent"));
	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 filename = ItemFactory.newTextItem("filename", "filename", null);
	filename.setRequired(true);
	filename.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(filename, template, create);

	addItem(form);
}
 
Example #3
Source File: RegisterLayout.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private LinkItem createBackToLoginLink() {
    LinkItem backToLoginLink = new LinkItem();
    backToLoginLink.setShowTitle(false); // only link
    backToLoginLink.setDefaultValue(i18n.userLogin());
    backToLoginLink.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            getMainEventBus().fireEvent(new ChangeLayoutEvent(LOGIN));
        }
    });
    return backToLoginLink;
}
 
Example #4
Source File: RegisterLayout.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private ButtonItem createRegisterButton() {
    ButtonItem registerButton = new ButtonItem();
    registerButton.setTitle(i18n.register());
    registerButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            RegisterLayout.this.register();
        }
    });
    return registerButton;
}
 
Example #5
Source File: LoginLayout.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private LinkItem createForgotPasswordLink() {
    LinkItem forgotPasswordLink = new LinkItem();
    forgotPasswordLink.setShowTitle(false); // only link
    forgotPasswordLink.setDefaultValue(i18n.forgotPassword());
    forgotPasswordLink.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            getMainEventBus().fireEvent(new ChangeLayoutEvent(PASSWORD));
        }
    });
    return forgotPasswordLink;
}
 
Example #6
Source File: LoginLayout.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private LinkItem createRegisterLink() {
    LinkItem registerLink = new LinkItem();
    registerLink.setShowTitle(false); // only link
    registerLink.setDefaultValue(i18n.register());
    registerLink.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            getMainEventBus().fireEvent(new ChangeLayoutEvent(REGISTER));
        }
    });
    return registerLink;
}
 
Example #7
Source File: LoginLayout.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private ButtonItem createLoginButton() {
    ButtonItem loginButton = new ButtonItem();
    loginButton.setTitle(i18n.login());
    loginButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            if (LoginLayout.this.form.validate(false)) {
                login();
            }
        }
    });
    return loginButton;
}
 
Example #8
Source File: WorkflowDialog.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public WorkflowDialog(final long[] ids) {
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("startworkflow"));
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	setAutoSize(true);
	centerInPage();

	workflow = ItemFactory.newWorkflowSelector();
	workflow.setTitle(I18N.message("chooseworkflow"));
	workflow.setWrapTitle(false);
	workflow.setRequired(true);

	tag = ItemFactory.newTextItem("tag", I18N.message("tag"), null);
	tag.setWrapTitle(false);
	tag.setRequired(false);

	ButtonItem start = new ButtonItem();
	start.setTitle(I18N.message("startworkflow"));
	start.setAutoFit(true);
	start.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			onStart(ids);
		}
	});

	form.setTitleOrientation(TitleOrientation.TOP);
	form.setFields(workflow, tag, start);
	addItem(form);
}
 
Example #9
Source File: SendToArchiveDialog.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Constructor
 * 
 * @param ids Identifiers of the elements that have to be archived
 * @param document True if the ids refers to documents, False in case of
 *        folders
 */
public SendToArchiveDialog(final long[] ids, final boolean document) {
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);

	setTitle(I18N.message("sendtoexparchive"));
	setWidth(380);
	setHeight(100);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();

	SelectItem archive = ItemFactory.newArchiveSelector(GUIArchive.MODE_EXPORT, GUIArchive.STATUS_OPENED);
	archive.setTitle(I18N.message("selectopenarchive"));
	archive.setWrapTitle(false);
	archive.setRequired(true);

	ButtonItem send = new ButtonItem();
	send.setStartRow(false);
	send.setTitle(I18N.message("sendtoexparchive"));
	send.setAutoFit(true);
	send.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			onSend(ids, document);
		}
	});

	form.setFields(archive, send);
	addItem(form);
}
 
Example #10
Source File: NoteUpdateDialog.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public NoteUpdateDialog(final long docId, final long noteId, String noteMessage, final NotesPanel notesPanel) {
	super();
	this.notesPanel = notesPanel;
	this.noteId = noteId;
	this.docId = docId;

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

	message = new RichTextItem("name");
	message.setTitle(I18N.message("message"));
	message.setShowTitle(false);
	message.setRequired(true);
	message.setWidth("*");
	message.setHeight("*");
	message.setValue(noteMessage);

	save = new ButtonItem();
	save.setTitle(I18N.message("save"));
	save.setAutoFit(true);
	save.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			onSave();
		}
	});

	noteForm.setItems(message, save);
	addItem(noteForm);
}
 
Example #11
Source File: AddForm.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public AddForm() {
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);

	setTitle(I18N.message("addform"));
	setAutoSize(true);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();

	formSelector = ItemFactory.newFormSelector();
	formSelector.setWrapTitle(false);
	formSelector.setRequired(true);

	TextItem title = ItemFactory.newTextItem("title", "title", null);
	title.setRequired(true);

	ButtonItem save = new ButtonItem();
	save.setTitle(I18N.message("save"));
	save.setAutoFit(true);
	save.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			onSave();
		}
	});

	form.setNumCols(2);
	form.setTitleOrientation(TitleOrientation.TOP);
	form.setFields(title, formSelector, save);
	addItem(form);
}
 
Example #12
Source File: StampDialog.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public StampDialog(final DocumentsGrid sourceGrid) {
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("applystamp"));
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	setAutoSize(true);
	centerInPage();

	stamp = ItemFactory.newStampSelector();
	stamp.setTitle(I18N.message("choosestamp"));
	stamp.setWrapTitle(false);
	stamp.setRequired(true);

	visualPositioning = new CheckboxItem();
	visualPositioning.setName("visualpositioning");
	visualPositioning.setTitle(I18N.message("visualpositioning"));

	ButtonItem apply = new ButtonItem();
	apply.setTitle(I18N.message("apply"));
	apply.setAutoFit(true);
	apply.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			onApply(sourceGrid);
		}
	});

	form.setTitleOrientation(TitleOrientation.TOP);
	form.setFields(stamp, visualPositioning, apply);

	addItem(form);
}
 
Example #13
Source File: ZohoCheckin.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ZohoCheckin(final GUIDocument document, final ZohoEditor 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 #14
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 #15
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 #16
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 #17
Source File: WorkflowNoteEditor.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public WorkflowNoteEditor(TaskDetailsDialog parentDialog) {
	super();
	this.parentDialog = parentDialog;

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

	message = new RichTextItem("message");
	message.setTitle(I18N.message("message"));
	message.setShowTitle(false);
	message.setRequired(true);
	message.setWidth(680);
	message.setHeight(230);

	save = new ButtonItem();
	save.setTitle(I18N.message("save"));
	save.setAutoFit(true);
	save.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			onSave();
		}
	});

	noteForm.setItems(message, save);
	addItem(noteForm);
}
 
Example #18
Source File: ContactsImportSettings.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public ContactsImportSettings() {
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("uploadcontacts"));
	setWidth(380);
	setHeight(330);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();

	form = new DynamicForm();

	SelectItem separated = ItemFactory.newSelectItem("separatedby", "separatedby");
	separated.setWidth(80);
	LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
	map.put(",", ",");
	map.put(";", ";");
	separated.setValueMap(map);
	separated.setValue(",");

	SelectItem delimiter = ItemFactory.newSelectItem("textdelimiter", "textdelimiter");
	delimiter.setWidth(80);
	LinkedHashMap<String, String> map2 = new LinkedHashMap<String, String>();
	map2.put("\"", "\"");
	map2.put("'", "'");
	delimiter.setValueMap(map2);
	delimiter.setValue("\"");

	RadioGroupItem skip = ItemFactory.newBooleanSelector("skipfirstrow", "skipfirstrow");
	skip.setValue("yes");

	SpinnerItem firstName = ItemFactory.newSpinnerItem("firstname", "firstname", 1);
	firstName.setRequired(true);
	firstName.setWidth(60);
	firstName.setMin(1);
	firstName.setHint(I18N.message("columnindex"));

	SpinnerItem lastName = ItemFactory.newSpinnerItem("lastname", "lastname", 2);
	lastName.setRequired(true);
	lastName.setWidth(60);
	lastName.setMin(1);
	lastName.setHint(I18N.message("columnindex"));

	SpinnerItem email = ItemFactory.newSpinnerItem("email", "email", 3);
	email.setRequired(true);
	email.setWidth(60);
	email.setMin(1);
	email.setHint(I18N.message("columnindex"));

	SpinnerItem company = ItemFactory.newSpinnerItem("company", "company", 4);
	company.setRequired(true);
	company.setWidth(60);
	company.setMin(1);
	company.setHint(I18N.message("columnindex"));

	SpinnerItem phone = ItemFactory.newSpinnerItem("phone", "phone", 5);
	phone.setRequired(true);
	phone.setWidth(60);
	phone.setMin(1);
	phone.setHint(I18N.message("columnindex"));

	SpinnerItem mobile = ItemFactory.newSpinnerItem("mobile", "cell", 6);
	mobile.setRequired(true);
	mobile.setWidth(60);
	mobile.setMin(1);
	mobile.setHint(I18N.message("columnindex"));

	SpinnerItem address = ItemFactory.newSpinnerItem("address", "address", 7);
	address.setRequired(true);
	address.setWidth(60);
	address.setMin(1);
	address.setHint(I18N.message("columnindex"));

	SubmitItem importButton = new SubmitItem();
	importButton.setTitle(I18N.message("iimport"));
	importButton.setEndRow(true);
	importButton.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			onImport();
		}
	});

	form.setItems(separated, delimiter, skip, firstName, lastName, email, company, phone, mobile, address,
			importButton);

	addItem(form);
}
 
Example #19
Source File: ReplicateUserSettings.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public ReplicateUserSettings(List<Long> userIds, final UsersPanel panel) {
	super();

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

	final ValuesManager vm = new ValuesManager();
	final DynamicForm form = new DynamicForm();
	form.setValuesManager(vm);
	form.setWidth(350);

	SelectItem masterUser = ItemFactory.newUserSelector("user", "masteruser", null, true);
	masterUser.setHint(I18N.message("masteruserhint"));

	final CheckboxItem userInterface = ItemFactory.newCheckbox("userinterface", "userinterface");
	userInterface.setValue(true);

	final CheckboxItem groups = ItemFactory.newCheckbox("groups", "groups");
	groups.setValue(false);

	final ButtonItem confirm = new ButtonItem();
	confirm.setTitle(I18N.message("confirm"));
	confirm.setAutoFit(true);
	confirm.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			vm.validate();
			if (!vm.hasErrors()) {
				long masterUserId = Long.parseLong(vm.getValueAsString("user"));
				ContactingServer.get().show();
				SecurityService.Instance.get().replicateUsersSettings(masterUserId, userIds.toArray(new Long[0]),
						userInterface.getValueAsBoolean(), groups.getValueAsBoolean(), new AsyncCallback<Void>() {

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

							@Override
							public void onSuccess(Void arg0) {
								ContactingServer.get().hide();
								Log.info(I18N.message("userssaved"));
								destroy();
								panel.refresh();
							}
						});
			}
		}
	});

	form.setFields(masterUser, userInterface, groups, confirm);

	addItem(form);
}
 
Example #20
Source File: ShareFileSettings.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public ShareFileSettings(String[] settings) {
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("sharefile"));
	setWidth(400);
	setHeight(150);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setPadding(2);
	setMembersMargin(2);

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

	TextItem username = ItemFactory.newEmailItem("username", "username", false);
	username.setValue(settings[0]);
	username.setRequired(true);
	username.setWidth(220);

	TextItem password = ItemFactory.newPasswordItem("password", "password", null);
	password.setRequired(true);
	password.setWidth(150);

	TextItem host = ItemFactory.newTextItem("host", "host", null);
	host.setValue(settings[2]);
	host.setRequired(true);
	host.setWidth(220);

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

	form.setItems(host, username, password, save);

	addItem(form);
}
 
Example #21
Source File: SaveDialog.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public SaveDialog() {
	super();

	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("savesearch"));
	setWidth(350);
	setHeight(100);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setPadding(5);
	setAutoSize(true);

	final ValuesManager vm = new ValuesManager();
	final DynamicForm form = new DynamicForm();
	form.setValuesManager(vm);
	form.setWidth(350);
	form.setMargin(5);

	TextItem name = ItemFactory.newTextItem("name", "name", null);
	name.setRequired(true);
	name.setValidators(new SimpleTextValidator());
	name.setWidth(100);

	TextItem description = ItemFactory.newTextItem("description", "description", null);
	description.setWidth(300);

	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()) {
				final GUISearchOptions options = Search.get().getOptions();
				options.setName(vm.getValueAsString("name"));
				options.setDescription(vm.getValueAsString("description"));
				SearchService.Instance.get().save(Search.get().getOptions(), new AsyncCallback<Boolean>() {

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

					@Override
					public void onSuccess(Boolean b) {
						if (!b)
							SC.warn(I18N.message("duplicateelement"));
						else {
							SavedSearchesPanel.get().addEntry(
									vm.getValueAsString("name"),
									vm.getValueAsString("description"),
									options.getType() == GUISearchOptions.TYPE_FULLTEXT ? I18N.message("fulltext")
											: I18N.message("parametric"));
							destroy();
						}
					}
				});
			}
		}
	});

	form.setFields(name, description, save);
	addItem(form);
}
 
Example #22
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 #23
Source File: GDriveSettings.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public GDriveSettings() {
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("googledrive"));
	setWidth(400);
	setHeight(150);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setPadding(2);

	form.setTitleOrientation(TitleOrientation.TOP);

	final TextItem clientId = ItemFactory.newTextItem("clientid", "clientid", null);
	clientId.setWidth(370);
	clientId.setRequired(true);
	clientId.setEndRow(true);

	final TextItem clientSecret = ItemFactory.newTextItem("clientsecret", "clientsecret", null);
	clientSecret.setWidth(370);
	clientSecret.setRequired(true);
	clientSecret.setEndRow(true);

	ButtonItem authorize = new ButtonItem("authorize", I18N.message("authorize"));
	authorize.setAutoFit(true);

	authorize.addClickHandler(new ClickHandler() {

		@Override
		public void onClick(ClickEvent event) {
			onAuthenticate();
		}
	});

	form.setFields(clientId, clientSecret, authorize);

	addItem(form);

	GDriveService.Instance.get().loadSettings(new AsyncCallback<String[]>() {

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

		@Override
		public void onSuccess(String[] settings) {
			clientId.setValue(settings[0]);
			clientSecret.setValue(settings[1]);
		}
	});
}
 
Example #24
Source File: ResetPassword.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public ResetPassword(String product) {
	this.productName = product;
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("passwordreset"));
	setWidth(340);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setPadding(5);
	setAutoSize(true);
	setMargin(5);

	DynamicForm form = new DynamicForm();
	form.setMargin(5);
	form.setValuesManager(vm);
	TextItem username = ItemFactory.newTextItem("username", "username", "");
	username.setRequired(true);
	TextItem email = ItemFactory.newEmailItem("email", "email", false);
	email.setRequired(true);
	form.setFields(username, email);
	addItem(form);

	Label pwdResetMsg = new Label(I18N.message("passwordresetmessage"));
	pwdResetMsg.setWidth100();
	pwdResetMsg.setMargin(5);
	addItem(pwdResetMsg);

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

			if (vm.validate()) {
				final String userName = (String) values.get("username");
				final String emailAddress = (String) values.get("email");
				buttonForm.setDisabled(true);
				loginService.resetPassword(userName, emailAddress, productName, new AsyncCallback<Void>() {

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

					@Override
					public void onSuccess(Void result) {
						buttonForm.setDisabled(false);
						SC.say(I18N.message("amessagewassentto", emailAddress));
						destroy();
					}
				});
			}
		}
	});
	buttonForm.setItems(resetButton);
	addItem(buttonForm);
}
 
Example #25
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 #26
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 #27
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);
}
 
Example #28
Source File: ConversionDialog.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public ConversionDialog(GUIDocument document) {
	this.document = document;
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);

	setTitle(I18N.message("convert") + " - " + document.getFileName());
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setAutoSize(true);

	final RadioGroupItem action = ItemFactory.newRadioGroup("action", I18N.message("action"));
	action.setRequired(true);
	action.setEndRow(true);

	final SelectItem format = ItemFactory.newConversionFormatItem(document.getFileName());
	format.setEndRow(true);
	format.setRequired(true);

	final ButtonItem convert = new ButtonItem();
	convert.setStartRow(false);
	convert.setTitle(I18N.message("convert"));
	convert.setAutoFit(true);
	convert.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			onConvert();
		}
	});

	FolderService.Instance.get().getFolder(document.getFolder().getId(), false, false, false, 
			new AsyncCallback<GUIFolder>() {

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

				@Override
				public void onSuccess(GUIFolder folder) {
					convert.setDisabled(!folder.isDownload() && !folder.isWrite());

					LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
					if (folder.isDownload())
						map.put("download", I18N.message("download"));
					if (folder.isWrite())
						map.put("save", I18N.message("save"));
					action.setValueMap(map);
					action.setValue("download");

					form.setFields(format, action, convert);
					addItem(form);
				}
			});
}
 
Example #29
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 #30
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);
}