Ejemplo n.º 1
0
  public EmployeeEditor(GemDesktop desktop, ActionListener listener) {
    super(desktop);
    service = new BasicEmployeeService(dc);
    view = new EmployeeView(service, dataCache);

    this.setLayout(new BorderLayout());
    JScrollPane scroll = new JScrollPane(view);
    add(scroll, BorderLayout.CENTER);
    GemButton deleteBt = new GemButton(GemCommand.DELETE_CMD);
    deleteBt.setActionCommand("EmployeeDelete");
    deleteBt.addActionListener(listener);
    add(deleteBt, BorderLayout.SOUTH);
  }
Ejemplo n.º 2
0
 public InfoView(String label, boolean border) {
   rows = new ArrayList<InfoPanel>();
   setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
   GemPanel header = new GemPanel();
   if (border) {
     setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
   }
   header.setLayout(new BoxLayout(header, BoxLayout.X_AXIS));
   header.add(new JLabel(label));
   header.add(Box.createHorizontalGlue());
   btAdd = new GemButton("+");
   btAdd.setToolTipText(MessageUtil.getMessage("add.entry"));
   btAdd.setMargin(new Insets(0, 4, 0, 4)); // reduction de la taille du bouton
   btAdd.addActionListener(this);
   header.add(btAdd);
   add(header);
 }
Ejemplo n.º 3
0
 protected void setEditable(boolean b) {
   btAdd.setEnabled(b);
 }
Ejemplo n.º 4
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);
  }
Ejemplo n.º 5
0
 @Override
 public void addActionListener(ActionListener l) {
   super.addActionListener(l);
   btClose.addActionListener(l);
 }