/**
   * 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 PanelListaMateriasParaEditar(final BloqueBO bloqueBO) {
    buildMainLayout();
    setCompositionRoot(mainLayout);

    // TODO add user code here
    this.bloqueBO = bloqueBO;

    btn_editar.setEnabled(false);

    tableMaterias.addContainerProperty("Materias", MateriaBO.class, null);
    tableMaterias.setSelectable(true);
    tableMaterias.setImmediate(true);

    tableMaterias.addValueChangeListener(
        new ValueChangeListener() {
          private static final long serialVersionUID = 1L;

          @Override
          public void valueChange(ValueChangeEvent event) {
            btn_editar.setEnabled(tableMaterias.getValue() != null);
          }
        });

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

          @Override
          public void buttonClick(ClickEvent event) {
            try {
              int i = Integer.parseInt(tableMaterias.getValue().toString());
              ControladorAdministrador.getInstance().getAcademUI().cerrarVentanaEmergente();
              ControladorAdministrador.getInstance()
                  .mostrarPanelEditarMateria(listMaterias.get(i), bloqueBO);
            } catch (Exception e) {

            }
          }
        });
  }
예제 #2
0
  private void initContactList() {
    contactList.setContainerDataSource(contactContainer);
    contactList.setVisibleColumns(new String[] {FNAME, LNAME, COMPANY});
    contactList.setSelectable(true);
    contactList.setImmediate(true);

    contactList.addValueChangeListener(
        new Property.ValueChangeListener() {
          public void valueChange(ValueChangeEvent event) {
            Object contactId = contactList.getValue();

            /*
             * When a contact is selected from the list, we want to show
             * that in our editor on the right. This is nicely done by the
             * FieldGroup that binds all the fields to the corresponding
             * Properties in our contact at once.
             */
            if (contactId != null) editorFields.setItemDataSource(contactList.getItem(contactId));

            editorLayout.setVisible(contactId != null);
          }
        });
  }