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

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

Introduction

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

Prototype

public void setCellVerticalAlignment(IsWidget w, VerticalAlignmentConstant align) 

Source Link

Document

Overloaded version for IsWidget.

Usage

From source file:org.jboss.errai.workspaces.client.layout.WorkspaceLayout.java

License:Apache License

private Panel createNavigator() {
    leftPanel.addStyleName("workspace-LeftNavArea");

    final HorizontalPanel topNavPanel = new HorizontalPanel();
    topNavPanel.setWidth("100%");
    topNavPanel.setHeight("20px");
    topNavPanel.setStyleName("workspace-NavHeader");

    navigationLabel.setStyleName("workspace-NavHeaderText");
    topNavPanel.add(navigationLabel);//ww w . j  a  va  2s .  c o m

    final ImageResource collapseLeft = erraiImageBundle.collapseLeft();
    final ImageResource collapseRight = erraiImageBundle.collapseRight();
    final Image collapseButton = new Image(collapseLeft);
    collapseButton.setStyleName("workspace-NavCollapseButton");

    collapseButton.addClickHandler(new ClickHandler() {
        private boolean collapse = false;

        public void onClick(ClickEvent event) {
            if (!collapse) {
                Timer timer = new Timer() {
                    int i = navigation.getOffsetWidth();
                    int step = 10;

                    public void run() {
                        i -= step;

                        setSize();

                        if (i <= 12) {
                            cancel();
                            i = 12;
                            setSize();
                            navigation.setWidth(i + "px");
                            leftPanel.setArmed(true);
                            collapseNavPanel();
                        }
                    }

                    private void setSize() {
                        leftPanel.setWidth(i + "px");
                        leftPanel.setHeight("100%");
                    }
                };

                timer.scheduleRepeating(10);

                navigation.setVisible(false);
                navigationLabel.setVisible(false);

                collapseButton.setUrl(collapseRight.getURL());
            } else {
                leftPanel.setArmed(false);
                Timer timer = new Timer() {
                    int i = 12;
                    int step = 1;

                    public void run() {
                        i += step++;

                        setSize();

                        if (i >= 175) {
                            cancel();
                            i = 175;
                            setSize();
                            openNavPanel();
                        }
                    }

                    private void setSize() {
                        leftPanel.setWidth(i + "px");
                        leftPanel.setHeight("0");
                    }
                };

                if (navigation.getOffsetWidth() == 0)
                    timer.scheduleRepeating(20);
                collapseButton.setUrl(collapseLeft.getURL());
            }

            collapse = !collapse;
        }
    });

    topNavPanel.add(collapseButton);
    topNavPanel.setCellWidth(collapseButton, "21px");
    topNavPanel.setCellVerticalAlignment(collapseButton, HasVerticalAlignment.ALIGN_MIDDLE);
    topNavPanel.setCellVerticalAlignment(navigationLabel, HasVerticalAlignment.ALIGN_MIDDLE);

    leftPanel.add(topNavPanel);
    leftPanel.setCellHeight(topNavPanel, "23px");

    leftPanel.add(navigation);
    leftPanel.setCellHeight(navigation, "100%");

    navigation.setWidth("175px");
    leftPanel.setArmed(false);

    return leftPanel;
}

From source file:org.kaaproject.avro.ui.gwt.client.widget.BusyPopup.java

License:Apache License

public BusyPopup() {
    glass = Document.get().createDivElement();
    glass.setClassName(Utils.avroUiStyle.busyGlass());

    glass.getStyle().setPosition(Position.ABSOLUTE);
    glass.getStyle().setLeft(0, Unit.PX);
    glass.getStyle().setTop(0, Unit.PX);
    glass.getStyle().setZIndex(GLASS_Z_INDEX);

    getElement().getStyle().setZIndex(POPUP_Z_INDEX);

    HorizontalPanel panel = new HorizontalPanel();
    panel.setSize("320px", "70px");
    panel.addStyleName(Utils.avroUiStyle.busyPopup());
    Image image = new Image();
    image.setResource(Utils.resources.busyIndicator());
    panel.add(image);//from   w w  w . j ava 2 s  . co  m
    panel.setCellWidth(image, "60px");
    panel.setCellHorizontalAlignment(image, HasHorizontalAlignment.ALIGN_CENTER);
    panel.setCellVerticalAlignment(image, HasVerticalAlignment.ALIGN_MIDDLE);
    Label label = new Label();
    label.setText(Utils.constants.busyPopupText());
    label.getElement().getStyle().setPaddingRight(15, Unit.PX);
    panel.add(label);
    panel.setCellHorizontalAlignment(label, HasHorizontalAlignment.ALIGN_CENTER);
    panel.setCellVerticalAlignment(label, HasVerticalAlignment.ALIGN_MIDDLE);
    setWidget(panel);

}

From source file:org.kie.guvnor.guided.rule.client.editor.ActionValueEditor.java

License:Apache License

private Widget wrap(Widget w) {
    HorizontalPanel wrapper = new HorizontalPanel();
    Image clear = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
    clear.setAltText(Constants.INSTANCE.RemoveActionValueDefinition());
    clear.setTitle(Constants.INSTANCE.RemoveActionValueDefinition());
    clear.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            //Reset Constraint's value and value type
            if (Window.confirm(Constants.INSTANCE.RemoveActionValueDefinitionQuestion())) {
                value.setNature(FieldNatureType.TYPE_UNDEFINED);
                value.setValue(null);/*from w  ww. ja  v  a  2  s . com*/
                doTypeChosen();
            }
        }

    });

    wrapper.add(w);
    if (!this.readOnly) {
        wrapper.add(clear);
        wrapper.setCellVerticalAlignment(clear, HasVerticalAlignment.ALIGN_MIDDLE);
    }
    return wrapper;
}

From source file:org.kie.guvnor.guided.rule.client.editor.ConstraintValueEditor.java

License:Apache License

private Widget wrap(Widget w) {
    if (this.readOnly) {
        return w;
    }//  w  ww . ja  v  a  2s.c  o m
    HorizontalPanel wrapper = new HorizontalPanel();
    Image clear = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
    clear.setTitle(Constants.INSTANCE.RemoveConstraintValueDefinition());
    clear.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            //Reset Constraint's value and value type
            if (Window.confirm(Constants.INSTANCE.RemoveConstraintValueDefinitionQuestion())) {
                constraint.setConstraintValueType(BaseSingleFieldConstraint.TYPE_UNDEFINED);
                constraint.setValue(null);
                constraint.clearParameters();
                constraint.setExpressionValue(new ExpressionFormLine());
                doTypeChosen();
            }
        }

    });

    wrapper.add(w);
    if (!this.readOnly) {
        wrapper.add(clear);
        wrapper.setCellVerticalAlignment(clear, HasVerticalAlignment.ALIGN_MIDDLE);
    }
    return wrapper;
}

From source file:org.kuali.continuity.admin.main.client.Setting.java

License:Educational Community License

public void onModuleLoad() {

    RootPanel rootPanel = RootPanel.get("gwtRoot");
    rootPanel.setWidth("760px");

    VerticalPanel vp = new VerticalPanel();
    vp.add(new HTML("<h1>Setup System Parameters</h1>"));
    switchAccessOnoffHTML.setWidth("282px");
    vp.add(switchAccessOnoffHTML);/*from w ww. jav a2s.co  m*/

    HorizontalPanel switchAccessPanel = new HorizontalPanel();
    switchAccessPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
    switchAccessPanel.setWidth("700px");
    switchAccessPanel.add(locationLabel);

    locationTextLabel.setWidth("151px");
    locationTextLabel.setText("");
    locationTextLabel.addStyleName("settings-read-only");

    locationTextBox.setText("");
    locationTextBox.setReadOnly(true);
    locationTextBox.setStyleName("SettingsLocationTextBox");
    locationTextBox.setWidth("300px");
    //      locationTextBox.addStyleName("SettingsLocationTextBox");
    //      locationTextBox.setStylePrimaryName("SettingsLocationTextBox");

    //      switchAccessPanel.add(locationTextLabel);
    switchAccessPanel.add(locationTextBox);
    switchAccessPanel.add(accessLabel);
    switchAccessPanel.add(accessListBox);
    switchAccessPanel.setCellVerticalAlignment(locationLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    switchAccessPanel.setCellVerticalAlignment(accessLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    switchAccessPanel.setCellVerticalAlignment(locationTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    switchAccessPanel.setCellVerticalAlignment(accessListBox, HasVerticalAlignment.ALIGN_MIDDLE);

    vp.add(switchAccessPanel);

    final Label usingThisControlLabel = new HTML(
            "<p class='StandardWidth'>Using this control, an Institution Administrator or Local Administrator can specify who may access this planning tool, at any location under his/her control. One use of this is to \"turn off\" access to end-users (\"Local Users\") while customization is being done to the application</p>");
    vp.add(usingThisControlLabel);

    // --- test mode
    vp.add(testModePanel);
    testModePanel.add(new HTML("<hr style='margin-top:10px;'/>"));
    testModePanel.add(new HTML("<h3>Testing mode:</h3>"));
    testModePanel.add(testModeCheckBox);
    testModeCheckBox.setHTML(
            "<span class=\"gwt-HTML-location\">&nbsp;&nbsp;Check here to place the system in Testing Mode.  Testing Mode temporarily disables the automated email messages that are generated when you add a person's name onto the Add/Remove User screen, or when you approve/deny a password request on the Moderator's Approval screen.   Do this when testing, troubleshooting, setting up plans, etc. to avoid sending unwanted emails.   Uncheck to turn back on.</span>");
    FlexTable testModeTable = new FlexTable();
    testModeTable.setWidth("700px");
    testModeTable.getFlexCellFormatter().setColSpan(0, 0, 2);
    testModeTable.setHTML(0, 0, "<span class=\"gwt-HTML-location\">&nbsp;</span>");
    testModeTable.getFlexCellFormatter().setColSpan(1, 0, 2);
    testModeTable.setHTML(1, 0, "<span class=\"gwt-HTML-location\">Please note:</span>");
    testModeTable.setHTML(2, 0, "<span class=\"gwt-HTML-location\">(1)&nbsp;</span>");
    testModeTable.setHTML(2, 1,
            "<span class=\"gwt-HTML-location\">Testing Mode disables only the emails that would be generated by YOU.  Testing Mode has no impact on other users:  they will continue to experience normal system behavior.</span>");
    testModeTable.setHTML(3, 0, "<span class=\"gwt-HTML-location\">(2)&nbsp;</span>");
    testModeTable.setHTML(3, 1,
            "<span class=\"gwt-HTML-location\">Testing Mode disables only those emails generated by the Add/Remove User screen and by the Moderator's Approval screen.  Emails generated by the login screens (to create a new account, or replace a forgotten password) will continue to be generated as normal.</span>");
    testModeTable.setHTML(4, 0, "<span class=\"gwt-HTML-location\">(3)&nbsp;</span>");
    testModeTable.setHTML(4, 1,
            "<span class=\"gwt-HTML-location\">Emails are never generated by the Manage User Accounts screen, so that screen is not of concern.</span>");
    testModePanel.add(testModeTable);

    // -- email
    VerticalPanel emailVPanel = new VerticalPanel();
    vp.add(emailVPanel);
    emailVPanel.add(new HTML("<hr style='margin-top:10px;'/>"));
    emailVPanel.add(new HTML("<h3>Return Address for System-Generated Emails:</h3>"));
    emailVPanel.add(new HTML(
            "<p class=\"StandardWidth\">Under certain circumstances, this tool will generate &amp; send emails to users (details are given in the Administrator's Manual).</p>"
                    + "<p class=\"StandardWidth\">Please choose here the <span style='font-weight:bold;'>return address</span> that will be displayed on these emails.</p>"
                    + "<ul class=\"bulletlist\">"
                    + "<li>You might  use the email address of one of  your Local Administrators</li>"
                    + "<li>You might use  the address of  a departmental email account, if you have one; or</li>"
                    + "<li>You might create a special email account for this purpose.</li>" + "</ul><p>"
                    + "<p class=\"StandardWidth\">Keep in mind that  recipients are often reluctant  to open emails that have odd-looking  return addresses.</p>"
                    + "<p class=\"StandardWidth\">You may change this return address at any time in future by simply entering a new address here.</p>"));
    emailVPanel.add(emailPanel);
    emailPanel.setWidth("700px");
    HTML emailLabel = new HTML(
            "<span style='font-weight:bold;'>Return address for system-generated emails:</span>");
    emailTextBox.setStyleName("SettingDomainTextBox");
    emailTextBox.setWidth("300px");
    emailPanel.add(emailLabel);
    emailPanel.add(emailTextBox);

    // -- screen options
    vp.add(new HTML("<hr style='margin-top:10px;'/>"));
    vp.add(screenOptionsHTML);
    vp.add(showTeamsCheckBox);
    showTeamsCheckBox.setText("Show Teams");
    showTeamsCheckBox.addStyleName("optional-screen-list");
    vp.add(showSkillsCheckBox);
    showSkillsCheckBox.setText("Show Skills");
    showSkillsCheckBox.addStyleName("optional-screen-list");
    vp.add(showStaffingBox);
    showStaffingBox.setText("Show Staffing Requirements");
    showStaffingBox.addStyleName("optional-screen-list");
    vp.add(showExamplesOfCheckBox);
    showExamplesOfCheckBox.setWidth("240px");
    showExamplesOfCheckBox.setText("Show Examples of Critical Functions");
    showExamplesOfCheckBox.addStyleName("optional-screen-list");
    vp.add(replaceStep4);
    replaceStep4.setSize("455px", "22px");
    replaceStep4.setText("Replace Step 4: Instruction with Step 4: Faculty Preparedness");
    replaceStep4.addStyleName("optional-screen-list");

    final HTML theseSettingsControlLabel = new HTML(
            "<p class=\"StandardWidth\">These settings control the display or non-display of certain screens. When checked, the screen in question will appear for ALL users at a location. When un-checked, the screen will be hidden from ALL users at that location.</p>"
                    + "<p class=\"StandardWidth\">These settings apply to one location (campus) only. In a multi-campus institution, the settings would have to be done separately for each campus - they cannot be done for the whole institution.</p>"
                    + "<p class=\"StandardWidth\">These settings do not affect the data in the database. Hence when you switch a screen off, any data displayed on that screen remains in the database and will re-appear if you switch the screen on again at some future time.</p>");
    vp.add(theseSettingsControlLabel);
    theseSettingsControlLabel.setSize("709px", "107px");

    // --- select other optional features
    vp.add(otherPanel);
    otherPanel.add(new HTML("<hr style='margin-top:10px;'/>"));
    otherPanel.add(new HTML("<h3>Select Other Optional Features:</h3>"));
    otherPanel.add(showCriticalLevelCheckBox);
    showCriticalLevelCheckBox.setHTML(
            "&nbsp;&nbsp;<span style='font-weight:bold;'>Detail Screens:</span>  In Step 2 Critical Functions, display the detail screens for ALL functions, "
                    + "regardless of criticality level.  If unchecked, the detail screens will be displayed for functions whose criticality level is one of "
                    + "the top three levels, but will NOT be displayed for functions assigned  the fourth (lowest) level of criticality.");

    // --- select the rule for issuing passwords
    vp.add(modPanel);
    modPanel.setVisible(false);
    modPanel.add(new HTML("<hr style='margin-top:10px;'/>"));

    modPanel.add(new HTML("<h3>Select the Rule for Issuing Passwords:</h3>"));
    modPanel.add(new HTML(
            "<p class='StandardWidth'>This selection applies only when the location (campus) is configured for Direct Login (i.e., when Ariah Continuity issues passwords to users via email). </p>"));

    modPanel.add(radioFull);
    radioFull.setText(
            "Full Moderation (every password request is submitted to the Moderator for approval before a password is issued)");
    radioFull.addStyleName("password-rules-list");
    radioFull.setChecked(true);
    modPanel.add(radioPartial);
    radioPartial.setText(
            "Partial Moderation (issue passwords to users from the following email domains, submit other requests to Moderator):");
    radioPartial.addStyleName("password-rules-list");

    // set token
    String token = Cookies.getCookie(CSRF_TOKEN);
    csrfToken.setValue(token);
    vp.add(csrfToken);

    rootPanel.add(vp);

    // rootPanel.setStyleName("delText");

    // Buttons
    backButton.setStyleName("BackButtonClass");
    saveSettingsButton.setStyleName("SaveButtonClass");
    // SimplePanel rootPanel = new SimplePanel();

    itemService = (SimpleServiceAsync) GWT.create(SimpleService.class);

    backButton.setStyleName("BackButtonClass");

    backButton.setText("Back");
    backButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);
            redirect("/continuity/admin/adminHome");
        }
    });

    saveSettingsButton.setStyleName("SaveButtonClass");
    saveSettingsButton.setText("Save Settings");

    saveSettingsButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);
            invalidEmailHTML.setVisible(false);
            String retEmailAddr = emailTextBox.getText();
            if (retEmailAddr != null && retEmailAddr.trim().length() != 0
                    && !retEmailAddr.matches("^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$")) {
                invalidEmailHTML.setVisible(true);
                return;
            }

            domainList = new ArrayList();
            for (Iterator i = tableRoot.iterator(); i.hasNext();) {

                HorizontalPanel hp = (HorizontalPanel) i.next();
                Label dl = (Label) hp.getWidget(0);
                // Window.alert("Adding "+(String) dl.getText() );
                domainList.add((String) dl.getText());

            }
            boolean ok = true;

            //            if (domainList.size() > 0 && radioFull.isChecked()) {
            //
            //               radioPartial.setChecked(false);
            //               radioFull.setChecked(true);
            //               ok = true;
            //            }
            if (domainList.size() == 0 && radioPartial.isChecked()) {
                ok = false;
                boolean uncheck = Window.confirm(
                        "You have selected partial moderation with no email domains. Do you wish to use full moderation instead?");

                if (!uncheck) {
                    Window.alert(
                            "Please enter email domains for partial moderation, or select full moderation.");
                } else {
                    radioPartial.setChecked(false);
                    radioFull.setChecked(true);
                    ok = true;
                }
            }
            if (ok)
                ok = Window.confirm("Update  System Parameters: " + "are you sure?");
            if (ok) {
                SettingItem item = new SettingItem();
                item.setAccess(new Integer(accessListBox.getValue(accessListBox.getSelectedIndex())));
                Boolean[] opts = { false, false, false, false, false, false };
                opts[SettingItem.optionType.Teams.ordinal()] = showTeamsCheckBox.isChecked();
                opts[SettingItem.optionType.Skills.ordinal()] = showSkillsCheckBox.isChecked();
                opts[SettingItem.optionType.Staffing.ordinal()] = showStaffingBox.isChecked();
                opts[SettingItem.optionType.Functions.ordinal()] = showExamplesOfCheckBox.isChecked();
                opts[SettingItem.optionType.Replace.ordinal()] = !replaceStep4.isChecked();
                opts[SettingItem.optionType.CriticalityLevel.ordinal()] = showCriticalLevelCheckBox.isChecked();

                item.setOptions(opts);
                // ArrayList<String> domainList = new ArrayList();

                // admin email disabled
                item.setInTestMode(testModeCheckBox.isChecked());

                if (radioFull.isChecked()) {
                    item.setFullModeration("1");
                } else if (radioPartial.isChecked()) {
                    item.setFullModeration("2");
                }

                item.setSystemName(systemNameTextBox.getText());
                item.setEmail(emailTextBox.getText());
                item.setCsrfToken(csrfToken.getValue());

                String str[] = new String[domainList.size()];
                domainList.toArray(str);
                item.setDomainList(str);
                String[] str2 = item.getDomainList();
                // String slist="";
                // for (String s: str) {
                // slist+=s+" ";
                // }
                // Window.alert("Saving: "+slist);
                itemService.updateItem("setting", item, updateItemCallback);

            }

        }
    });

    final HorizontalPanel buttonPanel = new HorizontalPanel();

    buttonPanel.add(backButton);
    buttonPanel.add(saveSettingsButton);

    final HorizontalPanel domainPanel = new HorizontalPanel();
    modPanel.add(domainPanel);

    //      vp.add(domainPanel);
    final Label allowThisDomainLabel = new Label("Allow this domain (e.g. tufts.edu, tuftsfund.org):");
    domainPanel.add(allowThisDomainLabel);
    allowThisDomainLabel.setWidth("284px");
    allowThisDomainLabel.addStyleName("SettingAllowThisDomainLabel");

    domainPanel.add(domainTextBox);
    domainTextBox.setSize("255px", "20px");
    domainTextBox.setStyleName("SettingDomainTextBox");

    final Button addButton = new Button();

    domainPanel.add(addButton);
    addButton.setSize("103px", "22px");
    addButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            // Label listItem = new Label();
            // listItem.setText(domainTextBox.getText());
            // domainList.add(listItem);

            addDomain();

        }
    });
    addButton.setStyleName("ButtonClass");
    addButton.setText("Add to List");

    // Setup test code: delete
    final Label domain1 = new Label("l1");
    // rootPanel.add(domain1, 345, 460);
    domain1.setSize("255px", "15px");

    final Label del1 = new Label("delete");
    // rootPanel.add(del1, 620, 460);
    //del1.setStylePrimaryName("gwt-Labeld");
    del1.setStyleName("SettingDomainDeleteLink");
    del1.setSize("47px", "15px");

    formLoad();
    tableRoot = new VerticalPanel();
    tableRoot.addStyleName("domain_list");
    //tableRoot.addStyleName("partial-moderation-margin");

    HTML allowedDomainLab = new HTML("<p><strong>Allowed Domains:</strong></p>");
    allowedDomainLab.addStyleName("SettingAllowDomainLabel");
    modPanel.add(allowedDomainLab);

    modPanel.add(tableRoot);
    tableRoot.setWidth("300px");

    vp.add(new HTML("<hr style='margin-top:10px;'/>"));
    vp.add(new HTML("<h3>Create a Name for this Planning Tool:</h3>"));
    vp.add(new HTML(
            "<p class='StandardWidth'>Please enter here a name for your local version of the Ariah Continuity tool.  This name will appear in the system-generated emails that notify users about new accounts, passwords, etc.   Some possible examples:  Indiana Ready, UBC Ready, Penn State Continuity Planner.  For consistency, please use the same name as will appear in your custom graphics at the top of every page.</p>"));
    systemNameTextBox.setSize("644px", "20px");

    systemNameTextBox.setMaxLength(1000);
    systemNameTextBox.setStyleName("SettingDomainTextBox");
    vp.add(systemNameTextBox);

    vp.add(new HTML("<hr style='margin-top:10px;'/>"));

    invalidEmailHTML.setVisible(false);
    vp.add(invalidEmailHTML);
    vp.add(buttonPanel);

}

From source file:org.ned.server.nedadminconsole.client.dialogs.NedUploadDialog.java

License:Open Source License

public NedUploadDialog(String libId, NedDataModel model) {
    setSize("395px", "147px");

    this.model = model;
    setHTML(NedRes.instance().uploadDlgUploadFile());

    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    setWidget(verticalPanel);/* w  w w .jav  a  2s. co m*/
    verticalPanel.setSize("386px", "100px");

    uploadForm = new FormPanel();
    uploadForm.setAction("NedFileUploadServlet");
    uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART);
    uploadForm.setMethod(FormPanel.METHOD_POST);
    verticalPanel.add(uploadForm);
    uploadForm.setSize("100%", "100%");

    VerticalPanel verticalPanel_1 = new VerticalPanel();
    uploadForm.setWidget(verticalPanel_1);
    verticalPanel_1.setSize("100%", "77px");

    horizontalPanel_2 = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel_2);
    horizontalPanel_2.setWidth("100%");

    fileUpload = new FileUpload();
    horizontalPanel_2.add(fileUpload);
    horizontalPanel_2.setCellWidth(fileUpload, "100%");
    fileUpload.setName("fileUpload");
    verticalPanel_1.setCellHorizontalAlignment(fileUpload, HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel_1.setCellVerticalAlignment(fileUpload, HasVerticalAlignment.ALIGN_MIDDLE);
    fileUpload.setSize("100%", "30px");

    hiddenLibId = new Hidden("libId");
    horizontalPanel_2.add(hiddenLibId);
    hiddenLibId.setValue(libId);

    hiddenContentId = new Hidden("contentId");
    horizontalPanel_2.add(hiddenContentId);
    hiddenContentId.setValue(model.getCurrentObject().id);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    verticalPanel_1.add(horizontalPanel);
    horizontalPanel.setWidth("100%");
    verticalPanel_1.setCellHorizontalAlignment(horizontalPanel, HasHorizontalAlignment.ALIGN_CENTER);

    Button uploadBtn = new Button(NedRes.instance().uploadDlgUpload());
    horizontalPanel.add(uploadBtn);
    uploadBtn.setWidth("90%");
    horizontalPanel.setCellWidth(uploadBtn, "50%");
    horizontalPanel.setCellHorizontalAlignment(uploadBtn, HasHorizontalAlignment.ALIGN_CENTER);
    horizontalPanel.setCellVerticalAlignment(uploadBtn, HasVerticalAlignment.ALIGN_MIDDLE);
    uploadBtn.addClickHandler(new UploadFileClickHandler());
    verticalPanel.setCellVerticalAlignment(uploadBtn, HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setCellHorizontalAlignment(uploadBtn, HasHorizontalAlignment.ALIGN_CENTER);

    closeBtn = new Button(NedRes.instance().close());
    horizontalPanel.add(closeBtn);
    closeBtn.setWidth("90%");
    horizontalPanel.setCellWidth(closeBtn, "50%");
    horizontalPanel.setCellVerticalAlignment(closeBtn, HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.setCellHorizontalAlignment(closeBtn, HasHorizontalAlignment.ALIGN_CENTER);
    closeBtn.addClickHandler(new CloseClickHandler());

    setPopupPosition(200, 200);

    uploadForm.addSubmitHandler(new SubmitHandlerUploadFile());

    uploadForm.addSubmitCompleteHandler(new SubmitCompleteHandlerUploadFile());

    center();
}

From source file:org.onecmdb.ui.gwt.modeller.client.control.ModelInheritanceTreeControl.java

License:Open Source License

public Widget getWidget(final Object data) {
    HorizontalPanel hpanel = (HorizontalPanel) super.getWidget(data);
    if (data instanceof GWT_CiBean) {
        final GWT_CiBean bean = (GWT_CiBean) data;

        final Image popup = new Image("images/eclipse/tree_menu2.gif");
        hpanel.add(popup);/*from   w  w  w. ja  v  a  2  s . c  o  m*/
        hpanel.setCellVerticalAlignment(popup, VerticalPanel.ALIGN_MIDDLE);
        popup.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                System.out.println("Menu popup...");
                final PopupPanel p = new PopupPanel(true);
                //p.setStyleName("popup-menu");
                Command newInstance = new Command() {
                    public void execute() {
                        p.hide();
                        OneCMDBModelCreator.get().showScreen(OneCMDBModelCreator.NEW_INSTANCE_SCREEN,
                                bean.getAlias(), new Long(0));
                    }
                };
                Command newTemplate = new Command() {
                    public void execute() {
                        p.hide();
                        OneCMDBModelCreator.get().showScreen(OneCMDBModelCreator.NEW_TEMPLATE_SCREEN,
                                bean.getAlias(), new Long(0));
                    }
                };
                Command delete = new Command() {
                    public void execute() {
                        p.hide();
                        delete(bean);
                    }
                };

                // Make some sub-menus that we will cascade from the top menu.
                MenuBar fooMenu = new MenuBar(true);
                if (bean.isTemplate()) {
                    fooMenu.addItem("New Instance", newInstance);
                    fooMenu.addItem("New Template", newTemplate);
                }
                fooMenu.addItem("Delete", delete);

                p.setPopupPosition(popup.getAbsoluteLeft(), popup.getAbsoluteTop());
                p.setWidget(fooMenu);
                p.show();
            }

        });
    }
    return (hpanel);
}

From source file:org.onecmdb.ui.gwt.toolkit.client.view.input.CIMultiValueWidget.java

License:Open Source License

protected Widget getMultiListAsList(final MultipleAttributeValue mValue) {
    final HorizontalPanel hPanel = new HorizontalPanel();
    CIIconWidget icon = new CIIconWidget(mValue.getType());
    icon.update();//from w  ww.  j ava2  s.  c om
    hPanel.setWidth("100%");
    hPanel.add(icon);
    hPanel.setCellHorizontalAlignment(icon, HorizontalPanel.ALIGN_LEFT);
    Label name = new Label(mValue.getDisplayName());
    hPanel.add(name);
    HorizontalPanel actionPanel = new HorizontalPanel();
    actionPanel.setSpacing(6);

    if (!mValue.getCtrl().isReadonly()) {
        // Add action
        if (mValue.isComplex()) {
            addImage = new Image("images/eclipse/add_multi.gif");
            addImage.setTitle("Select values to the multi valued attribute");
        } else {
            addImage = new Image("images/eclipse/add_single.gif");
            addImage.setTitle("Add one value to the multi valued attribute");
        }
        actionPanel.add(addImage);

        // Delete all action
        Image deleteAllImage = new Image("images/delete-value.gif");
        deleteAllImage.setTitle("Remove ALL values!");
        actionPanel.add(deleteAllImage);
        deleteAllImage.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                if (Window.confirm("Remove all values for attribute?")) {
                    mValue.removeAttributeValues();
                    clearValues();
                }
            }

        });
        actionPanel.add(deleteAllImage);
    }

    // Expand action
    expandImage = new Image();
    expandImage.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            setExpandState(!expandState);
        }
    });
    setExpandState(true);

    actionPanel.add(expandImage);
    actionPanel.setCellVerticalAlignment(expandImage, VerticalPanel.ALIGN_MIDDLE);

    hPanel.add(actionPanel);
    hPanel.setCellHorizontalAlignment(actionPanel, HorizontalPanel.ALIGN_RIGHT);
    vPanel.add(hPanel);
    vPanel.add(valuePanel);
    return (vPanel);
}

From source file:org.onecmdb.ui.gwt.toolkit.client.view.popup.DragablePopup.java

License:Open Source License

public void load() {
    VerticalPanel panel = new VerticalPanel();
    HorizontalPanel header = new HorizontalPanel();
    header.setStyleName("one-select-popup-header");
    header.setWidth("100%");
    Label headerLabel = new Label(title);
    Image close = new Image("images/eclipse/close.gif");
    header.add(headerLabel);//w  w w . j  a v  a2  s  .  c o  m
    header.add(close);

    header.setCellHorizontalAlignment(headerLabel, HorizontalPanel.ALIGN_LEFT);
    header.setCellHorizontalAlignment(close, HorizontalPanel.ALIGN_RIGHT);
    header.setCellVerticalAlignment(close, HorizontalPanel.ALIGN_MIDDLE);

    // Add drag control.
    new DragControl(this, headerLabel);

    close.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            hide();
        }
    });
    panel.add(header);
    panel.add(content);

    panel.setCellVerticalAlignment(header, VerticalPanel.ALIGN_TOP);
    panel.setCellVerticalAlignment(content, VerticalPanel.ALIGN_TOP);
    panel.setCellHeight(content, "100%");
    setWidget(panel);
}

From source file:org.onecmdb.ui.gwt.toolkit.client.view.popup.SelectCIPopup.java

License:Open Source License

protected void load() {
    VerticalPanel panel = new VerticalPanel();
    HorizontalPanel header = new HorizontalPanel();
    header.setStyleName("one-select-popup-header");
    header.setWidth("100%");
    Label headerLabel = new Label(headerText);
    Image close = new Image("images/eclipse/close.gif");
    header.add(headerLabel);//  w  w  w  .j  a va  2 s  .c  om
    if (control instanceof SelectMultipleDataSourceControl) {
        HTML submit = new HTML("[<a href='javascript:;'>save</a>]");
        submit.setStyleName("one-submit-label");
        submit.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                control.getSelectListener()
                        .onSelect(((SelectMultipleDataSourceControl) control).getSelection());
            }
        });
        header.add(submit);
        header.setCellHorizontalAlignment(submit, HorizontalPanel.ALIGN_RIGHT);
    }

    header.add(close);

    header.setCellHorizontalAlignment(headerLabel, HorizontalPanel.ALIGN_LEFT);
    header.setCellHorizontalAlignment(close, HorizontalPanel.ALIGN_RIGHT);
    header.setCellVerticalAlignment(close, HorizontalPanel.ALIGN_MIDDLE);

    // Add drag control.
    new DragControl(this, headerLabel);

    close.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            hide();
        }
    });

    setStyleName("one-select-popup");

    control.setRootState(true);
    CITreeWidget templateTreeWidget = new CITreeWidget(control);

    templateTreeWidget.setSize("100%", "100%");
    ScrollPanel content = new ScrollPanel(templateTreeWidget);
    content.setHeight("300px");
    panel.add(header);
    panel.add(content);

    //panel.setCellVerticalAlignment(header, VerticalPanel.ALIGN_TOP);
    panel.setCellHeight(content, "100%");
    panel.setCellWidth(content, "100%");
    panel.setCellVerticalAlignment(content, VerticalPanel.ALIGN_TOP);
    setWidget(panel);

}