Пример #1
0
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   dc = TestProperties.getDataConnection();
   dataCache = TestProperties.getDataCache(dc);
   dataCache.load(null);
   desktop = new GemDesktopCtrl(new JFrame(), dataCache, new Properties());
   memberService = new MemberService(dc);
   plmCtrl = new PlanModifCtrl(desktop);
   toDay = new Date();
   Calendar cal = Calendar.getInstance();
   cal.setTime(toDay);
   cal.add(Calendar.MONTH, -5);
   before = new DateFr(cal.getTime());
   io = new PersonSubscriptionCardIO(dc);
 }
Пример #2
0
  public MemberFollowUpEditor(GemDesktop desktop, PersonFile pf) {
    super(desktop);
    memberService = new MemberService(DataCache.getDataConnection());
    personFile = pf;

    tableModel = new ScheduleRangeTableModel(dataCache);
    table = new JTable(tableModel);
    table.setAutoCreateRowSorter(true);

    table.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            if (table.getSelectedRow() < 0) {
              return;
            }
            int n = table.convertRowIndexToModel(table.getSelectedRow());
            if (e.getClickCount() == 2) {
              try {
                modification(n);
              } catch (SQLException sqe) {
                GemLogger.log(sqe.getMessage());
              } catch (PlanningException pe) {
                GemLogger.log(pe.getMessage());
              }
            }
          }
        });
    roomFilter =
        new RowFilter<Object, Object>() {

          @Override
          public boolean include(Entry<? extends Object, ? extends Object> entry) {
            String r = (String) entry.getValue(4);
            return !r.matches(Room.CATCHING_UP_REGEX);
          }
        };
    TableColumnModel cm = table.getColumnModel();
    cm.getColumn(0).setPreferredWidth(50);
    cm.getColumn(1).setPreferredWidth(15);
    cm.getColumn(2).setPreferredWidth(15);
    cm.getColumn(3).setPreferredWidth(100);
    cm.getColumn(4).setPreferredWidth(40);
    cm.getColumn(5).setPreferredWidth(60);
    cm.getColumn(6).setPreferredWidth(15);
    cm.getColumn(7).setPreferredWidth(160);
    cm.getColumn(8).setPreferredWidth(150);

    JScrollPane scroll = new JScrollPane(table);
    initPrintTable();
    initPrintDialog();

    btModify = new GemButton(GemCommand.VIEW_EDIT_CMD); // consulter/modifier
    btDelete = new GemButton(GemCommand.DELETE_CMD);
    btLoad = new GemButton(GemCommand.LOAD_CMD);
    btPrint = new GemButton(GemCommand.PRINT_CMD);
    btModify.addActionListener(this);
    btDelete.addActionListener(this);
    btLoad.addActionListener(this);
    btPrint.addActionListener(this);

    GemPanel datesPanel = new GemPanel();
    dates = new DateRangePanel();
    dates.setStart(dataCache.getStartOfYear());
    dates.setEnd(new Date()); // now by default
    totalTime = new GemLabel();
    GemPanel timePanel = new GemPanel();

    datesPanel.add(new GemLabel(BundleUtil.getLabel("Total.label") + " :"));
    datesPanel.add(totalTime);
    datesPanel.add(dates);
    datesPanel.add(btLoad);
    datesPanel.add(btPrint);

    GemPanel pDates = new GemPanel(new BorderLayout());
    pDates.add(datesPanel, BorderLayout.CENTER);
    pDates.add(timePanel, BorderLayout.SOUTH);

    GemPanel mainPanel = new GemPanel(new BorderLayout());
    mainPanel.add(scroll, BorderLayout.CENTER);
    mainPanel.add(pDates, BorderLayout.SOUTH);

    GemPanel buttons = new GemPanel(new GridLayout(1, 2));
    buttons.add(btModify);
    buttons.add(btDelete);

    setLayout(new BorderLayout());
    add(mainPanel, BorderLayout.CENTER);
    add(buttons, BorderLayout.SOUTH);
  }