예제 #1
0
  public PermissionsPanel(final JSONObject entityJsonObject) {

    //	this.center();
    this.setAutoHideEnabled(true);

    VerticalPanel vp = new VerticalPanel();
    vp.setSpacing(30);
    vp.setWidth("300px");

    vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);

    vp.add(new CloseButton(this));

    vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    vp.add(new Label("Permissions to Edit this information:"));

    vp.add(listPermissions(entityJsonObject));

    permissionName.setValue(null);
    permissionName.setWidth("200px");
    vp.add(permissionName);

    vp.add(new ButtonAddPermission(entityJsonObject, this));

    this.setWidget(vp);
  }
예제 #2
0
  @Inject
  public MainView(IndexDisplayer indexDisplayer) {

    c.setStyleName("tab");
    c.addStyleName("first");
    p.setStyleName("tab");

    message.setStyleName("messageBar");
    message.setVisible(false);

    int i;
    for (i = 0; i < 5; i++) {
      startIndex.addItem(indexDisplayer.getDisplay(i), Integer.toString(i));
    }
    for (i = 5; i < 10; i++) {
      lastIndex.addItem(indexDisplayer.getDisplay(i), Integer.toString(i));
    }

    startIndex.setSelectedIndex(0);
    lastIndex.setSelectedIndex(0);

    HorizontalPanel hp = new HorizontalPanel();
    hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hp.add(new Label("Start Index: "));
    hp.add(startIndex);
    hp.add(new Label("End Index: "));
    hp.add(lastIndex);
    hp.setSpacing(5);

    bar.add(c);
    bar.add(p);
    bar.setStyleName("tabs");

    mainPanel = new VerticalPanel();
    mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    clearHistory.setStyleName("link");
    mainPanel.add(clearHistory);

    mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    mainPanel.add(hp);
    mainPanel.add(bar);
    mainPanel.add(message);
    mainPanel.add(bodyContainer);
    mainPanel.add(filter);
    mainPanel.add(filterActivate);
    mainPanel.add(filterModule);
    mainPanel.add(hasBeenThere);
    mainPanel.add(broadcastInfo);
    mainPanel.add(showStatus);
    mainPanel.add(activateStatus);
    wait.add(new Label("Wait"));

    initWidget(mainPanel);

    bodyContainer.setStyleName("body");
    bodyContainer.setWidget(new Label("Click on one of the tab to start."));
  }
  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();
  }
 /** Constructor that builds the view that holds a title and all the phone calls if they exist. */
 public PhoneBillView() {
   VerticalPanel panel = new VerticalPanel();
   panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
   panel.add(new HTML("<h2>View the Phone Bill</h2>"));
   panel.add(table);
   initWidget(panel);
 }
예제 #5
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);
          }
        }
예제 #6
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();
          }
        });
  }
예제 #7
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);
  }
예제 #8
0
 public Dialog(String title) {
   dialogBox.setText(title);
   VerticalPanel verticalPanel = new VerticalPanel();
   verticalPanel.add(contentPanel);
   verticalPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
   verticalPanel.add(buttonPanel);
   dialogBox.add(verticalPanel);
   dialogBox.addCloseHandler(closeHandler);
   buttonPanel.setSpacing(2);
 }
  public RegisterResultPanel() {
    ServiceManager.getInstance().addLeagueUpdateListener(this);
    ServiceManager.getInstance().addLoginListener(this);

    mainPanel = new VerticalPanel();
    mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    mainPanel.setSpacing(Spelstegen.VERTICAL_SPACING);
    panelIsVisible = false;
    initWidget(mainPanel);
  }
  /** This is the entry point method. */
  public void onModuleLoad() {
    sendButton = new Button("Send");
    nameField = new TextBox();
    nameField.setText("GWT User");
    errorLabel = new Label();

    // We can add style names to widgets
    sendButton.addStyleName("sendButton");

    // Add the nameField and sendButton to the RootPanel
    // Use RootPanel.get() to get the entire body element
    RootPanel.get("nameFieldContainer").add(nameField);
    RootPanel.get("sendButtonContainer").add(sendButton);
    RootPanel.get("errorLabelContainer").add(errorLabel);

    // Focus the cursor on the name field when the app loads
    nameField.setFocus(true);
    nameField.selectAll();

    // Create the popup dialog box
    dialogBox = new DialogBox();
    dialogBox.setText("Remote Procedure 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(VerticalPanel.ALIGN_RIGHT);
    dialogVPanel.add(closeButton);
    dialogBox.setWidget(dialogVPanel);

    // Add a handler to close the DialogBox
    final ClickHandler buttonClickHandler =
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            dialogBox.hide();
            sendButton.setEnabled(true);
            sendButton.setFocus(true);
          }
        };
    closeButton.addClickHandler(buttonClickHandler);

    // Add a handler to send the name to the server
    ChangeEventHandler handler = new ChangeEventHandler();
    sendButton.addClickHandler(handler);
    nameField.addKeyUpHandler(handler);
  }
  /** Default constructor */
  public DeleteConfiguration() {
    super();

    initService();

    initWidget(mainPanel);

    mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    mainPanel.setSpacing(10);

    DecoratorPanel dp = new DecoratorPanel();
    mainPanel.add(dp);
    mainPanel.setCellHorizontalAlignment(dp, HasHorizontalAlignment.ALIGN_CENTER);

    mainPanel.setWidth(DOCK_PANEL_WIDTH);

    upperPanel.setWidth(PERCENT_100);
    upperPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    upperPanel.setSpacing(10);

    // Sub-Title
    Label subTitleLabel = new Label(SUB_TITLE);
    subTitleLabel.addStyleDependentName(SUB_TITLE_LABEL_STYLE);
    upperPanel.add(subTitleLabel);
    upperPanel.setCellHorizontalAlignment(subTitleLabel, HasHorizontalAlignment.ALIGN_CENTER);

    wbConfigTextBox.addChangeHandler(this);
    LabeledWidget workbookIdBox = new LabeledWidget(wbConfigTextBox);
    workbookIdBox.setLabelText(CONFIG_ID_COLON);
    workbookIdBox.setPanelWidth(RESULTS_DATA_WIDTH);
    upperPanel.add(workbookIdBox);

    submitButton.addClickHandler(this);
    submitButton.setEnabled(false);
    upperPanel.add(submitButton);

    dp.add(upperPanel);
  }
  /** Creates new component design panel for non-visible components. */
  public SimpleNonVisibleComponentsPanel() {
    // Initialize UI
    VerticalPanel panel = new VerticalPanel();
    panel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);

    heading = new Label("");
    heading.setStyleName("ya-NonVisibleComponentsHeader");
    panel.add(heading);

    componentsPanel = new FlowPanel();
    componentsPanel.setStyleName("ode-SimpleUiDesignerNonVisibleComponents");
    panel.add(componentsPanel);

    initWidget(panel);
  }
  @Override
  public void showEmpty(Displayer displayer) {
    currentDisplayer = null;
    VerticalPanel centeredPanel = new VerticalPanel();
    centeredPanel.setWidth("100%");
    centeredPanel.setHeight("100%");
    centeredPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    centeredPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    Label noDataLabel = new Label(DashboardConstants.INSTANCE.noData());
    centeredPanel.add(noDataLabel);

    displayerPanel.clear();
    displayerPanel.add(centeredPanel);
  }
예제 #14
0
  /** Displays a {@link RunInfoDialogBox}. */
  public RunInfoDialogBox(DataManager data) {

    super(true); // autohide
    this.setModal(true);
    this.setStyleName("wmt-DialogBox");
    this.setText("Model Run Information");
    this.data = data;

    VerticalPanel contents = new VerticalPanel();
    contents.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    contents.setWidth("30em");
    contents.getElement().getStyle().setMargin(1.0, Unit.EM);

    String msg = "<h2>Congratulations!</h2><p>You have submitted your model run.</p>";
    HTML msgHtml = new HTML(msg);
    contents.add(msgHtml);

    choicePanel = new ChoicePanel();
    choicePanel.getOkButton().setHTML(Constants.FA_STATUS + "View run status...");
    choicePanel.getCancelButton().setHTML(Constants.FA_BEER + "Close");
    contents.add(choicePanel);

    this.setWidget(contents);

    /*
     * Hides the dialog box.
     */
    DialogCancelHandler cancelHandler = new DialogCancelHandler(this);
    choicePanel.getCancelButton().addClickHandler(cancelHandler);

    /*
     * Opens run status page in a new tab.
     */
    ClickHandler okHandler =
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            RunInfoDialogBox.this.hide();
            Window.open(
                DataURL.showCurrentModelRun(RunInfoDialogBox.this.data), "WMT_currentRun", null);
          }
        };
    choicePanel.getOkButton().addClickHandler(okHandler);

    // Apply standard handlers to "Enter" and "Esc" keys.
    choicePanel.addDomHandler(
        new ModalKeyHandler(okHandler, cancelHandler), KeyDownEvent.getType());
  }
  public void showCloseButtonPanel() {
    CaptionPanel closePanel = new CaptionPanel(constants.closeTitle());
    closePanel.setWidth("185px");

    VerticalPanel vp = new VerticalPanel();
    vp.setWidth("100%");
    vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    closeButton = new Button(constants.close());

    vp.add(closeButton);

    closePanel.setContentWidget(vp);

    builderContent.add(closePanel);
  }
  public void showCodePreviewPanel() {
    CaptionPanel showCode = new CaptionPanel(constants.showCodeTitle());
    showCode.setWidth("185px");

    VerticalPanel vp = new VerticalPanel();
    vp.setWidth("100%");
    vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    showCodeButton = new Button(constants.showCode());

    vp.add(showCodeButton);

    showCode.setContentWidget(vp);

    builderContent.add(showCode);
  }
예제 #17
0
  public TextInputDialogBox(String title, String text, String placeholder) {
    // Set the dialog box's caption.
    setText(title);

    VerticalPanel vPanel = new VerticalPanel();
    HorizontalPanel hPanel = new HorizontalPanel();

    // Enable animation.
    setAnimationEnabled(true);

    // Enable glass background.
    setGlassEnabled(true);

    // Center this bad boy.
    center();

    vPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);

    Button ok = new Button("OK");
    ok.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            TextInputDialogBox.this.onPositive();
          }
        });

    Button cancel = new Button("Cancel");
    cancel.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            TextInputDialogBox.this.onNegative();
          }
        });

    hPanel.add(ok);
    hPanel.add(cancel);

    textBox = new PlaceholderTextBox();
    textBox.setPlaceholder(placeholder);
    textBox.setWidth("97%");
    textBox.setText(text);
    vPanel.add(textBox);
    vPanel.add(hPanel);

    setWidget(vPanel);
  }
  public SingleLightboxImagePanel() {
    VerticalPanel panel = new VerticalPanel();
    panel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    panel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);

    Label headerLabel = new Label("Single Image Demo");
    panel.add(headerLabel);
    panel.add(getDescription());

    Image image = new Image("image.jpg");
    image.setTitle("Image Title"); // Not required, but will be used as caption
    LightboxImage lightboxImage = new LightboxImage(image);

    panel.add(lightboxImage);
    panel.add(getCodeSnippet());
    initWidget(panel);
  }
예제 #19
0
  public MetricsHome(String chartOption) {

    VerticalPanel vp = new VerticalPanel();
    vp.setSize("97%", "100%");

    vpMetricsChart.setSize("100%", "100%");
    vpMetricsChart.setSpacing(30);
    vpMetricsChart.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    vp.add(new MetricsOptions());

    vp.add(vpMetricsChart);

    openDocumentationOption(chartOption);

    this.add(vp);
  }
  @Override
  public void showLoading(Displayer displayer) {
    currentDisplayer = null;
    VerticalPanel centeredPanel = new VerticalPanel();
    centeredPanel.setWidth("100%");
    centeredPanel.setHeight("100%");
    centeredPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    centeredPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    Image loadingIcon =
        new Image(DataSetClientResources.INSTANCE.images().loadingIcon().getSafeUri());
    loadingIcon.setTitle(DashboardConstants.INSTANCE.loading());
    loadingIcon.setAltText(DashboardConstants.INSTANCE.loading());
    centeredPanel.add(loadingIcon);

    displayerPanel.clear();
    displayerPanel.add(centeredPanel);
  }
예제 #21
0
  private VerticalPanel createWidget() {
    VerticalPanel vp = new VerticalPanel();
    vp.setWidth(468 + "px");
    vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    vp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    StringBuilder sb = new StringBuilder();
    sb.append("<b>HOW TO PLAY</b>").append("<br>");
    sb.append("Use arrow keys to merge the numbers.").append("<br>").append("<br>");

    sb.append("<b>ABOUT 2048</b>").append("<br>");
    sb.append(
            "This popular and highly addictive game 2048 was created by Gabriele Cirulli (<a href='http://gabrielecirulli.com/' target='_blank'> gabrielecirulli.com </a>)")
        .append("<br>")
        .append("<br>");

    sb.append("<b>ABOUT THIS SITE</b>").append("<br>");
    sb.append(
            "On this site yo can find GWT (Google Web Toolkit) implementation of the game 2048. It was mainly writen because of the fun and as a learning process of Html5 support in GWT.")
        .append("<br>")
        .append("<br>");

    sb.append(
            "You can find source code <a href='https://github.com/kalbomat/gwt2048' target='_blank'> here </a>.")
        .append("<br>")
        .append("<br>");

    HTML h0 = new HTML(sb.toString());
    vp.add(h0);

    Button closeButton = new Button("Close");
    vp.add(closeButton);
    closeButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            hide();
            aboutCloseHandler.setFocusOnClose();
          }
        });

    return vp;
  }
  public void addTree(HtmlTextTree textTree) {
    if (getWidgetCount() > 0) clear();
    myTabLayoutScrollPanel
        .getMyTabLayoutPanel()
        .getLinacLegoWebApp()
        .getStatusTextArea()
        .addStatus("Finished building " + treeType + " layout view.");
    pbsLevelPanel =
        new PbsLevelPanel(
            0, textTree.getTextTreeArrayList().get(0), true, null, myTabLayoutScrollPanel);
    VerticalPanel vertWrapperPanel = new VerticalPanel();
    vertWrapperPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    vertWrapperPanel.add(new InlineHTML(textTree.getInlineHtmlString(false, false)));
    vertWrapperPanel.add(pbsLevelPanel);
    add(vertWrapperPanel);
    //	      pbsLevelPanel.focusPanel.setFocus(false);
    pbsLevelPanel.expandPanel();
  }
  /** Configures a flex table and corresponding titles to add to the overall layout. */
  private VerticalPanel addToPanel(
      String sectionText, final FlexTable table, final boolean isAsset) {
    VerticalPanel layout = new VerticalPanel();
    layout.setWidth("60%");
    layout.setStyleName("asset-step-layout");
    layout.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);

    table.setWidth("100%");
    FlexCellFormatter formatter = table.getFlexCellFormatter();
    formatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT);

    // Adding the section headings for the table
    Label sectionLabel = new Label(sectionText);
    sectionLabel.setStyleName("square-title");
    table.setWidget(0, 0, sectionLabel);

    if (table.getRowCount() == 0) {
      this.addRowToTable("", null, -1, table, isAsset); // initially blank
    }

    Button newRowButton = null;
    if (isAsset) {
      newRowButton = new Button(messages.addAssetButton());
    } else {
      newRowButton = new Button(messages.addSecuritySubGoal());
    }

    newRowButton.setWidth("180px");

    newRowButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            addRowToTable("", null, new Integer(-1), table, isAsset);
          }
        });

    layout.add(table);
    layout.add(newRowButton);

    return layout;
  }
  /** This is the entry point method. */
  public void onModuleLoad() {
    // Create the popup dialog box
    dialogBox = new DialogBox();
    dialogBox.setText("Remote Procedure Call");
    dialogBox.setAnimationEnabled(true);
    dialogBox.setModal(true);
    closeButton = new Button("Close");
    // We can set the id of a widget by accessing its Element
    closeButton.getElement().setId("closeButton");
    errorLabel = new HTML();
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.addStyleName("dialogVPanel");
    dialogVPanel.add(errorLabel);
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
    dialogVPanel.add(closeButton);
    dialogBox.setWidget(dialogVPanel);

    // Add a handler to close the DialogBox
    closeButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            dialogBox.hide();
          }
        });

    authService.isLoggedIn(
        new AsyncCallback<Boolean>() {
          public void onFailure(Throwable arg0) {
            showError("Error", Message.SERVER_ERROR);
          }

          public void onSuccess(Boolean res) {
            if (res) {
              displayMainUI();
            } else {
              displayLoginForm();
            }
          }
        });
  }
예제 #25
0
  // Method response to user click of "Search" menu in top menubar.
  // Causes popup panel to appear
  protected void doPostSearch() {
    VerticalPanel content = new VerticalPanel();
    content.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    HorizontalPanel inputRow = new HorizontalPanel();
    Label searchTermLabel = new Label("Search Title Term: ");
    final TextBox searchTermTextBox = new TextBox();
    inputRow.add(searchTermLabel);
    inputRow.add(searchTermTextBox);

    HorizontalPanel btnRow = new HorizontalPanel();
    btnRow.setStyleName("search-button-row");
    Button cancelBtn = new Button("Cancel");
    cancelBtn.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            searchPopup.hide();
          }
        });
    Button searchBtn = new Button("Search");
    searchBtn.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            control.handleTitleSearchRequest(searchTermTextBox.getText());
            searchPopup.hide();
          }
        });
    btnRow.add(cancelBtn);
    btnRow.add(new Label(""));
    btnRow.add(searchBtn);

    content.add(inputRow);
    content.add(btnRow);
    searchPopup.setWidget(content);
    searchPopup.center();
  }
예제 #26
0
  private void initializeStatusPanel() {
    String comboWidth = "125px";
    statusPanel = new VerticalPanel();
    StyleInjector.inject(
        ".statusPanelStyle { "
            + "background: #E0ECF8;"
            + "border-radius: 5px 10px;"
            + "opacity: 0.8}");
    statusPanel.setStyleName("statusPanelStyle");

    statusPanel.setSpacing(5);
    statusPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    initializeLayerCombo(comboWidth);
    initializeEpsgCombo(comboWidth);
    initializeStatusGrid();

    statusPanel.add(new FieldLabel(layerCombo, UIMessages.INSTANCE.sbSelectLayerLabel()));
    statusPanel.add(new FieldLabel(epsgCombo, UIMessages.INSTANCE.sbEpsgLabel()));
    statusPanel.add(statusGrid);

    statusPanel.setVisible(false);
  }
  public IdentifyAssetsAndGoalsSubGoalsPane(State stateInfo) {
    super(stateInfo);

    VerticalPanel layout = new VerticalPanel();
    layout.setWidth("100%");
    layout.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    layout.setSpacing(5);

    // Get up to date data first thing
    this.updateBusinessGoalInformation(new SubGoalsTableInitializer());
    this.updateBusinessGoalInformation(new AssetTableInitializer());

    // Then add the data to our flex tables
    this.subGoalsTable = new FlexTable();
    layout.add(addToPanel(messages.securitySubGoalsLabel(), this.subGoalsTable, false));

    // And do the same thing for the assets
    this.assetsTable = new FlexTable();
    layout.add(addToPanel(messages.assetsLabel(), this.assetsTable, true));
    layout.add(NavigationButtons(layout));

    this.getContent().clear();
    this.getContent().add(layout);
  }
예제 #28
0
  public InformationDialog(String html) {

    // Set the dialog box's caption.
    setText(LocaleMessages.LANG.information());

    // Enable animation.
    setAnimationEnabled(false);

    // Enable glass background.
    setGlassEnabled(true);

    Label label = new Label(html);

    Button ok = new Button(LocaleMessages.LANG.accept());
    ok.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            InformationDialog.this.hide();
          }
        });

    VerticalPanel panel = new VerticalPanel();
    VerticalPanel panelH = new VerticalPanel();

    panel.setHeight("100px");
    panel.setWidth("180px");

    panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    panel.add(label);
    panelH.setHeight("40px");
    panel.add(panelH);
    panel.add(ok);

    setWidget(panel);
  }
예제 #29
0
  public ScheduleEditor(ScheduleDialogType type) {
    super();
    isBlockoutDialog = (type == ScheduleDialogType.BLOCKOUT);
    startTimePicker = new TimePicker();

    setStylePrimaryName("scheduleEditor"); // $NON-NLS-1$

    scheduleCombo = createScheduleCombo();
    Label l = new Label(MSGS.recurrenceColon());
    l.setStyleName(SCHEDULE_LABEL);
    add(l);
    add(scheduleCombo);

    SimplePanel hspacer = new SimplePanel();
    hspacer.setWidth("100px"); // $NON-NLS-1$

    if (!isBlockoutDialog) {
      startTimePanel = createStartTimePanel();
      add(startTimePanel);
    } else {

      // Blockout End TimePicker
      blockoutEndTimePicker = new TimePicker();
      blockoutEndTimePicker.setHour("01"); // $NON-NLS-1$
      blockoutEndTimePicker.setMinute("00"); // $NON-NLS-1$
      blockoutEndTimePicker.setTimeOfDay(TimeUtil.TimeOfDay.PM);

      // Blockout End Caption Panel
      blockoutEndTimePicker.getElement().getStyle().setDisplay(Display.NONE);

      final String[] daysList = new String[365];
      final String[] hoursList = new String[24];
      final String[] minutesList = new String[60];

      // Populate list
      for (Integer i = 0; i < 365; i++) {
        String iStr = i.toString();
        daysList[i] = iStr;

        if (i < 60) {
          minutesList[i] = iStr;
          if (i < 24) {
            hoursList[i] = iStr;
          }
        }
      }

      // Units of time Drop Down
      daysListBox = new ListBox();
      daysListBox.getElement().setId("daysListBox"); // $NON-NLS-1$
      populateListItems(daysListBox, daysList, 0, 365);

      final Label daysLabel = new Label(MSGS.dayOrDays());
      daysLabel.getElement().setAttribute("for", daysListBox.getElement().getId()); // $NON-NLS-1$

      hoursListBox = new ListBox();
      hoursListBox.getElement().setId("hoursListBox"); // $NON-NLS-1$
      populateListItems(hoursListBox, hoursList, 0, 24);

      final Label hoursLabel = new Label(MSGS.hourOrHours());
      hoursLabel.getElement().setAttribute("for", hoursListBox.getElement().getId()); // $NON-NLS-1$

      minutesListBox = new ListBox();
      minutesListBox.getElement().setId("minutesListBox"); // $NON-NLS-1$
      populateListItems(minutesListBox, minutesList, 0, 60);

      final Label minutesLabel = new Label(MSGS.minuteOrMinutes());
      minutesLabel
          .getElement()
          .setAttribute("for", minutesListBox.getElement().getId()); // $NON-NLS-1$

      final HorizontalPanel durationPanel = new HorizontalPanel();
      durationPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
      durationPanel.setSpacing(blockoutEndTimePicker.getSpacing());
      durationPanel.add(daysListBox);
      durationPanel.add(daysLabel);
      durationPanel.add(hoursListBox);
      durationPanel.add(hoursLabel);
      durationPanel.add(minutesListBox);
      durationPanel.add(minutesLabel);

      // Bind change handler
      this.scheduleCombo.addChangeHandler(
          new ChangeHandler() {

            @Override
            public void onChange(ChangeEvent event) {
              String scheduleType = scheduleCombo.getItemText(scheduleCombo.getSelectedIndex());

              if (ScheduleType.RUN_ONCE.toString().equals(scheduleType)) {
                show(
                    true,
                    daysListBox,
                    daysLabel,
                    hoursListBox,
                    hoursLabel,
                    minutesListBox,
                    minutesLabel);

                populateListItems(daysListBox, daysList, 0, 365);
                populateListItems(hoursListBox, hoursList, 0, 24);
                populateListItems(minutesListBox, minutesList, 0, 60);

              } else if (ScheduleType.HOURS.toString().equals(scheduleType)) {
                hide(true, daysListBox, daysLabel, hoursListBox, hoursLabel);
                show(true, minutesListBox, minutesLabel);

                populateListItems(minutesListBox, minutesList, 0, 60);

              } else if (ScheduleType.DAILY.toString().equals(scheduleType)) {
                hide(true, daysListBox, daysLabel);
                show(true, hoursListBox, hoursLabel, minutesListBox, minutesLabel);

                populateListItems(hoursListBox, hoursList, 0, 24);
                populateListItems(minutesListBox, minutesList, 0, 60);

              } else if (ScheduleType.WEEKLY.toString().equals(scheduleType)) {
                show(
                    true,
                    daysListBox,
                    daysLabel,
                    hoursListBox,
                    hoursLabel,
                    minutesListBox,
                    minutesLabel);

                populateListItems(daysListBox, daysList, 0, 7);
                populateListItems(hoursListBox, hoursList, 0, 24);
                populateListItems(minutesListBox, minutesList, 0, 60);

              } else if (ScheduleType.MONTHLY.toString().equals(scheduleType)) {
                show(
                    true,
                    daysListBox,
                    daysLabel,
                    hoursListBox,
                    hoursLabel,
                    minutesListBox,
                    minutesLabel);

                populateListItems(daysListBox, daysList, 0, 28);
                populateListItems(hoursListBox, hoursList, 0, 24);
                populateListItems(minutesListBox, minutesList, 0, 60);

              } else if (ScheduleType.YEARLY.toString().equals(scheduleType)) {
                show(
                    true,
                    daysListBox,
                    daysLabel,
                    hoursListBox,
                    hoursLabel,
                    minutesListBox,
                    minutesLabel);

                populateListItems(daysListBox, daysList, 0, 365);
                populateListItems(hoursListBox, hoursList, 0, 24);
                populateListItems(minutesListBox, minutesList, 0, 60);
              }
            }
          });

      /*
       * Radio Buttons for duration
       */
      this.durationRadioButton =
          new RadioButton("durationRadioGroup", "durationRadioButton"); // $NON-NLS-1$ //$NON-NLS-2$
      this.durationRadioButton.setText(MSGS.duration());
      this.durationRadioButton.setValue(Boolean.TRUE);
      this.durationRadioButton.addClickHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              blockoutEndTimePicker.getElement().getStyle().setDisplay(Display.NONE);
              durationPanel.getElement().getStyle().clearDisplay();
            }
          });

      this.endTimeRadioButton =
          new RadioButton("durationRadioGroup", "endTimeRadioButton"); // $NON-NLS-1$ //$NON-NLS-2$
      this.endTimeRadioButton.setText(MSGS.endTime());
      this.endTimeRadioButton.addClickHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              blockoutEndTimePicker.getElement().getStyle().clearDisplay();
              durationPanel.getElement().getStyle().setDisplay(Display.NONE);
            }
          });

      // Radio Buttons Panel
      HorizontalPanel radioButtonsPanel = new HorizontalPanel();
      radioButtonsPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
      radioButtonsPanel.add(this.durationRadioButton);
      radioButtonsPanel.add(this.endTimeRadioButton);

      // Ends Panel
      VerticalPanel endsPanel = new VerticalPanel();
      endsPanel.add(radioButtonsPanel);
      endsPanel.add(blockoutEndTimePicker);
      endsPanel.add(durationPanel);

      // Blockout period
      CaptionPanel blockoutStartCaptionPanel = new CaptionPanel(MSGS.startTime());
      HorizontalPanel blockoutStartPanel = new HorizontalPanel();
      blockoutStartPanel.add(getStartTimePicker());
      timeZonePicker = new ListBox();
      timeZonePicker.setStyleName("timeZonePicker");
      timeZonePicker.setVisibleItemCount(1);
      blockoutStartPanel.add(timeZonePicker);
      timeZonePicker.getElement().getParentElement().getStyle().setPaddingTop(5, Unit.PX);

      blockoutStartCaptionPanel.add(blockoutStartPanel);
      populateTimeZonePicker();

      // Ends Caption Panel
      CaptionPanel endCaptionPanel = new CaptionPanel(MSGS.endsCaptionTitle());
      endCaptionPanel.add(endsPanel);

      VerticalPanel blockoutPanel = new VerticalPanel();
      blockoutPanel.setWidth("100%"); // $NON-NLS-1$
      blockoutPanel.add(blockoutStartCaptionPanel);
      blockoutPanel.add(endCaptionPanel);

      add(blockoutPanel);
    }

    VerticalPanel vp = new VerticalPanel();
    vp.setWidth("100%"); // $NON-NLS-1$
    add(vp);
    setCellHeight(vp, "100%"); // $NON-NLS-1$

    runOnceEditor = new RunOnceEditor(startTimePicker);
    vp.add(runOnceEditor);
    scheduleTypeMap.put(ScheduleType.RUN_ONCE, runOnceEditor);
    runOnceEditor.setVisible(true);

    recurrenceEditor = new RecurrenceEditor(startTimePicker);
    vp.add(recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.SECONDS, recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.MINUTES, recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.HOURS, recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.DAILY, recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.WEEKLY, recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.MONTHLY, recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.YEARLY, recurrenceEditor);
    recurrenceEditor.setVisible(false);

    cronEditor = new CronEditor();
    scheduleTypeMap.put(ScheduleType.CRON, cronEditor);
    cronEditor.setVisible(false);

    if (!isBlockoutDialog) {
      vp.add(cronEditor);

      VerticalPanel blockoutButtonPanel = new VerticalPanel();
      blockoutButtonPanel.setWidth("100%"); // $NON-NLS-1$
      // blockoutButtonPanel.setHeight("30%");
      blockoutButtonPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
      blockoutButtonPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);

      // We want to add a button to check for blockout conflicts
      blockoutCheckButton.setStyleName("pentaho-button"); // $NON-NLS-1$
      blockoutCheckButton.getElement().setId("blockout-check-button"); // $NON-NLS-1$
      blockoutCheckButton.setVisible(false);

      hspacer.setHeight("50px"); // $NON-NLS-1$
      blockoutButtonPanel.add(hspacer);
      blockoutButtonPanel.add(blockoutCheckButton);

      vp.add(hspacer);
      add(blockoutButtonPanel);
    }

    configureOnChangeHandler();
  }
예제 #30
0
  @Override
  public void onModuleLoad() {
    this.agentInfo = computeAgentInfo();
    this.listener = getApplicationListener();
    this.config = getConfig();

    if (config.rootPanel != null) {
      this.root = config.rootPanel;
    } else {
      Element element = Document.get().getElementById("embed-" + GWT.getModuleName());
      if (element == null) {
        VerticalPanel panel = new VerticalPanel();
        panel.setWidth("" + config.width + "px");
        panel.setHeight("" + config.height + "px");
        panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        RootPanel.get().add(panel);
        RootPanel.get().setWidth("" + config.width + "px");
        RootPanel.get().setHeight("" + config.height + "px");
        this.root = panel;
      } else {
        VerticalPanel panel = new VerticalPanel();
        panel.setWidth("" + config.width + "px");
        panel.setHeight("" + config.height + "px");
        panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        element.appendChild(panel.getElement());
        root = panel;
      }
    }

    // initialize SoundManager2
    SoundManager.init(GWT.getModuleBaseURL(), 9);

    // wait for soundmanager to load, this is fugly, but for
    // some reason the ontimeout and onerror callbacks are never
    // called (function instanceof Function fails, wtf JS?).
    new Timer() {
      @Override
      public void run() {
        if (SoundManager.swfLoaded()) {
          final PreloaderCallback callback = getPreloaderCallback();
          preloader = new Preloader();
          preloader.preload(
              "assets.txt",
              new PreloaderCallback() {
                @Override
                public void loaded(String file, int loaded, int total) {
                  callback.loaded(file, loaded, total);
                }

                @Override
                public void error(String file) {
                  callback.error(file);
                }

                @Override
                public void done() {
                  callback.done();
                  root.clear();
                  setupLoop();
                }
              });
          cancel();
        }
      }
    }.scheduleRepeating(100);
  }