Example usage for com.google.gwt.user.client.ui HorizontalPanel add

List of usage examples for com.google.gwt.user.client.ui HorizontalPanel add

Introduction

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

Prototype

@Override
    public void add(Widget w) 

Source Link

Usage

From source file:com.ephesoft.dcma.gwt.rv.client.view.ExternalAppDialogBox.java

License:Open Source License

public ExternalAppDialogBox(String url, java.util.Map<String, String> dimensionsOfPopUpMap) {
    super();//from   ww w .j av a2 s .  co  m
    setWidget(BINDER.createAndBindUi(this));
    addStyleName(ReviewValidateConstants.CONFIGURED_DIMENSIONS_DIALOG);
    int xDimension;
    int yDimension;

    try {
        xDimension = Integer.parseInt(dimensionsOfPopUpMap.get(ReviewValidateConstants.POP_UP_X_DIMENSION));
        if (xDimension < 0) {
            xDimension = DEFAULT_X_DIMENSION;
        }
    } catch (Exception e) {
        xDimension = DEFAULT_X_DIMENSION;
    }

    try {
        yDimension = Integer.parseInt(dimensionsOfPopUpMap.get(ReviewValidateConstants.POP_UP_Y_DIMENSION));
        if (yDimension < 0) {
            yDimension = DEFAULT_Y_DIMENSION;
        }
    } catch (Exception e) {
        yDimension = DEFAULT_Y_DIMENSION;
    }

    setWidth(xDimension + "px");
    setHeight(yDimension + "px");
    Frame frame = new Frame(url);
    frame.setWidth(xDimension + "px");
    frame.setHeight(yDimension + "px");
    okButton = new Button("Ok", new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            listener.onOkClick();
            hide();
        }
    });
    okButton.setTitle("Ctrl+a");
    closeButton = new Button("Close", new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            listener.onCloseClick();
            hide();
        }
    });
    closeButton.setTitle("Ctrl+z");
    okButton.getElement().setAttribute("id", "okButtonElement");
    closeButton.getElement().setAttribute("id", "closeButtonElement");
    okButton.setVisible(false);
    closeButton.setVisible(false);
    HorizontalPanel horizontalButtonPanel = new HorizontalPanel();
    horizontalButtonPanel.setSpacing(5);
    horizontalButtonPanel.add(okButton);
    horizontalButtonPanel.add(closeButton);
    horizontalButtonPanel.setCellHorizontalAlignment(okButton, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalButtonPanel.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.add(frame);
    verticalPanel.setCellHorizontalAlignment(frame, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setCellHorizontalAlignment(horizontalButtonPanel, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.add(horizontalButtonPanel);
    setModal(true);
    setVisible(true);
    show();
}

From source file:com.ephesoft.dcma.gwt.rv.client.view.TableExtractionView.java

License:Open Source License

private void setTableUI(final FlexTable flexTable, final DataTable dataTable) {
    ScrollPanel panel = new ScrollPanel();
    if (dataTable.getRows().getRow().size() == 0) {
        setEmptyTableView(flexTable, dataTable.getHeaderRow());
    }//  w  w w .  java 2 s  . co m

    panel.add(flexTable);
    panel.setHeight("150px");
    panel.setWidth("400px");
    panel.setTitle(dataTable.getName());
    HorizontalPanel hPanel = new HorizontalPanel();
    insertRowButton = new Button();
    deleteRowButton = new Button();
    deleteAllRowButton = new Button();
    manualExtractionButton = new Button();
    setButtonsText();

    onInsertButtonClicked(insertRowButton, dataTable);
    onDeleteButtonClicked(deleteRowButton, dataTable);
    onDeleteAllButtonClicked(deleteAllRowButton, dataTable);
    onManualExtractionButtonClicked(manualExtractionButton, dataTable);

    final String tableName = dataTable.getName();
    tableNameVsButtonMap.put(insertRowButton, tableName);
    tableNameVsButtonMap.put(deleteRowButton, tableName);
    tableNameVsButtonMap.put(deleteAllRowButton, tableName);
    tableNameVsButtonMap.put(manualExtractionButton, tableName);
    Label label = new Label();
    label.setWidth(GAP_BETWEEN_BUTTONS);
    hPanel.add(insertRowButton);
    hPanel.add(label);
    label = new Label();
    label.setWidth(GAP_BETWEEN_BUTTONS);
    hPanel.add(deleteRowButton);
    hPanel.add(label);
    label = new Label();
    label.setWidth(GAP_BETWEEN_BUTTONS);
    hPanel.add(deleteAllRowButton);
    hPanel.add(label);
    hPanel.add(manualExtractionButton);
    Label emptyLabel = new Label();
    emptyLabel.setHeight("20px");
    verticalPanel.add(emptyLabel);
    emptyLabel = new Label();
    emptyLabel.setText(dataTable.getName());
    verticalPanel.add(emptyLabel);
    verticalPanel.add(hPanel);
    emptyLabel = new Label();
    emptyLabel.setHeight("10px");
    verticalPanel.add(emptyLabel);
    verticalPanel.add(panel);

}

From source file:com.ephesoft.dcma.gwt.rv.client.view.TableExtractionView.java

License:Open Source License

private void addHeaderColumns(final List<Column> columnList, final FlexTable flexTable) {
    tableNameVsCheckBoxMap.get(selectedDataTableName).clear();
    int columnNumber = 0;
    for (Column headerColumn : columnList) {
        HorizontalPanel headerRowPanel = new HorizontalPanel();
        Label headerText = new Label(headerColumn.getName());
        headerRowPanel.add(headerText);
        headerRowPanel.setWidth("80px");
        CheckBox validationCheckBox = new CheckBox();
        validationCheckBox.setVisible(Boolean.FALSE);
        headerRowPanel.add(validationCheckBox);
        headerRowPanel.setCellVerticalAlignment(validationCheckBox, HasVerticalAlignment.ALIGN_MIDDLE);
        tableNameVsCheckBoxMap.get(selectedDataTableName).add(validationCheckBox);
        flexTable.setWidget(0, columnNumber, headerRowPanel);
        flexTable.getCellFormatter().addStyleName(0, columnNumber, "wordWrap");
        columnNumber++;// w  w  w. j ava  2s  .co m
    }
}

From source file:com.ephesoft.gxt.admin.client.view.plugin.PluginDetailView.java

License:Open Source License

public void addNoFieldExists() {
    HorizontalPanel cont = new HorizontalPanel();
    cont.addStyleName("pluginPanel");
    Label label = new Label();
    label.setText(LocaleDictionary.getConstantValue(BatchClassConstants.NO_FIELD_EXISTS));
    label.addStyleName("noPluginLabel");
    cont.add(label);
    vlayoutContainer.add(cont);/*from   w w w .  jav  a2s.c  o m*/
}

From source file:com.ephesoft.gxt.admin.client.view.plugin.PluginDetailView.java

License:Open Source License

public void addWidget(String labelText, Widget widget, boolean isMandatory) {
    HorizontalPanel cont = new HorizontalPanel();
    cont.addStyleName("pluginPanel");
    if (isMandatory) {
        MandatoryLabel label = new MandatoryLabel();
        label.setLabelText(labelText);//from   w w  w  . j a  v a 2 s. c  o m
        label.addStyleName("pluginLabel");
        cont.add(label);
    } else {
        labelText = StringUtil.concatenate(labelText, AdminConstants.COLON);
        Label label = new Label();
        label.setText(labelText);
        label.addStyleName("pluginLabel");
        cont.add(label);
    }
    widget.addStyleName("widgetPluginLabel");
    cont.add(widget);
    vlayoutContainer.add(cont);
}

From source file:com.ephesoft.gxt.core.client.ui.widget.PagingToolbar.java

License:Open Source License

public PagingToolbar(final int rowsInPage, final Grid<?> bindedGrid) {
    super(getPageSize(rowsInPage, bindedGrid));
    pagingField = new IntegerField();
    this.bindedGrid = bindedGrid;
    resetLabel = new Label();
    resetLabel.setTitle(LocaleConstants.RESET);
    this.insert(resetLabel, 13);
    this.addStyleName("toolbarTextAlign");
    resetLabel.addStyleName("resetImage");
    prev.addStyleName("previousToolbarButton");
    next.addStyleName("nextToolbarButton");
    last.addStyleName("lastToolbarButton");
    first.addStyleName("firstToolbarButton");
    refresh.addStyleName("refreshToolbarButton");
    prev.addStyleName("toolbarButton");
    next.addStyleName("toolbarButton");

    last.addStyleName("toolbarButton");
    first.addStyleName("toolbarButton");
    refresh.addStyleName("toolbarButton");
    addEnableHandler(first);// w  w w .j a v  a2  s.com
    addEnableHandler(prev);
    addEnableHandler(last);
    addEnableHandler(next);
    pagingField.setText(String.valueOf(pageSize));
    pagingField.setValue(pageSize);
    pagingField.setTitle(LocaleConstants.ACCEPT_VALUES_BETWEEN_10_TO_50);
    pageSizePrefixLabel = new Label(LocaleConstants.SHOWING);
    pageSizePrefixLabel.addStyleName("pagingPrefixLabel");
    HorizontalPanel pagingPanel = new HorizontalPanel();
    pagingPanel.addStyleName("pagingPanel");
    pagingPanel.add(pageSizePrefixLabel);
    pagingPanel.add(pagingField);
    pageSizeSuffixLabel = new Label(LocaleConstants.RECORDS_PER_PAGE);
    pagingField.setWidth(30);
    pagingPanel.add(pageSizeSuffixLabel);
    this.add(pagingPanel);
    pagingField.addStyleName("pagingTextBox");

    //displayText.setLabel(getMessages().displayMessage(0, 0, 0));
    beforePage.setLabel(LocaleConstants.PAGE);

    pagingField.addValueChangeHandler(new ValueChangeHandler<Integer>() {

        @Override
        public void onValueChange(ValueChangeEvent<Integer> event) {
            Integer changedValue = event.getValue();

            if (changedValue != null && changedValue >= 10 && changedValue <= 50) {
                pageSize = changedValue;
                String cookieName = getCookieName(bindedGrid);
                if (!StringUtil.isNullOrEmpty(cookieName)) {
                    CookieUtil.storeCookie(cookieName, String.valueOf(pageSize));
                }
                refresh();
                loader.setLimit(pageSize);
            } else {
                pagingField.setText(String.valueOf(pageSize));
            }
        }
    });

    pagingField.addBlurHandler(new BlurHandler() {

        @Override
        public void onBlur(BlurEvent event) {
            pagingField.setText(String.valueOf(pageSize));
        }
    });

    resetLabel.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            PagingToolbar.this.bindedGrid.clearFilter();
        }
    });

    resetLabel.addMouseOverHandler(new MouseOverHandler() {

        @Override
        public void onMouseOver(MouseOverEvent event) {
            resetLabel.addStyleName("labelHover");
        }
    });

    resetLabel.addMouseOutHandler(new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            resetLabel.removeStyleName("labelHover");
        }
    });

    pageText.addKeyUpHandler(new KeyUpHandler() {

        @Override
        public void onKeyUp(KeyUpEvent event) {
            String text = pageText.getText();
            int totalPages = PagingToolbar.this.getTotalPages();
            boolean isValid = ValidationUtil.isValidNumericalValue(text, Integer.class);
            if (isValid) {
                int value = Integer.parseInt(text);
                isValid = ValidationUtil.isValueInRange(value, Math.min(1, totalPages), totalPages);
            }
            if (isValid) {
                pageText.removeStyleName("invalidField");
            } else {
                pageText.addStyleName("invalidField");
            }
        }
    });

    setToolTipSize();

    setWidgetIDs();
}

From source file:com.ephesoft.gxt.core.client.ui.widget.ScreenNavigatorWidget.java

License:Open Source License

private HorizontalPanel getInnerHorizontalPanel(Widget firstWidget, final Widget secondWidget) {
    final HorizontalPanel widgetHorizontalPanel = new HorizontalPanel();
    widgetHorizontalPanel.add(firstWidget);
    widgetHorizontalPanel.getElement().setAttribute("cellPadding", "2");
    widgetHorizontalPanel.setSpacing(1);
    widgetHorizontalPanel.setWidth("100px");
    secondWidget.setVisible(true);//from   w w w .ja  v a 2s.  c  o m
    secondWidget.addStyleName("panelLabelStyle");
    final MenuBar menuBar = (MenuBar) secondWidget;
    final MenuBarWidget menuBarWidget = new MenuBarWidget(true);
    menuBarWidget.addItem(new MenuItem(menuBar.getTitle(), menuBar));
    widgetHorizontalPanel.add(menuBarWidget);
    menuBarWidget.setVisible(false);
    widgetHorizontalPanel.addDomHandler(new MouseOverHandler() {

        public void onMouseOver(MouseOverEvent event) {
            widgetHorizontalPanel.addStyleName("horizontalPanelMouseHover");
            menuBarWidget.setAutoOpen(true);
            menuBarWidget.setSelectedMenu(false);
            if (null != previosMenuBar) {
                previosMenuBar.closeAllChildren(false);
            }
        }
    }, MouseOverEvent.getType());

    widgetHorizontalPanel.addDomHandler(new MouseOutHandler() {

        public void onMouseOut(MouseOutEvent event) {
            widgetHorizontalPanel.removeStyleName("horizontalPanelMouseHover");
            menuBarWidget.setSelectedMenu(true);
            previosMenuBar = menuBarWidget;
        }
    }, MouseOutEvent.getType());
    return widgetHorizontalPanel;
}

From source file:com.ephesoft.gxt.core.client.ui.widget.ScreenNavigatorWidget.java

License:Open Source License

private HorizontalPanel getPageMenuInnerHorizontalPanel(Widget firstWidget, final Widget secondWidget,
        final String url) {
    final HorizontalPanel widgetHorizontalPanel = new HorizontalPanel();
    widgetHorizontalPanel.add(firstWidget);
    widgetHorizontalPanel.add(secondWidget);
    widgetHorizontalPanel.getElement().setAttribute("cellPadding", "2");
    widgetHorizontalPanel.setSpacing(1);
    widgetHorizontalPanel.addStyleName("panelWidth");
    secondWidget.setVisible(false);/*from w w w  . ja  va 2s .  co  m*/
    secondWidget.setWidth("100px");
    secondWidget.addStyleName("panelLabelStyle");
    if (!url.equalsIgnoreCase(CoreCommonConstant.EMPTY_STRING)) {
        String currentURL = Window.Location.getHref();
        String baseUrl = currentURL.substring(0, currentURL.lastIndexOf('/'));
        StringBuffer newUrl = new StringBuffer();
        newUrl.append(baseUrl).append(url);
        if (currentURL.equalsIgnoreCase(newUrl.toString())) {
            widgetHorizontalPanel.addStyleName("setSelectedPageStyle");
        }
    }
    widgetHorizontalPanel.addDomHandler(new MouseOverHandler() {

        public void onMouseOver(MouseOverEvent event) {
            widgetHorizontalPanel.addStyleName("horizontalPanelMouseHover");
            if (null != previosMenuBar) {
                previosMenuBar.closeAllChildren(false);
            }
        }
    }, MouseOverEvent.getType());

    widgetHorizontalPanel.addDomHandler(new MouseOutHandler() {

        public void onMouseOut(MouseOutEvent event) {
            widgetHorizontalPanel.removeStyleName("horizontalPanelMouseHover");
        }
    }, MouseOutEvent.getType());
    widgetHorizontalPanel.addDomHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            if (!url.equalsIgnoreCase(CoreCommonConstant.EMPTY_STRING)) {
                String href = Window.Location.getHref();
                String baseUrl = href.substring(0, href.lastIndexOf('/'));
                StringBuffer newUrl = new StringBuffer();
                newUrl.append(baseUrl).append(url);
                Window.Location.assign(newUrl.toString());
            }
        }
    }, ClickEvent.getType());
    return widgetHorizontalPanel;
}

From source file:com.ephesoft.gxt.login.client.LoginEntryPoint.java

License:Open Source License

@Override
public void onLoad() {
    Window.setTitle(LocaleDictionary.getConstantValue(LoginConstants.LOGIN_TITLE));

    Label userName = new Label(LocaleDictionary.getConstantValue(LoginConstants.login_username));
    Label password = new Label(LocaleDictionary.getConstantValue(LoginConstants.login_password));
    RootPanel.get("loginHeader").getElement()
            .setInnerText(LocaleDictionary.getConstantValue(LoginConstants.login_button_text));
    RootPanel.get("j_username").getElement().setAttribute("placeholder", userName.getText());
    RootPanel.get("j_username").getElement().focus();
    RootPanel.get("j_password").getElement().setAttribute("placeholder", password.getText());
    final Label versionNumber = new Label();

    ((LoginRemoteServiceAsync) createRpcService()).getProductVersion(new AsyncCallback<String>() {

        @Override//from w  w w. java2 s  .c om
        public void onSuccess(String version) {
            versionNumber.setText(version);
            RootPanel.get("versionLabel").getElement().setInnerText(versionNumber.getText());
        }

        @Override
        public void onFailure(Throwable arg0) {
            DialogUtil.showMessageDialog(LocaleDictionary.getConstantValue(LocaleCommonConstants.ERROR_TITLE),
                    LocaleDictionary.getConstantValue(LoginConstants.UNABLE_TO_RETRIVE_VERSION_INFO),
                    DialogIcon.ERROR);

        }
    });

    final Label expiryMsg = new Label();
    final Label failOverMsg = new Label();
    ((LoginRemoteServiceAsync) createRpcService()).getLicenseExpiryMsg(new AsyncCallback<Void>() {

        @Override
        public void onFailure(Throwable arg0) {
            String alertMsg = arg0.getLocalizedMessage();
            int indexOfDelimiter = alertMsg.indexOf('@');
            String days = alertMsg.substring(0, indexOfDelimiter);
            int remainingDays = Integer.parseInt(days);
            String dateString = alertMsg.substring(indexOfDelimiter + 1);
            if (remainingDays != 0) {
                expiryMsg.setText(
                        LocaleDictionary.getMessageValue(LoginMessages.LICENSE_EXPIRY_MSG, days, dateString));
            } else {
                expiryMsg.setText(LocaleDictionary.getMessageValue(LoginMessages.LICENSE_EXPIRY_MSG_TODAY));
            }
            expiryMsg.addStyleName(FONT_RED_CSS);
            expiryMsg.addStyleName(BOLD_TEXT_CSS);
            RootPanel.get(EXPIRY_MSG_LEBEL).getElement().setInnerText(expiryMsg.getText());
            RootPanel.get(EXPIRY_MSG_LEBEL).addStyleName(expiryMsg.getStyleName());
        }

        @Override
        public void onSuccess(Void arg0) {
        }
    });

    ((LoginRemoteServiceAsync) createRpcService()).getFailOverMessage(new AsyncCallback<Boolean>() {

        @Override
        public void onSuccess(Boolean result) {
            if (true == result) {
                // failOverMsg.setText("");
            } else {
                failOverMsg.setText(LocaleDictionary.getMessageValue(LoginMessages.FAILOVER_MSG));
                failOverMsg.addStyleName(FONT_RED_CSS);
                failOverMsg.addStyleName(BOLD_TEXT_CSS);
                RootPanel.get(FAIL_OVER_LABEL).getElement().setInnerText(failOverMsg.getText());
                RootPanel.get(FAIL_OVER_LABEL).addStyleName(failOverMsg.getStyleName());
            }
        }

        @Override
        public void onFailure(Throwable arg0) {

        }

    });
    final HorizontalPanel horPanel = new HorizontalPanel();
    horPanel.addStyleName("horizontalPanel");
    RootPanel.get().add(horPanel);
    ScreenMaskUtility.maskScreen(LocaleDictionary.getMessageValue(LoginMessages.LOADING));
    rpcService.getFooterProperties(new AsyncCallback<Map<String, String>>() {

        @Override
        public void onSuccess(Map<String, String> footerProperties) {
            footerText = footerProperties.get(CoreCommonConstants.FOOTER_TEXT_KEY);
            footerLink = footerProperties.get(CoreCommonConstants.FOOTER_LINK_KEY);
            final Anchor footerInfo = new Anchor(footerText, footerLink);
            horPanel.addStyleName("loginFooter");
            horPanel.add(footerInfo);
            horPanel.setCellHorizontalAlignment(footerInfo, HasHorizontalAlignment.ALIGN_CENTER);
            ScreenMaskUtility.unmaskScreen();
        }

        @Override
        public void onFailure(Throwable arg0) {
            ScreenMaskUtility.unmaskScreen();
            DialogUtil.showMessageDialog(LocaleDictionary.getConstantValue(LocaleCommonConstants.ERROR_TITLE),
                    LocaleDictionary.getMessageValue(LoginMessages.APPLICATION_NOT_AUTHORIZED),
                    DialogIcon.ERROR);
        }
    });
    RootPanel.get("error").getElement()
            .setInnerText(LocaleDictionary.getConstantValue(LoginConstants.INVALID_CREDENTIALS));
    RootPanel.get("error").addStyleName(FONT_RED_CSS);

    SubmitButton submitButton = new SubmitButton();
    //            (SubmitButton) SubmitButton.wrap(RootPanel.get("button").getElement());
    // submitButton.setFocus(true);

    submitButton.getElement().setTitle(LocaleDictionary.getConstantValue(LoginConstants.login_button_text));
    submitButton.getElement().setInnerHTML("<i class=\"icon-arrow-right icon-large\"></i>");
    submitButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            login();
        }
    });

    submitButton.setStyleName("gwt-Button");
    RootPanel.get("button").getElement().addClassName("submit");
    RootPanel.get("button").add(submitButton);

}

From source file:com.ephesoft.gxt.rv.client.widget.ThumbnailWidgetPanel.java

License:Open Source License

@Override
protected Widget createWidget() {
    if (null != document) {
        final List<String> thumbnailNamesList = BatchSchemaUtil.getThumbnails(document);
        List<Image> thumbnailImages = null;
        Image thumbnailImage = new Image();
        if (!CollectionUtil.isEmpty(thumbnailNamesList)) {
            thumbnailImages = new ArrayList<Image>();
            for (final String thumbnailName : thumbnailNamesList) {
                thumbnailImage = new Image(ReviewValidateNavigator.getAbsoluteURL(thumbnailName));
                thumbnailImages.add(thumbnailImage);
            }/*from   w  w  w. j  av a 2  s.  c  o  m*/
        }
        panel = new VerticalPanel();
        panel.addStyleName("documentStack");
        documentNameLabel = new Label(getDocumentTypeDisplayText(document));
        documentNameLabel = new Label(document.getType());
        final HorizontalPanel horizontalPanel = new HorizontalPanel();
        horizontalPanel.setSpacing(5);
        documentNameLabel.addStyleName("highlightedLabel");
        horizontalPanel.add(new Label(docIdentifier));
        horizontalPanel.add(documentNameLabel);
        final ThumbnailStack thumbnailStack = new ThumbnailStack(thumbnailImages);
        panel.add(horizontalPanel);
        panel.add(thumbnailStack);
    }
    return panel;
}