示例#1
0
  private Layout buildButtons(boolean disabled, boolean icon, boolean error, boolean sized) {

    String[] buttonStyles = new String[] {"Normal", "Primary", "Small", "Link"};

    HorizontalLayout hl = new HorizontalLayout();
    hl.setSpacing(true);
    hl.setMargin(true);

    for (int i = 0; i < buttonStyles.length; i++) {
      Button b;
      if (nativeButtons) {
        b = new NativeButton(buttonStyles[i] + " style");
      } else {
        b = new Button(buttonStyles[i] + " style");
      }
      b.setStyleName(buttonStyles[i].toLowerCase());
      if (icon) {
        b.setIcon(
            new ThemeResource("../runo/icons/" + (largeIcons ? "64" : "16") + "/document.png"));
      }
      if (error) {
        b.setComponentError(new UserError("Error"));
      }
      if (disabled) {
        b.setEnabled(false);
      }
      if (sized) {
        b.setWidth("250px");
        b.setCaption(b.getCaption() + " (250px)");
      }
      hl.addComponent(b);
    }

    return hl;
  }
示例#2
0
  private Component buildFields() {
    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);
    fields.addStyleName("fields");

    username = new TextField("Usuario");
    username.setIcon(FontAwesome.USER);
    username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    username.focus();

    clave = new PasswordField("Contraseña");
    clave.setIcon(FontAwesome.LOCK);
    clave.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final Button signin = new Button("Entrar");
    signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signin.setClickShortcut(KeyCode.ENTER);

    fields.addComponents(username, clave, signin);
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    signin.addClickListener(
        new ClickListener() {
          private static final long serialVersionUID = 1L;

          @Override
          public void buttonClick(final ClickEvent event) {

            doLogin();
          }
        });
    return fields;
  }
示例#3
0
  public void initializeAddBtnPanel() {
    btnAdd = initSizeButton(btnAdd, "Agregar", ">", null);
    btnAddAll = initSizeButton(btnAddAll, "Agregar Todos", ">>", null);
    btnRemove = initSizeButton(btnRemove, "Quitar", "<", null);
    btnRemoveAll = initSizeButton(btnRemoveAll, "Quitar Todos", "<<", null);

    panelAddButton = new VerticalLayout();
    panelAddButton.setMargin(false);
    panelAddButton.setHeight("100%");
    panelAddButton.setWidth("100%");

    GridLayout grid = new GridLayout(1, 4);
    grid.setWidth("90%");
    grid.setHeight("50%");

    grid.addComponent(btnAddAll, 0, 0);
    grid.setComponentAlignment(btnAddAll, Alignment.MIDDLE_CENTER);
    grid.addComponent(btnRemoveAll, 0, 3);
    grid.setComponentAlignment(btnRemoveAll, Alignment.MIDDLE_CENTER);
    panelAddButton.addComponent(grid);
    panelAddButton.setComponentAlignment(grid, Alignment.MIDDLE_CENTER);

    mainPanel.addComponent(panelAddButton);
    mainPanel.setExpandRatio(panelAddButton, new Float(0.10));
  }
示例#4
0
  @Override
  protected void setup() {
    HorizontalLayout hl = new HorizontalLayout();
    hl.setWidth("250px");

    final String longString = "this is a somewhat long string.";
    final Label longLabel = new Label(longString);

    Button changeLength = new Button("Change length");
    changeLength.addListener(
        new Button.ClickListener() {
          public void buttonClick(ClickEvent event) {
            if (longLabel.getValue().equals(longString)) {
              longLabel.setValue("");
            } else {
              longLabel.setValue(longString);
            }
          }
        });

    hl.addComponent(longLabel);
    hl.addComponent(changeLength);

    addComponent(hl);
  }
  public ConfirmationDialog(String caption, String description) {
    setCaption(caption);
    setModal(true);
    setResizable(false);
    setClosable(false);
    setWidth(400, Unit.PIXELS);
    setHeight(200, Unit.PIXELS);
    addCloseListener(this);

    okButton = UIHelper.createButton("ok", null, null, this);
    okButton.setId("confirmationDialog.button.ok");
    cancelButton = UIHelper.createButton("cancel", "cancels the current action.", null, this);
    cancelButton.setId("confirmationDialog.button.cancel");
    label.setDescription(description);

    final HorizontalLayout buttonLayout = new HorizontalLayout(okButton, cancelButton);
    buttonLayout.setSpacing(true);

    layout.setSpacing(true);
    layout.setMargin(true);
    layout.setSizeFull();
    layout.addComponent(label);
    layout.addComponent(buttonLayout);
    layout.setComponentAlignment(buttonLayout, Alignment.BOTTOM_RIGHT);

    setContent(layout);
    center();
  }
  private Component createReindeerTab() {
    HorizontalLayout layout = new HorizontalLayout();
    layout.setMargin(true);

    splitButton = new SplitButton("New Document");
    splitButton.setIcon(new ThemeResource("../runo/icons/16/document-add.png"));
    splitButton.setComponent(createSplitButtonPopupContent());

    splitButton.addClickListener(
        new SplitButtonClickListener() {
          public void splitButtonClick(SplitButtonClickEvent event) {
            getMainWindow().showNotification("Button clicked!");
          }
        });

    splitButton.addPopupVisibilityListener(
        new SplitButtonPopupVisibilityListener() {
          public void splitButtonPopupVisibilityChange(SplitButtonPopupVisibilityEvent event) {
            String msg = "Popup closed";
            if (event.getSplitButton().isPopupVisible()) {
              msg = "Popup opened";
            }
            getMainWindow().showNotification(msg);
          }
        });
    layout.addComponent(splitButton);

    return layout;
  }
    public OrderChanger(final Indexed container, final Object itemId) {
      HorizontalLayout layout = new HorizontalLayout();
      layout.addComponent(up);
      up.setIcon(new ThemeResource("../runo/icons/32/arrow-up.png"));
      up.addStyleName(BaseTheme.BUTTON_LINK);
      up.addListener(
          new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
              int newIndex = container.indexOfId(itemId) - 1;
              container.removeItem(itemId);
              container.addItemAt(newIndex, itemId);
              up.setEnabled(newIndex > 0);
            }
          });
      up.setEnabled(container.indexOfId(itemId) > 0);

      layout.addComponent(down);
      down.setIcon(new ThemeResource("../runo/icons/32/arrow-down.png"));
      down.addStyleName(BaseTheme.BUTTON_LINK);
      down.addListener(
          new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
              int newIndex = container.indexOfId(itemId) + 1;
              container.removeItem(itemId);
              container.addItemAt(newIndex, itemId);
              down.setEnabled(newIndex < container.size() - 1);
            }
          });
      down.setEnabled(container.indexOfId(itemId) < container.size() - 1);

      setCompositionRoot(layout);
    }
示例#8
0
  public TimelineScreen() {

    setMargin(true);

    Label label = new Label(VaadinSession.getCurrent().getAttribute(Principal.class).getName());

    Button button = new Button("Logout");

    button.addClickListener(new LogoutBehavior());

    HorizontalLayout menuBar = new HorizontalLayout(label, button);

    menuBar.setWidth(100, PERCENTAGE);
    menuBar.setComponentAlignment(button, MIDDLE_RIGHT);
    menuBar.setMargin(true);

    addComponent(menuBar);

    TweetRefresherBehavior behavior = TwaattinUI.getCurrent().getTweetRefresherBehavior();

    addComponentAttachListener(behavior);

    VerticalLayout timeline = new VerticalLayout();

    timeline.addStyleName("p-timeline");

    addComponent(timeline);
  }
  @PostConstruct
  private void initForm() {
    this.addFormComponents();

    final Button commit = new Button("Commit");
    final Button cancel = new Button("Cancel");

    cancel.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(Button.ClickEvent event) {
            clearForm();
          }
        });
    commit.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(Button.ClickEvent event) {
            sendForm();
            clearForm();
          }
        });
    final HorizontalLayout buttonBar = new HorizontalLayout();

    buttonBar.addComponent(commit);
    buttonBar.addComponent(cancel);

    addComponent(buttonBar);
  }
示例#10
0
 private HorizontalLayout createStyleToolbar() {
   HorizontalLayout toolbar = new HorizontalLayout();
   Button boldButton = new Button(FontAwesome.BOLD);
   boldButton.addClickListener(
       new ClickListener() {
         @Override
         public void buttonClick(ClickEvent event) {
           updateSelectedCellsBold();
         }
       });
   ColorPicker backgroundColor = new ColorPicker();
   backgroundColor.setCaption("Background Color");
   backgroundColor.addColorChangeListener(
       new ColorChangeListener() {
         @Override
         public void colorChanged(ColorChangeEvent event) {
           updateSelectedCellsBackgroundColor(event.getColor());
         }
       });
   ColorPicker fontColor = new ColorPicker();
   fontColor.setCaption("Font Color");
   fontColor.addColorChangeListener(
       new ColorChangeListener() {
         @Override
         public void colorChanged(ColorChangeEvent event) {
           updateSelectedCellsFontColor(event.getColor());
         }
       });
   toolbar.addComponent(boldButton);
   toolbar.addComponent(backgroundColor);
   toolbar.addComponent(fontColor);
   return toolbar;
 }
  private Component buildFooter() {
    HorizontalLayout footer = new HorizontalLayout();
    footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
    footer.setWidth(100.0f, Unit.PERCENTAGE);

    Button ok = new Button("OK");
    ok.addStyleName(ValoTheme.BUTTON_PRIMARY);
    ok.addClickListener(
        event -> {
          try {
            fieldGroup.commit();
            // Updated user should also be persisted to database. But
            // not in this demo.

            Notification success = new Notification("Profile updated successfully");
            success.setDelayMsec(2000);
            success.setStyleName("bar success small");
            success.setPosition(Position.BOTTOM_CENTER);
            success.show(Page.getCurrent());

            //                    DashboardEventBus.post(new ProfileUpdatedEvent());
            close();
          } catch (CommitException e) {
            Notification.show("Error while updating profile", Type.ERROR_MESSAGE);
          }
        });
    ok.focus();
    footer.addComponent(ok);
    footer.setComponentAlignment(ok, Alignment.TOP_RIGHT);
    return footer;
  }
示例#12
0
  private com.vaadin.ui.Component buildFields() {
    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);
    fields.addStyleName("fields");

    final TextField username = new TextField("Username");
    username.setIcon(FontAwesome.USER);
    username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final PasswordField password = new PasswordField("Password");
    password.setIcon(FontAwesome.LOCK);
    password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final Button signin = new Button("Sign In");
    signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signin.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    signin.focus();

    fields.addComponents(username, password, signin);
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    signin.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(final Button.ClickEvent event) {
            DashboardEventBus.post(
                new UserLoginRequestedEvent(username.getValue(), password.getValue()));
          }
        });
    return fields;
  }
示例#13
0
 @Override
 public Layout startLayout() {
   VerticalLayout vl = new VerticalLayout();
   vl.setMargin(true);
   vl.setSpacing(true);
   Label tps = new Label("Temps de scan estimé : " + Ping.TPS);
   Label desc = new Label(Ping.DESCRITPION, ContentMode.HTML);
   HorizontalLayout hl = new HorizontalLayout();
   hl.setMargin(true);
   hl.setSpacing(true);
   @SuppressWarnings("serial")
   Button start =
       new ScanStartButton() {
         @Override
         public void onClick() {
           ping.start(site);
           panel.setContent(runningLayout());
         }
       };
   hl.addComponents(start);
   hl.setSizeUndefined();
   vl.addComponents(desc, tps, hl);
   vl.setComponentAlignment(hl, Alignment.MIDDLE_CENTER);
   return vl;
 }
示例#14
0
  private void BuildMenu() {
    menu.removeAllComponents();
    menu.addStyleName("menu");
    menu.setSizeUndefined();
    menu.setMargin(true);

    for (final String view : routes.keySet()) {
      Button b =
          new NativeButton(
              view.substring(0, 1).toUpperCase() + view.substring(1).replace('-', ' '));
      b.addStyleName("icon-" + view);
      b.setSizeFull();
      b.addClickListener(
          new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
              clearMenuSelection(menu);
              event.getButton().addStyleName("selected");
              if (!navegador.getState().equals("/" + view)) navegador.navigateTo("/" + view);
            }
          });

      menu.addComponent(b);
      viewNameToMenuButton.put("/" + view, b);
    }
  }
  private void buildLayout() {

    VerticalLayout top = new VerticalLayout();
    Label l1 = new Label("Users");

    l1.setStyleName("h2");
    top.addComponent(l1);
    top.addComponent(fieldSearch);
    top.addComponent(filterCCNo);

    Label l2 = new Label("Rules");
    l2.setStyleName("h2");

    userGrid.setWidth("100%");
    userGrid.setHeight("250px");

    userRulesGrid.setWidth("100%");
    userRulesGrid.setHeight("250px");

    HorizontalLayout rulesButtons = new HorizontalLayout();
    rulesButtons.addComponent(addUserRuleButton);
    rulesButtons.addComponent(editUserRuleButton);
    rulesButtons.addComponent(deleteUserRuleButton);

    Panel userPanel = new Panel(userGrid);
    Panel userRulesPanel = new Panel(userRulesGrid);

    VerticalLayout main = new VerticalLayout(top, userPanel, l2, userRulesGrid, rulesButtons);
    main.setMargin(new MarginInfo(false, true, false, true));

    setContent(main);
  }
示例#16
0
  private void BuildBranding() {
    branding.setSizeUndefined();
    branding.addStyleName("branding");
    branding.addStyleName("menu");

    Button b = new NativeButton();
    b.addStyleName("icon-dashboard");
    b.setSizeFull();
    b.addClickListener(
        new ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            clearMenuSelection(menu);
            event.getButton().addStyleName("selected");
            if (!navegador.getState().equals("/dashboard")) navegador.navigateTo("/dashboard");
          }
        });

    viewNameToMenuButton.put("/dashboard", b);
    viewNameToMenuButton.get("/dashboard").setHtmlContentAllowed(true);
    viewNameToMenuButton.get("/dashboard").setCaption("<span class=\"badge\">2</span>");

    Label logo = new Label("Zombre <span>Underwear</span>", ContentMode.HTML);
    logo.setSizeFull();
    branding.addComponent(b);
    //    	branding.addComponent(logo);
  }
示例#17
0
  private void buildFooterButtons() {

    FooterCell cell = footer.getCell("clientName");

    HorizontalLayout btnLayout = new HorizontalLayout();
    btnLayout.setSpacing(true);

    Button exportBtn = new Button("Export");
    exportBtn.addStyleName(ValoTheme.BUTTON_TINY);
    exportBtn.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    exportBtn.setIcon(FontAwesome.FILE_EXCEL_O);

    Button refreshBtn = new Button("Refresh");
    refreshBtn.addStyleName(ValoTheme.BUTTON_TINY);
    refreshBtn.addStyleName(ValoTheme.BUTTON_FRIENDLY);
    refreshBtn.setIcon(FontAwesome.REFRESH);

    refreshBtn.addClickListener(
        new Button.ClickListener() {

          private static final long serialVersionUID = 1L;

          @Override
          public void buttonClick(ClickEvent event) {

            queryAndRefresh(
                PerisaiUtil.convertDateToString(today, dtFormat),
                PerisaiUtil.convertDateToString(tmrw, dtFormat));
          }
        });

    // btnLayout.addComponent(exportBtn);
    // btnLayout.addComponent(refreshBtn);
    cell.setComponent(btnLayout);
  }
  protected void addButtons() {
    // Cancel
    Button cancelButton = new Button(i18nManager.getMessage(Messages.BUTTON_CANCEL));
    cancelButton.addStyleName(Reindeer.BUTTON_SMALL);
    cancelButton.addListener(
        new ClickListener() {
          public void buttonClick(ClickEvent event) {
            close();
          }
        });

    // Delete
    Button deleteButton =
        new Button(i18nManager.getMessage(Messages.DEPLOYMENT_DELETE_POPUP_DELETE_BUTTON));
    deleteButton.addStyleName(Reindeer.BUTTON_SMALL);
    deleteButton.addListener(
        new ClickListener() {
          public void buttonClick(ClickEvent event) {
            // Delete deployment, close popup window and refresh deployment list
            repositoryService.deleteDeployment(deployment.getId(), true);
            close();
            deploymentPage.refreshSelectNext();
          }
        });

    // Alignment
    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.addComponent(cancelButton);
    buttonLayout.addComponent(deleteButton);
    addComponent(buttonLayout);
    windowLayout.setComponentAlignment(buttonLayout, Alignment.BOTTOM_RIGHT);
  }
示例#19
0
  protected HorizontalLayout generateActionButtons(Object taskItemId) {
    HorizontalLayout actionButtons = new HorizontalLayout();

    FormDefinition form = taskFormModel.getForm(taskItemId);
    Button formButton =
        new Button(
            form == null
                ? i18nManager.getMessage(Messages.PROCESS_EDITOR_TASK_FORM_CREATE)
                : i18nManager.getMessage(Messages.PROCESS_EDITOR_TASK_FORM_EDIT));
    formButton.addListener(new ShowFormClickListener(taskFormModel, taskItemId));
    formButton.setData(taskItemId);
    actionButtons.addComponent(formButton);

    Button deleteTaskButton = new Button("-");
    deleteTaskButton.setData(taskItemId);
    deleteTaskButton.addListener(new DeleteTaskClickListener(this));
    actionButtons.addComponent(deleteTaskButton);

    Button addTaskButton = new Button("+");
    addTaskButton.setData(taskItemId);
    addTaskButton.addListener(new AddTaskClickListener(this));
    actionButtons.addComponent(addTaskButton);

    return actionButtons;
  }
  public CrmPreviewFormControlsGenerator(final AdvancedPreviewBeanForm<T> editForm) {
    this.previewForm = editForm;

    editButtons = new HorizontalLayout();
    editButtons.setSpacing(true);
    editButtons.addStyleName("edit-btn");
  }
示例#21
0
  @AutoGenerated
  private HorizontalLayout buildHorizontalLayout_3() {
    // common part: create layout
    horizontalLayout_3 = new HorizontalLayout();
    horizontalLayout_3.setImmediate(false);
    horizontalLayout_3.setWidth("-1px");
    horizontalLayout_3.setHeight("-1px");
    horizontalLayout_3.setMargin(false);

    // txtFiltroUsuario
    txtFiltroUsuario = new TextField();
    txtFiltroUsuario.setImmediate(false);
    txtFiltroUsuario.setWidth("65px");
    txtFiltroUsuario.setHeight("-1px");
    txtFiltroUsuario.setInputPrompt("Usuario");
    horizontalLayout_3.addComponent(txtFiltroUsuario);

    // txtFiltroNombres
    txtFiltroNombres = new TextField();
    txtFiltroNombres.setImmediate(false);
    txtFiltroNombres.setWidth("86px");
    txtFiltroNombres.setHeight("-1px");
    txtFiltroNombres.setInputPrompt("Nombres");
    horizontalLayout_3.addComponent(txtFiltroNombres);

    // txtFiltroApePaterno
    txtFiltroApePaterno = new TextField();
    txtFiltroApePaterno.setImmediate(false);
    txtFiltroApePaterno.setWidth("88px");
    txtFiltroApePaterno.setHeight("-1px");
    txtFiltroApePaterno.setInputPrompt("Ape. Paterno");
    horizontalLayout_3.addComponent(txtFiltroApePaterno);

    // txtFiltroApeMaterno
    txtFiltroApeMaterno = new TextField();
    txtFiltroApeMaterno.setImmediate(false);
    txtFiltroApeMaterno.setWidth("90px");
    txtFiltroApeMaterno.setHeight("-1px");
    txtFiltroApeMaterno.setInputPrompt("Ape. Materno");
    horizontalLayout_3.addComponent(txtFiltroApeMaterno);

    // txtFiltroCargo
    txtFiltroCargo = new TextField();
    txtFiltroCargo.setImmediate(false);
    txtFiltroCargo.setWidth("142px");
    txtFiltroCargo.setHeight("-1px");
    txtFiltroCargo.setInputPrompt("Cargo");
    horizontalLayout_3.addComponent(txtFiltroCargo);

    // txtFiltroOficina
    txtFiltroOficina = new TextField();
    txtFiltroOficina.setImmediate(false);
    txtFiltroOficina.setWidth("171px");
    txtFiltroOficina.setHeight("-1px");
    txtFiltroOficina.setInputPrompt("Oficina");
    horizontalLayout_3.addComponent(txtFiltroOficina);

    return horizontalLayout_3;
  }
  private void initLayout() {
    horizontalLayout = new HorizontalLayout();

    uriFragmentUtility.addListener(
        new FragmentChangedListener() {
          @Override
          public void fragmentChanged(FragmentChangedEvent source) {
            String fragment = uriFragmentUtility.getFragment();
            if (!uriCallbacks.isEmpty() && Strings.hasText(fragment)) {
              for (UriChangedCallback callback : uriCallbacks) {
                callback.handle(fragment);
              }
            }
          }
        });

    activityQueuesPane = new ActivityQueuesPane(this);
    initViewController();
    activityQueuesPane.refreshData();
    viewController.displayCurrentView();

    removeAllComponents();

    showHideButton0 = new Button();
    showHideButton0.setStyleName(BaseTheme.BUTTON_LINK);
    showHideButton0.setIcon(resourceCache.getImage("/img/guzik_1.png"));
    showHideButton0.setSizeFull();

    showHideButton1 = new Button();
    showHideButton1.setStyleName(BaseTheme.BUTTON_LINK);
    showHideButton1.setIcon(resourceCache.getImage("/img/guzik_2.png"));

    showHideButton2 = new Button();
    showHideButton2.setStyleName(BaseTheme.BUTTON_LINK);
    showHideButton2.setIcon(resourceCache.getImage("/img/guzik_2.png"));
    final VerticalLayout leftPanel =
        verticalLayout(
            showHideButton1,
            new NewProcessExtendedPane(bpmSession, i18NSource, this),
            activityQueuesPane,
            new ActivityFiltersPane(this),
            showHideButton2);

    leftPanelTrigger = new LeftPanelVisibilityTrigger(leftPanel, true);
    leftPanel.setWidth(300, Sizeable.UNITS_PIXELS);
    showHideButton0.addListener(leftPanelTrigger);
    showHideButton1.addListener(leftPanelTrigger);
    showHideButton2.addListener(leftPanelTrigger);

    ComponentContainer viewContainer = viewController.getViewContainer();

    horizontalLayout.setWidth(100, Sizeable.UNITS_PERCENTAGE);
    horizontalLayout.addComponent(leftPanel);
    horizontalLayout.addComponent(viewContainer);
    horizontalLayout.setExpandRatio(viewContainer, 1.0f);
    addComponent(showHideButton0);
    addComponent(horizontalLayout);
    addComponent(uriFragmentUtility);
  }
示例#23
0
 private Component buildNavBar() {
   Panel navPanel = new Panel();
   HorizontalLayout nav = new HorizontalLayout();
   nav.addStyleName("ait-content-nav");
   nav.addComponent(new Label(AitView.getNavText(menu), ContentMode.HTML));
   navPanel.setContent(nav);
   return navPanel;
 }
示例#24
0
  public void initializePanelRigth() {
    lstStudentSelecteds = new ListSelect("Alumnos Asignados");
    lstStudentSelecteds.setSizeFull();
    lstStudentSelecteds.setMultiSelect(true);

    mainPanel.addComponent(lstStudentSelecteds);
    mainPanel.setExpandRatio(lstStudentSelecteds, new Float(0.45));
  }
示例#25
0
  public LoadForm(BWPresentation bwPresentation) {
    bwSpecReceiver = new SpecificationReceiver(bwPresentation);

    // Upload buttons
    setMargin(true);
    setWidth("320px");
    setHeight("120px");

    // Load goal specification (upload)
    Upload uploadBW =
        new Upload("Upload the Blended Workflow specification here:", this.bwSpecReceiver);
    uploadBW.setButtonCaption("Submit");
    uploadBW.addListener((Upload.SucceededListener) this.bwSpecReceiver);
    uploadBW.addListener((Upload.FailedListener) this.bwSpecReceiver);

    HorizontalLayout submitPanel = new HorizontalLayout();
    submitPanel.setSpacing(true);
    Button bwSpecificationLoadBtn = new Button("Load");
    bwSpecificationLoadBtn.addListener(
        new ClickListener() {
          @Atomic(mode = TxMode.WRITE)
          @Override
          public void buttonClick(ClickEvent event) {
            try {
              String bwSpec = bwSpecReceiver.getSpecInString();
              if (bwSpec != null) {
                BlendedWorkflow.getInstance().getBwManager().loadBWSpecification(bwSpec);
                getApplication().getMainWindow().removeWindow(LoadForm.this.getWindow());
              } else {
                getApplication()
                    .getMainWindow()
                    .showNotification("Blended Workflow Specification missing");
              }
            } catch (java.lang.NullPointerException jle) {
              getApplication()
                  .getMainWindow()
                  .showNotification(
                      "Please upload a Blended Workflow Specifications",
                      Notification.TYPE_ERROR_MESSAGE);
            }
          }
        });
    submitPanel.addComponent(bwSpecificationLoadBtn);

    Button cancel = new Button("Cancel");
    cancel.addListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            getApplication().getMainWindow().removeWindow(LoadForm.this.getWindow());
          }
        });
    submitPanel.addComponent(cancel);

    addComponent(uploadBW);
    addComponent(submitPanel);
    setComponentAlignment(submitPanel, Alignment.BOTTOM_CENTER);
  }
    private void createBasicSearchLayout() {
      final HorizontalLayout basicSearchBody = new HorizontalLayout();
      basicSearchBody.setStyleName("message-search");
      basicSearchBody.setSizeUndefined();
      basicSearchBody.setSpacing(false);

      final TextField nameField = new TextField();
      nameField.addTextChangeListener(
          new TextChangeListener() {
            @Override
            public void textChange(final TextChangeEvent event) {
              MessageSearchPanel.this.messageSearchCriteria = new MessageSearchCriteria();

              MessageSearchPanel.this.messageSearchCriteria.setProjectids(
                  new SetSearchField<Integer>(
                      SearchField.AND, MessageSearchPanel.this.project.getId()));

              MessageSearchPanel.this.textSearch = event.getText().toString().trim();

              MessageSearchPanel.this.messageSearchCriteria.setMessage(
                  new StringSearchField(MessageSearchPanel.this.textSearch));

              MessageSearchPanel.this.notifySearchHandler(
                  MessageSearchPanel.this.messageSearchCriteria);
            }
          });

      nameField.setTextChangeEventMode(TextChangeEventMode.LAZY);
      nameField.setTextChangeTimeout(200);
      nameField.setWidth(UIConstants.DEFAULT_CONTROL_WIDTH);
      UiUtils.addComponent(basicSearchBody, nameField, Alignment.MIDDLE_LEFT);

      final Button searchBtn = new Button();
      searchBtn.addClickListener(
          new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final Button.ClickEvent event) {
              MessageSearchPanel.this.messageSearchCriteria = new MessageSearchCriteria();

              MessageSearchPanel.this.messageSearchCriteria.setProjectids(
                  new SetSearchField<Integer>(
                      SearchField.AND, MessageSearchPanel.this.project.getId()));

              MessageSearchPanel.this.messageSearchCriteria.setMessage(
                  new StringSearchField(MessageSearchPanel.this.textSearch));

              MessageSearchPanel.this.notifySearchHandler(
                  MessageSearchPanel.this.messageSearchCriteria);
            }
          });
      searchBtn.setStyleName("search-icon-button");
      searchBtn.setIcon(MyCollabResource.newResource("icons/16/search_white.png"));
      basicSearchBody.addComponent(searchBtn);

      this.setCompositionRoot(basicSearchBody);
    }
示例#27
0
  private VerticalLayout displayMyBalSheetsInRows(List<BalanceSheet> myBalSheets) {
    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();
    vl.setSpacing(true);
    vl.setStyleName("bal-sheet-panel");

    // Display placeholder if no current balance sheets
    if (myBalSheets.size() == 0) {
      Button balSheet = new Button();
      balSheet.setStyleName(BaseTheme.BUTTON_LINK);
      balSheet.setIcon(IconManager.getIcon(IconManager.BALANCE_SHEET));
      balSheet.setEnabled(false);

      vl.addComponent(balSheet);

      return vl;
    }

    // Build the viewable list of my balance sheets
    List<HorizontalLayout> balSheetRows = new ArrayList<>();
    for (int i = 0; i < myBalSheets.size(); i++) {
      HorizontalLayout row;
      if (i % NUM_COLS == 0) {
        row = new HorizontalLayout();
        balSheetRows.add(row);
      } else {
        row = balSheetRows.get(balSheetRows.size() - 1);
      }

      final BalanceSheet balSheet = myBalSheets.get(i);
      Button balSheetBtn = new Button(balSheet.getSheetName());
      balSheetBtn.setDescription(balSheet.getDescription());
      balSheetBtn.setStyleName(BaseTheme.BUTTON_LINK);
      balSheetBtn.setIcon(IconManager.getIcon(IconManager.BALANCE_SHEET));
      if (!balSheet.isActive()) {
        balSheetBtn.setEnabled(false);
      } else {
        balSheetBtn.addListener(
            new Button.ClickListener() {

              private static final long serialVersionUID = 1L;

              @Override
              public void buttonClick(ClickEvent event) {
                AccountsApplication.getInstance().nav.loadNewView(new SingleBalanceSheet(balSheet));
              }
            });
      }

      row.addComponent(balSheetBtn);
    }

    for (HorizontalLayout hl : balSheetRows) {
      vl.addComponent(hl);
    }

    return vl;
  }
示例#28
0
 private Layout createButtonControls() {
   final HorizontalLayout controlPanel = new HorizontalLayout();
   final Layout controlButtons =
       (new EditFormControlsGenerator<>(editUserForm)).createButtonControls();
   controlButtons.setSizeUndefined();
   controlPanel.addComponent(controlButtons);
   controlPanel.setComponentAlignment(controlButtons, Alignment.MIDDLE_CENTER);
   return controlPanel;
 }
示例#29
0
  private void buildLayout() {
    setSizeUndefined();
    setMargin(true);

    HorizontalLayout actions = new HorizontalLayout(save, cancel);
    actions.setSpacing(true);

    addComponents(actions, firstName, lastName, phone, email, birthDate);
  }
示例#30
0
  private void addHelpLink() {

    if (StringUtils.isEmpty(helpLink)) {
      return;
    }
    final Link helpLinkComponent = SPUIComponentProvider.getHelpLink(helpLink);
    buttonsLayout.addComponent(helpLinkComponent);
    buttonsLayout.setComponentAlignment(helpLinkComponent, Alignment.MIDDLE_RIGHT);
  }