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

The following examples show how to use com.smartgwt.client.widgets.Label#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: DesaExportAction.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
public ExportOptionsWidget() {
    i18n = GWT.create(ClientMessages.class);
    label = new Label();
    label.setMargin(5);
    label.setWidth100();
    label.setAutoHeight();
    label.setWrap(false);
    form = new DynamicForm();
    CheckboxItem hierarchy = new CheckboxItem(ExportResourceApi.DESA_HIERARCHY_PARAM,
            i18n.ExportOptionsWidget_Hierarchy_Title());
    hierarchy.setPrompt(i18n.ExportOptionsWidget_Hierarchy_Hint());
    form.setFields(hierarchy);
}
 
Example 2
Source File: StatusView.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private StatusView() {
    container = new HLayout();
    content = new Label();
    content.setIcon("[SKIN]/Dialog/say.png");
    content.setIconSize(20);
    content.setMargin(1);
    content.setPadding(1);

    content.setHeight(38);
    content.setValign(VerticalAlignment.CENTER);
    content.setAlign(Alignment.LEFT);
    content.setWrap(Boolean.FALSE);

    container.setMembers(content);
    container.setLeft(Page.getWidth() / 2 - 50);
    container.setTop(4);
    container.setLayoutLeftMargin(4);
    container.setLayoutRightMargin(4);
    container.setBorder("1px solid red");
    container.setBackgroundColor("white");
    container.setAutoHeight();
    container.setShowShadow(Boolean.TRUE);

    timer = new Timer() {

        @Override
        public void run() {
            container.animateHide(AnimationEffect.FADE);
        }
    };
}
 
Example 3
Source File: Cursor.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * ID of the message to be used to compose the email
 * 
 * @param maxDisplayedRecordsCookieName name of the cookies to save the max number of displayed records
 * @param enabledPagination if the pagination must be enabled
 * @param compactView if the compact vidualization must be used
 */
public Cursor(String maxDisplayedRecordsCookieName, boolean enabledPagination, boolean compactView) {
	setHeight(20);
	this.maxCookieName = maxDisplayedRecordsCookieName;

	label = new Label(" ");
	label.setWrap(false);
	label.setMargin(2);
	setAlign(Alignment.RIGHT);

	String mx = "100";
	if (maxDisplayedRecordsCookieName != null) {
		if (Offline.get(maxDisplayedRecordsCookieName) != null
				&& !Offline.get(maxDisplayedRecordsCookieName).equals(""))
			mx = (String) Offline.get(maxDisplayedRecordsCookieName);
	}

	maxItem = ItemFactory.newSpinnerItem("max", "display", Integer.parseInt(mx), 2, (Integer) null);
	maxItem.setValue(Integer.parseInt(mx));
	maxItem.setWidth(70);
	maxItem.setStep(20);
	maxItem.setSaveOnEnter(true);
	maxItem.setImplicitSave(true);
	maxItem.addChangedHandler(new ChangedHandler() {

		@Override
		public void onChanged(ChangedEvent event) {
			onMaxChange();
		}
	});
	if (compactView) {
		maxItem.setShowTitle(false);
	} else {
		maxItem.setHint(I18N.message("elements"));
	}

	addFormItem(maxItem);
	if (enabledPagination) {
		pageItem = ItemFactory.newSpinnerItem("page", "page", 1, 1, 1);
		pageItem.setHint("");
		pageItem.setSaveOnEnter(true);
		pageItem.setImplicitSave(true);

		addSeparator();
		addFormItem(pageItem);
	}
	addFill();
	addMember(label);
}
 
Example 4
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 5
Source File: ImportSourceChooser.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public ImportSourceChooser(ClientMessages i18n) {
    this.i18n = i18n;
    VLayout layout = this;
    setWidth100();
    setHeight100();
    VLayout innerLayout = new VLayout();
    innerLayout.setLayoutMargin(4);

    lblCurrSelection = new Label(i18n.ImportSourceChooser_NothingSelected_Title());
    lblCurrSelection.setWidth100();
    lblCurrSelection.setAutoFit(true);
    lblCurrSelection.setMargin(4);
    lblCurrSelection.setCanSelectText(true);

    treeGrid = new TreeGrid();
    treeGrid.setHeight100();
    treeGrid.setDataSource(dataSource);
    TreeGridField stateField = new TreeGridField(
            ImportTreeDataSource.FIELD_STATE,
            i18n.ImportSourceChooser_TreeHeaderImportState_Title());
    stateField.setWidth(100);
    treeGrid.setFields(
            new TreeGridField(ImportTreeDataSource.FIELD_NAME, i18n.ImportSourceChooser_TreeHeaderFolderName_Title()),
            stateField);
    treeGrid.setShowConnectors(true);
    treeGrid.setEmptyMessage(i18n.ImportSourceChooser_NoDataOnServer_Title());
    treeGrid.setAlternateRecordStyles(true);
    treeGrid.setSelectionType(SelectionStyle.SINGLE);
    ListGridPersistance treeGridPersistence = new ListGridPersistance("ImportSourceChooser.directoryList", treeGrid);
    treeGrid.setViewState(treeGridPersistence.getViewState());

    treeGrid.addFolderClickHandler(new FolderClickHandler() {

        @Override
        public void onFolderClick(FolderClickEvent event) {
            updateOnSelection();
            // issue 41: open node on single click
            TreeNode folder = event.getFolder();
            event.getViewer().getTree().openFolder(folder);
        }
    });

    ToolStrip toolbar = createToolbar();

    optionsForm = createOptionsForm();

    innerLayout.setMembers(optionsForm, lblCurrSelection, treeGrid);
    layout.setMembers(toolbar, innerLayout);
}