Esempio n. 1
0
  private void buildToolbar() {
    toolbar = new ToolBar();

    next = new Button();
    next.setIconStyle("icon-next");
    next.setText("Next " + NUMBER_OF_RESULTS + " Results");
    next.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            start += NUMBER_OF_RESULTS;
            if (start + NUMBER_OF_RESULTS > currentResults.getLength()) next.setEnabled(false);
            if (start > 0) prev.setEnabled(true);
            fillTable();
          }
        });

    prev = new Button();
    prev.setIconStyle("icon-previous");
    prev.setText("Previous " + NUMBER_OF_RESULTS + " Results");
    prev.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            start -= NUMBER_OF_RESULTS;
            if (start < 0) start = 0;
            if (start == 0) prev.setEnabled(false);
            if (start + NUMBER_OF_RESULTS < currentResults.getLength()) next.setEnabled(true);
            fillTable();
          }
        });

    toolbar.add(prev);
    toolbar.add(next);
  }
  private void buildToolbar(RowData data) {
    toolbar = new ToolBar();

    saveAndAddTaxa = new Button();
    saveAndAddTaxa.setText("Save and Add Taxa");
    saveAndAddTaxa.setIconStyle("icon-go-jump");
    saveAndAddTaxa.setTitle("Save and Add Taxa");
    saveAndAddTaxa.addListener(
        Events.Select,
        new Listener() {
          public void handleEvent(BaseEvent be) {
            save(SAVEANDCONTINUE);
          }
        });

    save = new Button();
    save.setText("Save");
    save.setIconStyle("icon-save");
    save.setTitle("Save and Continue Editing");
    save.addListener(
        Events.Select,
        new Listener() {
          public void handleEvent(BaseEvent be) {
            save(SAVE);
          }
        });

    saveAndExit = new Button();
    saveAndExit.setIconStyle("icon-save-and-exit");
    saveAndExit.setText("Save and Exit");
    saveAndExit.setTitle("Save and Exit without adding taxa");
    saveAndExit.addListener(
        Events.Select,
        new Listener() {
          public void handleEvent(BaseEvent be) {
            save(SAVEANDEXIT);
          }
        });

    cancel = new Button();
    cancel.setIconStyle("icon-cancel");
    cancel.setText("Cancel");
    cancel.setTitle("Cancel");
    cancel.addListener(
        Events.Select,
        new Listener() {
          public void handleEvent(BaseEvent be) {
            cancel();
          }
        });

    addItemsToToolBar();
    add(toolbar, data);
  }
  public void draw() {

    if (!drawn) {
      for (String definable : DefinitionCache.impl.getDefinables())
        addDefinition(definable, DefinitionCache.impl.getDefinition(definable));

      Button save = new Button();
      save.setText("Save");
      save.setIconStyle("icon-save");
      save.setTitle("Save");
      save.addListener(
          Events.Select,
          new Listener<BaseEvent>() {
            public void handleEvent(BaseEvent be) {
              save();
            }
          });

      Button add = new Button();
      add.setText("Add new definition");
      add.setIconStyle("icon-add");
      add.setTitle("Add new definition");
      add.addListener(
          Events.Select,
          new Listener<BaseEvent>() {
            public void handleEvent(BaseEvent be) {
              TextField<String> f = addDefinition("", "");
              layout();

              scrollIntoView(f);
            }
          });

      ToolBar toolbar = new ToolBar();
      toolbar.add(save);
      toolbar.add(add);
      setTopComponent(toolbar);

      drawn = true;
    }
  }
  @Override
  public ToolBar initToolBar() {
    SubModuleToolbar toolbar = new SubModuleToolbar(getEventBus());

    final Button importUser = new Button();

    importUser.setText(I18nUtils.getMessages().user_button_importUsers());
    importUser.setTitle(I18nUtils.getMessages().user_button_importUsers_tip());
    importUser.setIcon(AbstractImagePrototype.create(Icons.INSTANCE.user()));
    importUser.enable();
    importUser.addListener(
        Events.OnClick,
        new Listener<BaseEvent>() {

          public void handleEvent(BaseEvent be) {
            initUserImportView();
          }
        });
    toolbar.add(importUser);

    return toolbar;
  }
Esempio n. 5
0
    @Override
    public void onSuccess(final List<ConnectionRequest> result) {

      try {
        if (result.isEmpty()) {
          connectionRequest.setVisible(false);
        } else {
          final Menu scrollMenu = new Menu();
          scrollMenu.setMaxHeight(MAX_HEIGHT);
          for (final ConnectionRequest r : result) {
            MenuItem m = acceptConnectionMenuItem(scrollMenu, r);
            scrollMenu.add(m);
          }

          connectionRequest.setMenu(scrollMenu);
          connectionCount = result.size();

          connectionRequest.setText("Requests(" + connectionCount + ')');
        }
      } catch (NimbitsException ex) {
        FeedbackHelper.showError(ex);
      }
    }
Esempio n. 6
0
 /**
  * Creates a new button with the given text.
  *
  * @param text the button text
  */
 public Button(String text) {
   this();
   setText(text);
 }
  private ToolBar createCalendarToolbar() {
    ToolBar calendarToolbar = new ToolBar();

    currentMonthAndYear = new Button();
    DateTimeFormat formatter = DateTimeFormat.getFormat("MMMM yyyy");
    String result = formatter.format(calendar.getDate());
    currentMonthAndYear.setText(result);
    currentMonthAndYear.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            dpDialog.show();
            dpDialog.center();
          }
        });

    Button today = new Button("<b>" + HarvesterUI.CONSTANTS.today() + "</b>");
    today.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            ((DatePicker) dpDialog.getItem(0)).setValue(new Date());
            //                DateTimeFormat formatter = DateTimeFormat.getFormat("MMMM yyyy");
            //                String result = formatter.format(calendar.getDate());
            //                currentMonthAndYear.setText(result);
            //                calendarTaskManager.updateScheduleTasks();
          }
        });

    Button yearLeft = new Button("<b>" + "<<" + "</b>");
    yearLeft.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            DateWrapper dw = new DateWrapper(calendar.getDate());
            ((DatePicker) dpDialog.getItem(0)).setValue(dw.addMonths(-1).asDate());
            //                DateTimeFormat formatter = DateTimeFormat.getFormat("MMMM yyyy");
            //                String result = formatter.format(calendar.getDate());
            //                currentMonthAndYear.setText(result);
            //                calendarTaskManager.updateScheduleTasks();
          }
        });

    Button yearRight = new Button("<b>" + ">>" + "</b>");
    yearRight.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            DateWrapper dw = new DateWrapper(calendar.getDate());
            ((DatePicker) dpDialog.getItem(0)).setValue(dw.addMonths(1).asDate());
            //                DateTimeFormat formatter = DateTimeFormat.getFormat("MMMM yyyy");
            //                String result = formatter.format(calendar.getDate());
            //                currentMonthAndYear.setText(result);
            //                calendarTaskManager.updateScheduleTasks();
          }
        });

    calendarToolbar.add(today);
    calendarToolbar.add(new SeparatorToolItem());
    calendarToolbar.add(yearLeft);
    calendarToolbar.add(currentMonthAndYear);
    calendarToolbar.add(yearRight);
    calendarToolbar.add(new SeparatorToolItem());

    calendarToolbar.add(new FillToolItem());
    createViewsButtons(calendarToolbar);

    return calendarToolbar;
  }
Esempio n. 8
0
  @Override
  protected void onRender(Element target, int index) {
    super.onRender(target, index);

    layout.setPadding(new Padding(2, 17, 1, 10)); // DIM
    layout.setHBoxLayoutAlign(HBoxLayout.HBoxLayoutAlign.MIDDLE);
    c.setLayout(layout);
    c.setLayoutOnChange(true);
    c.setAutoHeight(false);
    c.setAutoWidth(false);

    left.setIcon(AbstractImagePrototype.create(AzzeroCO2Resources.INSTANCE.left()));
    left.setIconAlign(Style.IconAlign.LEFT);
    left.setSize(32, 32);
    left.setText("");
    left.setToolTip("");
    left.setTitle("");
    left.setEnabled(false);
    left.setVisible(false);

    left.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            Dispatcher.forwardEvent(new AppEvent(UnAnnoDiAttivitaEvents.Previous, ce));
          }
        });
    c.add(left, new HBoxLayoutData(new Margins(0, 0, 0, 0)));

    flex.setFlex(1);
    c.add(leftText, flex);

    leftText.setSize(200, 15);
    rigthText.setSize(250, 15);
    rigthText.setStyleAttribute("text-align", "right");
    rigthText.setStyleAttribute("font-family", "arial");
    leftText.setStyleAttribute("font-family", "arial");
    leftText.setStyleAttribute("font-size", "14px");
    rigthText.setStyleAttribute("font-size", "14px");

    c.add(rigthText, new HBoxLayoutData(new Margins(0, 5, 0, 0)));

    right.setIconAlign(Style.IconAlign.RIGHT);
    //  right.setText("Energia");
    right.setIcon(AbstractImagePrototype.create(AzzeroCO2Resources.INSTANCE.rigth()));
    right.setSize(32, 32);
    right.setTitle("");
    right.setText("");
    right.setToolTip("");

    c.add(right, new HBoxLayoutData(new Margins(0, 0, 0, 0)));
    right.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            if (rigthText.getText().equalsIgnoreCase("torna alla home")) {
              Dispatcher.forwardEvent(CentralEvents.ShowPanel, Eventi.MAIN);
            } else {
              Dispatcher.forwardEvent(new AppEvent(UnAnnoDiAttivitaEvents.Next, ce));
            }
          }
        });
    add(c);
  }