Ejemplo n.º 1
0
  @Override
  public GemPanel init() {
    number = new GemNumericField(6);
    number.addActionListener(this);
    name = new GemField(15);
    name.addActionListener(this);
    style = new GemField(15);
    style.addActionListener(this);
    site = new GemField(15);
    site.addActionListener(this);

    btErase = new GemButton(GemCommand.ERASE_CMD);
    btErase.addActionListener(this);

    mask = new GemPanel();
    mask.setLayout(new GridBagLayout());

    GridBagHelper gb = new GridBagHelper(mask);
    gb.add(new GemLabel(BundleUtil.getLabel("Number.label")), 0, 0, 1, 1, GridBagHelper.WEST);
    gb.add(new GemLabel(BundleUtil.getLabel("Name.label")), 0, 1, 1, 1, GridBagHelper.WEST);
    gb.add(new GemLabel(BundleUtil.getLabel("Style.label")), 0, 2, 1, 1, GridBagHelper.WEST);
    gb.add(new GemLabel(BundleUtil.getLabel("Website.label")), 0, 3, 1, 1, GridBagHelper.WEST);

    gb.add(number, 1, 0, 1, 1, GridBagHelper.WEST);
    gb.add(name, 1, 1, 1, 1, GridBagHelper.WEST);
    gb.add(style, 1, 2, 1, 1, GridBagHelper.WEST);
    gb.add(site, 1, 3, 1, 1, GridBagHelper.WEST);

    gb.add(btErase, 2, 4, 1, 1, GridBagHelper.WEST);

    return mask;
  }
Ejemplo n.º 2
0
  public MemberRehearsalView(GemList<Room> roomList) {

    memberField = new GemField(35);
    memberField.setEditable(false);
    datePanel = new DateRangePanel(DateRangePanel.SIMPLE_DATE, null);
    hourPanel = new HourRangePanel(3 * 60);
    roomChoice = new RoomChoice(roomList);
    withCard = new JCheckBox(BundleUtil.getLabel("Subscription.label"));
    withCard.setBorder(null);
    this.setLayout(new GridBagLayout());
    GridBagHelper gb = new GridBagHelper(this);

    gb.add(new GemLabel(BundleUtil.getLabel("Member.label")), 0, 0, 1, 1, GridBagHelper.WEST);
    gb.add(new GemLabel(BundleUtil.getLabel("Date.label")), 0, 1, 1, 1, GridBagHelper.WEST);
    gb.add(new GemLabel(BundleUtil.getLabel("Hour.label")), 0, 2, 1, 1, GridBagHelper.WEST);
    gb.add(new GemLabel(BundleUtil.getLabel("Room.label")), 0, 3, 1, 1, GridBagHelper.WEST);
    // gb.add(new GemLabel(BundleUtil.getLabel("Subscription.label")), 0, 4, 1, 1,
    // GridBagHelper.EAST);

    gb.add(memberField, 1, 0, 1, 1, GridBagHelper.WEST);
    gb.add(datePanel, 1, 1, 1, 1, GridBagHelper.WEST);
    gb.add(hourPanel, 1, 2, 1, 1, GridBagHelper.WEST);
    gb.add(roomChoice, 1, 3, 1, 1, GridBagHelper.WEST);
    gb.add(withCard, 1, 4, 1, 1, GridBagHelper.WEST);
  }
Ejemplo n.º 3
0
 public void send(String _to, String bcc) {
   URI uriMailto = null;
   String to = _to;
   String mailClient = BundleUtil.getLabel("Mail.client");
   assert (mailClient != null);
   if (isMailSupported()
       && !mailClient.equalsIgnoreCase(
           "kmail")) { // XXX bug KDE retourne true pour Action.MAIL mais ne fonctionne pas
     try {
       if (to.length() > 0) {
         if (bcc != null && bcc.length() > 0) {
           to += "?bcc=" + bcc;
         }
         uriMailto = new URI("mailto", to, null);
         getDesktop().mail(uriMailto);
       } else {
         getDesktop().mail();
       }
     } catch (IOException ioe) {
       GemLogger.log(Level.WARNING, getClass().getName(), "send", ioe.getMessage());
       executeMailClient(_to, bcc);
     } catch (URISyntaxException use) {
       GemLogger.logException(use);
     }
   } else {
     // utiliser le runtime
     GemLogger.log("Desktop.Action.MAIL not supported");
     executeMailClient(to, bcc);
   }
 }
Ejemplo n.º 4
0
 private void executeMailClient(String to, String bcc) {
   try {
     String mailClient = BundleUtil.getLabel("Mail.client");
     Runtime.getRuntime().exec(mailClient + " " + formatMailto(to, bcc, mailClient));
   } catch (IOException e) {
     GemLogger.logException(e);
   }
 }
Ejemplo n.º 5
0
 private void executeMailClient(String mailto) {
   try {
     String mailClient = BundleUtil.getLabel("Mail.client");
     Runtime.getRuntime().exec(new String[] {mailClient, mailto});
   } catch (Exception e) {
     GemLogger.logException(e);
   }
 }
Ejemplo n.º 6
0
 private void executeMailClient() {
   try {
     String mailClient = BundleUtil.getLabel("Mail.client");
     Runtime.getRuntime().exec(mailClient);
   } catch (IOException e) {
     GemLogger.logException(e);
   }
 }
Ejemplo n.º 7
0
 @Override
 public GemPanel getCriterion() {
   pCriterion = new GemPanel();
   cbCriterion = new JComboBox(criteria);
   pCriterion.add(cbCriterion);
   allEstabList = desktop.getDataCache().getList(Model.Establishment);
   allEstabList.addElement(new Establishment(new Person(0, BundleUtil.getLabel("All.label"))));
   estab = new EstabChoice(allEstabList);
   pCriterion.add(estab);
   return pCriterion;
 }
Ejemplo n.º 8
0
  public ModuleChoice(ModuleChoiceModel model, boolean none) {
    super(model);

    if (none) {
      Module s = new Module(BundleUtil.getLabel("None.label"));
      insertItemAt(s, 0);
    }
    if (model.getSize() > 0) {
      setSelectedIndex(0);
    }
  }
Ejemplo n.º 9
0
  public CloseableTab(final TabPanel pane, final ActionListener listener) {
    super(new FlowLayout(FlowLayout.LEFT, 0, 0));
    this.listener = listener;
    if (pane == null) {
      throw new NullPointerException("TabbedPane is null");
    }
    setOpaque(false);
    this.pane = pane;

    setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
    JLabel label =
        new JLabel() {
          @Override
          public String getText() {
            int i = pane.indexOfTabComponent(CloseableTab.this);
            if (i != -1) {
              return pane.getTitleAt(i);
            }
            return null;
          }
        };

    // add more space between the label and the button
    if (UIManager.getLookAndFeel().getClass().getName().startsWith(JGOODIES)) {
      label.setOpaque(true);
      label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 7));
    } else {
      label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
    }

    add(label);

    // tab button
    button = new GemButton(closeIcon);
    button.setContentAreaFilled(false);
    button.setFocusable(false);
    button.setBorder(BorderFactory.createEtchedBorder());
    button.setBorderPainted(false);
    button.setToolTipText(BundleUtil.getLabel("Tab.closing.tip"));
    button.addActionListener(this);
    add(button);
    // add more space to the top of the component
    //    setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 5));

  }
Ejemplo n.º 10
0
  private void print() {
    desktop.setWaitCursor();
    hideCatchingRooms();
    printDlg.setVisible(true);
    try {
      List<Module> modules =
          memberService.findModuleOrders(personFile.getId(), dates.getStart(), dates.getEnd());
      StringBuilder sb = new StringBuilder(personFile.getContact().getFirstnameName());

      if (modules != null && !modules.isEmpty()) {
        sb.append(" : ");
        sb.append(modules.get(0).getTitle());
        if (modules.size() > 1) {
          sb.append("..."); // do not display next modules
        }
      }

      MessageFormat header = new MessageFormat(sb.toString());
      MessageFormat footer = new MessageFormat("Page {0}");
      PrintRequestAttributeSet prs = new HashPrintRequestAttributeSet();
      prs.add(MediaSizeName.ISO_A4);
      prs.add(Sides.TWO_SIDED_LONG_EDGE);
      prs.add(OrientationRequested.PORTRAIT);
      prs.add(
          new JobName(
              BundleUtil.getLabel("Follow.up.label") + "-" + personFile.getId(),
              Locale.getDefault()));
      // 210 x 297 mm | 8.3 x 11.7 in 1 inch = 25.4 mm

      MediaPrintableArea printableArea =
          new MediaPrintableArea(10f, 10f, 190f, 277f, MediaPrintableArea.MM);
      prs.add(printableArea);
      printTable.print(JTable.PrintMode.FIT_WIDTH, header, footer, true, prs, true);
    } catch (PrinterException ex) {
      GemLogger.logException(ex);
    } finally {
      printDlg.setVisible(false);
      desktop.setDefaultCursor();
    }
  }
Ejemplo n.º 11
0
  public BranchView() {

    no = new GemField(6);
    no.setEditable(false);
    no.setBackground(Color.lightGray);

    bankCode = new BankCodeField();
    bankName = new GemField(30);

    branchCode = new BranchCodeField();
    domiciliation = new GemField(24);
    bicCode = new BicCodeField();
    bicCode.setActionCommand(BankCodeCtrl.BIC_CMD);
    bicCode.setToolTipText(BundleUtil.getLabel("Bic.code.tip"));

    addressView = new AddressView();

    this.setLayout(new GridBagLayout());
    GridBagHelper gb = new GridBagHelper(this);

    gb.add(new GemLabel(BundleUtil.getLabel("Id.label")), 0, 0, 1, 1, GridBagHelper.WEST);
    gb.add(new GemLabel(BundleUtil.getLabel("Bank.code.label")), 0, 1, 1, 1, GridBagHelper.WEST);
    gb.add(new GemLabel(BundleUtil.getLabel("Bank.name.label")), 0, 2, 1, 1, GridBagHelper.WEST);
    gb.add(
        new GemLabel(BundleUtil.getLabel("Bank.branch.code.label")),
        0,
        3,
        1,
        1,
        GridBagHelper.WEST);
    gb.add(new GemLabel("Domiciliation"), 0, 4, 1, 1, GridBagHelper.WEST);
    gb.add(new GemLabel(BundleUtil.getLabel("Bic.code.label")), 0, 5, 1, 1, GridBagHelper.WEST);
    gb.add(no, 1, 0, 1, 1, GridBagHelper.WEST);
    gb.add(bankCode, 1, 1, 3, 1, GridBagHelper.WEST);
    gb.add(bankName, 1, 2, 3, 1, GridBagHelper.WEST);
    gb.add(branchCode, 1, 3, 1, 1, GridBagHelper.WEST);
    gb.add(domiciliation, 1, 4, 1, 1, GridBagHelper.WEST);
    gb.add(bicCode, 1, 5, 1, 1, GridBagHelper.WEST);
    gb.add(addressView, 0, 6, 2, 1, GridBagHelper.BOTH, 1.0, 1.0);
  }
Ejemplo n.º 12
0
/**
 * Export mailling teachers.
 *
 * @author <a href="mailto:[email protected]">Eric</a>
 * @author <a href="mailto:[email protected]">Jean-Marc Gobat</a>
 * @version 2.9.2.1
 * @since 1.0a 14/12/1999
 */
public class TeacherExportDlg extends ExportDlg {

  private static final String TEACHER_TITLE = BundleUtil.getLabel("Export.teacher.title");
  private static Object[] criteria = {
    MessageUtil.getMessage("export.criterium.teacher.all"),
    MessageUtil.getMessage("export.criterium.teacher.active"),
    MessageUtil.getMessage("export.criterium.teacher.year")
  };
  private GemPanel pCriterion;
  private JComboBox cbCriterion;
  private EstabChoice estab;
  private GemList<Establishment> allEstabList;

  public TeacherExportDlg(GemDesktop desktop) {
    super(desktop, TEACHER_TITLE);
  }

  public TeacherExportDlg(Dialog _parent) {
    super(_parent, TEACHER_TITLE);
  }

  @Override
  public GemPanel getCriterion() {
    pCriterion = new GemPanel();
    cbCriterion = new JComboBox(criteria);
    pCriterion.add(cbCriterion);
    allEstabList = desktop.getDataCache().getList(Model.Establishment);
    allEstabList.addElement(new Establishment(new Person(0, BundleUtil.getLabel("All.label"))));
    estab = new EstabChoice(allEstabList);
    pCriterion.add(estab);
    return pCriterion;
  }

  @Override
  public String getRequest() {
    String query = null;
    int e = estab.getKey();
    switch (cbCriterion.getSelectedIndex()) {
      case 0: // tous les profs
        query = "WHERE id > 0 AND id IN (SELECT idper FROM prof)";
        if (e > 0) {
          query +=
              " AND id IN (SELECT DISTINCT e.idper FROM prof e, planning p, salle s"
                  + " WHERE e.idper = p.idper"
                  + " AND p.ptype IN ("
                  + Schedule.COURSE
                  + ","
                  + Schedule.WORKSHOP
                  + ","
                  + Schedule.TRAINING
                  + ")"
                  + " AND p.lieux = s.id AND s.etablissement = "
                  + e
                  + ")";
        }
        break;
      case 1: // tous les profs actifs
        query = "WHERE id > 0 AND id IN (SELECT idper FROM prof WHERE actif = 't')";
        if (e > 0) {
          query +=
              " AND id IN (SELECT DISTINCT e.idper FROM prof e, planning p, salle s"
                  + " WHERE e.idper = p.idper"
                  + " AND p.ptype IN ("
                  + Schedule.COURSE
                  + ","
                  + Schedule.WORKSHOP
                  + ","
                  + Schedule.TRAINING
                  + ")"
                  + " AND p.lieux = s.id AND s.etablissement = "
                  + e
                  + ")";
        }
        break;
      case 2: // les intervenants de l'année
        query =
            "WHERE id > 0 AND id IN (SELECT DISTINCT e.idper FROM prof e, planning p, salle s"
                + " WHERE e.idper = p.idper"
                + " AND p.lieux = s.id"
                + " AND p.ptype IN ("
                + Schedule.COURSE
                + ","
                + Schedule.WORKSHOP
                + ","
                + Schedule.TRAINING
                + ")"
                + " AND p.jour >= '"
                + desktop.getDataCache().getStartOfYear()
                + "'";
        if (e > 0) {
          query += " AND s.etablissement = " + e;
        }
        query += ")";
        break;
    }

    return query;
  }

  @Override
  protected String getFileName() {
    return BundleUtil.getLabel("Export.teacher.file");
  }

  @Override
  protected void close() {
    allEstabList.removeElement((Establishment) allEstabList.getItem(0));
    super.close();
  }
}
Ejemplo n.º 13
0
 @Override
 protected String getFileName() {
   return BundleUtil.getLabel("Export.teacher.file");
 }
Ejemplo n.º 14
0
 public DayPlanTeacherView(GemList<Teacher> list) {
   super(BundleUtil.getLabel("Teacher.label"));
   teacherList = list;
 }
Ejemplo n.º 15
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);
  }