001: /*
002: * HtmlOptionsPanel.java
003: *
004: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
005: *
006: * Copyright 2002-2008, Thomas Kellerer
007: * No part of this code maybe reused without the permission of the author
008: *
009: * To contact the author please send an email to: support@sql-workbench.net
010: *
011: */
012: package workbench.gui.dialogs.export;
013:
014: import workbench.resource.ResourceMgr;
015: import workbench.resource.Settings;
016:
017: /**
018: *
019: * @author support@sql-workbench.net
020: */
021: public class HtmlOptionsPanel extends javax.swing.JPanel implements
022: HtmlOptions {
023:
024: /** Creates new form HtmlOptionsPanel */
025: public HtmlOptionsPanel() {
026: initComponents();
027: }
028:
029: public void saveSettings() {
030: Settings s = Settings.getInstance();
031: s.setProperty("workbench.export.html.createfullpage", this
032: .getCreateFullPage());
033: s.setProperty("workbench.export.html.escape", this
034: .getEscapeHtml());
035: s.setProperty("workbench.export.html.pagetitle", this
036: .getPageTitle());
037: }
038:
039: public void restoreSettings() {
040: Settings s = Settings.getInstance();
041: this
042: .setCreateFullPage(s
043: .getBoolProperty("workbench.export.html.createfullpage"));
044: this .setEscapeHtml(s
045: .getBoolProperty("workbench.export.html.escape"));
046: this .setPageTitle(s.getProperty(
047: "workbench.export.html.pagetitle", ""));
048: }
049:
050: public boolean getCreateFullPage() {
051: return this .fullPage.isSelected();
052: }
053:
054: public boolean getEscapeHtml() {
055: return escapeHtml.isSelected();
056: }
057:
058: public String getPageTitle() {
059: return pageTitle.getText();
060: }
061:
062: public void setCreateFullPage(boolean flag) {
063: fullPage.setSelected(flag);
064: }
065:
066: public void setEscapeHtml(boolean flag) {
067: escapeHtml.setSelected(flag);
068: }
069:
070: public void setPageTitle(String title) {
071: pageTitle.setText(title);
072: }
073:
074: /** This method is called from within the constructor to
075: * initialize the form.
076: * WARNING: Do NOT modify this code. The content of this method is
077: * always regenerated by the Form Editor.
078: */
079: private void initComponents()//GEN-BEGIN:initComponents
080: {
081: java.awt.GridBagConstraints gridBagConstraints;
082:
083: pageTitleLabel = new javax.swing.JLabel();
084: pageTitle = new javax.swing.JTextField();
085: fullPage = new javax.swing.JCheckBox();
086: escapeHtml = new javax.swing.JCheckBox();
087:
088: setLayout(new java.awt.GridBagLayout());
089:
090: pageTitleLabel.setText(ResourceMgr
091: .getString("LblExportHtmlPageTitle"));
092: pageTitleLabel
093: .setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
094: gridBagConstraints = new java.awt.GridBagConstraints();
095: gridBagConstraints.gridx = 0;
096: gridBagConstraints.gridy = 0;
097: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
098: gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
099: add(pageTitleLabel, gridBagConstraints);
100:
101: gridBagConstraints = new java.awt.GridBagConstraints();
102: gridBagConstraints.gridx = 0;
103: gridBagConstraints.gridy = 1;
104: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
105: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
106: gridBagConstraints.weightx = 1.0;
107: gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
108: add(pageTitle, gridBagConstraints);
109:
110: fullPage.setText(ResourceMgr.getString("LblExportFullHtml"));
111: gridBagConstraints = new java.awt.GridBagConstraints();
112: gridBagConstraints.gridx = 0;
113: gridBagConstraints.gridy = 2;
114: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
115: add(fullPage, gridBagConstraints);
116:
117: escapeHtml
118: .setText(ResourceMgr.getString("LblExportEscapeHtml"));
119: gridBagConstraints = new java.awt.GridBagConstraints();
120: gridBagConstraints.gridx = 0;
121: gridBagConstraints.gridy = 3;
122: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
123: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
124: gridBagConstraints.weighty = 1.0;
125: add(escapeHtml, gridBagConstraints);
126:
127: }//GEN-END:initComponents
128:
129: // Variables declaration - do not modify//GEN-BEGIN:variables
130: private javax.swing.JCheckBox escapeHtml;
131: private javax.swing.JCheckBox fullPage;
132: private javax.swing.JTextField pageTitle;
133: private javax.swing.JLabel pageTitleLabel;
134: // End of variables declaration//GEN-END:variables
135:
136: }
|