1 21 22 package org.gjt.sp.jedit.options; 23 24 import javax.swing.*; 26 import java.awt.event.*; 27 import java.awt.*; 28 import org.gjt.sp.jedit.gui.ColorWellButton; 29 import org.gjt.sp.jedit.*; 30 32 public class StatusBarOptionPane extends AbstractOptionPane 33 { 34 public StatusBarOptionPane() 36 { 37 super("status"); 38 } 40 protected void _init() 42 { 43 44 statusVisible = new JCheckBox(jEdit.getProperty( 45 "options.status.visible")); 46 statusVisible.setSelected(jEdit.getBooleanProperty( 47 "view.status.visible")); 48 statusVisible.addActionListener(new ActionHandler()); 49 addComponent(statusVisible); 50 51 52 addComponent(jEdit.getProperty("options.status.foreground"), 53 foregroundColor = new ColorWellButton( 54 jEdit.getColorProperty("view.status.foreground")), 55 GridBagConstraints.VERTICAL); 56 57 58 addComponent(jEdit.getProperty("options.status.background"), 59 backgroundColor = new ColorWellButton( 60 jEdit.getColorProperty("view.status.background")), 61 GridBagConstraints.VERTICAL); 62 63 64 showCaretStatus = new JCheckBox(jEdit.getProperty( 65 "options.status.show-caret-status")); 66 showCaretStatus.setSelected(jEdit.getBooleanProperty( 67 "view.status.show-caret-status")); 68 addComponent(showCaretStatus); 69 70 71 showEditMode = new JCheckBox(jEdit.getProperty( 72 "options.status.show-edit-mode")); 73 showEditMode.setSelected(jEdit.getBooleanProperty( 74 "view.status.show-edit-mode")); 75 addComponent(showEditMode); 76 77 78 showFoldMode = new JCheckBox(jEdit.getProperty( 79 "options.status.show-fold-mode")); 80 showFoldMode.setSelected(jEdit.getBooleanProperty( 81 "view.status.show-fold-mode")); 82 addComponent(showFoldMode); 83 84 85 showEncoding = new JCheckBox(jEdit.getProperty( 86 "options.status.show-encoding")); 87 showEncoding.setSelected(jEdit.getBooleanProperty( 88 "view.status.show-encoding")); 89 addComponent(showEncoding); 90 91 92 showWrap = new JCheckBox(jEdit.getProperty( 93 "options.status.show-wrap")); 94 showWrap.setSelected(jEdit.getBooleanProperty( 95 "view.status.show-wrap")); 96 addComponent(showWrap); 97 98 99 showMultiSelect = new JCheckBox(jEdit.getProperty( 100 "options.status.show-multi-select")); 101 showMultiSelect.setSelected(jEdit.getBooleanProperty( 102 "view.status.show-multi-select")); 103 addComponent(showMultiSelect); 104 105 106 showRectSelect = new JCheckBox(jEdit.getProperty( 107 "options.status.show-rect-select")); 108 showRectSelect.setSelected(jEdit.getBooleanProperty( 109 "view.status.show-rect-select")); 110 addComponent(showRectSelect); 111 112 113 showOverwrite = new JCheckBox(jEdit.getProperty( 114 "options.status.show-overwrite")); 115 showOverwrite.setSelected(jEdit.getBooleanProperty( 116 "view.status.show-overwrite")); 117 addComponent(showOverwrite); 118 119 120 showLineSeperator = new JCheckBox(jEdit.getProperty( 121 "options.status.show-line-seperator")); 122 showLineSeperator.setSelected(jEdit.getBooleanProperty( 123 "view.status.show-line-seperator")); 124 addComponent(showLineSeperator); 125 126 127 showMemory = new JCheckBox(jEdit.getProperty( 128 "options.status.show-memory")); 129 showMemory.setSelected(jEdit.getBooleanProperty( 130 "view.status.show-memory")); 131 showMemory.addActionListener(new ActionHandler()); 132 addComponent(showMemory); 133 134 135 addComponent(jEdit.getProperty("options.status.memory.foreground"), 136 memForegroundColor = new ColorWellButton( 137 jEdit.getColorProperty("view.status.memory.foreground")), 138 GridBagConstraints.VERTICAL); 139 140 141 addComponent(jEdit.getProperty("options.status.memory.background"), 142 memBackgroundColor = new ColorWellButton( 143 jEdit.getColorProperty("view.status.memory.background")), 144 GridBagConstraints.VERTICAL); 145 146 147 showClock = new JCheckBox(jEdit.getProperty( 148 "options.status.show-clock")); 149 showClock.setSelected(jEdit.getBooleanProperty( 150 "view.status.show-clock")); 151 showClock.addActionListener(new ActionHandler()); 152 addComponent(showClock); 153 154 updateEnabled(); 155 } 157 protected void _save() 159 { 160 jEdit.setBooleanProperty("view.status.visible", 161 statusVisible.isSelected()); 162 jEdit.setColorProperty("view.status.foreground",foregroundColor 163 .getSelectedColor()); 164 jEdit.setColorProperty("view.status.background",backgroundColor 165 .getSelectedColor()); 166 jEdit.setBooleanProperty("view.status.show-caret-status", 167 showCaretStatus.isSelected()); 168 jEdit.setBooleanProperty("view.status.show-edit-mode", 169 showEditMode.isSelected()); 170 jEdit.setBooleanProperty("view.status.show-fold-mode", 171 showFoldMode.isSelected()); 172 jEdit.setBooleanProperty("view.status.show-encoding", 173 showEncoding.isSelected()); 174 jEdit.setBooleanProperty("view.status.show-wrap", 175 showWrap.isSelected()); 176 jEdit.setBooleanProperty("view.status.show-multi-select", 177 showMultiSelect.isSelected()); 178 jEdit.setBooleanProperty("view.status.show-rect-select", 179 showRectSelect.isSelected()); 180 jEdit.setBooleanProperty("view.status.show-overwrite", 181 showOverwrite.isSelected()); 182 jEdit.setBooleanProperty("view.status.show-line-seperator", 183 showLineSeperator.isSelected()); 184 jEdit.setBooleanProperty("view.status.show-memory", 185 showMemory.isSelected()); 186 jEdit.setColorProperty("view.status.memory.foreground",memForegroundColor 187 .getSelectedColor()); 188 jEdit.setColorProperty("view.status.memory.background",memBackgroundColor 189 .getSelectedColor()); 190 jEdit.setBooleanProperty("view.status.show-clock", 191 showClock.isSelected()); 192 } 194 private JCheckBox statusVisible; 196 private ColorWellButton foregroundColor; 197 private ColorWellButton backgroundColor; 198 private JCheckBox showCaretStatus; 199 private JCheckBox showEditMode; 200 private JCheckBox showFoldMode; 201 private JCheckBox showEncoding; 202 private JCheckBox showWrap; 203 private JCheckBox showMultiSelect; 204 private JCheckBox showRectSelect; 205 private JCheckBox showOverwrite; 206 private JCheckBox showLineSeperator; 207 private JCheckBox showMemory; 208 private ColorWellButton memForegroundColor; 209 private ColorWellButton memBackgroundColor; 210 private JCheckBox showClock; 211 212 private void updateEnabled() 213 { 214 boolean enabled = statusVisible.isSelected(); 215 showCaretStatus.setEnabled(enabled); 216 showEditMode.setEnabled(enabled); 217 showFoldMode.setEnabled(enabled); 218 showEncoding.setEnabled(enabled); 219 showWrap.setEnabled(enabled); 220 showMultiSelect.setEnabled(enabled); 221 showRectSelect.setEnabled(enabled); 222 showOverwrite.setEnabled(enabled); 223 showLineSeperator.setEnabled(enabled); 224 showMemory.setEnabled(enabled); 225 memForegroundColor.setEnabled(enabled && showMemory.isSelected()); 226 memBackgroundColor.setEnabled(enabled && showMemory.isSelected()); 227 showClock.setEnabled(enabled); 228 } 229 231 class ActionHandler implements ActionListener 233 { 234 public void actionPerformed(ActionEvent evt) 235 { 236 updateEnabled(); 237 } 238 } } 240 | Popular Tags |