| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package us.paulevans.basicxslt; |
| 17 | |
|
| 18 | |
import java.awt.BorderLayout; |
| 19 | |
import java.awt.Color; |
| 20 | |
import java.awt.FlowLayout; |
| 21 | |
import java.awt.Font; |
| 22 | |
import java.awt.GridBagConstraints; |
| 23 | |
import java.awt.GridBagLayout; |
| 24 | |
import java.awt.event.ActionEvent; |
| 25 | |
import java.awt.event.ActionListener; |
| 26 | |
import java.awt.event.WindowAdapter; |
| 27 | |
import java.awt.event.WindowEvent; |
| 28 | |
import java.io.IOException; |
| 29 | |
|
| 30 | |
import javax.swing.ButtonGroup; |
| 31 | |
import javax.swing.JButton; |
| 32 | |
import javax.swing.JCheckBox; |
| 33 | |
import javax.swing.JFrame; |
| 34 | |
import javax.swing.JLabel; |
| 35 | |
import javax.swing.JPanel; |
| 36 | |
import javax.swing.JRadioButton; |
| 37 | |
import javax.swing.JScrollPane; |
| 38 | |
import javax.swing.JSeparator; |
| 39 | |
import javax.swing.JTextArea; |
| 40 | |
import javax.swing.JTextField; |
| 41 | |
|
| 42 | |
import net.blueslate.commons.gui.GUIUtils; |
| 43 | |
import net.blueslate.commons.xml.TransformOutputProperties; |
| 44 | |
|
| 45 | |
import org.apache.commons.lang.BooleanUtils; |
| 46 | |
import org.apache.commons.lang.StringUtils; |
| 47 | |
|
| 48 | |
|
| 49 | |
|
| 50 | |
|
| 51 | |
|
| 52 | |
|
| 53 | |
public class TransformOutputPropertiesFrame extends JFrame |
| 54 | |
implements ActionListener { |
| 55 | |
|
| 56 | |
|
| 57 | 0 | private static final LabelStringFactory stringFactory = |
| 58 | |
LabelStringFactory.getInstance(); |
| 59 | |
|
| 60 | |
|
| 61 | |
private static final int FRAME_WIDTH = 585; |
| 62 | |
private static final int FRAME_HEIGHT = 420; |
| 63 | |
|
| 64 | |
|
| 65 | |
private static final int XML_INDEX = 0; |
| 66 | |
private static final int HTML_INDEX = 1; |
| 67 | |
private static final int TEXT_INDEX = 2; |
| 68 | 0 | private static final String VALID_METHODS[] = { "xml", "html", "text" }; |
| 69 | |
|
| 70 | |
|
| 71 | |
private JButton cancelBtn, okayBtn; |
| 72 | |
private XSLRow xslRow; |
| 73 | |
private JTextArea CDATASectionElements; |
| 74 | |
private JTextField doctypePublic, doctypeSystem, encoding, mediaType, |
| 75 | |
version; |
| 76 | |
private JRadioButton xml, html, text, other; |
| 77 | |
private JTextField otherMethod; |
| 78 | |
private JCheckBox indent, omitXmlDeclaration, standalone; |
| 79 | |
private BasicXSLTFrame parent; |
| 80 | |
private TransformOutputProperties xmlIdentityTransformOutputProps; |
| 81 | |
|
| 82 | |
|
| 83 | |
|
| 84 | |
|
| 85 | |
|
| 86 | |
|
| 87 | |
|
| 88 | |
public TransformOutputPropertiesFrame(BasicXSLTFrame aParent, |
| 89 | |
TransformOutputProperties aXmlIdentityTransformOutputProps, |
| 90 | 0 | String aXmlFile) { |
| 91 | 0 | parent = aParent; |
| 92 | 0 | xmlIdentityTransformOutputProps = aXmlIdentityTransformOutputProps; |
| 93 | 0 | buildGui(buildNorthPanel(stringFactory.getString( |
| 94 | |
LabelStringFactory.OUTPUTPROPS_FRAME_IT_OUTPUT_PROPERTIES), |
| 95 | |
aXmlFile), xmlIdentityTransformOutputProps); |
| 96 | 0 | } |
| 97 | |
|
| 98 | |
|
| 99 | |
|
| 100 | |
|
| 101 | |
|
| 102 | |
|
| 103 | |
|
| 104 | |
public TransformOutputPropertiesFrame(BasicXSLTFrame aParent, |
| 105 | 0 | XSLRow aXSLRow) { |
| 106 | 0 | parent = aParent; |
| 107 | 0 | xslRow = aXSLRow; |
| 108 | 0 | buildGui(buildNorthPanel(stringFactory.getString( |
| 109 | |
LabelStringFactory. |
| 110 | |
OUTPUTPROPS_FRAME_TRANSFORM_OUTPUT_PROPERTIES) + " (" |
| 111 | |
+ xslRow.getDescription() + ")", xslRow.getTextField().getText()), |
| 112 | |
xslRow.getTransformOutputProperties()); |
| 113 | 0 | } |
| 114 | |
|
| 115 | |
|
| 116 | |
|
| 117 | |
|
| 118 | |
|
| 119 | |
|
| 120 | |
private void buildGui(JPanel aNorthPanel, |
| 121 | |
TransformOutputProperties aOutputProps) { |
| 122 | |
|
| 123 | |
JPanel southPanel, mainPanel; |
| 124 | |
|
| 125 | 0 | addWindowListener(new WindowAdapter() { |
| 126 | 0 | public void windowClosing(WindowEvent evt) { |
| 127 | 0 | dispose(); |
| 128 | 0 | } |
| 129 | |
}); |
| 130 | 0 | mainPanel = new JPanel(new BorderLayout()); |
| 131 | 0 | mainPanel.add(buildMainPanel(), BorderLayout.CENTER); |
| 132 | 0 | southPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); |
| 133 | 0 | southPanel.add(okayBtn = new JButton(stringFactory.getString( |
| 134 | |
LabelStringFactory.OK_BUTTON))); |
| 135 | 0 | southPanel.add(cancelBtn = new JButton(stringFactory.getString( |
| 136 | |
LabelStringFactory.CANCEL_BUTTON))); |
| 137 | 0 | okayBtn.addActionListener(this); |
| 138 | 0 | cancelBtn.addActionListener(this); |
| 139 | 0 | getContentPane().setLayout(new BorderLayout()); |
| 140 | 0 | getContentPane().add(aNorthPanel, BorderLayout.NORTH); |
| 141 | 0 | getContentPane().add(southPanel, BorderLayout.SOUTH); |
| 142 | 0 | getContentPane().add(new JScrollPane(mainPanel), BorderLayout.CENTER); |
| 143 | 0 | setTitle(stringFactory.getString(LabelStringFactory. |
| 144 | |
OUTPUTPROPS_FRAME_TRANSFORM_OUTPUT_PROPERTIES)); |
| 145 | 0 | setSize(FRAME_WIDTH, FRAME_HEIGHT); |
| 146 | 0 | GUIUtils.center(this, parent); |
| 147 | 0 | initializeGUI(aOutputProps); |
| 148 | 0 | setVisible(true); |
| 149 | 0 | } |
| 150 | |
|
| 151 | |
|
| 152 | |
|
| 153 | |
|
| 154 | |
|
| 155 | |
|
| 156 | |
|
| 157 | |
private JPanel buildNorthPanel(String aHeaderLabel, String aFile) { |
| 158 | |
|
| 159 | |
GridBagLayout layout; |
| 160 | |
GridBagConstraints constraints; |
| 161 | |
JPanel panel; |
| 162 | |
int row, col; |
| 163 | |
JLabel headerLabel, fileLabel; |
| 164 | |
|
| 165 | 0 | layout = new GridBagLayout(); |
| 166 | 0 | constraints = new GridBagConstraints(); |
| 167 | 0 | panel = new JPanel(layout); |
| 168 | 0 | headerLabel = new JLabel(aHeaderLabel); |
| 169 | 0 | row = 0; |
| 170 | 0 | col = 0; |
| 171 | 0 | headerLabel.setFont(new Font("arial", Font.PLAIN, 18)); |
| 172 | 0 | fileLabel = new JLabel(stringFactory.getString( |
| 173 | |
LabelStringFactory.OUTPUTPROPS_FRAME_FILE_LBL) + aFile); |
| 174 | 0 | fileLabel.setFont(new Font("arial", Font.PLAIN, 12)); |
| 175 | 0 | GUIUtils.add(panel, headerLabel, layout, constraints, row++, col, |
| 176 | |
1, 1, 1, 1, GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, |
| 177 | |
GUIUtils.MED_LARGE_INSETS); |
| 178 | 0 | GUIUtils.add(panel, new JSeparator(), layout, constraints, row++, col, |
| 179 | |
1, 1, 1, 1, GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, |
| 180 | |
GUIUtils.MED_LARGE_INSETS); |
| 181 | 0 | GUIUtils.add(panel, fileLabel, layout, constraints, row++, col, |
| 182 | |
1, 1, 1, 1, GridBagConstraints.NORTHEAST, |
| 183 | |
GridBagConstraints.BOTH, GUIUtils.MED_LARGE_INSETS); |
| 184 | 0 | return panel; |
| 185 | |
} |
| 186 | |
|
| 187 | |
|
| 188 | |
|
| 189 | |
|
| 190 | |
|
| 191 | |
private void initializeGUI(TransformOutputProperties aOutputProperties) { |
| 192 | |
|
| 193 | |
String method; |
| 194 | |
|
| 195 | 0 | CDATASectionElements.setText( |
| 196 | |
StringUtils.defaultString( |
| 197 | |
aOutputProperties.getCDATA_SECTION_ELEMENTS())); |
| 198 | 0 | doctypePublic.setText( |
| 199 | |
StringUtils.defaultString( |
| 200 | |
aOutputProperties.getDOCTYPE_PUBLIC())); |
| 201 | 0 | doctypeSystem.setText( |
| 202 | |
StringUtils.defaultString(aOutputProperties.getDOCTYPE_SYSTEM())); |
| 203 | 0 | encoding.setText( |
| 204 | |
StringUtils.defaultString(aOutputProperties.getENCODING())); |
| 205 | 0 | indent.setSelected( |
| 206 | |
BooleanUtils.toBoolean(aOutputProperties.getINDENT())); |
| 207 | 0 | mediaType.setText( |
| 208 | |
StringUtils.defaultString(aOutputProperties.getMEDIA_TYPE())); |
| 209 | 0 | version.setText( |
| 210 | |
StringUtils.defaultString(aOutputProperties.getVERSION())); |
| 211 | 0 | omitXmlDeclaration.setSelected( |
| 212 | |
BooleanUtils.toBoolean( |
| 213 | |
aOutputProperties.getOMIT_XML_DECLARATION())); |
| 214 | 0 | standalone.setSelected( |
| 215 | |
BooleanUtils.toBoolean(aOutputProperties.getSTANDALONE())); |
| 216 | 0 | method = aOutputProperties.getMETHOD(); |
| 217 | 0 | if (StringUtils.isNotBlank(method)) { |
| 218 | 0 | if (method.equals(VALID_METHODS[XML_INDEX])) { |
| 219 | 0 | xml.setSelected(true); |
| 220 | 0 | } else if (method.equals(VALID_METHODS[HTML_INDEX])) { |
| 221 | 0 | html.setSelected(true); |
| 222 | 0 | setEnableXmlCheckboxes(false); |
| 223 | 0 | } else if (method.equals(VALID_METHODS[TEXT_INDEX])) { |
| 224 | 0 | text.setSelected(true); |
| 225 | 0 | setEnableXmlCheckboxes(false); |
| 226 | 0 | } else { |
| 227 | 0 | setEnableXmlCheckboxes(false); |
| 228 | 0 | other.setSelected(true); |
| 229 | 0 | otherMethod.setEnabled(true); |
| 230 | 0 | otherMethod.setBackground(Color.WHITE); |
| 231 | 0 | otherMethod.setText(aOutputProperties.getMETHOD()); |
| 232 | |
} |
| 233 | 0 | } else { |
| 234 | 0 | xml.setSelected(true); |
| 235 | |
} |
| 236 | 0 | } |
| 237 | |
|
| 238 | |
|
| 239 | |
|
| 240 | |
|
| 241 | |
|
| 242 | |
private JPanel buildMainPanel() { |
| 243 | |
|
| 244 | |
int row; |
| 245 | |
GridBagLayout layout; |
| 246 | |
GridBagConstraints constraints; |
| 247 | |
JPanel main; |
| 248 | |
|
| 249 | 0 | layout = new GridBagLayout(); |
| 250 | 0 | constraints = new GridBagConstraints(); |
| 251 | 0 | main = new JPanel(layout); |
| 252 | 0 | row = 0; |
| 253 | 0 | GUIUtils.add(main, new JLabel(stringFactory.getString( |
| 254 | |
LabelStringFactory.OUTPUTPROPS_FRAME_CDATA_SECTION_ELEMENTS)), |
| 255 | |
layout, constraints, row, 0, 1, 1, GridBagConstraints.NORTHEAST, |
| 256 | |
GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); |
| 257 | 0 | GUIUtils.add(main, new JScrollPane(CDATASectionElements = |
| 258 | |
new JTextArea(3, 30)), layout, constraints, row++, 1, 1, 1, |
| 259 | |
GridBagConstraints.WEST, GridBagConstraints.NONE, |
| 260 | |
GUIUtils.SMALL_INSETS); |
| 261 | 0 | GUIUtils.add(main, new JLabel(stringFactory.getString( |
| 262 | |
LabelStringFactory.OUTPUTPROPS_FRAME_DOCTYPE_PUBLIC)), |
| 263 | |
layout, constraints, row, 0, 1, 1, GridBagConstraints.EAST, |
| 264 | |
GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); |
| 265 | 0 | GUIUtils.add(main, doctypePublic = new JTextField(30), layout, |
| 266 | |
constraints, row++, 1, 1, 1, GridBagConstraints.WEST, |
| 267 | |
GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); |
| 268 | 0 | GUIUtils.add(main, new JLabel(stringFactory.getString( |
| 269 | |
LabelStringFactory.OUTPUTPROPS_FRAME_DOCTYPE_SYSTEM)), |
| 270 | |
layout, constraints, row, 0, 1, 1, GridBagConstraints.EAST, |
| 271 | |
GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); |
| 272 | 0 | GUIUtils.add(main, doctypeSystem = new JTextField(30), layout, |
| 273 | |
constraints, row++, 1, 1, 1, GridBagConstraints.WEST, |
| 274 | |
GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); |
| 275 | 0 | GUIUtils.add(main, new JLabel(stringFactory.getString( |
| 276 | |
LabelStringFactory.OUTPUTPROPS_FRAME_ENCODING)), |
| 277 | |
layout, constraints, row, 0, 1, 1, GridBagConstraints.EAST, |
| 278 | |
GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); |
| 279 | 0 | GUIUtils.add(main, encoding = new JTextField(30), layout, |
| 280 | |
constraints, row++, 1, 1, 1, GridBagConstraints.WEST, |
| 281 | |
GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); |
| 282 | 0 | GUIUtils.add(main, new JLabel(stringFactory.getString( |
| 283 | |
LabelStringFactory.OUTPUTPROPS_FRAME_MEDIA_TYPE)), |
| 284 | |
layout, constraints, row, 0, 1, 1, GridBagConstraints.EAST, |
| 285 | |
GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); |
| 286 | 0 | GUIUtils.add(main, mediaType = new JTextField(30), layout, |
| 287 | |
constraints, row++, 1, 1, 1, GridBagConstraints.WEST, |
| 288 | |
GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); |
| 289 | 0 | GUIUtils.add(main, new JLabel(stringFactory.getString( |
| 290 | |
LabelStringFactory.OUTPUTPROPS_FRAME_METHOD)), |
| 291 | |
layout, constraints, row, 0, 1, 1, GridBagConstraints.EAST, |
| 292 | |
GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); |
| 293 | 0 | GUIUtils.add(main, buildMethodPanel(), layout, |
| 294 | |
constraints, row++, 1, 1, 1, GridBagConstraints.WEST, |
| 295 | |
GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); |
| 296 | 0 | GUIUtils.add(main, new JLabel(stringFactory.getString( |
| 297 | |
LabelStringFactory.OUTPUTPROPS_FRAME_VERSION)), |
| 298 | |
layout, constraints, row, 0, 1, 1, GridBagConstraints.EAST, |
| 299 | |
GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); |
| 300 | 0 | GUIUtils.add(main, version = new JTextField(30), layout, |
| 301 | |
constraints, row++, 1, 1, 1, GridBagConstraints.WEST, |
| 302 | |
GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); |
| 303 | 0 | GUIUtils.add(main, new JLabel(stringFactory.getString( |
| 304 | |
LabelStringFactory.OUTPUTPROPS_FRAME_INDENT)), |
| 305 | |
layout, constraints, row, 0, 1, 1, GridBagConstraints.EAST, |
| 306 | |
GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); |
| 307 | 0 | GUIUtils.add(main, indent = new JCheckBox(), layout, |
| 308 | |
constraints, row++, 1, 1, 1, GridBagConstraints.WEST, |
| 309 | |
GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); |
| 310 | 0 | GUIUtils.add(main, new JLabel(stringFactory.getString( |
| 311 | |
LabelStringFactory.OUTPUTPROPS_FRAME_OMIT_XML_DECLARATION)), |
| 312 | |
layout, constraints, row, 0, 1, 1, GridBagConstraints.EAST, |
| 313 | |
GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); |
| 314 | 0 | GUIUtils.add(main, omitXmlDeclaration = new JCheckBox(), layout, |
| 315 | |
constraints, row++, 1, 1, 1, GridBagConstraints.WEST, |
| 316 | |
GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); |
| 317 | 0 | GUIUtils.add(main, new JLabel(stringFactory.getString( |
| 318 | |
LabelStringFactory.OUTPUTPROPS_FRAME_IS_STANDALONE)), |
| 319 | |
layout, constraints, row, 0, 1, 1, GridBagConstraints.EAST, |
| 320 | |
GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); |
| 321 | 0 | GUIUtils.add(main, standalone = new JCheckBox(), layout, |
| 322 | |
constraints, row++, 1, 1, 1, GridBagConstraints.WEST, |
| 323 | |
GridBagConstraints.NONE, GUIUtils.SMALL_INSETS); |
| 324 | 0 | return main; |
| 325 | |
} |
| 326 | |
|
| 327 | |
|
| 328 | |
|
| 329 | |
|
| 330 | |
|
| 331 | |
private JPanel buildMethodPanel() { |
| 332 | |
|
| 333 | |
int row; |
| 334 | |
ButtonGroup group; |
| 335 | |
GridBagLayout layout; |
| 336 | |
GridBagConstraints constraints; |
| 337 | |
JPanel panel; |
| 338 | |
|
| 339 | 0 | row = 0; |
| 340 | 0 | group = new ButtonGroup(); |
| 341 | 0 | layout = new GridBagLayout(); |
| 342 | 0 | constraints = new GridBagConstraints(); |
| 343 | 0 | panel = new JPanel(layout); |
| 344 | 0 | GUIUtils.add(panel, xml = new JRadioButton(stringFactory.getString( |
| 345 | |
LabelStringFactory.OUTPUTPROPS_FRAME_METHODS_XML) + " | "), |
| 346 | |
layout, constraints, row, 0, 1, 1, GridBagConstraints.WEST, |
| 347 | |
GridBagConstraints.NONE, GUIUtils.NO_INSETS); |
| 348 | 0 | GUIUtils.add(panel, html = new JRadioButton(stringFactory.getString( |
| 349 | |
LabelStringFactory.OUTPUTPROPS_FRAME_METHODS_HTML) + " | "), |
| 350 | |
layout, constraints, row, 1, 1, 1, GridBagConstraints.WEST, |
| 351 | |
GridBagConstraints.NONE, GUIUtils.NO_INSETS); |
| 352 | 0 | GUIUtils.add(panel, text = new JRadioButton(stringFactory.getString( |
| 353 | |
LabelStringFactory.OUTPUTPROPS_FRAME_METHODS_TEXT) + " | "), |
| 354 | |
layout, constraints, row, 2, 1, 1, GridBagConstraints.WEST, |
| 355 | |
GridBagConstraints.NONE, GUIUtils.NO_INSETS); |
| 356 | 0 | GUIUtils.add(panel, other = new JRadioButton(stringFactory.getString( |
| 357 | |
LabelStringFactory.OUTPUTPROPS_FRAME_METHODS_OTHER)), layout, |
| 358 | |
constraints, row, 3, 1, 1, GridBagConstraints.WEST, |
| 359 | |
GridBagConstraints.NONE, GUIUtils.NO_INSETS); |
| 360 | 0 | GUIUtils.add(panel, otherMethod = new JTextField(10), layout, |
| 361 | |
constraints, row, 4, 1, 1, GridBagConstraints.WEST, |
| 362 | |
GridBagConstraints.NONE, GUIUtils.NO_INSETS); |
| 363 | 0 | group.add(xml); |
| 364 | 0 | group.add(html); |
| 365 | 0 | group.add(text); |
| 366 | 0 | group.add(other); |
| 367 | 0 | xml.addActionListener(this); |
| 368 | 0 | html.addActionListener(this); |
| 369 | 0 | text.addActionListener(this); |
| 370 | 0 | other.addActionListener(this); |
| 371 | 0 | xml.setSelected(true); |
| 372 | 0 | otherMethod.setEnabled(false); |
| 373 | 0 | otherMethod.setBackground(Color.LIGHT_GRAY); |
| 374 | 0 | return panel; |
| 375 | |
} |
| 376 | |
|
| 377 | |
|
| 378 | |
|
| 379 | |
|
| 380 | |
|
| 381 | |
private void setOutputProperties( |
| 382 | |
TransformOutputProperties aOutputProperties) { |
| 383 | |
|
| 384 | |
String val; |
| 385 | |
|
| 386 | 0 | aOutputProperties.setCDATA_SECTION_ELEMENTS( |
| 387 | |
StringUtils.strip(CDATASectionElements.getText())); |
| 388 | 0 | aOutputProperties.setDOCTYPE_PUBLIC( |
| 389 | |
StringUtils.strip(doctypePublic.getText())); |
| 390 | 0 | aOutputProperties.setDOCTYPE_SYSTEM(doctypeSystem.getText()); |
| 391 | 0 | aOutputProperties.setENCODING(encoding.getText()); |
| 392 | 0 | aOutputProperties.setMEDIA_TYPE(mediaType.getText()); |
| 393 | 0 | aOutputProperties.setENCODING(encoding.getText()); |
| 394 | 0 | aOutputProperties.setVERSION(version.getText()); |
| 395 | 0 | aOutputProperties.setOMIT_XML_DECLARATION( |
| 396 | |
omitXmlDeclaration.isSelected()); |
| 397 | 0 | aOutputProperties.setINDENT(indent.isSelected()); |
| 398 | 0 | aOutputProperties.setSTANDALONE(standalone.isSelected()); |
| 399 | 0 | if (xml.isSelected()) { |
| 400 | 0 | val = VALID_METHODS[XML_INDEX]; |
| 401 | 0 | } else if (html.isSelected()) { |
| 402 | 0 | val = VALID_METHODS[HTML_INDEX]; |
| 403 | 0 | } else if (text.isSelected()) { |
| 404 | 0 | val = VALID_METHODS[TEXT_INDEX]; |
| 405 | 0 | } else { |
| 406 | 0 | val = otherMethod.getText(); |
| 407 | |
} |
| 408 | 0 | aOutputProperties.setMETHOD(val); |
| 409 | 0 | } |
| 410 | |
|
| 411 | |
|
| 412 | |
|
| 413 | |
|
| 414 | |
|
| 415 | |
private void setEnableXmlCheckboxes(boolean aEnable) { |
| 416 | 0 | standalone.setEnabled(aEnable); |
| 417 | 0 | indent.setEnabled(aEnable); |
| 418 | 0 | omitXmlDeclaration.setEnabled(aEnable); |
| 419 | 0 | } |
| 420 | |
|
| 421 | |
|
| 422 | |
|
| 423 | |
|
| 424 | |
public void actionPerformed(ActionEvent aEvent) { |
| 425 | |
|
| 426 | |
Object eventSource; |
| 427 | |
|
| 428 | 0 | eventSource = aEvent.getSource(); |
| 429 | 0 | if (eventSource == cancelBtn) { |
| 430 | 0 | dispose(); |
| 431 | 0 | } else if (eventSource instanceof JRadioButton) { |
| 432 | 0 | setEnableXmlCheckboxes(eventSource == xml); |
| 433 | 0 | if (eventSource == other) { |
| 434 | 0 | otherMethod.setEnabled(true); |
| 435 | 0 | otherMethod.requestFocus(); |
| 436 | 0 | otherMethod.setBackground(Color.WHITE); |
| 437 | 0 | } else { |
| 438 | 0 | otherMethod.setEnabled(false); |
| 439 | 0 | otherMethod.setBackground(Color.LIGHT_GRAY); |
| 440 | |
} |
| 441 | 0 | } else if (eventSource == okayBtn) { |
| 442 | 0 | if (xslRow != null) { |
| 443 | 0 | setOutputProperties(xslRow.getTransformOutputProperties()); |
| 444 | 0 | xslRow.setAreOutputPropertiesSet(true); |
| 445 | 0 | } else { |
| 446 | 0 | setOutputProperties(xmlIdentityTransformOutputProps); |
| 447 | 0 | parent.setAreOutputPropertiesSet(true); |
| 448 | |
} |
| 449 | 0 | dispose(); |
| 450 | |
} |
| 451 | 0 | } |
| 452 | |
} |
| 453 | |
|