Example usage for com.google.gwt.user.client.ui DockPanel SOUTH

List of usage examples for com.google.gwt.user.client.ui DockPanel SOUTH

Introduction

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

Prototype

DockLayoutConstant SOUTH

To view the source code for com.google.gwt.user.client.ui DockPanel SOUTH.

Click Source Link

Document

Specifies that a widget be added at the south edge of the dock.

Usage

From source file:org.jboss.bpm.console.client.task.OpenTasksView.java

License:Open Source License

public Widget asWidget() {
    panel = new DockPanel();

    initialize();//from w ww  . j  a v  a  2 s.c  o m

    registerCommonActions(appContext, controller);

    // ----

    /*TaskDetailView assignedDetailView = new TaskDetailView(false);
    controller.addView("AssignedDetailView", assignedDetailView);
    assignedDetailView.initialize();
    registerView(controller, tabPanel, AssignedTasksView.ID, new AssignedTasksView(appContext, assignedDetailView));*/

    controller.addView(OpenTasksView.ID, this);

    // ----

    panel.add(detailsView, DockPanel.SOUTH);
    panel.add(taskList, DockPanel.CENTER);

    return panel;
}

From source file:org.jboss.errai.widgets.client.layout.WSDropShadowLayout.java

License:Apache License

public WSDropShadowLayout(Widget wrappedWidget) {
    DockPanel dockPanel = new DockPanel();

    /**/*  www. j  a  va2s. c  om*/
     * Bad hack to avoid rendering shadow when IE is present.
     */
    if (getUserAgent().indexOf("msie") == -1) {
        HorizontalPanel top = new HorizontalPanel();
        top.setWidth("100%");

        dockPanel.add(top, DockPanel.NORTH);
        dockPanel.setCellWidth(top, "100%");

        SimplePanel topLeftCorner = new SimplePanel();
        topLeftCorner.setStyleName("WSDropShadow-topLeftCorner");
        top.add(topLeftCorner);

        SimplePanel topLeft = new SimplePanel();
        topLeft.setStyleName("WSDropShadow-topLeft");
        top.add(topLeft);

        SimplePanel topMiddle = new SimplePanel();
        topMiddle.setStyleName("WSDropShadow-topMiddle");
        top.add(topMiddle);
        top.setCellWidth(topMiddle, "100%");

        SimplePanel topRight = new SimplePanel();
        topRight.setStyleName("WSDropShadow-topRight");
        top.add(topRight);

        SimplePanel topRightCorner = new SimplePanel();
        topRightCorner.setStyleName("WSDropShadow-topRightCorner");
        top.add(topRightCorner);

        HorizontalPanel bottom = new HorizontalPanel();
        bottom.setWidth("100%");
        dockPanel.add(bottom, DockPanel.SOUTH);
        dockPanel.setCellWidth(bottom, "100%");

        SimplePanel bottomLeftCorner = new SimplePanel();
        bottomLeftCorner.setStyleName("WSDropShadow-bottomLeftCorner");
        bottom.add(bottomLeftCorner);

        SimplePanel bottomLeft = new SimplePanel();
        bottomLeft.setStyleName("WSDropShadow-bottomLeft");
        bottom.add(bottomLeft);

        SimplePanel bottomMiddle = new SimplePanel();
        bottomMiddle.setStyleName("WSDropShadow-bottomMiddle");
        bottom.add(bottomMiddle);
        bottom.setCellWidth(bottomMiddle, "100%");

        SimplePanel bottomRight = new SimplePanel();
        bottomRight.setStyleName("WSDropShadow-bottomRight");
        bottom.add(bottomRight);

        SimplePanel bottomRightCorner = new SimplePanel();
        bottomRightCorner.setStyleName("WSDropShadow-bottomRightCorner");
        bottom.add(bottomRightCorner);

        VerticalPanel left = new VerticalPanel();
        left.setHeight("100%");
        dockPanel.add(left, DockPanel.WEST);
        dockPanel.setCellHeight(left, "100%");

        SimplePanel leftTop = new SimplePanel();
        leftTop.setStyleName("WSDropShadow-leftTop");
        left.add(leftTop);

        SimplePanel leftMiddle = new SimplePanel();
        leftMiddle.setHeight("100%");
        leftMiddle.setStyleName("WSDropShadow-leftMiddle");
        left.add(leftMiddle);
        left.setCellHeight(leftMiddle, "100%");

        SimplePanel leftBottom = new SimplePanel();
        leftBottom.setStyleName("WSDropShadow-leftBottom");
        left.add(leftBottom);

        VerticalPanel right = new VerticalPanel();
        right.setHeight("100%");
        dockPanel.add(right, DockPanel.EAST);
        dockPanel.setCellHeight(right, "100%");

        SimplePanel rightTop = new SimplePanel();
        rightTop.setStyleName("WSDropShadow-rightTop");
        right.add(rightTop);

        SimplePanel rightMiddle = new SimplePanel();
        rightMiddle.setHeight("100%");
        rightMiddle.setStyleName("WSDropShadow-rightMiddle");
        right.add(rightMiddle);
        right.setCellHeight(rightMiddle, "100%");

        SimplePanel rightBottom = new SimplePanel();
        rightBottom.setStyleName("WSDropShadow-rightBottom");
        right.add(rightBottom);

    }
    dockPanel.add(wrappedWidget, DockPanel.CENTER);
    dockPanel.setCellWidth(wrappedWidget, "100%");
    dockPanel.setCellHeight(wrappedWidget, "100%");

    initWidget(dockPanel);
}

From source file:org.jboss.errai.widgets.client.WSModalDialog.java

License:Apache License

public WSModalDialog(String title) {
    window = new WSWindowPanel(title);

    dockPanel = new DockPanel();
    dockPanel.setWidth("400px");

    dockPanel.add(new Image(imageBundle.redFlag()), DockPanel.WEST);
    dockPanel.add(message, DockPanel.CENTER);

    message.getElement().getStyle().setProperty("padding", "0px");

    HorizontalPanel buttonPanel = new HorizontalPanel();

    okButton = new Button("OK");
    okListener = new ClickCallbackListener(this, AcceptsCallback.MESSAGE_OK);
    okButton.addClickHandler(okListener);

    buttonPanel.add(okButton);/*from  ww  w.jav  a2s.co m*/

    cancelButton = new Button("Cancel");
    cancelListener = new ClickCallbackListener(this, AcceptsCallback.MESSAGE_CANCEL);
    cancelButton.addClickHandler(cancelListener);

    dockPanel.add(cancelButton, DockPanel.SOUTH);

    buttonPanel.add(cancelButton);

    dockPanel.add(buttonPanel, DockPanel.SOUTH);
    dockPanel.setCellHorizontalAlignment(buttonPanel, DockPanel.ALIGN_RIGHT);
    dockPanel.setCellHeight(buttonPanel, "45px");

    window.add(dockPanel);
}

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

License:Educational Community License

public void onModuleLoad() {

    RootPanel rootPanel = RootPanel.get("gwtRoot");
    rootPanel.setWidth("642");
    Element screenelement = DOM.getElementById("itemdata");
    Element formelement = DOM.getElementById("formelement");
    Element pluralelement = DOM.getElementById("plural");
    String panelHeight = "250px";
    String planBoxWidth = "275px";

    String pageInfo = screenelement.getTitle();
    String pageTitle = screenelement.getTitle();
    String proxyUrl = "./items.lst";
    itemService = (SimpleServiceAsync) GWT.create(SimpleService.class);

    rootPanel.add(dockPanel);/*from w w  w.j a v  a  2 s . com*/

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

    dockPanel.add(horizontalPanel, DockPanel.NORTH);
    horizontalPanel.setSize("601px", panelHeight);
    VerticalPanel leftPanel = new VerticalPanel();
    leftPanel.add(new Label("Available Plans"));
    leftPanel.add(availablePlanListBox);

    horizontalPanel.add(leftPanel);

    availablePlanListBox.setWidth(planBoxWidth);
    availablePlanListBox.setVisibleItemCount(listBoxHeight);
    availablePlanListBox.addClickListener(new ClickListener() {
        public void onClick(final Widget arg0) {
            if (availablePlanListBox.getSelectedIndex() >= 0)
                if (availablePlanListBox.getSelectedIndex() <= availablePlanListBox.getItemCount()) {
                    int index = availablePlanListBox.getSelectedIndex();
                    Integer planId = Integer.parseInt(availablePlanListBox.getValue(index));

                    criticalFunctionLabel.setText(" - " + availablePlanListBox.getItemText(index));
                    itemService.getStringArray("function", planId, callbackGetFunctions);
                }
        }

    });
    examplePlanListBox.setWidth(planBoxWidth);
    examplePlanListBox.addClickListener(new ClickListener() {
        public void onClick(final Widget arg0) {
            int index = examplePlanListBox.getSelectedIndex();
            if (index >= 0)
                if (index < examplePlanListBox.getItemCount()) {
                    // Window.alert("" +
                    // examplePlanListBox.getSelectedIndex()
                    // + " " + examplePlanListBox.getItemCount());
                    Integer planId = Integer.parseInt(examplePlanListBox.getValue(index));

                    //Window.alert("Before getting plans for plan id " + planId);
                    // criticalFunctionLabel.setText(" - "+examplePlanListBox
                    // .getItemText(index));
                    criticalFunctionLabel.setText(" - " + examplePlanListBox.getItemText(index));
                    itemService.getStringArray("function", planId, callbackGetFunctions);
                }
        }
    });
    availablePlanListBox.addChangeListener(new ChangeListener() {

        public void onChange(Widget arg0) {
            // Window.alert("Double click "+availablePlanListBox.getItemText(
            // availablePlanListBox.getSelectedIndex()));
            addMethod();

        }
    });
    examplePlanListBox.addChangeListener(new ChangeListener() {

        public void onChange(Widget arg0) {
            // Window.alert("Double click "+availablePlanListBox.getItemText(
            // availablePlanListBox.getSelectedIndex()));
            removeMethod();

        }
    });
    itemRootName = pageInfo.toLowerCase();

    VerticalPanel topFiller = new VerticalPanel();
    String midwid = "90px";
    topFiller.setSize(midwid, "90px");
    topFiller.add(new Label(" "));
    midPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    midPanel.add(topFiller);
    horizontalPanel.add(midPanel);

    midPanel.add(addButton);
    addButton.addClickListener(new ClickListener() {
        public void onClick(final Widget arg0) {
            // Get plan from Available Plan List
            // Remove it and add it to example plan List
            addMethod();

        }
    });
    // addButton.setText("Add >");

    VerticalPanel midFiller = new VerticalPanel();
    midFiller.setSize(midwid, "12px");
    midFiller.add(new Label(" "));
    midPanel.add(midFiller);
    midPanel.add(removeButton);
    removeButton.addClickListener(new ClickListener() {
        public void onClick(final Widget arg0) {
            // Get selected item from example Plan List
            // Remove it from selected List and add it to
            // Available list.
            removeMethod();

        }
    });
    // removeButton.setText("< Remove ");
    VerticalPanel rightPanel = new VerticalPanel();
    rightPanel.add(new Label("Selected Plans"));
    rightPanel.add(examplePlanListBox);
    horizontalPanel.add(rightPanel);

    examplePlanListBox.setVisibleItemCount(listBoxHeight);
    examplePlanListBox.addClickListener(new ClickListener() {
        public void onClick(final Widget arg0) {
            // Show functions for the current plan.
            //itemService.getStringArray("function", thisInstitution,callbackGetPlans);
        }
    });

    horizontalPanel_1.setSize("601px", "128px");
    VerticalPanel bottom = new VerticalPanel();
    AbsolutePanel bottomLabelPanel = new AbsolutePanel();
    // HorizontalPanel bottomLabelPanelLeft = new HorizontalPanel();

    // bottomLabelPanelLeft.setWidth("220px");
    // bottomLabelPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    // bottomLabelPanelLeft.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    // bottomLabelPanel.add(bottomLabelPanelLeft);

    final Label cfTitle = new Label("Critical Functions of Plan");
    bottomLabelPanel.add(cfTitle, 0, 0);

    cfTitle.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    // functionLabelPanel.add(spacer);
    criticalFunctionLabel.setStyleName("AttentionClass2");
    bottomLabelPanel.add(criticalFunctionLabel, 140, 0);
    criticalFunctionLabel.setWidth("341px");
    bottomLabelPanel.setHeight("12px");
    criticalFunctionLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    // criticalFunctionLabel.setText("Hi there Joe Smudley");

    // HorizontalPanel functionLabelPanel = new HorizontalPanel();
    // functionLabelPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    // functionLabelPanel.setWidth("136px");

    // bottomLabelPanel.add(functionLabelPanel, 409, 0);

    bottom.add(bottomLabelPanel);
    bottom.add(criticalFunctionsListBox);
    horizontalPanel_1.add(bottom);
    criticalFunctionsListBox.setWidth("642px");
    criticalFunctionsListBox.setVisibleItemCount(10);

    // Button Bar
    backButton.setText("Back");
    backButton.setStyleName("ButtonClass");
    backButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);
            redirect("/continuity/admin/adminHome");
        }
    });
    viewButton.setText("View User-Screen");
    viewButton.setStyleName("ButtonClass");
    viewButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);
            redirect("/continuity/plan/getCriticalFunctionExamples");
        }
    });
    saveButton.setText("Save Selections");
    saveButton.setStyleName("ButtonClass");

    saveButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);
            NamedItem item = new NamedItem();
            item.setId(currentId);
            // Create plan list
            String planString = "";
            String comma = "";
            for (int i = 0; i < examplePlanListBox.getItemCount(); i++) {
                String planId = examplePlanListBox.getValue(i);
                planString += comma + planId;
                comma = ",";
            }
            item.setName(planString);
            item.setCsrfToken(csrfToken.getValue());
            itemService.updateItem("function", item, callbackUpdate);
        }
    });

    buttonBar.add(left, DockPanel.WEST);
    left.setWidth("200px");
    right.setWidth("440px");
    right.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    left.add(backButton);
    right.add(saveButton);
    right.add(viewButton);
    buttonBar.add(right, DockPanel.EAST);

    buttonBar.setSize(screenWidth, "58px");
    dockPanel.add(buttonBar, DockPanel.SOUTH);
    dockPanel.add(horizontalPanel_1, DockPanel.SOUTH);
    // Begin load process.
    // Get Function Example list
    itemService.getItem("function", thisInstitution, callbackLoad);

    // formGrid.addFormItem("Order", orderBox);

}

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

License:Educational Community License

public void doModuleLoad() {
    super.onModuleSetup();

    // Element gwtRoot= DOM.getElementById("gwtRoot");
    // rootPanel = RootPanel.get("gwtRoot");
    RootPanel rootPanel = RootPanel.get("gwtRoot");

    // Window.alert("Start at: "+rootPanel.getTitle());
    // Defaults for SimpleGridView
    textBox.setWidth("341px");
    orderBox.setWidth("40px");

    // Button Bar
    buttonBar.add(left, DockPanel.WEST);
    left.setWidth("200px");
    right.setWidth("440px");
    left.add(backButton);//from w  ww  .ja va 2s  . c  o m
    buttonBar.add(right, DockPanel.EAST);
    HTML spacer = new HTML("&nbsp;");
    right.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    right.add(insertButton);
    right.add(updateButton);
    right.add(deleteButton);

    // Add button listeners.

    insertButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);

            boolean ok = Window.confirm("Insert new  entry: " + textBox.getText() + ": are you sure?");
            currentActiveItem = gridPanel.getActiveItem();
            if (ok) {
                buttonPressed = "insert";

                getFormController().insert(itemRootName, updateItemCallback);
            }

        }
    });
    updateButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);
            if (currentId <= 0) {
                setError("Record selection required");
                showErr(true);
            } else {
                currentActiveItem = gridPanel.getActiveItem();
                boolean ok = Window.confirm("Update entry: " + textBox.getText() + ": are you sure?");
                if (ok) {
                    buttonPressed = "update";
                    getFormController().update(itemRootName, updateItemCallback);
                }
            }

        }
    });

    deleteButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);
            if (currentId <= 0) {
                setError("Record selection required");
                showErr(true);
            } else {
                currentActiveItem = gridPanel.getActiveItem();
                boolean ok = Window.confirm(delAskMsg + textBox.getText() + ": are you sure?");
                if (ok) {
                    buttonPressed = "delete";
                    // Item item = new Item();
                    formController.delete(itemRootName, updateItemCallback);
                }
            }
        }
    });

    // Build up Main dock panel
    rootPanel.add(dockPanel);
    dockPanel.setWidth("642px");
    spacerBar.setSize(screenWidth, "10px");

    // Page heading
    // headingLabel.setHTML("<p>&nbsp;</p>");
    // headingBar.add(headingLabel);
    // headingBar.setSize(screenWidth,"30px");
    dockPanel.add(headingBar, DockPanel.NORTH);
    headingBar.setHeight("2px");
    headingBar.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);

    // Add panels below the gridpanel
    if (showButtonRow) {
        dockPanel.add(buttonBar, DockPanel.SOUTH);
    }

    dockPanel.add(errorTextPanel, DockPanel.SOUTH);
    dockPanel.add(errorPanel, DockPanel.SOUTH);

    errorPanel.setSize(screenWidth, "12px");
    errorTextPanel.setSize(screenWidth, "12px");

    buttonBar.setSize(screenWidth, "58px");
    dockPanel.add(formPanel, DockPanel.SOUTH);
    dockPanel.add(spacerBar, DockPanel.SOUTH);
    formPanel.add(flexForm);
    loadErrorSetup(errorPanel, errorTextPanel);

    loadErrorSetup(errorPanel, errorTextPanel);

    CSS.swapStyleSheet("theme", "js/ext/resources/css/xtheme-gray.css");

}

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

License:Educational Community License

public void doModuleLoad() {
    super.onModuleSetup();

    //Element gwtRoot= DOM.getElementById("gwtRoot");
    //rootPanel = RootPanel.get("gwtRoot");
    RootPanel rootPanel = RootPanel.get("gwtRoot");

    // Window.alert("Start at: "+rootPanel.getTitle());
    // Defaults for SimpleGridView
    textBox.setWidth("341px");
    orderBox.setWidth("40px");

    // Button Bar
    buttonBar.add(left, DockPanel.WEST);
    left.setWidth("200px");
    right.setWidth("440px");
    left.add(backButton);//from  ww w.j a  v  a 2s .  co  m
    buttonBar.add(right, DockPanel.EAST);
    HTML spacer = new HTML("&nbsp;");
    right.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    // right.add(insertButton);
    // right.add(updateButton);
    // right.add(deleteButton);

    // Add button listeners.

    insertButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);

            boolean ok = Window.confirm("Insert new  entry: " + textBox.getText() + ": are you sure?");
            if (ok) {

                getFormController().insert(itemRootName, updateItemCallback);
            }

        }
    });
    updateButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);

            boolean ok = Window.confirm("Update entry: " + textBox.getText() + ": are you sure?");
            if (ok) {
                getFormController().update(itemRootName, updateItemCallback);
            }

        }
    });
    deleteButton.addClickListener(new ClickListener() {
        public void onClick(final Widget sender) {
            showErr(false);
            boolean ok = Window.confirm("Delete  entry: " + textBox.getText() + ": are you sure?");
            if (ok) {

                Item item = new Item();
                formController.delete(itemRootName, item, updateItemCallback);
            }

        }
    });

    // Build up Main dock panel
    rootPanel.add(dockPanel);
    dockPanel.setWidth("642px");
    spacerBar.setSize(screenWidth, "10px");

    // Page heading
    // headingLabel.setHTML("<p>&nbsp;</p>");
    // headingBar.add(headingLabel);
    // headingBar.setSize(screenWidth,"30px");
    dockPanel.add(headingBar, DockPanel.NORTH);
    headingBar.setHeight("2px");
    headingBar.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);

    // Add panels below the gridpanel
    // if (showButtonRow) {
    dockPanel.add(buttonBar, DockPanel.SOUTH);
    // }

    dockPanel.add(errorTextPanel, DockPanel.SOUTH);
    dockPanel.add(errorPanel, DockPanel.SOUTH);

    errorPanel.setSize(screenWidth, "24px");
    buttonBar.setSize(screenWidth, "58px");
    dockPanel.add(formPanel, DockPanel.SOUTH);
    dockPanel.add(spacerBar, DockPanel.SOUTH);
    formPanel.add(flexForm);
    loadErrorSetup(errorPanel, errorTextPanel);
    CSS.swapStyleSheet("theme", "js/ext/resources/css/xtheme-gray.css");

}

From source file:org.kuali.student.common.ui.client.widgets.buttonlayout.ButtonColumn.java

License:Educational Community License

public ButtonColumn() {
    setupDefaultStyles();/*ww w  .  jav  a  2s  .com*/
    mainPanel.add(contentPanel, DockPanel.WEST);
    mainPanel.add(topPanel, DockPanel.NORTH);
    mainPanel.setVerticalAlignment(HasAlignment.ALIGN_BOTTOM);
    mainPanel.add(bottomPanel, DockPanel.SOUTH);
    this.initWidget(mainPanel);
}

From source file:org.kuali.student.common.ui.client.widgets.buttonlayout.ButtonColumn.java

License:Educational Community License

public ButtonColumn(boolean contentRight) {
    setupDefaultStyles();// w ww . ja v a 2s .  co m
    if (contentRight) {
        mainPanel.add(contentPanel, DockPanel.EAST);
    } else {
        mainPanel.add(contentPanel, DockPanel.WEST);
    }
    mainPanel.add(topPanel, DockPanel.NORTH);
    mainPanel.setVerticalAlignment(HasAlignment.ALIGN_BOTTOM);
    mainPanel.add(bottomPanel, DockPanel.SOUTH);
    this.initWidget(mainPanel);
}

From source file:org.kuali.student.common.ui.client.widgets.buttonlayout.ButtonRow.java

License:Educational Community License

public ButtonRow(boolean contentBottom) {
    setupDefaultStyles();//  www .  j a v  a 2 s  .co  m
    if (contentBottom) {
        mainPanel.add(contentPanel, DockPanel.SOUTH);
    } else {
        mainPanel.add(contentPanel, DockPanel.NORTH);
    }
    mainPanel.add(leftPanel, DockPanel.WEST);
    mainPanel.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT);
    mainPanel.add(rightPanel, DockPanel.EAST);
    this.initWidget(mainPanel);
}

From source file:org.nuxeo.ecm.platform.annotations.gwt.client.view.NewAnnotationPopup.java

License:Apache License

public NewAnnotationPopup(final Element element, final AnnotationController controller,
        final boolean removeOnCancel, final String annotationType, final String annotationName) {
    this.controller = controller;
    this.element = element;
    this.removeOnCancel = removeOnCancel;

    GWT.log("creating new annotation pop up", null);
    int scroll = Document.get().getBody().getScrollTop();
    controller.setFrameScrollFromTop(scroll);
    dockPanel.setStyleName("annotationsNewAnnotationPopup");

    dockPanel.add(verticalPanel, DockPanel.NORTH);
    dockPanel.add(annotationTextArea, DockPanel.CENTER);
    dockPanel.add(flowPanel, DockPanel.SOUTH);

    if (annotationName != null) {
        selectedAnnotationType = annotationName;
        // Add into the view
        verticalPanel.add(new Label(selectedAnnotationType));

        Map<String, String[]> fields = controller.getWebConfiguration().getAnnotationDefinition(annotationName)
                .getFields();//www.j a  v  a 2s .c om
        for (String fieldName : fields.keySet()) {
            ListBox fieldListBox = new ListBox();
            fieldListBox.setName(fieldName);
            for (String choice : fields.get(fieldName)) {
                fieldListBox.addItem(choice);
            }
            fieldListBoxes.add(fieldListBox);

            // Add into the view
            verticalPanel.add(fieldListBox);
        }
    } else {
        WebConfiguration webConf = controller.getWebConfiguration();
        List<AnnotationDefinition> annotationDefs = webConf
                .getAnnotationDefinitions(new TypeFilter(annotationType));
        if (annotationDefs.size() == 1) {
            selectedAnnotationType = annotationDefs.get(0).getName();
            String label = selectedAnnotationType;
            // If this is the default annotation (Comment), internationalize the
            // title
            if (label.equals(AnnotationConstant.COMMENT_ANNOTATION_NAME)) {
                TranslationConstants translationContants = GWT.create(TranslationConstants.class);
                label = translationContants.comment();
            }

            // Add into the view
            verticalPanel.add(new Label(label));
        } else {
            for (AnnotationDefinition annotationDef : annotationDefs) {
                listBox.addItem(annotationDef.getName());
            }

            // Add into the view
            verticalPanel.add(listBox);
        }

    }

    TranslationConstants translationContants = GWT.create(TranslationConstants.class);
    submit = new Button(translationContants.submit());
    submit.setEnabled(false);
    flowPanel.add(submit);
    cancel = new Button(translationContants.cancel());
    flowPanel.add(cancel);
    submit.addClickListener(new CommitListener(element, annotationName));

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

    this.add(dockPanel);
}