예제 #1
0
 public void handleError(ApplicationError e) {
   List msg = e.getMsg();
   if (msg != null) {
     new MessageDlg(msg, JOptionPane.ERROR_MESSAGE);
     Err.alarm(msg.get(0).toString());
   } else {
     Print.prThrowable(e, "Auto-generated handler");
   }
 }
예제 #2
0
 public AbstractTableItemAdapter getAdapter(int columnIndex) {
   AbstractTableItemAdapter result = null;
   if (columnIndex != -1) {
     ItemAdapter ad = (ItemAdapter) flatColumns.get(columnIndex);
     if (!(ad
         instanceof
         AbstractTableItemAdapter)) { // Err.error( "Got a " + ad.getClass().getName() + " for " +
                                      // ad.getDOFieldName());
     } else {
       result = (AbstractTableItemAdapter) ad;
     }
   }
   /**/
   else {
     Print.pr("ERROR, Could not get an Adapter as columnIndex is -1");
   }
   /**/
   return result;
 }
예제 #3
0
 /** Setup data so will give a full roster no matter which month, no matter what time */
 private void populateFromDemoData() {
   SdzEntityManagerI pm = dataStore.getEM();
   pm.registerPersistentAll(demoDataCayenne.newWorkers);
   pm.registerPersistentAll(demoDataCayenne.newBMs);
   pm.registerPersistentAll(demoDataCayenne.newRSs);
   pm.registerPersistentAll(demoDataCayenne.newUsers);
   pm.registerPersistentAll(
       demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_DAY_IN_WEEK));
   pm.registerPersistentAll(
       demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_FLEXIBILITY));
   pm.registerPersistentAll(
       demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_MONTH_IN_YEAR));
   pm.registerPersistentAll(
       demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_INTERVAL));
   pm.registerPersistentAll(
       demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_FLEXIBILITY));
   pm.registerPersistentAll(
       demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_SENIORITY));
   pm.registerPersistentAll(demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_SEX));
   pm.registerPersistentAll(
       demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_WEEK_IN_MONTH));
   pm.registerPersistentAll(
       demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_WHICH_SHIFT));
   Err.pr(
       "Population complete, have added "
           + demoDataCayenne.newWorkers.size()
           + " Workers and "
           + demoDataCayenne.newRSs.size()
           + " RosterSlots and "
           + demoDataCayenne.newUsers.size()
           + " UserDetails and "
           + demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_SENIORITY).size()
           + " Seniorities and "
           + demoDataCayenne.newBMs.size()
           + " BuddyManagers to the database");
   Print.prList(
       demoDataCayenne.wombatLookups.get(WombatDomainLookupEnum.ALL_SENIORITY), "seniorities");
 }
예제 #4
0
  public Object getValueAt(int row, int col) {
    Object result = null;
    if (row < getRowCount()) {
      pr("{{ row " + row + " is less than getRowCount() " + getRowCount(), true);
      if (!TableSignatures.useNew(getTableControl())
          && row == applyInsertModeForCursor(block.getIndex())) {
        pr(
            "{{ for row "
                + row
                + " col "
                + col
                + ", getting from special insert buffer, actual index is "
                + block.getIndex(),
            true);
        TableIdEnum id = IdEnum.newTable(getTableControl(), row, col, getColumnClass(col), null);
        result = TableSignatures.getText(id);
      } else {
        pr("{{ for row " + row + " col " + col + ", getting directly from database table", true);
        fillFlat(applyInsertModeForAllOtherRows(row));

        AbstractTableItemAdapter ta = null;
        if (!doingNonVisual()) {
          ta = (AbstractTableItemAdapter) flatColumns.get(col);
          if (ta.getTableControl().getClass() == TableComp.class) {
            Err.error("Expected a Visual table, got " + ta.getTableControl().getClass().getName());
          }
        } else {
          ta = (AbstractTableItemAdapter) nvFlatColumns.get(getNonVisualOrdinal());
          if (ta.getTableControl().getClass() != TableComp.class) {
            Err.error(
                "Expected a Non-Visual table, got " + ta.getTableControl().getClass().getName());
          }
        }
        pr("Getting database table value from DoAdapter() id " + ta.getDoAdapter().id, true);
        Object obj = ta.getStoredFlatObject();
        pr("StoredFlatObject: " + obj, true);
        if (obj != null) {
          pr("\tis of type " + obj.getClass().getName(), true);
        }
        result = ta.getDoAdapter().getFieldValue(obj);
      }
      if (!doingNonVisual() && nvTables != null) {
        if (row != lastRowPainted) {
          int i = 0;
          for (Iterator iterator = nvTables.iterator(); iterator.hasNext(); i++) {
            TableComp tableComp = (TableComp) iterator.next();
            setNonVisualOrdinal(i);
            tableComp.getModel().getValueAt(row, 0);
            setNonVisualOrdinal(VISUAL_MODE);
          }
          lastRowPainted = row;
        }
      }
    } else {
      Print.pr("Want row " + row);
      Print.pr("Row count is " + getRowCount());
      Err.error("Table asking for a row that's not there: <" + row + "> for block " + block);
    }
    if (result != null) {
      pr(
          "Value at "
              + col
              + ", "
              + row
              + " is "
              + result
              + " of type "
              + result.getClass().getName()
              + " from ID:"
              + id);
    }
    return result;
  }
예제 #5
0
 public StartupMemoryDemo() {
   Print.pr("In StartupMemoryDemo (usually called from Java Web Start)");
   init();
   dataStoreFactory.addConnection(SuperSixConnectionEnum.SUPERSIX_DEMO_MEMORY);
   SuperSixManagerUtils.setDataStore(dataStoreFactory.getDataStore());
 }