Ejemplo n.º 1
0
 /**
  * Add the event and vector of listeners to the queue to be delivered.
  *
  * @param event the event
  * @param vector the vector of listeners
  */
 protected void queueEvent(MailEvent event, Vector vector) {
   /*
    * Copy the vector in order to freeze the state of the set
    * of EventListeners the event should be delivered to prior
    * to delivery.  This ensures that any changes made to the
    * Vector from a target listener's method during the delivery
    * of this event will not take effect until after the event is
    * delivered.
    */
   Vector v = (Vector) vector.clone();
   q.enqueue(event, v);
 }
 /** Constructor */
 public ServiceFilterPanel(String text, Vector list) {
   empty_border = new EmptyBorder(5, 5, 0, 5);
   indent_border = new EmptyBorder(5, 25, 5, 5);
   service_box = new JCheckBox(text);
   service_box.addActionListener(this);
   service_data = new Vector();
   if (list != null) {
     service_box.setSelected(true);
     service_data = (Vector) list.clone();
   }
   service_list = new JList(service_data);
   service_list.setBorder(new EtchedBorder());
   service_list.setVisibleRowCount(5);
   service_list.addListSelectionListener(this);
   service_list.setEnabled(service_box.isSelected());
   service_scroll = new JScrollPane(service_list);
   service_scroll.setBorder(new EtchedBorder());
   remove_service_button = new JButton("Remove");
   remove_service_button.addActionListener(this);
   remove_service_button.setEnabled(false);
   remove_service_panel = new JPanel();
   remove_service_panel.setLayout(new FlowLayout());
   remove_service_panel.add(remove_service_button);
   service_area = new JPanel();
   service_area.setLayout(new BorderLayout());
   service_area.add(service_scroll, BorderLayout.CENTER);
   service_area.add(remove_service_panel, BorderLayout.EAST);
   service_area.setBorder(indent_border);
   add_service_field = new JTextField();
   add_service_field.addActionListener(this);
   add_service_field.getDocument().addDocumentListener(this);
   add_service_field.setEnabled(service_box.isSelected());
   add_service_button = new JButton("Add");
   add_service_button.addActionListener(this);
   add_service_button.setEnabled(false);
   add_service_panel = new JPanel();
   add_service_panel.setLayout(new BorderLayout());
   JPanel dummy = new JPanel();
   dummy.setBorder(empty_border);
   add_service_panel.add(dummy, BorderLayout.WEST);
   add_service_panel.add(add_service_button, BorderLayout.EAST);
   add_service_area = new JPanel();
   add_service_area.setLayout(new BorderLayout());
   add_service_area.add(add_service_field, BorderLayout.CENTER);
   add_service_area.add(add_service_panel, BorderLayout.EAST);
   add_service_area.setBorder(indent_border);
   setLayout(new BorderLayout());
   add(service_box, BorderLayout.NORTH);
   add(service_area, BorderLayout.CENTER);
   add(add_service_area, BorderLayout.SOUTH);
   setBorder(empty_border);
 }
Ejemplo n.º 3
0
 /** Met à jour le cache en fonction de la liste todo */
 private void updateCache() {
   aladin.trace(2, "Start cache updater...");
   Vector v;
   synchronized (this) {
     v = (Vector) todo.clone();
     todo.clear();
   }
   Enumeration e = v.elements();
   while (e.hasMoreElements()) {
     String url = (String) e.nextElement();
     try {
       putInCache(url);
     } catch (Exception e1) {
     }
     Util.pause(1000); // Pose entre deux
   }
   fin();
 }