Java Examples for com.google.gwt.dom.client.Style.TextAlign
The following java examples will help you to understand the usage of com.google.gwt.dom.client.Style.TextAlign. These source code samples are taken from different open source projects.
Example 1
| Project: gwt.create2015-master File: AsyncContactProvider.java View source code |
private void installLoadingIndicator() {
Style style = loadingStatus.getElement().getStyle();
style.setFontSize(2, Unit.EM);
style.setFontWeight(FontWeight.BOLD);
style.setBackgroundColor("yellow");
style.setTextAlign(TextAlign.CENTER);
RootLayoutPanel.get().add(loadingStatus);
RootLayoutPanel.get().setWidgetTopHeight(loadingStatus, 0, Unit.PX, 3, Unit.EM);
}Example 2
| Project: framework-master File: VScrollTable.java View source code |
/**
* Set alignment of the text in the cell
*
* @param c
* The alignment which can be ALIGN_CENTER, ALIGN_LEFT,
* ALIGN_RIGHT
*/
public void setAlign(char c) {
if (align != c) {
switch(c) {
case ALIGN_CENTER:
captionContainer.getStyle().setTextAlign(TextAlign.CENTER);
break;
case ALIGN_RIGHT:
captionContainer.getStyle().setTextAlign(TextAlign.RIGHT);
break;
default:
captionContainer.getStyle().setTextAlign(TextAlign.LEFT);
break;
}
}
align = c;
}Example 3
| Project: che-master File: ResolveViewImpl.java View source code |
@Override
public void addConflictingFile(String filePath) {
Label filePathLabel = new Label(filePath);
filePathLabel.getElement().getStyle().setFloat(Float.LEFT);
filePathLabel.getElement().getStyle().setMarginRight(1, Unit.EM);
ListBox conflictResolutionActions = new ListBox();
for (ConflictResolutionAction action : conflictActions) {
conflictResolutionActions.addItem(action.getText());
}
filesResolutionActions.put(filePath, conflictResolutionActions);
Element resolutionDiv = DOM.createDiv();
resolutionDiv.getStyle().setMarginLeft(1, Unit.EM);
resolutionDiv.getStyle().setMarginRight(1, Unit.EM);
resolutionDiv.getStyle().setMarginBottom(1, Unit.EM);
resolutionDiv.getStyle().setTextAlign(TextAlign.RIGHT);
resolutionDiv.appendChild(filePathLabel.getElement());
resolutionDiv.appendChild(conflictResolutionActions.getElement());
mainPanel.getElement().appendChild(resolutionDiv);
}Example 4
| Project: ovirt-engine-master File: NetworkOutOfSyncPanel.java View source code |
public Widget outOfSyncTableAsWidget() {
addTableFirstRow();
for (ReportedConfiguration reportedConfiguration : reportedConfigurationList) {
List<Label> values = reportedConfigurationAsList(reportedConfiguration);
TextAlign textAlign = resolveAlignment(reportedConfiguration.getType());
addOutOfSyncRow(values, textAlign);
}
return flowPanel.asWidget();
}Example 5
| Project: map4rdf-master File: RoutesView.java View source code |
private void addGeoResourceInRow(GeoResource resource, Geometry geometry, int row) {
GeoResourceGeometry geoResourceGeometry = new GeoResourceGeometry(resource, geometry);
if (rows == 1 && row == 0) {
GeoResourceGeometry temp = route.get(0);
route.clear();
route.add(geoResourceGeometry);
route.add(temp);
} else {
route.add(geoResourceGeometry);
}
String label = LocaleUtil.getBestLabel(resource);
FlowPanel anchorContainer = new FlowPanel();
Anchor anchor = new Anchor(label, resource.getUri());
anchor.setTarget("_blank");
anchorContainer.add(anchor);
anchorContainer.setSize("170px", "100%");
anchorContainer.getElement().getStyle().setProperty("wordWrap", "break-word");
anchorContainer.getElement().getStyle().setTextAlign(TextAlign.CENTER);
anchor.getElement().getStyle().setTextAlign(TextAlign.CENTER);
char leter = DrawPointStyle.getMinLeter();
if (row < DrawPointStyle.getLeterSize()) {
leter = (char) (DrawPointStyle.getMinLeter() + row);
} else {
leter = DrawPointStyle.getMaxLeter();
}
DrawPointStyle style = new DrawPointStyle(leter);
List<GeoResource> list = new ArrayList<GeoResource>();
GeoResource centroidResource = new GeoResource(resource.getUri(), GeoUtils.getCentroid(geometry));
list.add(centroidResource);
list.add(resource);
mapPresenter.drawGeoResources(list, style);
routesWidget.setWidget(row, 0, new Image(GWT.getModuleBaseURL() + style.getImageURL()));
routesWidget.setWidget(row, 1, anchorContainer);
routesWidget.getCellFormater().setWidth(row, 1, "100%");
routesWidget.getCellFormater().setHeight(row, 1, "100%");
Button button = new Button();
button.setSize("32px", "28px");
button.getElement().appendChild(new Image(browserResources.eraserIcon()).getElement());
button.getElement().getStyle().setLeft(0, Unit.PX);
routesWidget.setWidget(row, 2, button);
ClickHandler handler = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
removePoint(this);
}
};
button.addClickHandler(handler);
relationHandler.put(handler, new PanelWithGeoResourceGeometry(geoResourceGeometry, row));
}Example 6
| Project: gwt.svn-master File: HorizontalSplitPanel.java View source code |
@Override
public void init(HorizontalSplitPanel panel) {
this.panel = panel;
final Element elem = panel.getElement();
// right-alignment is the default with RTL directionality.
if (LocaleInfo.getCurrentLocale().isRTL()) {
elem.getStyle().setTextAlign(TextAlign.RIGHT);
} else {
elem.getStyle().setTextAlign(TextAlign.LEFT);
}
DOM.setStyleAttribute(elem, "position", "relative");
/*
* Technically, these are snapped to the top and bottom, but IE doesn't
* provide a reliable way to make that happen, so a resize listener is
* wired up to control the height of these elements.
*/
addAbsolutePositoning(panel.getElement(LEFT));
addAbsolutePositoning(panel.getElement(RIGHT));
addAbsolutePositoning(panel.getSplitElement());
expandToFitParentUsingPercentages(panel.container);
if (LocaleInfo.getCurrentLocale().isRTL()) {
// Snap the left pane to the left edge of the container. We
// only need to do this when layout is RTL; if we don't, the
// left pane will overlap the right pane.
setLeft(panel.getElement(LEFT), "0px");
}
}Example 7
| Project: geogebra-master File: InputBarHelpPanelW.java View source code |
private void createGUI() {
// create syntax panel
syntaxPanel = new VerticalPanel();
// button panel
FlowPanel pnlButton = new FlowPanel();
// create help button if not in exam mode
btnOnlineHelp = new Button(app.getLocalization().getMenu("ShowOnlineHelp"));
btnOnlineHelp.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
openOnlineHelp();
}
});
render(app.getNetworkOperation().isOnline());
app.getNetworkOperation().getView().add(this);
btnOnlineHelp.addStyleName("inputHelp-OnlineHelpBtn");
pnlButton.add(btnOnlineHelp);
pnlButton.getElement().getStyle().setFloat(Style.Float.RIGHT);
// create close button
btnClose = new Button(app.getLocalization().getMenu("Close"));
btnClose.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
hide();
}
});
btnClose.setStyleName("inputHelp-CancelBtn");
pnlButton.add(btnClose);
// create detail title panel
lblSyntax = new InlineLabel();
lblSyntax.getElement().getStyle().setTextAlign(TextAlign.LEFT);
HorizontalPanel detailTitlePanel = new HorizontalPanel();
detailTitlePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
detailTitlePanel.add(lblSyntax);
detailTitlePanel.add(pnlButton);
detailTitlePanel.addStyleName("inputHelp-detailPanelTitle");
add(detailTitlePanel);
// create the detail panel
VerticalPanel detailPanel = new VerticalPanel();
detailPanel.add(syntaxPanel);
detailPanel.setWidth("100%");
// create the index tree and put it in a scroll panel
indexTree = new Tree() {
@Override
public void setSelectedItem(TreeItem item, boolean fireEvents) {
if (item == null) {
super.setSelectedItem(null, fireEvents);
return;
}
onSelectionNative(item, fireEvents);
}
private native void onSelectionNative(TreeItem item, boolean fireEvents);
};
indexTree.addStyleName("inputHelp-tree");
indexTree.setAnimationEnabled(true);
// show only mathematical functions for exam simple calculator
if (app.getArticleElement().hasDataParamEnableGraphing() && !app.getArticleElement().getDataParamEnableGraphing(true)) {
detailScroller = new ScrollPanel(detailPanel);
detailScroller.setStyleName("AVHelpDetailScroller");
add(detailScroller);
} else {
ScrollPanel treeScroller = new ScrollPanel(indexTree);
treeScroller.setSize("100%", "100%");
// put the detail panel and index tree side by side in a
// SplitLayoutPanel
sp = new SplitLayoutPanel();
sp.addStyleName("ggbdockpanelhack");
sp.addEast(treeScroller, 280);
sp.add(new ScrollPanel(detailPanel));
// now add the split panel to our main panel
add(sp);
}
}Example 8
| Project: platypus-master File: TimePicker.java View source code |
public void setAbsolute() {
timePickerContainer.getElement().getStyle().setPosition(Position.ABSOLUTE);
timePickerContainer.getElement().getStyle().setHeight(0, Style.Unit.PX);
timePickerContainer.getElement().getStyle().setProperty("width", "auto");
timePickerContainer.getElement().getStyle().setBottom(0, Style.Unit.PCT);
timePickerContainer.getElement().getStyle().setOverflow(Overflow.HIDDEN);
setStyleName(timePickerContainer.getElement(), "time-picker");
verticalAlign.getElement().getStyle().setHeight(100, Style.Unit.PCT);
verticalAlign.getElement().getStyle().setWidth(0, Style.Unit.PCT);
widgetContainer.getElement().getStyle().setDisplay(Display.INLINE_BLOCK);
verticalAlign.getElement().getStyle().setDisplay(Display.INLINE_BLOCK);
dateBlock.getElement().getStyle().setDisplay(Display.BLOCK);
dateBlock.getElement().getStyle().setTextAlign(TextAlign.CENTER);
dateBlock.getElement().getStyle().setMarginBottom(10, Style.Unit.PCT);
txtHour.getElement().getStyle().setWidth(componentWidth, Style.Unit.PCT);
txtHour.getElement().getStyle().setMarginLeft(marginLeft, Style.Unit.PX);
txtHour.getElement().getStyle().setTextAlign(TextAlign.CENTER);
txtHour.setStyleName("time-picker-text");
txtMinute.getElement().getStyle().setWidth(componentWidth, Style.Unit.PCT);
txtMinute.getElement().getStyle().setTextAlign(TextAlign.CENTER);
txtMinute.setStyleName("time-picker-text");
txtSecond.getElement().getStyle().setTextAlign(TextAlign.CENTER);
txtSecond.getElement().getStyle().setWidth(componentWidth, Style.Unit.PCT);
txtSecond.setStyleName("time-picker-text");
txtSecond.getElement().getStyle().setMarginRight(marginRight, Style.Unit.PX);
widgetContainer.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
verticalAlign.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
hCenter.getElement().getStyle().setHeight(100, Style.Unit.PCT);
hCenter.getElement().getStyle().setDisplay(Display.BLOCK);
hCenter.getElement().getStyle().setProperty("marginLeft", "auto");
hCenter.getElement().getStyle().setProperty("marginRight", "auto");
setButtonStyleAbsolute(btnUpHour, "time-picker-up");
btnUpHour.getElement().getStyle().setMarginLeft(marginLeft, Style.Unit.PX);
setButtonStyleAbsolute(btnUpMinute, "time-picker-up");
setButtonStyleAbsolute(btnUpSecond, "time-picker-up");
btnUpSecond.getElement().getStyle().setMarginRight(marginRight, Style.Unit.PX);
setButtonStyleAbsolute(btnDownHour, "time-picker-down");
btnDownHour.getElement().getStyle().setMarginLeft(marginLeft, Style.Unit.PX);
setButtonStyleAbsolute(btnDownMinute, "time-picker-down");
setButtonStyleAbsolute(btnDownSecond, "time-picker-down");
btnDownSecond.getElement().getStyle().setMarginRight(marginRight, Style.Unit.PX);
setSeparatorStyle(separatorUp1, true);
setSeparatorStyle(separatorUp2, true);
setSeparatorStyle(separatorTime1, false);
setSeparatorStyle(separatorTime2, false);
setSeparatorStyle(separatorDown1, true);
setSeparatorStyle(separatorDown2, true);
}Example 9
| Project: spreadsheet-master File: FormulaBarWidget.java View source code |
@Override
public void onBrowserEvent(Event event) {
final int type = event.getTypeInt();
if (type == Event.ONKEYUP) {
final int keyCode = event.getKeyCode();
if (keyCode == KeyCodes.KEY_ENTER) {
// submit address value
handler.onAddressEntered(addressField.getValue().replaceAll(" ", ""));
addressField.setFocus(false);
} else if (keyCode == KeyCodes.KEY_ESCAPE) {
revertCellAddressValue();
handler.onAddressFieldEsc();
}
} else if (type == Event.ONFOCUS) {
handler.setSheetFocused(true);
addressField.getElement().getStyle().setTextAlign(TextAlign.LEFT);
} else {
handler.setSheetFocused(false);
addressField.getElement().getStyle().clearTextAlign();
}
}Example 10
| Project: vaadin-master File: VScrollTable.java View source code |
/**
* Set alignment of the text in the cell
*
* @param c
* The alignment which can be ALIGN_CENTER, ALIGN_LEFT,
* ALIGN_RIGHT
*/
public void setAlign(char c) {
if (align != c) {
switch(c) {
case ALIGN_CENTER:
captionContainer.getStyle().setTextAlign(TextAlign.CENTER);
break;
case ALIGN_RIGHT:
captionContainer.getStyle().setTextAlign(TextAlign.RIGHT);
break;
default:
captionContainer.getStyle().setTextAlign(TextAlign.LEFT);
break;
}
}
align = c;
}Example 11
| Project: DevTools-master File: ResolveViewImpl.java View source code |
@Override
public void addConflictingFile(String filePath) {
Label filePathLabel = new Label(filePath);
filePathLabel.getElement().getStyle().setFloat(Float.LEFT);
filePathLabel.getElement().getStyle().setMarginRight(1, Unit.EM);
ListBox conflictResolutionActions = new ListBox();
for (ConflictResolutionAction action : conflictActions) {
conflictResolutionActions.addItem(action.getText());
}
filesResolutionActions.put(filePath, conflictResolutionActions);
Element resolutionDiv = DOM.createDiv();
resolutionDiv.getStyle().setMarginLeft(1, Unit.EM);
resolutionDiv.getStyle().setMarginRight(1, Unit.EM);
resolutionDiv.getStyle().setMarginBottom(1, Unit.EM);
resolutionDiv.getStyle().setTextAlign(TextAlign.RIGHT);
resolutionDiv.appendChild(filePathLabel.getElement());
resolutionDiv.appendChild(conflictResolutionActions.getElement());
mainPanel.getElement().appendChild(resolutionDiv);
}Example 12
| Project: gwt-sandbox-master File: HorizontalSplitPanel.java View source code |
@Override
public void init(HorizontalSplitPanel panel) {
this.panel = panel;
final Element elem = panel.getElement();
// right-alignment is the default with RTL directionality.
if (LocaleInfo.getCurrentLocale().isRTL()) {
elem.getStyle().setTextAlign(TextAlign.RIGHT);
} else {
elem.getStyle().setTextAlign(TextAlign.LEFT);
}
DOM.setStyleAttribute(elem, "position", "relative");
/*
* Technically, these are snapped to the top and bottom, but IE doesn't
* provide a reliable way to make that happen, so a resize listener is
* wired up to control the height of these elements.
*/
addAbsolutePositoning(panel.getElement(LEFT));
addAbsolutePositoning(panel.getElement(RIGHT));
addAbsolutePositoning(panel.getSplitElement());
expandToFitParentUsingPercentages(panel.container);
if (LocaleInfo.getCurrentLocale().isRTL()) {
// Snap the left pane to the left edge of the container. We
// only need to do this when layout is RTL; if we don't, the
// left pane will overlap the right pane.
setLeft(panel.getElement(LEFT), "0px");
}
}Example 13
| Project: gwt-master File: HorizontalSplitPanel.java View source code |
@Override
public void init(HorizontalSplitPanel panel) {
this.panel = panel;
final Element elem = panel.getElement();
// right-alignment is the default with RTL directionality.
if (LocaleInfo.getCurrentLocale().isRTL()) {
elem.getStyle().setTextAlign(TextAlign.RIGHT);
} else {
elem.getStyle().setTextAlign(TextAlign.LEFT);
}
elem.getStyle().setProperty("position", "relative");
/*
* Technically, these are snapped to the top and bottom, but IE doesn't
* provide a reliable way to make that happen, so a resize listener is
* wired up to control the height of these elements.
*/
addAbsolutePositoning(panel.getElement(LEFT));
addAbsolutePositoning(panel.getElement(RIGHT));
addAbsolutePositoning(panel.getSplitElement());
expandToFitParentUsingPercentages(panel.container);
if (LocaleInfo.getCurrentLocale().isRTL()) {
// Snap the left pane to the left edge of the container. We
// only need to do this when layout is RTL; if we don't, the
// left pane will overlap the right pane.
setLeft(panel.getElement(LEFT), "0px");
}
}Example 14
| Project: gwtcc-master File: HtmlStylesBuilder.java View source code |
@Override
public StylesBuilder textAlign(TextAlign value) {
return delegate.styleProperty(SafeStylesUtils.forTextAlign(value));
}