This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 246175
Collapse All | Expand All

(-)a/db.dataview/nbproject/project.xml (+18 lines)
Lines 6-11 Link Here
6
            <code-name-base>org.netbeans.modules.db.dataview</code-name-base>
6
            <code-name-base>org.netbeans.modules.db.dataview</code-name-base>
7
            <module-dependencies>
7
            <module-dependencies>
8
                <dependency>
8
                <dependency>
9
                    <code-name-base>org.jdesktop.beansbinding</code-name-base>
10
                    <build-prerequisite/>
11
                    <compile-dependency/>
12
                    <run-dependency>
13
                        <release-version>1</release-version>
14
                        <specification-version>1.24</specification-version>
15
                    </run-dependency>
16
                </dependency>
17
                <dependency>
9
                    <code-name-base>org.netbeans.api.progress</code-name-base>
18
                    <code-name-base>org.netbeans.api.progress</code-name-base>
10
                    <build-prerequisite/>
19
                    <build-prerequisite/>
11
                    <compile-dependency/>
20
                    <compile-dependency/>
Lines 33-38 Link Here
33
                    </run-dependency>
42
                    </run-dependency>
34
                </dependency>
43
                </dependency>
35
                <dependency>
44
                <dependency>
45
                    <code-name-base>org.netbeans.modules.options.api</code-name-base>
46
                    <build-prerequisite/>
47
                    <compile-dependency/>
48
                    <run-dependency>
49
                        <release-version>1</release-version>
50
                        <specification-version>1.41</specification-version>
51
                    </run-dependency>
52
                </dependency>
53
                <dependency>
36
                    <code-name-base>org.openide.awt</code-name-base>
54
                    <code-name-base>org.openide.awt</code-name-base>
37
                    <build-prerequisite/>
55
                    <build-prerequisite/>
38
                    <compile-dependency/>
56
                    <compile-dependency/>
(-)a/db.dataview/src/org/netbeans/modules/db/dataview/options/Bundle.properties (+8 lines)
Line 0 Link Here
1
DataViewSettingsPanel.chkPackColumns.text=Pack columns
2
DataViewSettingsPanel.chkShowAbsoluteRowNumbers.text=Show absolute row numbers
3
DataViewSettingsPanel.rbRememberPageSize.text=Remember and use previous
4
DataViewSettingsPanel.lblPageSize.text=Default page size:
5
DataViewSettingsPanel.rbShowAllRows.text=Show all rows
6
DataViewSettingsPanel.rbFixedPageSize.text=
7
DataViewSettingsPanel.chkShowTruncateTableButton.text=Show truncate table button
8
DataViewSettingsPanel.chkCopyRowValuesWithHeaders.text=Copy row values with headers (keyboard)
(-)a/db.dataview/src/org/netbeans/modules/db/dataview/options/DataViewSettings.java (+109 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2014 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.db.dataview.options;
44
45
import java.util.prefs.Preferences;
46
import org.openide.util.NbPreferences;
47
48
/**
49
 *
50
 * @author Markus Opitz
51
 */
52
public final class DataViewSettings {
53
54
    public static final int PAGE_SIZE_REMEMBER = -1;
55
    public static final int PAGE_SIZE_SHOW_ALL = 0;
56
57
    private static final String PROP_DEFAULT_PAGE_SIZE = "defaultPageSize";
58
    private static final String PROP_PACK_COLUMNS = "packColumns";
59
    private static final String PROP_SHOW_TRUNCATE_TABLE_BUTTON = "showTruncateTableButton";
60
    private static final String PROP_SHOW_ABSOLUTE_ROW_NUMBERS = "showAbsoluteRowNumbers";
61
    private static final String PROP_COPY_ROW_VALUES_WITH_HEADERS = "copyRowValuesWithHeaders";
62
63
    private DataViewSettings() {
64
    }
65
66
    public static int getDefaultPageSize() {
67
        return getPreferences().getInt(PROP_DEFAULT_PAGE_SIZE, PAGE_SIZE_REMEMBER);
68
    }
69
70
    public static void setDefautPageSize(int defaultPageSize) {
71
        getPreferences().putInt(PROP_DEFAULT_PAGE_SIZE, defaultPageSize);
72
    }
73
74
    public static boolean getPackColumns() {
75
        return getPreferences().getBoolean(PROP_PACK_COLUMNS, false);
76
    }
77
78
    public static void setPackColumns(boolean alwaysPackColumns) {
79
        getPreferences().putBoolean(PROP_PACK_COLUMNS, alwaysPackColumns);
80
    }
81
82
    public static boolean getShowTruncateTableButton() {
83
        return getPreferences().getBoolean(PROP_SHOW_TRUNCATE_TABLE_BUTTON, true);
84
    }
85
86
    public static void setShowTruncateTableButton(boolean showTruncateTableButton) {
87
        getPreferences().putBoolean(PROP_SHOW_TRUNCATE_TABLE_BUTTON, showTruncateTableButton);
88
    }
89
90
    public static boolean getShowAbsoluteRowNumbers() {
91
        return getPreferences().getBoolean(PROP_SHOW_ABSOLUTE_ROW_NUMBERS, false);
92
    }
93
94
    public static void setShowAbsoluteRowNumbers(boolean showAbsoluteRowNumbers) {
95
        getPreferences().putBoolean(PROP_SHOW_ABSOLUTE_ROW_NUMBERS, showAbsoluteRowNumbers);
96
    }
97
98
    public static boolean getCopyRowValuesWithHeaders() {
99
        return getPreferences().getBoolean(PROP_COPY_ROW_VALUES_WITH_HEADERS, false);
100
    }
101
102
    public static void setCopyRowValuesWithHeaders(boolean copyRowsWithHeaders) {
103
        getPreferences().putBoolean(PROP_COPY_ROW_VALUES_WITH_HEADERS, copyRowsWithHeaders);
104
    }
105
106
    private static Preferences getPreferences() {
107
        return NbPreferences.forModule(DataViewSettings.class);
108
    }
109
}
(-)a/db.dataview/src/org/netbeans/modules/db/dataview/options/DataViewSettingsOptionsPanelController.java (+122 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2014 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.db.dataview.options;
43
44
import java.beans.PropertyChangeListener;
45
import java.beans.PropertyChangeSupport;
46
import javax.swing.JComponent;
47
import javax.swing.SwingUtilities;
48
import org.netbeans.spi.options.OptionsPanelController;
49
import org.openide.util.HelpCtx;
50
import org.openide.util.Lookup;
51
52
@OptionsPanelController.SubRegistration(
53
        displayName = "#AdvancedOption_DisplayName_DataViewSettings",
54
        keywords = "#AdvancedOption_Keywords_DataViewSettings",
55
        keywordsCategory = "Advanced/DataViewSettings"
56
)
57
@org.openide.util.NbBundle.Messages({"AdvancedOption_DisplayName_DataViewSettings=SQL Data View", "AdvancedOption_Keywords_DataViewSettings=SQL"})
58
public final class DataViewSettingsOptionsPanelController extends OptionsPanelController {
59
60
    private DataViewSettingsPanel panel;
61
    private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
62
    private boolean changed;
63
64
    public void update() {
65
        getPanel().load();
66
        changed = false;
67
    }
68
69
    public void applyChanges() {
70
        SwingUtilities.invokeLater(new Runnable() {
71
            @Override
72
            public void run() {
73
                getPanel().store();
74
                changed = false;
75
            }
76
        });
77
    }
78
79
    public void cancel() {
80
        // need not do anything special, if no changes have been persisted yet
81
    }
82
83
    public boolean isValid() {
84
        return getPanel().valid();
85
    }
86
87
    public boolean isChanged() {
88
        return changed;
89
    }
90
91
    public HelpCtx getHelpCtx() {
92
        return null; // new HelpCtx("...ID") if you have a help set
93
    }
94
95
    public JComponent getComponent(Lookup masterLookup) {
96
        return getPanel();
97
    }
98
99
    public void addPropertyChangeListener(PropertyChangeListener l) {
100
        pcs.addPropertyChangeListener(l);
101
    }
102
103
    public void removePropertyChangeListener(PropertyChangeListener l) {
104
        pcs.removePropertyChangeListener(l);
105
    }
106
107
    private DataViewSettingsPanel getPanel() {
108
        if (panel == null) {
109
            panel = new DataViewSettingsPanel(this);
110
        }
111
        return panel;
112
    }
113
114
    void changed() {
115
        if (!changed) {
116
            changed = true;
117
            pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
118
        }
119
        pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
120
    }
121
122
}
(-)a/db.dataview/src/org/netbeans/modules/db/dataview/options/DataViewSettingsPanel.form (+137 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
2
3
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <NonVisualComponents>
5
    <Component class="javax.swing.ButtonGroup" name="pageSizeButtonGroup">
6
    </Component>
7
  </NonVisualComponents>
8
  <AuxValues>
9
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
10
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
11
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
12
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
13
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
14
    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
15
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
16
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
17
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
18
  </AuxValues>
19
20
  <Layout>
21
    <DimensionLayout dim="0">
22
      <Group type="103" groupAlignment="0" attributes="0">
23
          <Group type="102" attributes="0">
24
              <EmptySpace max="-2" attributes="0"/>
25
              <Group type="103" groupAlignment="0" attributes="0">
26
                  <Component id="chkShowAbsoluteRowNumbers" min="-2" max="-2" attributes="0"/>
27
                  <Component id="chkShowTruncateTableButton" alignment="0" min="-2" max="-2" attributes="0"/>
28
                  <Component id="chkCopyRowValuesWithHeaders" alignment="0" min="-2" max="-2" attributes="0"/>
29
                  <Component id="chkPackColumns" alignment="0" min="-2" max="-2" attributes="0"/>
30
                  <Component id="lblPageSize" alignment="0" min="-2" max="-2" attributes="0"/>
31
                  <Component id="rbRememberPageSize" alignment="0" min="-2" max="-2" attributes="0"/>
32
                  <Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
33
                      <Group type="102" alignment="0" attributes="0">
34
                          <Component id="rbFixedPageSize" min="-2" max="-2" attributes="0"/>
35
                          <EmptySpace max="32767" attributes="0"/>
36
                          <Component id="spnFixedPageSize" min="-2" pref="100" max="-2" attributes="0"/>
37
                      </Group>
38
                      <Component id="rbShowAllRows" alignment="0" min="-2" max="-2" attributes="0"/>
39
                  </Group>
40
              </Group>
41
              <EmptySpace pref="251" max="32767" attributes="0"/>
42
          </Group>
43
      </Group>
44
    </DimensionLayout>
45
    <DimensionLayout dim="1">
46
      <Group type="103" groupAlignment="0" attributes="0">
47
          <Group type="102" alignment="0" attributes="0">
48
              <EmptySpace max="-2" attributes="0"/>
49
              <Component id="lblPageSize" min="-2" max="-2" attributes="0"/>
50
              <EmptySpace type="unrelated" max="-2" attributes="0"/>
51
              <Component id="rbRememberPageSize" min="-2" max="-2" attributes="0"/>
52
              <EmptySpace max="-2" attributes="0"/>
53
              <Component id="rbShowAllRows" min="-2" max="-2" attributes="0"/>
54
              <EmptySpace max="-2" attributes="0"/>
55
              <Group type="103" groupAlignment="0" attributes="0">
56
                  <Component id="rbFixedPageSize" min="-2" max="-2" attributes="0"/>
57
                  <Component id="spnFixedPageSize" min="-2" max="-2" attributes="0"/>
58
              </Group>
59
              <EmptySpace type="separate" max="-2" attributes="0"/>
60
              <Component id="chkPackColumns" min="-2" max="-2" attributes="0"/>
61
              <EmptySpace max="-2" attributes="0"/>
62
              <Component id="chkShowTruncateTableButton" min="-2" max="-2" attributes="0"/>
63
              <EmptySpace max="-2" attributes="0"/>
64
              <Component id="chkShowAbsoluteRowNumbers" min="-2" max="-2" attributes="0"/>
65
              <EmptySpace max="-2" attributes="0"/>
66
              <Component id="chkCopyRowValuesWithHeaders" min="-2" max="-2" attributes="0"/>
67
              <EmptySpace pref="129" max="32767" attributes="0"/>
68
          </Group>
69
      </Group>
70
    </DimensionLayout>
71
  </Layout>
72
  <SubComponents>
73
    <Component class="javax.swing.JCheckBox" name="chkShowTruncateTableButton">
74
      <Properties>
75
        <Property name="selected" type="boolean" value="true"/>
76
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
77
          <ResourceString bundle="org/netbeans/modules/db/dataview/options/Bundle.properties" key="DataViewSettingsPanel.chkShowTruncateTableButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
78
        </Property>
79
      </Properties>
80
    </Component>
81
    <Component class="javax.swing.JCheckBox" name="chkShowAbsoluteRowNumbers">
82
      <Properties>
83
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
84
          <ResourceString bundle="org/netbeans/modules/db/dataview/options/Bundle.properties" key="DataViewSettingsPanel.chkShowAbsoluteRowNumbers.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
85
        </Property>
86
      </Properties>
87
    </Component>
88
    <Component class="javax.swing.JCheckBox" name="chkPackColumns">
89
      <Properties>
90
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
91
          <ResourceString bundle="org/netbeans/modules/db/dataview/options/Bundle.properties" key="DataViewSettingsPanel.chkPackColumns.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
92
        </Property>
93
      </Properties>
94
    </Component>
95
    <Component class="javax.swing.JCheckBox" name="chkCopyRowValuesWithHeaders">
96
      <Properties>
97
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
98
          <ResourceString bundle="org/netbeans/modules/db/dataview/options/Bundle.properties" key="DataViewSettingsPanel.chkCopyRowValuesWithHeaders.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
99
        </Property>
100
      </Properties>
101
    </Component>
102
    <Component class="javax.swing.JRadioButton" name="rbRememberPageSize">
103
      <Properties>
104
        <Property name="selected" type="boolean" value="true"/>
105
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
106
          <ResourceString bundle="org/netbeans/modules/db/dataview/options/Bundle.properties" key="DataViewSettingsPanel.rbRememberPageSize.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
107
        </Property>
108
      </Properties>
109
    </Component>
110
    <Component class="javax.swing.JRadioButton" name="rbFixedPageSize">
111
      <Properties>
112
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
113
          <ResourceString bundle="org/netbeans/modules/db/dataview/options/Bundle.properties" key="DataViewSettingsPanel.rbFixedPageSize.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
114
        </Property>
115
      </Properties>
116
    </Component>
117
    <Component class="javax.swing.JSpinner" name="spnFixedPageSize">
118
      <BindingProperties>
119
        <BindingProperty name="enabled" source="rbFixedPageSize" sourcePath="${selected}" target="spnFixedPageSize" targetPath="enabled" updateStrategy="0" immediately="false"/>
120
      </BindingProperties>
121
    </Component>
122
    <Component class="javax.swing.JLabel" name="lblPageSize">
123
      <Properties>
124
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
125
          <ResourceString bundle="org/netbeans/modules/db/dataview/options/Bundle.properties" key="DataViewSettingsPanel.lblPageSize.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
126
        </Property>
127
      </Properties>
128
    </Component>
129
    <Component class="javax.swing.JRadioButton" name="rbShowAllRows">
130
      <Properties>
131
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
132
          <ResourceString bundle="org/netbeans/modules/db/dataview/options/Bundle.properties" key="DataViewSettingsPanel.rbShowAllRows.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
133
        </Property>
134
      </Properties>
135
    </Component>
136
  </SubComponents>
137
</Form>
(-)a/db.dataview/src/org/netbeans/modules/db/dataview/options/DataViewSettingsPanel.java (+195 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2014 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.db.dataview.options;
43
44
import org.netbeans.modules.db.dataview.api.DataViewPageContext;
45
46
final class DataViewSettingsPanel extends javax.swing.JPanel {
47
48
    private final DataViewSettingsOptionsPanelController controller;
49
50
    DataViewSettingsPanel(DataViewSettingsOptionsPanelController controller) {
51
        this.controller = controller;
52
        initComponents();
53
        pageSizeButtonGroup.add(rbRememberPageSize);
54
        pageSizeButtonGroup.add(rbShowAllRows);
55
        pageSizeButtonGroup.add(rbFixedPageSize);
56
    }
57
58
    /**
59
     * This method is called from within the constructor to initialize the form. WARNING: Do NOT
60
     * modify this code. The content of this method is always regenerated by the Form Editor.
61
     */
62
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
63
    private void initComponents() {
64
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
65
66
        pageSizeButtonGroup = new javax.swing.ButtonGroup();
67
        chkShowTruncateTableButton = new javax.swing.JCheckBox();
68
        chkShowAbsoluteRowNumbers = new javax.swing.JCheckBox();
69
        chkPackColumns = new javax.swing.JCheckBox();
70
        chkCopyRowValuesWithHeaders = new javax.swing.JCheckBox();
71
        rbRememberPageSize = new javax.swing.JRadioButton();
72
        rbFixedPageSize = new javax.swing.JRadioButton();
73
        spnFixedPageSize = new javax.swing.JSpinner();
74
        lblPageSize = new javax.swing.JLabel();
75
        rbShowAllRows = new javax.swing.JRadioButton();
76
77
        chkShowTruncateTableButton.setSelected(true);
78
        org.openide.awt.Mnemonics.setLocalizedText(chkShowTruncateTableButton, org.openide.util.NbBundle.getMessage(DataViewSettingsPanel.class, "DataViewSettingsPanel.chkShowTruncateTableButton.text")); // NOI18N
79
80
        org.openide.awt.Mnemonics.setLocalizedText(chkShowAbsoluteRowNumbers, org.openide.util.NbBundle.getMessage(DataViewSettingsPanel.class, "DataViewSettingsPanel.chkShowAbsoluteRowNumbers.text")); // NOI18N
81
82
        org.openide.awt.Mnemonics.setLocalizedText(chkPackColumns, org.openide.util.NbBundle.getMessage(DataViewSettingsPanel.class, "DataViewSettingsPanel.chkPackColumns.text")); // NOI18N
83
84
        org.openide.awt.Mnemonics.setLocalizedText(chkCopyRowValuesWithHeaders, org.openide.util.NbBundle.getMessage(DataViewSettingsPanel.class, "DataViewSettingsPanel.chkCopyRowValuesWithHeaders.text")); // NOI18N
85
86
        rbRememberPageSize.setSelected(true);
87
        org.openide.awt.Mnemonics.setLocalizedText(rbRememberPageSize, org.openide.util.NbBundle.getMessage(DataViewSettingsPanel.class, "DataViewSettingsPanel.rbRememberPageSize.text")); // NOI18N
88
89
        org.openide.awt.Mnemonics.setLocalizedText(rbFixedPageSize, org.openide.util.NbBundle.getMessage(DataViewSettingsPanel.class, "DataViewSettingsPanel.rbFixedPageSize.text")); // NOI18N
90
91
        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, rbFixedPageSize, org.jdesktop.beansbinding.ELProperty.create("${selected}"), spnFixedPageSize, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
92
        bindingGroup.addBinding(binding);
93
94
        org.openide.awt.Mnemonics.setLocalizedText(lblPageSize, org.openide.util.NbBundle.getMessage(DataViewSettingsPanel.class, "DataViewSettingsPanel.lblPageSize.text")); // NOI18N
95
96
        org.openide.awt.Mnemonics.setLocalizedText(rbShowAllRows, org.openide.util.NbBundle.getMessage(DataViewSettingsPanel.class, "DataViewSettingsPanel.rbShowAllRows.text")); // NOI18N
97
98
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
99
        this.setLayout(layout);
100
        layout.setHorizontalGroup(
101
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
102
            .addGroup(layout.createSequentialGroup()
103
                .addContainerGap()
104
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
105
                    .addComponent(chkShowAbsoluteRowNumbers)
106
                    .addComponent(chkShowTruncateTableButton)
107
                    .addComponent(chkCopyRowValuesWithHeaders)
108
                    .addComponent(chkPackColumns)
109
                    .addComponent(lblPageSize)
110
                    .addComponent(rbRememberPageSize)
111
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
112
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
113
                            .addComponent(rbFixedPageSize)
114
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
115
                            .addComponent(spnFixedPageSize, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
116
                        .addComponent(rbShowAllRows, javax.swing.GroupLayout.Alignment.LEADING)))
117
                .addContainerGap(251, Short.MAX_VALUE))
118
        );
119
        layout.setVerticalGroup(
120
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
121
            .addGroup(layout.createSequentialGroup()
122
                .addContainerGap()
123
                .addComponent(lblPageSize)
124
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
125
                .addComponent(rbRememberPageSize)
126
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
127
                .addComponent(rbShowAllRows)
128
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
129
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
130
                    .addComponent(rbFixedPageSize)
131
                    .addComponent(spnFixedPageSize, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
132
                .addGap(18, 18, 18)
133
                .addComponent(chkPackColumns)
134
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
135
                .addComponent(chkShowTruncateTableButton)
136
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
137
                .addComponent(chkShowAbsoluteRowNumbers)
138
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
139
                .addComponent(chkCopyRowValuesWithHeaders)
140
                .addContainerGap(129, Short.MAX_VALUE))
141
        );
142
143
        bindingGroup.bind();
144
    }// </editor-fold>//GEN-END:initComponents
145
146
    void load() {
147
        int defaultPageSize = DataViewSettings.getDefaultPageSize();
148
        if (defaultPageSize == DataViewSettings.PAGE_SIZE_REMEMBER) {
149
            rbRememberPageSize.setSelected(true);
150
            spnFixedPageSize.setValue(DataViewPageContext.DEFAULT_PAGE_SIZE);
151
        } else if (defaultPageSize == DataViewSettings.PAGE_SIZE_SHOW_ALL) {
152
            rbShowAllRows.setSelected(true);
153
            spnFixedPageSize.setValue(DataViewPageContext.DEFAULT_PAGE_SIZE);
154
        } else {
155
            rbFixedPageSize.setSelected(true);
156
            spnFixedPageSize.setValue(defaultPageSize);
157
        }
158
        chkPackColumns.setSelected(DataViewSettings.getPackColumns());
159
        chkShowTruncateTableButton.setSelected(DataViewSettings.getShowTruncateTableButton());
160
        chkShowAbsoluteRowNumbers.setSelected(DataViewSettings.getShowAbsoluteRowNumbers());
161
        chkCopyRowValuesWithHeaders.setSelected(DataViewSettings.getCopyRowValuesWithHeaders());
162
    }
163
164
    void store() {
165
        if (rbRememberPageSize.isSelected()) {
166
            DataViewSettings.setDefautPageSize(DataViewSettings.PAGE_SIZE_REMEMBER);
167
        } else if (rbShowAllRows.isSelected()) {
168
            DataViewSettings.setDefautPageSize(DataViewSettings.PAGE_SIZE_SHOW_ALL);
169
        } else {
170
            DataViewSettings.setDefautPageSize((int) spnFixedPageSize.getValue());
171
        }
172
        DataViewSettings.setPackColumns(chkPackColumns.isSelected());
173
        DataViewSettings.setShowTruncateTableButton(chkShowTruncateTableButton.isSelected());
174
        DataViewSettings.setShowAbsoluteRowNumbers(chkShowAbsoluteRowNumbers.isSelected());
175
        DataViewSettings.setCopyRowValuesWithHeaders(chkCopyRowValuesWithHeaders.isSelected());
176
    }
177
178
    boolean valid() {
179
        return true;
180
    }
181
182
    // Variables declaration - do not modify//GEN-BEGIN:variables
183
    private javax.swing.JCheckBox chkCopyRowValuesWithHeaders;
184
    private javax.swing.JCheckBox chkPackColumns;
185
    private javax.swing.JCheckBox chkShowAbsoluteRowNumbers;
186
    private javax.swing.JCheckBox chkShowTruncateTableButton;
187
    private javax.swing.JLabel lblPageSize;
188
    private javax.swing.ButtonGroup pageSizeButtonGroup;
189
    private javax.swing.JRadioButton rbFixedPageSize;
190
    private javax.swing.JRadioButton rbRememberPageSize;
191
    private javax.swing.JRadioButton rbShowAllRows;
192
    private javax.swing.JSpinner spnFixedPageSize;
193
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
194
    // End of variables declaration//GEN-END:variables
195
}

Return to bug 246175