Ejemplo n.º 1
0
  private Component createFilterComponent() {
    Panel pnl = new Panel("Cari mahasiswa");
    GridLayout gl = new GridLayout(3, 2);
    gl.setMargin(true);
    FormLayout flKiri = new FormLayout();
    FormLayout flKanan = new FormLayout();
    tfNama = new TextField("Nama");
    tfNimStart = new TextField("Nim mulai");
    tfAngkatan = new TextField("Angkatan");
    flKiri.setSpacing(true);
    flKanan.setSpacing(true);

    Button buttonFilter = new Button("Cari");
    buttonFilter.addClickListener(
        new ClickListener() {

          private static final long serialVersionUID = 1L;

          @Override
          public void buttonClick(ClickEvent event) {
            filter();
          }
        });
    flKiri.addComponents(tfNama, tfNimStart, cbProdi);
    flKanan.addComponents(tfAngkatan, cbPA, buttonFilter);
    gl.addComponent(flKiri, 0, 0);
    gl.addComponent(flKanan, 1, 0);
    gl.setSpacing(true);
    pnl.setContent(gl);
    return pnl;
  }
Ejemplo n.º 2
0
  public GridLayout getGridView(String[] headerTable) {

    List reportData = report.dataReport();
    if (reportData.isEmpty()) {
      return new GridLayout();
    }

    GridLayout grid = new GridLayout(1, 2 * reportData.size());

    Iterator iterator = reportData.iterator();
    while (iterator.hasNext()) {
      Object[] row = (Object[]) iterator.next();

      for (int i = 0; i < row.length - 1; i++) {
        grid.addComponent(new Label(row[i].toString()));
      }

      Table table = fillTable(headerTable, (List) row[row.length - 1]);
      table.setWidth("100%");
      grid.addComponent(table);
      grid.setComponentAlignment(
          table, new Alignment(Bits.ALIGNMENT_VERTICAL_CENTER | Bits.ALIGNMENT_HORIZONTAL_CENTER));
    }

    return grid;
  }
Ejemplo n.º 3
0
  @Override
  public void init() {
    LegacyWindow w = new LegacyWindow(getClass().getSimpleName());
    setMainWindow(w);
    // setTheme("tests-tickets");
    GridLayout gl = new GridLayout(4, 2);

    Button button =
        new Button(
            "1",
            new ClickListener() {

              @Override
              public void buttonClick(ClickEvent event) {
                Button b = event.getButton();
                l.setValue(l.getValue() + b.getCaption());
              }
            });

    gl.addComponent(l, 0, 0, 3, 0);
    gl.addComponent(button);
    gl.addComponent(new Label("2"));
    gl.addComponent(new Label("3"));
    gl.addComponent(new Label("4"));

    w.setContent(gl);
  }
Ejemplo n.º 4
0
  public FormEstadoSoporte() {

    super.setColumns(4);
    super.setRows(3);
    setSpacing(true);
    setMargin(true);
    setWidth("100%");

    this.txt_id_estado_soporte = new TextField("Id. Estado Soporte:");
    this.txt_nombre_esoporte = new TextField("Descripcion del Estado de Soporte: ");
    this.mensajes = new ArrayList<BarMessage>();

    pitm_esoporte.addItemProperty("id_estado_soporte", new ObjectProperty<Integer>(0));
    pitm_esoporte.addItemProperty("nombre_estado_soporte", new ObjectProperty<String>(""));
    pitm_esoporte.addItemProperty("sigla", new ObjectProperty<String>(""));

    this.binder_esoporte = new FieldGroup(this.pitm_esoporte);

    binder_esoporte.bind(this.txt_id_estado_soporte, "id_estado_soporte");
    binder_esoporte.bind(this.txt_nombre_esoporte, "nombre_estado_soporte");

    this.txt_nombre_esoporte.setRequired(true);
    this.txt_nombre_esoporte.addValidator(new NullValidator("No Nulo", false));
    this.txt_nombre_esoporte.addValidator(
        new StringLengthValidator(Messages.STRING_LENGTH_MESSAGE(3, 50), 3, 50, false));
    this.txt_id_estado_soporte.setEnabled(false);

    txt_id_estado_soporte.setWidth("90%");
    txt_nombre_esoporte.setWidth("90%");

    updateId();
    buildContent();
    Responsive.makeResponsive(this);
  }
Ejemplo n.º 5
0
  @SuppressWarnings("serial")
  private void initButtonLinkCcBcc() {
    btnLinkCc = new Button("Add Cc");
    btnLinkCc.setStyleName(UIConstants.BUTTON_LINK);
    inputLayout.addComponent(btnLinkCc, 1, 0);
    inputLayout.setComponentAlignment(btnLinkCc, Alignment.MIDDLE_CENTER);

    btnLinkBcc = new Button("Add Bcc");
    btnLinkBcc.setStyleName(UIConstants.BUTTON_LINK);
    inputLayout.addComponent(btnLinkBcc, 2, 0);
    inputLayout.setComponentAlignment(btnLinkBcc, Alignment.MIDDLE_CENTER);

    btnLinkCc.addClickListener(
        new Button.ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            buttonLinkCcClick(event);
          }
        });

    btnLinkBcc.addClickListener(
        new Button.ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            butonLinkBccClick(event);
          }
        });
  }
Ejemplo n.º 6
0
  @Override
  protected void setup(VaadinRequest request) {
    final VerticalLayout uiLayout = new VerticalLayout();
    uiLayout.setMargin(true);
    setContent(uiLayout);

    final VerticalLayout windowLayout = new VerticalLayout();

    final Window testWindow = new Window("WebKitFail", windowLayout);
    testWindow.setWidth(300, Unit.PIXELS);

    GridLayout gl = new GridLayout();
    gl.setHeight(null);
    gl.setWidth(100, Unit.PERCENTAGE);
    windowLayout.addComponent(gl);

    ListSelect listSelect = new ListSelect();
    listSelect.setWidth(100, Unit.PERCENTAGE);
    gl.addComponent(listSelect);
    gl.setMargin(true);

    final Button testButton =
        new Button(
            "Open Window",
            new Button.ClickListener() {
              @Override
              public void buttonClick(ClickEvent event) {
                UI.getCurrent().addWindow(testWindow);
              }
            });
    uiLayout.addComponent(testButton);
  }
Ejemplo n.º 7
0
 private void removeAllInputField() {
   inputLayout.removeComponent(btnLinkCc);
   inputLayout.removeComponent(ccField);
   inputLayout.removeComponent(subjectField);
   inputLayout.removeComponent(bccField);
   inputLayout.removeComponent(btnLinkBcc);
 }
Ejemplo n.º 8
0
 /**
  * The constructor should first build the main layout, set the composition root and then do any
  * custom initialization.
  *
  * <p>The constructor will not be automatically regenerated by the visual editor.
  */
 public LoginComponent() {
   buildMainLayout();
   setCompositionRoot(mainLayout);
   mainLayout.setVisible(true);
   mainLayout.setEnabled(true);
   this.setSizeUndefined();
 }
 private void addActualUnitField(GridLayout innerLayout, int index, Field field) {
   GridLayout actualLayout = (GridLayout) innerLayout.getComponent(2, 0);
   if (actualLayout != null) {
     if (actualLayout.getComponent(1, index) == null) {
       actualLayout.addComponent(field, 1, index, 1, index);
     }
   }
 }
 private void addExpectedUnitField(GridLayout innerLayout, int index, Field field) {
   GridLayout expectedLayout = (GridLayout) innerLayout.getComponent(1, 0);
   if (expectedLayout != null) {
     if (expectedLayout.getComponent(1, index) == null) {
       expectedLayout.addComponent(field, 1, index, 1, index);
     }
   }
 }
 private void addCaptionLabel(GridLayout innerLayout, int index, Label label) {
   GridLayout captionLayout = (GridLayout) innerLayout.getComponent(0, 0);
   if (captionLayout != null) {
     if (captionLayout.getComponent(0, index) == null) {
       captionLayout.addComponent(label, 0, index, 0, index);
     }
   }
 }
 private int getNextIndex(GridLayout innerLayout) {
   GridLayout expectedLayout = (GridLayout) innerLayout.getComponent(1, 0);
   if (expectedLayout != null) {
     return expectedLayout.getRows();
   } else {
     return -1;
   }
 }
 private GridLayout locateLayoutWeek(Label label) {
   layoutWeek = new GridLayout();
   label.setWidth(40, UNITS_PIXELS);
   layoutWeek.setWidth(100, UNITS_PERCENTAGE);
   layoutWeek.setHeight(40, UNITS_PIXELS);
   layoutWeek.setComponentAlignment(label, Alignment.MIDDLE_CENTER);
   layoutWeek.addComponent(label);
   return layoutWeek;
 }
Ejemplo n.º 14
0
 @Test
 public void testDefaultAlignment() {
   Label label = new Label("A label");
   TextField tf = new TextField("A TextField");
   gridLayout.addComponent(label);
   gridLayout.addComponent(tf);
   Assert.assertEquals(Alignment.TOP_LEFT, gridLayout.getComponentAlignment(label));
   Assert.assertEquals(Alignment.TOP_LEFT, gridLayout.getComponentAlignment(tf));
 }
Ejemplo n.º 15
0
  private void addFullInputFieldByOrder() {
    inputLayout.addComponent(ccField, 0, 1);
    inputLayout.addComponent(btnLinkCc, 1, 1);

    inputLayout.addComponent(bccField, 0, 2);
    inputLayout.addComponent(btnLinkBcc, 1, 2);

    inputLayout.addComponent(subjectField, 0, 3);
  }
Ejemplo n.º 16
0
 /*
  * Override to get control over where fields are placed.
  */
 @Override
 protected void attachField(Object propertyId, Field field) {
   field.setCaption(null);
   if (propertyId.equals("annexNote")) {
     field.setWidth(100, UNITS_PERCENTAGE);
     ourLayout.addComponent(field, 1, 0);
     ourLayout.setColumnExpandRatio(1, 1.0F);
   }
 }
Ejemplo n.º 17
0
 @Test
 public void testAlteredDefaultAlignment() {
   Label label = new Label("A label");
   TextField tf = new TextField("A TextField");
   gridLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
   gridLayout.addComponent(label);
   gridLayout.addComponent(tf);
   Assert.assertEquals(Alignment.MIDDLE_CENTER, gridLayout.getComponentAlignment(label));
   Assert.assertEquals(Alignment.MIDDLE_CENTER, gridLayout.getComponentAlignment(tf));
 }
Ejemplo n.º 18
0
 private void checkToReInitCcBcc() {
   if ((!isAddCc) && (!isAddBcc)) {
     inputLayout.removeComponent(btnLinkCc);
     inputLayout.removeComponent(btnLinkBcc);
     initButtonLinkCcBcc();
     inputLayout.removeComponent(subjectField);
     inputLayout.removeComponent(0, 1);
     inputLayout.addComponent(subjectField, 0, 1);
   }
 }
Ejemplo n.º 19
0
  public GridLayout initialize() {

    LOG.debug("Initializing the category and post view");
    buildCategoryTree();
    buildCategoryCRUDAccordion();

    postCRUDAccordion = postView.buildPostCRUDAccordion();
    postCRUDAccordion.setHeight("100%");
    postViewGrid = postView.buildPostViewGrid();

    topLayout.setImmediate(true);
    topLayout.setHeight("100%");
    topLayout.setWidth("100%");
    topLayout.setSpacing(true);

    // first row of the grid layout
    topLayout.addComponent(categoryAccordionCRUD);
    topLayout.addComponent(topTreeLayout);
    topLayout.addComponent(postCRUDAccordion); // builds the CRUD accordion for Posts management

    // second row of the grid layout
    topLayout.addComponent(
        postViewGrid,
        0,
        1,
        2,
        1); // builds the Grid for the Posts view which spans over 3 columns of the row
    topLayout.setComponentAlignment(postViewGrid, Alignment.TOP_LEFT);

    return topLayout;
  }
  protected void addHeader() {
    GridLayout header = new GridLayout(3, 2);
    header.setWidth(100, UNITS_PERCENTAGE);
    header.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
    header.setSpacing(true);
    header.setMargin(false, false, true, false);

    // Add image
    Embedded image = new Embedded(null, Images.PROCESS_50);
    header.addComponent(image, 0, 0, 0, 1);

    // Add task name
    Label nameLabel = new Label(getProcessDisplayName(processDefinition, processInstance));
    nameLabel.addStyleName(Reindeer.LABEL_H2);
    header.addComponent(nameLabel, 1, 0, 2, 0);

    // Add start time
    PrettyTimeLabel startTimeLabel =
        new PrettyTimeLabel(
            i18nManager.getMessage(Messages.PROCESS_START_TIME),
            historicProcessInstance.getStartTime(),
            null,
            true);
    startTimeLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_START_TIME);
    header.addComponent(startTimeLabel, 1, 1);

    header.setColumnExpandRatio(1, 1.0f);
    header.setColumnExpandRatio(2, 1.0f);

    panelLayout.addComponent(header);
  }
Ejemplo n.º 21
0
  @SuppressWarnings("serial")
  @Override
  public void init(VaadinRequest request) {
    GridLayout layout = new GridLayout();
    layout.setSizeFull();
    layout.setMargin(true);
    setContent(layout);

    handleURLParams(request.getParameterMap());

    initContent();
  }
 private void addTextFieldSearch() {
   textValueField =
       ShortcutExtension.installShortcutAction(
           new TextField(),
           new ShortcutListener("CampaignSearchField", ShortcutAction.KeyCode.ENTER, null) {
             @Override
             public void handleAction(Object o, Object o1) {
               doSearch();
             }
           });
   layoutSearchPane.addComponent(textValueField, 0, 0);
   layoutSearchPane.setComponentAlignment(textValueField, Alignment.MIDDLE_CENTER);
 }
Ejemplo n.º 23
0
  private void initializeDivisionComboBox() {

    FormLayout divisionFormLayout = new FormLayout();
    divisionTextField.setWidth("60%");
    divisionTextField.setNullRepresentation("");
    divisionTextField.setImmediate(true);
    divisionTextField.setValue(loadSanctionActSubWindow.getDivisionSelected());
    divisionTextField.setReadOnly(true);
    divisionFormLayout.addComponent(divisionTextField);

    gridLayout.addComponent(divisionFormLayout, 0, 0);
    gridLayout.setComponentAlignment(divisionFormLayout, Alignment.MIDDLE_LEFT);
  }
Ejemplo n.º 24
0
 @Test
 public void testNestedGridLayouts() {
   String design =
       "<!DOCTYPE html>"
           + //
           "<html>"
           + //
           " <body> "
           + //
           "  <v-grid-layout> "
           + //
           "   <row> "
           + //
           "    <column> "
           + //
           "     <v-grid-layout> "
           + //
           "      <row> "
           + //
           "       <column> "
           + //
           "        <v-button>"
           + //
           "          Button "
           + //
           "        </v-button> "
           + //
           "       </column> "
           + //
           "      </row> "
           + //
           "     </v-grid-layout> "
           + //
           "    </column> "
           + //
           "   </row> "
           + //
           "  </v-grid-layout>  "
           + //
           " </body>"
           + //
           "</html>";
   GridLayout outer = new GridLayout();
   GridLayout inner = new GridLayout();
   Button b = new Button("Button");
   b.setCaptionAsHtml(true);
   inner.addComponent(b);
   outer.addComponent(inner);
   testRead(design, outer);
   testWrite(design, outer);
 }
Ejemplo n.º 25
0
  /** Llenado del Combo Box */
  private void buildContent() {

    Panel pn_res = new Panel("Registre el Número de Resolución Revalorización");
    Panel pn_dep = new Panel("Seleccione una Dependencia");
    Panel pn_fecha = new Panel("Registre Fecha Elaboracion Reporte");
    pn_res.setIcon(FontAwesome.PRINT);
    pn_res.setStyleName(AitTheme.PANEL_PRINT);
    pn_dep.setIcon(FontAwesome.PRINT);
    pn_dep.setStyleName(AitTheme.PANEL_PRINT);
    pn_fecha.setIcon(FontAwesome.PRINT);
    pn_fecha.setStyleName(AitTheme.PANEL_PRINT);

    GridLayout gridl_res = new GridLayout(2, 1);
    gridl_res.setSizeFull();
    gridl_res.setColumnExpandRatio(0, 0);
    gridl_res.addComponent(this.txt_no_resolucion, 0, 0);
    pn_res.setContent(gridl_res);

    this.addComponent(pn_res, 0, 0, 1, 0);

    GridLayout gridl_fecha = new GridLayout(2, 1);
    gridl_fecha.setSizeFull();
    gridl_fecha.setColumnExpandRatio(0, 0);
    gridl_fecha.addComponent(this.dt_fecha, 0, 0);
    pn_fecha.setContent(gridl_fecha);

    this.addComponent(pn_fecha, 0, 2, 1, 2);
  }
Ejemplo n.º 26
0
 /** {@inheritDoc} */
 @Override
 public void paintContent(PaintTarget target) throws PaintException {
   super.paintContent(target);
   if (dropHandler != null && isEnabled()) {
     dropHandler.getAcceptCriterion().paint(target);
   }
 }
Ejemplo n.º 27
0
  private void initializeEnrollmentTextField() {
    FormLayout enrollmentFormLayout = new FormLayout();
    enrollmentTextField.setWidth("90%");
    enrollmentTextField.setNullRepresentation("");
    enrollmentTextField.setRequired(true);
    Enrollment enrollmentSelected =
        editSanctionActsSubWindow.getLoadSanctionActList().getEnrollmentSelected();
    if (enrollmentSelected != null) enrollmentTextField.setValue(enrollmentSelected);

    enrollmentFormLayout.addComponent(enrollmentTextField);

    enrollmentTextField.setReadOnly(true);

    gridLayout.addComponent(enrollmentFormLayout, 0, 1);
    gridLayout.setComponentAlignment(enrollmentFormLayout, Alignment.MIDDLE_LEFT);
  }
Ejemplo n.º 28
0
 private void addDetail(String name, String param, Object value) {
   Label requestLabel = new Label(r.getParameter(param));
   requestLabel.setId(param);
   Label browserLabel = new Label("" + value);
   browserLabel.setId(name);
   l.addComponents(new Label(name), requestLabel, browserLabel);
 }
Ejemplo n.º 29
0
  @Override
  protected Panel buildMainLayout() {
    GridLayout gridLayout = new GridLayout(13, 1);
    Label longitudeLabel = new Label("Long. ");
    Label latitudeLabel = new Label("Lat. ");
    Label radiusLabel = new Label("Rad. in m. ");
    Label nameLabel = new Label("Name ");

    longitudeTextField = new TextField();
    longitudeTextField.setWidth("80");
    longitudeTextField.setImmediate(true);
    longitudeTextField.setValidationVisible(true);
    longitudeTextField.addValidator(longitudeValidator);

    latitudeTextField = new TextField();
    latitudeTextField.setWidth("80");
    latitudeTextField.setImmediate(true);
    latitudeTextField.setValidationVisible(true);
    latitudeTextField.addValidator(latitudeValidator);

    radiusTextField = new TextField();
    radiusTextField.setWidth("80");
    radiusTextField.setImmediate(true);
    radiusTextField.setValidationVisible(true);
    radiusTextField.addValidator(doubleValidator);

    nameTextField = new TextField();
    nameTextField.setWidth("80");
    nameTextField.setImmediate(true);
    nameTextField.setValidationVisible(true);
    nameTextField.addValidator(new StringValidator());

    gridLayout.addComponent(getLabelOperator());
    gridLayout.addComponent(getComboboxOperator());
    gridLayout.addComponent(nameLabel);
    gridLayout.addComponent(nameTextField);
    gridLayout.addComponent(latitudeLabel);
    gridLayout.addComponent(latitudeTextField);
    gridLayout.addComponent(longitudeLabel);
    gridLayout.addComponent(longitudeTextField);
    gridLayout.addComponent(radiusLabel);
    gridLayout.addComponent(radiusTextField);
    setRestrictedOperatorComboBox();
    panel.setContent(gridLayout);
    panel.setCaption("Geofence");
    return super.buildMainLayout();
  }
Ejemplo n.º 30
0
 @Test
 public void testOneBigComponentGridLayout() {
   Button b1 = new Button("Button 0,0 -> 1,1");
   b1.setCaptionAsHtml(true);
   String design =
       "<v-grid-layout><row>" //
           + "<column colspan=2 rowspan=2>"
           + writeChild(b1)
           + "</column>" //
           + "</row><row expand=2>" //
           + "</row></v-grid-layout>";
   GridLayout gl = new GridLayout(2, 2);
   gl.addComponent(b1, 0, 0, 1, 1);
   gl.setRowExpandRatio(1, 2);
   testWrite(design, gl);
   testRead(design, gl);
 }