public Canvas getViewPanel() {

    final TabSet tabSet = new TabSet();
    tabSet.setTabBarPosition(Side.TOP);

    // required so that the select item doesnt touch the tab pane
    tabSet.setTabBarThickness(25);
    tabSet.setTabBarAlign(Side.LEFT);
    tabSet.setWidth(400);
    tabSet.setHeight(200);

    final Tab statusTab = new Tab("Status");

    final Canvas statusPane = new Canvas();
    statusTab.setPane(statusPane);
    tabSet.addTab(statusTab);

    SelectItem selectItem = new SelectItem();
    selectItem.setValueMap("Development", "Staging", "Production");
    selectItem.setShowTitle(false);

    selectItem.setDefaultValue("Development");
    selectItem.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            statusPane.setContents(
                event.getValue()
                    + ": <span style='color:green;font-weight:bold'>Normal</span><br>");
          }
        });

    DynamicForm form = new DynamicForm();
    // form.setHeight(1);
    form.setPadding(0);
    form.setMargin(0);
    form.setCellPadding(1);
    form.setNumCols(1);
    form.setFields(selectItem);

    tabSet.setTabBarControls(TabBarControls.TAB_SCROLLER, TabBarControls.TAB_PICKER, form);
    return tabSet;
  }
Beispiel #2
0
  public void onModuleLoad() {
    /*
     * SmartGWT components
     */
    topTabSet.setTabBarPosition(Side.TOP);
    topTabSet.setTabBarAlign(Side.LEFT);
    topTabSet.setHeight100();
    topTabSet.setWidth100();
    topTabSet.addTab(loadTab);
    topTabSet.addTab(editTab);
    topTabSet.addTab(errorTab);
    topTabSet.setTabBarControls(
        TabBarControls.TAB_SCROLLER,
        TabBarControls.TAB_PICKER,
        suggestCanvasItem,
        confirmFactorValues,
        exportIDFButton,
        exportSDRFButton,
        revalidateButton);
    RootPanel.get("contentsarea").add(topTabSet);

    /*
     * Buttons
     */
    // Confirm Factor Values
    confirmFactorValues.setWidth(150);
    confirmFactorValues.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            guiMediator.showIDFFactorValue_ValidatorWindow();
          }
        });
    // Export SDRF
    exportSDRFButton.setIcon("[SKIN]actions/download.png");
    exportSDRFButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (!guiMediator.getCurrentSDRFTitle().equals("null")) {
              logger.log(Level.INFO, "Export SDRF Button was pressed");
              fileService.writeFile(
                  guiMediator.getCurrentSDRFTitle(),
                  guiMediator.getSDRFAsString(),
                  new FileServiceCallback(guiMediator.getCurrentSDRFTitle()));
            }
          }
        });
    // Export IDF
    exportIDFButton.setIcon("[SKIN]actions/download.png");
    exportIDFButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (!guiMediator.getCurrentIDFTitle().equals("null")) {
              logger.log(Level.INFO, "Export IDF Button was pressed");
              fileService.writeFile(
                  guiMediator.getCurrentIDFTitle(),
                  guiMediator.getIDFAsString(),
                  new FileServiceCallback(guiMediator.getCurrentIDFTitle()));
            }
          }
        });
    // Revalidate Button
    revalidateButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            if (!guiMediator.getCurrentSDRFTitle().equals("null")
                && !guiMediator.getCurrentIDFTitle().equals("null")) {
              validationService.validate(
                  guiMediator.getCurrentIDFTitle(),
                  guiMediator.getIDFAsString(),
                  guiMediator.getCurrentSDRFTitle(),
                  guiMediator.getSDRFAsString(),
                  new ValidationServiceCallback(guiMediator));
            }
          }
        });

    // *****************************
    // Layout
    // *****************************

    TagCloudWindow tagCloudWindow = new TagCloudWindow(guiMediator);
    tagCloudWindow.show();
    tagCloudWindow.moveTo(250, 85);
    // tagCloudWindow.moveAbove(canvas)

    // mainLayout.setHtmlElement(DOM.getElementById("webapp"));
    // mainLayout.show();

    // topTabSet.setHtmlElement(DOM.getElementById("webapp"));

    Window.addWindowClosingHandler(
        new Window.ClosingHandler() {
          public void onWindowClosing(Window.ClosingEvent closingEvent) {
            closingEvent.setMessage("Do you really want to leave the page?");
          }
        });
  }