List of usage examples for com.google.gwt.user.client.ui HasHorizontalAlignment ALIGN_DEFAULT
HorizontalAlignmentConstant ALIGN_DEFAULT
To view the source code for com.google.gwt.user.client.ui HasHorizontalAlignment ALIGN_DEFAULT.
Click Source Link
From source file:ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.InfoBox.java
License:Apache License
/** * Default constructor with {@link HasHorizontalAlignment#ALIGN_CENTER}. */ public InfoBox() { this(HasHorizontalAlignment.ALIGN_DEFAULT); }
From source file:n3phele.client.view.LoginView.java
License:Open Source License
public LoginView(String homeUrl) { this.homeUrl = homeUrl; if (altMethod) { form = FormPanel.wrap(Document.get().getElementById(LOGINFORM_ID), true); form.addSubmitHandler(new SubmitHandler() { @Override//www. j a v a2 s .c o m public void onSubmit(SubmitEvent event) { setMessage("checking your identity and credentials."); N3phele.authenticate(getUsername(), getPassword(), LoginView.this); } }); } else { // // Get a handle to the form and set its action to our jsni method // form = FormPanel.wrap(Document.get().getElementById(LOGINFORM_ID), false); // form.setAction("javascript:__gwt_login()"); // // // Get the submit button for text localization // @SuppressWarnings("unused") // ButtonElement submit = (ButtonElement) Document.get().getElementById(LOGINBUTTON_ID); // // // Now, inject the jsni method for handling the form submit // injectLoginFunction(this); } this.decoratorPanel = new DecoratorPanel(); VerticalPanel v = new VerticalPanel(); this.decoratorPanel.add(v); Button register = new Button("<u>register</u>", new ClickHandler() { @Override public void onClick(ClickEvent event) { new NewUserView(LoginView.this.homeUrl + "user").show(); } }); Button forgot = new Button("<u>forgot password</u>", new ClickHandler() { @Override public void onClick(ClickEvent event) { new ForgotPasswordView(LoginView.this.homeUrl + "user/reset").show(); } }); HTML h = new HTML(); h.setHTML( "<h1 style=\"text-indent:10px\">n3phele login</h1><p style=\"border-style:solid;border-width:1px;border-color:#4f81bd\"></p>"); v.add(h); errmsg = new HTML(); errmsg.setHeight("100px"); errmsg.setWordWrap(true); errmsg.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); v.add(errmsg); register.setStyleName(N3phele.n3pheleResource.css().registerButton()); forgot.setStyleName(N3phele.n3pheleResource.css().registerButton()); v.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_DEFAULT); v.add(form); v.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); v.add(register); v.add(forgot); initWidget(this.decoratorPanel); }
From source file:org.glom.web.client.ui.details.DetailsCell.java
License:Open Source License
private void setupWidgets(LayoutItemWithFormatting layoutItem) { // Labels (text in div element) are being used so that the height of the details-data element can be set for // the multiline height of LayoutItemFields. This allows the the data element to display the correct height // if style is applied that shows the height. This has the added benefit of allowing the order of the label and // data elements to be changed for right-to-left languages. String title = layoutItem.getTitle(); if (!StringUtils.isEmpty(title)) { title += ":"; }/*w ww . j a v a2 s. c o m*/ final Label detailsLabel = new Label(title); //TODO: Rename to titleLabel? detailsLabel.setStyleName("details-label"); detailsData.setStyleName("details-data"); Formatting formatting = layoutItem.getFormatting(); if (formatting == null) { GWT.log("setData(): formatting is null"); formatting = new Formatting(); // To avoid checks later. } // set the alignment switch (formatting.getHorizontalAlignment()) { case HORIZONTAL_ALIGNMENT_LEFT: detailsLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); break; case HORIZONTAL_ALIGNMENT_RIGHT: detailsLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); break; case HORIZONTAL_ALIGNMENT_AUTO: default: detailsLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_DEFAULT); break; } // set the text foreground and background colors final String foregroundColor = formatting.getTextFormatColorForegroundAsHTMLColor(); if (!StringUtils.isEmpty(foregroundColor)) { detailsData.getElement().getStyle().setColor(foregroundColor); } final String backgroundColor = formatting.getTextFormatColorBackgroundAsHTMLColor(); if (!StringUtils.isEmpty(backgroundColor)) { detailsData.getElement().getStyle().setBackgroundColor(backgroundColor); } mainPanel.setStyleName("details-cell"); mainPanel.add(detailsLabel); mainPanel.add(detailsData); }
From source file:org.glom.web.client.ui.list.ListTable.java
License:Open Source License
private void addColumn(final LayoutItemField layoutItemField) { // Setup the default alignment of the column. HorizontalAlignmentConstant columnAlignment; Formatting formatting = layoutItemField.getFormatting(); if (formatting == null) { GWT.log("addColumn(): Formatting is null for field=" + layoutItemField.getLayoutDisplayName()); formatting = new Formatting(); // Just to avoid null dereferencing later. }// ww w . j a v a 2 s. co m switch (formatting.getHorizontalAlignment()) { case HORIZONTAL_ALIGNMENT_LEFT: columnAlignment = HasHorizontalAlignment.ALIGN_LEFT; break; case HORIZONTAL_ALIGNMENT_RIGHT: columnAlignment = HasHorizontalAlignment.ALIGN_RIGHT; break; case HORIZONTAL_ALIGNMENT_AUTO: default: columnAlignment = HasHorizontalAlignment.ALIGN_DEFAULT; break; } // create a new column Column<DataItem[], ?> column = null; final int j = cellTable.getColumnCount(); switch (layoutItemField.getGlomType()) { case TYPE_BOOLEAN: column = new Column<DataItem[], Boolean>(new BooleanCell()) { @Override public Boolean getValue(final DataItem[] row) { if (row.length == 1 && row[0] == null) { // an empty row return null; } if (j >= row.length) { GWT.log("addColumn(): j=" + j + " is out of range. length=" + row.length); return null; } else { return row[j].getBoolean(); } } }; // override the configured horizontal alignment columnAlignment = HasHorizontalAlignment.ALIGN_CENTER; break; case TYPE_NUMERIC: // create a GWT NumberFormat for the column final NumericFormat numericFormat = formatting.getNumericFormat(); final NumberFormat gwtNumberFormat = Utils.getNumberFormat(numericFormat); // create the actual column column = new Column<DataItem[], Double>(new NumericCell( formatting.getTextFormatColorForegroundAsHTMLColor(), formatting.getTextFormatColorBackgroundAsHTMLColor(), gwtNumberFormat, numericFormat.getUseAltForegroundColorForNegatives(), numericFormat.getCurrencySymbol())) { @Override public Double getValue(final DataItem[] row) { if (row.length == 1 && row[0] == null) { // an empty row return null; } if (j >= row.length) { GWT.log("addColumn(): j=" + j + " is out of range. length=" + row.length); return null; } else { return row[j].getNumber(); } } }; break; case TYPE_IMAGE: column = new Column<DataItem[], String>(new ImageCell()) { @Override public String getValue(final DataItem[] row) { if (row.length == 1 && row[0] == null) { // an empty row return null; } if (j >= row.length) { GWT.log("addColumn(): j=" + j + " is out of range. length=" + row.length); return null; } else { return row[j].getImageDataUrl(); } } }; // override the configured horizontal alignment columnAlignment = HasHorizontalAlignment.ALIGN_CENTER; break; default: // use a text rendering cell for types we don't know about but log an error // TODO log error here case TYPE_DATE: case TYPE_INVALID: case TYPE_TIME: case TYPE_TEXT: column = new Column<DataItem[], String>( new TextCell(formatting.getTextFormatColorForegroundAsHTMLColor(), formatting.getTextFormatColorBackgroundAsHTMLColor())) { @Override public String getValue(final DataItem[] row) { if (row.length == 1 && row[0] == null) { // an empty row return null; } if (j >= row.length) { GWT.log("addColumn(): j=" + j + " is out of range. length=" + row.length); return null; } else { return row[j].getText(); } } }; break; } // set column properties and add to cell cellTable column.setHorizontalAlignment(columnAlignment); column.setSortable(true); cellTable.addColumn(column, new SafeHtmlHeader(SafeHtmlUtils.fromString(layoutItemField.getTitle()))); }
From source file:org.jbpm.formbuilder.client.effect.HorizontalAlignmentFormEffect.java
License:Apache License
@Override public void remove(FBFormItem item) { super.remove(item); Widget widget = getWidget();/*from w ww. j av a2 s . c o m*/ if (widget instanceof HasHorizontalAlignment) { HasHorizontalAlignment hw = (HasHorizontalAlignment) widget; hw.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_DEFAULT); } }