Java 类com.google.gwt.dom.client.Style.TextAlign 实例源码

项目:gwt-generators    文件:ColumnAlignmentContext.java   
private void setHorizontalAlignment(TextAlign align)
{
   horizontalAlignment = HasHorizontalAlignment.class.getName();
   switch (align)
   {
      case CENTER:
         horizontalAlignment += ".ALIGN_CENTER";
         break;
      case JUSTIFY:
         horizontalAlignment += ".ALIGN_JUSTIFY";
         break;
      case LEFT:
         horizontalAlignment += ".ALIGN_LEFT";
         break;
      case RIGHT:
         horizontalAlignment += ".ALIGN_RIGHT";
         break;
   }
}
项目:Cubee    文件:FAIcon.java   
public FAIcon(EIcon icon) {
    if (icon == null) {
        throw new NullPointerException("The icon parameter can not be null.");
    }

    this.widthProperty().bind(size);
    this.heightProperty().bind(size);
    this.getElement().getStyle().setTextAlign(TextAlign.CENTER);
    this.icon.set(icon);

    iElement = DOM.createElement("i");
    this.getElement().appendChild(iElement);

    size.addChangeListener(changeListener);
    foreColor.addChangeListener(changeListener);
    spin.addChangeListener(changeListener);
    this.icon.addChangeListener(changeListener);

    refreshStyle();
}
项目:unitimes    文件:NumberBox.java   
public NumberBox() {
    setStyleName("gwt-SuggestBox");
    setWidth("100px");
    getElement().getStyle().setTextAlign(TextAlign.RIGHT);
    addKeyPressHandler(new KeyPressHandler() {
        @Override
        public void onKeyPress(KeyPressEvent event) {
            if (!isEnabled() || isReadOnly()) return;

            int keyCode = event.getNativeEvent().getKeyCode();

            switch (keyCode) {
            case KeyCodes.KEY_BACKSPACE:
            case KeyCodes.KEY_DELETE:
            case KeyCodes.KEY_ESCAPE:
            case KeyCodes.KEY_RIGHT:
            case KeyCodes.KEY_LEFT:
            case KeyCodes.KEY_TAB:
                return;
            }

            if (isDecimal() && event.getCharCode() == '.' && !getValue().contains(".")) return;
            if (isNegative() && event.getCharCode() == '-' && !getValue().contains("-") && (getCursorPos() == 0 || getSelectionLength() == getValue().length()))
                return;

            if (Character.isDigit(event.getCharCode()))
                return;

            cancelKey( );
        }
    } );
}
项目:unitime    文件:NumberBox.java   
public NumberBox() {
    setStyleName("gwt-SuggestBox");
    setWidth("100px");
    getElement().getStyle().setTextAlign(TextAlign.RIGHT);
    addKeyPressHandler(new KeyPressHandler() {
        @Override
        public void onKeyPress(KeyPressEvent event) {
            if (!isEnabled() || isReadOnly()) return;

            int keyCode = event.getNativeEvent().getKeyCode();

            switch (keyCode) {
            case KeyCodes.KEY_BACKSPACE:
            case KeyCodes.KEY_DELETE:
            case KeyCodes.KEY_ESCAPE:
            case KeyCodes.KEY_RIGHT:
            case KeyCodes.KEY_LEFT:
            case KeyCodes.KEY_TAB:
                return;
            }

            if (isDecimal() && event.getCharCode() == '.' && !getValue().contains(".")) return;
            if (isNegative() && event.getCharCode() == '-' && !getValue().contains("-") && (getCursorPos() == 0 || getSelectionLength() == getValue().length()))
                return;

            if (Character.isDigit(event.getCharCode()))
                return;

            cancelKey( );
        }
    } );
}
项目:platypus-js    文件:TimePicker.java   
private void setSeparatorStyle(Widget separator, boolean invisible) {
    separator.getElement().getStyle().setDisplay(Display.INLINE_BLOCK);
    separator.getElement().getStyle().setWidth(separatorWidth, Style.Unit.PCT);
    separator.getElement().getStyle().setTextAlign(TextAlign.CENTER);
    separator.getElement().setInnerText(":");
    separator.setStyleName("time-picker-separator");
    if (invisible) {
        separator.getElement().getStyle().setVisibility(Visibility.HIDDEN);
    }
}
项目:platypus-js    文件:TimePicker.java   
private void setSeparatorStyleRelative(Widget separator, boolean invisible) {
    separator.getElement().getStyle().setDisplay(Display.INLINE_BLOCK);
    separator.getElement().getStyle().setWidth(separatorWidthRelative, Style.Unit.PX);
    separator.getElement().getStyle().setTextAlign(TextAlign.CENTER);
    separator.getElement().setInnerText(":");
    separator.setStyleName("time-picker-separator");
    if (invisible) {
        separator.getElement().getStyle().setVisibility(Visibility.HIDDEN);
    }
}
项目:platypus-js    文件:TimePicker.java   
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);
}
项目:platypus-js    文件:TimePicker.java   
public void setRelative() {
    timePickerContainer.getElement().getStyle().setPosition(Position.RELATIVE);
    timePickerContainer.getElement().getStyle().setHeight(0, Style.Unit.PX);
    timePickerContainer.getElement().getStyle().setBottom(0, Style.Unit.PCT);
    timePickerContainer.getElement().getStyle().setOverflow(Overflow.HIDDEN);

    setStyleName(timePickerContainer.getElement(), "time-picker");
    timePickerContainer.getElement().getStyle().setWidth(relativeWidth, Style.Unit.PX);

    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.NONE);

    txtHour.getElement().getStyle().setWidth(componentWidthRelative, Style.Unit.PX);
    txtHour.getElement().getStyle().setMarginLeft(marginLeft, Style.Unit.PX);
    txtHour.getElement().getStyle().setTextAlign(TextAlign.CENTER);
    txtHour.setStyleName("time-picker-text");
    txtMinute.getElement().getStyle().setWidth(componentWidthRelative, Style.Unit.PX);
    txtMinute.getElement().getStyle().setTextAlign(TextAlign.CENTER);
    txtMinute.setStyleName("time-picker-text");
    txtSecond.getElement().getStyle().setTextAlign(TextAlign.CENTER);
    txtSecond.getElement().getStyle().setWidth(componentWidthRelative, Style.Unit.PX);
    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");

    setButtonStyleRelative(btnUpHour, "time-picker-up");
    btnUpHour.getElement().getStyle().setMarginLeft(marginLeft, Style.Unit.PX);
    setButtonStyleRelative(btnUpMinute, "time-picker-up");
    setButtonStyleRelative(btnUpSecond, "time-picker-up");
    btnUpSecond.getElement().getStyle().setMarginRight(marginRight, Style.Unit.PX);

    setButtonStyleRelative(btnDownHour, "time-picker-down");
    btnDownHour.getElement().getStyle().setMarginLeft(marginLeft, Style.Unit.PX);
    setButtonStyleRelative(btnDownMinute, "time-picker-down");
    setButtonStyleRelative(btnDownSecond, "time-picker-down");
    btnDownSecond.getElement().getStyle().setMarginRight(marginRight, Style.Unit.PX);

    setSeparatorStyleRelative(separatorUp1, true);
    setSeparatorStyleRelative(separatorUp2, true);
    setSeparatorStyleRelative(separatorTime1, false);
    setSeparatorStyleRelative(separatorTime2, false);
    setSeparatorStyleRelative(separatorDown1, true);
    setSeparatorStyleRelative(separatorDown2, true);
    setHeight(100, Style.Unit.PCT);
}
项目:geomajas-project-client-gwt2    文件:FeatureInfoControlViewImpl.java   
public FeatureInfoControlViewImpl() {
    UI_BINDER.createAndBindUi(this);

    button.getElement().getStyle().setWidth(25, Unit.PX);
    button.getElement().getStyle().setTextAlign(TextAlign.CENTER);
}