public ChooseDocFlowStageDialog() {
   stagesList =
       new DefaultTableController(
           new DefaultEntityListTableModel<StageAction>() {
             @Override
             protected void doLoad() {
               setEntityList(
                   MiscUtils.convertUncheckedList(
                       StageAction.class, OrmTemplate.getInstance().find(LOAD_STAGES_EJBQL)),
                   fieldList);
             }
           });
   stagesList.getModel().load();
 }
 public WeekCalendarSearchForm() {
   weekCalendarList =
       new DefaultTableController(
           new DefaultEntityListTableModel<WeekCalendar>() {
             @Override
             protected void doLoad() {
               setEntityList(
                   MiscUtils.convertUncheckedList(
                       WeekCalendar.class,
                       OrmTemplate.getInstance().find(LOAD_DAY_CALENDAR_EJBQL)),
                   fieldList);
             }
           });
   weekCalendarList.getModel().load();
 }
 /* (non-Javadoc)
  * @see com.mg.framework.generic.ui.AbstractSearchForm#getSearchedEntities()
  */
 @Override
 protected PersistentObject[] getSearchedEntities() {
   return ((DefaultEntityListTableModel<?>) weekCalendarList.getModel()).getSelectedEntities();
 }
 public Contractor getSelectedCustomer() {
   return ((CustomerSelectTableModel) table.getModel()).getSelectedCustomer();
 }
 public void executeDlg(List<CustomerSelectTableModelItem> tableModelItems) {
   ((CustomerSelectTableModel) table.getModel()).setTableList(tableModelItems);
   this.execute();
 }
 /**
  * запуск формы
  *
  * @param job ЗНП
  */
 public void execute(Job job) {
   this.job = job;
   jobRoutes.getModel().load();
   run(UIUtils.isModalMode());
 }
 public StageAction getStageAction() {
   return ((DefaultEntityListTableModel<StageAction>) stagesList.getModel())
       .getSelectedEntities()[0];
 }
  /* (non-Javadoc)
   * @see com.mg.framework.generic.ui.AbstractSearchForm#doOnRun()
   */
  @Override
  protected void doOnRun() {

    table =
        new DefaultTableController(
            new DefaultEJBQLTableModel() {

              /* (non-Javadoc)
               * @see com.mg.framework.generic.ui.DefaultEJBQLTableModel#getDefaultFieldDefsSet()
               */
              @Override
              protected Set<TableEJBQLFieldDef> getDefaultFieldDefsSet() {
                Set<TableEJBQLFieldDef> result = super.getDefaultFieldDefsSet();
                result.add(
                    new TableEJBQLFieldDef(
                        PositionFill.class, "Id", "pf.Id", true)); // $NON-NLS-1$ //$NON-NLS-2$
                result.add(
                    new TableEJBQLFieldDef(
                        PositionFill.class,
                        "SlPositionUnique",
                        "pf.SlPositionUnique",
                        false)); //$NON-NLS-1$ //$NON-NLS-2$
                result.add(
                    new TableEJBQLFieldDef(
                        PositionFill.class,
                        "Position",
                        "p.Name",
                        "left join pf.Position as p",
                        false)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                result.add(
                    new TableEJBQLFieldDef(
                        PositionFill.class,
                        "PositionFillKind",
                        "pfk.KCode",
                        "left join pf.PositionFillKind as pfk",
                        false)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                result.add(
                    new TableEJBQLFieldDef(
                        PositionFill.class,
                        "BeginDate",
                        "pf.BeginDate",
                        false)); //$NON-NLS-1$ //$NON-NLS-2$
                result.add(
                    new TableEJBQLFieldDef(
                        PositionFill.class,
                        "EndDate",
                        "pf.EndDate",
                        false)); //$NON-NLS-1$ //$NON-NLS-2$
                result.add(
                    new TableEJBQLFieldDef(
                        PositionFill.class,
                        "RateNumber",
                        "pf.RateNumber",
                        false)); //$NON-NLS-1$ //$NON-NLS-2$
                result.add(
                    new TableEJBQLFieldDef(
                        PositionFill.class,
                        "IsBasic",
                        "pf.IsBasic",
                        false)); //$NON-NLS-1$ //$NON-NLS-2$
                return DatabaseUtils.embedAddinFieldsDefaultEJBQLFieldDefs(result, null);
              }

              /* (non-Javadoc)
               * @see com.mg.framework.generic.ui.AbstractTableModel#doLoad()
               */
              @Override
              protected void doLoad() {
                setQuery(
                    createQueryText(),
                    paramsName.toArray(new String[paramsName.size()]),
                    paramsValue.toArray(new Object[paramsValue.size()]));
              }

              private String createQueryText() {
                Set<TableEJBQLFieldDef> fieldDefs =
                    ((DefaultEJBQLTableModel) table.getModel()).getFieldDefsSet();
                String fieldsList = DatabaseUtils.generateEJBQLSelectClause(fieldDefs);
                String fromList = DatabaseUtils.generateEJBQLFromClause(fieldDefs);
                return String.format(INIT_QUERY_TEXT, fieldsList, fromList);
              }

              /* (non-Javadoc)
               * @see com.mg.framework.generic.ui.DefaultEJBQLTableModel#setSelectedRows(int[])
               */
              @Override
              public void setSelectedRows(int[] rows) {
                if (rows.length == 0) selectedId = null;
                else {
                  Object[] row = getRowList().get(rows[0]);
                  selectedId = (Integer) row[0];
                }
              }
            });
    super.doOnRun();
    table.getModel().load();
  }
Beispiel #9
0
 private void refreshRights() {
   grantsTable.getModel().load();
 }