1    /*
2    Copyright 2001 by Ralph Hartley
3    This software is licenced under the terms of the
4    Gnu Public Licence
5    */
6    import javax.swing.*;
7    import javax.swing.event.*;
8    import java.awt.event.*;
9    import java.awt.*;
10   import java.io.*;
11   import java.util.*;
12   
13   public class PrefPageNew extends PrefEditor {
14   
15     private static final long serialVersionUID = Version.getSUID();
16   
17     public Page target;
18   
19     public PrefPageNew(PrefPage old) {
20       name = "Page";
21       target = new Page();
22       old.target = target;
23       old.apply();
24     }
25   
26     public PrefPageNew() {
27       name = "Page";
28       target = new Page();
29     }
30   
31     public void apply() {    
32       Page.defpage=target;
33     }
34   
35     public void save() {
36       if (pane==null) return;
37       target.acceptPropertyEdit();
38   //    super.save();
39       apply();
40   //    super.abandon();
41     }
42   
43     public void abandon() {
44       target.abandonPropertyEdit();
45       super.abandon();
46     }
47   
48     public void newPane() throws NoSuchFieldException {
49       int level = target.getLevel();
50       Object[] edits = new Object[level+1];
51       target.getPropertyEdit(edits,level,null,null);
52       pane = new javax.swing.Box(BoxLayout.Y_AXIS);
53   
54       for (int i=0;i<level+1;i++)
55         pane.add((Component)edits[i]);
56     }
57   }
58