[hg] main-silver: Issue #239698 - Missing Save button in modify ...

  • From: Tomas Stupka < >
  • To:
  • Subject: [hg] main-silver: Issue #239698 - Missing Save button in modify ...
  • Date: Fri, 10 Jan 2014 04:50:45 +0000

changeset 8008dea4fb60 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/8008dea4fb60
description:
        Issue #239698 - Missing Save button in modify query editor?

diffstat:

 bugzilla/src/org/netbeans/modules/bugzilla/query/Bundle.properties           
 |   4 +
 bugzilla/src/org/netbeans/modules/bugzilla/query/QueryController.java        
 |  11 +++-
 bugzilla/src/org/netbeans/modules/bugzilla/query/QueryPanel.form             
 |  24 ++++++++-
 bugzilla/src/org/netbeans/modules/bugzilla/query/QueryPanel.java             
 |  18 +++++-
 jira/src/org/netbeans/modules/jira/query/Bundle.properties                   
 |   2 +
 jira/src/org/netbeans/modules/jira/query/QueryController.java                
 |   4 +
 jira/src/org/netbeans/modules/jira/query/QueryPanel.form                     
 |  19 ++++++-
 jira/src/org/netbeans/modules/jira/query/QueryPanel.java                     
 |  11 +++-
 odcs.tasks/src/org/netbeans/modules/odcs/tasks/ODCS.java                     
 |   8 +++
 odcs.tasks/src/org/netbeans/modules/odcs/tasks/query/Bundle.properties       
 |   1 +
 
odcs.tasks/src/org/netbeans/modules/odcs/tasks/query/ODCSQueryController.java 
|  25 ++++++++-
 odcs.tasks/src/org/netbeans/modules/odcs/tasks/query/QueryPanel.form         
 |  20 +++++++-
 odcs.tasks/src/org/netbeans/modules/odcs/tasks/query/QueryPanel.java         
 |  19 +++++++-
 13 files changed, 146 insertions(+), 20 deletions(-)

diffs (624 lines):

diff --git 
a/bugzilla/src/org/netbeans/modules/bugzilla/query/Bundle.properties 
b/bugzilla/src/org/netbeans/modules/bugzilla/query/Bundle.properties
--- a/bugzilla/src/org/netbeans/modules/bugzilla/query/Bundle.properties
+++ b/bugzilla/src/org/netbeans/modules/bugzilla/query/Bundle.properties
@@ -106,6 +106,8 @@
 QueryPanel.webButton.text=Open web Query
 LBL_MatchingIssues=There are {0} tasks matching this query.
 LBL_MatchingIssue=There is 1 task matching this query.
+QueryPanel.saveChangesButton.text=Save Changes
+QueryPanel.saveQueryButton.text=Save Query
 QueryPanel.cancelChangesButton.text=Cancel Changes
 QueryPanel.jLabel4.text_1=
 QueryPanel.jLabel5.text=
@@ -155,11 +157,13 @@
 QueryPanel.gotoIssueButton.AccessibleContext.accessibleDescription=N/A
 QueryPanel.urlTextField.AccessibleContext.accessibleDescription=N/A
 QueryPanel.searchButton.AccessibleContext.accessibleDescription=N/A
+QueryPanel.saveChangesButton.AccessibleContext.accessibleDescription=N/A
 QueryPanel.cancelChangesButton.AccessibleContext.accessibleDescription=N/A
 QueryPanel.filterComboBox.AccessibleContext.accessibleDescription=N/A
 
QueryPanel.refreshConfigurationButton.AccessibleContext.accessibleDescription=N/A
 QueryPanel.urlToggleButton.AccessibleContext.accessibleDescription=N/A
 QueryPanel.webButton.AccessibleContext.accessibleDescription=N/A
+QueryPanel.saveButton.AccessibleContext.accessibleDescription=N/A
 QueryPanel.separatorLabel2.text=
 QueryPanel.separatorLabel3.text=
 QueryPanel.jLabel7.text=
diff --git 
a/bugzilla/src/org/netbeans/modules/bugzilla/query/QueryController.java 
b/bugzilla/src/org/netbeans/modules/bugzilla/query/QueryController.java
--- a/bugzilla/src/org/netbeans/modules/bugzilla/query/QueryController.java
+++ b/bugzilla/src/org/netbeans/modules/bugzilla/query/QueryController.java
@@ -175,6 +175,7 @@
         panel.searchButton.addActionListener(this);
         panel.keywordsButton.addActionListener(this);
         panel.cancelChangesButton.addActionListener(this);
+        panel.saveChangesButton.addActionListener(this);
         panel.gotoIssueButton.addActionListener(this);
         panel.webButton.addActionListener(this);
         panel.urlToggleButton.addActionListener(this);
@@ -397,6 +398,7 @@
                         @Override
                         public void run() {
                             enableFields(true);
+                            setChanged();
                             handle.finish();
                             panel.showRetrievingProgress(false, null, 
!query.isSaved());
                         }
@@ -525,6 +527,8 @@
             onGotoIssue();
         } else if (e.getSource() == panel.keywordsButton) {
             onKeywords();
+        } else if (e.getSource() == panel.saveChangesButton) {
+            onSave(true); // refresh
         } else if (e.getSource() == panel.cancelChangesButton) {
             onCancelChanges();
         } else if (e.getSource() == panel.webButton) {
@@ -1025,13 +1029,16 @@
 
     @Override
     public void stateChanged(ChangeEvent e) {
+        setChanged();
+    }
+
+    public void setChanged() {
         UIUtils.runInAWT(new Runnable() {
             @Override
             public void run() {
-                if (!ignoreChanges && isChanged()) {
+                panel.saveChangesButton.setEnabled((!ignoreChanges && 
isChanged()) || !query.isSaved());
                     fireChanged();
                 }                
-            }
         });
     }
 
diff --git a/bugzilla/src/org/netbeans/modules/bugzilla/query/QueryPanel.form 
b/bugzilla/src/org/netbeans/modules/bugzilla/query/QueryPanel.form
--- a/bugzilla/src/org/netbeans/modules/bugzilla/query/QueryPanel.form
+++ b/bugzilla/src/org/netbeans/modules/bugzilla/query/QueryPanel.form
@@ -1371,9 +1371,11 @@
               <Group type="102" alignment="1" attributes="0">
                   <EmptySpace max="-2" attributes="0"/>
                   <Component id="searchButton" min="-2" max="-2" 
attributes="0"/>
-                  <EmptySpace max="-2" attributes="0"/>
+                  <EmptySpace type="unrelated" max="-2" attributes="0"/>
+                  <Component id="saveChangesButton" min="-2" max="-2" 
attributes="0"/>
+                  <EmptySpace type="unrelated" max="-2" attributes="0"/>
                   <Component id="cancelChangesButton" min="-2" max="-2" 
attributes="0"/>
-                  <EmptySpace max="32767" attributes="0"/>
+                  <EmptySpace pref="496" max="32767" attributes="0"/>
                   <Component id="webButton" min="-2" max="-2" 
attributes="0"/>
                   <EmptySpace max="-2" attributes="0"/>
                   <Component id="separatorLabel2" min="-2" max="-2" 
attributes="0"/>
@@ -1399,6 +1401,7 @@
                       <Group type="103" alignment="0" groupAlignment="3" 
attributes="0">
                           <Component id="searchButton" alignment="3" 
min="-2" max="-2" attributes="0"/>
                           <Component id="cancelChangesButton" alignment="3" 
min="-2" max="-2" attributes="0"/>
+                          <Component id="saveChangesButton" alignment="3" 
min="-2" max="-2" attributes="0"/>
                       </Group>
                       <Group type="103" alignment="0" groupAlignment="3" 
attributes="0">
                           <Component id="refreshConfigurationButton" 
alignment="3" min="-2" max="-2" attributes="0"/>
@@ -1626,7 +1629,7 @@
                           <EmptySpace max="-2" attributes="0"/>
                           <Component id="jLabel2" min="-2" max="-2" 
attributes="0"/>
                           <EmptySpace max="-2" attributes="0"/>
-                          <Component id="urlTextField" pref="829" 
max="32767" attributes="0"/>
+                          <Component id="urlTextField" max="32767" 
attributes="0"/>
                           <EmptySpace max="-2" attributes="0"/>
                       </Group>
                   </Group>
@@ -1683,6 +1686,21 @@
             <AuxValue name="JavaCodeGenerator_VariableModifier" 
type="java.lang.Integer" value="16"/>
           </AuxValues>
         </Component>
+        <Component class="javax.swing.JButton" name="saveChangesButton">
+          <Properties>
+            <Property name="text" type="java.lang.String" 
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+              <ResourceString 
bundle="org/netbeans/modules/bugzilla/query/Bundle.properties" 
key="QueryPanel.saveChangesButton.text" 
replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, 
&quot;{key}&quot;)"/>
+            </Property>
+          </Properties>
+          <AccessibilityProperties>
+            <Property name="AccessibleContext.accessibleDescription" 
type="java.lang.String" 
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+              <ResourceString 
bundle="org/netbeans/modules/bugzilla/query/Bundle.properties" 
key="QueryPanel.saveChangesButton.AccessibleContext.accessibleDescription" 
replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, 
&quot;{key}&quot;)"/>
+            </Property>
+          </AccessibilityProperties>
+          <AuxValues>
+            <AuxValue name="JavaCodeGenerator_VariableModifier" 
type="java.lang.Integer" value="16"/>
+          </AuxValues>
+        </Component>
         <Container class="javax.swing.JPanel" name="gotoPanel">
           <Properties>
             <Property name="background" type="java.awt.Color" 
editor="org.netbeans.beaninfo.editors.ColorEditor">
diff --git a/bugzilla/src/org/netbeans/modules/bugzilla/query/QueryPanel.java 
b/bugzilla/src/org/netbeans/modules/bugzilla/query/QueryPanel.java
--- a/bugzilla/src/org/netbeans/modules/bugzilla/query/QueryPanel.java
+++ b/bugzilla/src/org/netbeans/modules/bugzilla/query/QueryPanel.java
@@ -121,6 +121,8 @@
         filterLabel.setVisible(false);
         noContentPanel.setVisible(false);
         
+        saveChangesButton.setEnabled(false);
+
         bugAssigneeCheckBox.setOpaque(false);
         reporterCheckBox.setOpaque(false);
         ccCheckBox.setOpaque(false);
@@ -797,7 +799,7 @@
                 .addContainerGap()
                 .addComponent(jLabel2)
                 
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                .addComponent(urlTextField, 
javax.swing.GroupLayout.DEFAULT_SIZE, 829, Short.MAX_VALUE)
+                .addComponent(urlTextField)
                 .addContainerGap())
         );
         urlPanelLayout.setVerticalGroup(
@@ -853,6 +855,8 @@
 
         org.openide.awt.Mnemonics.setLocalizedText(cancelChangesButton, 
org.openide.util.NbBundle.getMessage(QueryPanel.class, 
"QueryPanel.cancelChangesButton.text")); // NOI18N
 
+        org.openide.awt.Mnemonics.setLocalizedText(saveChangesButton, 
org.openide.util.NbBundle.getMessage(QueryPanel.class, 
"QueryPanel.saveChangesButton.text")); // NOI18N
+
         gotoPanel.setBackground(new java.awt.Color(224, 224, 224));
 
         jLabel1.setLabelFor(idTextField);
@@ -907,9 +911,11 @@
             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, 
searchPanelLayout.createSequentialGroup()
                 .addContainerGap()
                 .addComponent(searchButton)
-                
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+                .addComponent(saveChangesButton)
+                
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                 .addComponent(cancelChangesButton)
-                
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 496, 
Short.MAX_VALUE)
                 .addComponent(webButton, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE)
                 
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                 .addComponent(separatorLabel2)
@@ -932,7 +938,8 @@
                 
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                     
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                         .addComponent(searchButton)
-                        .addComponent(cancelChangesButton))
+                        .addComponent(cancelChangesButton)
+                        .addComponent(saveChangesButton))
                     
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                         .addComponent(refreshConfigurationButton, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE)
                         .addComponent(urlToggleButton, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE)
@@ -948,6 +955,7 @@
         
urlToggleButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(QueryPanel.class,
 "QueryPanel.urlToggleButton.AccessibleContext.accessibleDescription")); // 
NOI18N
         
searchButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(QueryPanel.class,
 "QueryPanel.searchButton.AccessibleContext.accessibleDescription")); // 
NOI18N
         
cancelChangesButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(QueryPanel.class,
 "QueryPanel.cancelChangesButton.AccessibleContext.accessibleDescription")); 
// NOI18N
+        
saveChangesButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(QueryPanel.class,
 "QueryPanel.saveChangesButton.AccessibleContext.accessibleDescription")); // 
NOI18N
         
refreshConfigurationButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(QueryPanel.class,
 
"QueryPanel.refreshConfigurationButton.AccessibleContext.accessibleDescription"));
 // NOI18N
 
         
queryHeaderPanel.setBackground(javax.swing.UIManager.getDefaults().getColor("TextArea.background"));
@@ -1220,6 +1228,7 @@
     final javax.swing.JLabel resolutionLabel = new javax.swing.JLabel();
     final javax.swing.JList resolutionList = new javax.swing.JList();
     final javax.swing.JScrollPane resolutionScrollPane = new 
HackedScrollPane();
+    final javax.swing.JButton saveChangesButton = new javax.swing.JButton();
     final javax.swing.JButton searchButton = new javax.swing.JButton();
     final javax.swing.JPanel searchPanel = new javax.swing.JPanel();
     final org.netbeans.modules.bugtracking.commons.LinkButton seenButton = 
new org.netbeans.modules.bugtracking.commons.LinkButton();
@@ -1370,6 +1379,7 @@
             public void run() {
                 searchPanel.setVisible(b);
                 cancelChangesButton.setVisible(b);
+                saveChangesButton.setVisible(b);
                 
                 webButton.setVisible(b);
                 separatorLabel2.setVisible(b);
diff --git a/jira/src/org/netbeans/modules/jira/query/Bundle.properties 
b/jira/src/org/netbeans/modules/jira/query/Bundle.properties
--- a/jira/src/org/netbeans/modules/jira/query/Bundle.properties
+++ b/jira/src/org/netbeans/modules/jira/query/Bundle.properties
@@ -76,6 +76,8 @@
 QueryPanel.seenButton.text=Mark All Tasks As Seen
 QueryPanel.removeButton.text=Remove
 QueryPanel.webButton.text=Open web Query
+QueryPanel.saveChangesButton.text=Save Changes
+QueryPanel.saveQueryButton.text=Save Query
 QueryPanel.cancelChangesButton.text=Cancel Changes
 QueryPanel.jLabel4.text_1=
 QueryPanel.jLabel5.text=
diff --git a/jira/src/org/netbeans/modules/jira/query/QueryController.java 
b/jira/src/org/netbeans/modules/jira/query/QueryController.java
--- a/jira/src/org/netbeans/modules/jira/query/QueryController.java
+++ b/jira/src/org/netbeans/modules/jira/query/QueryController.java
@@ -172,6 +172,7 @@
         panel.projectList.addListSelectionListener(this);
         panel.filterComboBox.addItemListener(this);
         panel.searchButton.addActionListener(this);
+        panel.saveChangesButton.addActionListener(this);
         panel.cancelChangesButton.addActionListener(this);
         panel.gotoIssueButton.addActionListener(this);
         panel.webButton.addActionListener(this);
@@ -709,6 +710,7 @@
 
     public void changed(boolean b) {
         isChanged = b;
+        panel.saveChangesButton.setEnabled(b || !query.isSaved());
         fireChanged();
     }
 
@@ -761,6 +763,8 @@
             onGotoIssue();
         } else if (e.getSource() == panel.searchButton) {
             onRefresh();
+        } else if (e.getSource() == panel.saveChangesButton) {
+            onSave(null, true);   // invoke refresh after save
         } else if (e.getSource() == panel.cancelChangesButton) {
             onCancelChanges();
         } else if (e.getSource() == panel.webButton) {
diff --git a/jira/src/org/netbeans/modules/jira/query/QueryPanel.form 
b/jira/src/org/netbeans/modules/jira/query/QueryPanel.form
--- a/jira/src/org/netbeans/modules/jira/query/QueryPanel.form
+++ b/jira/src/org/netbeans/modules/jira/query/QueryPanel.form
@@ -1268,11 +1268,13 @@
                   <Group type="103" groupAlignment="1" attributes="0">
                       <Group type="102" alignment="0" attributes="0">
                           <Component id="searchButton" min="-2" max="-2" 
attributes="0"/>
-                          <EmptySpace max="-2" attributes="0"/>
+                          <EmptySpace type="unrelated" max="-2" 
attributes="0"/>
+                          <Component id="saveChangesButton" min="-2" 
max="-2" attributes="0"/>
+                          <EmptySpace type="unrelated" max="-2" 
attributes="0"/>
                           <Component id="cancelChangesButton" min="-2" 
max="-2" attributes="0"/>
                           <EmptySpace max="-2" attributes="0"/>
                           <Component id="warningLabel" min="-2" max="-2" 
attributes="0"/>
-                          <EmptySpace max="32767" attributes="0"/>
+                          <EmptySpace pref="523" max="32767" attributes="0"/>
                           <Component id="webButton" min="-2" max="-2" 
attributes="0"/>
                           <EmptySpace max="-2" attributes="0"/>
                           <Component id="separatorLabel2" min="-2" max="-2" 
attributes="0"/>
@@ -1296,7 +1298,8 @@
                       <Group type="103" groupAlignment="3" attributes="0">
                           <Component id="searchButton" alignment="3" 
min="-2" max="-2" attributes="0"/>
                           <Component id="cancelChangesButton" alignment="3" 
min="-2" max="-2" attributes="0"/>
-                          <Component id="warningLabel" alignment="0" 
min="-2" max="-2" attributes="0"/>
+                          <Component id="saveChangesButton" alignment="3" 
min="-2" max="-2" attributes="0"/>
+                          <Component id="warningLabel" alignment="3" 
min="-2" max="-2" attributes="0"/>
                       </Group>
                       <Group type="103" alignment="0" groupAlignment="3" 
attributes="0">
                           <Component id="reloadAttributesButton" 
alignment="3" min="-2" max="-2" attributes="0"/>
@@ -1487,6 +1490,16 @@
             <AuxValue name="JavaCodeGenerator_VariableModifier" 
type="java.lang.Integer" value="16"/>
           </AuxValues>
         </Component>
+        <Component class="javax.swing.JButton" name="saveChangesButton">
+          <Properties>
+            <Property name="text" type="java.lang.String" 
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+              <ResourceString 
bundle="org/netbeans/modules/jira/query/Bundle.properties" 
key="QueryPanel.saveChangesButton.text" 
replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, 
&quot;{key}&quot;)"/>
+            </Property>
+          </Properties>
+          <AuxValues>
+            <AuxValue name="JavaCodeGenerator_VariableModifier" 
type="java.lang.Integer" value="16"/>
+          </AuxValues>
+        </Component>
         <Container class="javax.swing.JPanel" name="gotoPanel">
           <Properties>
             <Property name="background" type="java.awt.Color" 
editor="org.netbeans.beaninfo.editors.ColorEditor">
diff --git a/jira/src/org/netbeans/modules/jira/query/QueryPanel.java 
b/jira/src/org/netbeans/modules/jira/query/QueryPanel.java
--- a/jira/src/org/netbeans/modules/jira/query/QueryPanel.java
+++ b/jira/src/org/netbeans/modules/jira/query/QueryPanel.java
@@ -834,6 +834,8 @@
 
         org.openide.awt.Mnemonics.setLocalizedText(cancelChangesButton, 
org.openide.util.NbBundle.getMessage(QueryPanel.class, 
"QueryPanel.cancelChangesButton.text")); // NOI18N
 
+        org.openide.awt.Mnemonics.setLocalizedText(saveChangesButton, 
org.openide.util.NbBundle.getMessage(QueryPanel.class, 
"QueryPanel.saveChangesButton.text")); // NOI18N
+
         gotoPanel.setBackground(new java.awt.Color(224, 224, 224));
 
         org.openide.awt.Mnemonics.setLocalizedText(jLabel1, 
org.openide.util.NbBundle.getMessage(QueryPanel.class, 
"QueryPanel.jLabel1.text_1")); // NOI18N
@@ -893,11 +895,13 @@
                 
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                     .addGroup(javax.swing.GroupLayout.Alignment.LEADING, 
searchPanelLayout.createSequentialGroup()
                         .addComponent(searchButton)
-                        
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                        
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+                        .addComponent(saveChangesButton)
+                        
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                         .addComponent(cancelChangesButton)
                         
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                         .addComponent(warningLabel)
-                        
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                        
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 523, 
Short.MAX_VALUE)
                         .addComponent(webButton, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE)
                         
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                         .addComponent(separatorLabel2)
@@ -917,6 +921,7 @@
                     
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                         .addComponent(searchButton)
                         .addComponent(cancelChangesButton)
+                        .addComponent(saveChangesButton)
                         .addComponent(warningLabel))
                     
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                         .addComponent(reloadAttributesButton, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE)
@@ -1220,6 +1225,7 @@
     final javax.swing.JComboBox reporterComboBox = new 
javax.swing.JComboBox();
     final javax.swing.JTextField reporterTextField = new 
javax.swing.JTextField();
     final javax.swing.JList resolutionList = new javax.swing.JList();
+    final javax.swing.JButton saveChangesButton = new javax.swing.JButton();
     final javax.swing.JButton searchButton = new javax.swing.JButton();
     final javax.swing.JPanel searchPanel = new javax.swing.JPanel();
     final org.netbeans.modules.bugtracking.commons.LinkButton seenButton = 
new org.netbeans.modules.bugtracking.commons.LinkButton();
@@ -1341,6 +1347,7 @@
     void setModifyVisible(boolean b) {
         searchPanel.setVisible(b);
         cancelChangesButton.setVisible(b);
+        saveChangesButton.setVisible(b);
         
         webButton.setVisible(b);
         separatorLabel2.setVisible(b);
diff --git a/odcs.tasks/src/org/netbeans/modules/odcs/tasks/ODCS.java 
b/odcs.tasks/src/org/netbeans/modules/odcs/tasks/ODCS.java
--- a/odcs.tasks/src/org/netbeans/modules/odcs/tasks/ODCS.java
+++ b/odcs.tasks/src/org/netbeans/modules/odcs/tasks/ODCS.java
@@ -80,6 +80,7 @@
     private CloudDevRepositoryConnector rc;
     
     private RequestProcessor rp;
+    private RequestProcessor rpp;
     
     public static ODCS getInstance() {
         if(instance == null) {
@@ -239,6 +240,13 @@
         return rp;
     }
 
+    public RequestProcessor getParallelRequestProcessor() {
+        if(rpp == null) {
+            rpp = new RequestProcessor("ODCS Parallel Tasks", 20, true); // 
NOI18N
+        }
+        return rpp;
+    }
+
     public CloudDevClient getCloudDevClient(TaskRepository taskRepository) {
         return 
rc.getCloudDevClientManager().getCloudDevClient(taskRepository);
     }
diff --git 
a/odcs.tasks/src/org/netbeans/modules/odcs/tasks/query/Bundle.properties 
b/odcs.tasks/src/org/netbeans/modules/odcs/tasks/query/Bundle.properties
--- a/odcs.tasks/src/org/netbeans/modules/odcs/tasks/query/Bundle.properties
+++ b/odcs.tasks/src/org/netbeans/modules/odcs/tasks/query/Bundle.properties
@@ -86,6 +86,7 @@
 QueryPanel.webButton.text=Open Web Query
 LBL_MatchingIssues=There are {0} issues matching this query.
 LBL_MatchingIssue=There is 1 issue matching this query.
+QueryPanel.saveQueryButton.text=&Save Query
 QueryPanel.cancelChangesButton.text=Canc&el Changes
 QueryPanel.jLabel4.text_1=
 QueryPanel.jLabel5.text=
diff --git 
a/odcs.tasks/src/org/netbeans/modules/odcs/tasks/query/ODCSQueryController.java
 
b/odcs.tasks/src/org/netbeans/modules/odcs/tasks/query/ODCSQueryController.java
--- 
a/odcs.tasks/src/org/netbeans/modules/odcs/tasks/query/ODCSQueryController.java
+++ 
b/odcs.tasks/src/org/netbeans/modules/odcs/tasks/query/ODCSQueryController.java
@@ -161,6 +161,7 @@
         panel.refreshConfigurationButton.addActionListener(this);
         panel.findIssuesButton.addActionListener(this);
         panel.cloneQueryButton.addActionListener(this);
+        panel.saveChangesButton.addActionListener(this);
 
         panel.idTextField.addActionListener(this);
         panel.productList.addKeyListener(this);
@@ -203,7 +204,10 @@
         
         if(query.isSaved()) {
             setAsSaved();
+        } else {
+            panel.saveChangesButton.setEnabled(true);
         }
+        
         if (modifiable) {
             querySemaphore.acquireUninterruptibly();
             postPopulate(false);
@@ -416,7 +420,10 @@
 
     @Override
     public void stateChanged(ChangeEvent e) {
-        fireChanged();
+        if(!populated) {
+            return;
+    }
+        setChanged();
     }
     
     @Override
@@ -479,6 +486,8 @@
             onRefresh();
         } else if (e.getSource() == panel.gotoIssueButton) {
             onGotoIssue();
+        } else if (e.getSource() == panel.saveChangesButton) {
+            onSave(null, true); // refresh
         } else if (e.getSource() == panel.cancelChangesButton) {
             onCancelChanges();
         } else if (e.getSource() == panel.webButton) {
@@ -548,7 +557,7 @@
     }
 
     private void onSave(final String newName, final boolean refresh) {
-       ODCS.getInstance().getRequestProcessor().post(new Runnable() {
+       ODCS.getInstance().getParallelRequestProcessor().post(new Runnable() {
             @Override
             public void run() {
                 ODCS.LOG.fine("on save start");
@@ -583,7 +592,7 @@
             if(query.save(name)) {
                 setAsSaved();
                 parameters.resetChanged();
-                fireChanged();                
+                setChanged();                
                 if (!query.wasRun()) {
                     ODCS.LOG.log(Level.FINE, "refreshing query '{0}' after 
save", new Object[]{name});
                     onRefresh();
@@ -596,6 +605,12 @@
         }
     }
 
+    public void setChanged() {
+        boolean changed = isChanged();
+        panel.saveChangesButton.setEnabled(changed || !query.isSaved());
+        fireChanged();
+    }
+
     private String getSaveName() {
         QueryNameValidator v = new QueryNameValidator() {
             @Override
@@ -652,6 +667,7 @@
     private void setAsSaved() {
         panel.setSaved(query.getDisplayName(), getLastRefresh());
         panel.setModifyVisible(false);
+        panel.saveChangesButton.setEnabled(false);
     }
 
     private String getLastRefresh() throws MissingResourceException {
@@ -820,7 +836,8 @@
             originalCriteria = criteria;
             criteria = null;
         }
-        
+        parameters.resetChanged();
+        setChanged();
         panel.setModifyVisible(true);
     }
 
diff --git 
a/odcs.tasks/src/org/netbeans/modules/odcs/tasks/query/QueryPanel.form 
b/odcs.tasks/src/org/netbeans/modules/odcs/tasks/query/QueryPanel.form
--- a/odcs.tasks/src/org/netbeans/modules/odcs/tasks/query/QueryPanel.form
+++ b/odcs.tasks/src/org/netbeans/modules/odcs/tasks/query/QueryPanel.form
@@ -1219,6 +1219,8 @@
                       <Group type="102" attributes="0">
                           <Component id="searchButton" min="-2" max="-2" 
attributes="0"/>
                           <EmptySpace max="-2" attributes="0"/>
+                          <Component id="saveChangesButton" min="-2" 
max="-2" attributes="0"/>
+                          <EmptySpace max="-2" attributes="0"/>
                           <Component id="cancelChangesButton" min="-2" 
max="-2" attributes="0"/>
                           <EmptySpace max="32767" attributes="0"/>
                           <Component id="refreshConfigurationButton" 
min="-2" max="-2" attributes="0"/>
@@ -1239,6 +1241,7 @@
                   <Group type="103" groupAlignment="2" attributes="0">
                       <Component id="refreshConfigurationButton" 
alignment="2" min="-2" max="-2" attributes="0"/>
                       <Component id="cancelChangesButton" alignment="2" 
min="-2" max="-2" attributes="0"/>
+                      <Component id="saveChangesButton" alignment="2" 
min="-2" max="-2" attributes="0"/>
                       <Component id="searchButton" alignment="2" min="-2" 
max="-2" attributes="0"/>
                   </Group>
                   <EmptySpace max="-2" attributes="0"/>
@@ -1485,6 +1488,21 @@
             <AuxValue name="JavaCodeGenerator_VariableModifier" 
type="java.lang.Integer" value="16"/>
           </AuxValues>
         </Component>
+        <Component class="javax.swing.JButton" name="saveChangesButton">
+          <Properties>
+            <Property name="text" type="java.lang.String" 
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+              <ResourceString 
bundle="org/netbeans/modules/odcs/tasks/query/Bundle.properties" 
key="QueryPanel.saveQueryButton.text" 
replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, 
&quot;{key}&quot;)"/>
+            </Property>
+          </Properties>
+          <AccessibilityProperties>
+            <Property name="AccessibleContext.accessibleDescription" 
type="java.lang.String" 
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+              <ResourceString 
bundle="org/netbeans/modules/c2c/tasks/query/Bundle.properties" 
key="QueryPanel.saveChangesButton.AccessibleContext.accessibleDescription" 
replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, 
&quot;{key}&quot;)"/>
+            </Property>
+          </AccessibilityProperties>
+          <AuxValues>
+            <AuxValue name="JavaCodeGenerator_VariableModifier" 
type="java.lang.Integer" value="16"/>
+          </AuxValues>
+        </Component>
         <Container class="javax.swing.JPanel" name="gotoPanel">
           <Properties>
             <Property name="background" type="java.awt.Color" 
editor="org.netbeans.beaninfo.editors.ColorEditor">
@@ -1626,7 +1644,7 @@
                           <Component id="separatorLabel1" min="-2" max="-2" 
attributes="0"/>
                           <EmptySpace max="-2" attributes="0"/>
                           <Component id="webButton" min="-2" max="-2" 
attributes="0"/>
-                          <EmptySpace min="0" pref="0" max="32767" 
attributes="0"/>
+                          <EmptySpace min="0" pref="130" max="32767" 
attributes="0"/>
                       </Group>
                   </Group>
                   <EmptySpace max="-2" attributes="0"/>
diff --git 
a/odcs.tasks/src/org/netbeans/modules/odcs/tasks/query/QueryPanel.java 
b/odcs.tasks/src/org/netbeans/modules/odcs/tasks/query/QueryPanel.java
--- a/odcs.tasks/src/org/netbeans/modules/odcs/tasks/query/QueryPanel.java
+++ b/odcs.tasks/src/org/netbeans/modules/odcs/tasks/query/QueryPanel.java
@@ -64,6 +64,8 @@
 import javax.swing.plaf.basic.BasicTreeUI;
 import org.netbeans.modules.bugtracking.issuetable.Filter;
 import org.netbeans.modules.bugtracking.commons.UIUtils;
+import org.openide.awt.Mnemonics;
+import org.openide.util.NbBundle;
 
 /**
  *
@@ -136,6 +138,8 @@
         searchByDescriptionCheckBox.setOpaque(false);
         searchBySummaryCheckBox.setOpaque(false);
 
+        cancelChangesButton.setEnabled(false);
+        
         filterComboBox.setRenderer(new FilterCellRenderer());
 
         UIUtils.keepFocusedComponentVisible(this);
@@ -157,6 +161,7 @@
                 filterLabel.setEnabled(!running);
                 filterComboBox.setEnabled(!running);
                 
+                saveChangesButton.setEnabled(!running);
                 cancelChangesButton.setEnabled(!running);                
             }
         };
@@ -782,6 +787,8 @@
 
         org.openide.awt.Mnemonics.setLocalizedText(cancelChangesButton, 
org.openide.util.NbBundle.getMessage(QueryPanel.class, 
"QueryPanel.cancelChangesButton.text")); // NOI18N
 
+        org.openide.awt.Mnemonics.setLocalizedText(saveChangesButton, 
org.openide.util.NbBundle.getMessage(QueryPanel.class, 
"QueryPanel.saveQueryButton.text")); // NOI18N
+
         gotoPanel.setBackground(new java.awt.Color(224, 224, 224));
 
         jLabel1.setLabelFor(idTextField);
@@ -833,6 +840,8 @@
                     .addGroup(searchPanelLayout.createSequentialGroup()
                         .addComponent(searchButton)
                         
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                        .addComponent(saveChangesButton)
+                        
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                         .addComponent(cancelChangesButton)
                         
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                         .addComponent(refreshConfigurationButton, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE)))
@@ -849,12 +858,14 @@
                 
.addGroup(searchPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                     .addComponent(refreshConfigurationButton, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE)
                     .addComponent(cancelChangesButton)
+                    .addComponent(saveChangesButton)
                     .addComponent(searchButton))
                 .addContainerGap())
         );
 
         
searchButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(QueryPanel.class,
 "QueryPanel.searchButton.AccessibleContext.accessibleDescription")); // 
NOI18N
         
cancelChangesButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(QueryPanel.class,
 "QueryPanel.cancelChangesButton.AccessibleContext.accessibleDescription")); 
// NOI18N
+        
saveChangesButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(QueryPanel.class,
 "QueryPanel.saveChangesButton.AccessibleContext.accessibleDescription")); // 
NOI18N
         
refreshConfigurationButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(QueryPanel.class,
 
"QueryPanel.refreshConfigurationButton.AccessibleContext.accessibleDescription"));
 // NOI18N
 
         
queryHeaderPanel.setBackground(javax.swing.UIManager.getDefaults().getColor("TextArea.background"));
@@ -971,7 +982,7 @@
                         .addComponent(separatorLabel1)
                         
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                         .addComponent(webButton, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE)
-                        .addGap(0, 0, Short.MAX_VALUE)))
+                        .addGap(0, 130, Short.MAX_VALUE)))
                 .addContainerGap())
         );
         queryHeaderPanelLayout.setVerticalGroup(
@@ -1154,6 +1165,7 @@
     public final org.netbeans.modules.bugtracking.commons.LinkButton 
removeButton = new org.netbeans.modules.bugtracking.commons.LinkButton();
     final javax.swing.JLabel resolutionLabel = new javax.swing.JLabel();
     final javax.swing.JList resolutionList = new javax.swing.JList();
+    final javax.swing.JButton saveChangesButton = new javax.swing.JButton();
     final javax.swing.JButton searchButton = new javax.swing.JButton();
     final javax.swing.JCheckBox searchByDescriptionCheckBox = new 
javax.swing.JCheckBox();
     final javax.swing.JCheckBox searchBySummaryCheckBox = new 
javax.swing.JCheckBox();
@@ -1281,8 +1293,12 @@
             public void run() {
                 searchPanel.setVisible(b);
                 cancelChangesButton.setVisible(b);
+                saveChangesButton.setVisible(b);
+                
                 tableFieldsPanel.setVisible(!b);
                 searchButton.setVisible(!b);
+                
+                modifyButton.setEnabled(!b);
             }
         };
         UIUtils.runInAWT(r);
@@ -1300,6 +1316,7 @@
                 tablePanel.setVisible(true);
                 nameLabel.setText(name);
                 setLastRefresh(lastRefresh);
+                Mnemonics.setLocalizedText(startLabel, 
NbBundle.getMessage(QueryPanel.class, "QueryPanel.saveQueryButton.text")); // 
NOI18N
             }
         };
         UIUtils.runInAWT(r);

[hg] main-silver: Issue #239698 - Missing Save button in modify ...

Tomas Stupka 01/10/2014

Project Features

About this Project

ConnectedDeveloper was started in November 2009, is owned by tpavek, and has 64 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close