Changeset 13 for trunk


Ignore:
Timestamp:
Sep 1, 2010, 3:31:29 PM (8 years ago)
Author:
b.hoekman@…
Message:

added option to only save new transformations!!

Makes it easier to keep them organised!!

Location:
trunk/msCompareTransformationGUI/src/connectionsframework
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/msCompareTransformationGUI/src/connectionsframework/Bundle.properties

    r12 r13  
    2424ConnectionsFrameworkView.jButton2.toolTipText=Add Connections without Source
    2525ConnectionsFrameworkView.jSaveRulesMI.text=save rules xml
     26ConnectionsFrameworkView.jSaveNewRulesMI.text=save new rules xml
  • trunk/msCompareTransformationGUI/src/connectionsframework/ConnectionsFrameworkView.form

    r12 r13  
    510510              </Events>
    511511            </MenuItem>
     512            <MenuItem class="javax.swing.JMenuItem" name="jSaveNewRulesMI">
     513              <Properties>
     514                <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
     515                  <ResourceString bundle="connectionsframework/Bundle.properties" key="ConnectionsFrameworkView.jSaveNewRulesMI.text" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
     516                </Property>
     517                <Property name="name" type="java.lang.String" value="jSaveNewRulesMI" noResource="true"/>
     518              </Properties>
     519              <Events>
     520                <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jSaveNewRulesMIActionPerformed"/>
     521              </Events>
     522            </MenuItem>
    512523            <MenuItem class="javax.swing.JMenuItem" name="exitMenuItem">
    513524              <Properties>
  • trunk/msCompareTransformationGUI/src/connectionsframework/ConnectionsFrameworkView.java

    r12 r13  
    148148        jImportRulesFileMI = new javax.swing.JMenuItem();
    149149        jMenuItem2 = new javax.swing.JMenuItem();
     150        jSaveNewRulesMI = new javax.swing.JMenuItem();
    150151        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
    151152        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
     
    440441        fileMenu.add(jMenuItem2);
    441442
     443        jSaveNewRulesMI.setText(bundle.getString("ConnectionsFrameworkView.jSaveNewRulesMI.text")); // NOI18N
     444        jSaveNewRulesMI.setName("jSaveNewRulesMI"); // NOI18N
     445        jSaveNewRulesMI.addActionListener(new java.awt.event.ActionListener() {
     446            public void actionPerformed(java.awt.event.ActionEvent evt) {
     447                jSaveNewRulesMIActionPerformed(evt);
     448            }
     449        });
     450        fileMenu.add(jSaveNewRulesMI);
     451
    442452        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(connectionsframework.ConnectionsFrameworkApp.class).getContext().getActionMap(ConnectionsFrameworkView.class, this);
    443453        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
     
    619629        }
    620630    }//GEN-LAST:event_jMenuItem2ActionPerformed
     631
     632    private void jSaveNewRulesMIActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jSaveNewRulesMIActionPerformed
     633        javax.swing.JFileChooser jFileChooser = new javax.swing.JFileChooser();
     634
     635        statusMessageLabel.setText("pls wait till save is completed");
     636
     637        int returnVal = jFileChooser.showSaveDialog(ConnectionsFrameworkApp.getApplication().getMainFrame());
     638
     639         if (returnVal == javax.swing.JFileChooser.APPROVE_OPTION) {
     640            File file = jFileChooser.getSelectedFile();
     641            engine.saveNew(file);
     642            statusMessageLabel.setText("Save file Succesfull");
     643        } else {
     644            statusMessageLabel.setText("Save file cancelled by user.");
     645        }
     646    }//GEN-LAST:event_jSaveNewRulesMIActionPerformed
    621647
    622648    private void updateFields() {
     
    706732    private javax.swing.JComboBox jRelationCB;
    707733    private javax.swing.JCheckBox jRemoveConnectedCcB;
     734    private javax.swing.JMenuItem jSaveNewRulesMI;
    708735    private javax.swing.JScrollPane jScrollPane1;
    709736    private javax.swing.JScrollPane jScrollPane2;
  • trunk/msCompareTransformationGUI/src/connectionsframework/Engine.java

    r12 r13  
    763763        stXML.saveTransformations(file, saveList);
    764764    }
     765
     766    void saveNew(File file) {
     767        HashSet<AttributeTransformation> allTransformations = new HashSet<AttributeTransformation>();
     768        allTransformations.addAll(this.addedTransformations);
     769
     770        ArrayList<AttributeTransformation> saveList = new ArrayList<AttributeTransformation>();
     771        saveList.addAll(allTransformations);
     772
     773        SaveTransformationXML stXML = new SaveTransformationXML();
     774        stXML.saveTransformations(file, saveList);
     775    }
    765776}
Note: See TracChangeset for help on using the changeset viewer.