1 19 20 25 26 package org.netbeans.modules.css.visual.ui; 27 28 import org.netbeans.modules.css.visual.model.CssStyleData; 29 import java.awt.BorderLayout ; 30 import java.awt.Image ; 31 import java.beans.PropertyChangeSupport ; 32 import java.util.ArrayList ; 33 import java.util.List ; 34 import javax.swing.JPanel ; 35 import org.openide.util.NbBundle; 36 37 42 public class StyleBuilderPanel extends JPanel { 43 JPanel currentEditor; 44 String currentStyle = null; 45 private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport (this); 46 47 Image previewImage = null; 48 49 StyleEditorListPanel styleEditorListPanel = null; 50 51 List styleEditorList = new ArrayList (); 52 String noPreviewLabel = NbBundle.getMessage(StyleBuilderPanel.class, "NO_PREVIEW"); 53 54 55 public StyleBuilderPanel() { 56 initComponents(); 57 initialize(); 58 } 59 60 private void initialize(){ 61 styleEditorListPanel = new StyleEditorListPanel(this); 62 63 styleEditorList.add(new FontStyleEditor()); 64 BackgroundStyleEditor bgStyleEditor = new BackgroundStyleEditor(); 65 styleEditorList.add(bgStyleEditor); 66 styleEditorList.add(new TextBlockStyleEditor()); 67 styleEditorList.add(new BorderStyleEditor()); 68 styleEditorList.add(new MarginStyleEditor()); 69 styleEditorList.add(new PositionStyleEditor()); 70 73 for(int i=0; i< styleEditorList.size(); i++){ 74 StyleEditor styleEitor = (StyleEditor)styleEditorList.get(i); 75 styleEditorListPanel.addEditor(styleEitor); 76 } 77 styleEditorListPanel.setSelectedEditor((StyleEditor)styleEditorList.get(0)); 78 setEditorListPanel(styleEditorListPanel); 79 } 80 81 public void setCssStyleData(final CssStyleData cssStyleData){ 82 for(int i=0; i< styleEditorList.size(); i++){ 83 StyleEditor styleEitor = (StyleEditor)styleEditorList.get(i); 84 styleEitor.setCssPropertyValues(cssStyleData); 85 } 86 } 87 88 private void initComponents() { 90 styleEditorSplitPane = new javax.swing.JSplitPane (); 91 editorListPanel = new javax.swing.JPanel (); 92 editorPanel = new javax.swing.JPanel (); 93 94 setLayout(new java.awt.BorderLayout ()); 95 96 editorListPanel.setLayout(new java.awt.BorderLayout ()); 97 98 editorListPanel.setBorder(new javax.swing.border.EmptyBorder (new java.awt.Insets (3, 3, 3, 3))); 99 styleEditorSplitPane.setLeftComponent(editorListPanel); 100 101 editorPanel.setLayout(new java.awt.BorderLayout ()); 102 103 styleEditorSplitPane.setRightComponent(editorPanel); 104 105 add(styleEditorSplitPane, java.awt.BorderLayout.CENTER); 106 107 } 108 110 113 public void setEditorListPanel(JPanel panel){ 114 editorListPanel.add(panel,BorderLayout.CENTER); 115 repaint(); 116 } 117 118 123 public void setEditorPanel(JPanel panel){ 124 if(currentEditor != null) { 125 editorPanel.remove(currentEditor); 126 } 127 currentEditor = panel; 128 editorPanel.add(currentEditor,BorderLayout.CENTER); 129 validate(); 130 repaint(); 131 } 132 133 private javax.swing.JPanel editorListPanel; 135 private javax.swing.JPanel editorPanel; 136 private javax.swing.JSplitPane styleEditorSplitPane; 137 139 } 140 | Popular Tags |