示例#1
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);
  }
  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;
  }
示例#3
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;
  }
示例#4
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));
  }
示例#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);
          }
        });
  }
  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);
  }
示例#7
0
  public ReceiptForm() {
    // Create our layout (3x3 GridLayout)
    ourLayout = new GridLayout(2, 2);

    // Use top-left margin and spacing
    ourLayout.setMargin(true, false, false, true);
    ourLayout.setSpacing(true);
    ourLayout.setWidth(400, Component.UNITS_PIXELS);

    setLayout(ourLayout);

    setFormFieldFactory(new ReceiptFormFieldFactory());

    // Set up buffering
    setWriteThrough(false); // we want explicit 'apply'
    setInvalidCommitted(false); // no invalid values in datamodel

    lblNote.setSizeUndefined();
    ourLayout.addComponent(lblNote, 0, 0);
    ourLayout.setComponentAlignment(lblNote, Alignment.TOP_RIGHT);
    ourLayout.addComponent(btnSave, 1, 1);

    btnSave.addListener(
        new Button.ClickListener() {

          public void buttonClick(ClickEvent event) {
            commit();
            if (getItemDataSource() instanceof Buffered) {
              ((Buffered) getItemDataSource()).commit();
            }
          }
        });
  }
  /** 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);
  }
  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;
  }
示例#10
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));
 }
示例#11
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);
  }
示例#12
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));
 }
示例#13
0
  private void initLayoutContent() {
    initNavigationButtons();
    initHideWeekEndButton();
    initReadOnlyButton();
    initDisabledButton();
    initAddNewEventButton();

    HorizontalLayout hl = new HorizontalLayout();
    hl.setWidth("100%");
    hl.setSpacing(true);
    hl.setMargin(new MarginInfo(false, false, true, false));
    hl.addComponent(prevButton);
    hl.addComponent(captionLabel);
    hl.addComponent(monthButton);
    hl.addComponent(weekButton);
    hl.addComponent(nextButton);
    hl.setComponentAlignment(prevButton, Alignment.MIDDLE_LEFT);
    hl.setComponentAlignment(captionLabel, Alignment.MIDDLE_CENTER);
    hl.setComponentAlignment(monthButton, Alignment.MIDDLE_CENTER);
    hl.setComponentAlignment(weekButton, Alignment.MIDDLE_CENTER);
    hl.setComponentAlignment(nextButton, Alignment.MIDDLE_RIGHT);

    monthButton.setVisible(viewMode == Mode.WEEK);
    weekButton.setVisible(viewMode == Mode.DAY);

    HorizontalLayout controlPanel = new HorizontalLayout();
    controlPanel.setSpacing(true);
    controlPanel.setMargin(new MarginInfo(false, false, true, false));
    controlPanel.setWidth("100%");
    controlPanel.addComponent(localeSelect);
    controlPanel.addComponent(timeZoneSelect);
    controlPanel.addComponent(formatSelect);
    controlPanel.addComponent(customFirstDayOfWeekSelect);
    controlPanel.addComponent(hideWeekendsButton);
    controlPanel.addComponent(readOnlyButton);
    controlPanel.addComponent(disabledButton);
    controlPanel.addComponent(addNewEvent);

    controlPanel.setComponentAlignment(timeZoneSelect, Alignment.MIDDLE_LEFT);
    controlPanel.setComponentAlignment(formatSelect, Alignment.MIDDLE_LEFT);
    controlPanel.setComponentAlignment(localeSelect, Alignment.MIDDLE_LEFT);
    controlPanel.setComponentAlignment(hideWeekendsButton, Alignment.MIDDLE_LEFT);
    controlPanel.setComponentAlignment(readOnlyButton, Alignment.MIDDLE_LEFT);
    controlPanel.setComponentAlignment(disabledButton, Alignment.MIDDLE_LEFT);
    controlPanel.setComponentAlignment(addNewEvent, Alignment.MIDDLE_LEFT);

    GridLayout layout = (GridLayout) getContent();
    layout.addComponent(controlPanel);
    layout.addComponent(hl);
    layout.addComponent(calendarComponent);
    layout.setRowExpandRatio(layout.getRows() - 1, 1.0f);
  }
 @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);
 }
  private void refresh() {
    this.platformConfigurationConfiguredResource = new PlatformConfigurationConfiguredResource();

    this.platformConfiguration =
        this.configurationManagement.getConfiguration(this.platformConfigurationConfiguredResource);

    // create the configuration if it does not already exist!
    if (platformConfiguration == null) {
      this.platformConfigurationConfiguredResource.setConfiguration(new PlatformConfiguration());
      platformConfiguration =
          this.configurationManagement.createConfiguration(platformConfigurationConfiguredResource);
    }

    final List<ConfigurationParameter> parameters =
        (List<ConfigurationParameter>) platformConfiguration.getParameters();

    GridLayout layout = new GridLayout();
    layout.setWidth("100%");
    layout.setSpacing(true);

    Panel userPanel = null;
    Panel passwordPanel = null;
    Panel mapPanel = null;

    for (ConfigurationParameter parameter : parameters) {
      if (parameter.getName().equals("webServiceUserAccount")) {
        userParam = parameter;
        userPanel =
            this.createTextFieldPanel(
                parameter,
                new NonZeroLengthStringValidator("The web service user account must be entered!"));
      } else if (parameter.getName().equals("webServiceUserPassword")) {
        passwordParam = parameter;
        passwordPanel =
            this.createPasswordFieldPanel(
                parameter,
                new NonZeroLengthStringValidator("The web service user password must be entered!"));
      }
      if (parameter.getName().equals("configurationMap")) {
        mapPanel = this.createMapPanel((ConfigurationParameterMapImpl) parameter);
      }
    }

    layout.addComponent(userPanel);
    layout.addComponent(passwordPanel);
    layout.addComponent(mapPanel);

    this.setContent(layout);
  }
示例#16
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);
  }
示例#17
0
  private GridLayout getLayout() {

    final GridLayout layout = new GridLayout(4, 5);
    layout.setSpacing(true);
    TextField postalAddress = getTextField("Postal PersonAddress", "postalAddress");
    TextField postalCode = getTextField("Postal Code", "postalCode");
    TextField physicalAddress = getTextField("Physical PersonAddress", "physicalAddress");
    TextField addressType = getTextField("PersonAddress Type", "addressTypeId");

    layout.addComponent(postalAddress, 0, 0);
    layout.addComponent(physicalAddress, 1, 0);
    layout.addComponent(addressType, 0, 1);
    layout.addComponent(postalCode, 1, 1);
    layout.addComponent(getButtons(), 0, 2, 1, 2);
    return layout;
  }
示例#18
0
  private void buildContent() {

    this.cb_Grupo.setWidth("100%");
    this.cb_Auxiliar.setWidth("100%");
    this.cb_Activos.setWidth("100%");

    setColumnExpandRatio(0, 0.3f);
    setColumnExpandRatio(1, 1f);
    setColumnExpandRatio(2, 1f);

    GridLayout gridlFecha = new GridLayout(1, 1);
    gridlFecha.setWidth("100%");
    GridLayout gridlCodigo = new GridLayout(1, 1);
    gridlCodigo.setWidth("100%");
    gridlCodigo.setHeight("100%");
    GridLayout gridlCombos = new GridLayout(1, 3);
    gridlCombos.setWidth("100%");
    gridlCodigo.setMargin(true);
    gridlFecha.setMargin(true);
    gridlCombos.setMargin(true);

    Panel pnFecha = new Panel("Fecha Elaboracion");
    pnFecha.setContent(gridlFecha);
    pnFecha.setStyleName(AitTheme.PANEL_PRINT);
    pnFecha.setIcon(FontAwesome.EDIT);
    pnCodigo = new Panel("Seleccion por codigo");
    pnCodigo.setContent(gridlCodigo);
    pnCodigo.setStyleName(AitTheme.PANEL_PRINT);
    pnCodigo.setIcon(FontAwesome.EDIT);
    pnCombos = new Panel("Seleccion por Grupo y Auxiliar Contable");
    pnCombos.setContent(gridlCombos);
    pnCombos.setStyleName(AitTheme.PANEL_PRINT);
    pnCombos.setIcon(FontAwesome.EDIT);

    pnCodigo.addClickListener(this);
    pnCombos.addClickListener(this);

    gridlFecha.addComponent(dtf_fechaElaboracion, 0, 0);
    gridlCodigo.addComponent(txt_codigoActivo, 0, 0);
    gridlCombos.addComponent(this.cb_Grupo, 0, 0);
    gridlCombos.addComponent(this.cb_Auxiliar, 0, 1);
    gridlCombos.addComponent(this.cb_Activos, 0, 2);

    addComponent(pnFecha, 0, 0);
    addComponent(pnCodigo, 1, 0);
    addComponent(pnCombos, 1, 1, 1, 3);
  }
 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);
     }
   }
 }
示例#20
0
  @AutoGenerated
  private GridLayout buildHeadLayout() {
    // common part: create layout
    headLayout = new GridLayout();
    headLayout.setImmediate(false);
    headLayout.setWidth("-1px");
    headLayout.setHeight("-1px");
    headLayout.setMargin(false);
    headLayout.setSpacing(true);
    headLayout.setColumns(2);
    headLayout.setRows(2);

    // parameterTypeLabel
    parameterTypeLabel = new Label();
    parameterTypeLabel.setImmediate(false);
    parameterTypeLabel.setWidth("-1px");
    parameterTypeLabel.setHeight("-1px");
    parameterTypeLabel.setValue("Type of Parameter");
    headLayout.addComponent(parameterTypeLabel, 0, 0);

    // parameterType
    parameterType = new ComboBox();
    parameterType.setImmediate(false);
    parameterType.setWidth("-1px");
    parameterType.setHeight("-1px");
    headLayout.addComponent(parameterType, 1, 0);

    // parameterNameLabel
    parameterNameLabel = new Label();
    parameterNameLabel.setImmediate(false);
    parameterNameLabel.setWidth("-1px");
    parameterNameLabel.setHeight("-1px");
    parameterNameLabel.setValue("Parameter");
    headLayout.addComponent(parameterNameLabel, 0, 1);
    headLayout.setComponentAlignment(parameterNameLabel, new Alignment(6));

    // parameterName
    parameterName = new TextField();
    parameterName.setImmediate(false);
    parameterName.setWidth("-1px");
    parameterName.setHeight("-1px");
    parameterName.setRequired(true);
    headLayout.addComponent(parameterName, 1, 1);

    return headLayout;
  }
 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 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);
     }
   }
 }
示例#23
0
  private Component buildFormContent() {

    VerticalLayout formContent = new VerticalLayout();
    formContent.setSpacing(true);

    Panel frmPanel = new Panel();
    frmPanel.setStyleName(AitTheme.PANEL_FORM);
    frmPanel.setIcon(FontAwesome.EDIT);
    frmPanel.setWidth("100%");
    frmPanel.setCaption("Servidor con Atribuciones de Autorizacion");

    GridLayout gridlFunionario = new GridLayout(3, 1);
    gridlFunionario.addComponent(txtDependencia, 0, 0);
    gridlFunionario.addComponent(txtUnidadOrganizacional, 1, 0);
    gridlFunionario.addComponent(txt_nombre_servidor, 2, 0);

    gridlFunionario.setMargin(true);
    gridlFunionario.setSpacing(true);
    gridlFunionario.setWidth("100%");
    frmPanel.setContent(gridlFunionario);

    formContent.setMargin(true);
    formContent.addComponent(frmPanel);
    Panel gridPanel = new Panel();
    gridPanel.setWidth("100%");
    gridPanel.setCaption("Documentos que Puede Autorizar");
    gridPanel.setContent(this.gridTipoAutorizacion);
    gridPanel.setStyleName(AitTheme.PANEL_GRID);
    gridPanel.setIcon(FontAwesome.TABLE);
    formContent.setMargin(true);

    Panel gridpin = new Panel();
    gridpin.setStyleName(AitTheme.PANEL_FORM);
    gridpin.setIcon(FontAwesome.TABLE);
    gridpin.setWidth("100%");
    gridpin.setCaption("N. PIN");
    gridpin.setContent(this.frm_pin);
    formContent.setMargin(true);

    formContent.addComponent(frmPanel);
    formContent.addComponent(gridPanel);
    formContent.addComponent(gridpin);
    Responsive.makeResponsive(formContent);
    return formContent;
  }
示例#24
0
  public LoginModule() {

    setMargin(true);
    setSpacing(true);
    grid.setSizeFull();
    grid.setSpacing(true);

    final TextField username = new TextField();
    username.setValue("username");
    username.setWidth("120px");
    username.setStyleName("small");
    grid.addComponent(username, 0, 0);

    final PasswordField password = new PasswordField();
    password.setValue("password");
    password.setWidth("120px");
    password.setStyleName("small");
    grid.addComponent(password, 0, 1);

    Button button = new Button("Login");
    button.setWidth("120px");
    button.setStyleName("small");
    button.addListener(
        new Button.ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            login.setUsername(username.getValue().toString());
            login.setPassword(password.getValue().toString());
            String user = login.getUsername();
            String pass = login.getPassword();
            // login.setResult(authLog.login(user, pass));
            boolean result = authLog.login(user, pass);
            if (result == true) {
              label.setCaption("Successfully Login");
            } else {
              label.setCaption("SQL Error");
            }
          }
        });
    grid.addComponent(button, 0, 2);
    panel.addComponent(grid);
    addComponent(panel);
    addComponent(label);
  }
 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;
 }
示例#26
0
  public void initializeButtonPanel() {
    buttonForm = new HorizontalLayout();
    buttonForm.setSizeFull();

    buttonSave.setStyleName("saveButton");
    buttonSave.setDescription("Guardar");
    buttonCancel.setStyleName("cancelButton");
    buttonCancel.setDescription("Cancelar");

    buttonForm.setMargin(false);

    GridLayout grid = new GridLayout(2, 1);
    grid.addComponent(buttonSave, 0, 0);
    grid.addComponent(buttonCancel, 1, 0);
    grid.setWidth("20%");
    buttonForm.addComponent(grid);
    buttonForm.setComponentAlignment(grid, Alignment.MIDDLE_CENTER);
  }
示例#27
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);
   }
 }
 private Panel addPanelMenu(Menu menu) {
   panel = new Panel();
   initComponents();
   for (int i = 1; i <= NUMBER_OF_SERVICE_DAYS; i++) {
     weekdayLabel = new Label(Weekday.getWeekday(i).toString());
     gridLayout.addComponent(locateLayoutWeek(weekdayLabel));
     for (MenuItem menuItem : menu.getItems().get(Weekday.getWeekday(i))) {
       ShowDayMenusPanel showDayMenusPanel =
           new ShowDayMenusPanel(menuItem.getDescription(), menuItem.getCost());
       showDayMenusPanel.setId(menuItem.getId());
       showDayMenusPanel.setWeekday(menuItem.getWeekday());
       currentWeekMenusPanels.add(showDayMenusPanel);
       gridLayout.addComponent(showDayMenusPanel);
       panel.addComponent(gridLayout);
     }
   }
   return panel;
 }
示例#29
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);
   }
 }
示例#30
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();
  }