001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: /*
043: * BorderStyleEditor.java
044: *
045: * Created on October 13, 2004, 12:23 PM
046: */
047:
048: package org.netbeans.modules.css.visual.ui;
049:
050: import java.awt.BorderLayout;
051: import java.awt.FontMetrics;
052: import org.netbeans.modules.css.visual.model.BorderModel;
053: import org.netbeans.modules.css.visual.model.CssProperties;
054: import org.netbeans.modules.css.editor.model.CssRuleContent;
055: import java.awt.Dimension;
056: import java.beans.PropertyChangeEvent;
057: import java.beans.PropertyChangeListener;
058: import java.awt.event.*;
059: import javax.swing.table.*;
060: import javax.swing.event.*;
061: import javax.swing.tree.*;
062: import javax.swing.*;
063: import org.netbeans.modules.css.visual.model.PropertyData;
064: import org.openide.util.NbBundle;
065:
066: /**
067: * Borders Style editor.
068: * @author Winston Prakash
069: * @version 1.0
070: */
071: public class BorderStyleEditor extends StyleEditor {
072:
073: BorderDataTable borderDataTable = new BorderDataTable();
074:
075: /** Creates new form FontStyleEditor */
076: public BorderStyleEditor() {
077: setName("borderStyleEditor"); //NOI18N
078: setDisplayName(NbBundle.getMessage(BorderStyleEditor.class,
079: "BORDER_EDITOR_DISPNAME"));
080: initComponents();
081: borderPanel.add(borderDataTable, BorderLayout.CENTER);
082: }
083:
084: /**
085: * Set the CSS Properties Values from the CssStyleData data structure
086: * to the GUI components.
087: */
088: protected void setCssPropertyValues(CssRuleContent cssStyleData) {
089: removeCssPropertyChangeListener();
090: borderDataTable.setCssPropertyValues(cssStyleData);
091: setCssPropertyChangeListener(cssStyleData);
092: }
093:
094: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
095: private void initComponents() {
096:
097: borderPanel = new javax.swing.JPanel();
098:
099: setLayout(new java.awt.BorderLayout(0, 5));
100:
101: borderPanel.setLayout(new java.awt.BorderLayout());
102: add(borderPanel, java.awt.BorderLayout.NORTH);
103: }// </editor-fold>//GEN-END:initComponents
104:
105: class BorderDataTable extends JPanel {
106:
107: CssRuleContent cssStyleData;
108:
109: BorderModel borderModel = new BorderModel();
110: JComboBox allStyleCombo;
111: BorderWidthField allWidthField;
112: ColorSelectionField allColorField;
113: JComboBox topStyleCombo;
114: BorderWidthField topWidthField;
115: ColorSelectionField topColorField;
116: JComboBox bottomStyleCombo;
117: BorderWidthField bottomWidthField;
118: ColorSelectionField bottomColorField;
119: JComboBox leftStyleCombo;
120: BorderWidthField leftWidthField;
121: ColorSelectionField leftColorField;
122: JComboBox rightStyleCombo;
123: BorderWidthField rightWidthField;
124: ColorSelectionField rightColorField;
125:
126: public BorderDataTable() {
127: setLayout(new FlexibleGridLayout(6, 4, 5, 5));
128: FontMetrics fontMetrics = getFontMetrics(getFont());
129: int aheight = (fontMetrics.getHeight() + 10) > 25 ? (fontMetrics
130: .getHeight() + 10)
131: : 25;
132: initCells(aheight);
133: getAccessibleContext().setAccessibleName(
134: NbBundle.getMessage(BorderDataTable.class,
135: "BORDER_STYLE_TABLE_ACCESS_NAME"));
136: getAccessibleContext().setAccessibleDescription(
137: NbBundle.getMessage(BorderDataTable.class,
138: "BORDER_STYLE_TABLE_ACCESS_DESC"));
139: }
140:
141: protected void setCssPropertyValues(CssRuleContent cssStyleData) {
142: removeCssPropertyChangeListener();
143:
144: // Set the values for the Border Style
145: String topStyle = cssStyleData
146: .getProperty(CssProperties.BORDER_TOP_STYLE);
147: String bottomStyle = cssStyleData
148: .getProperty(CssProperties.BORDER_BOTTOM_STYLE);
149: String leftStyle = cssStyleData
150: .getProperty(CssProperties.BORDER_LEFT_STYLE);
151: String rightStyle = cssStyleData
152: .getProperty(CssProperties.BORDER_RIGHT_STYLE);
153:
154: if ((topStyle != null) && (bottomStyle != null)
155: && (leftStyle != null) && (rightStyle != null)
156: && (topStyle.equals(bottomStyle))
157: && (topStyle.equals(leftStyle))
158: && (topStyle.equals(rightStyle))) {
159: allStyleCombo.setSelectedItem(topStyle);
160: } else {
161: allStyleCombo.setSelectedIndex(0);
162: if (topStyle != null) {
163: topStyleCombo.setSelectedItem(topStyle);
164: } else {
165: topStyleCombo.setSelectedIndex(0);
166: }
167: if (bottomStyle != null) {
168: bottomStyleCombo.setSelectedItem(bottomStyle);
169: } else {
170: bottomStyleCombo.setSelectedIndex(0);
171: }
172: if (leftStyle != null) {
173: leftStyleCombo.setSelectedItem(leftStyle);
174: } else {
175: leftStyleCombo.setSelectedIndex(0);
176: }
177: if (rightStyle != null) {
178: rightStyleCombo.setSelectedItem(rightStyle);
179: } else {
180: rightStyleCombo.setSelectedIndex(0);
181: }
182: }
183:
184: // Set the value for the Border Width
185: String topWidth = cssStyleData
186: .getProperty(CssProperties.BORDER_TOP_WIDTH);
187: String bottomWidth = cssStyleData
188: .getProperty(CssProperties.BORDER_BOTTOM_WIDTH);
189: String leftWidth = cssStyleData
190: .getProperty(CssProperties.BORDER_LEFT_WIDTH);
191: String rightWidth = cssStyleData
192: .getProperty(CssProperties.BORDER_RIGHT_WIDTH);
193:
194: if ((topWidth != null) && (bottomWidth != null)
195: && (leftWidth != null) && (rightWidth != null)
196: && (topWidth.equals(bottomWidth))
197: && (topWidth.equals(leftWidth))
198: && (topWidth.equals(rightWidth))) {
199: allWidthField.setWidthString(topWidth);
200: } else {
201: allWidthField.setWidthString(null);
202: topWidthField.setWidthString(topWidth);
203: bottomWidthField.setWidthString(bottomWidth);
204: leftWidthField.setWidthString(leftWidth);
205: rightWidthField.setWidthString(rightWidth);
206: }
207:
208: // Set the value for the Border Width
209: String topColor = cssStyleData
210: .getProperty(CssProperties.BORDER_TOP_COLOR);
211: String bottomColor = cssStyleData
212: .getProperty(CssProperties.BORDER_BOTTOM_COLOR);
213: String leftColor = cssStyleData
214: .getProperty(CssProperties.BORDER_LEFT_COLOR);
215: String rightColor = cssStyleData
216: .getProperty(CssProperties.BORDER_RIGHT_COLOR);
217:
218: if ((topColor != null) && (bottomColor != null)
219: && (leftColor != null) && (rightColor != null)
220: && (topColor.equals(bottomColor))
221: && (topColor.equals(leftColor))
222: && (topColor.equals(rightColor))) {
223: allColorField.setColorString(topColor);
224: } else {
225: allColorField.setColorString(null);
226: topColorField.setColorString(topColor);
227: bottomColorField.setColorString(bottomColor);
228: leftColorField.setColorString(leftColor);
229: rightColorField.setColorString(rightColor);
230: }
231:
232: borderDataTable.validate();
233: borderDataTable.repaint();
234: setCssPropertyChangeListener(cssStyleData);
235: }
236:
237: public void initCells(int aheight) {
238: JLabel colHeader1 = new JLabel("");
239: //colHeader1.add(new JLabel(NbBundle.getMessage(BorderDataTable.class, "BORDER_SIDE")));
240: //setValueAt(colHeader1, 0, 0 );
241: JPanel colHeader2 = new JPanel();
242: colHeader2.add(new JLabel(NbBundle.getMessage(
243: BorderDataTable.class, "BORDER_STYLE")));
244:
245: JPanel colHeader3 = new JPanel();
246: colHeader3.add(new JLabel(NbBundle.getMessage(
247: BorderDataTable.class, "BORDER_WIDTH")));
248:
249: JPanel colHeader6 = new JPanel();
250: colHeader6.add(new JLabel(NbBundle.getMessage(
251: BorderDataTable.class, "BORDER_COLOR")));
252:
253: JPanel rowHeader1 = new JPanel();
254: rowHeader1.add(new JLabel(NbBundle.getMessage(
255: BorderDataTable.class, "BORDER_ALL")));
256:
257: JPanel rowHeader2 = new JPanel();
258: rowHeader2.add(new JLabel(NbBundle.getMessage(
259: BorderDataTable.class, "BORDER_TOP")));
260:
261: JPanel rowHeader3 = new JPanel();
262: rowHeader3.add(new JLabel(NbBundle.getMessage(
263: BorderDataTable.class, "BORDER_BOTTOM")));
264:
265: JPanel rowHeader4 = new JPanel();
266: rowHeader4.add(new JLabel(NbBundle.getMessage(
267: BorderDataTable.class, "BORDER_LEFT")));
268:
269: JPanel rowHeader5 = new JPanel();
270: rowHeader5.add(new JLabel(NbBundle.getMessage(
271: BorderDataTable.class, "BORDER_RIGHT")));
272:
273: // All Side Style
274: allStyleCombo = new JComboBox();
275: allStyleCombo.getAccessibleContext().setAccessibleName(
276: NbBundle.getMessage(BorderDataTable.class,
277: "ALL_SIDE_BORDER_STYLE_ACCESS_NAME"));
278: allStyleCombo
279: .getAccessibleContext()
280: .setAccessibleDescription(
281: NbBundle
282: .getMessage(BorderDataTable.class,
283: "ALL_SIDE_BORDER_STYLE_ACCESS_DESC"));
284: allStyleCombo.setModel(borderModel.getStyleList());
285: allStyleCombo.addItemListener(new ItemListener() {
286:
287: public void itemStateChanged(ItemEvent evt) {
288: //cssPropertyChangeSupport().firePropertyChange(CssStyleData.BORDER_STYLE, null, allStyleCombo.getSelectedItem().toString());
289: topStyleCombo.setSelectedIndex(allStyleCombo
290: .getSelectedIndex());
291: bottomStyleCombo.setSelectedIndex(allStyleCombo
292: .getSelectedIndex());
293: leftStyleCombo.setSelectedIndex(allStyleCombo
294: .getSelectedIndex());
295: rightStyleCombo.setSelectedIndex(allStyleCombo
296: .getSelectedIndex());
297: }
298: });
299:
300: // All Side Width
301: allWidthField = new BorderWidthField();
302: allWidthField.setAccessibleName(NbBundle.getMessage(
303: BorderDataTable.class,
304: "ALL_SIDE_BORDER_WIDTH_ACCESS_NAME"), NbBundle
305: .getMessage(BorderDataTable.class,
306: "ALL_SIDE_BORDER_WIDTH_UNIT_ACCESS_NAME"));
307: allWidthField.setAccessibleDescription(NbBundle.getMessage(
308: BorderDataTable.class,
309: "ALL_SIDE_BORDER_WIDTH_ACCESS_DESC"), NbBundle
310: .getMessage(BorderDataTable.class,
311: "ALL_SIDE_BORDER_WIDTH_UNIT_ACCESS_DESC"));
312: allWidthField.addPropertyChangeListener("border-width",
313: new PropertyChangeListenerImpl() {
314:
315: //NOI18N
316: public void propertyChange(
317: PropertyChangeEvent evt) {
318: //cssPropertyChangeSupport().firePropertyChange(CssStyleData.BORDER_WIDTH, null, evt.getNewValue().toString());
319: topWidthField.setWidthString(evt
320: .getNewValue().toString());
321: bottomWidthField.setWidthString(evt
322: .getNewValue().toString());
323: leftWidthField.setWidthString(evt
324: .getNewValue().toString());
325: rightWidthField.setWidthString(evt
326: .getNewValue().toString());
327: }
328: });
329:
330: // All Side Width
331: allColorField = new ColorSelectionField();
332: allColorField.addPropertyChangeListener("color",
333: new PropertyChangeListenerImpl() {
334:
335: //NOI18N
336: public void propertyChange(
337: PropertyChangeEvent evt) {
338: //cssPropertyChangeSupport().firePropertyChange(CssStyleData.BORDER_COLOR, null, allColorField.getColorString());
339: topColorField.setColorString(allColorField
340: .getColorString());
341: bottomColorField
342: .setColorString(allColorField
343: .getColorString());
344: leftColorField.setColorString(allColorField
345: .getColorString());
346: rightColorField
347: .setColorString(allColorField
348: .getColorString());
349: }
350: });
351:
352: // Top Side Style
353: topStyleCombo = new JComboBox();
354: topStyleCombo.getAccessibleContext().setAccessibleName(
355: NbBundle.getMessage(BorderDataTable.class,
356: "TOP_SIDE_BORDER_STYLE_ACCESS_NAME"));
357: topStyleCombo
358: .getAccessibleContext()
359: .setAccessibleDescription(
360: NbBundle
361: .getMessage(BorderDataTable.class,
362: "TOP_SIDE_BORDER_STYLE_ACCESS_DESC"));
363: topStyleCombo.setModel(borderModel.getStyleList());
364: topStyleCombo.addItemListener(new ItemListener() {
365:
366: public void itemStateChanged(ItemEvent evt) {
367: if (evt.getStateChange() == ItemEvent.SELECTED) {
368: PropertyData pd = new PropertyData();
369: pd.setValue(evt.getItem().toString());
370: cssPropertyChangeSupport().firePropertyChange(
371: CssProperties.BORDER_TOP_STYLE, null,
372: pd.toString());
373: }
374: }
375: });
376:
377: // Top Side Width
378: topWidthField = new BorderWidthField();
379: topWidthField.setAccessibleName(NbBundle.getMessage(
380: BorderDataTable.class,
381: "TOP_SIDE_BORDER_WIDTH_ACCESS_NAME"), NbBundle
382: .getMessage(BorderDataTable.class,
383: "TOP_SIDE_BORDER_WIDTH_UNIT_ACCESS_NAME"));
384: topWidthField.setAccessibleDescription(NbBundle.getMessage(
385: BorderDataTable.class,
386: "TOP_SIDE_BORDER_WIDTH_ACCESS_DESC"), NbBundle
387: .getMessage(BorderDataTable.class,
388: "TOP_SIDE_BORDER_WIDTH_UNIT_ACCESS_DESC"));
389: topWidthField.addPropertyChangeListener("border-width",
390: new PropertyChangeListenerImpl() {
391:
392: //NOI18N
393: public void propertyChange(
394: PropertyChangeEvent evt) {
395: cssPropertyChangeSupport()
396: .firePropertyChange(
397: CssProperties.BORDER_TOP_WIDTH,
398: null,
399: evt.getNewValue()
400: .toString());
401: }
402: });
403:
404: // Top Side Color
405: topColorField = new ColorSelectionField();
406: topColorField.addPropertyChangeListener("color",
407: new PropertyChangeListenerImpl() {
408:
409: //NOI18N
410: public void propertyChange(
411: PropertyChangeEvent evt) {
412: cssPropertyChangeSupport()
413: .firePropertyChange(
414: CssProperties.BORDER_TOP_COLOR,
415: null,
416: evt.getNewValue()
417: .toString());
418: }
419: });
420:
421: // Bottom Side Style
422: bottomStyleCombo = new JComboBox();
423: bottomStyleCombo.getAccessibleContext().setAccessibleName(
424: NbBundle.getMessage(BorderDataTable.class,
425: "BOTTOM_SIDE_BORDER_STYLE_ACCESS_NAME"));
426: bottomStyleCombo
427: .getAccessibleContext()
428: .setAccessibleDescription(
429: NbBundle
430: .getMessage(BorderDataTable.class,
431: "BOTTOM_SIDE_BORDER_STYLE_ACCESS_DESC"));
432: bottomStyleCombo.setModel(borderModel.getStyleList());
433: bottomStyleCombo.addItemListener(new ItemListener() {
434: public void itemStateChanged(ItemEvent evt) {
435: if (evt.getStateChange() == ItemEvent.SELECTED) {
436: PropertyData pd = new PropertyData();
437: pd.setValue(evt.getItem().toString());
438: cssPropertyChangeSupport().firePropertyChange(
439: CssProperties.BORDER_BOTTOM_STYLE,
440: null, pd.toString());
441: }
442: }
443: });
444:
445: // Bottom Side Width
446: bottomWidthField = new BorderWidthField();
447: bottomWidthField
448: .setAccessibleName(
449: NbBundle
450: .getMessage(BorderDataTable.class,
451: "BOTTOM_SIDE_BORDER_WIDTH_ACCESS_NAME"),
452: NbBundle
453: .getMessage(BorderDataTable.class,
454: "BOTTOM_SIDE_BORDER_WIDTH_UNIT_ACCESS_NAME"));
455: bottomWidthField
456: .setAccessibleDescription(
457: NbBundle
458: .getMessage(BorderDataTable.class,
459: "BOTTOM_SIDE_BORDER_WIDTH_ACCESS_DESC"),
460: NbBundle
461: .getMessage(BorderDataTable.class,
462: "BOTTOM_SIDE_BORDER_WIDTH_UNIT_ACCESS_DESC"));
463: bottomWidthField.addPropertyChangeListener("border-width",
464: new PropertyChangeListenerImpl() {
465:
466: //NOI18N
467: public void propertyChange(
468: PropertyChangeEvent evt) {
469: cssPropertyChangeSupport()
470: .firePropertyChange(
471: CssProperties.BORDER_BOTTOM_WIDTH,
472: null,
473: evt.getNewValue()
474: .toString());
475: }
476: });
477:
478: // Bottom Side Width
479: bottomColorField = new ColorSelectionField();
480: bottomColorField.addPropertyChangeListener("color",
481: new PropertyChangeListenerImpl() {
482:
483: //NOI18N
484: public void propertyChange(
485: PropertyChangeEvent evt) {
486: cssPropertyChangeSupport()
487: .firePropertyChange(
488: CssProperties.BORDER_BOTTOM_COLOR,
489: null,
490: evt.getNewValue()
491: .toString());
492: }
493: });
494:
495: // Left Side Style
496: leftStyleCombo = new JComboBox(new String[] {});
497: leftStyleCombo.getAccessibleContext().setAccessibleName(
498: NbBundle.getMessage(BorderDataTable.class,
499: "LEFT_SIDE_BORDER_STYLE_ACCESS_NAME"));
500: leftStyleCombo
501: .getAccessibleContext()
502: .setAccessibleDescription(
503: NbBundle
504: .getMessage(BorderDataTable.class,
505: "LEFT_SIDE_BORDER_STYLE_ACCESS_DESC"));
506: leftStyleCombo.setModel(borderModel.getStyleList());
507: leftStyleCombo.addItemListener(new ItemListener() {
508: public void itemStateChanged(ItemEvent evt) {
509: if (evt.getStateChange() == ItemEvent.SELECTED) {
510: PropertyData pd = new PropertyData();
511: pd.setValue(evt.getItem().toString());
512: cssPropertyChangeSupport().firePropertyChange(
513: CssProperties.BORDER_LEFT_STYLE, null,
514: pd.toString());
515: }
516: }
517: });
518:
519: // Left Side Width
520: leftWidthField = new BorderWidthField();
521: leftWidthField.setAccessibleName(NbBundle.getMessage(
522: BorderDataTable.class,
523: "LEFT_SIDE_BORDER_WIDTH_ACCESS_NAME"), NbBundle
524: .getMessage(BorderDataTable.class,
525: "LEFT_SIDE_BORDER_WIDTH_UNIT_ACCESS_NAME"));
526: leftWidthField.setAccessibleDescription(NbBundle
527: .getMessage(BorderDataTable.class,
528: "LEFT_SIDE_BORDER_WIDTH_ACCESS_DESC"),
529: NbBundle.getMessage(BorderDataTable.class,
530: "LEFT_SIDE_BORDER_WIDTH_UNIT_ACCESS_DESC"));
531: // Set the Left Side data
532: leftWidthField.addPropertyChangeListener("border-width",
533: new PropertyChangeListenerImpl() {
534:
535: //NOI18N
536: public void propertyChange(
537: PropertyChangeEvent evt) {
538: cssPropertyChangeSupport()
539: .firePropertyChange(
540: CssProperties.BORDER_LEFT_WIDTH,
541: null,
542: evt.getNewValue()
543: .toString());
544: }
545: });
546:
547: // Left Side Width
548: leftColorField = new ColorSelectionField();
549: leftColorField.addPropertyChangeListener("color",
550: new PropertyChangeListenerImpl() {
551:
552: //NOI18N
553: public void propertyChange(
554: PropertyChangeEvent evt) {
555: cssPropertyChangeSupport()
556: .firePropertyChange(
557: CssProperties.BORDER_LEFT_COLOR,
558: null,
559: evt.getNewValue()
560: .toString());
561: }
562: });
563:
564: // Right Side Style
565: rightStyleCombo = new JComboBox();
566: rightStyleCombo.getAccessibleContext().setAccessibleName(
567: NbBundle.getMessage(BorderDataTable.class,
568: "RIGHT_SIDE_BORDER_STYLE_ACCESS_NAME"));
569: rightStyleCombo
570: .getAccessibleContext()
571: .setAccessibleDescription(
572: NbBundle
573: .getMessage(BorderDataTable.class,
574: "RIGHT_SIDE_BORDER_STYLE_ACCESS_DESC"));
575: rightStyleCombo.setModel(borderModel.getStyleList());
576: rightStyleCombo.addItemListener(new ItemListener() {
577: public void itemStateChanged(ItemEvent evt) {
578: if (evt.getStateChange() == ItemEvent.SELECTED) {
579: PropertyData pd = new PropertyData();
580: pd.setValue(evt.getItem().toString());
581: cssPropertyChangeSupport().firePropertyChange(
582: CssProperties.BORDER_RIGHT_STYLE, null,
583: pd.toString());
584: }
585: }
586:
587: });
588:
589: // Right Side Width
590: rightWidthField = new BorderWidthField();
591: rightWidthField
592: .setAccessibleName(
593: NbBundle
594: .getMessage(BorderDataTable.class,
595: "RIGHT_SIDE_BORDER_WIDTH_ACCESS_NAME"),
596: NbBundle
597: .getMessage(BorderDataTable.class,
598: "RIGHT_SIDE_BORDER_WIDTH_UNIT_ACCESS_NAME"));
599: rightWidthField
600: .setAccessibleDescription(
601: NbBundle
602: .getMessage(BorderDataTable.class,
603: "RIGHT_SIDE_BORDER_WIDTH_ACCESS_DESC"),
604: NbBundle
605: .getMessage(BorderDataTable.class,
606: "RIGHT_SIDE_BORDER_WIDTH_UNIT_ACCESS_DESC"));
607: rightWidthField.addPropertyChangeListener("border-width",
608: new PropertyChangeListenerImpl() {
609:
610: //NOI18N
611: public void propertyChange(
612: PropertyChangeEvent evt) {
613: cssPropertyChangeSupport()
614: .firePropertyChange(
615: CssProperties.BORDER_RIGHT_WIDTH,
616: null,
617: evt.getNewValue()
618: .toString());
619: }
620: });
621:
622: // Right Side Width
623: rightColorField = new ColorSelectionField();
624: rightColorField.addPropertyChangeListener("color",
625: new PropertyChangeListenerImpl() {
626:
627: //NOI18N
628: public void propertyChange(
629: PropertyChangeEvent evt) {
630: cssPropertyChangeSupport()
631: .firePropertyChange(
632: CssProperties.BORDER_RIGHT_COLOR,
633: null,
634: evt.getNewValue()
635: .toString());
636: }
637: });
638:
639: add(colHeader1);
640: add(colHeader2);
641: add(colHeader3);
642: add(colHeader6);
643: add(rowHeader1);
644: add(allStyleCombo);
645: add(allWidthField);
646: add(allColorField);
647: add(rowHeader2);
648: add(topStyleCombo);
649: add(topWidthField);
650: add(topColorField);
651: add(rowHeader3);
652: add(bottomStyleCombo);
653: add(bottomWidthField);
654: add(bottomColorField);
655: add(rowHeader4);
656: add(leftStyleCombo);
657: add(leftWidthField);
658: add(leftColorField);
659: add(rowHeader5);
660: add(rightStyleCombo);
661: add(rightWidthField);
662: add(rightColorField);
663: int cnt = getComponentCount();
664: int[] widths = { 50, 75, 125, 125 };
665: for (int i = 0; i < cnt; i++) {
666: int awidth = widths[i % 4];
667: getComponent(i).setPreferredSize(
668: new Dimension(awidth, aheight));
669: getComponent(i).setMinimumSize(
670: new Dimension(awidth, aheight));
671: getComponent(i).setMaximumSize(
672: new Dimension(awidth, aheight));
673: }
674: }
675:
676: class PropertyChangeListenerImpl implements
677: PropertyChangeListener {
678:
679: public void propertyChange(PropertyChangeEvent evt) {
680: }
681: }
682: }
683:
684: // Variables declaration - do not modify//GEN-BEGIN:variables
685: private javax.swing.JPanel borderPanel;
686: // End of variables declaration//GEN-END:variables
687: }
|