Beispiel #1
0
  @Override
  public void doAfterCompose(Div comp) throws Exception {
    super.doAfterCompose(comp);

    List<Product> prods = DAOs.getProductDAO().findAll();

    ListModelList<Product> prodModel = new ListModelList<Product>(prods);
    prodGrid.setModel(prodModel);
  }
  private void initModel() {
    // Available events
    // It is just for showing message, event is always listened in this demo.
    eventFilterModel.setMultiple(true);

    addEventFilter(Events.ON_START_EDITING, true);
    addEventFilter(Events.ON_EDITBOX_EDITING, true);
    addEventFilter(Events.ON_STOP_EDITING, true);
    addEventFilter(Events.ON_AFTER_CELL_CHANGE, true);

    addEventFilter(Events.ON_CTRL_KEY, true);

    addEventFilter(Events.ON_CELL_CLICK, false);
    addEventFilter(Events.ON_CELL_DOUBLE_CLICK, true);
    addEventFilter(Events.ON_CELL_RIGHT_CLICK, true);

    addEventFilter(Events.ON_HEADER_UPDATE, true);
    addEventFilter(Events.ON_HEADER_CLICK, true);
    addEventFilter(Events.ON_HEADER_RIGHT_CLICK, true);
    addEventFilter(Events.ON_HEADER_DOUBLE_CLICK, true);

    addEventFilter(Events.ON_AUX_ACTION, true);

    addEventFilter(Events.ON_CELL_FOUCS, false);
    addEventFilter(Events.ON_CELL_SELECTION, false);
    addEventFilter(Events.ON_CELL_SELECTION_UPDATE, true);

    addEventFilter(Events.ON_CELL_FILTER, true); // useless
    addEventFilter(Events.ON_CELL_VALIDATOR, true); // useless

    addEventFilter(Events.ON_WIDGET_UPDATE, true);
    addEventFilter(Events.ON_WIDGET_CTRL_KEY, true);

    addEventFilter(Events.ON_AFTER_SHEET_CREATE, true);
    addEventFilter(Events.ON_AFTER_SHEET_DELETE, true);
    addEventFilter(Events.ON_AFTER_SHEET_NAME_CHANGE, true);
    addEventFilter(Events.ON_AFTER_SHEET_ORDER_CHANGE, true);
    addEventFilter(Events.ON_SHEET_SELECT, true);

    addEventFilter(Events.ON_CELL_HYPERLINK, true);

    eventFilterList.setModel(eventFilterModel);

    // add default show only
    infoList.setModel(infoModel);
    addInfo("Spreadsheet initialized");

    // hint for special cells
    // D1
    Ranges.range(ss.getSelectedSheet(), 0, 3).setCellEditText("Edit Me");
    // E1
    Ranges.range(ss.getSelectedSheet(), 0, 4).setCellEditText("Edit Me");
    // D3
    Ranges.range(ss.getSelectedSheet(), 2, 3).setCellEditText("Edit Me");
    // E3
    Ranges.range(ss.getSelectedSheet(), 2, 4).setCellEditText("Edit Me");
  }
Beispiel #3
0
  public void doAfterCompose(Component comp) throws Exception {
    super.doAfterCompose(comp);
    Session session =
        ServiceLocator.getNeracaDenormalHome().getSessionFactory().getCurrentSession();

    session.beginTransaction();

    List<hibernate.homendomain.NeracaDenormal> dnhbm =
        session.createQuery("from hibernate.homendomain.NeracaDenormal").list();

    session.getTransaction().commit();
    //		System.out.println(ServiceLocator.getNeracaDenormalHome().findById(1));
    final Component parent = comp;
    List<NeracaDenormal> l = new ArrayList<NeracaDenormal>();
    for (hibernate.homendomain.NeracaDenormal dnn : dnhbm) {
      l.add(
          new NeracaDenormal(
              dnn.getDaerah(),
              dnn.getTahun(),
              dnn.getLaporan(),
              dnn.getId0(),
              dnn.getId1(),
              dnn.getId2(),
              dnn.getId3(),
              dnn.getId4(),
              dnn.getUraian(),
              dnn.getRupiah(),
              dnn.getTipeInput()));
    }
    //		l.addAll(NeracaDao.getNeracas());
    final List<Integer> idxParentAdd = Arrays.asList(2, 6, 11, 15);
    final List<Integer> idxLastDetail = Arrays.asList(4, 8, 13, 17);
    final ListModelList<NeracaDenormal> listModel = new ListModelList<NeracaDenormal>(l);
    grid1.setModel(listModel);
    NeracaRowRenderer nrr =
        new NeracaRowRenderer(listModel, grid1, idxParentAdd, idxLastDetail, btnSave);
    grid1.setRowRenderer(nrr);
  }
    private Grid appendGridItems(Row row, TaskQualityForm taskQualityForm) {
        Grid gridItems = new Grid();

        gridItems.setMold("paging");
        gridItems.setPageSize(5);
        gridItems.setFixedLayout(true);

        renderColumns(gridItems);

        gridItems.setRowRenderer(getTaskQualityFormItemsRowRenderer());
        gridItems.setModel(new SimpleListModel(taskQualityForm
                .getTaskQualityFormItems().toArray()));

        return gridItems;
    }