diff --git a/README.md b/README.md index 42f890df69dc007896385e453dd46718980f12bb..a2582805427c92ee782206a56eb58a6771c01633 100644 --- a/README.md +++ b/README.md @@ -1,124 +1,124 @@ -# Gephi - The Open Graph Viz Platform - -[![Build Status](https://travis-ci.org/gephi/gephi.svg?branch=master)](https://travis-ci.org/gephi/gephi) -[![Dependency Status](https://www.versioneye.com/user/projects/5891dedd45c80c0016cae662/badge.svg?style=flat)](https://www.versioneye.com/user/projects/5891dedd45c80c0016cae662?child=summary) -[![Downloads](https://img.shields.io/github/downloads/gephi/gephi/v0.9.1/total.svg)](https://github.com/gephi/gephi/releases/tag/v0.9.1) - -[Gephi](http://gephi.org) is an award-winning open-source platform for visualizing and manipulating large graphs. It runs on Windows, Mac OS X and Linux. Localization is available in French, Spanish, Japanese, Russian, Brazilian Portuguese, Chinese and Czech. - -- **Fast** Powered by a built-in OpenGL engine, Gephi is able to push the envelope with very large networks. Visualize networks up to a million elements. All actions (e.g. layout, filter, drag) run in real-time. - -- **Simple** Easy to install and [get started](https://gephi.github.io/users/quick-start). An UI that is centered around the visualization. Like Photoshop™ for graphs. - -- **Modular** Extend Gephi with [plug-ins](https://marketplace.gephi.org). The architecture is built on top of Netbeans Platform and can be extended or reused easily through well-written APIs. - -[Download Gephi](https://gephi.github.io/users/download) for Windows, Mac OS X and Linux and consult the [release notes](https://github.com/gephi/gephi/wiki/Releases). Example datasets can be found on our [wiki](https://github.com/gephi/gephi/wiki/Datasets). - -![Gephi](https://gephi.github.io/images/screenshots/select-tool-mini.png) - -## Install and use Gephi - -Download and [Install](https://gephi.github.io/users/install/) Gephi on your computer. - -Get started with the [Quick Start](https://gephi.github.io/users/quick-start/) and follow the [Tutorials](https://gephi.github.io/users/). Load a sample [dataset](https://github.com/gephi/gephi/wiki/Datasets) and start to play with the data. - -If you run into any trouble or have questions consult our [forum](http://forum.gephi.org). - -## Latest releases - -### Stable - -- Latest stable release on [gephi.org](https://gephi.org/users/download//). - -### Nightly builds - -Current version is 0.9.2-SNAPSHOT - -- [gephi-0.9.2-SNAPSHOT-windows.exe](http://oss.sonatype.org/service/local/artifact/maven/content?r=snapshots&g=org.gephi&a=gephi&v=0.9.2-SNAPSHOT&c=windows&p=exe) (Windows) - -- [gephi-0.9.2-SNAPSHOT-macos.dmg](http://oss.sonatype.org/service/local/artifact/maven/content?r=snapshots&g=org.gephi&a=gephi&v=0.9.2-SNAPSHOT&c=macos&p=dmg) (Mac OS X) - -- [gephi-0.9.2-SNAPSHOT-linux.tar.gz](https://oss.sonatype.org/service/local/artifact/maven/content?r=snapshots&g=org.gephi&a=gephi&v=0.9.2-SNAPSHOT&c=linux&p=tar.gz) (Linux) - -- [gephi-0.9.2-SNAPSHOT-sources.tar.gz](https://oss.sonatype.org/service/local/artifact/maven/content?r=snapshots&g=org.gephi&a=gephi&v=0.9.2-SNAPSHOT&c=sources&p=tar.gz) (Sources) - -## Developer Introduction - -Gephi is developed in Java and uses OpenGL for its visualization engine. Built on the top of Netbeans Platform, it follows a loosely-coupled, modular architecture philosophy. Gephi is split into modules, which depend on other modules through well-written APIs. Plugins can reuse existing APIs, create new services and even replace a default implementation with a new one. - -Consult the [**Javadoc**](http://gephi.github.io/gephi/0.9.1/apidocs/index.html) for an overview of the APIs. - -### Requirements - -- Java JDK 7 or 8 with preferably [Oracle Java JDK](http://java.com/en/). - -- [Apache Maven](http://maven.apache.org/) version 3.2.2 or later - -### Checkout and Build the sources - -- Fork the repository and clone - - git clone git@github.com:username/gephi.git - -- Run the following command or [open the project in Netbeans](https://github.com/gephi/gephi/wiki/How-to-build-Gephi) - - mvn clean install - -- Once built, one can test running Gephi - - cd modules/application - mvn nbm:cluster-app nbm:run-platform - -### Create Plug-ins - -Gephi is extensible and lets developers create plug-ins to add new features, or to modify existing features. For example, you can create a new layout algorithm, add a metric, create a filter or a tool, support a new file format or database, or modify the visualization. - -- [**Plugins Portal**](https://github.com/gephi/gephi/wiki/Plugins) - -- [Plugins Quick Start (5 minutes)](https://github.com/gephi/gephi/wiki/Plugin-Quick-Start) - -- Browse the [plugins](https://marketplace.gephi.org/) created by the community - -- We've created a [**Plugins Bootcamp**](https://github.com/gephi/gephi-plugins-bootcamp) to learn by examples. - -## Gephi Toolkit - -The Gephi Toolkit project packages essential Gephi modules (Graph, Layout, Filters, IO…) in a standard Java library which any Java project can use for getting things done. It can be used on a server or command-line tool to do the same things Gephi does but automatically. - -- [Download](https://gephi.org/toolkit/) - -- [GitHub Project](https://github.com/gephi/gephi-toolkit) - -- [Toolkit Portal](https://github.com/gephi/gephi/wiki/Toolkit) - -## License - -Gephi main source code is distributed under the dual license [CDDL 1.0](http://www.opensource.org/licenses/CDDL-1.0) and [GNU General Public License v3](http://www.gnu.org/licenses/gpl.html). Read the [Legal FAQs](http://gephi.github.io/legal/faq/) to learn more. - -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.github.io/developers/license/ -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. +# Gephi - The Open Graph Viz Platform + +[![Build Status](https://travis-ci.org/gephi/gephi.svg?branch=master)](https://travis-ci.org/gephi/gephi) +[![Dependency Status](https://www.versioneye.com/user/projects/5891dedd45c80c0016cae662/badge.svg?style=flat)](https://www.versioneye.com/user/projects/5891dedd45c80c0016cae662?child=summary) +[![Downloads](https://img.shields.io/github/downloads/gephi/gephi/v0.9.1/total.svg)](https://github.com/gephi/gephi/releases/tag/v0.9.1) + +[Gephi](http://gephi.org) is an award-winning open-source platform for visualizing and manipulating large graphs. It runs on Windows, Mac OS X and Linux. Localization is available in English, French, Spanish, Japanese, Russian, Brazilian Portuguese, Chinese, Czech and German. + +- **Fast** Powered by a built-in OpenGL engine, Gephi is able to push the envelope with very large networks. Visualize networks up to a million elements. All actions (e.g. layout, filter, drag) run in real-time. + +- **Simple** Easy to install and [get started](https://gephi.github.io/users/quick-start). An UI that is centered around the visualization. Like Photoshop™ for graphs. + +- **Modular** Extend Gephi with [plug-ins](https://marketplace.gephi.org). The architecture is built on top of Netbeans Platform and can be extended or reused easily through well-written APIs. + +[Download Gephi](https://gephi.github.io/users/download) for Windows, Mac OS X and Linux and consult the [release notes](https://github.com/gephi/gephi/wiki/Releases). Example datasets can be found on our [wiki](https://github.com/gephi/gephi/wiki/Datasets). + +![Gephi](https://gephi.github.io/images/screenshots/select-tool-mini.png) + +## Install and use Gephi + +Download and [Install](https://gephi.github.io/users/install/) Gephi on your computer. + +Get started with the [Quick Start](https://gephi.github.io/users/quick-start/) and follow the [Tutorials](https://gephi.github.io/users/). Load a sample [dataset](https://github.com/gephi/gephi/wiki/Datasets) and start to play with the data. + +If you run into any trouble or have questions consult our [forum](http://forum.gephi.org). + +## Latest releases + +### Stable + +- Latest stable release on [gephi.org](https://gephi.org/users/download//). + +### Nightly builds + +Current version is 0.9.2-SNAPSHOT + +- [gephi-0.9.2-SNAPSHOT-windows.exe](http://oss.sonatype.org/service/local/artifact/maven/content?r=snapshots&g=org.gephi&a=gephi&v=0.9.2-SNAPSHOT&c=windows&p=exe) (Windows) + +- [gephi-0.9.2-SNAPSHOT-macos.dmg](http://oss.sonatype.org/service/local/artifact/maven/content?r=snapshots&g=org.gephi&a=gephi&v=0.9.2-SNAPSHOT&c=macos&p=dmg) (Mac OS X) + +- [gephi-0.9.2-SNAPSHOT-linux.tar.gz](https://oss.sonatype.org/service/local/artifact/maven/content?r=snapshots&g=org.gephi&a=gephi&v=0.9.2-SNAPSHOT&c=linux&p=tar.gz) (Linux) + +- [gephi-0.9.2-SNAPSHOT-sources.tar.gz](https://oss.sonatype.org/service/local/artifact/maven/content?r=snapshots&g=org.gephi&a=gephi&v=0.9.2-SNAPSHOT&c=sources&p=tar.gz) (Sources) + +## Developer Introduction + +Gephi is developed in Java and uses OpenGL for its visualization engine. Built on the top of Netbeans Platform, it follows a loosely-coupled, modular architecture philosophy. Gephi is split into modules, which depend on other modules through well-written APIs. Plugins can reuse existing APIs, create new services and even replace a default implementation with a new one. + +Consult the [**Javadoc**](http://gephi.github.io/gephi/0.9.1/apidocs/index.html) for an overview of the APIs. + +### Requirements + +- Java JDK 7 or 8 with preferably [Oracle Java JDK](http://java.com/en/). + +- [Apache Maven](http://maven.apache.org/) version 3.2.2 or later + +### Checkout and Build the sources + +- Fork the repository and clone + + git clone git@github.com:username/gephi.git + +- Run the following command or [open the project in Netbeans](https://github.com/gephi/gephi/wiki/How-to-build-Gephi) + + mvn clean install + +- Once built, one can test running Gephi + + cd modules/application + mvn nbm:cluster-app nbm:run-platform + +### Create Plug-ins + +Gephi is extensible and lets developers create plug-ins to add new features, or to modify existing features. For example, you can create a new layout algorithm, add a metric, create a filter or a tool, support a new file format or database, or modify the visualization. + +- [**Plugins Portal**](https://github.com/gephi/gephi/wiki/Plugins) + +- [Plugins Quick Start (5 minutes)](https://github.com/gephi/gephi/wiki/Plugin-Quick-Start) + +- Browse the [plugins](https://marketplace.gephi.org/) created by the community + +- We've created a [**Plugins Bootcamp**](https://github.com/gephi/gephi-plugins-bootcamp) to learn by examples. + +## Gephi Toolkit + +The Gephi Toolkit project packages essential Gephi modules (Graph, Layout, Filters, IO…) in a standard Java library which any Java project can use for getting things done. It can be used on a server or command-line tool to do the same things Gephi does but automatically. + +- [Download](https://gephi.org/toolkit/) + +- [GitHub Project](https://github.com/gephi/gephi-toolkit) + +- [Toolkit Portal](https://github.com/gephi/gephi/wiki/Toolkit) + +## License + +Gephi main source code is distributed under the dual license [CDDL 1.0](http://www.opensource.org/licenses/CDDL-1.0) and [GNU General Public License v3](http://www.gnu.org/licenses/gpl.html). Read the [Legal FAQs](http://gephi.github.io/legal/faq/) to learn more. + +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.github.io/developers/license/ +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. 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 878675c053887fcccfdaedbf6043675df706846b..2962c9cbc3ae8d52ebe21c0e73d927c8e05efa6a 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 @@ -31,9 +31,9 @@ - - - + + + 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 b806ea6735f78f0c7845c0f159e871d12f2cbed0..22ba7c4c6c2986dae245b653494f153409e4599b 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 @@ -1,961 +1,970 @@ -/* - 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.desktop.importer; - -import java.awt.Color; -import java.awt.GridBagConstraints; -import java.awt.Insets; -import java.awt.Toolkit; -import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.StringSelection; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.Iterator; -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.JMenuItem; -import javax.swing.JPopupMenu; -import javax.swing.JRadioButton; -import javax.swing.JRootPane; -import javax.swing.SwingConstants; -import javax.swing.SwingUtilities; -import javax.swing.event.TreeModelListener; -import javax.swing.tree.TreeModel; -import javax.swing.tree.TreePath; -import org.gephi.io.importer.api.Container; -import org.gephi.io.importer.api.EdgeDirectionDefault; -import org.gephi.io.importer.api.EdgeMergeStrategy; -import org.gephi.io.importer.api.Issue; -import org.gephi.io.importer.api.Report; -import org.gephi.io.processor.spi.Processor; -import org.gephi.io.processor.spi.ProcessorUI; -import org.gephi.ui.components.BusyUtils; -import org.netbeans.swing.outline.DefaultOutlineModel; -import org.netbeans.swing.outline.OutlineModel; -import org.netbeans.swing.outline.RenderDataProvider; -import org.netbeans.swing.outline.RowModel; -import org.openide.util.Exceptions; -import org.openide.util.Lookup; -import org.openide.util.NbBundle; -import org.openide.util.NbPreferences; - -/** - * - * @author Mathieu Bastian - */ -public class ReportPanel extends javax.swing.JPanel { - - //Preferences - private final static String SHOW_ISSUES = "ReportPanel_Show_Issues"; - private final static String SHOW_REPORT = "ReportPanel_Show_Report"; - private final static int ISSUES_LIMIT = 5000; - private final ThreadGroup fillingThreads; - //Icons - private ImageIcon infoIcon; - private ImageIcon warningIcon; - private ImageIcon severeIcon; - private ImageIcon criticalIcon; - //Container - private Container[] containers; - //UI - private ButtonGroup processorGroup = new ButtonGroup(); - //Preferences: - private static final String PREF_MORE_OPTIONS_PANEL_VISIBLE = "ReportPanel_moreOptionsPanelVisible"; - private static final String PREF_EDGE_MERGE_STRATEGY = "ReportPanel_edgeMergeStrategy"; - private static final String PREF_AUTOSCALE = "ReportPanel_autoscale"; - private static final String PREF_CREATE_MISSING_NODES = "ReportPanel_createMissingNodes"; - private static final String PREF_SELF_LOOP = "ReportPanel_selfLoops"; - - public ReportPanel() { - try { - SwingUtilities.invokeAndWait(new Runnable() { - @Override - public void run() { - initComponents(); - initIcons(); - initProcessors(); - initMoreOptionsPanel(); - initMergeStrategyCombo(); - } - }); - } catch (InterruptedException ex) { - Exceptions.printStackTrace(ex); - } catch (InvocationTargetException ex) { - Exceptions.printStackTrace(ex); - } - - fillingThreads = new ThreadGroup("Report Panel Issues"); - - autoscaleCheckbox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - boolean s = autoscaleCheckbox.isSelected(); - NbPreferences.forModule(ReportPanel.class).putBoolean(PREF_AUTOSCALE, s); - for (Container container : containers) { - container.getLoader().setAutoScale(s); - } - } - }); - - createMissingNodesCheckbox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - boolean s = createMissingNodesCheckbox.isSelected(); - NbPreferences.forModule(ReportPanel.class).putBoolean(PREF_CREATE_MISSING_NODES, s); - for (Container container : containers) { - container.getLoader().setAllowAutoNode(s); - } - } - }); - - moreOptionsLink.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - moreOptionsPanel.setVisible(!moreOptionsPanel.isVisible()); - NbPreferences.forModule(ReportPanel.class).putBoolean(PREF_MORE_OPTIONS_PANEL_VISIBLE, moreOptionsPanel.isVisible()); - JRootPane rootPane = SwingUtilities.getRootPane(ReportPanel.this); - ((JDialog) rootPane.getParent()).pack(); - } - }); - - edgesMergeStrategyCombo.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - EdgeMergeStrategy strategy = ((EdgesMergeStrategyWrapper) edgesMergeStrategyCombo.getSelectedItem()).getInstance(); - NbPreferences.forModule(ReportPanel.class).put(PREF_EDGE_MERGE_STRATEGY, strategy.name()); - for (Container container : containers) { - container.getLoader().setEdgesMergeStrategy(strategy); - } - } - }); - - selfLoopCheckBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - boolean s = selfLoopCheckBox.isSelected(); - NbPreferences.forModule(ReportPanel.class).putBoolean(PREF_SELF_LOOP, s); - for (Container container : containers) { - container.getLoader().setAllowSelfLoop(s); - } - } - }); - - reportEditor.addMouseListener(new MouseAdapter() { - - @Override - public void mouseClicked(MouseEvent e) { - if (SwingUtilities.isRightMouseButton(e)) { - JPopupMenu contextMenu = new JPopupMenu(); - JMenuItem menuItem = new JMenuItem(); - menuItem.setText(NbBundle.getMessage(ReportPanel.class, "ReportPanel.reportCopy.text")); - menuItem.setToolTipText(NbBundle.getMessage(ReportPanel.class, "ReportPanel.reportCopy.description")); - menuItem.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard(); - clpbrd.setContents(new StringSelection(reportEditor.getText()), null); - } - }); - contextMenu.add(menuItem); - contextMenu.show(reportEditor, e.getX(), e.getY()); - } - } - }); - } - - public void initIcons() { - infoIcon = new javax.swing.ImageIcon(getClass().getResource("/org/gephi/desktop/importer/resources/info.png")); - warningIcon = new javax.swing.ImageIcon(getClass().getResource("/org/gephi/desktop/importer/resources/warning.gif")); - severeIcon = new javax.swing.ImageIcon(getClass().getResource("/org/gephi/desktop/importer/resources/severe.png")); - criticalIcon = new javax.swing.ImageIcon(getClass().getResource("/org/gephi/desktop/importer/resources/critical.png")); - } - - public void setData(Report report, Container[] containers) { - this.containers = containers; - initGraphTypeCombo(containers); - - initProcessorsUI(); - - fillIssues(report); - fillReport(report); - - fillStats(containers); - fillParameters(containers); - } - - private void removeTabbedPane() { - tabbedPane.setVisible(false); - } - - private void initMergeStrategyCombo() { - DefaultComboBoxModel mergeStrategryModel = new DefaultComboBoxModel(new EdgesMergeStrategyWrapper[]{ - new EdgesMergeStrategyWrapper(EdgeMergeStrategy.SUM), - new EdgesMergeStrategyWrapper(EdgeMergeStrategy.AVG), - new EdgesMergeStrategyWrapper(EdgeMergeStrategy.MIN), - new EdgesMergeStrategyWrapper(EdgeMergeStrategy.MAX), - new EdgesMergeStrategyWrapper(EdgeMergeStrategy.FIRST), - new EdgesMergeStrategyWrapper(EdgeMergeStrategy.LAST), - new EdgesMergeStrategyWrapper(EdgeMergeStrategy.NO_MERGE) - }); - edgesMergeStrategyCombo.setModel(mergeStrategryModel); - } - - private void initMoreOptionsPanel() { - boolean moreOptionsPanelVisible = NbPreferences.forModule(ReportPanel.class).getBoolean(PREF_MORE_OPTIONS_PANEL_VISIBLE, false); - if (!moreOptionsPanelVisible) { - moreOptionsPanel.setVisible(false); - } - } - - private void initGraphTypeCombo(final Container[] containers) { - final String directedStr = NbBundle.getMessage(ReportPanel.class, "ReportPanel.graphType.directed"); - final String undirectedStr = NbBundle.getMessage(ReportPanel.class, "ReportPanel.graphType.undirected"); - final String mixedStr = NbBundle.getMessage(ReportPanel.class, "ReportPanel.graphType.mixed"); - - EdgeDirectionDefault edd = null; - for (Container container : containers) { - EdgeDirectionDefault d = container.getUnloader().getEdgeDefault(); - if (edd == null) { - edd = d; - } else if (d.equals(EdgeDirectionDefault.UNDIRECTED) && !edd.equals(EdgeDirectionDefault.UNDIRECTED)) { - edd = EdgeDirectionDefault.MIXED; - } else if (d.equals(EdgeDirectionDefault.DIRECTED) && !edd.equals(EdgeDirectionDefault.DIRECTED)) { - edd = EdgeDirectionDefault.MIXED; - } - } - final EdgeDirectionDefault dir = edd; - - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - - DefaultComboBoxModel comboModel = new DefaultComboBoxModel(); - - switch (dir) { - case DIRECTED: - comboModel.addElement(directedStr); - comboModel.addElement(undirectedStr); - comboModel.addElement(mixedStr); - comboModel.setSelectedItem(directedStr); - break; - case UNDIRECTED: - comboModel.addElement(undirectedStr); - comboModel.addElement(mixedStr); - comboModel.setSelectedItem(undirectedStr); - break; - case MIXED: - comboModel.addElement(directedStr); - comboModel.addElement(undirectedStr); - comboModel.addElement(mixedStr); - comboModel.setSelectedItem(mixedStr); - break; - } - - graphTypeCombo.setModel(comboModel); - } - }); - graphTypeCombo.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object g = e.getItem(); - if (g.equals(directedStr)) { - for (Container container : containers) { - container.getLoader().setEdgeDefault(EdgeDirectionDefault.DIRECTED); - } - } else if (g.equals(undirectedStr)) { - for (Container container : containers) { - container.getLoader().setEdgeDefault(EdgeDirectionDefault.UNDIRECTED); - } - } else if (g.equals(mixedStr)) { - for (Container container : containers) { - container.getLoader().setEdgeDefault(EdgeDirectionDefault.MIXED); - } - } - } - } - }); - } - - private void fillIssues(Report report) { - final List issues = new ArrayList<>(); - Iterator itr = report.getIssues(ISSUES_LIMIT); - while (itr.hasNext()) { - issues.add(itr.next()); - } - if (issues.isEmpty()) { - JLabel label = new JLabel(NbBundle.getMessage(getClass(), "ReportPanel.noIssues")); - label.setHorizontalAlignment(SwingConstants.CENTER); - tab1ScrollPane.setViewportView(label); - } else { - //Busy label - final BusyUtils.BusyLabel busyLabel = BusyUtils.createCenteredBusyLabel(tab1ScrollPane, "Retrieving issues...", issuesOutline); - - //Thread - Thread thread = new Thread(fillingThreads, new Runnable() { - @Override - public void run() { - busyLabel.setBusy(true); - final TreeModel treeMdl = new IssueTreeModel(issues); - final OutlineModel mdl = DefaultOutlineModel.createOutlineModel(treeMdl, new IssueRowModel(), true); - - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - issuesOutline.setRootVisible(false); - issuesOutline.setRenderDataProvider(new IssueRenderer()); - issuesOutline.setModel(mdl); - busyLabel.setBusy(false); - } - }); - } - }, "Report Panel Issues Outline"); - if (NbPreferences.forModule(ReportPanel.class).getBoolean(SHOW_ISSUES, true)) { - thread.start(); - } - } - } - - private void fillReport(final Report report) { - Thread thread = new Thread(fillingThreads, new Runnable() { - @Override - public void run() { - final String str = report.getText(); - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - reportEditor.setText(str); - } - }); - } - }, "Report Panel Issues Report"); - if (NbPreferences.forModule(ReportPanel.class).getBoolean(SHOW_REPORT, true)) { - thread.start(); - } - } - - private void fillParameters(final Container[] containers) { - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - boolean autoscalePref = NbPreferences.forModule(ReportPanel.class).getBoolean(PREF_AUTOSCALE, containers[0].getUnloader().isAutoScale()); - boolean selfLoopPref = NbPreferences.forModule(ReportPanel.class).getBoolean(PREF_SELF_LOOP, containers[0].getUnloader().allowSelfLoop()); - boolean createMissingNodesPref = NbPreferences.forModule(ReportPanel.class).getBoolean(PREF_CREATE_MISSING_NODES, containers[0].getUnloader().allowAutoNode()); - EdgeMergeStrategy strategyPref = containers[0].getUnloader().getEdgesMergeStrategy(); - try { - strategyPref = EdgeMergeStrategy.valueOf(NbPreferences.forModule(ReportPanel.class).get(PREF_EDGE_MERGE_STRATEGY, strategyPref.name())); - } catch (Exception e) { - //NOOP - } - - autoscaleCheckbox.setSelected(autoscalePref); - selfLoopCheckBox.setSelected(selfLoopPref); - createMissingNodesCheckbox.setSelected(createMissingNodesPref); - edgesMergeStrategyCombo.setSelectedItem(new EdgesMergeStrategyWrapper(strategyPref)); - } - }); - } - - private void fillStats(final Container[] containers) { - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - //Source - String source; - if (containers.length == 1) { - source = containers[0].getSource(); - String[] label = source.split("\\."); - if (label.length > 2 && label[label.length - 2].matches("\\d+")) { //case of temp file - source = source.replaceFirst("." + label[label.length - 2], ""); - } - } else { - source = NbBundle.getMessage(ReportPanel.class, "ReportPanel.multiSourceLabel.text"); - } - sourceLabel.setText(source); - - //Node & Edge count - int nodeCount = 0, edgeCount = 0; - boolean dynamic = false, dynamicAtts = false, multiGraph = false; - for (Container container : containers) { - nodeCount += container.getUnloader().getNodeCount(); - edgeCount += container.getUnloader().getEdgeCount(); - dynamic |= container.isDynamicGraph(); - dynamicAtts |= container.hasDynamicAttributes(); - multiGraph |= container.isMultiGraph(); - } - graphCountLabel.setText("" + containers.length); - nodeCountLabel.setText("" + nodeCount); - edgeCountLabel.setText("" + edgeCount); - - //Dynamic graph - String yes = NbBundle.getMessage(getClass(), "ReportPanel.yes"); - String no = NbBundle.getMessage(getClass(), "ReportPanel.no"); - dynamicLabel.setText(dynamic ? yes : no); - dynamicAttsLabel.setText(dynamicAtts ? yes : no); - multigraphLabel.setText(multiGraph ? yes : no); - - //Multi sources - if (containers.length == 1) { - graphCountLabel.setVisible(false); - labelGraphCount.setVisible(false); - } - } - }); - } - private static final Object PROCESSOR_KEY = new Object(); - - private void initProcessors() { - int i = 0; - for (Processor processor : Lookup.getDefault().lookupAll(Processor.class)) { - JRadioButton radio = new JRadioButton(processor.getDisplayName()); - radio.putClientProperty(PROCESSOR_KEY, processor); - processorGroup.add(radio); - } - } - - private void initProcessorsUI() { - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - - List validButtons = new ArrayList<>(); - for (Enumeration enumeration = processorGroup.getElements(); enumeration.hasMoreElements();) { - AbstractButton radioButton = enumeration.nextElement(); - Processor p = (Processor) radioButton.getClientProperty(PROCESSOR_KEY); - //Enabled - ProcessorUI pui = getProcessorUI(p); - if (pui != null) { - boolean isValid = pui.isValid(containers); - if (isValid) { - validButtons.add(radioButton); - } - } - } - - int i = 0; - for (AbstractButton radio : validButtons) { - radio.setSelected(i == 0); - GridBagConstraints constraints = new GridBagConstraints(0, i++, 1, 1, 0, (i == validButtons.size() ? 1.0 : 0.0), GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0); - processorPanel.add(radio, constraints); - } - } - }); - } - - public void destroy() { - fillingThreads.interrupt(); - } - - public Processor getProcessor() { - for (Enumeration enumeration = processorGroup.getElements(); enumeration.hasMoreElements();) { - AbstractButton radioButton = enumeration.nextElement(); - if (radioButton.isSelected()) { - return (Processor) radioButton.getClientProperty(PROCESSOR_KEY); - } - } - return null; - } - - private ProcessorUI getProcessorUI(Processor processor) { - for (ProcessorUI pui : Lookup.getDefault().lookupAll(ProcessorUI.class)) { - if (pui.isUIFoProcessor(processor)) { - return pui; - } - } - return null; - } - - /** - * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - private void initComponents() { - java.awt.GridBagConstraints gridBagConstraints; - - processorStrategyRadio = new javax.swing.ButtonGroup(); - labelSrc = new javax.swing.JLabel(); - sourceLabel = new javax.swing.JLabel(); - tabbedPane = new javax.swing.JTabbedPane(); - tab1ScrollPane = new javax.swing.JScrollPane(); - issuesOutline = new org.netbeans.swing.outline.Outline(); - tab2ScrollPane = new javax.swing.JScrollPane(); - reportEditor = new javax.swing.JEditorPane(); - labelGraphType = new javax.swing.JLabel(); - processorPanel = new javax.swing.JPanel(); - statsPanel = new javax.swing.JPanel(); - labelNodeCount = new javax.swing.JLabel(); - labelEdgeCount = new javax.swing.JLabel(); - nodeCountLabel = new javax.swing.JLabel(); - edgeCountLabel = new javax.swing.JLabel(); - dynamicLabel = new javax.swing.JLabel(); - labelDynamic = new javax.swing.JLabel(); - labelMultiGraph = new javax.swing.JLabel(); - multigraphLabel = new javax.swing.JLabel(); - labelDynamicAtts = new javax.swing.JLabel(); - dynamicAttsLabel = new javax.swing.JLabel(); - labelGraphCount = new javax.swing.JLabel(); - graphCountLabel = new javax.swing.JLabel(); - moreOptionsPanel = new javax.swing.JPanel(); - moreOptionsLeftPanel = 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(); - graphTypeCombo = new javax.swing.JComboBox(); - moreOptionsLink = new org.jdesktop.swingx.JXHyperlink(); - - labelSrc.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.labelSrc.text")); // NOI18N - - sourceLabel.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.sourceLabel.text")); // NOI18N - - tab1ScrollPane.setViewportView(issuesOutline); - - tabbedPane.addTab(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.tab1ScrollPane.TabConstraints.tabTitle"), tab1ScrollPane); // NOI18N - - reportEditor.setEditable(false); - reportEditor.setFocusable(false); - tab2ScrollPane.setViewportView(reportEditor); - - tabbedPane.addTab(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.tab2ScrollPane.TabConstraints.tabTitle"), tab2ScrollPane); // NOI18N - - labelGraphType.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.labelGraphType.text")); // NOI18N - - processorPanel.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 - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 2, 6, 0); - 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 - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 2, 10, 0); - 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 - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 1.0; - gridBagConstraints.insets = new java.awt.Insets(0, 10, 6, 0); - 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 - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 1.0; - gridBagConstraints.insets = new java.awt.Insets(0, 10, 10, 0); - statsPanel.add(edgeCountLabel, gridBagConstraints); - - dynamicLabel.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.dynamicLabel.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 1.0; - gridBagConstraints.insets = new java.awt.Insets(0, 10, 6, 0); - statsPanel.add(dynamicLabel, gridBagConstraints); - - labelDynamic.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.labelDynamic.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 2, 6, 0); - statsPanel.add(labelDynamic, gridBagConstraints); - - labelMultiGraph.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.labelMultiGraph.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 5; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 2, 6, 0); - statsPanel.add(labelMultiGraph, gridBagConstraints); - - multigraphLabel.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.multigraphLabel.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 5; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 1.0; - gridBagConstraints.insets = new java.awt.Insets(0, 10, 6, 0); - statsPanel.add(multigraphLabel, gridBagConstraints); - - labelDynamicAtts.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.labelDynamicAtts.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 4; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 2, 6, 0); - statsPanel.add(labelDynamicAtts, gridBagConstraints); - - dynamicAttsLabel.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.dynamicAttsLabel.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 4; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 1.0; - gridBagConstraints.insets = new java.awt.Insets(0, 10, 6, 0); - statsPanel.add(dynamicAttsLabel, gridBagConstraints); - - labelGraphCount.setFont(labelGraphCount.getFont().deriveFont(labelGraphCount.getFont().getStyle() | java.awt.Font.BOLD)); - labelGraphCount.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.labelGraphCount.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(6, 2, 6, 0); - statsPanel.add(labelGraphCount, gridBagConstraints); - - graphCountLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N - graphCountLabel.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.graphCountLabel.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 0; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 1.0; - gridBagConstraints.insets = new java.awt.Insets(6, 10, 6, 0); - statsPanel.add(graphCountLabel, gridBagConstraints); - - moreOptionsPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); - moreOptionsPanel.setLayout(new java.awt.GridBagLayout()); - - moreOptionsLeftPanel.setLayout(new java.awt.GridBagLayout()); - - 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 - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.weightx = 1.0; - gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 0); - moreOptionsLeftPanel.add(autoscaleCheckbox, gridBagConstraints); - - 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 - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.weightx = 1.0; - gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0); - moreOptionsLeftPanel.add(createMissingNodesCheckbox, gridBagConstraints); - - 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); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.weightx = 1.0; - gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0); - moreOptionsLeftPanel.add(selfLoopCheckBox, gridBagConstraints); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.weightx = 1.0; - moreOptionsPanel.add(moreOptionsLeftPanel, gridBagConstraints); - - labelParallelEdgesMergeStrategy.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.labelParallelEdgesMergeStrategy.text")); // NOI18N - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 0; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; - gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0); - moreOptionsPanel.add(labelParallelEdgesMergeStrategy, gridBagConstraints); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 0; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; - gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0); - moreOptionsPanel.add(edgesMergeStrategyCombo, gridBagConstraints); - - moreOptionsLink.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.moreOptionsLink.text")); // NOI18N - moreOptionsLink.setClickedColor(new java.awt.Color(0, 51, 255)); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); - this.setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 625, Short.MAX_VALUE) - .addComponent(moreOptionsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(layout.createSequentialGroup() - .addComponent(labelSrc) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(sourceLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addGroup(layout.createSequentialGroup() - .addComponent(statsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGap(18, 18, 18) - .addComponent(processorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(layout.createSequentialGroup() - .addComponent(labelGraphType) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(graphTypeCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(moreOptionsLink, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(labelSrc) - .addComponent(sourceLabel)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .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(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) - .addComponent(moreOptionsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(processorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(statsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - ); - }// //GEN-END:initComponents - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JCheckBox autoscaleCheckbox; - private javax.swing.JCheckBox createMissingNodesCheckbox; - private javax.swing.JLabel dynamicAttsLabel; - private javax.swing.JLabel dynamicLabel; - private javax.swing.JLabel edgeCountLabel; - private javax.swing.JComboBox edgesMergeStrategyCombo; - private javax.swing.JLabel graphCountLabel; - private javax.swing.JComboBox graphTypeCombo; - private org.netbeans.swing.outline.Outline issuesOutline; - private javax.swing.JLabel labelDynamic; - private javax.swing.JLabel labelDynamicAtts; - private javax.swing.JLabel labelEdgeCount; - private javax.swing.JLabel labelGraphCount; - private javax.swing.JLabel labelGraphType; - private javax.swing.JLabel labelMultiGraph; - private javax.swing.JLabel labelNodeCount; - private javax.swing.JLabel labelParallelEdgesMergeStrategy; - private javax.swing.JLabel labelSrc; - private javax.swing.JPanel moreOptionsLeftPanel; - private org.jdesktop.swingx.JXHyperlink moreOptionsLink; - private javax.swing.JPanel moreOptionsPanel; - private javax.swing.JLabel multigraphLabel; - 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; - // End of variables declaration//GEN-END:variables - - private class IssueTreeModel implements TreeModel { - - private final List issues; - - public IssueTreeModel(List issues) { - this.issues = issues; - } - - @Override - public Object getRoot() { - return "root"; - } - - @Override - public Object getChild(Object parent, int index) { - return issues.get(index); - } - - @Override - public int getChildCount(Object parent) { - return issues.size(); - } - - @Override - public boolean isLeaf(Object node) { - return node instanceof Issue; - } - - @Override - public void valueForPathChanged(TreePath path, Object newValue) { - } - - @Override - public int getIndexOfChild(Object parent, Object child) { - return issues.indexOf(child); - } - - @Override - public void addTreeModelListener(TreeModelListener l) { - } - - @Override - public void removeTreeModelListener(TreeModelListener l) { - } - } - - private class IssueRowModel implements RowModel { - - @Override - public int getColumnCount() { - return 1; - } - - @Override - public Object getValueFor(Object node, int column) { - if (node instanceof Issue) { - Issue issue = (Issue) node; - return issue.getLevel().toString(); - } - return ""; - } - - @Override - public Class getColumnClass(int column) { - return String.class; - } - - @Override - public boolean isCellEditable(Object node, int column) { - return false; - } - - @Override - public void setValueFor(Object node, int column, Object value) { - } - - @Override - public String getColumnName(int column) { - return NbBundle.getMessage(ReportPanel.class, "ReportPanel.issueTable.issues"); - } - } - - private class IssueRenderer implements RenderDataProvider { - - @Override - public String getDisplayName(Object o) { - Issue issue = (Issue) o; - return issue.getMessage(); - } - - @Override - public boolean isHtmlDisplayName(Object o) { - return false; - } - - @Override - public Color getBackground(Object o) { - return null; - } - - @Override - public Color getForeground(Object o) { - return null; - } - - @Override - public String getTooltipText(Object o) { - return ""; - } - - @Override - public Icon getIcon(Object o) { - Issue issue = (Issue) o; - switch (issue.getLevel()) { - case INFO: - return infoIcon; - case WARNING: - return warningIcon; - case SEVERE: - return severeIcon; - case CRITICAL: - return criticalIcon; - } - return null; - } - } -} +/* + 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.desktop.importer; + +import java.awt.Color; +import java.awt.GridBagConstraints; +import java.awt.Insets; +import java.awt.Toolkit; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.StringSelection; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.Iterator; +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.JMenuItem; +import javax.swing.JPopupMenu; +import javax.swing.JRadioButton; +import javax.swing.JRootPane; +import javax.swing.SwingConstants; +import javax.swing.SwingUtilities; +import javax.swing.event.TreeModelListener; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreePath; +import org.gephi.io.importer.api.Container; +import org.gephi.io.importer.api.EdgeDirectionDefault; +import org.gephi.io.importer.api.EdgeMergeStrategy; +import org.gephi.io.importer.api.Issue; +import org.gephi.io.importer.api.Report; +import org.gephi.io.processor.spi.Processor; +import org.gephi.io.processor.spi.ProcessorUI; +import org.gephi.ui.components.BusyUtils; +import org.netbeans.swing.outline.DefaultOutlineModel; +import org.netbeans.swing.outline.OutlineModel; +import org.netbeans.swing.outline.RenderDataProvider; +import org.netbeans.swing.outline.RowModel; +import org.openide.util.Exceptions; +import org.openide.util.Lookup; +import org.openide.util.NbBundle; +import org.openide.util.NbPreferences; + +/** + * + * @author Mathieu Bastian + */ +public class ReportPanel extends javax.swing.JPanel { + + //Preferences + private final static String SHOW_ISSUES = "ReportPanel_Show_Issues"; + private final static String SHOW_REPORT = "ReportPanel_Show_Report"; + private final static int ISSUES_LIMIT = 5000; + private final ThreadGroup fillingThreads; + //Icons + private ImageIcon infoIcon; + private ImageIcon warningIcon; + private ImageIcon severeIcon; + private ImageIcon criticalIcon; + //Container + private Container[] containers; + //UI + private ButtonGroup processorGroup = new ButtonGroup(); + //Preferences: + private static final String PREF_MORE_OPTIONS_PANEL_VISIBLE = "ReportPanel_moreOptionsPanelVisible"; + private static final String PREF_EDGE_MERGE_STRATEGY = "ReportPanel_edgeMergeStrategy"; + private static final String PREF_AUTOSCALE = "ReportPanel_autoscale"; + private static final String PREF_CREATE_MISSING_NODES = "ReportPanel_createMissingNodes"; + private static final String PREF_SELF_LOOP = "ReportPanel_selfLoops"; + + public ReportPanel() { + try { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + initComponents(); + initIcons(); + initProcessors(); + initMoreOptionsPanel(); + initMergeStrategyCombo(); + } + }); + } catch (InterruptedException ex) { + Exceptions.printStackTrace(ex); + } catch (InvocationTargetException ex) { + Exceptions.printStackTrace(ex); + } + + fillingThreads = new ThreadGroup("Report Panel Issues"); + + autoscaleCheckbox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + boolean s = autoscaleCheckbox.isSelected(); + NbPreferences.forModule(ReportPanel.class).putBoolean(PREF_AUTOSCALE, s); + for (Container container : containers) { + container.getLoader().setAutoScale(s); + } + } + }); + + createMissingNodesCheckbox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + boolean s = createMissingNodesCheckbox.isSelected(); + NbPreferences.forModule(ReportPanel.class).putBoolean(PREF_CREATE_MISSING_NODES, s); + for (Container container : containers) { + container.getLoader().setAllowAutoNode(s); + } + } + }); + + moreOptionsLink.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + moreOptionsPanel.setVisible(!moreOptionsPanel.isVisible()); + NbPreferences.forModule(ReportPanel.class).putBoolean(PREF_MORE_OPTIONS_PANEL_VISIBLE, moreOptionsPanel.isVisible()); + JRootPane rootPane = SwingUtilities.getRootPane(ReportPanel.this); + ((JDialog) rootPane.getParent()).pack(); + } + }); + + edgesMergeStrategyCombo.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + EdgeMergeStrategy strategy = ((EdgesMergeStrategyWrapper) edgesMergeStrategyCombo.getSelectedItem()).getInstance(); + NbPreferences.forModule(ReportPanel.class).put(PREF_EDGE_MERGE_STRATEGY, strategy.name()); + for (Container container : containers) { + container.getLoader().setEdgesMergeStrategy(strategy); + } + } + }); + + selfLoopCheckBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + boolean s = selfLoopCheckBox.isSelected(); + NbPreferences.forModule(ReportPanel.class).putBoolean(PREF_SELF_LOOP, s); + for (Container container : containers) { + container.getLoader().setAllowSelfLoop(s); + } + } + }); + + reportEditor.addMouseListener(new MouseAdapter() { + + @Override + public void mouseClicked(MouseEvent e) { + if (SwingUtilities.isRightMouseButton(e)) { + JPopupMenu contextMenu = new JPopupMenu(); + JMenuItem menuItem = new JMenuItem(); + menuItem.setText(NbBundle.getMessage(ReportPanel.class, "ReportPanel.reportCopy.text")); + menuItem.setToolTipText(NbBundle.getMessage(ReportPanel.class, "ReportPanel.reportCopy.description")); + menuItem.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard(); + clpbrd.setContents(new StringSelection(reportEditor.getText()), null); + } + }); + contextMenu.add(menuItem); + contextMenu.show(reportEditor, e.getX(), e.getY()); + } + } + }); + } + + public void initIcons() { + infoIcon = new javax.swing.ImageIcon(getClass().getResource("/org/gephi/desktop/importer/resources/info.png")); + warningIcon = new javax.swing.ImageIcon(getClass().getResource("/org/gephi/desktop/importer/resources/warning.gif")); + severeIcon = new javax.swing.ImageIcon(getClass().getResource("/org/gephi/desktop/importer/resources/severe.png")); + criticalIcon = new javax.swing.ImageIcon(getClass().getResource("/org/gephi/desktop/importer/resources/critical.png")); + } + + public void setData(Report report, Container[] containers) { + this.containers = containers; + initGraphTypeCombo(containers); + + initProcessorsUI(); + + fillIssues(report); + fillReport(report); + + fillStats(containers); + fillParameters(containers); + } + + private void removeTabbedPane() { + tabbedPane.setVisible(false); + } + + private void initMergeStrategyCombo() { + DefaultComboBoxModel mergeStrategryModel = new DefaultComboBoxModel(new EdgesMergeStrategyWrapper[]{ + new EdgesMergeStrategyWrapper(EdgeMergeStrategy.SUM), + new EdgesMergeStrategyWrapper(EdgeMergeStrategy.AVG), + new EdgesMergeStrategyWrapper(EdgeMergeStrategy.MIN), + new EdgesMergeStrategyWrapper(EdgeMergeStrategy.MAX), + new EdgesMergeStrategyWrapper(EdgeMergeStrategy.FIRST), + new EdgesMergeStrategyWrapper(EdgeMergeStrategy.LAST), + new EdgesMergeStrategyWrapper(EdgeMergeStrategy.NO_MERGE) + }); + edgesMergeStrategyCombo.setModel(mergeStrategryModel); + } + + private void initMoreOptionsPanel() { + boolean moreOptionsPanelVisible = NbPreferences.forModule(ReportPanel.class).getBoolean(PREF_MORE_OPTIONS_PANEL_VISIBLE, false); + if (!moreOptionsPanelVisible) { + moreOptionsPanel.setVisible(false); + } + } + + private void initGraphTypeCombo(final Container[] containers) { + final String directedStr = NbBundle.getMessage(ReportPanel.class, "ReportPanel.graphType.directed"); + final String undirectedStr = NbBundle.getMessage(ReportPanel.class, "ReportPanel.graphType.undirected"); + final String mixedStr = NbBundle.getMessage(ReportPanel.class, "ReportPanel.graphType.mixed"); + + EdgeDirectionDefault edd = null; + for (Container container : containers) { + EdgeDirectionDefault d = container.getUnloader().getEdgeDefault(); + if (edd == null) { + edd = d; + } else if (d.equals(EdgeDirectionDefault.UNDIRECTED) && !edd.equals(EdgeDirectionDefault.UNDIRECTED)) { + edd = EdgeDirectionDefault.MIXED; + } else if (d.equals(EdgeDirectionDefault.DIRECTED) && !edd.equals(EdgeDirectionDefault.DIRECTED)) { + edd = EdgeDirectionDefault.MIXED; + } + } + final EdgeDirectionDefault dir = edd; + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + + DefaultComboBoxModel comboModel = new DefaultComboBoxModel(); + + switch (dir) { + case DIRECTED: + comboModel.addElement(directedStr); + comboModel.addElement(undirectedStr); + comboModel.addElement(mixedStr); + comboModel.setSelectedItem(directedStr); + break; + case UNDIRECTED: + comboModel.addElement(undirectedStr); + comboModel.addElement(mixedStr); + comboModel.setSelectedItem(undirectedStr); + break; + case MIXED: + comboModel.addElement(directedStr); + comboModel.addElement(undirectedStr); + comboModel.addElement(mixedStr); + comboModel.setSelectedItem(mixedStr); + break; + } + + graphTypeCombo.setModel(comboModel); + } + }); + graphTypeCombo.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + Object g = e.getItem(); + if (g.equals(directedStr)) { + for (Container container : containers) { + container.getLoader().setEdgeDefault(EdgeDirectionDefault.DIRECTED); + } + } else if (g.equals(undirectedStr)) { + for (Container container : containers) { + container.getLoader().setEdgeDefault(EdgeDirectionDefault.UNDIRECTED); + } + } else if (g.equals(mixedStr)) { + for (Container container : containers) { + container.getLoader().setEdgeDefault(EdgeDirectionDefault.MIXED); + } + } + } + } + }); + } + + private void fillIssues(Report report) { + final List issues = new ArrayList<>(); + Iterator itr = report.getIssues(ISSUES_LIMIT); + while (itr.hasNext()) { + issues.add(itr.next()); + } + if (issues.isEmpty()) { + JLabel label = new JLabel(NbBundle.getMessage(getClass(), "ReportPanel.noIssues")); + label.setHorizontalAlignment(SwingConstants.CENTER); + tab1ScrollPane.setViewportView(label); + } else { + //Busy label + final BusyUtils.BusyLabel busyLabel = BusyUtils.createCenteredBusyLabel(tab1ScrollPane, "Retrieving issues...", issuesOutline); + + //Thread + Thread thread = new Thread(fillingThreads, new Runnable() { + @Override + public void run() { + busyLabel.setBusy(true); + final TreeModel treeMdl = new IssueTreeModel(issues); + final OutlineModel mdl = DefaultOutlineModel.createOutlineModel(treeMdl, new IssueRowModel(), true); + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + issuesOutline.setRootVisible(false); + issuesOutline.setRenderDataProvider(new IssueRenderer()); + issuesOutline.setModel(mdl); + busyLabel.setBusy(false); + } + }); + } + }, "Report Panel Issues Outline"); + if (NbPreferences.forModule(ReportPanel.class).getBoolean(SHOW_ISSUES, true)) { + thread.start(); + } + } + } + + private void fillReport(final Report report) { + Thread thread = new Thread(fillingThreads, new Runnable() { + @Override + public void run() { + final String str = report.getText(); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + reportEditor.setText(str); + } + }); + } + }, "Report Panel Issues Report"); + if (NbPreferences.forModule(ReportPanel.class).getBoolean(SHOW_REPORT, true)) { + thread.start(); + } + } + + private void fillParameters(final Container[] containers) { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + boolean autoscalePref = NbPreferences.forModule(ReportPanel.class).getBoolean(PREF_AUTOSCALE, containers[0].getUnloader().isAutoScale()); + boolean selfLoopPref = NbPreferences.forModule(ReportPanel.class).getBoolean(PREF_SELF_LOOP, containers[0].getUnloader().allowSelfLoop()); + boolean createMissingNodesPref = NbPreferences.forModule(ReportPanel.class).getBoolean(PREF_CREATE_MISSING_NODES, containers[0].getUnloader().allowAutoNode()); + EdgeMergeStrategy strategyPref = containers[0].getUnloader().getEdgesMergeStrategy(); + try { + strategyPref = EdgeMergeStrategy.valueOf(NbPreferences.forModule(ReportPanel.class).get(PREF_EDGE_MERGE_STRATEGY, strategyPref.name())); + } catch (Exception e) { + //NOOP + } + + autoscaleCheckbox.setSelected(autoscalePref); + selfLoopCheckBox.setSelected(selfLoopPref); + createMissingNodesCheckbox.setSelected(createMissingNodesPref); + edgesMergeStrategyCombo.setSelectedItem(new EdgesMergeStrategyWrapper(strategyPref)); + } + }); + } + + private void fillStats(final Container[] containers) { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + //Source + String source; + if (containers.length == 1) { + source = containers[0].getSource(); + String[] label = source.split("\\."); + if (label.length > 2 && label[label.length - 2].matches("\\d+")) { //case of temp file + source = source.replaceFirst("." + label[label.length - 2], ""); + } + } else { + source = NbBundle.getMessage(ReportPanel.class, "ReportPanel.multiSourceLabel.text"); + } + sourceLabel.setText(source); + + //Node & Edge count + int nodeCount = 0, edgeCount = 0; + boolean dynamic = false, dynamicAtts = false, multiGraph = false; + for (Container container : containers) { + nodeCount += container.getUnloader().getNodeCount(); + edgeCount += container.getUnloader().getEdgeCount(); + dynamic |= container.isDynamicGraph(); + dynamicAtts |= container.hasDynamicAttributes(); + multiGraph |= container.isMultiGraph(); + } + graphCountLabel.setText("" + containers.length); + nodeCountLabel.setText("" + nodeCount); + edgeCountLabel.setText("" + edgeCount); + + //Dynamic graph + String yes = NbBundle.getMessage(getClass(), "ReportPanel.yes"); + String no = NbBundle.getMessage(getClass(), "ReportPanel.no"); + dynamicLabel.setText(dynamic ? yes : no); + dynamicAttsLabel.setText(dynamicAtts ? yes : no); + multigraphLabel.setText(multiGraph ? yes : no); + + //Multi sources + if (containers.length == 1) { + graphCountLabel.setVisible(false); + labelGraphCount.setVisible(false); + } + } + }); + } + private static final Object PROCESSOR_KEY = new Object(); + + private void initProcessors() { + int i = 0; + for (Processor processor : Lookup.getDefault().lookupAll(Processor.class)) { + JRadioButton radio = new JRadioButton(processor.getDisplayName()); + radio.setToolTipText(processor.getDisplayName()); + radio.putClientProperty(PROCESSOR_KEY, processor); + processorGroup.add(radio); + } + } + + private void initProcessorsUI() { + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + List validButtons = new ArrayList<>(); + for (Enumeration enumeration = processorGroup.getElements(); enumeration.hasMoreElements();) { + AbstractButton radioButton = enumeration.nextElement(); + Processor p = (Processor) radioButton.getClientProperty(PROCESSOR_KEY); + //Enabled + ProcessorUI pui = getProcessorUI(p); + if (pui != null) { + boolean isValid = pui.isValid(containers); + if (isValid) { + validButtons.add(radioButton); + } + } + } + + int i = 0; + for (AbstractButton radio : validButtons) { + radio.setSelected(i == 0); + GridBagConstraints constraints = new GridBagConstraints( + 0, i++,//gridx, gridy + 1, 1, //gridwidth, gridheight + 1, (i == validButtons.size() ? 1.0 : 0.0),//weightx, weighty + GridBagConstraints.NORTHWEST,//anchor + GridBagConstraints.HORIZONTAL,//fill + new Insets(0, 0, 0, 0),//insets + 0, 0//ipadx, ipady + ); + processorPanel.add(radio, constraints); + } + } + }); + } + + public void destroy() { + fillingThreads.interrupt(); + } + + public Processor getProcessor() { + for (Enumeration enumeration = processorGroup.getElements(); enumeration.hasMoreElements();) { + AbstractButton radioButton = enumeration.nextElement(); + if (radioButton.isSelected()) { + return (Processor) radioButton.getClientProperty(PROCESSOR_KEY); + } + } + return null; + } + + private ProcessorUI getProcessorUI(Processor processor) { + for (ProcessorUI pui : Lookup.getDefault().lookupAll(ProcessorUI.class)) { + if (pui.isUIFoProcessor(processor)) { + return pui; + } + } + return null; + } + + /** + * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + java.awt.GridBagConstraints gridBagConstraints; + + processorStrategyRadio = new javax.swing.ButtonGroup(); + labelSrc = new javax.swing.JLabel(); + sourceLabel = new javax.swing.JLabel(); + tabbedPane = new javax.swing.JTabbedPane(); + tab1ScrollPane = new javax.swing.JScrollPane(); + issuesOutline = new org.netbeans.swing.outline.Outline(); + tab2ScrollPane = new javax.swing.JScrollPane(); + reportEditor = new javax.swing.JEditorPane(); + labelGraphType = new javax.swing.JLabel(); + processorPanel = new javax.swing.JPanel(); + statsPanel = new javax.swing.JPanel(); + labelNodeCount = new javax.swing.JLabel(); + labelEdgeCount = new javax.swing.JLabel(); + nodeCountLabel = new javax.swing.JLabel(); + edgeCountLabel = new javax.swing.JLabel(); + dynamicLabel = new javax.swing.JLabel(); + labelDynamic = new javax.swing.JLabel(); + labelMultiGraph = new javax.swing.JLabel(); + multigraphLabel = new javax.swing.JLabel(); + labelDynamicAtts = new javax.swing.JLabel(); + dynamicAttsLabel = new javax.swing.JLabel(); + labelGraphCount = new javax.swing.JLabel(); + graphCountLabel = new javax.swing.JLabel(); + moreOptionsPanel = new javax.swing.JPanel(); + moreOptionsLeftPanel = 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(); + graphTypeCombo = new javax.swing.JComboBox(); + moreOptionsLink = new org.jdesktop.swingx.JXHyperlink(); + + labelSrc.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.labelSrc.text")); // NOI18N + + sourceLabel.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.sourceLabel.text")); // NOI18N + + tab1ScrollPane.setViewportView(issuesOutline); + + tabbedPane.addTab(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.tab1ScrollPane.TabConstraints.tabTitle"), tab1ScrollPane); // NOI18N + + reportEditor.setEditable(false); + reportEditor.setFocusable(false); + tab2ScrollPane.setViewportView(reportEditor); + + tabbedPane.addTab(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.tab2ScrollPane.TabConstraints.tabTitle"), tab2ScrollPane); // NOI18N + + labelGraphType.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.labelGraphType.text")); // NOI18N + + processorPanel.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 + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(0, 2, 6, 0); + 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 + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(0, 2, 10, 0); + 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 + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.insets = new java.awt.Insets(0, 10, 6, 0); + 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 + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.insets = new java.awt.Insets(0, 10, 10, 0); + statsPanel.add(edgeCountLabel, gridBagConstraints); + + dynamicLabel.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.dynamicLabel.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 3; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.insets = new java.awt.Insets(0, 10, 6, 0); + statsPanel.add(dynamicLabel, gridBagConstraints); + + labelDynamic.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.labelDynamic.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 3; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(0, 2, 6, 0); + statsPanel.add(labelDynamic, gridBagConstraints); + + labelMultiGraph.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.labelMultiGraph.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 5; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(0, 2, 6, 0); + statsPanel.add(labelMultiGraph, gridBagConstraints); + + multigraphLabel.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.multigraphLabel.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 5; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.insets = new java.awt.Insets(0, 10, 6, 0); + statsPanel.add(multigraphLabel, gridBagConstraints); + + labelDynamicAtts.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.labelDynamicAtts.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 4; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(0, 2, 6, 0); + statsPanel.add(labelDynamicAtts, gridBagConstraints); + + dynamicAttsLabel.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.dynamicAttsLabel.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 4; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.insets = new java.awt.Insets(0, 10, 6, 0); + statsPanel.add(dynamicAttsLabel, gridBagConstraints); + + labelGraphCount.setFont(labelGraphCount.getFont().deriveFont(labelGraphCount.getFont().getStyle() | java.awt.Font.BOLD)); + labelGraphCount.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.labelGraphCount.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.insets = new java.awt.Insets(6, 2, 6, 0); + statsPanel.add(labelGraphCount, gridBagConstraints); + + graphCountLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N + graphCountLabel.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.graphCountLabel.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 0; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.insets = new java.awt.Insets(6, 10, 6, 0); + statsPanel.add(graphCountLabel, gridBagConstraints); + + moreOptionsPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + moreOptionsPanel.setLayout(new java.awt.GridBagLayout()); + + moreOptionsLeftPanel.setLayout(new java.awt.GridBagLayout()); + + 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 + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 0); + moreOptionsLeftPanel.add(autoscaleCheckbox, gridBagConstraints); + + 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 + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0); + moreOptionsLeftPanel.add(createMissingNodesCheckbox, gridBagConstraints); + + 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); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0); + moreOptionsLeftPanel.add(selfLoopCheckBox, gridBagConstraints); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; + gridBagConstraints.weightx = 1.0; + moreOptionsPanel.add(moreOptionsLeftPanel, gridBagConstraints); + + labelParallelEdgesMergeStrategy.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.labelParallelEdgesMergeStrategy.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 0; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; + gridBagConstraints.insets = new java.awt.Insets(6, 0, 0, 0); + moreOptionsPanel.add(labelParallelEdgesMergeStrategy, gridBagConstraints); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 2; + gridBagConstraints.gridy = 0; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; + gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0); + moreOptionsPanel.add(edgesMergeStrategyCombo, gridBagConstraints); + + moreOptionsLink.setText(org.openide.util.NbBundle.getMessage(ReportPanel.class, "ReportPanel.moreOptionsLink.text")); // NOI18N + moreOptionsLink.setClickedColor(new java.awt.Color(0, 51, 255)); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 625, Short.MAX_VALUE) + .addComponent(moreOptionsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addComponent(labelSrc) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(sourceLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addComponent(statsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 329, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(processorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addComponent(labelGraphType) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(graphTypeCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(moreOptionsLink, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(labelSrc) + .addComponent(sourceLabel)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .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(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) + .addComponent(moreOptionsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(processorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(statsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + ); + }// //GEN-END:initComponents + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JCheckBox autoscaleCheckbox; + private javax.swing.JCheckBox createMissingNodesCheckbox; + private javax.swing.JLabel dynamicAttsLabel; + private javax.swing.JLabel dynamicLabel; + private javax.swing.JLabel edgeCountLabel; + private javax.swing.JComboBox edgesMergeStrategyCombo; + private javax.swing.JLabel graphCountLabel; + private javax.swing.JComboBox graphTypeCombo; + private org.netbeans.swing.outline.Outline issuesOutline; + private javax.swing.JLabel labelDynamic; + private javax.swing.JLabel labelDynamicAtts; + private javax.swing.JLabel labelEdgeCount; + private javax.swing.JLabel labelGraphCount; + private javax.swing.JLabel labelGraphType; + private javax.swing.JLabel labelMultiGraph; + private javax.swing.JLabel labelNodeCount; + private javax.swing.JLabel labelParallelEdgesMergeStrategy; + private javax.swing.JLabel labelSrc; + private javax.swing.JPanel moreOptionsLeftPanel; + private org.jdesktop.swingx.JXHyperlink moreOptionsLink; + private javax.swing.JPanel moreOptionsPanel; + private javax.swing.JLabel multigraphLabel; + 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; + // End of variables declaration//GEN-END:variables + + private class IssueTreeModel implements TreeModel { + + private final List issues; + + public IssueTreeModel(List issues) { + this.issues = issues; + } + + @Override + public Object getRoot() { + return "root"; + } + + @Override + public Object getChild(Object parent, int index) { + return issues.get(index); + } + + @Override + public int getChildCount(Object parent) { + return issues.size(); + } + + @Override + public boolean isLeaf(Object node) { + return node instanceof Issue; + } + + @Override + public void valueForPathChanged(TreePath path, Object newValue) { + } + + @Override + public int getIndexOfChild(Object parent, Object child) { + return issues.indexOf(child); + } + + @Override + public void addTreeModelListener(TreeModelListener l) { + } + + @Override + public void removeTreeModelListener(TreeModelListener l) { + } + } + + private class IssueRowModel implements RowModel { + + @Override + public int getColumnCount() { + return 1; + } + + @Override + public Object getValueFor(Object node, int column) { + if (node instanceof Issue) { + Issue issue = (Issue) node; + return issue.getLevel().toString(); + } + return ""; + } + + @Override + public Class getColumnClass(int column) { + return String.class; + } + + @Override + public boolean isCellEditable(Object node, int column) { + return false; + } + + @Override + public void setValueFor(Object node, int column, Object value) { + } + + @Override + public String getColumnName(int column) { + return NbBundle.getMessage(ReportPanel.class, "ReportPanel.issueTable.issues"); + } + } + + private class IssueRenderer implements RenderDataProvider { + + @Override + public String getDisplayName(Object o) { + Issue issue = (Issue) o; + return issue.getMessage(); + } + + @Override + public boolean isHtmlDisplayName(Object o) { + return false; + } + + @Override + public Color getBackground(Object o) { + return null; + } + + @Override + public Color getForeground(Object o) { + return null; + } + + @Override + public String getTooltipText(Object o) { + return ""; + } + + @Override + public Icon getIcon(Object o) { + Issue issue = (Issue) o; + switch (issue.getLevel()) { + case INFO: + return infoIcon; + case WARNING: + return warningIcon; + case SEVERE: + return severeIcon; + case CRITICAL: + return criticalIcon; + } + return null; + } + } +} diff --git a/modules/PreviewPlugin/src/main/resources/org/gephi/preview/plugin/renderers/Bundle.properties b/modules/PreviewPlugin/src/main/resources/org/gephi/preview/plugin/renderers/Bundle.properties index ae538ef6b196fc7df9dd69643f89d8564695951d..53fc4174d7ed46204bf508f237b38fb27cc1f3bf 100644 --- a/modules/PreviewPlugin/src/main/resources/org/gephi/preview/plugin/renderers/Bundle.properties +++ b/modules/PreviewPlugin/src/main/resources/org/gephi/preview/plugin/renderers/Bundle.properties @@ -1,77 +1,77 @@ -NodeRenderer.name = Default nodes -NodeRenderer.property.borderWidth.displayName = Border Width -NodeRenderer.property.borderWidth.description = -NodeRenderer.property.borderColor.displayName = Border Color -NodeRenderer.property.borderColor.description = -NodeRenderer.property.opacity.displayName = opacity -NodeRenderer.property.opacity.description = -NodeRenderer.property.perNodeOpacity.displayName = Per-Node Opacity -NodeRenderer.property.perNodeOpacity.description = Use opacity defined at node level. If true, renderer's opacity property will be ignored. - -EdgeRenderer.name = Default edges -EdgeRenderer.property.display.displayName = Show Edges -EdgeRenderer.property.display.description = -EdgeRenderer.property.thickness.displayName = Thickness -EdgeRenderer.property.thickness.description = -EdgeRenderer.property.rescaleWeight.displayName = Rescale weight -EdgeRenderer.property.rescaleWeight.description = Rescale edge weights to a normalized range -EdgeRenderer.property.rescaleWeight.min.displayName = Min. rescaled weight -EdgeRenderer.property.rescaleWeight.min.description = Mininum allowed weight after rescaling -EdgeRenderer.property.rescaleWeight.max.displayName = Max. rescaled weight -EdgeRenderer.property.rescaleWeight.max.description = Maximum allowed weight after rescaling -EdgeRenderer.property.curvedEdges.displayName = Curved -EdgeRenderer.property.curvedEdges.description = -EdgeRenderer.property.color.displayName = Color -EdgeRenderer.property.color.description = -EdgeRenderer.property.opacity.displayName = Opacity -EdgeRenderer.property.opacity.description = -EdgeRenderer.property.radius.displayName = Radius -EdgeRenderer.property.radius.description = - -NodeLabelRenderer.name = Default node labels -NodeLabelRenderer.property.display.displayName = Show Labels -NodeLabelRenderer.property.display.description = -NodeLabelRenderer.property.font.displayName = Font -NodeLabelRenderer.property.font.description = -NodeLabelRenderer.property.proportionalSize.displayName = Proportional size -NodeLabelRenderer.property.proportionalSize.description = -NodeLabelRenderer.property.color.displayName = Color -NodeLabelRenderer.property.color.description = -NodeLabelRenderer.property.shorten.displayName = Shorten label -NodeLabelRenderer.property.shorten.description = -NodeLabelRenderer.property.maxchar.displayName = Max characters -NodeLabelRenderer.property.maxchar.description = -NodeLabelRenderer.property.outlineSize.displayName = Outline size -NodeLabelRenderer.property.outlineSize.description = -NodeLabelRenderer.property.outlineColor.displayName = Outline color -NodeLabelRenderer.property.outlineColor.description = -NodeLabelRenderer.property.outlineOpacity.displayName = Outline opacity -NodeLabelRenderer.property.outlineOpacity.description = -NodeLabelRenderer.property.box.displayName = Box -NodeLabelRenderer.property.box.description = -NodeLabelRenderer.property.box.color.displayName = Box color -NodeLabelRenderer.property.box.color.description = -NodeLabelRenderer.property.box.opacity.displayName = Box opacity -NodeLabelRenderer.property.box.opacity.description = - -EdgeLabelRenderer.name = Default edge labels -EdgeLabelRenderer.property.display.displayName = Show Labels -EdgeLabelRenderer.property.display.description = -EdgeLabelRenderer.property.font.displayName = Font -EdgeLabelRenderer.property.font.description = -EdgeLabelRenderer.property.color.displayName = Color -EdgeLabelRenderer.property.color.description = -EdgeLabelRenderer.property.shorten.displayName = Shorten label -EdgeLabelRenderer.property.shorten.description = -EdgeLabelRenderer.property.maxchar.displayName = Max characters -EdgeLabelRenderer.property.maxchar.description = -EdgeLabelRenderer.property.outlineSize.displayName = Outline size -EdgeLabelRenderer.property.outlineSize.description = -EdgeLabelRenderer.property.outlineColor.displayName = Outline color -EdgeLabelRenderer.property.outlineColor.description = -EdgeLabelRenderer.property.outlineOpacity.displayName = Outline opacity -EdgeLabelRenderer.property.outlineOpacity.description = - -ArrowRenderer.name = Default edge arrows -ArrowRenderer.property.size.displayName = Size +NodeRenderer.name = Default nodes +NodeRenderer.property.borderWidth.displayName = Border Width +NodeRenderer.property.borderWidth.description = +NodeRenderer.property.borderColor.displayName = Border Color +NodeRenderer.property.borderColor.description = +NodeRenderer.property.opacity.displayName = Opacity +NodeRenderer.property.opacity.description = +NodeRenderer.property.perNodeOpacity.displayName = Per-Node Opacity +NodeRenderer.property.perNodeOpacity.description = Use opacity defined at node level. If true, renderer's opacity property will be ignored. + +EdgeRenderer.name = Default edges +EdgeRenderer.property.display.displayName = Show Edges +EdgeRenderer.property.display.description = +EdgeRenderer.property.thickness.displayName = Thickness +EdgeRenderer.property.thickness.description = +EdgeRenderer.property.rescaleWeight.displayName = Rescale weight +EdgeRenderer.property.rescaleWeight.description = Rescale edge weights to a normalized range +EdgeRenderer.property.rescaleWeight.min.displayName = Min. rescaled weight +EdgeRenderer.property.rescaleWeight.min.description = Mininum allowed weight after rescaling +EdgeRenderer.property.rescaleWeight.max.displayName = Max. rescaled weight +EdgeRenderer.property.rescaleWeight.max.description = Maximum allowed weight after rescaling +EdgeRenderer.property.curvedEdges.displayName = Curved +EdgeRenderer.property.curvedEdges.description = +EdgeRenderer.property.color.displayName = Color +EdgeRenderer.property.color.description = +EdgeRenderer.property.opacity.displayName = Opacity +EdgeRenderer.property.opacity.description = +EdgeRenderer.property.radius.displayName = Radius +EdgeRenderer.property.radius.description = + +NodeLabelRenderer.name = Default node labels +NodeLabelRenderer.property.display.displayName = Show Labels +NodeLabelRenderer.property.display.description = +NodeLabelRenderer.property.font.displayName = Font +NodeLabelRenderer.property.font.description = +NodeLabelRenderer.property.proportionalSize.displayName = Proportional size +NodeLabelRenderer.property.proportionalSize.description = +NodeLabelRenderer.property.color.displayName = Color +NodeLabelRenderer.property.color.description = +NodeLabelRenderer.property.shorten.displayName = Shorten label +NodeLabelRenderer.property.shorten.description = +NodeLabelRenderer.property.maxchar.displayName = Max characters +NodeLabelRenderer.property.maxchar.description = +NodeLabelRenderer.property.outlineSize.displayName = Outline size +NodeLabelRenderer.property.outlineSize.description = +NodeLabelRenderer.property.outlineColor.displayName = Outline color +NodeLabelRenderer.property.outlineColor.description = +NodeLabelRenderer.property.outlineOpacity.displayName = Outline opacity +NodeLabelRenderer.property.outlineOpacity.description = +NodeLabelRenderer.property.box.displayName = Box +NodeLabelRenderer.property.box.description = +NodeLabelRenderer.property.box.color.displayName = Box color +NodeLabelRenderer.property.box.color.description = +NodeLabelRenderer.property.box.opacity.displayName = Box opacity +NodeLabelRenderer.property.box.opacity.description = + +EdgeLabelRenderer.name = Default edge labels +EdgeLabelRenderer.property.display.displayName = Show Labels +EdgeLabelRenderer.property.display.description = +EdgeLabelRenderer.property.font.displayName = Font +EdgeLabelRenderer.property.font.description = +EdgeLabelRenderer.property.color.displayName = Color +EdgeLabelRenderer.property.color.description = +EdgeLabelRenderer.property.shorten.displayName = Shorten label +EdgeLabelRenderer.property.shorten.description = +EdgeLabelRenderer.property.maxchar.displayName = Max characters +EdgeLabelRenderer.property.maxchar.description = +EdgeLabelRenderer.property.outlineSize.displayName = Outline size +EdgeLabelRenderer.property.outlineSize.description = +EdgeLabelRenderer.property.outlineColor.displayName = Outline color +EdgeLabelRenderer.property.outlineColor.description = +EdgeLabelRenderer.property.outlineOpacity.displayName = Outline opacity +EdgeLabelRenderer.property.outlineOpacity.description = + +ArrowRenderer.name = Default edge arrows +ArrowRenderer.property.size.displayName = Size ArrowRenderer.property.size.description = \ No newline at end of file diff --git a/src/main/javadoc/overview.html b/src/main/javadoc/overview.html index 705e0a40e6639a1943ae1a225a4865efc60092b7..c29594e0d305bfbc97e7f321d47684a05b807eb7 100644 --- a/src/main/javadoc/overview.html +++ b/src/main/javadoc/overview.html @@ -16,6 +16,11 @@

API Changes

    +
  • + (September 08 2017) A new optional FileAware interface FileImporter in ImporterAPI. + This allows file importers to receive the file to import in a setFile method instead of the setReader method being called. + If your FileImporter implements this interface, setFile will be called, and setReader will not be called. +
  • (February 07 2016) A new setColors method has been added to Partition in AppearanceAPI.