Example usage for com.google.gwt.user.client.ui HasHorizontalAlignment ALIGN_JUSTIFY

List of usage examples for com.google.gwt.user.client.ui HasHorizontalAlignment ALIGN_JUSTIFY

Introduction

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

Prototype

HorizontalAlignmentConstant ALIGN_JUSTIFY

To view the source code for com.google.gwt.user.client.ui HasHorizontalAlignment ALIGN_JUSTIFY.

Click Source Link

Document

Specifies that the widget's contents should be aligned as justify.

Usage

From source file:com.google.appinventor.client.Ode.java

License:Open Source License

/**
 * Creates, visually centers, and optionally displays the dialog box
 * that informs the user how to start learning about using App Inventor
 * or create a new project.// www.j  a  va 2s  .  c  om
 * @param showDialog Convenience variable to show the created DialogBox.
 * @return The created and optionally displayed Dialog box.
 */
public DialogBox createNoProjectsDialog(boolean showDialog) {
    // Create the UI elements of the DialogBox
    final DialogBox dialogBox = new DialogBox(true, false); //DialogBox(autohide, modal)
    dialogBox.setStylePrimaryName("ode-DialogBox");
    dialogBox.setText(MESSAGES.createNoProjectsDialogText());

    Grid mainGrid = new Grid(2, 2);
    mainGrid.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER,
            HasVerticalAlignment.ALIGN_MIDDLE);
    mainGrid.getCellFormatter().setAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER,
            HasVerticalAlignment.ALIGN_MIDDLE);
    mainGrid.getCellFormatter().setAlignment(1, 1, HasHorizontalAlignment.ALIGN_RIGHT,
            HasVerticalAlignment.ALIGN_MIDDLE);

    Image dialogImage = new Image(Ode.getImageBundle().androidGreenSmall());

    Grid messageGrid = new Grid(2, 1);
    messageGrid.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_JUSTIFY,
            HasVerticalAlignment.ALIGN_MIDDLE);
    messageGrid.getCellFormatter().setAlignment(1, 0, HasHorizontalAlignment.ALIGN_LEFT,
            HasVerticalAlignment.ALIGN_MIDDLE);

    Label messageChunk1 = new HTML(MESSAGES.createNoProjectsDialogMessage1());

    messageChunk1.setWidth("23em");
    Label messageChunk2 = new Label(MESSAGES.createNoprojectsDialogMessage2());

    // Add the elements to the grids and DialogBox.
    messageGrid.setWidget(0, 0, messageChunk1);
    messageGrid.setWidget(1, 0, messageChunk2);
    mainGrid.setWidget(0, 0, dialogImage);
    mainGrid.setWidget(0, 1, messageGrid);

    dialogBox.setWidget(mainGrid);
    dialogBox.center();

    if (showDialog) {
        dialogBox.show();
    }

    return dialogBox;
}

From source file:com.urlisit.siteswrapper.cloud.widgets.InformationItemPopup.java

License:Apache License

/**
 * //  ww w .  j a va2  s  . com
 */
public InformationItemPopup(Item item, Literals literals) {
    this.item = item;
    this.literals = literals;
    popup.setText(item.getName());
    popup.setGlassEnabled(true);
    popup.setAnimationEnabled(true);
    VerticalPanel contents = new VerticalPanel();
    contents.setSpacing(5);
    contents.setWidth(Double.valueOf(Window.getClientWidth() * .75).intValue() + "px");
    popup.setWidget(contents);
    HTML description = new HTML(item.getDescription());
    contents.add(description);
    //contents.setCellHorizontalAlignment(description, HasHorizontalAlignment.ALIGN_CENTER);
    contents.setCellHorizontalAlignment(description, HasHorizontalAlignment.ALIGN_JUSTIFY);
    HorizontalPanel hContents = new HorizontalPanel();
    String videoEmbedHtml = literals.youTubeOldEmbed420x315().replace("VIDEO_URL", item.getVideoUrl());
    final HTML video = new HTML(videoEmbedHtml);
    final Image image = new Image(item.getImageUrl());
    image.setVisible(false);
    image.addLoadHandler(new LoadHandler() {
        @Override
        public void onLoad(LoadEvent event) {
            BigDecimal newHeight = BigDecimal.valueOf(315.00);
            BigDecimal width = BigDecimal.valueOf(Integer.valueOf(image.getWidth()).doubleValue());
            BigDecimal height = BigDecimal.valueOf(Integer.valueOf(image.getHeight()).doubleValue());
            BigDecimal newWidth = newHeight.multiply(width.divide(height, 4, BigDecimal.ROUND_HALF_EVEN));
            image.setPixelSize(newWidth.intValue(), newHeight.intValue());
            image.setVisible(true);
        }
    });
    hContents.add(video);
    hContents.add(image);
    contents.add(hContents);
    contents.setCellHorizontalAlignment(hContents, HasHorizontalAlignment.ALIGN_CENTER);
    Button closeButton = new Button("Close", new ClickHandler() {
        public void onClick(ClickEvent event) {
            popup.hide();
        }
    });
    contents.add(closeButton);
    contents.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_RIGHT);
}

From source file:gov.nist.spectrumbrowser.client.ViewCaptureEvents.java

License:Open Source License

@Override
public void onSuccess(String result) {
    try {//from w ww .j  a  v a 2s  .  c o  m
        verticalPanel.clear();
        super.drawNavigation();
        JSONValue jsonValue = JSONParser.parseLenient(result);
        JSONObject jsonObject = jsonValue.isObject();
        String status = jsonObject.get("status").isString().stringValue();

        if (!status.equals("OK")) {
            String errorMessage = jsonObject.get("ErrorMessage").isString().stringValue();
            Window.alert("Error Processing Request: " + errorMessage);
            return;
        }

        final JSONArray eventTimes = jsonObject.get("events").isArray();
        logger.finer("Found " + eventTimes.size() + " capture events.");

        title = new HTML("<h2>Capture Events</h2>");
        verticalPanel.add(title);

        String labelHtml = "<p>  A <b>capture event</b> is an event of interest detected by the sensor that triggers the capture "
                + "and recording of baseband I/Q  data which is stored on the sensor host.";
        labelHtml += "<br/>Click on capture timestamp to view forensics report (if it exists):</p> ";
        Grid buttonGrid = new Grid(1, 3);
        Button nextDay = new Button("Next Day");
        Button previousDay = new Button("Previous Day");
        Button refresh = new Button("Refresh");
        buttonGrid.setWidget(0, 0, previousDay);
        buttonGrid.setWidget(0, 1, refresh);
        buttonGrid.setWidget(0, 2, nextDay);
        verticalPanel.add(buttonGrid);
        previousDay.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                tSelectedStartTime = tSelectedStartTime - Defines.SECONDS_PER_DAY;
                spectrumBrowser.getSpectrumBrowserService().getCaptureEvents(sensorId, tSelectedStartTime, 1,
                        ViewCaptureEvents.this);

            }
        });

        nextDay.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                tSelectedStartTime = tSelectedStartTime + Defines.SECONDS_PER_DAY;
                spectrumBrowser.getSpectrumBrowserService().getCaptureEvents(sensorId, tSelectedStartTime, 1,
                        ViewCaptureEvents.this);

            }
        });

        refresh.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                spectrumBrowser.getSpectrumBrowserService().getCaptureEvents(sensorId, tSelectedStartTime, 1,
                        ViewCaptureEvents.this);

            }
        });

        HTML label = new HTML(labelHtml);
        label.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_JUSTIFY);
        verticalPanel.add(label);

        ScrollPanel horizontalScrollPanel = new ScrollPanel();

        final TextBox forensicReportTextBox = new TextBox();
        forensicReportTextBox.setWidth("400px");
        horizontalScrollPanel.add(forensicReportTextBox);
        verticalPanel.add(horizontalScrollPanel);

        if (eventTimes.size() == 0) {
            Window.alert("no capture events found");
        } else {
            final ListBox captureEventList = new ListBox();
            for (int i = 0; i < eventTimes.size(); i++) {

                String eventTime = eventTimes.get(i).isObject().get("formattedTimeStamp").isString()
                        .stringValue();
                captureEventList.addItem(eventTime);

            }

            captureEventList.setVisibleItemCount(20);
            ScrollPanel scrollPanel = new ScrollPanel();
            scrollPanel.add(captureEventList);
            verticalPanel.add(captureEventList);
            captureEventList.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    int index = captureEventList.getSelectedIndex();
                    if (eventTimes.get(index).isObject().get("forensicsReport") != null) {
                        JSONObject forensicReport = eventTimes.get(index).isObject().get("forensicsReport")
                                .isObject();
                        forensicReportTextBox.setText(forensicReport.toString());
                    } else {
                        forensicReportTextBox.setText("Not Available");
                    }

                }
            });
        }
        // calendar = new DatePicker();
        // hpanel.add(calendar);

    } catch (Throwable th) {
        logger.log(Level.SEVERE, "Error parsing json file ", th);
    }

}

From source file:org.geowe.client.local.main.tool.info.JoinDataDialog.java

License:Open Source License

private Widget createPanel() {
    final VerticalPanel vPanel = new VerticalPanel();
    vPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_JUSTIFY);

    vPanel.add(createTabPanel());// w w  w .  ja va 2s.  c  o m
    vPanel.add(separatorPanel);
    vPanel.add(loadFileButton);
    vPanel.add(comboPanel);
    vPanel.add(layerAttributeComboPanel);

    return vPanel;
}

From source file:org.jbpm.formbuilder.client.effect.HorizontalAlignmentFormEffect.java

License:Apache License

@Override
protected void createStyles() {
    int index = this.alignmentBox.getSelectedIndex();
    String value = this.alignmentBox.getValue(index);
    Widget widget = getWidget();/*  w w w.j a va2  s . c  o m*/
    if (widget instanceof HasHorizontalAlignment) {
        HasHorizontalAlignment hw = (HasHorizontalAlignment) widget;
        HorizontalAlignmentConstant align = null;
        if (i18n.AlignLeft().equals(value)) {
            align = HasHorizontalAlignment.ALIGN_LEFT;
        } else if (i18n.AlignRight().equals(value)) {
            align = HasHorizontalAlignment.ALIGN_RIGHT;
        } else if (i18n.AlignCenter().equals(value)) {
            align = HasHorizontalAlignment.ALIGN_CENTER;
        } else if (i18n.AlignJustify().equals(value)) {
            align = HasHorizontalAlignment.ALIGN_JUSTIFY;
        }
        Map<String, Object> dataSnapshot = new HashMap<String, Object>();
        dataSnapshot.put("oldAlignment", hw.getHorizontalAlignment());
        dataSnapshot.put("newAlignment", align);
        dataSnapshot.put("hwidget", hw);
        bus.fireEvent(new UndoableEvent(dataSnapshot, new UndoableHandler() {
            @Override
            public void onEvent(UndoableEvent event) {
            }

            @Override
            public void undoAction(UndoableEvent event) {
                HorizontalAlignmentConstant oldAlignment = (HorizontalAlignmentConstant) event
                        .getData("oldAlignment");
                HasHorizontalAlignment hwidget = (HasHorizontalAlignment) event.getData("hwidget");
                hwidget.setHorizontalAlignment(oldAlignment);
            }

            @Override
            public void doAction(UndoableEvent event) {
                HorizontalAlignmentConstant newAlignment = (HorizontalAlignmentConstant) event
                        .getData("newAlignment");
                HasHorizontalAlignment hwidget = (HasHorizontalAlignment) event.getData("hwidget");
                hwidget.setHorizontalAlignment(newAlignment);
            }
        }));
    }
}

From source file:org.opendatakit.aggregate.client.FilterSubTab.java

License:Apache License

public FilterSubTab() {
    // vertical//from w w  w. ja va2 s .c  om
    setStylePrimaryName(UIConsts.VERTICAL_FLOW_PANEL_STYLENAME);

    getElement().setId("filter_sub_tab");

    // create Nav Panel
    navTable = new FilterNavigationTable(this);
    navTable.getElement().setId("submission_nav_table");
    add(navTable);

    // Create Filters and Submissions Panel
    HorizontalPanel filtersNSubmissions = new HorizontalPanel();

    filtersPanel = new FiltersDataPanel(this);
    filtersNSubmissions.add(filtersPanel);
    filtersNSubmissions.getElement().getFirstChildElement().getFirstChildElement().getFirstChildElement()
            .setId("filters_panel"); // TODO: improve this

    submissionPanel = new SubmissionPanel();

    filtersNSubmissions.add(submissionPanel);
    filtersNSubmissions.getElement().setId("filters_data");
    filtersNSubmissions.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_JUSTIFY);

    add(filtersNSubmissions);
}

From source file:org.opendatakit.aggregate.client.OdkTablesManageAppLevelFilesSubTab.java

License:Apache License

/**
 * Sets up the View Table subtab.//from   w w w  . j  a va  2 s  .co  m
 */
public OdkTablesManageAppLevelFilesSubTab(OdkTablesTabUI parent) {
    this.parent = parent;

    addFileButton = new ServletPopupButton(ADD_FILE_BUTTON_TXT, ADD_FILE_TXT,
            UIConsts.APP_LEVEL_FILE_UPLOAD_SERVLET_ADDR, this, ADD_FILE_TOOLTIP_TXT, ADD_FILE_BALLOON_TXT);

    setStylePrimaryName(UIConsts.VERTICAL_FLOW_PANEL_STYLENAME);

    tableFileData = new OdkTablesViewAppLevelFileInfo(this);

    selectTablePanel = new FlexTable();
    selectTablePanel.getElement().setId("app_level_panel");
    selectTablePanel.setHTML(0, 0, "<h2> Application Level Files </h2>");
    if (AggregateUI.getUI().getUserInfo().getGrantedAuthorities()
            .contains(GrantedAuthorityName.ROLE_ADMINISTER_TABLES)) {
        selectTablePanel.setWidget(1, 0, addFileButton);
    }

    topPanel = new HorizontalPanel();
    topPanel.add(selectTablePanel);
    topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_JUSTIFY);
    add(topPanel);
    add(tableFileData);
}

From source file:org.opendatakit.aggregate.client.OdkTablesManageInstanceFilesSubTab.java

License:Apache License

/**
 * Sets up the View Table subtab.//from ww w . jav a 2  s. com
 */
public OdkTablesManageInstanceFilesSubTab(OdkTablesTabUI parent) {
    this.parent = parent;

    setStylePrimaryName(UIConsts.VERTICAL_FLOW_PANEL_STYLENAME);

    // displayDeleted = false;
    currentTable = null;

    // first construct a copy so you can build the list box before you
    // update it. This seems like bad style.
    currentTables = new ArrayList<TableEntryClient>();

    // set up the box so you can only select one and you provide both the
    // table name and ID.
    tableBox = new ListBox();
    // new TableEntryClientListBox(currentTables, false, false,
    // "Select a table to view.");
    tableBox.addChangeHandler(new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            int selectedIndex = tableBox.getSelectedIndex();
            // Call this to clear the contents while you are waiting on
            // the response from the server.
            tableFileData.updateDisplay(null);
            currentTable = null;
            selectedValue = selectedIndex;
            updateContentsForSelectedTable();
        }
    });

    tableFileData = new OdkTablesViewInstanceFileInfo(this);

    selectTablePanel = new FlexTable();
    selectTablePanel.getElement().setId("select_table_panel");
    selectTablePanel.setHTML(0, 0, "<h2 id=\"table_name\"> Select a Table </h2>");
    selectTablePanel.setWidget(0, 1, tableBox);

    topPanel = new HorizontalPanel();
    topPanel.add(selectTablePanel);
    topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_JUSTIFY);
    add(topPanel);
    add(tableFileData);

}

From source file:org.opendatakit.aggregate.client.OdkTablesManageTableFilesSubTab.java

License:Apache License

/**
 * Sets up the View Table subtab./*from  w w  w .  j  a va  2 s  .c  om*/
 */
public OdkTablesManageTableFilesSubTab(OdkTablesTabUI parent) {
    this.parent = parent;

    addFileButton = new OdkTablesTableIdServletPopupButton(ADD_FILE_BUTTON_TXT, ADD_FILE_TXT,
            UIConsts.TABLE_FILE_UPLOAD_SERVLET_ADDR, ADD_FILE_TOOLTIP_TXT, ADD_FILE_BALLOON_TXT, this, this);

    setStylePrimaryName(UIConsts.VERTICAL_FLOW_PANEL_STYLENAME);

    // displayDeleted = false;
    currentTable = null;

    // first construct a copy so you can build the list box before you
    // update it. This seems like bad style.
    currentTables = new ArrayList<TableEntryClient>();

    // set up the box so you can only select one and you provide both the
    // table name and ID.
    tableBox = new ListBox();
    // new TableEntryClientListBox(currentTables, false, false,
    // "Select a table to view.");
    tableBox.addChangeHandler(new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            int selectedIndex = tableBox.getSelectedIndex();
            // Call this to clear the contents while you are waiting on
            // the response from the server.
            tableFileData.updateDisplay(null);
            currentTable = null;
            selectedValue = selectedIndex;
            updateContentsForSelectedTable();
        }
    });

    tableFileData = new OdkTablesViewTableFileInfo(this);

    selectTablePanel = new FlexTable();
    selectTablePanel.getElement().setId("select_table_panel");
    selectTablePanel.setHTML(0, 0, "<h2 id=\"table_name\"> Select a Table </h2>");
    selectTablePanel.setWidget(0, 1, tableBox);
    if (AggregateUI.getUI().getUserInfo().getGrantedAuthorities()
            .contains(GrantedAuthorityName.ROLE_ADMINISTER_TABLES)) {
        selectTablePanel.setWidget(1, 0, addFileButton);
    }

    // deletedRowsCheckBox = new OdkTablesDisplayDeletedRowsCheckBox(this,
    // displayDeleted);
    // selectTablePanel.setWidget(0, 2, deletedRowsCheckBox);

    topPanel = new HorizontalPanel();
    topPanel.add(selectTablePanel);
    topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_JUSTIFY);
    add(topPanel);
    add(tableFileData);

}

From source file:org.opendatakit.aggregate.client.OdkTablesViewTableSubTab.java

License:Apache License

/**
 * Sets up the View Table subtab.//from   w  w  w .j a  v a2  s .co  m
 */
public OdkTablesViewTableSubTab(OdkTablesTabUI parent) {
    this.parent = parent;

    setStylePrimaryName(UIConsts.VERTICAL_FLOW_PANEL_STYLENAME);

    // displayDeleted = false;
    currentTable = null;

    // first construct a copy so you can build the list box before you
    // update it. This seems like bad style.
    currentTables = new ArrayList<TableEntryClient>();

    // set up the box so you can only select one and you provide both the
    // table name and ID.
    tableBox = new ListBox();
    // new TableEntryClientListBox(currentTables, false, false,
    // "Select a table to view.");
    tableBox.addChangeHandler(new ChangeHandler() {

        public void onChange(ChangeEvent event) {
            int selectedIndex = tableBox.getSelectedIndex();
            // Call this to clear contents while you are waiting on the
            // response from the server.
            tableData.updateDisplay(null);
            currentTable = null;
            selectedValue = selectedIndex;
            updateContentsForSelectedTable();
        }
    });

    tableData = new OdkTablesViewTable(this);

    selectTablePanel = new FlexTable();
    selectTablePanel.getElement().setId("select_table_panel");
    selectTablePanel.setHTML(0, 0, "<h2 id=\"table_name\"> Select a Table </h2>");
    selectTablePanel.setWidget(0, 1, tableBox);

    // deletedRowsCheckBox = new OdkTablesDisplayDeletedRowsCheckBox(this,
    // displayDeleted);
    // selectTablePanel.setWidget(0, 2, deletedRowsCheckBox);

    topPanel = new HorizontalPanel();
    topPanel.add(selectTablePanel);
    topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_JUSTIFY);
    add(topPanel);
    add(tableData);

}