Source Code Cross Referenced for PageLayoutChooserPanelGUI.java in  » IDE-Netbeans » visualweb.api.designer » org » netbeans » modules » visualweb » project » jsf » ui » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » visualweb.api.designer » org.netbeans.modules.visualweb.project.jsf.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the terms of the Common Development
003:         * and Distribution License (the License). You may not use this file except in
004:         * compliance with the License.
005:         *
006:         * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007:         * or http://www.netbeans.org/cddl.txt.
008:         *
009:         * When distributing Covered Code, include this CDDL Header Notice in each file
010:         * and include the License file at http://www.netbeans.org/cddl.txt.
011:         * If applicable, add the following below the CDDL Header, with the fields
012:         * enclosed by brackets [] replaced by your own identifying information:
013:         * "Portions Copyrighted [year] [name of copyright owner]"
014:         *
015:         * The Original Software is NetBeans. The Initial Developer of the Original
016:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-200? Sun
017:         * Microsystems, Inc. All Rights Reserved.
018:         */
019:
020:        package org.netbeans.modules.visualweb.project.jsf.ui;
021:
022:        import java.awt.Component;
023:        import java.util.ArrayList;
024:        import java.util.List;
025:        import java.util.Vector;
026:        import javax.swing.BorderFactory;
027:        import javax.swing.ImageIcon;
028:        import javax.swing.JLabel;
029:        import javax.swing.JList;
030:        import javax.swing.ListCellRenderer;
031:        import javax.swing.ListSelectionModel;
032:        import org.openide.WizardDescriptor;
033:        import org.openide.filesystems.FileObject;
034:        import org.openide.filesystems.Repository;
035:        import org.openide.util.HelpCtx;
036:        import org.openide.util.NbBundle;
037:
038:        /**
039:         * Wizard Panel UI that allows the user to select the Page Template
040:         * @author Winston Prakash
041:         */
042:        public class PageLayoutChooserPanelGUI extends javax.swing.JPanel
043:                implements  HelpCtx.Provider {
044:
045:            private PageLayoutChooserPanel wizardPanel;
046:
047:            /** Creates new form TemplatePanelVisual */
048:            public PageLayoutChooserPanelGUI(PageLayoutChooserPanel wizPanel) {
049:                initComponents();
050:                wizardPanel = wizPanel;
051:                templatesList.getSelectionModel().setSelectionMode(
052:                        ListSelectionModel.SINGLE_SELECTION);
053:                templatesList.setListData(wizardPanel.getPageLayoutList());
054:                templatesList.setCellRenderer(new CustomCellRenderer());
055:                wizardPanel.setSelectedPageLayout(wizardPanel
056:                        .getPageLayoutList().get(0));
057:                templatesList.setSelectedIndex(0);
058:                descriptionArea.setBackground(previewPanel.getBackground());
059:            }
060:
061:            @Override
062:            public String getName() {
063:                return NbBundle.getMessage(PageLayoutChooserPanelGUI.class,
064:                        "LBL_PageLayoutsPanel_Name");
065:            }
066:
067:            /** This method is called from within the constructor to
068:             * initialize the form.
069:             * WARNING: Do NOT modify this code. The content of this method is
070:             * always regenerated by the Form Editor.
071:             */
072:            // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
073:            private void initComponents() {
074:                java.awt.GridBagConstraints gridBagConstraints;
075:
076:                templatesListPanel = new javax.swing.JPanel();
077:                jScrollPane1 = new javax.swing.JScrollPane();
078:                templatesList = new javax.swing.JList();
079:                previewPanel = new javax.swing.JPanel();
080:                jScrollPane2 = new javax.swing.JScrollPane();
081:                jPanel1 = new javax.swing.JPanel();
082:                previewIcon = new javax.swing.JLabel();
083:                jScrollPane3 = new javax.swing.JScrollPane();
084:                descriptionArea = new javax.swing.JTextArea();
085:
086:                templatesList.setModel(new javax.swing.AbstractListModel() {
087:                    String[] strings = { "Item 1", "Item 2", "Item 3",
088:                            "Item 4", "Item 5" };
089:
090:                    public int getSize() {
091:                        return strings.length;
092:                    }
093:
094:                    public Object getElementAt(int i) {
095:                        return strings[i];
096:                    }
097:                });
098:                templatesList
099:                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
100:                            public void valueChanged(
101:                                    javax.swing.event.ListSelectionEvent evt) {
102:                                templatesListValueChanged(evt);
103:                            }
104:                        });
105:                jScrollPane1.setViewportView(templatesList);
106:
107:                org.jdesktop.layout.GroupLayout templatesListPanelLayout = new org.jdesktop.layout.GroupLayout(
108:                        templatesListPanel);
109:                templatesListPanel.setLayout(templatesListPanelLayout);
110:                templatesListPanelLayout
111:                        .setHorizontalGroup(templatesListPanelLayout
112:                                .createParallelGroup(
113:                                        org.jdesktop.layout.GroupLayout.LEADING)
114:                                .add(
115:                                        templatesListPanelLayout
116:                                                .createSequentialGroup()
117:                                                .addContainerGap()
118:                                                .add(
119:                                                        jScrollPane1,
120:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
121:                                                        211, Short.MAX_VALUE)));
122:                templatesListPanelLayout
123:                        .setVerticalGroup(templatesListPanelLayout
124:                                .createParallelGroup(
125:                                        org.jdesktop.layout.GroupLayout.LEADING)
126:                                .add(
127:                                        org.jdesktop.layout.GroupLayout.TRAILING,
128:                                        templatesListPanelLayout
129:                                                .createSequentialGroup()
130:                                                .addContainerGap()
131:                                                .add(
132:                                                        jScrollPane1,
133:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
134:                                                        303, Short.MAX_VALUE)
135:                                                .addContainerGap()));
136:
137:                jScrollPane2.setBorder(null);
138:
139:                jPanel1.setBorder(javax.swing.BorderFactory
140:                        .createTitledBorder(org.openide.util.NbBundle
141:                                .getMessage(PageLayoutChooserPanelGUI.class,
142:                                        "PREVIEW_TITLE"))); // NOI18N
143:                jPanel1.setLayout(new java.awt.GridBagLayout());
144:
145:                previewIcon.setText(org.openide.util.NbBundle.getMessage(
146:                        PageLayoutChooserPanelGUI.class, "NO_PREVIEW_TEXT")); // NOI18N
147:                gridBagConstraints = new java.awt.GridBagConstraints();
148:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
149:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
150:                jPanel1.add(previewIcon, gridBagConstraints);
151:
152:                jScrollPane2.setViewportView(jPanel1);
153:
154:                jScrollPane3.setBorder(null);
155:
156:                descriptionArea.setColumns(15);
157:                descriptionArea.setEditable(false);
158:                descriptionArea.setLineWrap(true);
159:                descriptionArea.setRows(5);
160:                descriptionArea
161:                        .setText(org.openide.util.NbBundle.getMessage(
162:                                PageLayoutChooserPanelGUI.class,
163:                                "NO_DESCRIPTION_TEXT")); // NOI18N
164:                descriptionArea.setBorder(null);
165:                jScrollPane3.setViewportView(descriptionArea);
166:
167:                org.jdesktop.layout.GroupLayout previewPanelLayout = new org.jdesktop.layout.GroupLayout(
168:                        previewPanel);
169:                previewPanel.setLayout(previewPanelLayout);
170:                previewPanelLayout
171:                        .setHorizontalGroup(previewPanelLayout
172:                                .createParallelGroup(
173:                                        org.jdesktop.layout.GroupLayout.LEADING)
174:                                .add(
175:                                        previewPanelLayout
176:                                                .createSequentialGroup()
177:                                                .addContainerGap()
178:                                                .add(
179:                                                        previewPanelLayout
180:                                                                .createParallelGroup(
181:                                                                        org.jdesktop.layout.GroupLayout.LEADING)
182:                                                                .add(
183:                                                                        org.jdesktop.layout.GroupLayout.TRAILING,
184:                                                                        jScrollPane2,
185:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
186:                                                                        216,
187:                                                                        Short.MAX_VALUE)
188:                                                                .add(
189:                                                                        org.jdesktop.layout.GroupLayout.TRAILING,
190:                                                                        jScrollPane3,
191:                                                                        0,
192:                                                                        0,
193:                                                                        Short.MAX_VALUE))
194:                                                .addContainerGap()));
195:                previewPanelLayout
196:                        .setVerticalGroup(previewPanelLayout
197:                                .createParallelGroup(
198:                                        org.jdesktop.layout.GroupLayout.LEADING)
199:                                .add(
200:                                        org.jdesktop.layout.GroupLayout.TRAILING,
201:                                        previewPanelLayout
202:                                                .createSequentialGroup()
203:                                                .addContainerGap()
204:                                                .add(
205:                                                        jScrollPane2,
206:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
207:                                                        205, Short.MAX_VALUE)
208:                                                .add(18, 18, 18)
209:                                                .add(
210:                                                        jScrollPane3,
211:                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
212:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
213:                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
214:                                                .addContainerGap()));
215:
216:                org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(
217:                        this );
218:                this .setLayout(layout);
219:                layout
220:                        .setHorizontalGroup(layout
221:                                .createParallelGroup(
222:                                        org.jdesktop.layout.GroupLayout.LEADING)
223:                                .add(
224:                                        org.jdesktop.layout.GroupLayout.TRAILING,
225:                                        layout
226:                                                .createSequentialGroup()
227:                                                .addContainerGap()
228:                                                .add(
229:                                                        templatesListPanel,
230:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
231:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
232:                                                        Short.MAX_VALUE)
233:                                                .add(18, 18, 18)
234:                                                .add(
235:                                                        previewPanel,
236:                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
237:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
238:                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)));
239:                layout.setVerticalGroup(layout.createParallelGroup(
240:                        org.jdesktop.layout.GroupLayout.LEADING).add(
241:                        templatesListPanel, 0,
242:                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
243:                        Short.MAX_VALUE).add(previewPanel,
244:                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
245:                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
246:                        Short.MAX_VALUE));
247:            }// </editor-fold>//GEN-END:initComponents
248:
249:            java.awt.GridBagConstraints gridBagConstraints;
250:
251:            private void templatesListValueChanged(
252:                    javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_templatesListValueChanged
253:                // When the user release the mouse button and completes the selection,
254:                // getValueIsAdjusting() becomes false
255:                if (!evt.getValueIsAdjusting()) {
256:                    JList list = (JList) evt.getSource();
257:                    PageLayoutData pageLayout = (PageLayoutData) list
258:                            .getSelectedValue();
259:                    wizardPanel.setSelectedPageLayout(pageLayout);
260:                    if (pageLayout.getPreviewImage() != null) {
261:                        previewIcon.setIcon(new ImageIcon(pageLayout
262:                                .getPreviewImage()));
263:                        previewIcon.setText("");
264:                    } else {
265:                        previewIcon.setIcon(null);
266:                        previewIcon.setText(NbBundle.getMessage(
267:                                PageLayoutChooserPanelGUI.class,
268:                                "NO_PREVIEW_TEXT"));
269:                    }
270:                    descriptionArea.setText(pageLayout.getDescription());
271:                }
272:            }//GEN-LAST:event_templatesListValueChanged
273:
274:            // Variables declaration - do not modify//GEN-BEGIN:variables
275:            private javax.swing.JTextArea descriptionArea;
276:            private javax.swing.JPanel jPanel1;
277:            private javax.swing.JScrollPane jScrollPane1;
278:            private javax.swing.JScrollPane jScrollPane2;
279:            private javax.swing.JScrollPane jScrollPane3;
280:            private javax.swing.JLabel previewIcon;
281:            private javax.swing.JPanel previewPanel;
282:            private javax.swing.JList templatesList;
283:            private javax.swing.JPanel templatesListPanel;
284:
285:            // End of variables declaration//GEN-END:variables
286:
287:            public HelpCtx getHelpCtx() {
288:                return new HelpCtx(PageLayoutChooserPanelGUI.class);
289:            }
290:
291:            class CustomCellRenderer extends JLabel implements  ListCellRenderer {
292:
293:                CustomCellRenderer() {
294:                    setBorder(BorderFactory.createEmptyBorder(1, 5, 1, 5));
295:                }
296:
297:                public Component getListCellRendererComponent(JList list,
298:                        Object value, // value to display
299:                        int index, // cell index
300:                        boolean isSelected, // is the cell selected
301:                        boolean cellHasFocus) {
302:                    PageLayoutData pageLayout = (PageLayoutData) value;
303:                    setText(pageLayout.getName());
304:                    if (pageLayout.getIcon() != null) {
305:                        setIcon(new ImageIcon(pageLayout.getIcon()));
306:                    }
307:                    if (isSelected) {
308:                        setBackground(list.getSelectionBackground());
309:                        setForeground(list.getSelectionForeground());
310:                    } else {
311:                        setBackground(list.getBackground());
312:                        setForeground(list.getForeground());
313:                    }
314:                    setEnabled(list.isEnabled());
315:                    setFont(list.getFont());
316:                    setOpaque(true);
317:                    return this;
318:                }
319:            }
320:        }
w__w__w.__jav___a_2___s__.___c___o__m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.