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 SpreadSheetOptionsPanel extends javax.swing.JPanel
022: implements SpreadSheetOptions {
023: private String exportType;
024:
025: public SpreadSheetOptionsPanel(String type) {
026: exportType = type;
027: initComponents();
028: }
029:
030: public void saveSettings() {
031: Settings s = Settings.getInstance();
032: s.setProperty("workbench.export." + exportType + ".pagetitle",
033: this .getPageTitle());
034: s.setProperty("workbench.export." + exportType + ".header",
035: getExportHeaders());
036: }
037:
038: public void restoreSettings() {
039: Settings s = Settings.getInstance();
040: this .setPageTitle(s.getProperty("workbench.export."
041: + exportType + ".pagetitle", ""));
042: boolean headerDefault = s.getBoolProperty("workbench.export."
043: + exportType + ".default.header", false);
044: boolean header = s.getBoolProperty("workbench.export."
045: + exportType + ".header", headerDefault);
046: this .setExportHeaders(header);
047: }
048:
049: public boolean getExportHeaders() {
050: return exportHeaders.isSelected();
051: }
052:
053: public void setExportHeaders(boolean flag) {
054: exportHeaders.setSelected(flag);
055: }
056:
057: public String getPageTitle() {
058: return pageTitle.getText();
059: }
060:
061: public void setPageTitle(String title) {
062: pageTitle.setText(title);
063: }
064:
065: /** This method is called from within the constructor to
066: * initialize the form.
067: * WARNING: Do NOT modify this code. The content of this method is
068: * always regenerated by the Form Editor.
069: */
070: // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
071: private void initComponents() {
072: java.awt.GridBagConstraints gridBagConstraints;
073:
074: pageTitleLabel = new javax.swing.JLabel();
075: pageTitle = new javax.swing.JTextField();
076: jPanel1 = new javax.swing.JPanel();
077: exportHeaders = new javax.swing.JCheckBox();
078:
079: setLayout(new java.awt.GridBagLayout());
080:
081: pageTitleLabel.setText(ResourceMgr.getString("LblSheetName"));
082: pageTitleLabel
083: .setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
084: gridBagConstraints = new java.awt.GridBagConstraints();
085: gridBagConstraints.gridx = 0;
086: gridBagConstraints.gridy = 1;
087: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
088: gridBagConstraints.insets = new java.awt.Insets(7, 6, 3, 6);
089: add(pageTitleLabel, gridBagConstraints);
090: gridBagConstraints = new java.awt.GridBagConstraints();
091: gridBagConstraints.gridx = 0;
092: gridBagConstraints.gridy = 2;
093: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
094: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
095: gridBagConstraints.weightx = 1.0;
096: gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 6);
097: add(pageTitle, gridBagConstraints);
098: gridBagConstraints = new java.awt.GridBagConstraints();
099: gridBagConstraints.gridx = 0;
100: gridBagConstraints.gridy = 3;
101: gridBagConstraints.weightx = 1.0;
102: gridBagConstraints.weighty = 1.0;
103: add(jPanel1, gridBagConstraints);
104:
105: exportHeaders.setText(ResourceMgr
106: .getString("LblExportIncludeHeaders"));
107: gridBagConstraints = new java.awt.GridBagConstraints();
108: gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
109: gridBagConstraints.insets = new java.awt.Insets(7, 6, 3, 6);
110: add(exportHeaders, gridBagConstraints);
111: }// </editor-fold>//GEN-END:initComponents
112:
113: // Variables declaration - do not modify//GEN-BEGIN:variables
114: private javax.swing.JCheckBox exportHeaders;
115: private javax.swing.JPanel jPanel1;
116: private javax.swing.JTextField pageTitle;
117: private javax.swing.JLabel pageTitleLabel;
118: // End of variables declaration//GEN-END:variables
119:
120: }
|