1 /*
2 * $HeadURL: $
3 * $Date: $
4 * $Revision: $
5 * $Author: $
6 *
7 * Copyright (c) 2005 MindTree Consulting Ltd.
8 *
9 * This file is part of Insight.
10 *
11 * Insight is free software: you can redistribute it and/or modify it under the
12 * terms of the GNU General Public License as published by the Free Software
13 * Foundation, either version 3 of the License, or (at your option) any later
14 * version.
15 *
16 * Insight is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
19 * Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License along with
22 * Insight. If not, see <http://www.gnu.org/licenses/>.
23 */
24 package com.mindtree.techworks.insight.gui.preferences;
25
26 import javax.swing.JLabel;
27 import javax.swing.JTextField;
28
29 import com.mindtree.techworks.insight.InsightConstants;
30
31
32 /**
33 * A concrete implementation of <code>AbstractPreferencesUIPanel</code>, this
34 * class allows the display and modification of preferences related to the
35 * Remote Protocol and listeners.
36 *
37 * @see com.mindtree.techworks.insight.gui.preferences.AbstractPreferencesUIPanel
38 * @author <a href="mailto:bindul_bhowmik@mindtree.com">Bindul Bhowmik</a>
39 * @version $Revision: 27 $ $Date: 2007-12-16 04:58:03 -0700 (Sun, 16 Dec 2007) $
40 */
41 public class RemoteProtocolUIPanel extends AbstractPreferencesUIPanel {
42
43 // -------------------------------------------------------------------------
44 // Class variables
45 // -------------------------------------------------------------------------
46
47 /**
48 * The Serial Version UID for serialization
49 */
50 private static final long serialVersionUID = -8948510402612700373L;
51
52 /**
53 * The preference id attrbute for the preference.
54 */
55 private static final String PORT_ID = "port";
56
57 // -------------------------------------------------------------------------
58 // Instance variables
59 // -------------------------------------------------------------------------
60
61 /**
62 * Port Text field
63 */
64 private JTextField portField;
65
66 // -------------------------------------------------------------------------
67 // Constructors
68 // -------------------------------------------------------------------------
69
70 /**
71 * Creates an instance of this class.
72 */
73 public RemoteProtocolUIPanel () {
74 // No args constructor
75 }
76
77 // -------------------------------------------------------------------------
78 // Methods implemented from
79 // com.mindtree.techworks.insight.gui.preferences.AbstractPreferencesUIPanel
80 // -------------------------------------------------------------------------
81
82 /**
83 * @see com.mindtree.techworks.insight.gui.preferences.AbstractPreferencesUIPanel#initializeDisplay()
84 */
85 protected void initializeDisplay () {
86
87 addComponent (new JLabel (InsightConstants.getLiteral ("REMOTE_PORT")),
88 0, 0, 0, 0, 1, 1);
89 this.portField = new JTextField ();
90 addComponent (portField, 1, 0, 1, 0, 3, 1);
91
92 // set the value from the Preference
93 this.portField.setText (this.preference
94 .getPreferenceAttributeById (PORT_ID).getValue ());
95
96 // add the empty label to dock components to the top
97 addComponent (new JLabel (), 0, 1, 1, 1, 4, 1);
98 }
99
100 /**
101 * @see com.mindtree.techworks.insight.gui.preferences.AbstractPreferencesUIPanel#setPreferenceValues()
102 */
103 protected void setPreferenceValues () {
104
105 this.preference.getPreferenceAttributeById (PORT_ID)
106 .setValue (this.portField.getText ());
107
108 }
109
110 }