public void setDisplayList() {
   // ::TABLE
   tableList.setContainerDataSource(model.getBeanItemContainerHeader());
   setTablePropertiesList();
   setDisplayTableFooterList();
   bindAndBuildFieldGroupComponentList();
 }
  @Override
  protected Component getChart() {
    List<StockData> data = new LinkedList<StockData>();
    for (int i = 0; i < 200; i++) {
      data.addAll(getStockData());
    }

    Container container = new BeanItemContainer<StockData>(StockData.class, data);

    Table table = new Table();
    table.setContainerDataSource(container);
    table.addGeneratedColumn(
        "values",
        new Table.ColumnGenerator() {
          @Override
          public Object generateCell(Table source, Object itemId, Object columnId) {
            return new Sparkline(
                100, 20, (Number[]) source.getItem(itemId).getItemProperty(columnId).getValue());
          }
        });

    table.setVisibleColumns("month", "values", "latest");
    table.setHeightUndefined();

    return table;
  }
 // Load Purchase Detail
 private void loadPurDtl() {
   try {
     logger.info(
         "Company ID : " + companyid + " | User Name : " + username + " > " + "Loading Search...");
     recordCnt = listEnqDtls.size();
     beanPurEnqDtlDM = new BeanItemContainer<SmsPurEnqDtlDM>(SmsPurEnqDtlDM.class);
     beanPurEnqDtlDM.addAll(listEnqDtls);
     logger.info(
         "Company ID : "
             + companyid
             + " | User Name : "
             + username
             + " > "
             + "Got the dPurDt. result set");
     tblSmsEnqDtl.setContainerDataSource(beanPurEnqDtlDM);
     tblSmsEnqDtl.setVisibleColumns(
         new Object[] {
           "pordName", "productUom", "enquiryQty", "enqDtlStaus", "lastUpdateddt", "lastUpdatedby"
         });
     tblSmsEnqDtl.setColumnHeaders(
         new String[] {
           "Product Name", "UOM", "Enquiry Qty", "Status", "Last Updated Date", "Last Updated By"
         });
     tblSmsEnqDtl.setColumnFooter("lastUpdatedby", "No.of Records : " + recordCnt);
     tblSmsEnqDtl.setPageLength(7);
   } catch (Exception e) {
     logger.info(e.getMessage());
   }
 }
  private void cargarUsuarios(List<Usuario> lstUsuarios, boolean flagLimpiar) {

    IndexedContainer container = new IndexedContainer();
    container.addContainerProperty("id", Long.class, null);
    container.addContainerProperty("usuario", String.class, null);
    container.addContainerProperty("clave", String.class, null);
    container.addContainerProperty("nombres", String.class, null);
    container.addContainerProperty("apePat", String.class, null);
    container.addContainerProperty("apeMat", String.class, null);
    container.addContainerProperty("cargo", String.class, null);
    container.addContainerProperty("descCargo", String.class, null);
    container.addContainerProperty("rol", Rol.class, null);
    container.addContainerProperty("policia", Policia.class, null);
    container.addContainerProperty("dependencia", Dependencia.class, null);
    container.addContainerProperty("oficina.id", Long.class, null);
    container.addContainerProperty("oficina.nombre", String.class, null);
    container.addContainerProperty("rol.id", Long.class, null);

    tblUsuarios.setContainerDataSource(container);
    tblUsuarios.setVisibleColumns(
        new Object[] {"usuario", "nombres", "apePat", "apeMat", "cargo", "oficina.nombre"});

    tblUsuarios.setColumnWidth("usuario", 50);
    tblUsuarios.setColumnWidth("nombres", 75);
    tblUsuarios.setColumnWidth("apePat", 75);
    tblUsuarios.setColumnWidth("apeMat", 75);
    tblUsuarios.setColumnWidth("cargo", 130);
    tblUsuarios.setColumnWidth("oficina.nombre", 160);

    tblUsuarios.setColumnHeader("usuario", "Usuario");
    tblUsuarios.setColumnHeader("nombres", "Nombres");
    tblUsuarios.setColumnHeader("apePat", "Ape. Paterno");
    tblUsuarios.setColumnHeader("apeMat", "Ape. Materno");
    tblUsuarios.setColumnHeader("cargo", "Cargo");
    tblUsuarios.setColumnHeader("oficina.nombre", "Oficina");

    int con = 1;
    for (Usuario usuario : lstUsuarios) {
      Item item = container.addItem(con++);
      item.getItemProperty("id").setValue(usuario.getId());
      item.getItemProperty("usuario").setValue(usuario.getUsuario());
      item.getItemProperty("clave").setValue(usuario.getClave());
      item.getItemProperty("nombres").setValue(usuario.getNombres());
      item.getItemProperty("apePat").setValue(usuario.getApePat());
      item.getItemProperty("apeMat").setValue(usuario.getApeMat());
      item.getItemProperty("rol").setValue(usuario.getRol());
      item.getItemProperty("cargo").setValue(usuario.getCargo());
      item.getItemProperty("dependencia").setValue(usuario.getOficina());
      item.getItemProperty("policia").setValue(usuario.getPolicia());
      item.getItemProperty("descCargo").setValue(usuario.getDescCargo());
      item.getItemProperty("rol.id")
          .setValue(usuario.getRol() != null ? usuario.getRol().getId() : null);
      item.getItemProperty("oficina.id")
          .setValue(usuario.getOficina() != null ? usuario.getOficina().getId() : null);
      item.getItemProperty("oficina.nombre")
          .setValue(usuario.getOficina() != null ? usuario.getOficina().getNombre() : null);
    }
    limpiar();
  }
 private void AddressList() {
   contactList.setContainerDataSource(addressBookData);
   contactList.setVisibleColumns(visibleCols);
   contactList.setSelectable(true);
   contactList.setImmediate(true);
   contactList.setWidth("380px");
   contactList.setHeight("190px");
 }
  @Override
  protected void configureTable(Table table) {
    table.setContainerDataSource(getTableContainer());

    setupGeneratedColumns(table);
    table.setVisibleColumns(new Object[] {"name", "playerCount", "roundCount", "gameCount"});
    table.setColumnHeaders(new String[] {"Name", "Players", "Rounds", "Games"});
  }
  @SuppressWarnings("serial")
  private Component getTable() {
    List<UserOprYayasan> lm = GenericPersistence.findList(UserOprYayasan.class);

    dashboardPanels = new VerticalLayout();
    dashboardPanels.addStyleName("dashboard-panels");
    Responsive.makeResponsive(dashboardPanels);
    beans.setBeanIdProperty("id");
    beans.removeAllItems();
    if (lm != null) {
      beans.addAll(lm);
    } else {
      beans.addBean(new UserOprYayasan());
    }

    tabel.addGeneratedColumn(
        "aksi",
        new ColumnGenerator() {
          @Override
          public Object generateCell(Table source, Object itemId, Object columnId) {
            HorizontalLayout hl = new HorizontalLayout();
            Button edit = new Button(FontAwesome.EDIT);
            Button hapus = new Button(FontAwesome.TRASH_O);
            edit.addStyleName(ValoTheme.BUTTON_FRIENDLY);
            edit.addStyleName(ValoTheme.BUTTON_SMALL);
            hapus.addStyleName(ValoTheme.BUTTON_FRIENDLY);
            hapus.addStyleName(ValoTheme.BUTTON_SMALL);
            BeanItem<?> i = (BeanItem<?>) source.getContainerDataSource().getItem(itemId);
            final UserOprYayasan o = (UserOprYayasan) i.getBean();
            edit.addClickListener(
                new ClickListener() {
                  @Override
                  public void buttonClick(ClickEvent event) {
                    tambahUserYayasanbaru(o);
                  }
                });
            hl.addComponent(edit);
            hl.addComponent(hapus);
            return hl;
          }
        });
    tabel.setSizeFull();
    tabel.setImmediate(true);
    tabel.setSelectable(true);
    tabel.setContainerDataSource(beans);
    tabel.setRowHeaderMode(Table.RowHeaderMode.INDEX);
    tabel.setColumnHeader("useNnama", "NAMA PENGGUNA");
    tabel.setColumnHeader("nama", "NAMA");
    tabel.setColumnHeader("realName", "NAMA LENGKAP");
    tabel.setColumnHeader("registerDate", "TANGGAL REGISTRASI");
    tabel.setColumnHeader("email", "E-MAIL");
    tabel.setColumnHeader("lastSuccessfulLogin", "TERAKHIR LOGIN");
    tabel.setColumnHeader("aksi", "AKSI");
    tabel.setVisibleColumns(
        "aksi", "nama", "realName", "registerDate", "email", "lastSuccessfulLogin");
    dashboardPanels.addComponent(tabel);
    return dashboardPanels;
  }
 public void setDisplayDetil() {
   // ::TABLE
   tableDetil.setContainerDataSource(model.getBeanItemContainerDetil());
   setTablePropertiesDetil();
   setDisplayTableFooterDetil();
   ;
   bindAndBuildFieldGroupComponentDetilHeader();
   setFormButtonAndTextState();
 }
  public void setDisplay() {
    // TABLE
    table.setContainerDataSource(model.getBeanItemContainerItemHeader());

    setTableProperties();

    setDisplayTableFooter();

    bindAndBuildFieldGroupComponent();
  }
 @Override
 public void bind() {
   Table userList = this.view.getUserList();
   container = new BeanItemContainer<User>(User.class);
   userList.setContainerDataSource(container);
   userList.setVisibleColumns(new String[] {"userName", "firstName", "lastName"});
   userList.setImmediate(true);
   userList.setSelectable(true);
   userList.setMultiSelect(false);
   // userList.setEditable(true);
 }
 @Override
 public void setContainerDataSource(Container newDataSource) {
   super.setContainerDataSource(newDataSource);
   setColumnHeaderMode(Table.COLUMN_HEADER_MODE_EXPLICIT);
   addStyleName("server-desc-basic-service");
   setCaption(ViewProperties.getCaption("table.serverServices"));
   setSortDisabled(true);
   setMultiSelect(false);
   setImmediate(false);
   setVisible(true);
 }
 @Override
 protected void initView() {
   super.initView();
   processTable = new Table();
   dataSource = new BeanItemContainer<ProcessDefinition>(ProcessDefinition.class);
   processTable.setContainerDataSource(dataSource);
   processTable.setVisibleColumns(
       new String[] {"name", "key", "version", "resourceName", "category"});
   processTable.setSizeFull();
   processTable.addGeneratedColumn("name", createNameColumnGenerator());
   getViewLayout().addComponent(processTable);
   getViewLayout().setExpandRatio(processTable, 1.0F);
 }
  protected Table createList() {
    groupTable = new Table();

    groupTable.setEditable(false);
    groupTable.setImmediate(true);
    groupTable.setSelectable(true);
    groupTable.setNullSelectionAllowed(false);
    groupTable.setSortDisabled(true);
    groupTable.setSizeFull();

    groupListQuery = new GroupListQuery();
    groupListContainer = new LazyLoadingContainer(groupListQuery, 20);
    groupTable.setContainerDataSource(groupListContainer);

    // Column headers
    groupTable.addGeneratedColumn("icon", new ThemeImageColumnGenerator(Images.GROUP_22));
    groupTable.setColumnWidth("icon", 22);
    groupTable.addContainerProperty("name", String.class, null);
    groupTable.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);

    // Listener to change right panel when clicked on a user
    groupTable.addListener(
        new Property.ValueChangeListener() {
          private static final long serialVersionUID = 1L;

          public void valueChange(ValueChangeEvent event) {
            Item item =
                groupTable.getItem(
                    event
                        .getProperty()
                        .getValue()); // the value of the property is the itemId of the table entry
            if (item != null) {
              String groupId = (String) item.getItemProperty("id").getValue();
              setDetailComponent(new GroupDetailPanel(GroupPage.this, groupId));

              // Update URL
              ExplorerApp.get()
                  .setCurrentUriFragment(new UriFragment(GroupNavigator.GROUP_URI_PART, groupId));
            } else {
              // Nothing is selected
              setDetailComponent(null);
              ExplorerApp.get()
                  .setCurrentUriFragment(new UriFragment(GroupNavigator.GROUP_URI_PART, groupId));
            }
          }
        });

    return groupTable;
  }
  @Override
  protected void init(VaadinRequest request) {
    //        entity = new MyEntity();
    //        entity.setName("Dima4");
    //        myForm.getserviceDYF2().saveEntity(entity);
    System.err.println("Init...");
    table = new Table("my table");
    c = new HbnContainer<MyEntity>(MyEntity.class, DatabaseUtil.getSessionFactory());
    if (c == null) {
      System.err.println("container=null");
    } else {
      System.err.println("container ok");
    }
    table.setContainerDataSource(
        c); // serviceDYF.getDao().getSessionFactory().getCurrentSession()));

    VerticalLayout view = new VerticalLayout();
    view.addComponent(new Label("Hello Vaadin! !"));
    view.addComponent(table);
    setContent(view);
  }
  /** 初始化表格 * */
  private void initRightTable(Table table, Container container) {
    table.setSizeFull();
    table.setHeight(100, Unit.PERCENTAGE);
    table.setContainerDataSource(container);
    table.setVisibleColumns(Constants.COMPLAIN_TYPE_COL);
    table.setColumnHeaders(Constants.COMPLAIN_TYPE_COL_HEADERS_CHINESE);

    table.setColumnCollapsingAllowed(true);
    table.setColumnReorderingAllowed(true);
    table.addItemClickListener(
        new ItemClickListener() {

          @Override
          public void itemClick(ItemClickEvent event) {
            // MouseButton.LEFT 左键单击
            if (event.getButtonName().equals(MouseButton.LEFT.getName())) {
              createWindow(event.getItem());
            }
          }
        });
  }
  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);
          }
        });
  }
Exemple #17
0
  @Override
  /** displays a list of historicProcessInstances */
  protected void initView() {
    super.initView();
    Button refresh = new Button("Refresh");
    refresh.addStyleName(Reindeer.BUTTON_SMALL);
    refresh.addListener(
        new Button.ClickListener() {
          private static final long serialVersionUID = 1L;

          @Override
          public void buttonClick(ClickEvent event) {
            getPresenter().init();
          }
        });

    processTable = new Table();
    dataSource =
        new BeanItemContainer<HistoricProcessInstanceTitle>(HistoricProcessInstanceTitle.class);
    processTable.setContainerDataSource(dataSource);
    processTable.setVisibleColumns(
        new String[] {
          "id",
          "processDefinitionId",
          "title",
          "startUserId",
          "startTime",
          "endTime",
          "durationInMillis"
        });
    processTable.setSizeFull();
    processTable.addGeneratedColumn("id", createNameColumnGenerator());
    processTable.addGeneratedColumn("durationInMillis", new TimeColumnGenerator());
    getViewLayout().addComponent(refresh);
    getViewLayout().addComponent(processTable);
    getViewLayout().setExpandRatio(processTable, 1.0F);
  }
  @Override
  protected void init(VaadinRequest request) {
    setSizeFull();

    VerticalLayout layout = new VerticalLayout();

    List<Aircraft> message = aircraftService.list();
    Label label = new Label(message.toString());
    final TextField field = new TextField();
    Button button = new Button();

    button.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(Button.ClickEvent clickEvent) {
            aircraftService.create(field.getValue());
          }
        });
    HorizontalLayout fieldPanel = new HorizontalLayout();
    fieldPanel.addComponent(field);
    fieldPanel.addComponent(button);
    fieldPanel.addComponent(label);

    Table table = new Table();
    table.setRowHeaderMode(Table.RowHeaderMode.ID);
    table.setSizeFull();

    final BeanItemContainer<Booking> container = new BeanItemContainer<Booking>(Booking.class);
    container.addAll(bookingService.list());
    container.addNestedContainerProperty("flight.flightNumber");
    container.removeContainerProperty("flight");
    table.setContainerDataSource(container);

    HorizontalLayout toolbar = new HorizontalLayout();
    Button addButton = new Button("Add");
    addButton.addClickListener(
        new Button.ClickListener() {

          @Override
          public void buttonClick(Button.ClickEvent clickEvent) {
            FormLayout formLayout = new FormLayout();

            // Form for editing the bean
            final BeanFieldGroup<Booking> binder = new BeanFieldGroup<Booking>(Booking.class);
            binder.setBuffered(true);
            final Booking bean = new Booking();
            bean.setFlight(new Flight());
            binder.setItemDataSource(bean);
            formLayout.addComponent(binder.buildAndBind("Ticket", "ticket"));
            formLayout.addComponent(binder.buildAndBind("Flight Nr.", "flight.flightNumber"));

            Button save = new Button("Save");
            save.addClickListener(
                new Button.ClickListener() {
                  @Override
                  public void buttonClick(Button.ClickEvent event) {
                    try {
                      binder.commit();
                      container.addBean(bean);
                    } catch (FieldGroup.CommitException e) {
                      throw new RuntimeException(e.getMessage());
                    }
                  }
                });
            formLayout.addComponent(save);

            UI.getCurrent().addWindow(new Window("Edit Booking", formLayout));
          }
        });
    toolbar.addComponent(addButton);

    layout.addComponent(fieldPanel);
    layout.addComponent(toolbar);
    layout.addComponent(table);

    UI.getCurrent()
        .setErrorHandler(
            new ErrorHandler() {
              @Override
              public void error(com.vaadin.server.ErrorEvent event) {
                Notification.show(
                    event.getThrowable().getLocalizedMessage(), Notification.Type.ERROR_MESSAGE);
              }
            });
    setContent(layout);
  }
 @Override
 public void buttonClick(ClickEvent event) {
   int i = mode % 4;
   t.setContainerDataSource(ta[i].getContainerDataSource());
   mode++;
 }
  private void cargarDatos() {
    Notificacion notificacionBuscar = new Notificacion();
    notificacionBuscar.setInforme(informe);
    List<Notificacion> notificaciones = notificacionService.buscar(notificacionBuscar);

    IndexedContainer container = new IndexedContainer();
    container.addContainerProperty(COLUMNA_UNIDAD_PROCURADURIA, String.class, null);
    container.addContainerProperty(COLUMNA_TIPO_NOTIFICACION, String.class, null);
    container.addContainerProperty(COLUMNA_FECHA_RECEPCION, String.class, null);
    container.addContainerProperty(COLUMNA_FECHA_VENCIMIENTO, String.class, null);
    container.addContainerProperty(COLUMNA_FECHA_PLAZO, String.class, null);
    container.addContainerProperty(COLUMNA_ESTADO_NOTIFICACION, String.class, null);
    container.addContainerProperty(COLUMNA_OPCION_ELIMINAR, Button.class, null);
    container.addContainerProperty(COLUMNA_OPCION_SEGUIMIENTO, Button.class, null);

    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");

    int con = 1;
    for (final Notificacion notificacion : notificaciones) {
      Item item = container.addItem(con++);
      item.getItemProperty(COLUMNA_UNIDAD_PROCURADURIA)
          .setValue(notificacion.getUnidad() == null ? null : notificacion.getUnidad().getNombre());
      item.getItemProperty(COLUMNA_TIPO_NOTIFICACION)
          .setValue(
              notificacion.getTipoNotificacion() == null
                  ? null
                  : notificacion.getTipoNotificacion().getNombre());
      item.getItemProperty(COLUMNA_FECHA_RECEPCION)
          .setValue(
              notificacion.getFechaRecepcion() == null
                  ? null
                  : df.format(notificacion.getFechaRecepcion()));
      item.getItemProperty(COLUMNA_FECHA_VENCIMIENTO)
          .setValue(
              notificacion.getFechaVencimiento() == null
                  ? null
                  : df.format(notificacion.getFechaVencimiento()));
      item.getItemProperty(COLUMNA_FECHA_PLAZO)
          .setValue(
              notificacion.getFechaPlazo() == null
                  ? null
                  : df.format(notificacion.getFechaPlazo()));
      item.getItemProperty(COLUMNA_ESTADO_NOTIFICACION)
          .setValue(notificacion.getEstado() == null ? null : notificacion.getEstado().getNombre());
      Button eliminar = new Button();
      eliminar.setCaption("Eliminar");
      eliminar.addListener(
          new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
              notificacionService.eliminar(notificacion);
              cargarDatos();
            }
          });
      item.getItemProperty(COLUMNA_OPCION_ELIMINAR).setValue(eliminar);
      Button seguimiento = new Button();
      seguimiento.setCaption("Seguimiento");
      seguimiento.addListener(
          new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {

              PanelRegistroInformeSeguimientoNotificacion
                  panelRegistroInformeSeguimientoNotificacion =
                      new PanelRegistroInformeSeguimientoNotificacion(notificacion);

              Window wdSeguimiento = new Window();

              wdSeguimiento.setModal(true);
              wdSeguimiento.setResizable(false);
              wdSeguimiento.addComponent(panelRegistroInformeSeguimientoNotificacion);

              wdSeguimiento.setCaption("Seguimiento");
              wdSeguimiento.setWidth("1050px");
              getApplication().getMainWindow().getWindow().addWindow(wdSeguimiento);
            }
          });
      item.getItemProperty(COLUMNA_OPCION_SEGUIMIENTO).setValue(seguimiento);
    }

    tblNotificacion.setContainerDataSource(container);
    tblNotificacion.setVisibleColumns(
        new Object[] {
          COLUMNA_UNIDAD_PROCURADURIA,
          COLUMNA_TIPO_NOTIFICACION,
          COLUMNA_FECHA_RECEPCION,
          COLUMNA_FECHA_VENCIMIENTO,
          COLUMNA_FECHA_PLAZO,
          COLUMNA_ESTADO_NOTIFICACION,
          COLUMNA_OPCION_ELIMINAR,
          COLUMNA_OPCION_SEGUIMIENTO
        });
    tblNotificacion.setColumnWidth(COLUMNA_UNIDAD_PROCURADURIA, 100);
    tblNotificacion.setColumnWidth(COLUMNA_TIPO_NOTIFICACION, 100);
    tblNotificacion.setColumnWidth(COLUMNA_FECHA_RECEPCION, 100);
    tblNotificacion.setColumnWidth(COLUMNA_FECHA_VENCIMIENTO, 100);
    tblNotificacion.setColumnWidth(COLUMNA_FECHA_PLAZO, 100);
    tblNotificacion.setColumnWidth(COLUMNA_ESTADO_NOTIFICACION, 100);
    tblNotificacion.setColumnWidth(COLUMNA_OPCION_ELIMINAR, 100);
    tblNotificacion.setColumnWidth(COLUMNA_OPCION_SEGUIMIENTO, 100);
    tblNotificacion.setColumnHeader(COLUMNA_UNIDAD_PROCURADURIA, "Unidad");
    tblNotificacion.setColumnHeader(COLUMNA_TIPO_NOTIFICACION, "Tipo");
    tblNotificacion.setColumnHeader(COLUMNA_FECHA_RECEPCION, "F. Recepcion");
    tblNotificacion.setColumnHeader(COLUMNA_FECHA_VENCIMIENTO, "F. Vencimiento");
    tblNotificacion.setColumnHeader(COLUMNA_FECHA_PLAZO, "F. Plazo");
    tblNotificacion.setColumnHeader(COLUMNA_ESTADO_NOTIFICACION, "Estado");
    tblNotificacion.setColumnHeader(COLUMNA_OPCION_ELIMINAR, "");
    tblNotificacion.setColumnHeader(COLUMNA_OPCION_SEGUIMIENTO, "");
  }
Exemple #21
0
  @Override
  public void init() {
    Window mainWindow = new Window("GridDemo");
    mainWindow.getContent().setSizeFull();
    ((VerticalLayout) mainWindow.getContent()).setSpacing(true);
    Indexed c = getTestContainer();
    final Table table = new Table();
    table.setImmediate(true);
    table.setSizeUndefined();
    table.setHeight("100%");
    table.setWidth("100%");
    table.setContainerDataSource(c);
    table.setCacheRate(0.5d);

    table.setNullSelectionAllowed(false);
    final Grid grid = new Grid(c);
    grid.setWidth("100%");
    grid.setHeight("100%");

    mainWindow.addComponent(grid);
    grid.getBody().setCelEditingEnabled(true);
    grid.setColumnWidth("p1", 200);
    grid.setImmediate(true);
    grid.setColumnAlignment("p1", Align.RIGHT);
    grid.setColumnAlignment("p2", Align.CENTER);
    grid.getHeader()
        .setHeaderFactory(
            new HeaderComponentFactory() {
              @Override
              public Component createComponent(final Grid grid, final Object propertyId) {
                final TextField l = new TextField("<b>" + propertyId + "<\b>");
                l.setImmediate(true);
                l.setWidth("100%");
                l.addListener(
                    new ValueChangeListener() {
                      @Override
                      public void valueChange(ValueChangeEvent event) {
                        ((Filterable) grid.getContainerDataSource())
                            .addContainerFilter(
                                new Filter() {

                                  @Override
                                  public boolean passesFilter(Object itemId, Item item)
                                      throws UnsupportedOperationException {
                                    return item.getItemProperty(propertyId)
                                        .getValue()
                                        .toString()
                                        .contains(l.getValue().toString());
                                  }

                                  @Override
                                  public boolean appliesToProperty(Object id) {
                                    return id.equals(propertyId);
                                  }
                                });
                      }
                    });
                return l;
              }
            });
    table.setEditable(true);
    // mainWindow.addComponent(table);
    setMainWindow(mainWindow);
    setTheme("griddemotheme");
  }
  public WindowManagerTeacher() {

    setCaption("quan ly bo mon "); // Constants.USER_CAPTION) ;

    mainLayout = new HorizontalLayout();
    mainLayout.setImmediate(false);
    mainLayout.setWidth(Constants.WIDTH_MAX, Sizeable.UNITS_PIXELS);
    mainLayout.setMargin(false);
    mainLayout.setSpacing(true);

    mainLayout.addComponent(new leftSide());

    rContentList = new VerticalLayout();
    rContentList.setWidth("100%");
    mainLayout.addComponent(rContentList);
    mainLayout.setExpandRatio(rContentList, 1.0f);

    rContentModify = new rightContentAddNewTeacher(1);
    rContentModify.setWidth("100%");

    VerticalLayout v = new VerticalLayout();
    v.setWidth("100%");
    v.setStyleName("bl-mainContent");
    v.addComponent(mainLayout);
    v.setComponentAlignment(mainLayout, Alignment.MIDDLE_CENTER);

    addComponent(new topLogin());
    addComponent(new topPanel());
    addComponent(new mainMenu());
    addComponent(v);
    addComponent(new bottom());

    // --------------------bl
    Label title = new Label("<center><h1>Danh sách giang vien<h1></center>", Label.CONTENT_XHTML);

    table = new Table();
    table.setWidth("100%");
    table.setPageLength(20);

    rContentList.addComponent(title);
    rContentList.addComponent(table);

    Connection conn = null;
    Statement stmt = null;

    try {
      JDBCConnectionPool pool =
          new SimpleJDBCConnectionPool(
              JDBC_DRIVER,
              DB_URL + QlgiangvienApplication.DB_DBNAME,
              QlgiangvienApplication.DB_USER,
              QlgiangvienApplication.DB_PASS);

      String mysql = "SELECT * from GiangVien";

      TableQuery query = new TableQuery("GiangVien", pool);
      query.setVersionColumn("OPTLOCK");

      SQLContainer container = new SQLContainer(query);
      container.setAutoCommit(true);
      //          container.re
      table.setContainerDataSource(container);

      //           FreeformQuery query = new FreeformQuery(mysql, pool, "MaGV") ;

      //           container = new SQLContainer(query);

      //           table.setContainerDataSource(container) ;

      table.addGeneratedColumn(
          "Chinh Sua",
          new Table.ColumnGenerator() {
            public Component generateCell(Table source, Object itemId, Object columnId) {
              final Item item = table.getItem(itemId);

              Button btnModify =
                  new Button(
                      "Chinh Sua",
                      new Button.ClickListener() {
                        @Override
                        public void buttonClick(ClickEvent event) {

                          //              				rContentList.setVisible(false);
                          //              				rContentModify.setVisible(true);
                          System.out.println(item.toString());
                          rContentModify.setUpdateData(
                              item.getItemProperty("MaGV").getValue().toString());
                          mainLayout.removeComponent(rContentList);
                          mainLayout.addComponent(rContentModify);
                          mainLayout.setExpandRatio(rContentModify, 1.0f);
                        }
                      });

              return btnModify;
            }
          });
      confirmDelete();
      table.addGeneratedColumn(
          "Xoa",
          new Table.ColumnGenerator() {
            public Component generateCell(Table source, Object itemId, Object columnId) {

              //            	   Item item = table.getItem(itemId);

              Button btnModify =
                  new Button(
                      "Xoa",
                      new Button.ClickListener() {
                        @Override
                        public void buttonClick(ClickEvent event) {

                          if (subwindow.getParent() == null) {

                            getWindow().addWindow(subwindow);
                          }
                        }
                      });

              return btnModify;
            }
          });

    } catch (Exception e) {
      System.out.println("in right COntent: " + e.toString());
    }
  } // end of container
Exemple #23
0
  private DataBinder<MarathonData> showOverviewData(final FormLayout layout) {
    layout.setMargin(true);
    final BeanFieldGroup<MarathonData> binder =
        new BeanFieldGroup<MarathonData>(MarathonData.class);
    layout.addComponent(binder.buildAndBind("Veranstaltung", "marathonName"));
    final BeanItemContainer<String> categoryListContainer =
        new BeanItemContainer<String>(String.class);

    final ListSelect categoryListSelect = new ListSelect("Kategorieen", categoryListContainer);
    categoryListSelect.setNewItemsAllowed(true);
    categoryListSelect.setNullSelectionAllowed(false);
    categoryListSelect.setMultiSelect(false);
    layout.addComponent(categoryListSelect);
    final Button removeItemButton = new Button("Kategorie löschen");
    layout.addComponent(removeItemButton);
    removeItemButton.addClickListener(
        new ClickListener() {

          @Override
          public void buttonClick(final ClickEvent event) {
            categoryListContainer.removeItem(categoryListSelect.getValue());
          }
        });
    // final ListSelect categoryList = new ListSelect("Kategorieen");
    // layout.addComponent(categoryList);

    final BeanItemContainer<DriverData> driverContainer =
        new BeanItemContainer<DriverData>(DriverData.class);

    final Table table = new Table("Fahrer");
    table.setContainerDataSource(driverContainer);
    table.removeContainerProperty("smallSheets");
    table.removeContainerProperty("startTimes");
    table.removeContainerProperty("category");
    table.addGeneratedColumn(
        "Kategorie",
        new ColumnGenerator() {

          @Override
          public Object generateCell(
              final Table source, final Object itemId, final Object columnId) {
            final ComboBox comboBox = new ComboBox();
            comboBox.setContainerDataSource(categoryListContainer);
            final DriverData driverData = (DriverData) itemId;
            final String category =
                driverData.getCategory() == null ? "" : driverData.getCategory();

            final ObjectProperty<String> property = new ObjectProperty<String>(category);
            comboBox.setPropertyDataSource(property);
            property.addValueChangeListener(
                new ValueChangeListener() {

                  @Override
                  public void valueChange(final ValueChangeEvent event) {
                    driverData.setCategory(property.getValue());
                  }
                });
            return comboBox;
          }
        });
    table.addGeneratedColumn(
        "Generieren",
        new ColumnGenerator() {

          @Override
          public Object generateCell(
              final Table source, final Object itemId, final Object columnId) {
            final DriverData driverData = (DriverData) itemId;
            final Button button = new Button("PDF");
            button.addClickListener(
                new ClickListener() {
                  @Override
                  public void buttonClick(final ClickEvent event) {
                    // showPdfHandler.showPdf(driverData.getName());
                  }
                });
            return button;
          }
        });
    table.addGeneratedColumn("Phase A Zettel", createPhaseCheckbox(Phase.A));
    table.addGeneratedColumn("Phase D Zettel", createPhaseCheckbox(Phase.D));
    table.addGeneratedColumn("Phase E Zettel", createPhaseCheckbox(Phase.E));
    final DurationFieldFactory fieldFactory = new DurationFieldFactory();
    table.addGeneratedColumn("Phase A Start", createPhaseStartInput(fieldFactory, Phase.A));
    table.addGeneratedColumn("Phase D Start", createPhaseStartInput(fieldFactory, Phase.D));
    table.addGeneratedColumn("Phase E Start", createPhaseStartInput(fieldFactory, Phase.E));
    table.addGeneratedColumn(
        "Fahrer Löschen",
        new ColumnGenerator() {

          @Override
          public Object generateCell(
              final Table source, final Object itemId, final Object columnId) {
            final Button button = new Button("-");
            button.addClickListener(
                new ClickListener() {

                  @Override
                  public void buttonClick(final ClickEvent event) {
                    driverContainer.removeItem(itemId);
                  }
                });
            return button;
          }
        });

    table.setEditable(true);
    table.setSortEnabled(false);
    // table.setNullSelectionAllowed(true);
    layout.addComponent(table);
    final Button addDriverButton = new Button("Neuer Fahrer");
    addDriverButton.addClickListener(
        new ClickListener() {

          @Override
          public void buttonClick(final ClickEvent event) {
            final DriverData driver = new DriverData();
            driver.setName("Fahrer - " + driverContainer.size());
            driverContainer.addBean(driver);
          }
        });
    layout.addComponent(addDriverButton);

    return new DataBinder<MarathonData>() {

      private MarathonData data;

      @Override
      public void bindData(final MarathonData data) {
        this.data = data;
        binder.setItemDataSource(data);
        categoryListContainer.removeAllItems();
        for (final String category : data.getCategories()) {
          categoryListContainer.addBean(category);
        }
        driverContainer.removeAllItems();
        for (final DriverData driver : data.getDrivers().values()) {
          driverContainer.addBean(driver);
        }
      }

      @Override
      public void commitHandler() {
        try {
          binder.commit();
          final List<String> categories = data.getCategories();
          categories.clear();
          categories.addAll(categoryListContainer.getItemIds());
          final Map<String, DriverData> drivers = data.getDrivers();
          drivers.clear();
          for (final DriverData driver : driverContainer.getItemIds()) {
            drivers.put(driver.getName(), driver);
          }
        } catch (final CommitException e) {
          throw new RuntimeException("Cannot commit", e);
        }
      }

      @Override
      public MarathonData getCurrentData() {
        return data;
      }
    };
  }
Exemple #24
0
  private DataBinder<MarathonData> showPhaseData(final FormLayout layout, final Phase phase) {
    layout.setMargin(true);
    final BeanFieldGroup<PhaseDataCompetition> binder =
        new BeanFieldGroup<PhaseDataCompetition>(PhaseDataCompetition.class);
    final DurationFieldFactory fieldFactory = new DurationFieldFactory();
    binder.setFieldFactory(fieldFactory);

    // layout.addComponent(binder.buildAndBind("geplante Startzeit", "startTime"));
    // layout.addComponent(binder.buildAndBind("Maximale Zeit", "maxTime"));
    // layout.addComponent(binder.buildAndBind("Minimale Zeit", "minTime"));
    layout.addComponent(binder.buildAndBind("Name der Phase", "phaseName"));
    layout.addComponent(binder.buildAndBind("Länge in m", "length"));
    // layout.addComponent(binder.buildAndBind("Geschwindigkeit im m/s", "velocity"));
    // layout.addComponent(binder.buildAndBind("Tabelle", "entries"));

    final BeanItemContainer<Entry<String, PhaseDataCategory>> categoryTimesItemContainer =
        new BeanItemContainer<Map.Entry<String, PhaseDataCategory>>(Map.Entry.class);
    final Table timesTable = new Table("Zeiten");
    timesTable.setContainerDataSource(categoryTimesItemContainer);
    timesTable.setHeight("8em");
    timesTable.removeContainerProperty("key");
    timesTable.removeContainerProperty("value");
    timesTable.addGeneratedColumn(
        "Kategorie",
        new ColumnGenerator() {

          @Override
          public Object generateCell(
              final Table source, final Object itemId, final Object columnId) {
            @SuppressWarnings("unchecked")
            final Entry<String, PhaseDataCategory> entry =
                (Entry<String, PhaseDataCategory>) itemId;
            return new Label(entry.getKey());
          }
        });
    timesTable.addGeneratedColumn(
        "Min. Zeit",
        new ColumnGenerator() {

          @Override
          public Object generateCell(
              final Table source, final Object itemId, final Object columnId) {
            @SuppressWarnings("unchecked")
            final Entry<String, PhaseDataCategory> entry =
                (Entry<String, PhaseDataCategory>) itemId;
            final TextField field = fieldFactory.createField(Duration.class, TextField.class);
            final PhaseDataCategory phaseDataCategory = entry.getValue();
            final ObjectProperty<Duration> property =
                new ObjectProperty<Duration>(
                    defaultIfNull(phaseDataCategory.getMinTime(), new Duration(0)));
            field.setPropertyDataSource(property);
            property.addValueChangeListener(
                new ValueChangeListener() {

                  @Override
                  public void valueChange(final ValueChangeEvent event) {
                    phaseDataCategory.setMinTime(property.getValue());
                  }
                });
            return field;
          }
        });
    timesTable.addGeneratedColumn(
        "Max. Zeit",
        new ColumnGenerator() {

          @Override
          public Object generateCell(
              final Table source, final Object itemId, final Object columnId) {
            @SuppressWarnings("unchecked")
            final Entry<String, PhaseDataCategory> entry =
                (Entry<String, PhaseDataCategory>) itemId;
            final TextField field = fieldFactory.createField(Duration.class, TextField.class);
            final PhaseDataCategory phaseDataCategory = entry.getValue();
            final ObjectProperty<Duration> property =
                new ObjectProperty<Duration>(
                    defaultIfNull(phaseDataCategory.getMaxTime(), new Duration(0)));
            field.setPropertyDataSource(property);
            property.addValueChangeListener(
                new ValueChangeListener() {

                  @Override
                  public void valueChange(final ValueChangeEvent event) {
                    phaseDataCategory.setMaxTime(property.getValue());
                  }
                });
            return field;
          }
        });
    timesTable.addGeneratedColumn(
        "Geschw.",
        new ColumnGenerator() {

          @Override
          public Object generateCell(
              final Table source, final Object itemId, final Object columnId) {
            @SuppressWarnings("unchecked")
            final Entry<String, PhaseDataCategory> entry =
                (Entry<String, PhaseDataCategory>) itemId;
            final PhaseDataCategory phaseDataCategory = entry.getValue();
            phaseDataCategory.getVelocity();
            final TextField field = fieldFactory.createField(Double.class, TextField.class);
            final ObjectProperty<Double> property =
                new ObjectProperty<Double>(
                    defaultIfNull(phaseDataCategory.getVelocity(), Double.valueOf(0)));
            field.setPropertyDataSource(property);
            property.addValueChangeListener(
                new ValueChangeListener() {

                  @Override
                  public void valueChange(final ValueChangeEvent event) {
                    phaseDataCategory.setVelocity(property.getValue());
                  }
                });
            return field;
          }
        });

    layout.addComponent(timesTable);

    final BeanItemContainer<TimeEntry> timeEntryItemContainer =
        new BeanItemContainer<TimeEntry>(TimeEntry.class);

    final Table table = new Table("Strecke");
    table.setContainerDataSource(timeEntryItemContainer);
    table.setEditable(true);
    table.setSortEnabled(false);
    table.setNullSelectionAllowed(true);
    layout.addComponent(table);
    table.setDragMode(TableDragMode.ROW);
    table.setDropHandler(
        new DropHandler() {

          @Override
          public void drop(final DragAndDropEvent dropEvent) {
            final DataBoundTransferable t = (DataBoundTransferable) dropEvent.getTransferable();
            final TimeEntry sourceItemId = (TimeEntry) t.getItemId(); // returns our Bean

            final AbstractSelectTargetDetails dropData =
                ((AbstractSelectTargetDetails) dropEvent.getTargetDetails());
            final TimeEntry targetItemId = (TimeEntry) dropData.getItemIdOver(); // returns our Bean

            // No move if source and target are the same, or there is no target
            if (sourceItemId == targetItemId || targetItemId == null) return;

            // Let's remove the source of the drag so we can add it back where requested...
            timeEntryItemContainer.removeItem(sourceItemId);

            if (dropData.getDropLocation() == VerticalDropLocation.BOTTOM) {
              timeEntryItemContainer.addItemAfter(targetItemId, sourceItemId);
            } else {
              final Object prevItemId = timeEntryItemContainer.prevItemId(targetItemId);
              timeEntryItemContainer.addItemAfter(prevItemId, sourceItemId);
            }
          }

          @Override
          public AcceptCriterion getAcceptCriterion() {
            return new SourceIs(table);
          }
        });
    table.addGeneratedColumn(
        "",
        new ColumnGenerator() {

          @Override
          public Object generateCell(
              final Table source, final Object itemId, final Object columnId) {
            final Button button = new Button("Löschen");
            button.addClickListener(
                new ClickListener() {
                  @Override
                  public void buttonClick(final ClickEvent event) {
                    source.getContainerDataSource().removeItem(itemId);
                  }
                });
            return button;
          }
        });
    final TableFieldFactory tableFieldFactory =
        new TableFieldFactory() {

          @Override
          public Field<?> createField(
              final Container container,
              final Object itemId,
              final Object propertyId,
              final Component uiContext) {
            final Class<?> type = container.getType(propertyId);
            final Field field = fieldFactory.createField(type, Field.class);
            if (field instanceof AbstractTextField) {
              final AbstractTextField abstractTextField = (AbstractTextField) field;
              abstractTextField.setNullRepresentation("");
              abstractTextField.setValidationVisible(true);
            }
            return field;
          }
        };
    table.setTableFieldFactory(tableFieldFactory);

    layout.addComponent(
        new Button(
            "Neuer Steckenpunkt",
            new ClickListener() {

              @Override
              public void buttonClick(final ClickEvent event) {
                timeEntryItemContainer.addBean(new TimeEntry());
              }
            }));

    final DataBinder<MarathonData> phaseDataBinder =
        new DataBinder<MarathonData>() {

          private MarathonData data;

          @Override
          public void bindData(final MarathonData phaseData) {
            this.data = phaseData;
            final PhaseDataCompetition dataCompetition = data.getCompetitionPhases().get(phase);
            binder.setItemDataSource(dataCompetition);
            timeEntryItemContainer.removeAllItems();
            timeEntryItemContainer.addAll(dataCompetition.getEntries());
            categoryTimesItemContainer.removeAllItems();
            final Map<String, PhaseDataCategory> categoryTimes = dataCompetition.getCategoryTimes();
            for (final String category : data.getCategories()) {
              if (!categoryTimes.containsKey(category)) {
                categoryTimes.put(category, new PhaseDataCategory());
              }
              categoryTimesItemContainer.addBean(
                  new Entry<String, PhaseDataCategory>() {

                    @Override
                    public String getKey() {
                      return category;
                    }

                    @Override
                    public PhaseDataCategory getValue() {
                      return categoryTimes.get(category);
                    }

                    @Override
                    public PhaseDataCategory setValue(final PhaseDataCategory value) {
                      return categoryTimes.put(category, value);
                    }
                  });
            }
          }

          @Override
          public void commitHandler() {
            try {
              binder.commit();
              final PhaseDataCompetition dataCompetition = data.getCompetitionPhases().get(phase);
              container2Model(timeEntryItemContainer, dataCompetition);
              for (final Entry<String, PhaseDataCategory> entry :
                  categoryTimesItemContainer.getItemIds()) {
                dataCompetition.getCategoryTimes().put(entry.getKey(), entry.getValue());
              }
            } catch (final CommitException e) {
              throw new RuntimeException("Cannot commit", e);
            }
          }

          @Override
          public MarathonData getCurrentData() {
            return data;
          }
        };
    layout.addComponent(
        new Button(
            "Reset Strecke",
            new ClickListener() {

              @Override
              public void buttonClick(final ClickEvent event) {
                phaseDataBinder.commitHandler();

                final PhaseDataCompetition phaseData =
                    phaseDataBinder.getCurrentData().getCompetitionPhases().get(phase);
                phaseData.setDefaultPoints();

                model2Container(phaseData, timeEntryItemContainer);
                System.out.println(phaseData);
              }
            }));
    return phaseDataBinder;
  }
Exemple #25
0
  protected Component createMainArea() {
    layout = new VerticalLayout();

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

    HorizontalLayout filterLine = new HorizontalLayout();

    TextField filterBox = new TextField();
    filterBox.addStyleName(JabylonStyle.SEARCH_FIELD.getCSSName());
    filterBox.addListener(
        new TextChangeListener() {

          @Override
          public void textChange(TextChangeEvent event) {
            propertyFilter.setFilterText(event.getText());
            propertyPairContainer.addContainerFilter(propertyFilter);
          }
        });
    filterBox.setInputPrompt(
        Messages.getString("PropertiesEditor_FILTER_INPUT_PROMPT")); // $NON-NLS-1$
    filterLine.addComponent(filterBox);

    final CheckBox untranslatedBox =
        new CheckBox(
            Messages.getString(
                "PropertiesEditor_SHOW_ONLY_UNTRANSLATED_BUTTON_CAPTION")); //$NON-NLS-1$
    untranslatedBox.addListener(
        new ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            propertyPairContainer.removeContainerFilter(untranslatedFilter);
            if (untranslatedBox.getValue().equals(Boolean.TRUE))
              propertyPairContainer.addContainerFilter(untranslatedFilter);
          }
        });
    untranslatedBox.setImmediate(true);
    filterLine.addComponent(untranslatedBox);

    layout.addComponent(filterLine);
    layout.setExpandRatio(filterLine, 0);

    table = new Table();
    table.addStyleName(JabylonStyle.TABLE_STRIPED.getCSSName());
    table.setSizeFull();
    target = descriptor.loadProperties();
    source = descriptor.getMaster().loadProperties();

    propertyPairContainer = new PropertyPairContainer(source, target);
    table.setContainerDataSource(propertyPairContainer);
    table.setVisibleColumns(
        propertyPairContainer.getContainerPropertyIds().subList(0, 2).toArray());
    table.setWidth(100, Table.UNITS_PERCENTAGE);
    table.addGeneratedColumn(
        Messages.getString("PropertiesEditor_PROBLEMS_COLUMN_HEADER"),
        new ColumnGenerator() { //$NON-NLS-1$

          @Override
          public Object generateCell(Table source, Object itemId, Object columnId) {

            if (reviews.containsKey(itemId)) {
              Embedded embedded = new Embedded("", ImageConstants.IMAGE_ERROR); // $NON-NLS-1$

              Review review = reviews.get((String) itemId).iterator().next();
              // TODO: this can't be the right way to refresh?
              if (review.cdoInvalid()) {
                reviews.remove(itemId, review); // the review is
                // no
                // longer valid
                embedded.setIcon(ImageConstants.IMAGE_OK);
                embedded.setDescription(""); // $NON-NLS-1$
              } else {
                embedded.setDescription(review.getMessage());
              }

              return embedded;
            } else return new Embedded("", ImageConstants.IMAGE_OK); // $NON-NLS-1$
          }
        });

    table.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_EXPLICIT);

    table.setColumnHeaders(
        new String[] {
          Messages.getString("PropertiesEditor_ORIGINAL_COLUMN_HEADER"),
          Messages.getString("PropertiesEditor_TRANSLATED_COLUMN_HEADER"),
          Messages.getString("PropertiesEditor_PROBLEMS_COLUMN_HEADER")
        }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    table.setColumnExpandRatio(propertyPairContainer.getContainerPropertyIds().get(0), 1.0f);
    table.setColumnExpandRatio(propertyPairContainer.getContainerPropertyIds().get(1), 1.0f);
    table.setColumnExpandRatio(
        Messages.getString("PropertiesEditor_PROBLEMS_COLUMN_HEADER"), 0.0f); // $NON-NLS-1$

    table.setEditable(false);
    table.setWriteThrough(false);

    table.setSelectable(true);
    table.setMultiSelect(false);
    table.setImmediate(true); // react at once when something is selected
    table.addListener(this);

    layout.addComponent(table);

    layout.setExpandRatio(table, 2);
    createEditorArea();
    return layout;
  }
Exemple #26
0
  private Panel allLinksDetails() {
    // positioning indices
    // final int leftStart=10,topStart=10, space=100;
    // create the panel that will hold all components
    Panel linksDetails = new Panel("Links Details");
    // set panel's properties
    linksDetails.setWidth("100%");
    linksDetails.setHeight("100%");

    // Create absolute layout specifying its properties
    final AbsoluteLayout layout = new AbsoluteLayout();
    // set layout's properties
    layout.setSizeFull();

    // Create components Objects and specify their properties
    Button btnLoad = new Button("Load task");
    // final Table tblSourceDestination = new Table("Source and Destination URIs");
    tblSourceDestination.setSelectable(true);
    tblSourceDestination.setWidth("90%");
    // fill the Source and Destination URIs table
    SQLContainer container = connectToDB("root", "mofo", userName);
    Notification.show("Welcome " + userName + " you loaded task Nr.: " + task);
    Compare.Equal suburbFilter = new Compare.Equal("taskId", Integer.valueOf(task));
    container.addContainerFilter(suburbFilter);
    // Fill the main (tblSourceDestination) table with resources
    tblSourceDestination.setContainerDataSource(container);
    tblSourceDestinationparam = tblSourceDestination;

    // add component to the layout specifying its position on the layout
    int tableWidth = (int) tblSourceDestination.getWidth();
    layout.addComponent(btnLoad, "left:1500px; top: 10px;");
    layout.addComponent(tblSourceDestination, "left: 10px; top: 20px;");

    linksDetails.setContent(layout);
    // Add EventHandlers for some of the components

    btnLoad.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            // lStartTime= System.currentTimeMillis();

            try {
              Object rowId = tblSourceDestination.getValue();
              Property sourceProperty =
                  tblSourceDestination.getContainerProperty(rowId, "sourceURI");
              Property destinationProperty =
                  tblSourceDestination.getContainerProperty(rowId, "destinationURI");

              source.setValue(sourceProperty.toString());
              destination.setValue(destinationProperty.toString());
              tblSourcePropertiesParam.removeAllItems();
              tblDestinationPropertiesParam.removeAllItems();

              Notification loadURI = new Notification("");
              loadURI.show("Links' URIs are successfully loaded ");
            } catch (Exception e) {
              Notification error = new Notification("Error");
              error.show("You did not select an item in the links table");
            }
          }
        });

    tblSourceDestination.addItemClickListener(
        new ItemClickEvent.ItemClickListener() {

          @Override
          public void itemClick(ItemClickEvent event) {
            /*lStartTime= System.currentTimeMillis();

            try
            {
            	Object rowId =tblSourceDestination.getValue();
                Property sourceProperty=tblSourceDestination.getContainerProperty(rowId,"sourceURI");
                Property destinationProperty=tblSourceDestination.getContainerProperty(rowId,"destinationURI");

                source.setValue(sourceProperty.toString());
                destination.setValue(destinationProperty.toString());
                tblSourcePropertiesParam.removeAllItems();
                tblDestinationPropertiesParam.removeAllItems();


                Notification loadURI= new Notification("");
                loadURI.show("Links' URIs are successfully loaded ");
            }
            catch(Exception e)
            {
            	Notification error= new Notification("Error");
            	error.show("You did not select an item in the links table");
            }*/
          }
        });

    return linksDetails;
  }
  @Override
  public void execute() {
    List<ChangeRecord> historyList = view.getUi().getStockService().findChanges(good);
    Window subWindow = new Window();
    subWindow.setModal(true);
    subWindow.setHeight("650px");
    subWindow.setWidth("700px");
    subWindow.setClosable(true);
    view.getUi().addWindow(subWindow);

    final Button pdfButton = new Button(bundle.getString("pdf.export"));
    pdfButton.setIcon(new ThemeResource("img/pdf.png"));
    pdfButton.setWidth("150");
    StreamResource pdfStream = getPDFStream(view.getUi().getStockService().findChanges(good));
    pdfStream.setMIMEType("application/pdf");
    FileDownloader pdfDownloader = new FileDownloader(pdfStream);
    pdfDownloader.extend(pdfButton);

    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.addComponent(pdfButton);

    for (ChangeRecord record : historyList) {
      for (ChangeRecord.PropertyChange p : record.getChangeList()) {
        p.setName(bundle.getString(p.getName()));
      }
      Panel panel = new Panel();
      BeanItemContainer<ChangeRecord.PropertyChange> container =
          new BeanItemContainer<>(ChangeRecord.PropertyChange.class, record.getChangeList());
      Table table = new Table();
      table.setContainerDataSource(container);
      table.setVisibleColumns("name", "oldValue", "newValue");
      table.setColumnHeaders(
          bundle.getString("history.property"),
          bundle.getString("history.old"),
          bundle.getString("history.new"));
      table.setColumnExpandRatio("name", 0.33f);
      table.setColumnExpandRatio("oldValue", 0.33f);
      table.setColumnExpandRatio("newValue", 0.33f);
      table.setPageLength(0);
      table.setWidth("100%");

      VerticalLayout panelLayout = new VerticalLayout();
      panelLayout.addComponent(
          new Label(
              "<b>"
                  + new SimpleDateFormat("dd-MM-YYYY HH:mm").format(record.getDate())
                  + ": "
                  + record.getUser().getName()
                  + " "
                  + record.getUser().getSurname()
                  + "</b><br/>",
              ContentMode.HTML));
      panelLayout.addComponent(table);
      panel.setContent(panelLayout);
      layout.addComponent(panel);
    }

    subWindow.setContent(layout);
  }