Cleanup; fixed default radio selection bug.

This commit is contained in:
U-BASIS\dgrove 2018-11-27 15:49:45 -05:00
parent ab242a0ab1
commit e38d85c0e2
2 changed files with 28 additions and 26 deletions

View File

@ -37,9 +37,6 @@
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="null"/> <Dimension value="null"/>
</Property> </Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="null"/>
</Property>
<Property name="requestFocusEnabled" type="boolean" value="false"/> <Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties> </Properties>
<Constraints> <Constraints>
@ -84,7 +81,7 @@
</Group> </Group>
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel2" min="-2" max="-2" attributes="0"/> <Component id="containerPanel" min="-2" max="-2" attributes="0"/>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0"> <Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Component id="commonItemSearchDescription" alignment="0" max="32767" attributes="0"/> <Component id="commonItemSearchDescription" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
@ -111,7 +108,7 @@
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="interCaseRadio" min="-2" max="-2" attributes="0"/> <Component id="interCaseRadio" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jPanel2" max="-2" attributes="0"/> <Component id="containerPanel" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Component id="percentageThresholdCheck" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="percentageThresholdCheck" alignment="3" min="-2" max="-2" attributes="0"/>
@ -174,7 +171,7 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="interCaseRadioActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="interCaseRadioActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Container class="javax.swing.JPanel" name="jPanel2"> <Container class="javax.swing.JPanel" name="containerPanel">
<Properties> <Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" red="0" type="rgb"/> <Color blue="0" green="0" red="0" type="rgb"/>

View File

@ -98,21 +98,23 @@ final class CommonAttributePanel extends javax.swing.JDialog implements Observer
interCasePanel = new InterCasePanel(); interCasePanel = new InterCasePanel();
interCasePanel.setVisible(true); interCasePanel.setVisible(true);
interCasePanel.setSize(384 - 43, (int) jPanel2.getPreferredSize().getHeight() + 43); interCasePanel.setSize(384 - 43, (int) containerPanel.getPreferredSize().getHeight() + 43);
intraCasePanel = new IntraCasePanel(); intraCasePanel = new IntraCasePanel();
intraCasePanel.setVisible(true); intraCasePanel.setVisible(true);
intraCasePanel.setSize(384 - 43, (int) jPanel2.getPreferredSize().getHeight() + 43); intraCasePanel.setSize(384 - 43, (int) containerPanel.getPreferredSize().getHeight() + 43);
this.setupDataSources(); this.setupDataSources();
if (CommonAttributePanel.isEamDbAvailableForIntercaseSearch()) { if (CommonAttributePanel.isEamDbAvailableForIntercaseSearch()) {
this.setupCases(); this.setupCases();
this.interCasePanel.setupCorrelationTypeFilter(); this.interCasePanel.setupCorrelationTypeFilter();
jPanel2.add(interCasePanel); this.interCaseRadio.setSelected(true);
switchInnerPanel(interCasePanel);
} else { } else {
this.disableIntercaseSearch(); this.disableIntercaseSearch();
jPanel2.add(intraCasePanel); this.intraCaseRadio.setSelected(true);
switchInnerPanel(intraCasePanel);
} }
this.revalidate(); this.revalidate();
this.repaint(); this.repaint();
@ -368,7 +370,6 @@ final class CommonAttributePanel extends javax.swing.JDialog implements Observer
if (!this.caseHasMultipleSources()) { //disable intra case search when only 1 data source in current case if (!this.caseHasMultipleSources()) { //disable intra case search when only 1 data source in current case
intraCaseRadio.setEnabled(false); intraCaseRadio.setEnabled(false);
interCaseRadio.setSelected(true); interCaseRadio.setSelected(true);
switchInnerPanel(interCasePanel);
} }
CommonAttributePanel.this.updateErrorTextAndSearchButton(); CommonAttributePanel.this.updateErrorTextAndSearchButton();
} }
@ -422,9 +423,14 @@ final class CommonAttributePanel extends javax.swing.JDialog implements Observer
}.execute(); }.execute();
} }
/**
* Display the provided panel inside the container panel.
*
* @param panel The panel to be shown.
*/
private void switchInnerPanel(JPanel panel) { private void switchInnerPanel(JPanel panel) {
jPanel2.removeAll(); containerPanel.removeAll();
jPanel2.add(panel); containerPanel.add(panel);
this.revalidate(); this.revalidate();
this.repaint(); this.repaint();
} }
@ -516,7 +522,7 @@ final class CommonAttributePanel extends javax.swing.JDialog implements Observer
scopeLabel = new javax.swing.JLabel(); scopeLabel = new javax.swing.JLabel();
intraCaseRadio = new javax.swing.JRadioButton(); intraCaseRadio = new javax.swing.JRadioButton();
interCaseRadio = new javax.swing.JRadioButton(); interCaseRadio = new javax.swing.JRadioButton();
jPanel2 = new javax.swing.JPanel(); containerPanel = new javax.swing.JPanel();
percentageThresholdCheck = new javax.swing.JCheckBox(); percentageThresholdCheck = new javax.swing.JCheckBox();
percentageThresholdInputBox = new javax.swing.JTextField(); percentageThresholdInputBox = new javax.swing.JTextField();
percentageThresholdTextTwo = new javax.swing.JLabel(); percentageThresholdTextTwo = new javax.swing.JLabel();
@ -533,7 +539,6 @@ final class CommonAttributePanel extends javax.swing.JDialog implements Observer
}); });
jPanel1.setMaximumSize(null); jPanel1.setMaximumSize(null);
jPanel1.setMinimumSize(null);
jPanel1.setRequestFocusEnabled(false); jPanel1.setRequestFocusEnabled(false);
org.openide.awt.Mnemonics.setLocalizedText(commonItemSearchDescription, org.openide.util.NbBundle.getMessage(CommonAttributePanel.class, "CommonAttributePanel.commonItemSearchDescription.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(commonItemSearchDescription, org.openide.util.NbBundle.getMessage(CommonAttributePanel.class, "CommonAttributePanel.commonItemSearchDescription.text")); // NOI18N
@ -559,17 +564,17 @@ final class CommonAttributePanel extends javax.swing.JDialog implements Observer
} }
}); });
jPanel2.setBackground(new java.awt.Color(0, 0, 0)); containerPanel.setBackground(new java.awt.Color(0, 0, 0));
jPanel2.setOpaque(false); containerPanel.setOpaque(false);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); javax.swing.GroupLayout containerPanelLayout = new javax.swing.GroupLayout(containerPanel);
jPanel2.setLayout(jPanel2Layout); containerPanel.setLayout(containerPanelLayout);
jPanel2Layout.setHorizontalGroup( containerPanelLayout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) containerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 430, Short.MAX_VALUE) .addGap(0, 430, Short.MAX_VALUE)
); );
jPanel2Layout.setVerticalGroup( containerPanelLayout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) containerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 330, Short.MAX_VALUE) .addGap(0, 330, Short.MAX_VALUE)
); );
@ -634,7 +639,7 @@ final class CommonAttributePanel extends javax.swing.JDialog implements Observer
.addContainerGap()) .addContainerGap())
.addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(containerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(commonItemSearchDescription, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(commonItemSearchDescription, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
@ -654,7 +659,7 @@ final class CommonAttributePanel extends javax.swing.JDialog implements Observer
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(interCaseRadio) .addComponent(interCaseRadio)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(containerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(percentageThresholdCheck) .addComponent(percentageThresholdCheck)
@ -862,13 +867,13 @@ final class CommonAttributePanel extends javax.swing.JDialog implements Observer
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel commonItemSearchDescription; private javax.swing.JLabel commonItemSearchDescription;
private javax.swing.JPanel containerPanel;
private javax.swing.JLabel dataSourcesLabel; private javax.swing.JLabel dataSourcesLabel;
private javax.swing.JLabel errorText; private javax.swing.JLabel errorText;
private javax.swing.JRadioButton interCaseRadio; private javax.swing.JRadioButton interCaseRadio;
private javax.swing.ButtonGroup interIntraButtonGroup; private javax.swing.ButtonGroup interIntraButtonGroup;
private javax.swing.JRadioButton intraCaseRadio; private javax.swing.JRadioButton intraCaseRadio;
private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JCheckBox percentageThresholdCheck; private javax.swing.JCheckBox percentageThresholdCheck;
private javax.swing.JTextField percentageThresholdInputBox; private javax.swing.JTextField percentageThresholdInputBox;
private javax.swing.JLabel percentageThresholdTextTwo; private javax.swing.JLabel percentageThresholdTextTwo;