diff options
author | mconway <michael_conway@unc.edu> | 2013-05-30 15:27:15 (GMT) |
---|---|---|
committer | mconway <michael_conway@unc.edu> | 2013-05-30 15:27:15 (GMT) |
commit | 4134fd60976672104c6d9f1f42cad55fad3b3bd6 (patch) | |
tree | d7d235ec3ca3d86dd6ed43f1c14c970ba00ed59c | |
parent | 54876a7a242944b23ff9141d88eb905b738fdb8a (diff) | |
download | QCG-Data-4134fd60976672104c6d9f1f42cad55fad3b3bd6.zip QCG-Data-4134fd60976672104c6d9f1f42cad55fad3b3bd6.tar.gz QCG-Data-4134fd60976672104c6d9f1f42cad55fad3b3bd6.tar.bz2 |
[#1441] add diff view to idrop
4 files changed, 429 insertions, 31 deletions
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/DiffViewDialog.form b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/DiffViewDialog.form index 715d52c..1f11302 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/DiffViewDialog.form +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/DiffViewDialog.form @@ -8,6 +8,9 @@ </Property> <Property name="modal" type="boolean" value="true"/> <Property name="name" type="java.lang.String" value="DiffViewDialog" noResource="true"/> + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[800, 600]"/> + </Property> </Properties> <AccessibilityProperties> <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> @@ -28,12 +31,17 @@ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> - <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-50,0,0,2,-97"/> + <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-30,0,0,2,-53"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> <SubComponents> <Container class="javax.swing.JPanel" name="pnlTop"> + <Properties> + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="null"/> + </Property> + </Properties> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> <BorderConstraints direction="North"/> @@ -111,15 +119,17 @@ </Constraint> </Constraints> - <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout"> - <Property name="columns" type="int" value="0"/> - <Property name="rows" type="int" value="1"/> - </Layout> + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> <SubComponents> <Container class="javax.swing.JScrollPane" name="scrollPaneDiff"> <AuxValues> <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> </AuxValues> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> + <BorderConstraints direction="Center"/> + </Constraint> + </Constraints> <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> <SubComponents> @@ -129,6 +139,125 @@ <Connection code="this.getFileTreeModel()" type="code"/> </Property> </Properties> + <Events> + <EventHandler event="valueChanged" listener="javax.swing.event.TreeSelectionListener" parameters="javax.swing.event.TreeSelectionEvent" handler="treeDiffValueChanged"/> + </Events> + </Component> + </SubComponents> + </Container> + <Container class="javax.swing.JPanel" name="pnlSelectionInfo"> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> + <BorderConstraints direction="South"/> + </Constraint> + </Constraints> + + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> + <SubComponents> + <Component class="javax.swing.JLabel" name="lblSelectedPathLabel"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/irods/jargon/idrop/desktop/systraygui/Bundle.properties" key="DiffViewDialog.lblSelectedPathLabel.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="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="3" insetsLeft="0" insetsBottom="3" insetsRight="0" anchor="22" weightX="0.0" weightY="0.0"/> + </Constraint> + </Constraints> + </Component> + <Component class="javax.swing.JLabel" name="lblSelectedPath"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/irods/jargon/idrop/desktop/systraygui/Bundle.properties" key="DiffViewDialog.lblSelectedPath.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="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> + </Constraint> + </Constraints> + </Component> + <Component class="javax.swing.JLabel" name="lblDescriptionOfDiffInfo"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/irods/jargon/idrop/desktop/systraygui/Bundle.properties" key="DiffViewDialog.lblDescriptionOfDiffInfo.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="0" gridY="1" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="3" insetsLeft="0" insetsBottom="3" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> + </Constraint> + </Constraints> + </Component> + <Component class="javax.swing.JButton" name="btnResolve"> + <Properties> + <Property name="mnemonic" type="int" value="114"/> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/irods/jargon/idrop/desktop/systraygui/Bundle.properties" key="DiffViewDialog.btnResolve.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/irods/jargon/idrop/desktop/systraygui/Bundle.properties" key="DiffViewDialog.btnResolve.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnResolveActionPerformed"/> + </Events> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> + <GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="3" fill="0" ipadX="0" ipadY="0" insetsTop="3" insetsLeft="0" insetsBottom="3" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> + </Constraint> + </Constraints> + </Component> + <Component class="javax.swing.JLabel" name="lblSuggestedResolution"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/irods/jargon/idrop/desktop/systraygui/Bundle.properties" key="DiffViewDialog.lblSuggestedResolution.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="0" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="3" insetsLeft="0" insetsBottom="3" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> + </Constraint> + </Constraints> + </Component> + <Component class="javax.swing.JButton" name="btnResolveGet"> + <Properties> + <Property name="mnemonic" type="int" value="103"/> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/irods/jargon/idrop/desktop/systraygui/Bundle.properties" key="DiffViewDialog.btnResolveGet.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/irods/jargon/idrop/desktop/systraygui/Bundle.properties" key="DiffViewDialog.btnResolveGet.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnResolveGetActionPerformed"/> + </Events> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> + <GridBagConstraints gridX="2" gridY="5" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="3" insetsLeft="0" insetsBottom="3" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> + </Constraint> + </Constraints> + </Component> + <Component class="javax.swing.JButton" name="btnResolvePut"> + <Properties> + <Property name="mnemonic" type="int" value="112"/> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/irods/jargon/idrop/desktop/systraygui/Bundle.properties" key="DiffViewDialog.btnResolvePut.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/irods/jargon/idrop/desktop/systraygui/Bundle.properties" key="DiffViewDialog.btnResolvePut.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnResolvePutActionPerformed"/> + </Events> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> + <GridBagConstraints gridX="1" gridY="5" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="3" insetsLeft="0" insetsBottom="3" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/> + </Constraint> + </Constraints> </Component> </SubComponents> </Container> @@ -141,18 +270,34 @@ </Constraint> </Constraints> - <Layout> - <DimensionLayout dim="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <EmptySpace min="0" pref="671" max="32767" attributes="0"/> - </Group> - </DimensionLayout> - <DimensionLayout dim="1"> - <Group type="103" groupAlignment="0" attributes="0"> - <EmptySpace min="0" pref="100" max="32767" attributes="0"/> - </Group> - </DimensionLayout> + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout"> + <Property name="columns" type="int" value="0"/> + <Property name="rows" type="int" value="1"/> </Layout> + <SubComponents> + <Container class="javax.swing.JPanel" name="pnlUploadDownloadButtons"> + + <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"> + <Property name="alignment" type="int" value="2"/> + </Layout> + <SubComponents> + <Component class="javax.swing.JButton" name="btnOK"> + <Properties> + <Property name="mnemonic" type="int" value="111"/> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/irods/jargon/idrop/desktop/systraygui/Bundle.properties" key="DiffViewDialog.btnOK.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/irods/jargon/idrop/desktop/systraygui/Bundle.properties" key="DiffViewDialog.btnOK.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnOKActionPerformed"/> + </Events> + </Component> + </SubComponents> + </Container> + </SubComponents> </Container> </SubComponents> </Form> diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/DiffViewDialog.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/DiffViewDialog.java index 11dbb88..7ff8f78 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/DiffViewDialog.java +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/DiffViewDialog.java @@ -4,12 +4,19 @@ */ package org.irods.jargon.idrop.desktop.systraygui; +import java.awt.Color; import javax.swing.ToolTipManager; +import javax.swing.tree.TreeSelectionModel; +import org.irods.jargon.core.exception.JargonException; +import org.irods.jargon.datautils.tree.FileTreeDiffEntry; +import org.irods.jargon.datautils.tree.FileTreeDiffEntry.DiffType; import org.irods.jargon.datautils.tree.FileTreeModel; +import org.irods.jargon.datautils.tree.FileTreeNode; import org.irods.jargon.idrop.desktop.systraygui.viscomponents.DiffTreeCustomRenderer; import org.irods.jargon.idrop.desktop.systraygui.viscomponents.DiffViewData; +import org.irods.jargon.idrop.desktop.systraygui.viscomponents.LocalFileTree; import org.slf4j.LoggerFactory; - + /** * * @author Mike @@ -25,6 +32,9 @@ public class DiffViewDialog extends javax.swing.JDialog { public DiffViewDialog(final iDrop parent, final boolean modal, final DiffViewData diffViewData) { super(parent, modal); initComponents(); + btnResolve.setVisible(false); + btnResolveGet.setVisible(false); + btnResolvePut.setVisible(false); idropGui = parent; this.diffViewData = diffViewData; this.fileTreeModel = diffViewData.getFileTreeModel(); @@ -51,13 +61,25 @@ public class DiffViewDialog extends javax.swing.JDialog { pnlCenter = new javax.swing.JPanel(); scrollPaneDiff = new javax.swing.JScrollPane(); treeDiff = new javax.swing.JTree(); + pnlSelectionInfo = new javax.swing.JPanel(); + lblSelectedPathLabel = new javax.swing.JLabel(); + lblSelectedPath = new javax.swing.JLabel(); + lblDescriptionOfDiffInfo = new javax.swing.JLabel(); + btnResolve = new javax.swing.JButton(); + lblSuggestedResolution = new javax.swing.JLabel(); + btnResolveGet = new javax.swing.JButton(); + btnResolvePut = new javax.swing.JButton(); pnlBottom = new javax.swing.JPanel(); + pnlUploadDownloadButtons = new javax.swing.JPanel(); + btnOK = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle(org.openide.util.NbBundle.getMessage(DiffViewDialog.class, "DiffViewDialog.title")); // NOI18N setModal(true); setName("DiffViewDialog"); // NOI18N + setPreferredSize(new java.awt.Dimension(800, 600)); + pnlTop.setPreferredSize(null); pnlTop.setLayout(new java.awt.GridBagLayout()); lblDiffResult.setText(org.openide.util.NbBundle.getMessage(DiffViewDialog.class, "DiffViewDialog.lblDiffResult.text")); // NOI18N @@ -99,25 +121,109 @@ public class DiffViewDialog extends javax.swing.JDialog { getContentPane().add(pnlTop, java.awt.BorderLayout.NORTH); - pnlCenter.setLayout(new java.awt.GridLayout()); + pnlCenter.setLayout(new java.awt.BorderLayout()); treeDiff.setModel(this.getFileTreeModel()); + treeDiff.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() { + public void valueChanged(javax.swing.event.TreeSelectionEvent evt) { + treeDiffValueChanged(evt); + } + }); scrollPaneDiff.setViewportView(treeDiff); - pnlCenter.add(scrollPaneDiff); + pnlCenter.add(scrollPaneDiff, java.awt.BorderLayout.CENTER); + + pnlSelectionInfo.setLayout(new java.awt.GridBagLayout()); + + lblSelectedPathLabel.setText(org.openide.util.NbBundle.getMessage(DiffViewDialog.class, "DiffViewDialog.lblSelectedPathLabel.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; + gridBagConstraints.insets = new java.awt.Insets(3, 0, 3, 0); + pnlSelectionInfo.add(lblSelectedPathLabel, gridBagConstraints); + + lblSelectedPath.setText(org.openide.util.NbBundle.getMessage(DiffViewDialog.class, "DiffViewDialog.lblSelectedPath.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + pnlSelectionInfo.add(lblSelectedPath, gridBagConstraints); + + lblDescriptionOfDiffInfo.setText(org.openide.util.NbBundle.getMessage(DiffViewDialog.class, "DiffViewDialog.lblDescriptionOfDiffInfo.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.insets = new java.awt.Insets(3, 0, 3, 0); + pnlSelectionInfo.add(lblDescriptionOfDiffInfo, gridBagConstraints); + + btnResolve.setMnemonic('r'); + btnResolve.setText(org.openide.util.NbBundle.getMessage(DiffViewDialog.class, "DiffViewDialog.btnResolve.text")); // NOI18N + btnResolve.setToolTipText(org.openide.util.NbBundle.getMessage(DiffViewDialog.class, "DiffViewDialog.btnResolve.toolTipText")); // NOI18N + btnResolve.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnResolveActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 2; + gridBagConstraints.gridheight = 3; + gridBagConstraints.insets = new java.awt.Insets(3, 0, 3, 0); + pnlSelectionInfo.add(btnResolve, gridBagConstraints); + + lblSuggestedResolution.setText(org.openide.util.NbBundle.getMessage(DiffViewDialog.class, "DiffViewDialog.lblSuggestedResolution.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.insets = new java.awt.Insets(3, 0, 3, 0); + pnlSelectionInfo.add(lblSuggestedResolution, gridBagConstraints); + + btnResolveGet.setMnemonic('g'); + btnResolveGet.setText(org.openide.util.NbBundle.getMessage(DiffViewDialog.class, "DiffViewDialog.btnResolveGet.text")); // NOI18N + btnResolveGet.setToolTipText(org.openide.util.NbBundle.getMessage(DiffViewDialog.class, "DiffViewDialog.btnResolveGet.toolTipText")); // NOI18N + btnResolveGet.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnResolveGetActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 2; + gridBagConstraints.gridy = 5; + gridBagConstraints.insets = new java.awt.Insets(3, 0, 3, 0); + pnlSelectionInfo.add(btnResolveGet, gridBagConstraints); + + btnResolvePut.setMnemonic('p'); + btnResolvePut.setText(org.openide.util.NbBundle.getMessage(DiffViewDialog.class, "DiffViewDialog.btnResolvePut.text")); // NOI18N + btnResolvePut.setToolTipText(org.openide.util.NbBundle.getMessage(DiffViewDialog.class, "DiffViewDialog.btnResolvePut.toolTipText")); // NOI18N + btnResolvePut.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnResolvePutActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 5; + gridBagConstraints.insets = new java.awt.Insets(3, 0, 3, 0); + pnlSelectionInfo.add(btnResolvePut, gridBagConstraints); + + pnlCenter.add(pnlSelectionInfo, java.awt.BorderLayout.SOUTH); getContentPane().add(pnlCenter, java.awt.BorderLayout.CENTER); - javax.swing.GroupLayout pnlBottomLayout = new javax.swing.GroupLayout(pnlBottom); - pnlBottom.setLayout(pnlBottomLayout); - pnlBottomLayout.setHorizontalGroup( - pnlBottomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 671, Short.MAX_VALUE) - ); - pnlBottomLayout.setVerticalGroup( - pnlBottomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 100, Short.MAX_VALUE) - ); + pnlBottom.setLayout(new java.awt.GridLayout()); + + pnlUploadDownloadButtons.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT)); + + btnOK.setMnemonic('o'); + btnOK.setText(org.openide.util.NbBundle.getMessage(DiffViewDialog.class, "DiffViewDialog.btnOK.text")); // NOI18N + btnOK.setToolTipText(org.openide.util.NbBundle.getMessage(DiffViewDialog.class, "DiffViewDialog.btnOK.toolTipText")); // NOI18N + btnOK.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnOKActionPerformed(evt); + } + }); + pnlUploadDownloadButtons.add(btnOK); + + pnlBottom.add(pnlUploadDownloadButtons); getContentPane().add(pnlBottom, java.awt.BorderLayout.SOUTH); @@ -126,15 +232,87 @@ public class DiffViewDialog extends javax.swing.JDialog { pack(); }// </editor-fold>//GEN-END:initComponents + private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed + this.dispose(); + }//GEN-LAST:event_btnOKActionPerformed + + private void treeDiffValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_treeDiffValueChanged + + log.info("value changed:{}", evt); + FileTreeNode node = (FileTreeNode) treeDiff.getLastSelectedPathComponent(); + log.info("selected node:{}", node); + + if (node == null) //Nothing is selected. + { + return; + } + + setDiffTypeDescriptionBasedOnNode((FileTreeDiffEntry) node.getUserObject()); + + }//GEN-LAST:event_treeDiffValueChanged + + private void btnResolveGetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnResolveGetActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_btnResolveGetActionPerformed + + private void btnResolvePutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnResolvePutActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_btnResolvePutActionPerformed + + private void btnResolveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnResolveActionPerformed + + log.info("btnResolveActionPerformed()"); + FileTreeNode node = (FileTreeNode) treeDiff.getLastSelectedPathComponent(); + log.info("selected node:{}", node); + FileTreeDiffEntry entry = (FileTreeDiffEntry) node.getUserObject(); + + log.info("entry:{}", entry); +/* + if (entry.getDiffType() == DiffType.LEFT_HAND_PLUS) { + log.info("schedule a put"); + try { + idropGui.getiDropCore() + .getTransferManager() + .enqueueAPut( + entry.getCollectionAndDataObjectListingEntry(), + targetIrodsFileAbsolutePath, + idropGui.getIrodsAccount().getd, + idropGui.getIrodsAccount()); + } catch (JargonException ex) { + java.util.logging.Logger.getLogger( + LocalFileTree.class.getName()).log( + java.util.logging.Level.SEVERE, null, ex); + idropGui.showIdropException(ex); + } + + + + } + +*/ + + + + }//GEN-LAST:event_btnResolveActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btnOK; + private javax.swing.JButton btnResolve; + private javax.swing.JButton btnResolveGet; + private javax.swing.JButton btnResolvePut; + private javax.swing.JLabel lblDescriptionOfDiffInfo; private javax.swing.JLabel lblDiffResult; private javax.swing.JLabel lblIrodsPath; private javax.swing.JLabel lblIrodsPathLabel; private javax.swing.JLabel lblLocalAbsPath; private javax.swing.JLabel lblLocalAbsPathLabel; + private javax.swing.JLabel lblSelectedPath; + private javax.swing.JLabel lblSelectedPathLabel; + private javax.swing.JLabel lblSuggestedResolution; private javax.swing.JPanel pnlBottom; private javax.swing.JPanel pnlCenter; + private javax.swing.JPanel pnlSelectionInfo; private javax.swing.JPanel pnlTop; + private javax.swing.JPanel pnlUploadDownloadButtons; private javax.swing.JScrollPane scrollPaneDiff; private javax.swing.JTree treeDiff; // End of variables declaration//GEN-END:variables @@ -148,6 +326,7 @@ public class DiffViewDialog extends javax.swing.JDialog { DiffTreeCustomRenderer renderer = new DiffTreeCustomRenderer(); treeDiff.setCellRenderer(renderer); ToolTipManager.sharedInstance().registerComponent(treeDiff); + treeDiff.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); } @@ -158,8 +337,70 @@ public class DiffViewDialog extends javax.swing.JDialog { public void setDiffViewData(DiffViewData diffViewData) { this.diffViewData = diffViewData; } - + public FileTreeModel getFileTreeModel() { return this.fileTreeModel; } + + private void setDiffTypeDescriptionBasedOnNode(final FileTreeDiffEntry diffEntry) { + if (diffEntry == null) { + return; + } + + lblSelectedPath.setText(diffEntry.getCollectionAndDataObjectListingEntry().getFormattedAbsolutePath()); + StringBuilder sb = new StringBuilder(); + + if (diffEntry.getDiffType() == DiffType.DIRECTORY_NO_DIFF) { + sb.append("No diffs detected at this directory"); + if (diffEntry.getCountOfDiffsInChildren() > 0) { + sb.append("...there are "); + sb.append(diffEntry.getCountOfDiffsInChildren()); + sb.append(" diffs detected in children of this directory"); + lblDescriptionOfDiffInfo.setForeground(Color.BLUE); + } else { + lblDescriptionOfDiffInfo.setForeground(Color.BLACK); + } + btnResolve.setVisible(false); + btnResolveGet.setVisible(false); + btnResolvePut.setVisible(false); + lblSuggestedResolution.setText(""); + lblDescriptionOfDiffInfo.setText(sb.toString()); + } else if (diffEntry.getDiffType() == DiffType.FILE_NAME_DIR_NAME_COLLISION) { + lblDescriptionOfDiffInfo.setForeground(Color.RED); + lblDescriptionOfDiffInfo.setText("A data object name collided with a collection name"); + lblSuggestedResolution.setText("This diff must be manually managed using the iDrop GUI"); + btnResolve.setVisible(false); + btnResolveGet.setVisible(false); + btnResolvePut.setVisible(false); + } else if (diffEntry.getDiffType() == DiffType.FILE_OUT_OF_SYNCH) { + lblDescriptionOfDiffInfo.setForeground(Color.RED); + lblDescriptionOfDiffInfo.setText("A file is out of synch"); + lblSuggestedResolution.setText("This file may be either uploaded or downloaded, overwriting the existing data"); + btnResolve.setVisible(false); + btnResolveGet.setVisible(true); + btnResolvePut.setVisible(true); + } else if (diffEntry.getDiffType() == DiffType.LEFT_HAND_PLUS) { + lblDescriptionOfDiffInfo.setForeground(Color.RED); + lblDescriptionOfDiffInfo.setText("The local file or collection does not exist in iRODS"); + lblSuggestedResolution.setText("Selecting the file or collection will upload to iRODS"); + btnResolve.setVisible(true); + btnResolveGet.setVisible(false); + btnResolvePut.setVisible(false); + } else if (diffEntry.getDiffType() == DiffType.RIGHT_HAND_PLUS) { + lblDescriptionOfDiffInfo.setForeground(Color.RED); + lblDescriptionOfDiffInfo.setText("The iRODS file or collection does not exist in the local directory"); + lblSuggestedResolution.setText("Selecting the file or collection will download from iRODS"); + btnResolve.setVisible(true); + btnResolveGet.setVisible(false); + btnResolvePut.setVisible(false); + } else { + lblDescriptionOfDiffInfo.setForeground(Color.RED); + lblDescriptionOfDiffInfo.setText(diffEntry.getDiffType().toString()); + lblSuggestedResolution.setText("Diff must be manually resolved"); + btnResolve.setVisible(false); + btnResolveGet.setVisible(false); + btnResolvePut.setVisible(false); + } + + } } diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/Version.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/Version.java index d7dec85..d82f434 100644 --- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/Version.java +++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/Version.java @@ -1,5 +1,5 @@ package org.irods.jargon.idrop.desktop.systraygui.utils; public final class Version { public static String VERSION="2.0.1-SNAPSHOT"; - public static String BUILD_TIME="20130530-0729"; + public static String BUILD_TIME="20130530-1053"; } diff --git a/idrop-swing/src/main/resources/org/irods/jargon/idrop/desktop/systraygui/Bundle.properties b/idrop-swing/src/main/resources/org/irods/jargon/idrop/desktop/systraygui/Bundle.properties index b10c5ce..7d60b23 100644 --- a/idrop-swing/src/main/resources/org/irods/jargon/idrop/desktop/systraygui/Bundle.properties +++ b/idrop-swing/src/main/resources/org/irods/jargon/idrop/desktop/systraygui/Bundle.properties @@ -322,3 +322,15 @@ DiffViewDialog.lblLocalAbsPathLabel.text=Local File: DiffViewDialog.lblLocalAbsPath.text=localabspathtext DiffViewDialog.lblIrodsPathLabel.text=IRODS File: DiffViewDialog.lblIrodsPath.text=irodspathhere +DiffViewDialog.btnOK.text=OK +DiffViewDialog.btnOK.toolTipText=Dismiss the dialog +DiffViewDialog.lblSelectedPathLabel.text=Selected Path: +DiffViewDialog.lblSelectedPath.text= +DiffViewDialog.lblDescriptionOfDiffInfo.text= +DiffViewDialog.btnResolve.text=Resolve +DiffViewDialog.btnResolve.toolTipText=Do a put or get as appropriate to resolve the diff +DiffViewDialog.lblSuggestedResolution.text= +DiffViewDialog.btnResolveGet.text=Resolve <<< +DiffViewDialog.btnResolveGet.toolTipText=Resolve by downloading and replacing a file +DiffViewDialog.btnResolvePut.toolTipText=Resolve by uploading and replacing a file +DiffViewDialog.btnResolvePut.text=Resolve >>> |