Ejemplo n.º 1
0
  private ButtonPanel createButtonPanel() {
    final Button customizeButton = new Button("");
    customizeButton.setVisible(_isDashboardEditor);
    customizeButton.addStyleDependentName("ImageButton");
    customizeButton.setTitle("Customize timeline");
    customizeButton.addStyleName("CustomizeButton");
    customizeButton.addClickHandler(new CustomizeTimelineHandler(_service, this));

    final Button copyButton = new Button("");
    copyButton.setVisible(_isDashboardEditor);
    copyButton.addStyleDependentName("ImageButton");
    copyButton.setTitle("Copy timeline");
    copyButton.addStyleName("CopyButton");
    copyButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            TimelinePanel copyPanel =
                new TimelinePanel(_tenant, _service, null, _timelineGroupPanel, _isDashboardEditor);
            copyPanel.setTimelineDefinition(_timelineDefinition);
            _timelineGroupPanel.add(copyPanel);
          }
        });

    final ButtonPanel buttonPanel = new ButtonPanel();

    buttonPanel.add(_header);
    buttonPanel.add(customizeButton);
    buttonPanel.add(copyButton);
    buttonPanel.add(_saveButton);
    buttonPanel.add(_deleteButton);

    return buttonPanel;
  }
Ejemplo n.º 2
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);
  }
Ejemplo n.º 3
0
  private Button createButton(int buttonsType, String text, ClickHandler clickHandler) {
    Button b;
    if (buttonsType == CONFIG_DEFAULT) b = new GWTCButton();
    else b = new GWTCButton(GWTCButton.BUTTON_TYPE_0, "");

    if (buttonsType == CONFIG_FLAT_BUTTONS) b.addStyleDependentName("flat");

    if (clickHandler != null) b.addClickHandler(clickHandler);

    b.setText(text);
    return b;
  }
Ejemplo n.º 4
0
 private void addRemoveButtonForStock(final String symbol, int row) {
   Button removeStockButton = new Button("x");
   removeStockButton.addStyleDependentName("remove");
   removeStockButton.addClickHandler(
       new ClickHandler() {
         public void onClick(ClickEvent event) {
           int removedIndex = stocks.indexOf(symbol);
           stocks.remove(removedIndex);
           stocksFlexTable.removeRow(removedIndex + 1);
         }
       });
   stocksFlexTable.setWidget(row, 3, removeStockButton);
 }
    public InnerItem(Serializable s) {
      close.addStyleDependentName("SMALLER");
      close.addClickHandler(
          new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
              inner.hide();
            }
          });
      innerLayout.add(close);
      grid.getCellFormatter().setWidth(0, 0, "85%");
      grid.getCellFormatter().setWidth(0, 1, "5%");
      label.setText(s.getName());
      grid.setWidget(0, 0, label);
      if (s instanceof CategorySerializable) {
        CategorySerializable c = (CategorySerializable) s;
        if (c.getDoc() != null || c.getAttributes().get("children_dsid") != null) {
          image.addClickHandler(
              new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                  inner.setPopupPosition(image.getAbsoluteLeft(), image.getAbsoluteTop());
                  inner.show();
                }
              });
          grid.setWidget(0, 1, image);
          if (c.getDoc() != null) {
            String url = c.getDoc();
            if (!c.getDoc().equals("")) {
              Anchor link = new Anchor("Documentation", url, "_blank");
              innerLayout.add(link);
            }
          }
          if (c.getAttributes().get("children_dsid") != null) {
            Anchor meta =
                new Anchor(
                    "Variable and Grid Description",
                    "getMetadata.do?dsid=" + c.getAttributes().get("children_dsid"),
                    "_blank");
            innerLayout.add(meta);
          }
          inner.add(innerLayout);
        }
      }
      initWidget(grid);
    }
Ejemplo n.º 6
0
  public TimelinePanel(
      TenantIdentifier tenant,
      DashboardServiceAsync service,
      TimelineIdentifier timelineIdentifier,
      DashboardGroupPanel timelineGroupPanel,
      boolean isDashboardEditor) {
    super();
    _tenant = tenant;
    _service = service;
    _timelineIdentifier = timelineIdentifier;
    _timelineGroupPanel = timelineGroupPanel;
    _isDashboardEditor = isDashboardEditor;
    _header = new HeadingLabel("");

    _loadingIndicator = new LoadingIndicator();
    _loadingIndicator.setHeight((DefaultVAxisOption.DEFAULT_HEIGHT + 4) + "px");

    _saveButton = new Button("");
    _saveButton.setVisible(isDashboardEditor);
    _saveButton.addStyleDependentName("ImageButton");
    _saveButton.setTitle("Save timeline");
    _saveButton.addStyleName("SaveButton");
    _saveButton.addClickHandler(new SaveTimelineClickHandler(_service, _tenant, this));

    if (_timelineIdentifier != null) {
      // initially does not make sense to save an (unchanged) and
      // identifyable timeline.
      setTimelineDefinitionUnchanged();
    }

    _deleteButton = new Button();
    _deleteButton.setVisible(isDashboardEditor);
    _deleteButton.addStyleDependentName("ImageButton");
    _deleteButton.setTitle("Delete timeline");
    _deleteButton.addStyleName("DeleteButton");
    _deleteButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            final boolean confirmation =
                Window.confirm("Are you sure you wish to delete this timeline?");
            if (confirmation) {
              if (_timelineIdentifier != null) {
                _service.removeTimeline(
                    _tenant,
                    _timelineIdentifier,
                    new DCAsyncCallback<Boolean>() {
                      @Override
                      public void onSuccess(Boolean result) {
                        // do nothing
                      }
                    });
              }
              _timelineGroupPanel.removeTimelinePanel(TimelinePanel.this);
            }
          }
        });

    addStyleName("TimelinePanel");
    add(createButtonPanel());
    updateHeader();
    setLoading();

    if (_timelineIdentifier != null) {
      _service.getTimelineDefinition(
          _tenant,
          _timelineIdentifier,
          new DCAsyncCallback<TimelineDefinition>() {
            @Override
            public void onSuccess(final TimelineDefinition definition) {
              setTimelineDefinition(definition);
            }
          });
    }
  }