Example #1
0
  @Inject
  public AddElementPanel(
      final Dispatcher dispatcher,
      EditorProvider editorProvider,
      Provider<ElementDialog> dialogProvider) {
    this.editorProvider = editorProvider;
    this.dialogProvider = dialogProvider;

    HBoxLayout layout = new HBoxLayout();
    layout.setHBoxLayoutAlign(HBoxLayoutAlign.STRETCHMAX);
    layout.setPack(BoxLayoutPack.CENTER);
    layout.setPadding(new Padding(15));
    setLayout(layout);

    add(
        createAddButton(
            I18N.CONSTANTS.addChart(),
            IconImageBundle.ICONS.barChart(),
            new SelectionListener<ButtonEvent>() {

              @Override
              public void componentSelected(ButtonEvent ce) {
                addElement(new ChartTemplate(dispatcher));
              }
            }));
    add(
        createAddButton(
            I18N.CONSTANTS.addTable(),
            IconImageBundle.ICONS.table(),
            new SelectionListener<ButtonEvent>() {

              @Override
              public void componentSelected(ButtonEvent ce) {
                addElement(new PivotTableTemplate(dispatcher));
              }
            }));
    add(
        createAddButton(
            I18N.CONSTANTS.addMap(),
            IconImageBundle.ICONS.map(),
            new SelectionListener<ButtonEvent>() {

              @Override
              public void componentSelected(ButtonEvent ce) {
                addElement(new MapTemplate(dispatcher));
              }
            }));
    add(
        createAddButton(
            I18N.CONSTANTS.addText(),
            IconImageBundle.ICONS.text(),
            new SelectionListener<ButtonEvent>() {

              @Override
              public void componentSelected(ButtonEvent ce) {
                addElement(new TextReportElement());
              }
            }));
  }
Example #2
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);
  }