Java Code Examples for com.smartgwt.client.widgets.Button#setMargin()

The following examples show how to use com.smartgwt.client.widgets.Button#setMargin() . 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: EditingTabSet.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public EditingTabSet(ClickHandler saveHandler, ClickHandler cancelHandler) {
	saveButton = new Button(I18N.message("save"));
	saveButton.setAutoFit(true);
	saveButton.setMargin(2);
	saveButton.addClickHandler(saveHandler);
	saveButton.setLayoutAlign(VerticalAlignment.CENTER);

	cancelButton = new Button(I18N.message("cancel"));
	cancelButton.setAutoFit(true);
	cancelButton.setMargin(2);
	cancelButton.setLayoutAlign(VerticalAlignment.CENTER);
	cancelButton.addClickHandler(new ClickHandler() {

		@Override
		public void onClick(ClickEvent event) {
			hideSave();
		}
	});
	if (cancelHandler != null)
		cancelButton.addClickHandler(cancelHandler);

	savePanel = new HLayout();
	savePanel.setHeight(20);
	savePanel.setMembersMargin(5);
	savePanel.setStyleName("warn");
	savePanel.setMembers(saveButton, cancelButton);

	savePanel.hide();

	setTabBarControls(savePanel, TabBarControls.TAB_SCROLLER, TabBarControls.TAB_PICKER);
}
 
Example 2
Source File: ShareFileDialog.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public ShareFileDialog(boolean export) {
	super();
	this.export = export;
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("sharefile"));
	setWidth(350);
	setHeight(300);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setPadding(3);

	VLayout content = new VLayout();
	content.setTop(10);
	content.setWidth100();
	content.setHeight100();
	content.setMembersMargin(3);

	tree = new ShareFileTree(export);
	tree.setWidth100();
	tree.setHeight100();

	VLayout buttons = new VLayout();
	buttons.setWidth100();
	buttons.setHeight(30);

	Button select = new Button(I18N.message("select"));
	select.setAutoFit(true);
	select.setMargin(1);
	select.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			if (ShareFileDialog.this.export)
				onExport();
			else
				onImport();
		}
	});

	buttons.setMembers(select);

	content.setMembers(tree, buttons);
	addItem(content);
}
 
Example 3
Source File: TemplateDetailsPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public TemplateDetailsPanel(TemplatesPanel panel) {
	super();
	this.templatesPanel = panel;

	setHeight100();
	setWidth100();
	setMembersMargin(10);

	Button saveButton = new Button(I18N.message("save"));
	saveButton.setAutoFit(true);
	saveButton.setMargin(2);
	saveButton.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			onSave();
		}
	});
	saveButton.setLayoutAlign(VerticalAlignment.CENTER);

	HTMLPane spacer = new HTMLPane();
	spacer.setContents("<div>&nbsp;</div>");
	spacer.setWidth("70%");
	spacer.setOverflow(Overflow.HIDDEN);

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

					@Override
					public void onSuccess(GUITemplate template) {
						setTemplate(template);
					}
				});
			} else {
				setTemplate(new GUITemplate());
			}
		}
	});
	tabSet.setTabBarPosition(Side.TOP);
	tabSet.setTabBarAlign(Side.LEFT);
	tabSet.setWidth100();
	tabSet.setHeight100();

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

	addMember(tabSet);
}
 
Example 4
Source File: InheritRightsDialog.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public InheritRightsDialog(final FolderSecurityPanel panel) {
	super();
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("inheritrights"));
	setWidth(250);
	setHeight(270);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setPadding(3);

	VLayout content = new VLayout();
	content.setTop(10);
	content.setWidth100();
	content.setHeight100();
	content.setMembersMargin(3);

	final TreeGrid folders = new FolderTree();
	folders.setWidth100();
	folders.setHeight100();

	VLayout buttons = new VLayout();
	buttons.setWidth100();
	buttons.setHeight(30);

	Button inheritRights = new Button(I18N.message("inheritrights"));
	inheritRights.setAutoFit(true);
	inheritRights.setMargin(1);
	inheritRights.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			LD.ask(I18N.message("inheritrights"),
					I18N.message("inheritrightsask", new String[] {
							FolderNavigator.get().getSelectedRecord().getAttributeAsString("name"),
							folders.getSelectedRecord().getAttributeAsString("name") }), new BooleanCallback() {

						@Override
						public void execute(Boolean value) {
							if (value) {
								FolderService.Instance.get()
										.inheritRights(
												panel.getFolder().getId(),
												Long.parseLong(folders.getSelectedRecord().getAttributeAsString(
														"folderId")), new AsyncCallback<GUIFolder>() {

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

													@Override
													public void onSuccess(GUIFolder arg) {
														panel.refresh(arg);
														destroy();
													}
												});
							}
							destroy();
						}
					});
		}
	});

	buttons.setMembers(inheritRights);

	content.setMembers(folders, buttons);
	addItem(content);
}
 
Example 5
Source File: CreateAliasDialog.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public CreateAliasDialog() {
	super();
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("createalias"));
	setWidth(470);
	setHeight(280);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setPadding(3);

	VLayout content = new VLayout();
	content.setTop(10);
	content.setWidth100();
	content.setHeight100();
	content.setMembersMargin(3);

	final TreeGrid folders = new FolderTree();
	folders.setWidth100();
	folders.setHeight100();

	HLayout buttons = new HLayout();
	buttons.setWidth100();
	buttons.setHeight(30);

	Button create = new Button(I18N.message("create"));
	create.setAutoFit(true);
	create.setMargin(1);
	create.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			FolderNavigator.get().createAlias(
					Long.parseLong(folders.getSelectedRecord().getAttributeAsString("folderId")));
			destroy();
		}
	});

	buttons.setMembers(create);
	content.setMembers(folders, buttons);
	addItem(content);
}
 
Example 6
Source File: MoveDialog.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public MoveDialog() {
	super();
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("move"));
	setWidth(250);
	setHeight(270);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setPadding(3);

	VLayout content = new VLayout();
	content.setTop(10);
	content.setWidth100();
	content.setHeight100();
	content.setMembersMargin(3);

	final TreeGrid folders = new FolderTree();
	folders.setWidth100();
	folders.setHeight100();

	VLayout buttons = new VLayout();
	buttons.setWidth100();
	buttons.setHeight(30);

	Button move = new Button(I18N.message("move"));
	move.setAutoFit(true);
	move.setMargin(1);
	move.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			String shownName = FolderNavigator.get().getSelectedRecord().getAttributeAsString("name");
			long[] selection = FolderNavigator.get().getSelectedIds();
			if (selection.length > 1)
				shownName = selection.length + " " + I18N.message("folders").toLowerCase();

			LD.ask(I18N.message("move"),
					I18N.message("moveask", new String[] { shownName,
							folders.getSelectedRecord().getAttributeAsString("name") }), new BooleanCallback() {

						@Override
						public void execute(Boolean value) {
							if (value) {
								FolderNavigator.get()
										.moveTo(Long.parseLong(folders.getSelectedRecord().getAttributeAsString(
												"folderId")));
							}
							destroy();
						}
					});
		}
	});

	buttons.setMembers(move);

	content.setMembers(folders, buttons);
	addItem(content);
}
 
Example 7
Source File: ApplyTemplateDialog.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public ApplyTemplateDialog() {
	super();
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("applytemplate"));
	setAutoSize(true);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();

	VLayout content = new VLayout();
	content.setWidth100();
	content.setHeight100();
	content.setMembersMargin(2);

	final TreeGrid folders = new FolderTree();
	folders.setWidth100();
	folders.setHeight100();

	final boolean inheritOptionEnabled = "true".equals(Session.get().getInfo()
			.getConfig("gui.security.inheritoption"));

	final DynamicForm form = new DynamicForm();

	CheckboxItem inheritSecurity = new CheckboxItem();
	inheritSecurity.setName("inheritSecurity");
	inheritSecurity.setTitle(I18N.message("inheritparentsec"));
	form.setItems(inheritSecurity);

	SelectItem templateSelector = ItemFactory.newFolderTemplateSelector();

	if (inheritOptionEnabled)
		form.setItems(templateSelector, inheritSecurity);

	Button apply = new Button(I18N.message("apply"));
	apply.setAutoFit(true);
	apply.setMargin(1);
	apply.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			if (!form.validate())
				return;

			final TreeNode selectedNode = (TreeNode) FolderNavigator.get().getSelectedRecord();
			final long folderId = Long.parseLong(selectedNode.getAttributeAsString("folderId"));
			long templateId = Long.parseLong(form.getValueAsString("foldertemplate"));

			FolderService.Instance.get().applyTemplate(folderId, templateId,
					inheritOptionEnabled && "true".equals(form.getValueAsString("inheritSecurity")),
					new AsyncCallback<Void>() {

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

						@Override
						public void onSuccess(Void arg0) {
							FolderNavigator.get().getTree().reloadChildren(selectedNode);
							Log.info(I18N.message("templateapplied"), null);
							destroy();
						}
					});
		}
	});

	content.setMembers(form, apply);
	addItem(content);
}
 
Example 8
Source File: ZohoDialog.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public ZohoDialog(boolean export) {
	super();
	this.export = export;
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("zoho"));
	setWidth(350);
	setHeight(300);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setPadding(3);

	VLayout content = new VLayout();
	content.setTop(10);
	content.setWidth100();
	content.setHeight100();
	content.setMembersMargin(3);

	tree = new ZohoTree(export);
	tree.setWidth100();
	tree.setHeight100();

	VLayout buttons = new VLayout();
	buttons.setWidth100();
	buttons.setHeight(30);

	Button select = new Button(I18N.message("select"));
	select.setAutoFit(true);
	select.setMargin(1);
	select.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			if (ZohoDialog.this.export)
				onExport();
			else
				onImport();
		}
	});

	buttons.setMembers(select);

	content.setMembers(tree, buttons);
	addItem(content);
}
 
Example 9
Source File: DropboxDialog.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public DropboxDialog(boolean export) {
	super();
	this.export = export;
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("dropbox"));
	setWidth(350);
	setHeight(300);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setPadding(3);

	VLayout content = new VLayout();
	content.setTop(10);
	content.setWidth100();
	content.setHeight100();
	content.setMembersMargin(3);

	tree = new DropboxTree(export);
	tree.setWidth100();
	tree.setHeight100();

	VLayout buttons = new VLayout();
	buttons.setWidth100();
	buttons.setHeight(30);

	Button select = new Button(I18N.message("select"));
	select.setAutoFit(true);
	select.setMargin(1);
	select.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			if (DropboxDialog.this.export)
				onExport();
			else
				onImport();
		}
	});

	buttons.setMembers(select);

	content.setMembers(tree, buttons);
	addItem(content);
}