/* A basic extension of the java.awt.Dialog class */ import java.awt.*; import twinfeats.awt.*; import twinfeats.util.*; import java.awt.event.*; import java.util.*; import java.io.*; import twinfeats.awt.TFCalendar; public class NewConf extends Dialog { ConfServer cserver; public NewConf(Frame parent, boolean modal, Profile p) { this(parent,modal); Calendar.setProfile(p); ProfileSection[] sn = p.getSections(); for (int i=0;i 0) { Confs.select(0); Confs_ItemStateChanged(null); } Calendar.repaint(); try { p.write(); } catch (IOException ioe) { ioe.printStackTrace(); } } class SymComponent extends java.awt.event.ComponentAdapter { public void componentResized(java.awt.event.ComponentEvent event) { Object object = event.getSource(); if (object == Calendar) Calendar_componentResized(event); } } void Calendar_componentResized(java.awt.event.ComponentEvent event) { // to do: code goes here. } void Update_Action(java.awt.event.ActionEvent event) { // to do: code goes here. String item = Confs.getSelectedItem(); int idx = Confs.getSelectedIndex(); Profile p = Calendar.getProfile(); ProfileSection ps = p.getSection(item); p.removeSection(ps.getName()); ps = new ProfileSection(Name.getText()); p.addSection(ps); p.addVar(ps,Calendar.STARTDATE,Start.getText()); p.addVar(ps,Calendar.ENDDATE,End.getText()); item = getSelections(Period); p.addVar(ps,Calendar.PERIOD,item); item = getSelections(Freq); p.addVar(ps,Calendar.FREQ,item); if (Public.getState()) p.addVar(ps,"Public","yes"); Calendar.repaint(); Confs.remove(idx); Confs.addItem(Name.getText()); Confs.select(Name.getText()); try { p.write(); } catch (IOException ioe) { ioe.printStackTrace(); } } public static String getSelections(List list) { StringBuffer sb = new StringBuffer(100); String[] sa = list.getSelectedItems(); if (sa != null) { for (int i=0;i 0) sb.append(","); sb.append(sa[i]); } } return sb.toString(); } }