예제 #1
0
  UploadStatusInfoWindow(
      final UIEventBus eventBus, final ArtifactUploadState artifactUploadState, final I18N i18n) {
    this.eventBus = eventBus;
    this.artifactUploadState = artifactUploadState;
    this.i18n = i18n;

    setPopupProperties();
    createStatusPopupHeaderComponents();

    mainLayout = new VerticalLayout();
    mainLayout.setSpacing(Boolean.TRUE);
    mainLayout.setSizeUndefined();
    setPopupSizeInMinMode();

    uploads = getGridContainer();
    grid = createGrid();
    setGridColumnProperties();

    mainLayout.addComponents(getCaptionLayout(), grid);
    mainLayout.setExpandRatio(grid, 1.0F);
    setContent(mainLayout);
    eventBus.subscribe(this);
    ui = UI.getCurrent();

    createConfirmDialog();
  }
  @SuppressWarnings("serial")
  private PopupView createProcessDefinitionPopup(final ProcessDefinition processDefinition) {
    final VerticalLayout layout = new VerticalLayout();
    final PopupView popup = new PopupView(processDefinition.getName(), layout);

    layout.setSizeUndefined();
    layout.setMargin(true);
    layout.setSpacing(true);
    Label header =
        new Label(
            String.format(
                "What would you like to do with <b>%s</b>?", processDefinition.getName()));
    header.setContentMode(Label.CONTENT_XHTML);
    layout.addComponent(header);

    Button startNewInstanceButton = new Button("Start a new instance");
    startNewInstanceButton.addStyleName(Reindeer.BUTTON_SMALL);
    startNewInstanceButton.addListener(
        new Button.ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            getPresenter().startNewInstance(processDefinition);
            popup.setPopupVisible(false);
          }
        });
    layout.addComponent(startNewInstanceButton);

    return popup;
  }
예제 #3
0
  private void buildCategoryTree() {
    tree = categoryTree.initialize();
    tree.addItemClickListener(this);
    tree.setSizeUndefined();

    treePanel.addStyleName(Runo.PANEL_LIGHT);
    treePanel.setHeight("100%");
    treePanel.setContent(treeLayout);

    treeLayout.setImmediate(true);
    treeLayout.setMargin(true);
    treeLayout.setSizeUndefined();
    treeLayout.addStyleName(Reindeer.LAYOUT_WHITE);
    treeLayout.addComponent(tree);

    topTreeLayout.setHeight("100%");
    topTreeLayout.setCaption("Categories");
    topTreeLayout.addStyleName(Runo.LAYOUT_DARKER);
    // topTreeLayout.addComponent(lblCategoryCaption);
    topTreeLayout.addComponent(treePanel);

    btnCreate.addClickListener(this);
    btnUpdate.addClickListener(this);
    btnDelete.addClickListener(this);
  }
예제 #4
0
 private void showComponent(final Component component, final String name) {
   final VerticalLayout layout = new VerticalLayout();
   layout.setSizeUndefined();
   layout.setMargin(true);
   final Window window = new Window(name, layout);
   window.setSizeUndefined();
   component.setSizeUndefined();
   window.addComponent(component);
   getWindow().addWindow(window);
 }
예제 #5
0
  private com.vaadin.ui.Component buildLoginForm() {
    final VerticalLayout loginPanel = new VerticalLayout();
    loginPanel.setSizeUndefined();
    loginPanel.setSpacing(true);
    Responsive.makeResponsive(loginPanel);
    loginPanel.addStyleName("login-panel");

    loginPanel.addComponent(buildLabels());
    loginPanel.addComponent(buildFields());
    loginPanel.addComponent(new CheckBox("Remember me", true));
    return loginPanel;
  }
예제 #6
0
  @SuppressWarnings("serial")
  /**
   * Creates a popup that allows to see the process history and the final report of
   * historicProcessInstance
   *
   * @param historicProcessInstance = historicProcessInstance to be seen
   * @return the popup of historicProcessInstance
   */
  private PopupView createHistoricProcessInstancePopup(
      final HistoricProcessInstance historicProcessInstance) {
    final VerticalLayout layout = new VerticalLayout();
    final PopupView popup = new PopupView(historicProcessInstance.getId(), layout);

    layout.setSizeUndefined();
    layout.setMargin(true);
    layout.setSpacing(true);
    Label header =
        new Label(
            String.format(
                "What would you like to do with process: <b>%s</b>?",
                historicProcessInstance.getId()));
    header.setContentMode(Label.CONTENT_XHTML);
    layout.addComponent(header);

    Button porcessHistory = new Button("See process history");
    porcessHistory.addStyleName(Reindeer.BUTTON_SMALL);
    porcessHistory.addListener(
        new Button.ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            getPresenter().setHistBrowser(historicProcessInstance);
            popup.setPopupVisible(false);
          }
        });
    layout.addComponent(porcessHistory);

    Button finalReport = new Button("see final report");
    finalReport.addStyleName(Reindeer.BUTTON_SMALL);
    finalReport.addListener(
        new Button.ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            getPresenter().setReportBrowser(historicProcessInstance);
            popup.setPopupVisible(false);
          }
        });
    layout.addComponent(finalReport);

    return popup;
  }
  private Layout createSplitButtonPopupContent() {
    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setSizeUndefined();

    layout.addComponent(createButton("New Word Document", "../runo/icons/16/document-doc.png"));
    layout.addComponent(createButton("New Excel Document", "../runo/icons/16/document-xsl.png"));
    layout.addComponent(
        createButton("New PowerPoint Document", "../runo/icons/16/document-ppt.png"));
    layout.addComponent(createButton("New PDF Document", "../runo/icons/16/document-pdf.png"));

    return layout;
  }
예제 #8
0
파일: DDTest6.java 프로젝트: ZOKOISC/vaadin
 private void openFile(File file) {
   // ATM supports only images.
   if (file.getType().equals("image/png")) {
     Embedded embedded = new Embedded(file.getName(), file.getResource());
     VerticalLayout layout = new VerticalLayout();
     layout.setMargin(true);
     Window w = new Window(file.getName(), layout);
     layout.addComponent(embedded);
     layout.setSizeUndefined();
     getMainWindow().addWindow(w);
   } else if (file.getType().equals("text/csv")) {
     showSpreadsheet(file);
   }
 }
예제 #9
0
 @Override
 protected void setup() {
   UI mainWindow = getMainWindow();
   HorizontalLayout controlpanels = new HorizontalLayout();
   for (int i = 1; i <= 5; i++) {
     VerticalLayout layout = new VerticalLayout();
     layout.setMargin(true);
     Window dialog = new Window("Dialog " + i, layout);
     layout.setSizeUndefined();
     windowlist.addBean(dialog);
     layout.addComponent(new Label("this is dialog number " + i));
     layout.addComponent(new ControlPanel());
     mainWindow.addWindow(dialog);
   }
   controlpanels.addComponent(new ControlPanel());
   getLayout().setSizeFull();
   getLayout().addComponent(controlpanels);
   getLayout().setComponentAlignment(controlpanels, Alignment.BOTTOM_LEFT);
 }
예제 #10
0
  @Override
  public void init() {
    LegacyWindow main = new LegacyWindow("Testing....");
    setMainWindow(main);

    final VerticalLayout lo = new VerticalLayout();
    lo.setSizeUndefined();
    lo.setWidth("100%");
    TextArea tf = new TextArea();
    tf.setValue(
        "The textfield should fill the window."
            + "\n - Try to resize window\n - Try to push REdo button");
    tf.setRows(10);
    tf.setWidth("100%");
    lo.addComponent(tf);
    Window subWin = new Window("This window should initially be as wide as the caption", lo);
    main.addWindow(subWin);
    // subWin.setWidth("500px");
  }
예제 #11
0
파일: AdminView.java 프로젝트: rmertins/cdi
  @Override
  protected Component buildContent() {
    VerticalLayout layout = new VerticalLayout();
    layout.setSizeUndefined();

    Label label = new Label("Admin only content here");
    label.setSizeUndefined();
    layout.addComponent(label);

    uiScopedCountLabel.setSizeUndefined();
    layout.addComponent(uiScopedCountLabel);

    privateCountLabel.setSizeUndefined();
    layout.addComponent(privateCountLabel);

    Button incrementButton = new Button("Increment UI scoped");
    layout.addComponent(incrementButton);
    incrementButton.addClickListener(
        new ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            counterService.next();
            updateLabels();
          }
        });

    Button incrementButton2 = new Button("Increment private");
    layout.addComponent(incrementButton2);
    incrementButton2.addClickListener(
        new ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            privateCounter.next();
            updateLabels();
          }
        });

    updateLabels();

    return layout;
  }
    public Layout buildLayout() {
      VerticalLayout layout = new VerticalLayout();
      VerticalLayout panelLayout = new VerticalLayout();
      panelLayout.setMargin(true);
      final Panel widePanel = new Panel("too big", panelLayout);
      widePanel.setSizeUndefined();
      widePanel.setWidth("2000px");
      widePanel.setHeight("200px");
      layout.addComponent(widePanel);
      Button button =
          new Button(
              "Change panel size",
              new ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                  switch (step++ % 4) {
                    case 0:
                      widePanel.setWidth("200px");
                      break;
                    case 1:
                      widePanel.setHeight("2000px");
                      break;
                    case 2:
                      widePanel.setWidth("2000px");
                      break;
                    case 3:
                      widePanel.setHeight("200px");
                      break;
                  }
                }
              });
      panelLayout.addComponent(button);
      layout.setSizeUndefined();
      return layout;
    }
  public SimpleLoginView() {
    setSizeFull();

    // Create the user input field
    userTextField = new TextField("User name: ");
    userTextField.setWidth("300px");
    userTextField.setRequired(true);
    userTextField.setInputPrompt("Your username (eg. user1)");
    userTextField.addValidator(new LoginValidator());
    userTextField.setInvalidAllowed(false);

    // Create the password input field
    passwordField = new PasswordField("Password:"******"300px");
    passwordField.setRequired(true);
    passwordField.addValidator(new PasswordValidator());
    passwordField.setValue("");
    passwordField.setNullRepresentation("");

    // Create login button
    loginButton = new Button("Login", this);

    // Add all to a panel
    VerticalLayout fields = new VerticalLayout(userTextField, passwordField, loginButton);
    fields.setCaption("Please login to access the application. (user1/password)");
    fields.setSpacing(true);
    fields.setMargin(new MarginInfo(true, true, true, false));
    fields.setSizeUndefined();

    // The view root layout
    VerticalLayout viewLayout = new VerticalLayout(fields);
    viewLayout.setSizeFull();
    viewLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER);
    viewLayout.setStyleName(Reindeer.LAYOUT_BLUE);
    setCompositionRoot(viewLayout);
  }
예제 #14
0
파일: DDTest6.java 프로젝트: ZOKOISC/vaadin
 private void showSpreadsheet(File file) {
   // ApplicationResource resource = (ApplicationResource)
   // file.getResource();
   String string = new String(file.bas.toByteArray());
   String[] rows = string.split("\n");
   String[] cols = rows[0].split(",");
   Table table = new Table();
   for (String string2 : cols) {
     // String col =
     string2.replaceAll("\"", ""); // remove surrounding ""
     table.addContainerProperty(string2, String.class, "");
   }
   for (int i = 1; i < rows.length; i++) {
     String[] split = rows[i].split(",");
     table.addItem(split, "" + i);
   }
   VerticalLayout layout = new VerticalLayout();
   layout.setMargin(true);
   Window w = new Window(file.getName(), layout);
   layout.setSizeUndefined();
   table.setEditable(true);
   layout.addComponent(table);
   getMainWindow().addWindow(w);
 }
예제 #15
0
  public TrackingScreen() {
    setMargin(true);
    setSpacing(true);
    setSizeFull();

    VerticalLayout vl = new VerticalLayout();
    vl.setSizeUndefined();

    final SatelliteTable table =
        new SatelliteTable(
            new String[] {"catalogNumber", "commonName"},
            new String[] {"Catalog Number", "Common Name"},
            10);
    table.setSizeUndefined();

    vl.addComponent(table);

    Button compute =
        new Button(
            "Track",
            new Button.ClickListener() {

              private static final long serialVersionUID = -2433152978338766513L;

              public void buttonClick(ClickEvent event) {
                if (table.getValue() == null) {
                  return;
                }

                Item item = table.getItem(table.getValue());
                Long id = (Long) item.getItemProperty("catalogNumber").getValue();
                Satellite sat = satService.getSatellite(id);
                TleEntry entry = satService.getLatestTleEntry(sat);

                vectorLayer.removeAllComponents();
                markerLayer.removeAllComponents();

                try {
                  TLE tle = new TLE(entry.getLine1(), entry.getLine2());

                  AbsoluteDate startDate = new AbsoluteDate(new Date(), TimeScalesFactory.getUTC());

                  double period = sat.getPeriod();
                  double iterations = 2;
                  long step = period > 100 ? 180 : 90;
                  BoundedPropagator boundedProp =
                      SatellitePropagation.getEphemeris(
                          tle, startDate.shiftedBy(-60 * 30), 60L * period * iterations, step);

                  currentTracker = new Tracker(boundedProp);
                  AbsoluteDate date = currentTracker.getStartDate();

                  List<Point> points = new LinkedList<Point>();
                  double lastLon = 0d;

                  while (date.compareTo(currentTracker.getEndDate()) < 0) {
                    GeodeticPoint gp = currentTracker.getPoint(date);

                    double lat = Math.toDegrees(gp.getLatitude());
                    double lon = Math.toDegrees(gp.getLongitude());

                    if (lastLon > 0 && lon < 0) {
                      Vector line = new PolyLine();
                      line.setPoints(points.toArray(new Point[points.size()]));
                      vectorLayer.addVector(line);
                      points.clear();
                    }

                    points.add(new Point(lon, lat));
                    lastLon = lon;
                    date = date.shiftedBy(step);
                  }

                  Vector line = new PolyLine();
                  line.setPoints(points.toArray(new Point[points.size()]));
                  vectorLayer.addVector(line);

                  GeodeticPoint gp = currentTracker.getPoint(startDate);
                  double lat = Math.toDegrees(gp.getLatitude());
                  double lon = Math.toDegrees(gp.getLongitude());

                  marker = new Marker(lon, lat);
                  // URL of marker Icon
                  marker.setIcon("images/satellite_48_hot.png", 24, 24);
                  markerLayer.addMarker(marker);

                } catch (Exception e) {
                  e.printStackTrace();
                }
              }
            });
    compute.setWidth("100%");
    compute.addStyleName(Runo.BUTTON_DEFAULT);
    compute.addStyleName(Runo.BUTTON_BIG);

    vl.addComponent(compute);

    addComponent(vl);

    OpenLayersMap map = new OpenLayersMap();
    map.setSizeFull();
    map.setImmediate(true); // update extent and zoom to server as they change

    OpenStreetMapLayer osm = new OpenStreetMapLayer();
    map.addLayer(osm);

    vectorLayer = new VectorLayer();
    vectorLayer.setSelectionMode(SelectionMode.NONE);

    Style defaultStyle = new Style();
    /* Set stroke color to green, otherwise like default style */
    defaultStyle.extendCoreStyle("default");
    defaultStyle.setStrokeColor("#00b963");
    defaultStyle.setStrokeOpacity(0.5);
    defaultStyle.setStrokeWidth(1);

    Style selectStyle = new Style();
    /* Set select color to blue, otherwise like default style */
    selectStyle.extendCoreStyle("default");
    selectStyle.setStrokeColor("#0063b9");
    selectStyle.setStrokeOpacity(0.5);
    selectStyle.setStrokeWidth(1);

    StyleMap styleMap = new StyleMap(defaultStyle, selectStyle, null);
    // make selectStyle inherit attributes not explicitly set
    styleMap.setExtendDefault(true);

    vectorLayer.setStyleMap(styleMap);
    vectorLayer.setDrawindMode(DrawingMode.NONE);

    map.addLayer(vectorLayer);

    // Define a Marker Layer
    markerLayer = new MarkerLayer();

    map.addLayer(markerLayer);

    addComponent(map);
    setExpandRatio(map, 1);

    Refresher r = new Refresher();
    r.setRefreshInterval(1000);
    r.addListener(
        new RefreshListener() {

          private static final long serialVersionUID = 2875834508560395285L;

          @Override
          public void refresh(Refresher source) {
            if (marker != null && currentTracker != null) {
              try {
                AbsoluteDate currentDate = new AbsoluteDate(new Date(), TimeScalesFactory.getUTC());
                GeodeticPoint gp = currentTracker.getPoint(currentDate);
                double lat = Math.toDegrees(gp.getLatitude());
                double lon = Math.toDegrees(gp.getLongitude());

                marker.setLon(lon);
                marker.setLat(lat);
              } catch (OrekitException e) {
                e.printStackTrace();
              }
            }
          }
        });

    addComponent(r);
  }
  private Component buildProfileTab() {
    HorizontalLayout root = new HorizontalLayout();
    root.setCaption("Profile");
    root.setIcon(FontAwesome.USER);
    root.setWidth(100.0f, Unit.PERCENTAGE);
    root.setSpacing(true);
    root.setMargin(true);
    root.addStyleName("profile-form");

    VerticalLayout pic = new VerticalLayout();
    pic.setSizeUndefined();
    pic.setSpacing(true);
    Image profilePic = new Image(null, new ThemeResource("img/profile-pic-300px.jpg"));
    profilePic.setWidth(100.0f, Unit.PIXELS);
    pic.addComponent(profilePic);

    Button upload =
        new Button(
            "Change…",
            event -> {
              Notification.show("Not implemented in this demo");
            });
    upload.addStyleName(ValoTheme.BUTTON_TINY);
    pic.addComponent(upload);

    root.addComponent(pic);

    FormLayout details = new FormLayout();
    details.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    root.addComponent(details);
    root.setExpandRatio(details, 1);

    firstNameField = new TextField("First Name");
    details.addComponent(firstNameField);
    lastNameField = new TextField("Last Name");
    details.addComponent(lastNameField);

    titleField = new ComboBox("Title");
    titleField.setInputPrompt("Please specify");
    titleField.addItem("Mr.");
    titleField.addItem("Mrs.");
    titleField.addItem("Ms.");
    titleField.setNewItemsAllowed(true);
    details.addComponent(titleField);

    sexField = new OptionGroup("Sex");
    sexField.addItem(Boolean.FALSE);
    sexField.setItemCaption(Boolean.FALSE, "Female");
    sexField.addItem(Boolean.TRUE);
    sexField.setItemCaption(Boolean.TRUE, "Male");
    sexField.addStyleName("horizontal");
    details.addComponent(sexField);

    Label section = new Label("Contact Info");
    section.addStyleName(ValoTheme.LABEL_H4);
    section.addStyleName(ValoTheme.LABEL_COLORED);
    details.addComponent(section);

    emailField = new TextField("Email");
    emailField.setWidth("100%");
    emailField.setRequired(true);
    emailField.setNullRepresentation("");
    details.addComponent(emailField);

    locationField = new TextField("Location");
    locationField.setWidth("100%");
    locationField.setNullRepresentation("");
    locationField.setComponentError(new UserError("This address doesn't exist"));
    details.addComponent(locationField);

    phoneField = new TextField("Phone");
    phoneField.setWidth("100%");
    phoneField.setNullRepresentation("");
    details.addComponent(phoneField);

    newsletterField = new OptionalSelect<>();
    newsletterField.addOption(0, "Daily");
    newsletterField.addOption(1, "Weekly");
    newsletterField.addOption(2, "Monthly");
    details.addComponent(newsletterField);

    section = new Label("Additional Info");
    section.addStyleName(ValoTheme.LABEL_H4);
    section.addStyleName(ValoTheme.LABEL_COLORED);
    details.addComponent(section);

    websiteField = new TextField("Website");
    websiteField.setInputPrompt("http://");
    websiteField.setWidth("100%");
    websiteField.setNullRepresentation("");
    details.addComponent(websiteField);

    bioField = new TextArea("Bio");
    bioField.setWidth("100%");
    bioField.setRows(4);
    bioField.setNullRepresentation("");
    details.addComponent(bioField);

    return root;
  }
  private void buildView() {
    // main frame
    Panel pane = new Panel("Create New Password");
    pane.setSizeUndefined();

    // form layout
    mnth_sel = new NativeSelect("Birth Month");
    mnth_sel.addItems(
        "January",
        "February",
        "March",
        "April",
        "May",
        "June",
        "July",
        "August",
        "September",
        "October",
        "November",
        "December");
    mnth_sel.setValue("January");
    mnth_sel.setMultiSelect(false);
    mnth_sel.setNullSelectionAllowed(false);
    mnth_sel.setImmediate(true);

    day_sel = new NativeSelect("Birth Day");
    for (int i = 0; i < 31; i++) day_sel.addItem(i + 1);
    day_sel.setValue(1);
    day_sel.setMultiSelect(false);
    day_sel.setNullSelectionAllowed(false);
    day_sel.setImmediate(true);

    FormLayout form = new FormLayout();
    form.setSizeUndefined();
    form.addComponent(mnth_sel);
    form.addComponent(day_sel);

    // content layout
    info = new Label();
    info.setSizeUndefined();
    info.setValue("Please fill in all fields below");

    question_txt = new TextArea("Security Question");
    question_txt.setValue(emp.getRandomQuestion()); // query user for security question
    question_txt.setReadOnly(true);
    question_txt.setRows(2);
    question_txt.setWidth("20em");

    ans_txt = new TextArea("Answer");
    ans_txt.setRows(2);
    ans_txt.setWidth("20em");

    Label gap = new Label();
    gap.setHeight("1em");

    submit = new Button("Continue");
    submit.setDescription("Continue password creation!");
    submit.setSizeFull();
    submit.setStyleName("primary");

    cancel = new Button("Cancel");
    cancel.setDescription("Return to login screen!");
    cancel.setSizeFull();

    VerticalLayout content = new VerticalLayout();
    content.setSizeUndefined();
    content.setSpacing(true);
    content.setMargin(true);
    content.addComponent(info);
    content.setComponentAlignment(info, Alignment.MIDDLE_CENTER);
    content.addComponent(form);
    content.addComponent(question_txt);
    content.addComponent(ans_txt);
    content.addComponent(gap);
    content.addComponent(submit);
    content.addComponent(cancel);

    // add 'content' to 'main frame'
    pane.setContent(content);

    // root layout
    this.setMargin(true);
    this.addComponent(pane);
    this.setComponentAlignment(pane, Alignment.TOP_CENTER);

    //
    // user interaction
    //
    submit.addClickListener(event -> handleSubmit(event));
    cancel.addClickListener(event -> handleCancel(event));
  }