[hg] main-silver: #233931 - Resolution field is not displayed as...

  • From: Ondrej Vrabec < >
  • To:
  • Subject: [hg] main-silver: #233931 - Resolution field is not displayed as...
  • Date: Tue, 13 Aug 2013 13:30:41 -0700

changeset 159809c7b728 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/159809c7b728
description:
        #233931 - Resolution field is not displayed as unsubmitted

diffstat:

 bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.form |  30 ++-
 bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.java |  90 
++++++++-
 2 files changed, 99 insertions(+), 21 deletions(-)

diffs (337 lines):

diff --git a/bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.form 
b/bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.form
--- a/bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.form
+++ b/bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.form
@@ -391,6 +391,8 @@
                           <Group type="102" alignment="0" attributes="0">
                               <Group type="103" groupAlignment="0" 
attributes="0">
                                   <Group type="102" attributes="0">
+                                      <Group type="103" groupAlignment="0" 
attributes="0">
+                                          <Group type="102" attributes="0">
                                       <Group type="103" groupAlignment="0" 
max="-2" attributes="0">
                                           <Component id="issueTypeCombo" 
max="32767" attributes="1"/>
                                           <Component 
id="statusWhiteboardField" min="0" pref="0" max="32767" attributes="1"/>
@@ -441,6 +443,12 @@
                                               <EmptySpace min="-2" pref="5" 
max="-2" attributes="0"/>
                                           </Group>
                                       </Group>
+                                          </Group>
+                                          <Group type="102" alignment="1" 
attributes="0">
+                                              <Component 
id="duplicateWarning" min="-2" pref="16" max="-2" attributes="0"/>
+                                              <EmptySpace min="-2" pref="5" 
max="-2" attributes="0"/>
+                                          </Group>
+                                      </Group>
                                       <Group type="103" groupAlignment="0" 
attributes="0">
                                           <Component id="blocksLabel" 
alignment="0" min="-2" max="-2" attributes="0"/>
                                           <Component id="dependsLabel" 
alignment="0" min="-2" max="-2" attributes="0"/>
@@ -608,11 +616,11 @@
                   <Component id="resolutionField" alignment="2" min="-2" 
max="-2" attributes="0"/>
               </Group>
               <EmptySpace min="-2" max="-2" attributes="0"/>
-              <Group type="103" groupAlignment="3" attributes="0">
-                  <Component id="dummyLabel2" linkSize="8" alignment="3" 
min="-2" max="-2" attributes="0"/>
-                  <Component id="duplicateLabel" alignment="3" min="-2" 
max="-2" attributes="0"/>
-                  <Component id="duplicateField" alignment="3" min="-2" 
max="-2" attributes="0"/>
-                  <Component id="duplicateButton" alignment="3" min="-2" 
max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="2" attributes="0">
+                  <Component id="duplicateWarning" alignment="2" min="-2" 
pref="16" max="-2" attributes="0"/>
+                  <Component id="duplicateLabel" alignment="2" min="-2" 
max="-2" attributes="0"/>
+                  <Component id="duplicateField" alignment="2" min="-2" 
max="-2" attributes="0"/>
+                  <Component id="duplicateButton" alignment="2" min="-2" 
max="-2" attributes="0"/>
               </Group>
               <EmptySpace min="-2" max="-2" attributes="0"/>
               <Group type="103" groupAlignment="2" attributes="0">
@@ -703,9 +711,17 @@
               <Component id="dummyCommentsPanel" max="32767" attributes="0"/>
           </Group>
           <Group type="102" attributes="0">
+              <Group type="103" groupAlignment="0" attributes="0">
+                  <Group type="102" attributes="0">
               <EmptySpace min="65" pref="65" max="-2" attributes="0"/>
               <Component id="assignedToStatusLabel" min="-2" max="-2" 
attributes="0"/>
-              <EmptySpace min="539" pref="539" max="-2" attributes="0"/>
+                  </Group>
+                  <Group type="102" attributes="0">
+                      <EmptySpace min="281" pref="281" max="-2" 
attributes="0"/>
+                      <Component id="dummyLabel2" linkSize="8" min="-2" 
max="-2" attributes="0"/>
+                  </Group>
+              </Group>
+              <EmptySpace min="-2" pref="299" max="-2" attributes="0"/>
           </Group>
       </Group>
     </DimensionLayout>
@@ -1511,5 +1527,7 @@
     </Component>
     <Component class="javax.swing.JLabel" name="commentWarning">
     </Component>
+    <Component class="javax.swing.JLabel" name="duplicateWarning">
+    </Component>
   </SubComponents>
 </Form>
diff --git a/bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.java 
b/bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.java
--- a/bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.java
+++ b/bugzilla/src/org/netbeans/modules/bugzilla/issue/IssuePanel.java
@@ -157,6 +157,9 @@
  *
  * @author Jan Stola
  */
+@NbBundle.Messages({
+    "LBL_Duplicate.fieldName=Duplicate of"
+})
 public class IssuePanel extends javax.swing.JPanel implements Scrollable {
     private static Color incomingChangesColor = null;
     private static final RequestProcessor RP = new 
RequestProcessor("Bugzilla Issue Panel", 5, false); // NOI18N
@@ -200,6 +203,7 @@
         Font font = reportedLabel.getFont();
         headerField.setFont(font.deriveFont((float)(font.getSize()*1.7)));
         duplicateLabel.setVisible(false);
+        duplicateWarning.setVisible(false);
         duplicateField.setVisible(false);
         duplicateButton.setVisible(false);
         attachDocumentListeners();
@@ -829,26 +833,27 @@
         if (warningLabel != null) {
             boolean change = false;
             if (!isNew) {
+                boolean visible = warningLabel.isVisible();
                 IssueField field = fields[0].first();
                 removeTooltips(warningLabel, field);
                 if (fieldLabel != null && fieldLabel.getFont().isBold()) {
                     
fieldLabel.setFont(fieldLabel.getFont().deriveFont(fieldLabel.getFont().getStyle()
 & ~Font.BOLD));
                 }
-                if (!valueModifiedByUser && !fieldDirty && 
valueModifiedByServer) {
+                if (visible && !valueModifiedByUser && !fieldDirty && 
valueModifiedByServer) {
                     String message = 
Bundle.IssuePanel_fieldModifiedRemotely(fieldName, lastSeenValue, 
repositoryValue);
                     // do not use ||
                     change = fieldsLocal.remove(field) != null | 
fieldsConflict.remove(field) != null
                             | !message.equals(fieldsIncoming.put(field, 
message));
                     tooltipsIncoming.addTooltip(warningLabel, field, 
Bundle.IssuePanel_fieldModifiedRemotelyTT(
                             fieldName, lastSeenValue, repositoryValue, 
ICON_REMOTE_PATH));
-                } else if (valueModifiedByServer) {
+                } else if (visible && valueModifiedByServer) {
                     String message = 
Bundle.IssuePanel_fieldModifiedConflict(fieldName, lastSeenValue, 
repositoryValue);
                     // do not use ||
                     change = fieldsLocal.remove(field) != null | 
fieldsIncoming.remove(field) != null
                             | !message.equals(fieldsConflict.put(field, 
message));
                     tooltipsConflict.addTooltip(warningLabel, field, 
Bundle.IssuePanel_fieldModifiedConflictTT(
                             fieldName, lastSeenValue, repositoryValue, 
newValue, ICON_CONFLICT_PATH));
-                } else if (valueModifiedByUser || fieldDirty) {
+                } else if (visible && (valueModifiedByUser || fieldDirty)) {
                     String message;
                     if (field == IssueField.COMMENT) {
                         message = Bundle.IssuePanel_commentAddedLocally();
@@ -982,7 +987,7 @@
         });
     }
 
-    private void initStatusCombo(String status) {
+    private void initStatusCombo(String currentStatus) {
         // Init statusCombo - allowed transitions (heuristics):
         // Open -> Open-Unconfirmed-Reopened+Resolved
         // Resolved -> Reopened+Close
@@ -1001,8 +1006,12 @@
         String unconfirmed = "UNCONFIRMED"; // NOI18N
         String reopened = "REOPENED"; // NOI18N
         String resolved = "RESOLVED"; // NOI18N
-        if(status != null) {
-            status = status.trim();
+        if (currentStatus != null) {
+            currentStatus = currentStatus.trim();
+        }
+        String status = issue.getLastSeenFieldValue(IssueField.STATUS);
+        if (status.isEmpty()) {
+            status = currentStatus;
         }
         if (openStatuses.contains(status)) {
             statuses.addAll(openStatuses);
@@ -1051,7 +1060,7 @@
         }
         resolvedIndex = statuses.indexOf(resolved);
         statusCombo.setModel(toComboModel(statuses));
-        statusCombo.setSelectedItem(status);
+        statusCombo.setSelectedItem(currentStatus);
     }
 
     private ComboBoxModel toComboModel(List<String> items) {
@@ -1077,6 +1086,8 @@
         updateFieldDecorations(statusCombo, IssueField.STATUS, 
statusWarning, statusLabel);
         updateFieldStatus(resolutionLabel, IssueField.RESOLUTION);
         updateFieldDecorations(resolutionCombo, IssueField.RESOLUTION, 
resolutionWarning, resolutionLabel);
+        updateFieldStatus(duplicateLabel, IssueField.DUPLICATE_ID);
+        updateFieldDecorations(duplicateWarning, duplicateLabel, 
Bundle.LBL_Duplicate_fieldName(), Pair.of(IssueField.DUPLICATE_ID, 
duplicateField));
         if (BugzillaUtil.showIssueType(issue.getRepository())) {
             updateFieldStatus(priorityLabel, IssueField.PRIORITY, 
IssueField.ISSUE_TYPE);
             updateFieldDecorations(priorityWarning, priorityLabel, new 
Pair[] {
@@ -1197,8 +1208,10 @@
             changed = true;
             if (value.equals("DUPLICATE")) {
                 issue.duplicate(duplicateField.getText().trim());
+                if 
(!duplicateField.getText().trim().equals(issue.getFieldValue(IssueField.DUPLICATE_ID)))
 {
                 unsavedFields.add(IssueField.DUPLICATE_ID);
                 issue.setFieldValue(IssueField.DUPLICATE_ID, 
duplicateField.getText().trim());
+                }
             } else {
                 issue.resolve(value);
             }
@@ -1707,6 +1720,7 @@
         btnDeleteTask = new javax.swing.JButton();
         timetrackingWarning = new javax.swing.JLabel();
         commentWarning = new javax.swing.JLabel();
+        duplicateWarning = new javax.swing.JLabel();
 
         FormListener formListener = new FormListener();
 
@@ -2110,6 +2124,8 @@
                             .addGroup(layout.createSequentialGroup()
                                 
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                     .addGroup(layout.createSequentialGroup()
+                                        
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                                            
.addGroup(layout.createSequentialGroup()
                                         
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
 false)
                                             .addComponent(issueTypeCombo, 0, 
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                             
.addComponent(statusWhiteboardField, 0, 0, Short.MAX_VALUE)
@@ -2148,6 +2164,9 @@
                                                     
.addComponent(statusWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 16, 
javax.swing.GroupLayout.PREFERRED_SIZE)
                                                     .addComponent(ccWarning, 
javax.swing.GroupLayout.PREFERRED_SIZE, 16, 
javax.swing.GroupLayout.PREFERRED_SIZE)
                                                     
.addComponent(resolutionWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 16, 
javax.swing.GroupLayout.PREFERRED_SIZE))
+                                                        .addGap(5, 5, 5))))
+                                            
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, 
layout.createSequentialGroup()
+                                                
.addComponent(duplicateWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 16, 
javax.swing.GroupLayout.PREFERRED_SIZE)
                                                 .addGap(5, 5, 5)))
                                         
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                             .addComponent(blocksLabel)
@@ -2292,8 +2311,8 @@
                     .addComponent(resolutionLabel)
                     .addComponent(resolutionField, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE))
                 
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
-                    .addComponent(dummyLabel2)
+                
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
+                    .addComponent(duplicateWarning, 
javax.swing.GroupLayout.PREFERRED_SIZE, 16, 
javax.swing.GroupLayout.PREFERRED_SIZE)
                     .addComponent(duplicateLabel)
                     .addComponent(duplicateField, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE)
                     .addComponent(duplicateButton))
@@ -2369,9 +2388,14 @@
                 
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                 .addComponent(dummyCommentsPanel, 
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
Short.MAX_VALUE))
             .addGroup(layout.createSequentialGroup()
+                
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                    .addGroup(layout.createSequentialGroup()
                 .addGap(65, 65, 65)
-                .addComponent(assignedToStatusLabel)
-                .addGap(539, 539, 539))
+                        .addComponent(assignedToStatusLabel))
+                    .addGroup(layout.createSequentialGroup()
+                        .addGap(281, 281, 281)
+                        .addComponent(dummyLabel2)))
+                .addGap(299, 299, 299))
         );
 
         layout.linkSize(javax.swing.SwingConstants.VERTICAL, new 
java.awt.Component[] {refreshButton, reloadButton, separatorLabel, 
separatorLabel2, separatorLabel3, showInBrowserButton});
@@ -2602,13 +2626,21 @@
             if (resolutionCombo.getParent() == null) {
                 ((GroupLayout)getLayout()).replace(resolutionField, 
resolutionCombo);
             }
+            resolutionCombo.setVisible(true);
+            resolutionWarning.setVisible(true);
+            resolutionLabel.setVisible(true);
             resolutionCombo.setSelectedItem("FIXED"); // NOI18N
-            resolutionCombo.setVisible(true);
         } else {
             resolutionCombo.setVisible(false);
+            resolutionLabel.setVisible(false);
+            resolutionWarning.setVisible(false);
+            updateFieldDecorations(resolutionCombo, IssueField.RESOLUTION, 
resolutionWarning, resolutionLabel);
             duplicateLabel.setVisible(false);
+            duplicateWarning.setVisible(false);
             duplicateField.setVisible(false);
             duplicateButton.setVisible(false);
+            updateFieldDecorations(duplicateField, IssueField.DUPLICATE_ID, 
duplicateWarning, duplicateLabel);
+            updateNoDuplicateId();
         }
         if (!resolutionField.getText().trim().equals("")) { // NOI18N
             if (statusCombo.getSelectedIndex() > resolvedIndex) {
@@ -2620,8 +2652,11 @@
                 resolutionField.setVisible(false);
             }
             duplicateLabel.setVisible(false);
+            duplicateWarning.setVisible(false);
             duplicateField.setVisible(false);
             duplicateButton.setVisible(false);
+            updateFieldDecorations(duplicateField, IssueField.DUPLICATE_ID, 
duplicateWarning, duplicateLabel);
+            updateNoDuplicateId();
         }
         resolutionLabel.setLabelFor(resolutionCombo.isVisible() ? 
resolutionCombo : resolutionField);
     }//GEN-LAST:event_statusComboActionPerformed
@@ -2772,8 +2807,10 @@
         }
         boolean shown = 
"DUPLICATE".equals(resolutionCombo.getSelectedItem()); // NOI18N
         duplicateLabel.setVisible(shown);
+        duplicateWarning.setVisible(shown);
         duplicateField.setVisible(shown);
         duplicateButton.setVisible(shown && duplicateField.isEditable());
+        updateFieldDecorations(duplicateField, IssueField.DUPLICATE_ID, 
duplicateWarning, duplicateLabel);
         updateNoDuplicateId();
     }//GEN-LAST:event_resolutionComboActionPerformed
 
@@ -3142,6 +3179,7 @@
     private javax.swing.JButton duplicateButton;
     private javax.swing.JTextField duplicateField;
     private javax.swing.JLabel duplicateLabel;
+    private javax.swing.JLabel duplicateWarning;
     private javax.swing.JTextField estimatedField;
     private javax.swing.JLabel estimatedLabel;
     private javax.swing.JLabel estimatedWarning;
@@ -3446,7 +3484,16 @@
         statusCombo.addActionListener(new FieldChangeListener(statusCombo, 
IssueField.STATUS, statusWarning, statusLabel));
         
         resolutionCombo.addActionListener(new 
FieldChangeListener(resolutionCombo, IssueField.RESOLUTION, 
resolutionWarning, resolutionLabel));
-        duplicateField.getDocument().addDocumentListener(new 
FieldChangeListener(duplicateField, IssueField.DUPLICATE_ID));
+        duplicateField.getDocument().addDocumentListener(new 
FieldChangeListener(duplicateField, IssueField.DUPLICATE_ID,
+                duplicateWarning, duplicateLabel, 
Bundle.LBL_Duplicate_fieldName()) {
+            @Override
+            public void fieldModified () {
+                if (!reloading && duplicateField.isVisible() && 
duplicateField.isEditable()) {
+                    storeFieldValue(IssueField.DUPLICATE_ID, 
duplicateField); //NOI18N
+                    updateDecorations();
+                }
+            }
+        });
         
         boolean showIssueType = 
BugzillaUtil.showIssueType(issue.getRepository());
         priorityCombo.addActionListener(new 
FieldChangeListener(priorityCombo, IssueField.PRIORITY, priorityWarning, 
priorityLabel, new Pair[] {
@@ -3613,12 +3660,23 @@
         }
         
         public FieldChangeListener (JComponent component, IssueField field, 
JLabel warningLabel,
+                JComponent fieldLabel, String fieldName) {
+            this(component, field, warningLabel, fieldLabel, fieldName, 
Pair.of(field, component));
+        }
+        
+        public FieldChangeListener (JComponent component, IssueField field, 
JLabel warningLabel,
                 JComponent fieldLabel, Pair<IssueField, ? extends 
JComponent>... multiField) {
+            this(component, field, warningLabel, fieldLabel,
+                    fieldLabel == null ? null : fieldName(fieldLabel), 
multiField);
+        }
+        
+        public FieldChangeListener (JComponent component, IssueField field, 
JLabel warningLabel,
+                JComponent fieldLabel, String fieldName, Pair<IssueField, ? 
extends JComponent>... multiField) {
             this.component = component;
             this.field = field;
             this.warningLabel = warningLabel;
             this.fieldLabel = fieldLabel;
-            this.fieldName = fieldLabel == null ? null : 
fieldName(fieldLabel);
+            this.fieldName = fieldName;
             this.decoratedFields = multiField;
         }
 
@@ -3801,7 +3859,9 @@
     }
 
     private void updateNoDuplicateId() {
-        boolean newNoDuplicateId = 
"DUPLICATE".equals(resolutionCombo.getSelectedItem()) && 
"".equals(duplicateField.getText().trim());
+        boolean newNoDuplicateId = 
"DUPLICATE".equals(resolutionCombo.getSelectedItem()) 
+                && duplicateField.isVisible()
+                && "".equals(duplicateField.getText().trim());
         if(newNoDuplicateId != noDuplicateId) {
             noDuplicateId = newNoDuplicateId;
             updateMessagePanel();

[hg] main-silver: #233931 - Resolution field is not displayed as...

Ondrej Vrabec 08/13/2013

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