示例#1
0
  private void createDialogBox() {
    dialogBox = new DialogBox();
    dialogBox.setText("RESTful Call");
    dialogBox.setAnimationEnabled(true);
    closeButton = new Button("Close");
    // We can set the id of a widget by accessing its Element
    closeButton.getElement().setId("closeButton");
    textToServerLabel = new Label();
    serverResponseLabel = new HTML();
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.addStyleName("dialogVPanel");
    dialogVPanel.add(new HTML("<b>Sending name to the server:</b>"));
    dialogVPanel.add(textToServerLabel);
    dialogVPanel.add(new HTML("<br><b>Server replies:</b>"));
    dialogVPanel.add(serverResponseLabel);
    dialogVPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    dialogVPanel.add(closeButton);
    dialogBox.setWidget(dialogVPanel);

    closeButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            dialogBox.hide();
          }
        });
  }
示例#2
0
  private void createOutputTableRowFor(FactPort factPort) {
    TextBox nameBox = CTextChangeHandler.createTextBox(factPort, "name");
    SuggestBox typeBox =
        CTextChangeHandler.createTypeSuggestBox(
            (ServiceDesigner) factPort.getServiceScreen2().get("serviceDesigner"),
            factPort,
            "factType");

    int outputNumRows = outputPortTable.getRowCount();

    // add the text and suggest boxes
    outputPortTable.setWidget(outputNumRows, 0, nameBox);
    outputPortTable.setWidget(outputNumRows, 1, typeBox);

    // add remove button
    Button removePortButton = new Button("Remove postcondition");
    removePortButton.setStyleName("fastButton");
    RemoveOutputPortHandler outputPortHandler = new RemoveOutputPortHandler();
    outputPortHandler.setFactPort(factPort);
    removePortButton.addClickHandler(outputPortHandler);
    outputPortTable.setWidget(outputNumRows, 3, removePortButton);

    // updateListener
    UpdateTransformationTabListener updateTabListener = new UpdateTransformationTabListener();
    factPort.addPropertyChangeListener("name", updateTabListener);
    factPort.addPropertyChangeListener("factType", updateTabListener);
  }
 @UiHandler({"findCityButton"})
 void onFindCityButtonClick(ClickEvent event) {
   final SearchNsiForm SNF = new SearchNsiForm();
   Button okButton = SNF.onInitialize(null, "CITY", 10, false, false);
   okButton.addClickHandler(
       new ClickHandler() {
         public void onClick(ClickEvent event) {
           Document addressDom = XMLParser.parse(SNF.getResultNsi().getV2());
           if (addressDom.getElementsByTagName("city").item(0).hasChildNodes()) {
             AddressEditForm.this.cityTextbox.setText(
                 addressDom.getElementsByTagName("city").item(0).getFirstChild().getNodeValue());
           }
           if (addressDom.getElementsByTagName("region").item(0).hasChildNodes()) {
             AddressEditForm.this.regionTextbox.setText(
                 addressDom.getElementsByTagName("region").item(0).getFirstChild().getNodeValue());
           }
           if (addressDom.getElementsByTagName("locality").item(0).hasChildNodes()) {
             AddressEditForm.this.localityTextbox.setText(
                 addressDom
                     .getElementsByTagName("locality")
                     .item(0)
                     .getFirstChild()
                     .getNodeValue());
           }
           AddressEditForm.this.address.setKladr(SNF.getResultNsi().getId());
         }
       });
 }
  @Test
  public void click_ClickkListener_NestedWidget() {
    // Given
    clicked = false;
    FlexTable t = new FlexTable();

    Button b = new Button("Wide Button");
    b.addClickListener(
        new ClickListener() {

          public void onClick(Widget sender) {
            clicked = !clicked;
          }
        });
    // add the button
    t.setWidget(0, 0, b);

    // Preconditions
    assertThat(clicked).isEqualTo(false);

    // When
    Browser.click(t.getWidget(0, 0));

    // Then
    assertThat(clicked).isEqualTo(true);
  }
示例#5
0
 /** clean */
 private void clean() {
   SearchSimple searchSimple = Main.get().mainPanel.search.searchBrowser.searchIn.searchSimple;
   SearchNormal searchNormal = Main.get().mainPanel.search.searchBrowser.searchIn.searchNormal;
   SearchAdvanced searchAdvanced =
       Main.get().mainPanel.search.searchBrowser.searchIn.searchAdvanced;
   searchSimple.fullText.setText("");
   searchNormal.context.setSelectedIndex(
       Main.get().mainPanel.search.searchBrowser.searchIn.posTaxonomy);
   searchNormal.content.setText("");
   searchAdvanced.path.setText("");
   searchAdvanced.categoryPath.setText("");
   searchAdvanced.categoryUuid = "";
   searchNormal.name.setText("");
   searchNormal.keywords.setText("");
   searchSavedName.setText("");
   searchButton.setEnabled(false);
   saveSearchButton.setEnabled(false);
   controlSearch.setVisible(false);
   Main.get().mainPanel.search.searchBrowser.searchIn.resetMetadata();
   searchAdvanced.typeDocument.setValue(true);
   searchAdvanced.typeFolder.setValue(false);
   searchAdvanced.typeMail.setValue(false);
   searchAdvanced.mimeTypes.setSelectedIndex(0);
   searchNormal.userListBox.setSelectedIndex(0);
   searchNormal.startDate.setText("");
   searchNormal.endDate.setText("");
   searchNormal.modifyDateFrom = null;
   searchNormal.modifyDateTo = null;
   searchAdvanced.from.setText("");
   searchAdvanced.to.setText("");
   searchAdvanced.subject.setText("");
   Main.get().mainPanel.search.searchBrowser.searchResult.removeAllRows();
 }
  /**
   * Creates new dialog.
   *
   * @param title the title for popup window
   * @param question the question that user must interact
   * @param handler the handler that call after user interact
   */
  public ProjectProblemDialog(String title, String question, final AskHandler handler) {
    this.handler = handler;
    setTitle(title);
    Widget widget = uiBinder.createAndBindUi(this);
    setWidget(widget);
    message.addStyleName(resources.centerPanelCss().label());
    message.getElement().setInnerHTML(question);

    Button configureButton =
        createButton(
            "Configure...",
            "problem-dialog-configure",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                handler.onConfigure();
                onClose();
              }
            });
    Button keepBlankButton =
        createButton(
            "Keep Blank",
            "problem-dialog-keepBlank",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                handler.onKeepBlank();
                onClose();
              }
            });
    configureButton.addStyleName(resources.centerPanelCss().blueButton());
    getFooter().add(configureButton);
    getFooter().add(keepBlankButton);
  }
  // Adds all the content to main panel
  public void initialize() {
    resultPanel = new FlowPanel();
    FlowPanel innerPanel = new FlowPanel();
    innerPanel.addStyleName("content-box");

    innerPanel.add(new HTML("<h2>Search results for " + filterString + "</h2>"));
    onlyLoanableButton = new Button("");
    onlyLoanableButton.addStyleName("onlyLoanable");
    onlyLoanableButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            onlyLoanable = !onlyLoanable;
            resultsTableList = new ArrayList<ShopItem>(results);
            if (onlyLoanable)
              for (ShopItem i : resultsTableList) if (!i.isLoanable()) resultsTableList.remove(i);
            updateTable();
          }
        });
    innerPanel.add(onlyLoanableButton);
    innerPanel.add(createResultTable());

    resultPanel.add(innerPanel);
    initWidget(resultPanel);
    layout.add(this);
  }
  /**
   * Creates an empty dialog box specifying its "auto-hide" property. It should not be shown until
   * its child widget has been added using {@link #add(Widget)}.
   *
   * @param autoHide <code>true</code> if the dialog should be automatically hidden when the user
   *     clicks outside of it
   * @param modal <code>true</code> if keyboard and mouse events for widgets not contained by the
   *     dialog should be ignored
   */
  public MyDialogBox(boolean autoHide, boolean modal) {
    super(autoHide, modal);
    dock = new HorizontalPanel();
    dock.add(caption);
    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(0);
    dock.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);

    listener = new DialogListener(this);
    minimiseBtn.addClickListener(listener);
    maximiseBtn.addClickListener(listener);
    closeBtn.addClickListener(listener);

    hp.add(minimiseBtn);
    hp.add(maximiseBtn);
    hp.add(closeBtn);
    dock.add(hp);
    panel.add(dock);

    panel.setHeight("100%");
    panel.setSpacing(0);

    sp = new ScrollPanel();
    panel.add(sp);
    super.setWidget(panel);

    setStyleName("gwt-DialogBox");
    dock.setStyleName("Caption");
    caption.addMouseListener(this);
  }
示例#9
0
  /** When the login button is clicked blabla happens */
  @UiHandler("loginButton")
  void onClick(ClickEvent e) {

    if (loginButton.getText().equals("Login")) {
      login();
    } else if (loginButton.getText().equals("Logout")) logout();
  }
示例#10
0
  public ListDialogBox(List<String> strings) {
    ScrollPanel sPanel = new ScrollPanel();
    VerticalPanel vPanel = new VerticalPanel();

    vPanel.add(new HTML("<br>"));

    if (strings != null) {
      for (String s : strings) {
        vPanel.add(new Label(s));
      }
    }

    Button close = new Button("close");
    close.addClickHandler(crosshandler);

    vPanel.add(new HTML("<br>"));
    vPanel.add(new HTML("<hr>"));
    vPanel.add(new HTML("<br>"));
    vPanel.add(close);

    sPanel.setVisible(true);
    sPanel.add(vPanel);
    this.add(sPanel);
    this.setText("RAW data from DB");
  }
 private void updateStyle() {
   if (selected) {
     button.addStyleName("btn-danger");
   } else {
     button.removeStyleName("btn-danger");
   }
 }
示例#12
0
  public void run(final RootPanel rp, final String nick) {

    if (Cookies.getCookie(nick) == null) Cookies.setCookie(nick, "" + 0);

    cl.setPageSize(500);

    final Button sendMessage =
        new Button(
            "sendMessage",
            new ClickHandler() {

              public void onClick(ClickEvent event) {

                if (!message.getText().equals("")) {
                  new Post().postJson(SERVERURL, nick.toString(), message.getText());
                  message.setText("");
                }
              }
            });

    rp.get("mainDiv2").setVisible(true);
    message.getElement().setAttribute("placeholder", "Introduce your message");
    message.getElement().setAttribute("id", "message");

    cl.getElement().setAttribute("id", "chatBox");

    sendMessage.getElement().setAttribute("id", "sendMessage");
    sendMessage.setText("Send");

    vp.getElement().setAttribute("id", "verticalPanel");
    hp.getElement().setAttribute("id", "horizontalPanel");

    panel.getElement().setAttribute("id", "scroller");

    hp.add(message);
    hp.add(sendMessage);
    panel.add(cl);
    vp.add(panel);

    vp.add(hp);
    rp.get("mainDiv2").add(vp);

    Timer t =
        new Timer() {
          @Override
          public void run() {
            getMessages();

            if (chatList != null && Integer.parseInt(Cookies.getCookie(nick)) < chatList.size()) {
              cl.setRowCount(chatList.size() + 1, true);
              cl.setRowData(
                  Integer.parseInt(Cookies.getCookie(nick)),
                  chatList.subList(Integer.parseInt(Cookies.getCookie(nick)), chatList.size()));
              panel.setVerticalScrollPosition(panel.getMaximumVerticalScrollPosition() - 1);
              Cookies.setCookie(nick, "" + chatList.size());
            }
          }
        };
    t.scheduleRepeating(1000);
  }
  /** This is used when creating a new rule. */
  public NewAssetWizard(EditItemEvent afterCreate, boolean showCats, String format, String title) {
    super("images/new_wiz.gif", title);
    this.showCats = showCats;
    this.format = format;

    this.afterCreate = afterCreate;

    addAttribute("Name:", name);

    if (showCats) {
      addAttribute("Initial category:", getCatChooser());
    }

    if (format == null) {
      addAttribute("Type (format) of rule:", this.formatChooser);
    }

    addAttribute("Package:", packageSelector);

    description.setVisibleLines(4);
    description.setWidth("100%");
    addAttribute("Initial description:", description);

    Button ok = new Button("OK");
    ok.addClickListener(
        new ClickListener() {
          public void onClick(Widget arg0) {
            ok();
          }
        });

    addAttribute("", ok);

    setStyleName("ks-popups-Popup");
  }
  private void createImageFormInput(VerticalPanel principalPanel) {
    VerticalPanel form = new VerticalPanel();
    HorizontalPanel formLineName = new HorizontalPanel();
    HorizontalPanel formLineURL = new HorizontalPanel();
    HorizontalPanel formLineAgregar = new HorizontalPanel();

    Label lbName = new Label("Nombre");
    this.txtName = new TextBox();
    formLineName.add(lbName);
    formLineName.add(this.txtName);
    form.add(formLineName);

    Label lbURL = new Label("URL");
    this.txtURL = new TextBox();
    formLineURL.add(lbURL);
    formLineURL.add(this.txtURL);
    form.add(formLineURL);

    Button btnAgregar = new Button("Agregar");
    btnAgregar.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            addImageEntry(txtName.getText(), txtURL.getText());
          }
        });

    formLineAgregar.add(btnAgregar);
    form.add(formLineAgregar);
    principalPanel.add(form);
  }
示例#15
0
  private void displayStock(final String finalSymbol) {
    // Add the task to the table.
    int row = tasksFlexTable.getRowCount();
    tasks.add(finalSymbol);
    tasksFlexTable.setText(row, 0, finalSymbol);
    tasksFlexTable.setWidget(row, 2, new Label());
    tasksFlexTable.getCellFormatter().addStyleName(row, 1, "watchListNumericColumn");
    tasksFlexTable.getCellFormatter().addStyleName(row, 2, "watchListNumericColumn");
    tasksFlexTable.getCellFormatter().addStyleName(row, 3, "watchListRemoveColumn");

    // Add a button to remove this task from the table.
    Button removeTaskButton = new Button("x");
    removeTaskButton.addStyleDependentName("remove");
    removeTaskButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            removeStock(finalSymbol);
          }
        });
    tasksFlexTable.setWidget(row, 3, removeTaskButton);

    // Get the stock price.
    refreshWatchList();

    newTaskTextBox.setFocus(true);
  }
示例#16
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);
  }
示例#17
0
 public void selectButton(Object obj) {
   for (int i = 0; i < panel.getWidgetCount(); i++) {
     Button b = (Button) panel.getWidget(i);
     if (b.getElement().getPropertyObject("object") == obj) b.addStyleName("Ribbon-selected");
     else b.removeStyleName("Ribbon-selected");
   }
 }
示例#18
0
 /**
  * Constructs a button with text string and with step target
  *
  * <p>Verify datas only on click "Next" button
  *
  * <p>store datas if
  *
  * @param text
  * @param toStep
  * @return build button
  */
 protected Button prepareButton(String text, final int toStep) {
   Button button = new Button();
   button.setText(text);
   button.addClickHandler(
       new ClickHandler() {
         public void onClick(ClickEvent event) {
           if (stepNumber < toStep) {
             try {
               if (!controller.isDebugActivated()) {
                 // Ask to verify datas
                 Map<SetupWizardData, String> datas = verifyDatas(toStep);
                 // Ask to controller to store these datas
                 controller.storeDatas(datas, toStep);
               }
               controller.displayScreen(toStep);
             } catch (InvalidWizardViewFieldException e) {
               controller.displayError(e.getWizardMessage());
             }
           } else {
             controller.displayScreen(toStep);
           }
         }
       });
   return button;
 }
  /**
   * @function setLabelsAndIds
   * @created_date : Jan 2, 2014
   * @description To set Labels and Id for buttons.
   * @parm(s) :
   * @return : void
   * @throws : <Mentioned if any exceptions>
   */
  private void setLabelsAndIds() {
    btnResourceLink.setText(i18n.GL0548());
    btnResourceLink.getElement().setId("btnResourceLink");
    btnResourceLink.getElement().setAttribute("alt", i18n.GL0548());
    btnResourceLink.getElement().setAttribute("title", i18n.GL0548());

    lblGooruFieldTrip.setText(i18n.GL0549());
    lblGooruFieldTrip.getElement().setId("lblGooruFieldTrip");
    lblGooruFieldTrip.getElement().setAttribute("alt", i18n.GL0549());
    lblGooruFieldTrip.getElement().setAttribute("title", i18n.GL0549());

    // lblGooruFieldTripDescUnforseen.setText(i18n.GL0550);
    // lblGooruFieldTripDescOriginal.setText(i18n.GL0552);
    lblGooruFieldTripDescOriginal.setText("");
    lblGooruFieldTripDescOriginal.getElement().setId("lblGooruFieldTripDescOriginal");
    lblGooruFieldTripDescOriginal.getElement().setAttribute("alt", "");
    lblGooruFieldTripDescOriginal.getElement().setAttribute("title", "");

    lblDontForget.setText(i18n.GL0551());
    lblDontForget.getElement().setId("lblDontForget");
    lblDontForget.getElement().setAttribute("alt", i18n.GL0551());
    lblDontForget.getElement().setAttribute("title", i18n.GL0551());

    imgFieldTrip.getElement().setId("imgFieldTrip");
    imgFieldTrip.setUrl("images/framebraker/field-trip.png");

    resoruceFrameBrakerContainer.getElement().setId("fpnlResoruceFrameBrakerContainer");
    resourceCategory.getElement().setId("pnlResourceCategory");
    lblGooruFieldTripDescUnforseen.getElement().setId("lblGooruFieldTripDescUnforseen");
    supportTip.getElement().setId("lblSupportTip");
    //		learnMoreLbl.setText("Learn more.");
  }
示例#20
0
  /** Constructor. */
  private ExportBox() {
    super(false);

    panel = new VerticalPanel();
    panel.getElement().getStyle().setMarginTop(1, Unit.EM);

    setHeadline(R.lang.Export());
    setDraggable(true);
    setWidth(WIDTH_PX + "px");

    btnExportXML = new Button(R.lang.exportInFile());
    btnExportXML.getElement().getStyle().setFloat(Float.RIGHT);
    btnExportXML.addClickHandler(this);

    btnClose = new Button(R.lang.Close());
    btnClose.getElement().getStyle().setMarginLeft(1, Unit.EM);
    btnClose.getElement().getStyle().setFloat(Float.RIGHT);
    btnClose.addClickHandler(this);

    textarea = new TextArea();
    textarea.setWidth((WIDTH_PX - 10) + "px");
    textarea.setHeight("200px");

    btnPanel = new FlowPanel();
    btnPanel.add(btnClose);
    btnPanel.add(btnExportXML);

    panel.add(textarea);
    panel.add(btnPanel);

    setContentWidget(panel);
  }
示例#21
0
  @Override
  public void displayUsers(Map<Integer, String> users) {
    usersList.clear();

    for (Integer userId : users.keySet()) {
      HTMLPanel panel = new HTMLPanel("");

      Anchor linkToEdit = new Anchor();

      linkToEdit.setText(users.get(userId));

      PlaceRequest placeToGo =
          new PlaceRequest.Builder()
              .nameToken(NameTokens.USER)
              .with(NameTokens.PARAM_ID, String.valueOf(userId))
              .build();
      linkToEdit.setHref("#" + tokenFormatter.toPlaceToken(placeToGo));

      Button deleteButton = new Button();
      deleteButton.setText("X");
      deleteButton.addClickHandler(clickEvent -> getUiHandlers().deleteUser(userId));

      panel.add(linkToEdit);
      panel.add(deleteButton);

      usersList.add(panel);
    }
  }
 private void showFieldChange() {
   final FormStylePopup pop = new FormStylePopup();
   pop.setModal(false);
   String[] fields =
       this.sce.getFieldCompletions(
           FieldAccessorsAndMutators.MUTATOR, this.editingCol.getFactType());
   final ListBox box = new ListBox();
   for (int i = 0; i < fields.length; i++) {
     box.addItem(fields[i]);
   }
   pop.addAttribute(constants.Field(), box);
   Button b = new Button(constants.OK());
   pop.addAttribute("", b);
   b.addClickHandler(
       new ClickHandler() {
         public void onClick(ClickEvent w) {
           editingCol.setFactField(box.getItemText(box.getSelectedIndex()));
           editingCol.setType(
               sce.getFieldType(editingCol.getFactType(), editingCol.getFactField()));
           makeLimitedValueWidget();
           doFieldLabel();
           pop.hide();
         }
       });
   pop.show();
 }
 public void setActivated(boolean activated) {
   if (activated == true) {
     activated_btn.setText("Deactivate");
   } else {
     activated_btn.setText("Activate");
   }
 }
  protected void showNewPatternDialog() {
    final FormStylePopup pop = new FormStylePopup();
    pop.setTitle(constants.NewFactSelectTheType());
    final ListBox types = new ListBox();
    for (int i = 0; i < sce.getFactTypes().length; i++) {
      types.addItem(sce.getFactTypes()[i]);
    }
    pop.addAttribute(constants.FactType(), types);
    final TextBox binding = new TextBox();
    pop.addAttribute(constants.Binding(), binding);

    Button ok = new Button(constants.OK());
    ok.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent w) {
            editingCol.setBoundName(binding.getText());
            editingCol.setFactType(types.getItemText(types.getSelectedIndex()));
            editingCol.setFactField(null);
            makeLimitedValueWidget();
            doPatternLabel();
            doFieldLabel();
            pop.hide();
          }
        });
    pop.addAttribute("", ok);

    pop.show();
  }
  public WgtEditOneTrigger() {
    VerticalPanel vpanel = new VerticalPanel();
    m_lstConditions.addChangeListener(this);
    m_lstConditions.setVisibleItemCount(10);
    vpanel.add(m_lstConditions);

    m_lstConditionsClass.setVisibleItemCount(1);
    for (ConditionClass conditionClass : ConditionClass.values()) {
      m_lstConditionsClass.addItem(conditionClass.name());
    }
    vpanel.add(m_lstConditionsClass);

    m_btnNewCondition.addClickHandler(this);
    vpanel.add(m_btnNewCondition);
    m_lstActions.addChangeListener(this);
    m_lstActions.setVisibleItemCount(10);
    vpanel.add(m_lstActions);

    m_lstActionsClass.setVisibleItemCount(1);
    for (ActionClass actionClass : ActionClass.values()) {
      m_lstActionsClass.addItem(actionClass.name());
    }
    vpanel.add(m_lstActionsClass);

    m_btnNewAction.addClickHandler(this);
    vpanel.add(m_btnNewAction);

    initWidget(vpanel);
  }
示例#26
0
  @Test
  public void runAsync() {
    // Arrange
    Button b = new Button();
    b.addClickHandler(
        new ClickHandler() {

          public void onClick(ClickEvent event) {
            GWT.runAsync(
                new RunAsyncCallback() {

                  public void onFailure(Throwable reason) {
                    fail("GWT.runAsync() has called \"onFailure\" callback");
                  }

                  public void onSuccess() {
                    success = true;
                  }
                });
          }
        });

    // Act
    Browser.click(b);

    // Assert
    assertTrue(success);
  }
  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();
  }
示例#28
0
  /**
   * Create an options panel that allows users to select a widget and reposition it.
   *
   * @return the new options panel
   */
  private Widget createOptionsBar() {
    // Create a panel to move components around
    HorizontalPanel optionsBar = new HorizontalPanel();
    optionsBar.setSpacing(5);
    optionsBar.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    // Add a title
    optionsBar.add(new HTML("<b>Animate Logos</b>"));

    // Add start button
    startButton = new Button("Start");
    startButton.addClickListener(
        new ClickListener() {
          public void onClick(Widget sender) {
            animation.run(2000);
          }
        });
    optionsBar.add(startButton);

    // Add cancel button
    cancelButton = new Button("Cancel");
    cancelButton.addClickListener(
        new ClickListener() {
          public void onClick(Widget sender) {
            animation.cancel();
          }
        });
    optionsBar.add(cancelButton);

    // Return the options bar
    return optionsBar;
  }
示例#29
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);
  }
  public void setPath(Path path) {
    this.fullPath = path;
    // ts.clear();
    ts.addAttribute(
        DecisionTableXLSEditorConstants.INSTANCE.UploadNewVersion() + ":",
        new AttachmentFileWidget(
            fullPath,
            new Command() {
              @Override
              public void execute() {}
            }));

    Button dl = new Button("Download");
    // dl.setEnabled( this.asset.getVersionNumber() > 0 );
    dl.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            Window.open(
                GWT.getModuleBaseURL()
                    + "file?"
                    + HTMLFileManagerFields.FORM_FIELD_PATH
                    + "="
                    + fullPath.toURI(),
                "downloading",
                "resizable=no,scrollbars=yes,status=no");
          }
        });
    ts.addAttribute(DecisionTableXLSEditorConstants.INSTANCE.DownloadCurrentVersion() + ":", dl);
  }