1
2 package org.xrn.gui;
3
4 import java.awt.Color;
5 import java.awt.Font;
6
7 import javax.swing.JButton;
8 import javax.swing.JComponent;
9 import javax.swing.JPanel;
10 import javax.swing.JScrollPane;
11 import javax.swing.JTextPane;
12 import javax.swing.border.TitledBorder;
13
14 import org.xrn.xsd2java.ContentType;
15 import org.xrn.xsd2java.impl.ContentTypeImpl;
16
17 public class SummaryPanel extends JPanel{
18 private Font schriftTyp;
19
20 private JButton newButton = new JButton( "New" );
21 private JTextPane textPane = null;
22 private JScrollPane scrollPane = null;
23
24 private JPanel panelOwner = null;
25
26 private ContentType summary = new ContentTypeImpl();
27
28 /***
29 * Constructor
30 * @param owner
31 * @param onMainPanel
32 */
33 public SummaryPanel( JPanel owner, String panelSize ){
34
35 setBorder( new TitledBorder( " Summary " ) );
36 schriftTyp = new Font( "Dialog", Font.BOLD, 14 );
37 setFont( schriftTyp );
38 setLayout( null );
39
40 panelOwner = owner;
41
42 textPane = new JTextPane();
43 scrollPane = new JScrollPane( textPane );
44 if( panelSize.equals( "big" ) )
45 dlgObjHinzufuegen( scrollPane, 25, 25, 500, 150 );
46 else if( panelSize.equals( "normal" ) )
47 dlgObjHinzufuegen( scrollPane, 25, 25, 250, 120 );
48 else
49 dlgObjHinzufuegen( scrollPane, 25, 25, 200, 120 );
50 }
51
52 /***
53 *
54 * @param c
55 * @param x0
56 * @param y0
57 * @param width
58 * @param height
59 */
60 public void dlgObjHinzufuegen( JComponent c, int x0, int y0, int breite, int hoehe ){
61 c.setBounds( x0, y0, breite, hoehe );
62 c.setForeground( Color.black );
63 add(c);
64 }
65
66 /***
67 * Delete the input and set the default value if necessary
68 *
69 */
70 public void resetFields( ){
71 textPane.setText( "" );
72 }
73
74 /***
75 *
76 * @return - The summary
77 */
78 public ContentType getSummary(){
79 summary.getContent().add( textPane.getText() );
80 return summary;
81 }
82
83 /***
84 *
85 * @param summ
86 */
87 public void setSummary( ContentType summ ){
88 this.summary = summ;
89 if( summary != null && summary.getContent().size() > 0)
90 textPane.setText( (String)summary.getContent().get( 0 ) );
91 }
92
93 }