Example usage for com.google.gwt.user.client.ui TextBoxBase ALIGN_RIGHT

List of usage examples for com.google.gwt.user.client.ui TextBoxBase ALIGN_RIGHT

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui TextBoxBase ALIGN_RIGHT.

Prototype

TextAlignConstant ALIGN_RIGHT

To view the source code for com.google.gwt.user.client.ui TextBoxBase ALIGN_RIGHT.

Click Source Link

Document

Align the text to the right.

Usage

From source file:com.levigo.jadice.web.client.components.WebtoolkitStatusBar.java

License:Open Source License

public WebtoolkitStatusBar(Webtoolkit w) {
    this.webtoolkit = w;
    setStyleName("Jadice-StatusBar");

    ToolbarIcons img = (ToolbarIcons) GWT.create(ToolbarIcons.class);
    // annotations = new Label("");
    statusText = new Label("");
    totalPages = new Label("");

    add(new Label("Zoom: "));
    currentZoom = new TextBox();
    currentZoom.setStyleName("Jadice-StatusBar-currentZoom");
    currentZoom.setTextAlignment(TextBoxBase.ALIGN_RIGHT);
    currentZoom.setWidth("30pt");
    currentZoom.addChangeHandler(new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            try {
                webtoolkit.setZoom(Integer.parseInt(currentZoom.getText()));
            } catch (NumberFormatException e) {
                // ignore
            }/*  ww w .  ja v  a 2 s . com*/
        }
    });
    currentZoom.addKeyPressHandler(ON_ENTER_BLUR);
    add(currentZoom);
    add(new Label("%"));

    add(new Image(img.separatorVertical()));

    add(new Label("Seite: "));
    currentPage = new TextBox();
    currentPage.setText("-");
    currentPage.setStyleName("Jadice-StatusBar-currentPage");
    currentPage.setTextAlignment(TextBox.ALIGN_RIGHT);
    currentPage.setWidth("30pt");
    currentPage.addChangeHandler(new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            try {
                webtoolkit.setPageIndex(Integer.parseInt(currentPage.getText()) - 1);
            } catch (NumberFormatException e) {
                // ignore
            }
        }
    });
    currentPage.addKeyPressHandler(ON_ENTER_BLUR);
    add(currentPage);

    add(new Label("von"));
    add(totalPages);
    // add(annotations);
    add(new Image(img.separatorVertical()));

    add(statusText);

    webtoolkit.addPropertyChangeListener(this);

    update();
}

From source file:com.qualogy.qafe.gwt.client.component.QPagingOptions.java

License:Apache License

/**
 * Create a box that holds the current page.
 *//*from w ww.  j  a  va2  s.c om*/
private void createCurPageBox() {
    // Setup the widget
    curPageBox.setWidth("3em");
    curPageBox.setText("1");
    curPageBox.setTextAlignment(TextBoxBase.ALIGN_RIGHT);

    // Disallow non-numeric pages
    KeyPressHandler handler = new KeyPressHandler() {
        public void onKeyPress(KeyPressEvent event) {
            char charCode = event.getCharCode();
            if (charCode == KeyCodes.KEY_ENTER) {
                QPagingOptions.this.table.gotoPage(getPagingBoxValue(), false);
            } else if (!Character.isDigit(charCode) && (charCode != KeyCodes.KEY_TAB)
                    && (charCode != KeyCodes.KEY_BACKSPACE) && (charCode != KeyCodes.KEY_DELETE)
                    && (charCode != KeyCodes.KEY_ENTER) && (charCode != KeyCodes.KEY_HOME)
                    && (charCode != KeyCodes.KEY_END) && (charCode != KeyCodes.KEY_LEFT)
                    && (charCode != KeyCodes.KEY_UP) && (charCode != KeyCodes.KEY_RIGHT)
                    && (charCode != KeyCodes.KEY_DOWN)) {
                curPageBox.cancelKey();
            }
        }
    };

    // Add the handler
    curPageBox.addKeyPressHandler(handler);
}

From source file:edu.caltech.ipac.firefly.ui.imageGrid.PagingOptions.java

/**
* Create a box that holds the current page.
*//*from   www .ja va  2 s. c o m*/
private void createCurPageBox() {
    // Setup the widget
    curPageBox.setWidth("3em");
    curPageBox.setText("1");
    curPageBox.setTextAlignment(TextBoxBase.ALIGN_RIGHT);

    // Disallow non-numeric pages
    KeyPressHandler handler = new KeyPressHandler() {
        public void onKeyPress(KeyPressEvent event) {
            char charCode = event.getCharCode();
            if (charCode == KeyCodes.KEY_ENTER) {
                PagingOptions.this.imageGridPanel.getImageGrid().gotoPage(getPagingBoxValue(), false);
            } else if (!Character.isDigit(charCode) && (charCode != KeyCodes.KEY_TAB)
                    && (charCode != KeyCodes.KEY_BACKSPACE) && (charCode != KeyCodes.KEY_DELETE)
                    && (charCode != KeyCodes.KEY_ENTER) && (charCode != KeyCodes.KEY_HOME)
                    && (charCode != KeyCodes.KEY_END) && (charCode != KeyCodes.KEY_LEFT)
                    && (charCode != KeyCodes.KEY_UP) && (charCode != KeyCodes.KEY_RIGHT)
                    && (charCode != KeyCodes.KEY_DOWN)) {
                curPageBox.cancelKey();
            }
        }
    };

    // Add the handler
    curPageBox.addKeyPressHandler(handler);
}

From source file:edu.caltech.ipac.firefly.ui.table.PagingPanel.java

License:Apache License

/**
 * Create a box that holds the current page.
 *//*from  ww w  . j  a v  a2 s. c om*/
private void createCurPageBox() {
    // Setup the widget
    curPageBox.setWidth("3em");
    curPageBox.setText("1");
    curPageBox.setTextAlignment(TextBoxBase.ALIGN_RIGHT);

    // Disallow non-numeric pages
    KeyPressHandler handler = new KeyPressHandler() {
        public void onKeyPress(KeyPressEvent event) {

            int keyCode = event.getNativeEvent().getKeyCode();
            char charCode = event.getCharCode();
            if (keyCode == KeyCodes.KEY_ENTER) {
                PagingPanel.this.table.gotoPage(getPagingBoxValue(), false);
            } else if (charCode != 0 && !Character.isDigit(charCode)) {
                curPageBox.cancelKey();
            }
        }
    };

    // Add the handler
    curPageBox.addKeyPressHandler(handler);
}

From source file:edu.kit.ipd.sonar.client.Menu.java

License:Open Source License

/**
 * initializes the menu's components./*from  w w  w.j ava2 s.  c  om*/
 */
private void initComponents() {

    GWT.log("Menu: initializing gui-objects...", null);

    VerticalPanel vpanel = new VerticalPanel();

    Image showImage = new Image(GWT.getModuleBaseURL() + "images/menushowbutton.png");
    showImage.addClickHandler(new ClickHandler() {
        public void onClick(final ClickEvent e) {
            showMenu();
        }
    });
    showImage.setStyleName("menuShowImage");
    SimplePanel sp = new SimplePanel();
    sp.setWidget(showImage);
    // This is needed so the menu doesn't maximize vertically, which
    // would cause it to pull the components apart.
    SimplePanel outer = new SimplePanel();
    outer.setWidget(vpanel);
    // Do _not_ change this order or add anything before 'outer'
    deckPanel.add(sp);
    deckPanel.add(outer);
    showMenu();
    initWidget(deckPanel);

    // Top bar
    HorizontalPanel topPanel = new HorizontalPanel();
    topPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    topPanel.add(new Image(GWT.getModuleBaseURL() + "images/logo.png"));
    topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    Image hideImage = new Image(GWT.getModuleBaseURL() + "images/menuhidebutton.png");
    hideImage.addClickHandler(new ClickHandler() {
        public void onClick(final ClickEvent e) {
            hideMenu();
        }
    });

    topPanel.add(hideImage);
    topPanel.setWidth("100%");
    vpanel.add(topPanel);

    // Centrality chooser table
    vpanel.add(centralityTable);

    //init admin-panel
    vpanel.add(adminPanel);

    //cutoff:
    Grid cutoffGrid = new Grid(1, 2);
    cutoffGrid.setWidth("100%");
    cutoffGrid.setWidget(0, 0, cutoffLabel);
    cutoffTextBox.setText("1");
    cutoffTextBox.setTextAlignment(TextBoxBase.ALIGN_RIGHT);
    cutoffTextBox.setStyleName("menuCutoffTextBox");
    cutoffGrid.setWidget(0, 1, cutoffTextBox);
    cutoffGrid.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT);
    vpanel.add(cutoffGrid);

    //init buttons
    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.setWidth("100%");
    //logout-button:
    buttonPanel.add(new Button(messages.logout(), new ClickHandler() {
        public void onClick(final ClickEvent e) {
            EventBus.getHandlerManager().fireEvent(new AttemptLogoutEvent());
        }
    }));
    buttonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    //Submit-button:
    buttonPanel.add(new Button(messages.confirm(), new ClickHandler() {
        public void onClick(final ClickEvent e) {
            requestGraph();
        }
    }));
    vpanel.add(buttonPanel);

    CaptionPanel infobox = new CaptionPanel(messages.infoBoxHeader());
    infobox.setStyleName("infobox");
    VerticalPanel infovpanel = new VerticalPanel();
    Label nodeInfoContent = new Label("");
    Label edgeInfoContent = new Label("");
    nodeInfoContent.getElement().setId(JSXGraphDrawer.NODE_TOOLTIP_ID);
    edgeInfoContent.getElement().setId(JSXGraphDrawer.EDGE_TOOLTIP_ID);
    infovpanel.add(nodeInfoContent);
    infovpanel.add(edgeInfoContent);
    infobox.setContentWidget(infovpanel);
    vpanel.add(infobox);
}