예제 #1
0
 /**
  * Initializes event editing panel.
  *
  * @param ne Network Element.
  * @param em Event Manager.
  * @param evt Event.
  */
 protected void initialize(AbstractNetworkElement ne, EventManager em) {
   myNE = ne;
   myEventManager = em;
   setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
   JPanel pH = new JPanel(new FlowLayout());
   JLabel lD =
       new JLabel(
           "<html><font color=\"blue\">"
               + TypesHWC.typeString(myNE.getType())
               + " "
               + myNE.toString()
               + "</font></html>");
   pH.add(lD);
   add(pH);
   // Box dp = Box.createVerticalBox();
   JPanel pD = new JPanel(new BorderLayout());
   pD.setBorder(BorderFactory.createTitledBorder("Description"));
   desc.setText(myEvent.getDescription());
   pD.add(new JScrollPane(desc), BorderLayout.CENTER);
   // dp.add(pD);
   add(pD);
   fillPanel();
   // Box fp = Box.createVerticalBox();
   JPanel pT = new JPanel(new FlowLayout());
   pT.setBorder(BorderFactory.createTitledBorder("Activation Time"));
   hh = new JSpinner(new SpinnerNumberModel(Util.getHours(myEvent.getTime()), 0, 99, 1));
   hh.setEditor(new JSpinner.NumberEditor(hh, "00"));
   pT.add(hh);
   pT.add(new JLabel("h "));
   mm = new JSpinner(new SpinnerNumberModel(Util.getMinutes(myEvent.getTime()), 0, 59, 1));
   mm.setEditor(new JSpinner.NumberEditor(mm, "00"));
   pT.add(mm);
   pT.add(new JLabel("m "));
   ss = new JSpinner(new SpinnerNumberModel(Util.getSeconds(myEvent.getTime()), 0, 59.99, 1));
   ss.setEditor(new JSpinner.NumberEditor(ss, "00.##"));
   pT.add(ss);
   pT.add(new JLabel("s"));
   // fp.add(pT);
   add(pT);
   winEE = new WindowEventEditor(this, null);
   winEE.setVisible(true);
   return;
 }
예제 #2
0
 /** Saves event into the list. */
 public synchronized void save() {
   myEvent.setNEID(myNE.getId());
   myEvent.setEnabled(true);
   myEvent.setDescription(desc.getText());
   int h = (Integer) hh.getValue();
   int m = (Integer) mm.getValue();
   double s = (Double) ss.getValue();
   myEvent.setTime(h + (m / 60.0) + (s / 3600.0));
   myEventManager.clearEvent(myEvent);
   myEventManager.addEvent(myEvent);
   if (eventTable != null) eventTable.updateData();
   return;
 }