ViewPanel.java revision 1472:c18cbe5936b8
1/*
2 * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24package com.sun.hotspot.igv.settings;
25
26/**
27 *
28 * @author Thomas Wuerthinger
29 */
30final class ViewPanel extends javax.swing.JPanel {
31
32    private final ViewOptionsPanelController controller;
33
34    ViewPanel(ViewOptionsPanelController controller) {
35        this.controller = controller;
36        initComponents();
37    }
38
39    /** This method is called from within the constructor to
40     * initialize the form.
41     * WARNING: Do NOT modify this code. The content of this method is
42     * always regenerated by the Form Editor.
43     */
44    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
45    private void initComponents() {
46
47        jPanel1 = new javax.swing.JPanel();
48        jLabel1 = new javax.swing.JLabel();
49        jLabel2 = new javax.swing.JLabel();
50        portSpinner = new javax.swing.JSpinner();
51        jScrollPane1 = new javax.swing.JScrollPane();
52        nodeTextArea = new javax.swing.JTextArea();
53        nodeWidthSpinner = new javax.swing.JSpinner();
54        jLabel3 = new javax.swing.JLabel();
55
56        org.openide.awt.Mnemonics.setLocalizedText(jLabel1, "Node Text");
57
58        org.openide.awt.Mnemonics.setLocalizedText(jLabel2, "Node Width");
59
60        nodeTextArea.setColumns(20);
61        nodeTextArea.setRows(5);
62        jScrollPane1.setViewportView(nodeTextArea);
63
64        org.openide.awt.Mnemonics.setLocalizedText(jLabel3, "Network Port");
65
66        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
67        jPanel1.setLayout(jPanel1Layout);
68        jPanel1Layout.setHorizontalGroup(
69            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
70            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
71                .addContainerGap()
72                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
73                    .add(jLabel1)
74                    .add(jLabel3)
75                    .add(jLabel2))
76                .add(39, 39, 39)
77                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
78                    .add(portSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 63, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
79                    .add(nodeWidthSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 63, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
80                    .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 365, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
81                .addContainerGap())
82        );
83        jPanel1Layout.setVerticalGroup(
84            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
85            .add(jPanel1Layout.createSequentialGroup()
86                .addContainerGap()
87                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
88                    .add(jPanel1Layout.createSequentialGroup()
89                        .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
90                        .add(18, 18, 18)
91                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
92                            .add(nodeWidthSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
93                            .add(jLabel2))
94                        .add(18, 18, 18)
95                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
96                            .add(portSpinner, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
97                            .add(jLabel3)))
98                    .add(jLabel1))
99                .add(73, 73, 73))
100        );
101
102        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
103        this.setLayout(layout);
104        layout.setHorizontalGroup(
105            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
106            .add(layout.createSequentialGroup()
107                .addContainerGap()
108                .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
109                .addContainerGap())
110        );
111        layout.setVerticalGroup(
112            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
113            .add(layout.createSequentialGroup()
114                .addContainerGap()
115                .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 232, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
116                .addContainerGap(206, Short.MAX_VALUE))
117        );
118    }// </editor-fold>//GEN-END:initComponents
119    void load() {
120        nodeTextArea.setText(Settings.get().get(Settings.NODE_TEXT, Settings.NODE_TEXT_DEFAULT));
121        nodeWidthSpinner.setValue(Integer.parseInt(Settings.get().get(Settings.NODE_WIDTH, Settings.NODE_WIDTH_DEFAULT)));
122        portSpinner.setValue(Integer.parseInt(Settings.get().get(Settings.PORT, Settings.PORT_DEFAULT)));
123    }
124
125    void store() {
126        Settings.get().put(Settings.NODE_TEXT, nodeTextArea.getText());
127        Settings.get().put(Settings.NODE_WIDTH, nodeWidthSpinner.getValue().toString());
128        Settings.get().put(Settings.PORT, portSpinner.getValue().toString());
129    }
130
131    boolean valid() {
132        return true;
133    }
134    // Variables declaration - do not modify//GEN-BEGIN:variables
135    private javax.swing.JLabel jLabel1;
136    private javax.swing.JLabel jLabel2;
137    private javax.swing.JLabel jLabel3;
138    private javax.swing.JPanel jPanel1;
139    private javax.swing.JScrollPane jScrollPane1;
140    private javax.swing.JTextArea nodeTextArea;
141    private javax.swing.JSpinner nodeWidthSpinner;
142    private javax.swing.JSpinner portSpinner;
143    // End of variables declaration//GEN-END:variables
144}
145