Source Code Cross Referenced for XPaletteComponentFactory.java in  » XML-UI » XUI » net » xoetrope » builder » editor » 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 » XML UI » XUI » net.xoetrope.builder.editor 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.xoetrope.builder.editor;
002:
003:        import java.awt.BorderLayout;
004:        import java.awt.Color;
005:        import java.awt.Container;
006:        import java.awt.Dimension;
007:        import java.awt.event.ActionListener;
008:        import java.awt.event.ItemListener;
009:        import javax.swing.JButton;
010:        import javax.swing.JComboBox;
011:        import javax.swing.JComponent;
012:        import javax.swing.JLabel;
013:        import javax.swing.JPanel;
014:        import javax.swing.JTextField;
015:        import javax.swing.border.EmptyBorder;
016:
017:        /**
018:         * <p>For creating rows within the PropertyEditor and the StyleEditor</p>
019:         * <p>Copyright: Copyright (c) Xoetrope Ltd., 1998-2003</p>
020:         * $Revision: 1.1 $
021:         */
022:        public class XPaletteComponentFactory {
023:            public XPaletteComponentFactory() {
024:            }
025:
026:            /**
027:             * Adds a edit field and a label to the toolbar for the named property
028:             * @param title the property name/label
029:             * @return the edit field for the property
030:             */
031:            public static void addSpacer(String title, Container page) {
032:                // This is added as a Panel a the XPanel gives a sizing problem if used as
033:                // the first child component
034:                JPanel panel = new JPanel();
035:                panel.setLayout(null);
036:
037:                panel.setSize(260, 20);
038:
039:                JLabel label = new JLabel();
040:                label.setFont(XuiDefaults.defaultFont);
041:                label.setBounds(1, 1, 258, 16);
042:                label.setText(title);
043:                panel.add(label);
044:
045:                page.add(panel);
046:            }
047:
048:            /**
049:             * Adds a combo field and a label to the toolbar for the named property
050:             * @param propertyName the property name/label
051:             * @param selIdx the index of the selected item in the dropdown
052:             * @param values the dropdown list's values
053:             * @param page the XPage to get the componentFactory from
054:             * @param ilistener the ItemListener which will be added to the combobox
055:             * @return the edit field for the property
056:             */
057:            public static JComboBox addComboProperty(String propertyName,
058:                    int selIdx, String[] values, Container page,
059:                    ItemListener ilistener) {
060:                JPanel panel = new JPanel();
061:                panel.setBounds(0, 0, 260, 16);
062:                panel.setLayout(null);
063:                panel.setName("XPageBuilder_OptionalProperty");
064:
065:                JLabel label = new JLabel();
066:                label.setName(propertyName);
067:                label.setFont(XuiDefaults.defaultFont);
068:                panel.add(label);
069:
070:                JComboBox acombo = new JComboBox();
071:                acombo.setLightWeightPopupEnabled(true);
072:                acombo.setFont(XuiDefaults.defaultFont);
073:                panel.add(acombo);
074:
075:                label.setHorizontalAlignment(JLabel.RIGHT);
076:
077:                loadCombo(acombo, values);
078:                acombo.setSelectedIndex(selIdx);
079:
080:                acombo.addItemListener(ilistener);
081:
082:                return acombo;
083:            }
084:
085:            /**
086:             * Resets the values of a combobox and populates it with the new values
087:             * @param combo The target combobox
088:             * @param values array of values to be inserted into the combobox
089:             */
090:            private static void loadCombo(JComboBox combo, String[] values) {
091:                combo.removeAllItems();
092:                for (int i = 0; i < values.length; i++)
093:                    combo.addItem(values[i]);
094:            }
095:
096:            public static JTextField addProperty(String propertyName,
097:                    String content, boolean optional, JComponent parent,
098:                    ActionListener alistener, int width) {
099:                JPanel pnlCont = new JPanel(new BorderLayout());
100:                pnlCont.setBorder(new EmptyBorder(1, 1, 1, 2));
101:                pnlCont.setPreferredSize(new Dimension(240, 18));
102:
103:                JLabel lblPrompt = new JLabel(propertyName);
104:                lblPrompt.setPreferredSize(new Dimension(80, 16));
105:                lblPrompt.setFont(XuiDefaults.defaultFont);
106:                pnlCont.add(lblPrompt, BorderLayout.WEST);
107:
108:                JTextField txtProp = new JTextField();
109:                txtProp.setPreferredSize(new Dimension(130, 16));
110:                txtProp.setFont(XuiDefaults.defaultFont);
111:                pnlCont.add(txtProp, BorderLayout.CENTER);
112:
113:                parent.add(pnlCont);
114:                pnlCont.doLayout();
115:                return txtProp;
116:            }
117:
118:            /**
119:             * @param propertyName the name of the property to add
120:             * @param parent The component to which to add the newly created component.
121:             * @param action The String to set as the action command
122:             * @param aListener The ActionListener to add to the component
123:             * @param width The width of the new component
124:             * @param btnoffset The horizontal offset at which to position the component
125:             * @return the newly created XLabel
126:             */
127:            public static JLabel addLabelProperty(String propertyName,
128:                    JComponent parent, String action, ActionListener aListener,
129:                    boolean addButton) {
130:                JPanel pnlCont = new JPanel(new BorderLayout());
131:                pnlCont.setBorder(new EmptyBorder(1, 1, 1, 2));
132:                pnlCont.setPreferredSize(new Dimension(240, 18));
133:
134:                JLabel lblPrompt = new JLabel(propertyName);
135:                lblPrompt.setPreferredSize(new Dimension(80, 16));
136:                lblPrompt.setFont(XuiDefaults.defaultFont);
137:                pnlCont.add(lblPrompt, BorderLayout.WEST);
138:
139:                JLabel lblProp = new JLabel();
140:                lblProp.setOpaque(true);
141:                lblProp.setBackground(Color.white);
142:                lblProp.setFont(XuiDefaults.defaultFont);
143:                lblProp.setPreferredSize(new Dimension(130, 16));
144:                pnlCont.add(lblProp, BorderLayout.CENTER);
145:
146:                if (addButton) {
147:                    JButton btnMore = new JButton("...");
148:                    btnMore.setPreferredSize(new Dimension(20, 16));
149:                    btnMore.addActionListener(aListener);
150:                    btnMore.setActionCommand(action);
151:                    btnMore.setFont(XuiDefaults.defaultFont);
152:                    pnlCont.add(btnMore, BorderLayout.EAST);
153:                } else {
154:                    JLabel dummy = new JLabel();
155:                    dummy.setPreferredSize(new Dimension(20, 16));
156:                    pnlCont.add(dummy, BorderLayout.EAST);
157:                }
158:
159:                parent.add(pnlCont);
160:                pnlCont.doLayout();
161:                return lblProp;
162:            }
163:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.