diff --git a/modules/DesktopImport/pom.xml b/modules/DesktopImport/pom.xml index ed5657a29df40279c6fc12b161adec5d29f0b644..634350f8f65fc7d5daca585532673bbee21deb30 100644 --- a/modules/DesktopImport/pom.xml +++ b/modules/DesktopImport/pom.xml @@ -72,6 +72,10 @@ ${project.groupId} core-library-wrapper + + ${project.groupId} + ui-library-wrapper + diff --git a/modules/DesktopImport/src/main/java/org/gephi/desktop/importer/DesktopImportControllerUI.java b/modules/DesktopImport/src/main/java/org/gephi/desktop/importer/DesktopImportControllerUI.java index cf0bd5e14d33f12861edcd5b6720b875bb56b187..d75ff86f97757359d99b94abce16b46499be0298 100644 --- a/modules/DesktopImport/src/main/java/org/gephi/desktop/importer/DesktopImportControllerUI.java +++ b/modules/DesktopImport/src/main/java/org/gephi/desktop/importer/DesktopImportControllerUI.java @@ -115,7 +115,8 @@ public class DesktopImportControllerUI implements ImportControllerUI { // } // NotifyDescriptor.Message msg = new NotifyDescriptor.Message(message, NotifyDescriptor.WARNING_MESSAGE); // DialogDisplayer.getDefault().notify(msg); - Logger.getLogger("").log(Level.SEVERE, "", t.getCause()); + Exceptions.printStackTrace(t); + t.printStackTrace(); } }; executor = new LongTaskExecutor(true, "Importer", 10); diff --git a/modules/DesktopImport/src/main/java/org/gephi/desktop/importer/ReportPanel.form b/modules/DesktopImport/src/main/java/org/gephi/desktop/importer/ReportPanel.form index 8eadcf70867d8d3cf6d80d8c03097e5b0712cca2..11dae62bbde0fa40500dadb56e217684b269aed3 100644 --- a/modules/DesktopImport/src/main/java/org/gephi/desktop/importer/ReportPanel.form +++ b/modules/DesktopImport/src/main/java/org/gephi/desktop/importer/ReportPanel.form @@ -23,7 +23,7 @@ - + @@ -33,20 +33,22 @@ - - + + + - + - - - - + + + + + - + @@ -61,23 +63,21 @@ - - + + - + - - - - - - - - + + + + + + @@ -151,38 +151,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -288,5 +262,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/DesktopImport/src/main/java/org/gephi/desktop/importer/ReportPanel.java b/modules/DesktopImport/src/main/java/org/gephi/desktop/importer/ReportPanel.java index 4027c636d63bf7d7beb0afae96b1127307b2e633..9fe8ed3152b7a8755ab4076d55866cf15ad04dbb 100644 --- a/modules/DesktopImport/src/main/java/org/gephi/desktop/importer/ReportPanel.java +++ b/modules/DesktopImport/src/main/java/org/gephi/desktop/importer/ReportPanel.java @@ -44,6 +44,8 @@ package org.gephi.desktop.importer; import java.awt.Color; import java.awt.GridBagConstraints; import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.lang.reflect.InvocationTargetException; @@ -51,10 +53,13 @@ import java.util.Enumeration; import java.util.List; import javax.swing.AbstractButton; import javax.swing.ButtonGroup; +import javax.swing.DefaultComboBoxModel; import javax.swing.Icon; import javax.swing.ImageIcon; +import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JRadioButton; +import javax.swing.JRootPane; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.event.TreeModelListener; @@ -62,7 +67,8 @@ import javax.swing.tree.TreeModel; import javax.swing.tree.TreePath; import org.gephi.io.importer.api.Container; import org.gephi.io.importer.api.ContainerUnloader; -import org.gephi.io.importer.api.EdgeDiretionDefault; +import org.gephi.io.importer.api.EdgeDirectionDefault; +import org.gephi.io.importer.api.EdgeWeightMergeStrategy; import org.gephi.io.importer.api.Issue; import org.gephi.io.importer.api.Report; import org.gephi.io.processor.spi.Processor; @@ -107,6 +113,8 @@ public class ReportPanel extends javax.swing.JPanel { initIcons(); initProcessors(); initProcessorsUI(); + initMoreOptionsPanel(); + initMergeStrategyCombo(); } }); } catch (InterruptedException ex) { @@ -123,13 +131,13 @@ public class ReportPanel extends javax.swing.JPanel { int g = graphTypeCombo.getSelectedIndex(); switch (g) { case 0: - container.getLoader().setEdgeDefault(EdgeDiretionDefault.DIRECTED); + container.getLoader().setEdgeDefault(EdgeDirectionDefault.DIRECTED); break; case 1: - container.getLoader().setEdgeDefault(EdgeDiretionDefault.UNDIRECTED); + container.getLoader().setEdgeDefault(EdgeDirectionDefault.UNDIRECTED); break; case 2: - container.getLoader().setEdgeDefault(EdgeDiretionDefault.MIXED); + container.getLoader().setEdgeDefault(EdgeDirectionDefault.MIXED); break; } } @@ -138,8 +146,8 @@ public class ReportPanel extends javax.swing.JPanel { autoscaleCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { - if (autoscaleCheckbox.isSelected() != container.isAutoScale()) { - container.setAutoScale(autoscaleCheckbox.isSelected()); + if (autoscaleCheckbox.isSelected() != container.getUnloader().isAutoScale()) { + container.getLoader().setAutoScale(autoscaleCheckbox.isSelected()); } } }); @@ -148,7 +156,37 @@ public class ReportPanel extends javax.swing.JPanel { @Override public void itemStateChanged(ItemEvent e) { if (createMissingNodesCheckbox.isSelected() != container.getUnloader().allowAutoNode()) { - container.setAllowAutoNode(createMissingNodesCheckbox.isSelected()); + container.getLoader().setAllowAutoNode(createMissingNodesCheckbox.isSelected()); + } + } + }); + + moreOptionsLink.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + moreOptionsPanel.setVisible(!moreOptionsPanel.isVisible()); + JRootPane rootPane = SwingUtilities.getRootPane(ReportPanel.this); + ((JDialog) rootPane.getParent()).pack(); + } + }); + + edgesMergeStrategyCombo.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + int g = edgesMergeStrategyCombo.getSelectedIndex(); + switch (g) { + case 0: + container.getLoader().setEdgesMergeStrategy(EdgeWeightMergeStrategy.SUM); + break; + case 1: + container.getLoader().setEdgesMergeStrategy(EdgeWeightMergeStrategy.AVG); + break; + case 2: + container.getLoader().setEdgesMergeStrategy(EdgeWeightMergeStrategy.MIN); + break; + case 3: + container.getLoader().setEdgesMergeStrategy(EdgeWeightMergeStrategy.MAX); + break; } } }); @@ -163,13 +201,15 @@ public class ReportPanel extends javax.swing.JPanel { public void setData(Report report, Container container) { this.container = container; + initGraphTypeCombo(container); report.pruneReport(ISSUES_LIMIT); fillIssues(report); fillReport(report); fillStats(container); - autoscaleCheckbox.setSelected(container.isAutoScale()); + fillParameters(container); + autoscaleCheckbox.setSelected(container.getUnloader().isAutoScale()); createMissingNodesCheckbox.setSelected(container.getUnloader().allowAutoNode()); } @@ -177,6 +217,52 @@ public class ReportPanel extends javax.swing.JPanel { tabbedPane.setVisible(false); } + private void initMergeStrategyCombo() { + DefaultComboBoxModel mergeStrategryModel = new DefaultComboBoxModel(new String[]{ + NbBundle.getMessage(ReportPanel.class, "ReportPanel.mergeStrategy.sum"), + NbBundle.getMessage(ReportPanel.class, "ReportPanel.mergeStrategy.avg"), + NbBundle.getMessage(ReportPanel.class, "ReportPanel.mergeStrategy.min"), + NbBundle.getMessage(ReportPanel.class, "ReportPanel.mergeStrategy.max")}); + edgesMergeStrategyCombo.setModel(mergeStrategryModel); + } + + private void initMoreOptionsPanel() { + moreOptionsPanel.setVisible(false); + } + + private void initGraphTypeCombo(final Container container) { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + String directedStr = NbBundle.getMessage(ReportPanel.class, "ReportPanel.graphType.directed"); + String undirectedStr = NbBundle.getMessage(ReportPanel.class, "ReportPanel.graphType.undirected"); + String mixedStr = NbBundle.getMessage(ReportPanel.class, "ReportPanel.graphType.mixed"); + + DefaultComboBoxModel comboModel = new DefaultComboBoxModel(); + + EdgeDirectionDefault dir = container.getUnloader().getEdgeDefault(); + switch (dir) { + case DIRECTED: + comboModel.addElement(directedStr); + comboModel.addElement(undirectedStr); + comboModel.addElement(mixedStr); + break; + case UNDIRECTED: + comboModel.addElement(undirectedStr); + comboModel.addElement(mixedStr); + break; + case MIXED: + comboModel.addElement(directedStr); + comboModel.addElement(undirectedStr); + comboModel.addElement(mixedStr); + break; + } + + graphTypeCombo.setModel(comboModel); + } + }); + } + private void fillIssues(Report report) { final List issues = report.getIssues(); if (issues.isEmpty()) { @@ -230,6 +316,45 @@ public class ReportPanel extends javax.swing.JPanel { } } + private void fillParameters(final Container container) { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + //Autoscale + autoscaleCheckbox.setSelected(container.getUnloader().isAutoScale()); + selfLoopCheckBox.setSelected(container.getUnloader().allowSelfLoop()); + createMissingNodesCheckbox.setSelected(container.getUnloader().allowAutoNode()); + + switch (container.getUnloader().getEdgeDefault()) { + case DIRECTED: + graphTypeCombo.setSelectedIndex(0); + break; + case UNDIRECTED: + graphTypeCombo.setSelectedIndex(1); + break; + case MIXED: + graphTypeCombo.setSelectedIndex(2); + break; + } + + switch (container.getUnloader().getEdgesMergeStrategy()) { + case SUM: + edgesMergeStrategyCombo.setSelectedIndex(0); + break; + case AVG: + edgesMergeStrategyCombo.setSelectedIndex(1); + break; + case MIN: + edgesMergeStrategyCombo.setSelectedIndex(2); + break; + case MAX: + edgesMergeStrategyCombo.setSelectedIndex(3); + break; + } + } + }); + } + private void fillStats(final Container container) { SwingUtilities.invokeLater(new Runnable() { @Override @@ -243,9 +368,6 @@ public class ReportPanel extends javax.swing.JPanel { sourceLabel.setText(source); - //Autoscale - autoscaleCheckbox.setSelected(container.isAutoScale()); - ContainerUnloader unloader = container.getUnloader(); //Node & Edge count @@ -254,18 +376,6 @@ public class ReportPanel extends javax.swing.JPanel { nodeCountLabel.setText("" + nodeCount); edgeCountLabel.setText("" + edgeCount); - switch (unloader.getEdgeDefault()) { - case DIRECTED: - graphTypeCombo.setSelectedIndex(0); - break; - case UNDIRECTED: - graphTypeCombo.setSelectedIndex(1); - break; - case MIXED: - graphTypeCombo.setSelectedIndex(2); - break; - } - //Dynamic & Hierarchical graph dynamicLabel.setText(container.isDynamicGraph() ? NbBundle.getMessage(getClass(), "ReportPanel.yes") : NbBundle.getMessage(getClass(), "ReportPanel.no")); } @@ -340,10 +450,8 @@ public class ReportPanel extends javax.swing.JPanel { reportEditor = new javax.swing.JEditorPane(); labelGraphType = new javax.swing.JLabel(); graphTypeCombo = new javax.swing.JComboBox(); - autoscaleCheckbox = new javax.swing.JCheckBox(); processorPanel = new javax.swing.JPanel(); - createMissingNodesCheckbox = new javax.swing.JCheckBox(); - jPanel1 = new javax.swing.JPanel(); + statsPanel = new javax.swing.JPanel(); labelNodeCount = new javax.swing.JLabel(); labelEdgeCount = new javax.swing.JLabel(); nodeCountLabel = new javax.swing.JLabel(); @@ -351,6 +459,13 @@ public class ReportPanel extends javax.swing.JPanel { dynamicLabel = new javax.swing.JLabel(); labelDynamic = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); + moreOptionsLink = new org.jdesktop.swingx.JXHyperlink(); + moreOptionsPanel = new javax.swing.JPanel(); + autoscaleCheckbox = new javax.swing.JCheckBox(); + createMissingNodesCheckbox = new javax.swing.JCheckBox(); + selfLoopCheckBox = new javax.swing.JCheckBox(); + labelParallelEdgesMergeStrategy = new javax.swing.JLabel(); + edgesMergeStrategyCombo = new javax.swing.JComboBox(); labelSrc.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.labelSrc.text")); // NOI18N @@ -366,16 +481,9 @@ public class ReportPanel extends javax.swing.JPanel { labelGraphType.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.labelGraphType.text")); // NOI18N - graphTypeCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Directed", "Undirected", "Mixed" })); - - autoscaleCheckbox.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.autoscaleCheckbox.text")); // NOI18N - autoscaleCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.autoscaleCheckbox.toolTipText")); // NOI18N - processorPanel.setLayout(new java.awt.GridBagLayout()); - createMissingNodesCheckbox.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.createMissingNodesCheckbox.text")); // NOI18N - - jPanel1.setLayout(new java.awt.GridBagLayout()); + statsPanel.setLayout(new java.awt.GridBagLayout()); labelNodeCount.setFont(labelNodeCount.getFont().deriveFont(labelNodeCount.getFont().getStyle() | java.awt.Font.BOLD)); labelNodeCount.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.labelNodeCount.text")); // NOI18N @@ -384,7 +492,7 @@ public class ReportPanel extends javax.swing.JPanel { gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(10, 0, 6, 0); - jPanel1.add(labelNodeCount, gridBagConstraints); + statsPanel.add(labelNodeCount, gridBagConstraints); labelEdgeCount.setFont(labelEdgeCount.getFont().deriveFont(labelEdgeCount.getFont().getStyle() | java.awt.Font.BOLD)); labelEdgeCount.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.labelEdgeCount.text")); // NOI18N @@ -393,7 +501,7 @@ public class ReportPanel extends javax.swing.JPanel { gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 10, 0); - jPanel1.add(labelEdgeCount, gridBagConstraints); + statsPanel.add(labelEdgeCount, gridBagConstraints); nodeCountLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N nodeCountLabel.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.nodeCountLabel.text")); // NOI18N @@ -403,7 +511,7 @@ public class ReportPanel extends javax.swing.JPanel { gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(10, 10, 6, 0); - jPanel1.add(nodeCountLabel, gridBagConstraints); + statsPanel.add(nodeCountLabel, gridBagConstraints); edgeCountLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N edgeCountLabel.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.edgeCountLabel.text")); // NOI18N @@ -413,7 +521,7 @@ public class ReportPanel extends javax.swing.JPanel { gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 10, 10, 0); - jPanel1.add(edgeCountLabel, gridBagConstraints); + statsPanel.add(edgeCountLabel, gridBagConstraints); dynamicLabel.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.dynamicLabel.text")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); @@ -422,7 +530,7 @@ public class ReportPanel extends javax.swing.JPanel { gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 10, 6, 0); - jPanel1.add(dynamicLabel, gridBagConstraints); + statsPanel.add(dynamicLabel, gridBagConstraints); labelDynamic.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.labelDynamic.text")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); @@ -430,7 +538,7 @@ public class ReportPanel extends javax.swing.JPanel { gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 6, 0); - jPanel1.add(labelDynamic, gridBagConstraints); + statsPanel.add(labelDynamic, gridBagConstraints); jLabel1.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.jLabel1.text")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); @@ -439,7 +547,59 @@ public class ReportPanel extends javax.swing.JPanel { gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weighty = 1.0; - jPanel1.add(jLabel1, gridBagConstraints); + statsPanel.add(jLabel1, gridBagConstraints); + + moreOptionsLink.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.moreOptionsLink.text")); // NOI18N + + moreOptionsPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + + autoscaleCheckbox.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.autoscaleCheckbox.text")); // NOI18N + autoscaleCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.autoscaleCheckbox.toolTipText")); // NOI18N + + createMissingNodesCheckbox.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.createMissingNodesCheckbox.text")); // NOI18N + createMissingNodesCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.createMissingNodesCheckbox.toolTipText")); // NOI18N + + selfLoopCheckBox.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.selfLoopCheckBox.text")); // NOI18N + selfLoopCheckBox.setToolTipText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.selfLoopCheckBox.toolTipText")); // NOI18N + selfLoopCheckBox.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); + + labelParallelEdgesMergeStrategy.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.labelParallelEdgesMergeStrategy.text")); // NOI18N + + javax.swing.GroupLayout moreOptionsPanelLayout = new javax.swing.GroupLayout(moreOptionsPanel); + moreOptionsPanel.setLayout(moreOptionsPanelLayout); + moreOptionsPanelLayout.setHorizontalGroup( + moreOptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(moreOptionsPanelLayout.createSequentialGroup() + .addContainerGap() + .addGroup(moreOptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(moreOptionsPanelLayout.createSequentialGroup() + .addComponent(selfLoopCheckBox) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(labelParallelEdgesMergeStrategy) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(edgesMergeStrategyCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(moreOptionsPanelLayout.createSequentialGroup() + .addGroup(moreOptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(createMissingNodesCheckbox) + .addComponent(autoscaleCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + ); + moreOptionsPanelLayout.setVerticalGroup( + moreOptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(moreOptionsPanelLayout.createSequentialGroup() + .addContainerGap() + .addGroup(moreOptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(selfLoopCheckBox) + .addGroup(moreOptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(labelParallelEdgesMergeStrategy) + .addComponent(edgesMergeStrategyCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(autoscaleCheckbox) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(createMissingNodesCheckbox) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); @@ -448,7 +608,7 @@ public class ReportPanel extends javax.swing.JPanel { .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(tabbedPane) + .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 609, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(labelSrc) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -457,15 +617,17 @@ public class ReportPanel extends javax.swing.JPanel { .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(labelGraphType) - .addGap(49, 49, 49) - .addComponent(graphTypeCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(18, 18, 18) + .addComponent(graphTypeCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE)) + .addComponent(statsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(createMissingNodesCheckbox, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(autoscaleCheckbox, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addComponent(processorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(processorPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(moreOptionsLink, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(8, 8, 8)))) + .addComponent(moreOptionsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); layout.setVerticalGroup( @@ -476,20 +638,19 @@ public class ReportPanel extends javax.swing.JPanel { .addComponent(labelSrc) .addComponent(sourceLabel)) .addGap(18, 18, 18) - .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 137, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(tabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(labelGraphType) - .addComponent(autoscaleCheckbox) - .addComponent(graphTypeCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(graphTypeCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(moreOptionsLink, 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.TRAILING) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() - .addComponent(createMissingNodesCheckbox) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(processorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE) - .addContainerGap()) - .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(moreOptionsPanel, 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.LEADING) + .addComponent(processorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(statsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 121, Short.MAX_VALUE)) + .addContainerGap()) ); }// //GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables @@ -497,20 +658,25 @@ public class ReportPanel extends javax.swing.JPanel { private javax.swing.JCheckBox createMissingNodesCheckbox; private javax.swing.JLabel dynamicLabel; private javax.swing.JLabel edgeCountLabel; + private javax.swing.JComboBox edgesMergeStrategyCombo; private javax.swing.JComboBox graphTypeCombo; private org.netbeans.swing.outline.Outline issuesOutline; private javax.swing.JLabel jLabel1; - private javax.swing.JPanel jPanel1; private javax.swing.JLabel labelDynamic; private javax.swing.JLabel labelEdgeCount; private javax.swing.JLabel labelGraphType; private javax.swing.JLabel labelNodeCount; + private javax.swing.JLabel labelParallelEdgesMergeStrategy; private javax.swing.JLabel labelSrc; + private org.jdesktop.swingx.JXHyperlink moreOptionsLink; + private javax.swing.JPanel moreOptionsPanel; private javax.swing.JLabel nodeCountLabel; private javax.swing.JPanel processorPanel; private javax.swing.ButtonGroup processorStrategyRadio; private javax.swing.JEditorPane reportEditor; + private javax.swing.JCheckBox selfLoopCheckBox; private javax.swing.JLabel sourceLabel; + private javax.swing.JPanel statsPanel; private javax.swing.JScrollPane tab1ScrollPane; private javax.swing.JScrollPane tab2ScrollPane; private javax.swing.JTabbedPane tabbedPane; @@ -597,7 +763,7 @@ public class ReportPanel extends javax.swing.JPanel { @Override public String getColumnName(int column) { - return "Issues"; + return NbBundle.getMessage(ReportPanel.class, "ReportPanel.issueTable.issues"); } } diff --git a/modules/DesktopImport/src/main/resources/org/gephi/desktop/importer/Bundle.properties b/modules/DesktopImport/src/main/resources/org/gephi/desktop/importer/Bundle.properties index c0525d160b0335485c0767e9e53ce1a57b29f61e..56877c383e7893d96fd71760c032d88a0b588790 100644 --- a/modules/DesktopImport/src/main/resources/org/gephi/desktop/importer/Bundle.properties +++ b/modules/DesktopImport/src/main/resources/org/gephi/desktop/importer/Bundle.properties @@ -21,6 +21,10 @@ ReportPanel.autoscaleCheckbox.text=Auto-scale ReportPanel.noIssues=No issue found during import ReportPanel.yes=yes ReportPanel.no=no +ReportPanel.graphType.directed=Directed +ReportPanel.graphType.undirected=Undirected +ReportPanel.graphType.mixed=Mixed +ReportPanel.issueTable.issues=Issues DesktopImportControllerUI.spigotSource = Spigot {0} DesktopImportControllerUI.streamSource = Stream {0} @@ -39,4 +43,13 @@ DesktopImportControllerUI.spigot.ui.dialog.title = {0} settings DesktopImportControllerUI.processor.ui.dialog.title = Processor settings ReportPanel.createMissingNodesCheckbox.text=Create missing nodes +ReportPanel.createMissingNodesCheckbox.toolTipText=Create missing nodes found as edges' source or target +ReportPanel.moreOptionsLink.text=More options... ReportPanel.jLabel1.text= +ReportPanel.selfLoopCheckBox.text=Self-loops +ReportPanel.selfLoopCheckBox.toolTipText=Allow self-loops on nodes +ReportPanel.labelParallelEdgesMergeStrategy.text=Edges merge strategy: +ReportPanel.mergeStrategy.sum=Sum +ReportPanel.mergeStrategy.avg=Average +ReportPanel.mergeStrategy.min=Minimum +ReportPanel.mergeStrategy.max=Maximum diff --git a/modules/ImportAPI/src/main/java/org/gephi/io/importer/api/Container.java b/modules/ImportAPI/src/main/java/org/gephi/io/importer/api/Container.java index eee9518cf311a065d21c65f2a37f5297985fc2af..eaa5eb4c150256f4f1965dec0e7536bf017be16c 100644 --- a/modules/ImportAPI/src/main/java/org/gephi/io/importer/api/Container.java +++ b/modules/ImportAPI/src/main/java/org/gephi/io/importer/api/Container.java @@ -95,16 +95,6 @@ public interface Container { */ public ContainerUnloader getUnloader(); - public void setAutoScale(boolean autoscale); - - public boolean isAutoScale(); - - public void setAllowSelfLoop(boolean value); - - public void setAllowAutoNode(boolean value); - - public void setAllowParallelEdge(boolean value); - /** * Set a report this container can use to report issues detected when * loading the container. Report are used to log info and issues during @@ -128,7 +118,7 @@ public interface Container { * This method must be called after the loading is complete and before * unloading. Its aim is to verify data consistency as a whole. * - * @return true if container data is * * consistent, false otherwise + * @return true if container data is * * * consistent, false otherwise */ public boolean verify(); diff --git a/modules/ImportAPI/src/main/java/org/gephi/io/importer/api/ContainerLoader.java b/modules/ImportAPI/src/main/java/org/gephi/io/importer/api/ContainerLoader.java index af06c78eb77fd42f84c536b4bb2c93f2fdc0a7da..7cb7a25d1356c800a777b49e5388c012c559e9ad 100644 --- a/modules/ImportAPI/src/main/java/org/gephi/io/importer/api/ContainerLoader.java +++ b/modules/ImportAPI/src/main/java/org/gephi/io/importer/api/ContainerLoader.java @@ -133,7 +133,8 @@ public interface ContainerLoader { * * @param source the edge source node * @param target the edge target node - * @return the edge from source to target * * * * or null if not found + * @return the edge from source to target * * * * + * or null if not found */ // public EdgeDraft getEdge(NodeDraft source, NodeDraft target); /** @@ -163,7 +164,7 @@ public interface ContainerLoader { * * @param edgeDefault the edge default type value */ - public void setEdgeDefault(EdgeDiretionDefault edgeDefault); + public void setEdgeDefault(EdgeDirectionDefault edgeDefault); public ColumnDraft getNodeColumn(String key); @@ -188,4 +189,15 @@ public interface ContainerLoader { * @param timeFormat the current time format */ public void setTimeFormat(TimeFormat timeFormat); + + //PARAMETERS SETTERS + public void setAllowSelfLoop(boolean value); + + public void setAllowAutoNode(boolean value); + + public void setAllowParallelEdge(boolean value); + + public void setAutoScale(boolean autoscale); + + public void setEdgesMergeStrategy(EdgeWeightMergeStrategy edgesMergeStrategy); } diff --git a/modules/ImportAPI/src/main/java/org/gephi/io/importer/api/ContainerUnloader.java b/modules/ImportAPI/src/main/java/org/gephi/io/importer/api/ContainerUnloader.java index 01bf52cfe5d493e82ec2c13de8ba074c12f66aee..2833230030678fa8c3ad6580a460ff50b1c0ec52 100644 --- a/modules/ImportAPI/src/main/java/org/gephi/io/importer/api/ContainerUnloader.java +++ b/modules/ImportAPI/src/main/java/org/gephi/io/importer/api/ContainerUnloader.java @@ -72,15 +72,20 @@ public interface ContainerUnloader { public Iterable getEdgeColumns(); // public EdgeDraft getEdge(NodeDraft source, NodeDraft target); - public EdgeDiretionDefault getEdgeDefault(); + public EdgeDirectionDefault getEdgeDefault(); public TimeFormat getTimeFormat(); + public String getSource(); + + //PARAMETERS GETTERS public boolean allowSelfLoop(); public boolean allowAutoNode(); public boolean allowParallelEdges(); - public String getSource(); + public boolean isAutoScale(); + + public EdgeWeightMergeStrategy getEdgesMergeStrategy(); } diff --git a/modules/ImportAPI/src/main/java/org/gephi/io/importer/api/EdgeWeightMergeStrategy.java b/modules/ImportAPI/src/main/java/org/gephi/io/importer/api/EdgeWeightMergeStrategy.java new file mode 100644 index 0000000000000000000000000000000000000000..dbba2bac7a722ffedc60f97710e23ba0ea053668 --- /dev/null +++ b/modules/ImportAPI/src/main/java/org/gephi/io/importer/api/EdgeWeightMergeStrategy.java @@ -0,0 +1,47 @@ +/* + Copyright 2008-2010 Gephi + Authors : Mathieu Bastian + Website : http://www.gephi.org + + This file is part of Gephi. + + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + + Copyright 2011 Gephi Consortium. All rights reserved. + + The contents of this file are subject to the terms of either the GNU + General Public License Version 3 only ("GPL") or the Common + Development and Distribution License("CDDL") (collectively, the + "License"). You may not use this file except in compliance with the + License. You can obtain a copy of the License at + http://gephi.org/about/legal/license-notice/ + or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the + specific language governing permissions and limitations under the + License. When distributing the software, include this License Header + Notice in each file and include the License files at + /cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the + License Header, with the fields enclosed by brackets [] replaced by + your own identifying information: + "Portions Copyrighted [year] [name of copyright owner]" + + If you wish your version of this file to be governed by only the CDDL + or only the GPL Version 3, indicate your decision by adding + "[Contributor] elects to include this software in this distribution + under the [CDDL or GPL Version 3] license." If you do not indicate a + single choice of license, a recipient has the option to distribute + your version of this file under either the CDDL, the GPL Version 3 or + to extend the choice of license to its licensees as provided above. + However, if you add GPL Version 3 code and therefore, elected the GPL + Version 3 license, then the option applies only if the new code is + made subject to such option by the copyright holder. + + Contributor(s): + + Portions Copyrighted 2011 Gephi Consortium. + */ +package org.gephi.io.importer.api; + +public enum EdgeWeightMergeStrategy { + + SUM, AVG, MAX, MIN +} diff --git a/modules/ImportAPI/src/main/java/org/gephi/io/importer/impl/ImportContainerParameters.java b/modules/ImportAPI/src/main/java/org/gephi/io/importer/impl/ImportContainerParameters.java index f0fce3485a3c0f370400bc1be7fa97651e7d9d28..e16412d18f13d85b7cca7270d1362a20727b4959 100644 --- a/modules/ImportAPI/src/main/java/org/gephi/io/importer/impl/ImportContainerParameters.java +++ b/modules/ImportAPI/src/main/java/org/gephi/io/importer/impl/ImportContainerParameters.java @@ -41,25 +41,21 @@ */ package org.gephi.io.importer.impl; +import org.gephi.io.importer.api.EdgeWeightMergeStrategy; + /** * * @author Mathieu Bastian */ public class ImportContainerParameters { - public enum EdgeWeightMergeStrategy { - - SUM, AVG, MAX, MIN - } protected boolean selfLoops = true; protected boolean parallelEdges = true; protected boolean autoNode = true; protected boolean autoScale = true; protected boolean sortNodesBySize = true; protected boolean fillLabelWithId = true; - protected EdgeWeightMergeStrategy parallelEdgesMergeStrategy = EdgeWeightMergeStrategy.SUM; - protected EdgeWeightMergeStrategy undirectedMergeStrategy = EdgeWeightMergeStrategy.SUM; - protected boolean mergeParallelEdgesWeight = true; + protected EdgeWeightMergeStrategy edgesMergeStrategy = EdgeWeightMergeStrategy.SUM; protected boolean mergeParallelEdgesAttributes = true; protected boolean duplicateWithLabels = false; @@ -71,12 +67,8 @@ public class ImportContainerParameters { this.autoNode = autoNode; } - public EdgeWeightMergeStrategy getParallelEdgesMergeStrategy() { - return parallelEdgesMergeStrategy; - } - - public EdgeWeightMergeStrategy getUndirectedMergeStrategy() { - return undirectedMergeStrategy; + public EdgeWeightMergeStrategy getEdgesMergeStrategy() { + return edgesMergeStrategy; } public boolean isParallelEdges() { @@ -119,14 +111,6 @@ public class ImportContainerParameters { this.autoScale = autoScale; } - public boolean isMergeParallelEdgesWeight() { - return mergeParallelEdgesWeight; - } - - public void setMergeParallelEdgesWeight(boolean mergeParallelEdgesWeight) { - this.mergeParallelEdgesWeight = mergeParallelEdgesWeight; - } - public boolean isDuplicateWithLabels() { return duplicateWithLabels; } @@ -142,4 +126,8 @@ public class ImportContainerParameters { public void setMergeParallelEdgesAttributes(boolean mergeParallelEdgesAttributes) { this.mergeParallelEdgesAttributes = mergeParallelEdgesAttributes; } + + public void setEdgesMergeStrategy(EdgeWeightMergeStrategy edgesMergeStrategy) { + this.edgesMergeStrategy = edgesMergeStrategy; + } } diff --git a/modules/ImportAPI/src/main/java/org/gephi/io/importer/impl/ImportControllerImpl.java b/modules/ImportAPI/src/main/java/org/gephi/io/importer/impl/ImportControllerImpl.java index 9a37c66b23d0c04f9b06e2aa020d71b492894dc2..425a762cafd673be109a3608c0dea9c490bad04a 100644 --- a/modules/ImportAPI/src/main/java/org/gephi/io/importer/impl/ImportControllerImpl.java +++ b/modules/ImportAPI/src/main/java/org/gephi/io/importer/impl/ImportControllerImpl.java @@ -1,43 +1,43 @@ /* -Copyright 2008-2010 Gephi -Authors : Mathieu Bastian -Website : http://www.gephi.org - -This file is part of Gephi. - -DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - -Copyright 2011 Gephi Consortium. All rights reserved. - -The contents of this file are subject to the terms of either the GNU -General Public License Version 3 only ("GPL") or the Common -Development and Distribution License("CDDL") (collectively, the -"License"). You may not use this file except in compliance with the -License. You can obtain a copy of the License at -http://gephi.org/about/legal/license-notice/ -or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the -specific language governing permissions and limitations under the -License. When distributing the software, include this License Header -Notice in each file and include the License files at -/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the -License Header, with the fields enclosed by brackets [] replaced by -your own identifying information: -"Portions Copyrighted [year] [name of copyright owner]" - -If you wish your version of this file to be governed by only the CDDL -or only the GPL Version 3, indicate your decision by adding -"[Contributor] elects to include this software in this distribution -under the [CDDL or GPL Version 3] license." If you do not indicate a -single choice of license, a recipient has the option to distribute -your version of this file under either the CDDL, the GPL Version 3 or -to extend the choice of license to its licensees as provided above. -However, if you add GPL Version 3 code and therefore, elected the GPL -Version 3 license, then the option applies only if the new code is -made subject to such option by the copyright holder. - -Contributor(s): - -Portions Copyrighted 2011 Gephi Consortium. + Copyright 2008-2010 Gephi + Authors : Mathieu Bastian + Website : http://www.gephi.org + + This file is part of Gephi. + + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + + Copyright 2011 Gephi Consortium. All rights reserved. + + The contents of this file are subject to the terms of either the GNU + General Public License Version 3 only ("GPL") or the Common + Development and Distribution License("CDDL") (collectively, the + "License"). You may not use this file except in compliance with the + License. You can obtain a copy of the License at + http://gephi.org/about/legal/license-notice/ + or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the + specific language governing permissions and limitations under the + License. When distributing the software, include this License Header + Notice in each file and include the License files at + /cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the + License Header, with the fields enclosed by brackets [] replaced by + your own identifying information: + "Portions Copyrighted [year] [name of copyright owner]" + + If you wish your version of this file to be governed by only the CDDL + or only the GPL Version 3, indicate your decision by adding + "[Contributor] elects to include this software in this distribution + under the [CDDL or GPL Version 3] license." If you do not indicate a + single choice of license, a recipient has the option to distribute + your version of this file under either the CDDL, the GPL Version 3 or + to extend the choice of license to its licensees as provided above. + However, if you add GPL Version 3 code and therefore, elected the GPL + Version 3 license, then the option applies only if the new code is + made subject to such option by the copyright holder. + + Contributor(s): + + Portions Copyrighted 2011 Gephi Consortium. */ package org.gephi.io.importer.impl; @@ -268,7 +268,7 @@ public class ImportControllerImpl implements ImportController { @Override public void process(Container container, Processor processor, Workspace workspace) { container.closeLoader(); - if (container.isAutoScale()) { + if (container.getUnloader().isAutoScale()) { Scaler scaler = Lookup.getDefault().lookup(Scaler.class); if (scaler != null) { scaler.doScale(container);