public int load(Topic topic) {
    super.load(topic);
    childPanel.clear();

    int childCount = 0;
    for (Iterator iterator = topic.getInstances().iterator(); iterator.hasNext(); ) {

      TopicTypeConnector conn = (TopicTypeConnector) iterator.next();

      Topic child = conn.getTopic();
      if (manager.isEdittable() || child.isPublicVisible()) {
        childPanel.add(new TopicLink(child));
      }

      childCount++;
    }

    if (childCount < 1) {
      childPanel.add(new Label(" "));
    }
    int scrollH = childCount * HEIGHT_PER_ENTRY;
    scrollH = (scrollH < MAX_HEIGHT) ? scrollH : MAX_HEIGHT;
    scroll.setHeight(scrollH + "px");
    System.out.println("ChildGadg scroll heigh " + scrollH);

    return childCount;
  }
Esempio n. 2
0
  private void showAddNewComment() {
    newCommentLayout.clear();
    final TextArea comment = new TextArea();
    comment.setWidth("100%");
    newCommentLayout.add(comment);

    Button ok = new Button(constants.OK());
    Button cancel = new Button(constants.Cancel());

    ok.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent sender) {
            sendNewComment(comment.getText());
          }
        });

    cancel.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent sender) {
            showNewCommentButton();
          }
        });

    HorizontalPanel hp = new HorizontalPanel();
    hp.add(ok);
    hp.add(cancel);

    newCommentLayout.add(hp);

    comment.setFocus(true);
  }
Esempio n. 3
0
  public void onModuleLoad() {
    // Make some text boxes. The password text box is identical to the text
    // box, except that the input is visually masked by the browser.
    PasswordTextBox ptb = new PasswordTextBox();
    TextBox tb = new TextBox();

    // TODO(ECC) must be tested.
    tb.addKeyPressHandler(
        new KeyPressHandler() {

          public void onKeyPress(KeyPressEvent event) {
            if (!Character.isDigit(event.getCharCode())) {
              ((TextBox) event.getSource()).cancelKey();
            }
          }
        });

    // Let's make an 80x50 text area to go along with the other two.
    TextArea ta = new TextArea();
    ta.setCharacterWidth(80);
    ta.setVisibleLines(50);

    // Add them to the root panel.
    VerticalPanel panel = new VerticalPanel();
    panel.add(tb);
    panel.add(ptb);
    panel.add(ta);
    RootPanel.get().add(panel);
  }
Esempio n. 4
0
  private Panel createNewNameInput(final ScrollPanel contentPanel) {
    VerticalPanel form = new VerticalPanel();
    HorizontalPanel nameForm = new HorizontalPanel();
    nameForm.add(new Label("Name"));
    final TextBox nameTextBox = new TextBox();
    nameTextBox.setName("personName");
    nameForm.add(nameTextBox);
    form.add(nameForm);
    Button saveButton =
        new Button(
            "Store",
            new ClickListener() {
              public void onClick(Widget sender) {
                String name = nameTextBox.getText();
                RaffleServiceGwtRemoteAsync service = RaffleServiceGwtRemote.App.getInstance();
                AsyncCallback callback =
                    new AsyncCallback() {
                      public void onFailure(Throwable caught) {
                        GWT.log("Failure while creating a new name", caught);
                      }

                      public void onSuccess(Object result) {
                        contentPanel.setWidget(new Label("Name is stored"));
                      }
                    };
                service.storeName(name, callback);
              }
            });
    form.add(saveButton);
    return form;
  }
  private VerticalPanel getPanel() {
    VerticalPanel panel = new VerticalPanel();
    panel.setStyleName("StudioPopup");

    VerticalPanel info = new VerticalPanel();
    info.setSpacing(10);

    Label lbl = new Label();
    lbl.setStyleName("StudioPopup-Msg-Strong");
    lbl.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    lbl.setText("Add Value");

    Label lblName = new Label();
    lblName.setStyleName("StudioPopup-Msg");
    lblName.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    lblName.setText("Value");

    enumValue = new TextBox();
    enumValue.setWidth("155px");

    HorizontalPanel namePanel = new HorizontalPanel();
    namePanel.setSpacing(10);
    namePanel.add(lblName);
    namePanel.add(enumValue);
    namePanel.setCellVerticalAlignment(lblName, HasVerticalAlignment.ALIGN_MIDDLE);

    info.add(lbl);
    info.add(namePanel);

    panel.add(info);
    panel.add(getButtonPanel());

    return panel;
  }
Esempio n. 6
0
  private VerticalPanel buildExtras() {

    HorizontalPanel extsBaseRow = new HorizontalPanel();

    ToggleButton bShowOnly = new ToggleButton(new Image("images/button_eye.gif"), this);
    bShowOnly.setTitle("Click to hide all route segments except this one! Click again to restore.");
    extsBaseRow.add(bShowOnly);

    soClick = new HTML("<div class=\"togglelink\">詳細內容</div>");
    soClick.setTitle("顯示詳細內容.");
    soClick.addClickListener(this);
    extsBaseRow.add(soClick);

    VerticalPanel exts = new VerticalPanel();
    exts.add(extsBaseRow);

    detailPanel = buildStopOvers();
    exts.add(detailPanel);

    exts.setStyleName("extras");
    extsBaseRow.setStyleName("base_row");
    bShowOnly.setStyleName("eye");
    detailPanel.setStyleName("stopovers");
    return exts;
  }
Esempio n. 7
0
  private void refreshWidgets() {
    this.artifactEditor = new ArtifactEditor(asset, null);
    this.ruleViewer =
        new RuleViewer(
            asset,
            this.editEvent,
            this.closeCommand,
            this.checkedInCommand,
            this.archiveCommand,
            this.isHistoricalReadOnly,
            actionToolbarButtonsConfigurationProvider,
            ruleViewerSettings);
    this.actionToolBar = this.ruleViewer.getActionToolbar();

    VerticalPanel vp = new VerticalPanel();
    vp.add(this.actionToolBar);

    TabPanel tPanel = new TabPanel();
    tPanel.setWidth("100%");

    ScrollPanel pnl = new ScrollPanel();
    pnl.add(this.artifactEditor);
    tPanel.add(pnl, "Attributes");
    // tPanel.selectTab(0);

    pnl = new ScrollPanel();
    // pnl1.setWidth("100%");
    pnl.add(this.ruleViewer);
    tPanel.add(pnl, "Edit");
    tPanel.selectTab(1);

    vp.add(tPanel);
    initWidget(vp);
  }
  public void showContainerSizePanel() {
    CaptionPanel bodySize = new CaptionPanel(constants.containerSizeTitle());
    bodySize.setWidth("185px");

    final VerticalPanel content = new VerticalPanel();

    containerSizeListBox = new CustomListBox();

    content.add(containerSizeListBox);
    bodySize.setContentWidget(content);

    HorizontalPanel setSizePanel = new HorizontalPanel();

    setSizeDisclosurePanel = new DisclosurePanel(constants.sizeInPixel());
    setSizeDisclosurePanel.setAnimationEnabled(true);
    setSizeDisclosurePanel.setOpen(true);
    setSizeDisclosurePanel.setVisible(false);

    setSizeDisclosurePanel.add(setSizePanel);

    customSizeTextBox = new TextBox();
    customSizeTextBox.setWidth("50px");
    setSizePanel.add(customSizeTextBox);

    validCustomSizeButton = new Button("OK");

    setSizePanel.add(validCustomSizeButton);

    content.add(setSizeDisclosurePanel);

    builderContent.add(bodySize);
  }
  public VerticalPanel buildUsersListPanel() {
    DockPanel headerDockPanel = new DockPanel();
    headerDockPanel.add(deleteUserBtn, DockPanel.EAST);
    VerticalPanel spacer = new VerticalPanel();
    spacer.setWidth("2"); // $NON-NLS-1$
    headerDockPanel.add(spacer, DockPanel.EAST);
    headerDockPanel.add(addUserBtn, DockPanel.EAST);
    Label label = new Label("Users"); // $NON-NLS-1$
    headerDockPanel.add(label, DockPanel.WEST);
    headerDockPanel.setCellWidth(label, "100%"); // $NON-NLS-1$
    VerticalPanel userListPanel = new VerticalPanel();
    userListPanel.add(headerDockPanel);
    userListPanel.add(usersList);
    userListPanel.add(new Label(Messages.getString("filter"))); // $NON-NLS-1$
    userListPanel.add(filterTextBox);

    userListPanel.setCellHeight(usersList, "100%"); // $NON-NLS-1$
    userListPanel.setCellWidth(usersList, "100%"); // $NON-NLS-1$
    userListPanel.setHeight("100%"); // $NON-NLS-1$
    userListPanel.setWidth("100%"); // $NON-NLS-1$
    usersList.setHeight("100%"); // $NON-NLS-1$
    usersList.setWidth("100%"); // $NON-NLS-1$
    filterTextBox.setWidth("100%"); // $NON-NLS-1$
    deleteUserBtn.setEnabled(false);

    filterTextBox.addKeyboardListener(this);
    usersList.addChangeListener(this);
    addUserBtn.addClickListener(this);
    deleteUserBtn.addClickListener(this);
    return userListPanel;
  }
Esempio n. 10
0
        public void onSuccess(List<PacketUserData> result) {
          clear();
          add(html);
          HorizontalPanel horizontalPanel = new HorizontalPanel();
          for (PacketUserData data : result) {
            final VerticalPanel panel = new VerticalPanel();
            panel.setHorizontalAlignment(ALIGN_CENTER);

            final Image image = new Image(Constant.ICON_URL_PREFIX + data.imageFileName);
            image.setPixelSize(Constant.ICON_SIZE_BIG, Constant.ICON_SIZE_BIG);
            panel.add(image);

            final Label label = new Label(data.playerName);
            panel.add(label);

            horizontalPanel.add(panel);

            if (horizontalPanel.getWidgetCount() == 8) {
              add(horizontalPanel);
              horizontalPanel = new HorizontalPanel();
            }
          }

          if (horizontalPanel.getWidgetCount() != 0) {
            add(horizontalPanel);
          }
        }
Esempio n. 11
0
  // Helper method to make list of buttons on left side of View
  public void makeSideBar(HorizontalPanel hp) {
    VerticalPanel sidePanel = new VerticalPanel();
    hp.add(sidePanel);
    sidePanel.setSize("72px", "98px");

    Button postAdButton = new Button("Post Ad");
    postAdButton.setStyleName("sideBarButton");
    postAdButton.setText("Post Ad");
    // add a clickListener to the button
    postAdButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            viewPostAdForm();
          }
        });
    sidePanel.add(postAdButton);

    Button viewAdsButton = new Button("View Ads");
    viewAdsButton.setStyleName("sideBarButton");
    viewAdsButton.setText("View Ads");
    // add a clickListener to the button
    viewAdsButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            control.viewAdDataFromServer();
          }
        });
    sidePanel.add(viewAdsButton);

    Hyperlink adminHyperlink = new Hyperlink("Admin Page", false, "newHistoryToken");
    sidePanel.add(adminHyperlink);
  }
Esempio n. 12
0
  public MyDialog(String title, String msg) {
    // Set the dialog box's caption.
    setText(title);

    // Enable animation.
    setAnimationEnabled(true);

    // Enable glass background.
    setGlassEnabled(true);

    this.center();

    // Create a table to layout the content
    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSpacing(15);
    this.setWidget(dialogContents);

    // Add some text to the top of the dialog
    HTML details = new HTML(msg);
    dialogContents.add(details);
    dialogContents.setCellHorizontalAlignment(details, HasHorizontalAlignment.ALIGN_CENTER);

    // DialogBox is a SimplePanel, so you have to set its widget property to
    // whatever you want its contents to be.
    Button ok = new Button("OK");
    ok.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            MyDialog.this.hide();
          }
        });

    dialogContents.add(ok);
    dialogContents.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER);
  }
Esempio n. 13
0
  private void registrationCompleted(
      MyDialog registrationPopup, final RegisterOntologyResult uploadOntologyResult) {

    registrationPopup.hide();

    String error = uploadOntologyResult.getError();

    StringBuffer sb = new StringBuffer();

    VerticalPanel vp = new VerticalPanel();
    vp.setSpacing(6);

    if (error == null) {

      String uri = uploadOntologyResult.getUri();

      vp.add(
          new HTML(
              "<font color=\"green\">Congratulations!</font> "
                  + "Your ontology is now registered."));

      vp.add(
          new HTML(
              "<br/>The URI of the ontology is: "
                  //					+ "<a href=\"" +uri+ "\">"
                  + uri
              //					+ "</a>"
              ));

      vp.add(new HTML("<br/>For diagnostics, this is the response from the back-end server:"));

      sb.append(uploadOntologyResult.getInfo());

      // and, disable all editing fields/buttons:
      // (user will have to start from the "load" step)
      //			enable(false);
    } else {
      sb.append(error);
    }

    String msg = sb.toString();
    Orr.log(CLASS_NAME + ": Registration result: " + msg);

    final MyDialog popup = new MyDialog(null);
    popup.setCloseButtonText("Return to ontology list");
    popup.setText(error == null ? "Registration completed sucessfully" : "Error");
    popup.addTextArea(null).setText(msg);
    popup.getTextArea().setSize("600", "150");

    popup.getDockPanel().add(vp, DockPanel.NORTH);
    popup.center();

    popup.addPopupListener(
        new PopupListener() {
          public void onPopupClosed(PopupPanel sender, boolean autoClosed) {
            PortalControl.getInstance().completedRegisterOntologyResult(uploadOntologyResult);
          }
        });
    popup.show();
  }
  public VerticalDecisionTableWidget(
      GuidedDecisionTable52 model,
      DataModelOracle oracle,
      Identity identity,
      boolean isReadOnly,
      EventBus eventBus) {
    super(model, oracle, identity, isReadOnly, eventBus);

    VerticalPanel vp = new VerticalPanel();

    ctrls = new DecisionTableControlsWidget(this, model, identity, isReadOnly);
    vp.add(ctrls);

    // Construct the widget from which we're composed
    widget =
        new VerticalDecoratedDecisionTableGridWidget(
            resources, cellFactory, cellValueFactory, dropDownManager, isReadOnly, eventBus);
    vp.add(widget);

    initWidget(vp);

    // Fire event for UI components to set themselves up
    SetGuidedDecisionTableModelEvent sme = new SetGuidedDecisionTableModelEvent(model);
    eventBus.fireEvent(sme);
  }
Esempio n. 15
0
    public CategorySelector() {
      setTitle(constants.SelectCategoryToAdd());
      VerticalPanel vert = new VerticalPanel();

      selector =
          new CategoryExplorerWidget(
              new CategorySelectHandler() {
                public void selected(String sel) {
                  selectedPath = sel;
                }
              });

      vert.add(selector);
      vert.add(ok);

      addRow(vert);

      ok.addClickHandler(
          new ClickHandler() {
            public void onClick(ClickEvent event) {
              if (selectedPath != null && !"".equals(selectedPath)) {
                addToCategory(selectedPath);
              }
              hide();
            }
          });
    }
Esempio n. 16
0
  private FlowLayoutContainer createButtons(Category cat) {
    VerticalPanel vp = new VerticalPanel();
    vp.setSpacing(10);
    vp.setWidth("400px");

    for (Type type : Type.values()) {
      vp.add(format(type.getText()));

      HorizontalPanel hp = new HorizontalPanel();
      hp.setSpacing(5);

      CellButtonBase<?> small = createButton(cat, type);
      CellButtonBase<?> medium = createButton(cat, type);
      CellButtonBase<?> large = createButton(cat, type);

      configureButton(small, type, ButtonScale.SMALL);
      configureButton(medium, type, ButtonScale.MEDIUM);
      configureButton(large, type, ButtonScale.LARGE);

      hp.add(small);
      hp.add(medium);
      hp.add(large);

      vp.add(hp);
    }

    FlowLayoutContainer f = new FlowLayoutContainer();
    f.getScrollSupport().setScrollMode(ScrollMode.AUTO);
    f.add(vp);

    con.add(f);

    return f;
  }
Esempio n. 17
0
  private void showLogonDialog() {
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Login");
    dialogBox.setGlassEnabled(true);
    dialogBox.setAnimationEnabled(true);

    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setSpacing(4);
    dialogBox.setWidget(verticalPanel);

    final TextBox username = new TextBox();
    verticalPanel.add(new HTML("Username:"******"Logon",
            new ClickHandler() {
              public void onClick(ClickEvent event) {
                dialogBox.hide();
                login(username.getValue());
              }
            });
    verticalPanel.add(closeButton);

    dialogBox.center();
    dialogBox.show();
  }
Esempio n. 18
0
    public Widget makeExtraUI(final WebLayerItem item) {

      final CheckBox cb =
          GwtUtil.makeCheckBox(
              "Offset Calculation",
              "Calculate the distance, delta(RA), delta(Dec), and PA between two points",
              _posAngle);
      cb.addValueChangeHandler(
          new ValueChangeHandler<Boolean>() {
            public void onValueChange(ValueChangeEvent<Boolean> ev) {
              _posAngle = ev.getValue();
              redraw();
            }
          });

      SimpleInputField units =
          SimpleInputField.createByProp("PrefGroup.Generic.field.DistanceReadout");
      String pref = Preferences.get(DIST_READOUT);
      units.setValue(pref == null ? DEG : pref);
      units
          .getField()
          .addValueChangeHandler(
              new ValueChangeHandler<String>() {
                public void onValueChange(ValueChangeEvent<String> ev) {
                  Preferences.set(DIST_READOUT, ev.getValue());
                  redraw();
                }
              });

      VerticalPanel vp = new VerticalPanel();
      vp.add(cb);
      vp.add(units);

      return vp;
    }
Esempio n. 19
0
    public void initLayout() {
      lang = new ListBox();
      lang =
          Convert.makeSelectedLanguageListBox(
              (ArrayList<String[]>) MainApp.getLanguage(), tObj.getLang());
      lang.setWidth("100%");
      lang.setEnabled(false);

      term = new TextBox();
      term.setText(tObj.getLabel());
      term.setWidth("100%");

      main = new CheckBox(constants.conceptPreferredTerm());
      if (tObj.isMainLabel()) {
        main.setValue(tObj.isMainLabel());
        // main.setEnabled(false);
      }

      Grid table = new Grid(2, 2);
      table.setWidget(0, 0, new HTML(constants.conceptTerm()));
      table.setWidget(1, 0, new HTML(constants.conceptLanguage()));
      table.setWidget(0, 1, term);
      table.setWidget(1, 1, lang);
      table.setWidth("100%");
      table.getColumnFormatter().setWidth(1, "80%");

      VerticalPanel vp = new VerticalPanel();
      vp.add(GridStyle.setTableConceptDetailStyleleft(table, "gslRow1", "gslCol1", "gslPanel1"));
      vp.add(main);
      vp.setSpacing(0);
      vp.setWidth("100%");
      vp.setCellHorizontalAlignment(main, HasHorizontalAlignment.ALIGN_RIGHT);

      addWidget(vp);
    }
Esempio n. 20
0
  private Panel buildPanelBrowse() {

    this._panelBrowse.setSpacing(Constantes.SPACING_MIN);
    this._panelBrowse.setHeight(Constantes.Dim50PX);
    this._panelBrowse.setWidth(Constantes.MAX_SIZE);
    this._panelBrowse.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
    this._panelBrowse.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    // radio button
    final VerticalPanel vPanelLabel = new VerticalPanel();
    vPanelLabel.add(this._rbChoisirArchive);
    vPanelLabel.add(this._rbChoisirRepSource);
    this._panelBrowse.add(vPanelLabel);
    this._panelBrowse.setCellWidth(vPanelLabel, "300px");

    // action panel
    final FlowPanel actionPanel = new FlowPanel();
    actionPanel.add(this._fileUploader);
    actionPanel.add(this.buildAppletButton());
    this._panelBrowse.add(actionPanel);
    this._panelBrowse.setCellWidth(actionPanel, "350px");

    // buttons
    this._panelBrowse.add(this._btGoInfo);
    this._panelBrowse.setCellWidth(this._btGoInfo, "50px");

    this._panelBrowse.add(this._btDemo);

    return this._panelBrowse;
  }
  public IndicatorWidget(ProjectMediator med) {
    this.med = med;

    name_lbl = new Label();
    author_lbl = new Label();
    description_lbl = new Label();
    version_lbl = new Label();
    activated_btn = new Button();
    setActivated(false);
    activated_btn.addClickHandler(this);

    labelPanel.setStyleName("indicatorInfoPanel");
    labelPanel.add(name_lbl);
    labelPanel.add(author_lbl);
    labelPanel.add(version_lbl);
    labelPanel.add(description_lbl);
    labelPanel.add(activated_btn);

    name_lbl.addStyleName("indicatorInfoTitle");
    author_lbl.addStyleName("indicatorInfoStage");
    version_lbl.addStyleName("indicatorInfoStage");
    description_lbl.addStyleName("indicatorInfoDescription");

    mainPanel.setWidget(0, 0, labelPanel);
    initWidget(mainPanel);
  }
  /**
   * Create a Date picker. The code comes from the GWT show case :
   * http://gwt.google.com/samples/Showcase/Showcase.html#!CwDatePicker@
   *
   * @return
   */
  private VerticalPanel createDatePanel() {
    // Create a basic date picker
    DatePicker datePicker = new DatePicker();
    final Label text = new Label();

    // Set the value in the text box when the user selects a date
    datePicker.addValueChangeHandler(
        new ValueChangeHandler<Date>() {
          public void onValueChange(ValueChangeEvent<Date> event) {
            Date date = event.getValue();
            String dateString = DateTimeFormat.getMediumDateFormat().format(date);
            text.setText(dateString);
          }
        });

    // Set the default value
    datePicker.setValue(new Date(), true);

    // Combine the widgets into a panel and return them
    VerticalPanel vPanel = new VerticalPanel();
    vPanel.add(new HTML("Permanent DatePicker:"));
    vPanel.add(text);
    vPanel.add(datePicker);
    return vPanel;
  }
  private void showSetCellAlignmentDialog(final ListBox listBox, final IAlignment iAlignment) {
    final DialogBox origDialog = new DialogBox();
    DOM.setStyleAttribute(origDialog.getElement(), "zIndex", Integer.toString(Integer.MAX_VALUE));
    final VerticalPanel dialog = new VerticalPanel();
    origDialog.add(dialog);
    origDialog.setText("Cell Alignment Dialog");
    dialog.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);

    dialog.add(new Label("Please choose the Widget :"));
    final ListBox widgetIndexLb = new ListBox();
    for (Iterator<Widget> iterator = iterator(); iterator.hasNext(); ) {
      Widget next = iterator.next();
      widgetIndexLb.addItem(
          ((IVkWidget) next).getWidgetName() + " - at index - " + getWidgetIndex(next));
    }

    widgetIndexLb.setWidth("300px");
    dialog.add(widgetIndexLb);
    widgetIndexLb.addChangeHandler(
        new ChangeHandler() {
          @Override
          public void onChange(ChangeEvent event) {
            iAlignment.doAlignment(
                widgetIndexLb.getSelectedIndex(), listBox.getValue(listBox.getSelectedIndex()));
          }
        });
    dialog.add(new Label("Please choose Alignment"));
    dialog.add(listBox);
    listBox.addChangeHandler(
        new ChangeHandler() {
          @Override
          public void onChange(ChangeEvent event) {
            iAlignment.doAlignment(
                widgetIndexLb.getSelectedIndex(), listBox.getValue(listBox.getSelectedIndex()));
          }
        });
    HorizontalPanel buttonsPanel = new HorizontalPanel();
    dialog.add(buttonsPanel);
    Button saveButton = new Button("OK");
    buttonsPanel.add(saveButton);
    saveButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            // iAlignment.doAlignment(widgetIndexLb.getSelectedIndex(),
            // listBox.getValue(listBox.getSelectedIndex()));
            origDialog.hide();
          }
        });
    Button cancelButton = new Button("Cancel");
    buttonsPanel.add(cancelButton);
    cancelButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            origDialog.hide();
          }
        });
    origDialog.center();
  }
  public LocalRepositoriesWidget() {
    RStudioGinjector.INSTANCE.injectMembers(this);

    VerticalPanel panel = new VerticalPanel();
    panel.add(new LabelWithHelp("Local repositories:", "packrat_local_repos"));

    HorizontalPanel hp = new HorizontalPanel();
    listBox_ = new ListBox(true);
    listBox_.addStyleName(RES.styles().listBox());
    listBox_.getElement().<SelectElement>cast().setSize(3);
    hp.add(listBox_);

    VerticalPanel buttonPanel = new VerticalPanel();
    SmallButton buttonAdd = createButton("Add...");
    buttonAdd.addClickHandler(addButtonClicked_);
    buttonPanel.add(buttonAdd);
    SmallButton buttonRemove = createButton("Remove");
    buttonRemove.addClickHandler(removeButtonClicked_);
    buttonPanel.add(buttonRemove);
    hp.add(buttonPanel);

    panel.add(hp);

    initWidget(panel);
  }
Esempio n. 25
0
  private Widget appendComment(DiscussionRecord r) {
    SmallLabel hrd =
        new SmallLabel(constants.smallCommentBy0On1Small(r.author, new Date(r.timestamp)));
    hrd.addStyleName("discussion-header");
    commentList.add(hrd);

    String[] parts = r.note.split("\n");

    if (parts.length > 0) {
      StringBuilder txtBuilder = new StringBuilder();
      for (int i = 0; i < parts.length; i++) {
        txtBuilder.append(parts[i]);
        if (i != parts.length - 1) {
          txtBuilder.append("<br/>");
        }
      }
      HTML hth = new HTML(txtBuilder.toString());
      hth.setStyleName("form-field");
      commentList.add(hth);
    } else {
      Label lbl = new Label(r.note);
      lbl.setStyleName("form-field");
      commentList.add(lbl);
    }

    commentList.add(new HTML("<br/>"));
    return hrd;
  }
Esempio n. 26
0
  /** Initialize this example. */
  private Widget initialize() {

    // Create a new panel
    absolutePanel = new AbsolutePanel();

    // Add a widget that we will animate
    animateeTop = new Image("gwtLogoThumb.png");
    animateeBottom = new Image("gwtLogoThumb.png");
    animateeLeft = new Image("gwtLogoThumb.png");
    animateeRight = new Image("gwtLogoThumb.png");
    absolutePanel.add(animateeTop);
    absolutePanel.add(animateeBottom);
    absolutePanel.add(animateeLeft);
    absolutePanel.add(animateeRight);

    // Wrap the absolute panel in a DecoratorPanel
    VerticalPanel absolutePanelWrapper = new VerticalPanel();
    absolutePanelWrapper.add(absolutePanel);

    // Add the components to a panel and return it
    absolutePanelWrapper.add(createOptionsBar());

    // Create the custom animation
    animation = new CustomAnimation(70);

    // Set the start position of the widgets
    animation.onComplete();

    absolutePanel.setSize((animation.centerX * 2 + 10) + "px", (animation.centerY * 2 + 10) + "px");

    // Return the layout
    return absolutePanelWrapper;
  }
Esempio n. 27
0
  public DiscussionWidget(final Artifact artifact, boolean readOnly) {
    this.artifact = artifact;
    this.readOnly = readOnly;

    DecoratedDisclosurePanel discussionPanel = new DecoratedDisclosurePanel(constants.Discussion());
    discussionPanel.setWidth("100%");

    commentList.setWidth("100%");
    VerticalPanel discussionLayout = new VerticalPanel();
    discussionLayout.setWidth("90%");

    newCommentLayout.setWidth("100%");
    refreshDiscussion();
    showNewCommentButton();

    discussionLayout.add(newCommentLayout);
    discussionLayout.add(commentList);

    discussionPanel.setContent(discussionLayout);

    pushNotify =
        new ServerPushNotification() {
          public void messageReceived(PushResponse response) {
            if ("discussion".equals(response.messageType)
                && artifact.getUuid().equals(response.message)) {
              System.err.println("Refreshing discussion...");
              refreshDiscussion();
            }
          }
        };

    PushClient.instance().subscribe(pushNotify);

    initWidget(discussionPanel);
  }
Esempio n. 28
0
  public SubGoalDialogBox(
      final Command riksPane,
      List<GwtSubGoal> allSubGoals,
      List<GwtSubGoal> curretSelectedSubGoals) {

    // Set the dialog box's caption.
    setText(messages.associateGoals());

    this.allSubGoals = allSubGoals;
    this.oldSelectedSubGoals = curretSelectedSubGoals;

    final VerticalPanel checkBoxContainer = new VerticalPanel();
    checkBoxContainer.setSpacing(10);
    for (GwtSubGoal a : allSubGoals) {

      SubGoalCheckBox checkBox = new SubGoalCheckBox();
      checkBox.setText(a.getDescription());
      checkBox.setSubGoalID(a.getId());
      if (isCurrentSubGoalSelected(a.getId())) {
        checkBox.setValue(true);
      }
      checkBoxContainer.add(checkBox);
    }

    Button ok = new Button(messages.ok());
    Button cancel = new Button(messages.cancel());
    cancel.setWidth("60px");
    ok.setWidth("60px");

    FlexTable buttonsTable = new FlexTable();
    buttonsTable.setWidth("100%");
    buttonsTable.setCellPadding(3);
    buttonsTable.setWidget(0, 0, ok);
    buttonsTable.setWidget(0, 1, cancel);
    buttonsTable
        .getCellFormatter()
        .setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    buttonsTable.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT);

    ok.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            loadSelectedSubGoals(checkBoxContainer);
            riksPane.execute();
            SubGoalDialogBox.this.hide();
          }
        });

    cancel.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {

            SubGoalDialogBox.this.hide();
          }
        });

    checkBoxContainer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    checkBoxContainer.add(buttonsTable);
    setWidget(checkBoxContainer);
  }
  /**
   * This method is called when GWT loads the Notes application (as defined in the Notes.gwt.xml).
   */
  public void onModuleLoad() {

    final HorizontalPanel mainpanel = new HorizontalPanel();

    final HTML displayTitle = new HTML("Existing Notes");
    displayTitle.setStyleName("displayTitle");
    final HTML entryTitle = new HTML("Create A Note");
    entryTitle.setStyleName("entryTitle");

    final VerticalPanel displayPanel = new VerticalPanel();
    displayPanel.setVerticalAlignment(VerticalPanel.ALIGN_TOP);
    displayPanel.setStyleName("displayPanel");
    displayPanel.add(displayTitle);

    final VerticalPanel entryPanel = new VerticalPanel();
    entryPanel.setVerticalAlignment(VerticalPanel.ALIGN_TOP);
    entryPanel.setStyleName("entryPanel");
    entryPanel.add(entryTitle);

    displayPanel.add(notesPanel);

    final VerticalPanel form = createForm();
    entryPanel.add(form);

    mainpanel.add(displayPanel);
    mainpanel.add(entryPanel);

    RootPanel.get("notes").add(mainpanel);

    getNotes();
  }
Esempio n. 30
0
  public TagPopup(UIObject target, String spaceUname, String tagname) {
    super(target, true, true, true);
    this.spaceUname = spaceUname;
    this.tagname = tagname;

    VerticalPanel panel = new VerticalPanel();
    panel.add(message);
    panel.add(new HTML("<b>" + tagname + "</b>"));
    panel.add(new Hr());
    panel.add(pagesPanel);
    if (!AbstractEntryPoint.isOffline()) {
      // so far, have to block tag cloud in offline model as the macro render logic is on
      // MacroHandler side, it is not easy to do in
      // offline model.
      Hyperlink tagCloud =
          new Hyperlink(
              Msg.consts.goto_tagcloud(),
              GwtUtils.buildToken(
                  GwtUtils.getCPageToken(SharedConstants.CPAGE_TAG_CLOUD), spaceUname));
      tagCloud.addClickHandler(
          new ClickHandler() {
            public void onClick(ClickEvent event) {
              TagPopup.this.hide();
            }
          });
      panel.add(tagCloud);
      panel.setCellHorizontalAlignment(tagCloud, HasHorizontalAlignment.ALIGN_RIGHT);
    }
    panel.setSize("100%", "100%");
    this.setWidget(panel);
  }