From c6faaa70ef9076d0dd1f7ea0ed02e4c8fe407ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Kov=C3=A1r?= <matko@192.168.1.105> Date: Wed, 13 Oct 2021 11:38:17 +0200 Subject: [PATCH] added selection buttons functionality --- .../fidentis/analyst/core/ProjectTopComp.form | 18 +----------- .../fidentis/analyst/core/ProjectTopComp.java | 28 ++++++++----------- .../fidentis/analyst/core/Bundle.properties | 1 - 3 files changed, 13 insertions(+), 34 deletions(-) diff --git a/GUI/src/main/java/cz/fidentis/analyst/core/ProjectTopComp.form b/GUI/src/main/java/cz/fidentis/analyst/core/ProjectTopComp.form index db9edbb5..7787b0c6 100644 --- a/GUI/src/main/java/cz/fidentis/analyst/core/ProjectTopComp.form +++ b/GUI/src/main/java/cz/fidentis/analyst/core/ProjectTopComp.form @@ -57,7 +57,7 @@ <Component id="jPanel2" alignment="0" max="32767" attributes="0"/> <Component id="jPanel5" alignment="0" max="32767" attributes="0"/> </Group> - <EmptySpace min="0" pref="450" max="32767" attributes="0"/> + <EmptySpace min="0" pref="551" max="32767" attributes="0"/> </Group> </Group> </DimensionLayout> @@ -155,21 +155,6 @@ </Constraint> </Constraints> </Component> - <Component class="javax.swing.JButton" name="collapseButton1"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Tahoma" size="12" style="0"/> - </Property> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="cz/fidentis/analyst/core/Bundle.properties" key="ProjectTopComp.collapseButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> - </Properties> - <Constraints> - <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> - <GridBagConstraints gridX="4" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="16" insetsLeft="22" insetsBottom="13" insetsRight="4" anchor="18" weightX="0.0" weightY="0.0"/> - </Constraint> - </Constraints> - </Component> <Component class="javax.swing.JButton" name="inflateButton1"> <Properties> <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> @@ -261,7 +246,6 @@ </Column> </TableColumnModel> </Property> - <Property name="columnSelectionAllowed" type="boolean" value="true"/> <Property name="dragEnabled" type="boolean" value="true"/> <Property name="rowHeight" type="int" value="40"/> <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor"> diff --git a/GUI/src/main/java/cz/fidentis/analyst/core/ProjectTopComp.java b/GUI/src/main/java/cz/fidentis/analyst/core/ProjectTopComp.java index 7cff4527..21c74dcb 100644 --- a/GUI/src/main/java/cz/fidentis/analyst/core/ProjectTopComp.java +++ b/GUI/src/main/java/cz/fidentis/analyst/core/ProjectTopComp.java @@ -90,7 +90,6 @@ public final class ProjectTopComp extends TopComponent { removeButton1 = new javax.swing.JButton(); selectAllButton1 = new javax.swing.JButton(); deselectAllButton1 = new javax.swing.JButton(); - collapseButton1 = new javax.swing.JButton(); inflateButton1 = new javax.swing.JButton(); analyzeButton1 = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); @@ -161,15 +160,6 @@ public final class ProjectTopComp extends TopComponent { gridBagConstraints.insets = new java.awt.Insets(16, 22, 13, 4); jPanel5.add(deselectAllButton1, gridBagConstraints); - collapseButton1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(collapseButton1, org.openide.util.NbBundle.getMessage(ProjectTopComp.class, "ProjectTopComp.collapseButton1.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 4; - gridBagConstraints.gridy = 0; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(16, 22, 13, 4); - jPanel5.add(collapseButton1, gridBagConstraints); - inflateButton1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(inflateButton1, org.openide.util.NbBundle.getMessage(ProjectTopComp.class, "ProjectTopComp.inflateButton1.text")); // NOI18N inflateButton1.setAlignmentX(0.5F); @@ -224,7 +214,6 @@ public final class ProjectTopComp extends TopComponent { return canEdit [columnIndex]; } }); - jTable1.setColumnSelectionAllowed(true); jTable1.setDragEnabled(true); jTable1.setRowHeight(40); jTable1.getTableHeader().setReorderingAllowed(false); @@ -256,7 +245,7 @@ public final class ProjectTopComp extends TopComponent { .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addGap(0, 450, Short.MAX_VALUE)) + .addGap(0, 551, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -293,22 +282,29 @@ public final class ProjectTopComp extends TopComponent { }//GEN-LAST:event_analyzeButton1MouseClicked private void selectAllButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_selectAllButton1MouseClicked - jTable1.selectAll(); - + //jTable1.selectAll(); + javax.swing.table.DefaultTableModel model = (javax.swing.table.DefaultTableModel)jTable1.getModel(); + for (int i = 0; i < model.getRowCount(); i++) {model.setValueAt(true, i, 0);} }//GEN-LAST:event_selectAllButton1MouseClicked private void deselectAllButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_deselectAllButton1MouseClicked - jTable1.clearSelection(); + //jTable1.clearSelection(); + javax.swing.table.DefaultTableModel model = (javax.swing.table.DefaultTableModel)jTable1.getModel(); + for (int i = 0; i < model.getRowCount(); i++) {model.setValueAt(false, i, 0);} }//GEN-LAST:event_deselectAllButton1MouseClicked private void inflateButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_inflateButton1MouseClicked // TODO add your handling code here: + javax.swing.table.DefaultTableModel model = (javax.swing.table.DefaultTableModel)jTable1.getModel(); + for (int i = 0; i < model.getRowCount(); i++) { + if (model.getValueAt(i, 0) == (Object)true) {model.setValueAt(false, i, 0);} + else {model.setValueAt(true, i, 0);} + } }//GEN-LAST:event_inflateButton1MouseClicked // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton addButton1; private javax.swing.JButton analyzeButton1; - private javax.swing.JButton collapseButton1; private javax.swing.JButton deselectAllButton1; private javax.swing.JButton inflateButton1; private javax.swing.JPanel jPanel1; diff --git a/GUI/src/main/resources/cz/fidentis/analyst/core/Bundle.properties b/GUI/src/main/resources/cz/fidentis/analyst/core/Bundle.properties index 81152880..09e65a30 100644 --- a/GUI/src/main/resources/cz/fidentis/analyst/core/Bundle.properties +++ b/GUI/src/main/resources/cz/fidentis/analyst/core/Bundle.properties @@ -12,7 +12,6 @@ SingleFaceTab.jButton2.text=jButton2 ProjectTopComp.addButton1.text=Add ProjectTopComp.analyzeButton1.text=Open 1:1 ProjectTopComp.inflateButton1.text=Inflate -ProjectTopComp.collapseButton1.text=Collapse ProjectTopComp.deselectAllButton1.text=Deselect all ProjectTopComp.selectAllButton1.text=Select all ProjectTopComp.removeButton1.text=Remove -- GitLab