proj_name
stringclasses
131 values
relative_path
stringlengths
30
228
class_name
stringlengths
1
68
func_name
stringlengths
1
48
masked_class
stringlengths
78
9.82k
func_body
stringlengths
46
9.61k
len_input
int64
29
2.01k
len_output
int64
14
1.94k
total
int64
55
2.05k
relevant_context
stringlengths
0
38.4k
gephi_gephi
gephi/modules/StatisticsPlugin/src/main/java/org/gephi/statistics/plugin/dynamic/DynamicNbNodes.java
DynamicNbNodes
getReport
class DynamicNbNodes implements DynamicStatistics { public static final String NB_NODES = "dynamic nodecount"; //Data private GraphModel graphModel; private double window; private double tick; private Interval bounds; //Average private Map<Double, Integer> counts; @Override public void execute(GraphModel graphModel) { this.graphModel = graphModel; this.counts = new HashMap<>(); } @Override public String getReport() {<FILL_FUNCTION_BODY>} @Override public void loop(GraphView window, Interval interval) { Graph graph = graphModel.getGraph(window); int count = graph.getNodeCount(); graphModel.getGraphVisible().setAttribute(NB_NODES, count, interval.getLow()); graphModel.getGraphVisible().setAttribute(NB_NODES, count, interval.getHigh()); counts.put(interval.getLow(), count); counts.put(interval.getHigh(), count); } @Override public void end() { } @Override public double getWindow() { return window; } @Override public void setWindow(double window) { this.window = window; } @Override public double getTick() { return tick; } @Override public void setTick(double tick) { this.tick = tick; } @Override public Interval getBounds() { return bounds; } @Override public void setBounds(Interval bounds) { this.bounds = bounds; } }
//Time series XYSeries dSeries = ChartUtils.createXYSeries(counts, "Nb Nodes Time Series"); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(dSeries); JFreeChart chart = ChartFactory.createXYLineChart( "# Nodes Time Series", "Time", "# Nodes", dataset, PlotOrientation.VERTICAL, true, false, false); chart.removeLegend(); ChartUtils.decorateChart(chart); ChartUtils.scaleChart(chart, dSeries, false); String imageFile = ChartUtils.renderChart(chart, "nb-nodes-ts.png"); NumberFormat f = new DecimalFormat("#0.000"); String report = "<HTML> <BODY> <h1>Dynamic Number of Nodes Report </h1> " + "<hr>" + "<br> Bounds: from " + f.format(bounds.getLow()) + " to " + f.format(bounds.getHigh()) + "<br> Window: " + window + "<br> Tick: " + tick + "<br><br><h2> Number of nodes over time: </h2>" + "<br /><br />" + imageFile; /*for (Interval<Integer> count : counts) { report += count.toString(dynamicModel.getTimeFormat().equals(DynamicModel.TimeFormat.DOUBLE)) + "<br />"; }*/ report += "<br /><br /></BODY></HTML>"; return report;
437
416
853
<no_super_class>
gephi_gephi
gephi/modules/StatisticsPluginUI/src/main/java/org/gephi/ui/statistics/plugin/ClusteringCoefficientPanel.java
ClusteringCoefficientPanel
initComponents
class ClusteringCoefficientPanel extends javax.swing.JPanel { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.ButtonGroup algorithmButtonGroup; private javax.swing.ButtonGroup directedButtonGroup; // End of variables declaration//GEN-END:variables // public boolean isBruteForce() { // return bruteRadioButton.isSelected(); // } private javax.swing.JRadioButton directedRadioButton; // public void setBruteForce(boolean brute) { // algorithmButtonGroup.setSelected(brute ? bruteRadioButton.getModel() : triangleRadioButton.getModel(), true); // } private org.jdesktop.swingx.JXHeader header; private javax.swing.JRadioButton undirectedRadioButton; public ClusteringCoefficientPanel() { initComponents(); //Disable directed if the graph is undirecteds GraphController graphController = Lookup.getDefault().lookup(GraphController.class); if (graphController.getGraphModel().isUndirected()) { directedRadioButton.setEnabled(false); } } public boolean isDirected() { return directedRadioButton.isSelected(); } public void setDirected(boolean directed) { directedButtonGroup .setSelected(directed ? directedRadioButton.getModel() : undirectedRadioButton.getModel(), true); if (!directed) { directedRadioButton.setEnabled(false); } } /** * 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") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() {<FILL_FUNCTION_BODY>}// </editor-fold>//GEN-END:initComponents }
directedButtonGroup = new javax.swing.ButtonGroup(); algorithmButtonGroup = new javax.swing.ButtonGroup(); directedRadioButton = new javax.swing.JRadioButton(); undirectedRadioButton = new javax.swing.JRadioButton(); header = new org.jdesktop.swingx.JXHeader(); directedButtonGroup.add(directedRadioButton); directedRadioButton.setText(org.openide.util.NbBundle.getMessage(ClusteringCoefficientPanel.class, "ClusteringCoefficientPanel.directedRadioButton.text")); // NOI18N directedButtonGroup.add(undirectedRadioButton); undirectedRadioButton.setText(org.openide.util.NbBundle.getMessage(ClusteringCoefficientPanel.class, "ClusteringCoefficientPanel.undirectedRadioButton.text")); // NOI18N header.setDescription(org.openide.util.NbBundle .getMessage(ClusteringCoefficientPanel.class, "ClusteringCoefficientPanel.header.description")); // NOI18N header.setTitle(org.openide.util.NbBundle .getMessage(ClusteringCoefficientPanel.class, "ClusteringCoefficientPanel.header.title")); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, 638, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(undirectedRadioButton) .addComponent(directedRadioButton)) .addContainerGap(532, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(header, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(directedRadioButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(undirectedRadioButton) .addContainerGap(95, Short.MAX_VALUE)) );
533
703
1,236
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/StatisticsPluginUI/src/main/java/org/gephi/ui/statistics/plugin/ClusteringCoefficientUI.java
ClusteringCoefficientUI
unsetup
class ClusteringCoefficientUI implements StatisticsUI { private ClusteringCoefficientPanel panel; private ClusteringCoefficient clusteringCoefficient; @Override public JPanel getSettingsPanel() { panel = new ClusteringCoefficientPanel(); return panel; } @Override public void setup(Statistics statistics) { this.clusteringCoefficient = (ClusteringCoefficient) statistics; if (panel != null) { panel.setDirected(clusteringCoefficient.isDirected()); } } @Override public void unsetup() {<FILL_FUNCTION_BODY>} @Override public Class<? extends Statistics> getStatisticsClass() { return ClusteringCoefficient.class; } @Override public String getValue() { DecimalFormat df = new DecimalFormat("###.###"); return "" + df.format(clusteringCoefficient.getAverageClusteringCoefficient()); } @Override public String getDisplayName() { return NbBundle.getMessage(getClass(), "ClusteringCoefficientUI.name"); } @Override public String getCategory() { return StatisticsUI.CATEGORY_NODE_OVERVIEW; } @Override public int getPosition() { return 300; } @Override public String getShortDescription() { return NbBundle.getMessage(getClass(), "ClusteringCoefficientUI.shortDescription"); } }
if (panel != null) { clusteringCoefficient.setDirected(panel.isDirected()); } clusteringCoefficient = null; panel = null;
410
48
458
<no_super_class>
gephi_gephi
gephi/modules/StatisticsPluginUI/src/main/java/org/gephi/ui/statistics/plugin/ConnectedComponentPanel.java
ConnectedComponentPanel
initComponents
class ConnectedComponentPanel extends javax.swing.JPanel { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.ButtonGroup buttonGroup1; private javax.swing.JRadioButton directedRadioButton; private org.jdesktop.swingx.JXHeader header; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JRadioButton undirectedRadioButton; // End of variables declaration//GEN-END:variables /** * Creates new form ConnectedComponentPanel */ public ConnectedComponentPanel() { initComponents(); //Disable directed if the graph is undirecteds GraphController graphController = Lookup.getDefault().lookup(GraphController.class); if (graphController.getGraphModel().isUndirected()) { directedRadioButton.setEnabled(false); } } public boolean isDirected() { return directedRadioButton.isSelected(); } public void setDirected(boolean directed) { buttonGroup1.setSelected(directed ? directedRadioButton.getModel() : undirectedRadioButton.getModel(), true); if (!directed) { directedRadioButton.setEnabled(false); } } /** * 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") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() {<FILL_FUNCTION_BODY>}// </editor-fold>//GEN-END:initComponents }
buttonGroup1 = new javax.swing.ButtonGroup(); header = new org.jdesktop.swingx.JXHeader(); directedRadioButton = new javax.swing.JRadioButton(); undirectedRadioButton = new javax.swing.JRadioButton(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); header.setDescription(org.openide.util.NbBundle .getMessage(ConnectedComponentPanel.class, "ConnectedComponentPanel.header.description")); // NOI18N header.setTitle(org.openide.util.NbBundle .getMessage(ConnectedComponentPanel.class, "ConnectedComponentPanel.header.title")); // NOI18N buttonGroup1.add(directedRadioButton); directedRadioButton.setText(org.openide.util.NbBundle .getMessage(ConnectedComponentPanel.class, "ConnectedComponentPanel.directedRadioButton.text")); // NOI18N buttonGroup1.add(undirectedRadioButton); undirectedRadioButton.setText(org.openide.util.NbBundle .getMessage(ConnectedComponentPanel.class, "ConnectedComponentPanel.undirectedRadioButton.text")); // NOI18N jLabel1.setForeground(new java.awt.Color(102, 102, 102)); jLabel1.setText(org.openide.util.NbBundle .getMessage(ConnectedComponentPanel.class, "ConnectedComponentPanel.jLabel1.text")); // NOI18N jLabel2.setForeground(new java.awt.Color(102, 102, 102)); jLabel2.setText(org.openide.util.NbBundle .getMessage(ConnectedComponentPanel.class, "ConnectedComponentPanel.jLabel2.text")); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, 565, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(directedRadioButton) .addComponent(undirectedRadioButton)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 39, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(header, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(directedRadioButton) .addComponent(jLabel1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(undirectedRadioButton) .addComponent(jLabel2)) .addContainerGap(148, Short.MAX_VALUE)) );
470
1,063
1,533
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/StatisticsPluginUI/src/main/java/org/gephi/ui/statistics/plugin/DegreeDistributionPanel.java
DegreeDistributionPanel
initComponents
class DegreeDistributionPanel extends javax.swing.JPanel { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JRadioButton directedRadioButton; private javax.swing.JRadioButton undirectedRadioButton; private org.jdesktop.swingx.JXLabel descriptionLabel; private javax.swing.ButtonGroup directedButtonGroup; private org.jdesktop.swingx.JXHeader header; // End of variables declaration//GEN-END:variables public DegreeDistributionPanel() { initComponents(); //Disable directed if the graph is undirecteds GraphController graphController = Lookup.getDefault().lookup(GraphController.class); if (graphController.getGraphModel().isUndirected()) { directedRadioButton.setEnabled(false); } } public boolean isDirected() { return directedRadioButton.isSelected(); } public void setDirected(boolean directed) { directedButtonGroup .setSelected(directed ? directedRadioButton.getModel() : undirectedRadioButton.getModel(), true); if (!directed) { directedRadioButton.setEnabled(false); } } /** * 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") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() {<FILL_FUNCTION_BODY>}// </editor-fold>//GEN-END:initComponents }
directedButtonGroup = new javax.swing.ButtonGroup(); directedRadioButton = new javax.swing.JRadioButton(); undirectedRadioButton = new javax.swing.JRadioButton(); descriptionLabel = new org.jdesktop.swingx.JXLabel(); header = new org.jdesktop.swingx.JXHeader(); directedButtonGroup.add(directedRadioButton); directedRadioButton.setText(org.openide.util.NbBundle .getMessage(DegreeDistributionPanel.class, "DegreeDistributionPanel.directedRadioButton.text")); // NOI18N directedButtonGroup.add(undirectedRadioButton); undirectedRadioButton.setText(org.openide.util.NbBundle .getMessage(DegreeDistributionPanel.class, "DegreeDistributionPanel.undirectedRadioButton.text")); // NOI18N descriptionLabel.setLineWrap(true); descriptionLabel.setText(org.openide.util.NbBundle .getMessage(DegreeDistributionPanel.class, "DegreeDistributionPanel.descriptionLabel.text")); // NOI18N descriptionLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP); header.setDescription(org.openide.util.NbBundle .getMessage(DegreeDistributionPanel.class, "DegreeDistributionPanel.header.description")); // NOI18N header.setTitle(org.openide.util.NbBundle .getMessage(DegreeDistributionPanel.class, "DegreeDistributionPanel.header.title")); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, 439, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(undirectedRadioButton) .addComponent(directedRadioButton) .addComponent(descriptionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE)) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(header, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(directedRadioButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(undirectedRadioButton) .addGap(96, 96, 96) .addComponent(descriptionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) );
447
860
1,307
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/StatisticsPluginUI/src/main/java/org/gephi/ui/statistics/plugin/DiameterUI.java
DiameterUI
unsetup
class DiameterUI implements StatisticsUI { private GraphDistancePanel panel; private GraphDistance graphDistance; @Override public JPanel getSettingsPanel() { panel = new GraphDistancePanel(); return panel; } @Override public void setup(Statistics statistics) { this.graphDistance = (GraphDistance) statistics; if (panel != null) { panel.setDirected(graphDistance.isDirected()); panel.doNormalize(graphDistance.isNormalized()); } } @Override public void unsetup() {<FILL_FUNCTION_BODY>} @Override public Class<? extends Statistics> getStatisticsClass() { return GraphDistance.class; } @Override public String getValue() { DecimalFormat df = new DecimalFormat("###.###"); return "" + df.format(graphDistance.getDiameter()); } @Override public String getDisplayName() { return NbBundle.getMessage(getClass(), "DiameterUI.name"); } @Override public String getCategory() { return StatisticsUI.CATEGORY_NETWORK_OVERVIEW; } @Override public int getPosition() { return 100; } @Override public String getShortDescription() { return NbBundle.getMessage(getClass(), "DiameterUI.shortDescription"); } }
if (panel != null) { graphDistance.setDirected(panel.isDirected()); graphDistance.setNormalized(panel.normalize()); } panel = null; graphDistance = null;
375
58
433
<no_super_class>
gephi_gephi
gephi/modules/StatisticsPluginUI/src/main/java/org/gephi/ui/statistics/plugin/EigenvectorCentralityPanel.java
EigenvectorCentralityPanel
initComponents
class EigenvectorCentralityPanel extends javax.swing.JPanel { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.ButtonGroup buttonGroup1; private javax.swing.JRadioButton directedRadioButton; private org.jdesktop.swingx.JXHeader header; private javax.swing.JTextField iterationTextField; private javax.swing.JLabel jLabel1; private javax.swing.JRadioButton undirectedRadioButton; // End of variables declaration//GEN-END:variables /** * Creates new form EigenvectorCentralityPanel */ public EigenvectorCentralityPanel() { initComponents(); //Disable directed if the graph is undirecteds GraphController graphController = Lookup.getDefault().lookup(GraphController.class); if (graphController.getGraphModel().isUndirected()) { directedRadioButton.setEnabled(false); } } public boolean isDirected() { return this.directedRadioButton.isSelected(); } public void setDirected(boolean pDirected) { this.directedRadioButton.setSelected(pDirected); this.undirectedRadioButton.setSelected(!pDirected); if (!pDirected) { directedRadioButton.setEnabled(false); } } public int getNumRuns() { try { int runs = Integer.parseInt(iterationTextField.getText()); return runs; } catch (Exception e) { Exceptions.printStackTrace(e); } return 0; } public void setNumRuns(int mRuns) { iterationTextField.setText(mRuns + ""); } /** * 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") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() {<FILL_FUNCTION_BODY>}// </editor-fold>//GEN-END:initComponents private void undirectedRadioButtonActionPerformed( java.awt.event.ActionEvent evt) {//GEN-FIRST:event_undirectedRadioButtonActionPerformed // TODO add your handling code here: }//GEN-LAST:event_undirectedRadioButtonActionPerformed }
buttonGroup1 = new javax.swing.ButtonGroup(); header = new org.jdesktop.swingx.JXHeader(); iterationTextField = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); directedRadioButton = new javax.swing.JRadioButton(); undirectedRadioButton = new javax.swing.JRadioButton(); header.setDescription(org.openide.util.NbBundle .getMessage(EigenvectorCentralityPanel.class, "EigenvectorCentralityPanel.header.description")); // NOI18N header.setTitle(org.openide.util.NbBundle .getMessage(EigenvectorCentralityPanel.class, "EigenvectorCentralityPanel.header.title")); // NOI18N iterationTextField.setMinimumSize(new java.awt.Dimension(30, 27)); jLabel1.setText(org.openide.util.NbBundle .getMessage(EigenvectorCentralityPanel.class, "EigenvectorCentralityPanel.labeliterations.text")); // NOI18N buttonGroup1.add(directedRadioButton); directedRadioButton.setText(org.openide.util.NbBundle .getMessage(EigenvectorCentralityPanel.class, "EigenvectorCentralityPanel.directedButton.text")); // NOI18N buttonGroup1.add(undirectedRadioButton); undirectedRadioButton.setText(org.openide.util.NbBundle.getMessage(EigenvectorCentralityPanel.class, "EigenvectorCentralityPanel.undirectedButton.text")); // NOI18N undirectedRadioButton.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { undirectedRadioButtonActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, 541, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(directedRadioButton) .addComponent(undirectedRadioButton) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1) .addGap(8, 8, 8) .addComponent(iterationTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 174, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(header, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(directedRadioButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(undirectedRadioButton) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(iterationTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1)) .addContainerGap(66, Short.MAX_VALUE)) );
666
1,065
1,731
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/StatisticsPluginUI/src/main/java/org/gephi/ui/statistics/plugin/EigenvectorCentralityUI.java
EigenvectorCentralityUI
setup
class EigenvectorCentralityUI implements StatisticsUI { private final StatSettings settings = new StatSettings(); private EigenvectorCentralityPanel panel; private EigenvectorCentrality eigen; @Override public JPanel getSettingsPanel() { panel = new EigenvectorCentralityPanel(); return panel; } @Override public void setup(Statistics statistics) {<FILL_FUNCTION_BODY>} @Override public void unsetup() { if (panel != null) { eigen.setNumRuns(panel.getNumRuns()); eigen.setDirected(panel.isDirected()); settings.save(eigen); } panel = null; eigen = null; } @Override public Class<? extends Statistics> getStatisticsClass() { return EigenvectorCentrality.class; } @Override public String getValue() { return null; } @Override public String getDisplayName() { return NbBundle.getMessage(getClass(), "EigenvectorCentralityUI.name"); } @Override public String getCategory() { return StatisticsUI.CATEGORY_NODE_OVERVIEW; } @Override public int getPosition() { return 1000; } @Override public String getShortDescription() { return NbBundle.getMessage(getClass(), "EigenvectorCentralityUI.shortDescription"); } private static class StatSettings { private int mNumRuns = 100; private void save(EigenvectorCentrality stat) { this.mNumRuns = stat.getNumRuns(); } private void load(EigenvectorCentrality stat) { stat.setNumRuns(mNumRuns); } } }
this.eigen = (EigenvectorCentrality) statistics; if (panel != null) { settings.load(eigen); panel.setNumRuns(eigen.getNumRuns()); panel.setDirected(eigen.isDirected()); }
488
74
562
<no_super_class>
gephi_gephi
gephi/modules/StatisticsPluginUI/src/main/java/org/gephi/ui/statistics/plugin/GraphDensityPanel.java
GraphDensityPanel
initComponents
class GraphDensityPanel extends javax.swing.JPanel { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JRadioButton directedRadioButton; private javax.swing.JRadioButton undirectedRadioButton; private javax.swing.ButtonGroup directedButtonGroup; private org.jdesktop.swingx.JXHeader header; // End of variables declaration//GEN-END:variables public GraphDensityPanel() { initComponents(); //Disable directed if the graph is undirecteds GraphController graphController = Lookup.getDefault().lookup(GraphController.class); if (graphController.getGraphModel().isUndirected()) { directedRadioButton.setEnabled(false); } } public boolean isDirected() { return directedRadioButton.isSelected(); } public void setDirected(boolean directed) { directedButtonGroup .setSelected(directed ? directedRadioButton.getModel() : undirectedRadioButton.getModel(), true); if (!directed) { directedRadioButton.setEnabled(false); } } /** * 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") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() {<FILL_FUNCTION_BODY>}// </editor-fold>//GEN-END:initComponents }
directedButtonGroup = new javax.swing.ButtonGroup(); directedRadioButton = new javax.swing.JRadioButton(); undirectedRadioButton = new javax.swing.JRadioButton(); header = new org.jdesktop.swingx.JXHeader(); directedButtonGroup.add(directedRadioButton); directedRadioButton.setText(org.openide.util.NbBundle .getMessage(GraphDensityPanel.class, "GraphDensityPanel.directedRadioButton.text")); // NOI18N directedButtonGroup.add(undirectedRadioButton); undirectedRadioButton.setText(org.openide.util.NbBundle .getMessage(GraphDensityPanel.class, "GraphDensityPanel.undirectedRadioButton.text")); // NOI18N header.setDescription(org.openide.util.NbBundle .getMessage(GraphDensityPanel.class, "GraphDensityPanel.header.description")); // NOI18N header.setTitle( org.openide.util.NbBundle.getMessage(GraphDensityPanel.class, "GraphDensityPanel.header.title")); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, 477, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(undirectedRadioButton) .addComponent(directedRadioButton)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(header, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(directedRadioButton) .addGap(7, 7, 7) .addComponent(undirectedRadioButton) .addContainerGap(84, Short.MAX_VALUE)) );
428
662
1,090
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/StatisticsPluginUI/src/main/java/org/gephi/ui/statistics/plugin/HitsUI.java
HitsUI
setup
class HitsUI implements StatisticsUI { private final StatSettings settings = new StatSettings(); private HitsPanel panel; private Hits hits; @Override public JPanel getSettingsPanel() { panel = new HitsPanel(); return panel; } @Override public void setup(Statistics statistics) {<FILL_FUNCTION_BODY>} @Override public void unsetup() { if (panel != null) { hits.setEpsilon(panel.getEpsilon()); hits.setUndirected(!panel.isDirected()); settings.save(hits); } panel = null; hits = null; } @Override public Class<? extends Statistics> getStatisticsClass() { return Hits.class; } @Override public String getValue() { return null; } @Override public String getDisplayName() { return NbBundle.getMessage(getClass(), "HitsUI.name"); } @Override public String getCategory() { return StatisticsUI.CATEGORY_NETWORK_OVERVIEW; } @Override public int getPosition() { return 500; } @Override public String getShortDescription() { return NbBundle.getMessage(getClass(), "HitsUI.shortDescription"); } private static class StatSettings { private double epsilon = 0.0001; private void save(Hits stat) { this.epsilon = stat.getEpsilon(); } private void load(Hits stat) { stat.setEpsilon(epsilon); } } }
this.hits = (Hits) statistics; if (panel != null) { settings.load(hits); panel.setEpsilon(hits.getEpsilon()); panel.setDirected(!hits.getUndirected()); }
446
70
516
<no_super_class>
gephi_gephi
gephi/modules/StatisticsPluginUI/src/main/java/org/gephi/ui/statistics/plugin/ModularityUI.java
ModularityUI
unsetup
class ModularityUI implements StatisticsUI { private final StatSettings settings = new StatSettings(); private ModularityPanel panel; private Modularity mod; @Override public JPanel getSettingsPanel() { panel = new ModularityPanel(); return panel; } @Override public void setup(Statistics statistics) { this.mod = (Modularity) statistics; if (panel != null) { settings.load(mod); panel.setRandomize(mod.getRandom()); panel.setUseWeight(mod.getUseWeight()); panel.setResolution(mod.getResolution()); panel.setInitialModularityClassIndex(mod.getInitialModularityClassIndex()); } } @Override public void unsetup() {<FILL_FUNCTION_BODY>} @Override public Class<? extends Statistics> getStatisticsClass() { return Modularity.class; } @Override public String getValue() { DecimalFormat df = new DecimalFormat("###.###"); return "" + df.format(mod.getModularity()); } @Override public String getDisplayName() { return NbBundle.getMessage(getClass(), "ModularityUI.name"); } @Override public String getCategory() { return StatisticsUI.CATEGORY_COMMUNITY_DETECTION; } @Override public int getPosition() { return 600; } @Override public String getShortDescription() { return NbBundle.getMessage(getClass(), "ModularityUI.shortDescription"); } private static class StatSettings { private boolean randomize = true; private boolean useWeight = true; private void save(Modularity stat) { this.randomize = stat.getRandom(); this.useWeight = stat.getUseWeight(); } private void load(Modularity stat) { stat.setRandom(randomize); stat.setUseWeight(useWeight); } } }
if (panel != null) { mod.setRandom(panel.isRandomize()); mod.setUseWeight(panel.useWeight()); mod.setResolution(panel.resolution()); mod.setInitialModularityClassIndex(panel.getInitialModularityClassIndex()); settings.save(mod); } mod = null; panel = null;
543
96
639
<no_super_class>
gephi_gephi
gephi/modules/StatisticsPluginUI/src/main/java/org/gephi/ui/statistics/plugin/PageRankUI.java
StatSettings
save
class StatSettings { private double epsilon = 0.001; private double probability = 0.85; private boolean useEdgeWeight = false; private void save(PageRank stat) {<FILL_FUNCTION_BODY>} private void load(PageRank stat) { stat.setEpsilon(epsilon); stat.setProbability(probability); stat.setUseEdgeWeight(useEdgeWeight); } }
this.epsilon = stat.getEpsilon(); this.probability = stat.getProbability(); this.useEdgeWeight = stat.isUseEdgeWeight();
118
43
161
<no_super_class>
gephi_gephi
gephi/modules/StatisticsPluginUI/src/main/java/org/gephi/ui/statistics/plugin/dynamic/DynamicClusteringCoefficientPanel.java
DynamicClusteringCoefficientPanel
setDirected
class DynamicClusteringCoefficientPanel extends javax.swing.JPanel { protected javax.swing.JRadioButton directedRadioButton; protected javax.swing.JRadioButton undirectedRadioButton; // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JCheckBox averageOnlyCheckbox; private javax.swing.ButtonGroup directedButtonGroup; private org.jdesktop.swingx.JXHeader header; /** * Creates new form DynamicClusteringCoefficientPanel */ public DynamicClusteringCoefficientPanel() { initComponents(); //Disable directed if the graph is undirecteds GraphController graphController = Lookup.getDefault().lookup(GraphController.class); if (graphController.getGraphModel().isUndirected()) { directedRadioButton.setEnabled(false); } } public boolean isDirected() { return directedRadioButton.isSelected(); } public void setDirected(boolean directed) {<FILL_FUNCTION_BODY>} public boolean isAverageOnly() { return averageOnlyCheckbox.isSelected(); } public void setAverageOnly(boolean averageOnly) { averageOnlyCheckbox.setSelected(averageOnly); } /** * 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") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { directedButtonGroup = new javax.swing.ButtonGroup(); header = new org.jdesktop.swingx.JXHeader(); directedRadioButton = new javax.swing.JRadioButton(); undirectedRadioButton = new javax.swing.JRadioButton(); averageOnlyCheckbox = new javax.swing.JCheckBox(); header.setDescription(org.openide.util.NbBundle.getMessage(DynamicClusteringCoefficientPanel.class, "DynamicClusteringCoefficientPanel.header.description")); // NOI18N header.setTitle(org.openide.util.NbBundle.getMessage(DynamicClusteringCoefficientPanel.class, "DynamicClusteringCoefficientPanel.header.title")); // NOI18N directedButtonGroup.add(directedRadioButton); directedRadioButton.setText(org.openide.util.NbBundle.getMessage(DynamicClusteringCoefficientPanel.class, "DynamicClusteringCoefficientPanel.directedRadioButton.text")); // NOI18N directedButtonGroup.add(undirectedRadioButton); undirectedRadioButton.setText(org.openide.util.NbBundle.getMessage(DynamicClusteringCoefficientPanel.class, "DynamicClusteringCoefficientPanel.undirectedRadioButton.text")); // NOI18N averageOnlyCheckbox.setText(org.openide.util.NbBundle.getMessage(DynamicClusteringCoefficientPanel.class, "DynamicClusteringCoefficientPanel.averageOnlyCheckbox.text")); // NOI18N 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(undirectedRadioButton) .addComponent(directedRadioButton) .addComponent(averageOnlyCheckbox)) .addContainerGap(294, Short.MAX_VALUE)) .addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, 496, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(header, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(directedRadioButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(undirectedRadioButton) .addGap(18, 18, 18) .addComponent(averageOnlyCheckbox) .addContainerGap(34, Short.MAX_VALUE)) ); }// </editor-fold>//GEN-END:initComponents // End of variables declaration//GEN-END:variables }
directedButtonGroup .setSelected(directed ? directedRadioButton.getModel() : undirectedRadioButton.getModel(), true); if (!directed) { directedRadioButton.setEnabled(false); }
1,293
61
1,354
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/StatisticsPluginUI/src/main/java/org/gephi/ui/statistics/plugin/dynamic/DynamicClusteringCoefficientUI.java
DynamicClusteringCoefficientUI
setup
class DynamicClusteringCoefficientUI implements StatisticsUI { private final StatSettings settings = new StatSettings(); private DynamicClusteringCoefficient clusetingCoefficient; private DynamicClusteringCoefficientPanel panel; @Override public JPanel getSettingsPanel() { panel = new DynamicClusteringCoefficientPanel(); return panel; } @Override public void setup(Statistics statistics) {<FILL_FUNCTION_BODY>} @Override public void unsetup() { if (panel != null) { clusetingCoefficient.setDirected(panel.isDirected()); clusetingCoefficient.setAverageOnly(panel.isAverageOnly()); settings.save(clusetingCoefficient); } clusetingCoefficient = null; } @Override public Class<? extends Statistics> getStatisticsClass() { return DynamicClusteringCoefficient.class; } @Override public String getValue() { return ""; } @Override public String getDisplayName() { return NbBundle.getMessage(getClass(), "DynamicClusteringCoefficientUI.name"); } @Override public String getCategory() { return StatisticsUI.CATEGORY_DYNAMIC; } @Override public int getPosition() { return 400; } @Override public String getShortDescription() { return NbBundle.getMessage(getClass(), "DynamicClusteringCoefficientUI.shortDescription"); } private static class StatSettings { private boolean averageOnly = false; private double window = 0.0; private double tick = 0.0; private void save(DynamicClusteringCoefficient stat) { this.averageOnly = stat.isAverageOnly(); this.window = stat.getWindow(); this.tick = stat.getTick(); } private void load(DynamicClusteringCoefficient stat) { stat.setAverageOnly(averageOnly); stat.setWindow(window); stat.setTick(tick); } } }
this.clusetingCoefficient = (DynamicClusteringCoefficient) statistics; if (panel != null) { settings.load(clusetingCoefficient); panel.setDirected(clusetingCoefficient.isDirected()); panel.setAverageOnly(clusetingCoefficient.isAverageOnly()); }
574
87
661
<no_super_class>
gephi_gephi
gephi/modules/StatisticsPluginUI/src/main/java/org/gephi/ui/statistics/plugin/dynamic/DynamicDegreePanel.java
DynamicDegreePanel
initComponents
class DynamicDegreePanel extends javax.swing.JPanel { protected javax.swing.JRadioButton directedRadioButton; protected javax.swing.JRadioButton undirectedRadioButton; // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JCheckBox averageOnlyCheckbox; private javax.swing.ButtonGroup directedButtonGroup; private org.jdesktop.swingx.JXHeader header; /** * Creates new form DynamicDegreePanel */ public DynamicDegreePanel() { initComponents(); //Disable directed if the graph is undirecteds GraphController graphController = Lookup.getDefault().lookup(GraphController.class); if (graphController.getGraphModel().isUndirected()) { directedRadioButton.setEnabled(false); } } public boolean isDirected() { return directedRadioButton.isSelected(); } public void setDirected(boolean directed) { directedButtonGroup .setSelected(directed ? directedRadioButton.getModel() : undirectedRadioButton.getModel(), true); if (!directed) { directedRadioButton.setEnabled(false); } } public boolean isAverageOnly() { return averageOnlyCheckbox.isSelected(); } public void setAverageOnly(boolean averageOnly) { averageOnlyCheckbox.setSelected(averageOnly); } /** * 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") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() {<FILL_FUNCTION_BODY>}// </editor-fold>//GEN-END:initComponents // End of variables declaration//GEN-END:variables }
directedButtonGroup = new javax.swing.ButtonGroup(); header = new org.jdesktop.swingx.JXHeader(); directedRadioButton = new javax.swing.JRadioButton(); undirectedRadioButton = new javax.swing.JRadioButton(); averageOnlyCheckbox = new javax.swing.JCheckBox(); header.setDescription(org.openide.util.NbBundle .getMessage(DynamicDegreePanel.class, "DynamicDegreePanel.header.description")); // NOI18N header.setTitle(org.openide.util.NbBundle .getMessage(DynamicDegreePanel.class, "DynamicDegreePanel.header.title")); // NOI18N directedButtonGroup.add(directedRadioButton); directedRadioButton.setText(org.openide.util.NbBundle .getMessage(DynamicDegreePanel.class, "DynamicDegreePanel.directedRadioButton.text")); // NOI18N directedButtonGroup.add(undirectedRadioButton); undirectedRadioButton.setText(org.openide.util.NbBundle .getMessage(DynamicDegreePanel.class, "DynamicDegreePanel.undirectedRadioButton.text")); // NOI18N averageOnlyCheckbox.setText(org.openide.util.NbBundle .getMessage(DynamicDegreePanel.class, "DynamicDegreePanel.averageOnlyCheckbox.text")); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, 503, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(undirectedRadioButton) .addComponent(directedRadioButton) .addComponent(averageOnlyCheckbox)) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(header, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(directedRadioButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(undirectedRadioButton) .addGap(18, 18, 18) .addComponent(averageOnlyCheckbox) .addContainerGap(34, Short.MAX_VALUE)) );
523
775
1,298
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/StatisticsPluginUI/src/main/java/org/gephi/ui/statistics/plugin/dynamic/DynamicDegreeUI.java
DynamicDegreeUI
unsetup
class DynamicDegreeUI implements StatisticsUI { private final StatSettings settings = new StatSettings(); private DynamicDegree degree; private DynamicDegreePanel panel; @Override public JPanel getSettingsPanel() { panel = new DynamicDegreePanel(); return panel; } @Override public void setup(Statistics statistics) { this.degree = (DynamicDegree) statistics; if (panel != null) { settings.load(degree); panel.setDirected(degree.isDirected()); panel.setAverageOnly(degree.isAverageOnly()); } } @Override public void unsetup() {<FILL_FUNCTION_BODY>} @Override public Class<? extends Statistics> getStatisticsClass() { return DynamicDegree.class; } @Override public String getValue() { return ""; } @Override public String getDisplayName() { return NbBundle.getMessage(getClass(), "DynamicDegreeUI.name"); } @Override public String getCategory() { return StatisticsUI.CATEGORY_DYNAMIC; } @Override public int getPosition() { return 300; } @Override public String getShortDescription() { return NbBundle.getMessage(getClass(), "DynamicDegreeUI.shortDescription"); } private static class StatSettings { private boolean averageOnly = false; private double window = 0.0; private double tick = 0.0; private void save(DynamicDegree stat) { this.averageOnly = stat.isAverageOnly(); this.window = stat.getWindow(); this.tick = stat.getTick(); } private void load(DynamicDegree stat) { stat.setAverageOnly(averageOnly); stat.setWindow(window); stat.setTick(tick); } } }
if (panel != null) { degree.setDirected(panel.isDirected()); degree.setAverageOnly(panel.isAverageOnly()); settings.save(degree); } degree = null; panel = null;
531
66
597
<no_super_class>
gephi_gephi
gephi/modules/StatisticsPluginUI/src/main/java/org/gephi/ui/statistics/plugin/dynamic/DynamicNbEdgesPanel.java
DynamicNbEdgesPanel
initComponents
class DynamicNbEdgesPanel extends javax.swing.JPanel { // Variables declaration - do not modify//GEN-BEGIN:variables private org.jdesktop.swingx.JXHeader header; /** * Creates new form DynamicNbEdgesPanel */ public DynamicNbEdgesPanel() { initComponents(); } /** * 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") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() {<FILL_FUNCTION_BODY>}// </editor-fold>//GEN-END:initComponents // End of variables declaration//GEN-END:variables }
header = new org.jdesktop.swingx.JXHeader(); header.setDescription(org.openide.util.NbBundle .getMessage(DynamicNbEdgesPanel.class, "DynamicNbEdgesPanel.header.description")); // NOI18N header.setTitle(org.openide.util.NbBundle .getMessage(DynamicNbEdgesPanel.class, "DynamicNbEdgesPanel.header.title")); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(header, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(50, Short.MAX_VALUE)) );
241
325
566
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/StatisticsPluginUI/src/main/java/org/gephi/ui/statistics/plugin/dynamic/DynamicNbEdgesUI.java
DynamicNbEdgesUI
unsetup
class DynamicNbEdgesUI implements StatisticsUI { private final StatSettings settings = new StatSettings(); private DynamicNbEdges nbEdges; private DynamicNbEdgesPanel panel; @Override public JPanel getSettingsPanel() { panel = new DynamicNbEdgesPanel(); return panel; } @Override public void setup(Statistics statistics) { this.nbEdges = (DynamicNbEdges) statistics; if (panel != null) { settings.load(nbEdges); } } @Override public void unsetup() {<FILL_FUNCTION_BODY>} @Override public Class<? extends Statistics> getStatisticsClass() { return DynamicNbEdges.class; } @Override public String getValue() { return ""; } @Override public String getDisplayName() { return NbBundle.getMessage(getClass(), "DynamicNbEdgesUI.name"); } @Override public String getCategory() { return StatisticsUI.CATEGORY_DYNAMIC; } @Override public int getPosition() { return 200; } @Override public String getShortDescription() { return NbBundle.getMessage(getClass(), "DynamicNbEdgesUI.shortDescription"); } private static class StatSettings { private double window = 0.0; private double tick = 0.0; private void save(DynamicNbEdges stat) { this.window = stat.getWindow(); this.tick = stat.getTick(); } private void load(DynamicNbEdges stat) { stat.setWindow(window); stat.setTick(tick); } } }
if (panel != null) { settings.save(nbEdges); } nbEdges = null;
481
35
516
<no_super_class>
gephi_gephi
gephi/modules/StatisticsPluginUI/src/main/java/org/gephi/ui/statistics/plugin/dynamic/DynamicNbNodesPanel.java
DynamicNbNodesPanel
initComponents
class DynamicNbNodesPanel extends javax.swing.JPanel { // Variables declaration - do not modify//GEN-BEGIN:variables private org.jdesktop.swingx.JXHeader header; /** * Creates new form DynamicNbNodesPanel */ public DynamicNbNodesPanel() { initComponents(); } /** * 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") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() {<FILL_FUNCTION_BODY>}// </editor-fold>//GEN-END:initComponents // End of variables declaration//GEN-END:variables }
header = new org.jdesktop.swingx.JXHeader(); header.setDescription(org.openide.util.NbBundle .getMessage(DynamicNbNodesPanel.class, "DynamicNbNodesPanel.header.description")); // NOI18N header.setTitle(org.openide.util.NbBundle .getMessage(DynamicNbNodesPanel.class, "DynamicNbNodesPanel.header.title")); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, 412, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(header, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(43, Short.MAX_VALUE)) );
238
321
559
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/StatisticsPluginUI/src/main/java/org/gephi/ui/statistics/plugin/dynamic/DynamicNbNodesUI.java
DynamicNbNodesUI
unsetup
class DynamicNbNodesUI implements StatisticsUI { private final StatSettings settings = new StatSettings(); private DynamicNbNodes nbNodes; private DynamicNbNodesPanel panel; @Override public JPanel getSettingsPanel() { panel = new DynamicNbNodesPanel(); return panel; } @Override public void setup(Statistics statistics) { this.nbNodes = (DynamicNbNodes) statistics; if (panel != null) { settings.load(nbNodes); } } @Override public void unsetup() {<FILL_FUNCTION_BODY>} @Override public Class<? extends Statistics> getStatisticsClass() { return DynamicNbNodes.class; } @Override public String getValue() { return ""; } @Override public String getDisplayName() { return NbBundle.getMessage(getClass(), "DynamicNbNodesUI.name"); } @Override public String getCategory() { return StatisticsUI.CATEGORY_DYNAMIC; } @Override public int getPosition() { return 100; } @Override public String getShortDescription() { return NbBundle.getMessage(getClass(), "DynamicNbNodesUI.shortDescription"); } private static class StatSettings { private double window = 0.0; private double tick = 0.0; private void save(DynamicNbNodes stat) { this.window = stat.getWindow(); this.tick = stat.getTick(); } private void load(DynamicNbNodes stat) { stat.setWindow(window); stat.setTick(tick); } } }
if (panel != null) { settings.save(nbNodes); } nbNodes = null;
468
33
501
<no_super_class>
gephi_gephi
gephi/modules/TimelineAPI/src/main/java/org/gephi/timeline/GraphObserverThread.java
GraphObserverThread
run
class GraphObserverThread extends Thread { private final TimelineControllerImpl timelineController; private final TimelineModelImpl timelineModel; private boolean stop; private Interval interval; public GraphObserverThread(TimelineControllerImpl controller, TimelineModelImpl model) { this.timelineModel = model; this.timelineController = controller; this.interval = model.getGraphModel().getTimeBounds(); } @Override public void run() {<FILL_FUNCTION_BODY>} public void stopThread() { stop = true; } }
while (!stop) { GraphModel graphModel = timelineModel.getGraphModel(); Interval bounds = graphModel.getTimeBounds(); if (!bounds.equals(interval)) { interval = bounds; timelineController.setMinMax(interval.getLow(), interval.getHigh()); } try { Thread.sleep(1000); } catch (InterruptedException ex) { } }
151
112
263
<methods>public void <init>() ,public void <init>(java.lang.Runnable) ,public void <init>(java.lang.String) ,public void <init>(java.lang.ThreadGroup, java.lang.Runnable) ,public void <init>(java.lang.ThreadGroup, java.lang.String) ,public void <init>(java.lang.Runnable, java.lang.String) ,public void <init>(java.lang.ThreadGroup, java.lang.Runnable, java.lang.String) ,public void <init>(java.lang.ThreadGroup, java.lang.Runnable, java.lang.String, long) ,public void <init>(java.lang.ThreadGroup, java.lang.Runnable, java.lang.String, long, boolean) ,public static int activeCount() ,public final void checkAccess() ,public int countStackFrames() ,public static native java.lang.Thread currentThread() ,public static void dumpStack() ,public static int enumerate(java.lang.Thread[]) ,public static Map<java.lang.Thread,java.lang.StackTraceElement[]> getAllStackTraces() ,public java.lang.ClassLoader getContextClassLoader() ,public static java.lang.Thread.UncaughtExceptionHandler getDefaultUncaughtExceptionHandler() ,public long getId() ,public final java.lang.String getName() ,public final int getPriority() ,public java.lang.StackTraceElement[] getStackTrace() ,public java.lang.Thread.State getState() ,public final java.lang.ThreadGroup getThreadGroup() ,public java.lang.Thread.UncaughtExceptionHandler getUncaughtExceptionHandler() ,public static native boolean holdsLock(java.lang.Object) ,public void interrupt() ,public static boolean interrupted() ,public final boolean isAlive() ,public final boolean isDaemon() ,public boolean isInterrupted() ,public final void join() throws java.lang.InterruptedException,public final synchronized void join(long) throws java.lang.InterruptedException,public final synchronized void join(long, int) throws java.lang.InterruptedException,public static void onSpinWait() ,public final void resume() ,public void run() ,public void setContextClassLoader(java.lang.ClassLoader) ,public final void setDaemon(boolean) ,public static void setDefaultUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler) ,public final synchronized void setName(java.lang.String) ,public final void setPriority(int) ,public void setUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler) ,public static native void sleep(long) throws java.lang.InterruptedException,public static void sleep(long, int) throws java.lang.InterruptedException,public synchronized void start() ,public final void stop() ,public final void suspend() ,public java.lang.String toString() ,public static native void yield() <variables>private static final java.lang.StackTraceElement[] EMPTY_STACK_TRACE,public static final int MAX_PRIORITY,public static final int MIN_PRIORITY,public static final int NORM_PRIORITY,private volatile sun.nio.ch.Interruptible blocker,private final java.lang.Object blockerLock,private java.lang.ClassLoader contextClassLoader,private boolean daemon,private static volatile java.lang.Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler,private volatile long eetop,private java.lang.ThreadGroup group,java.lang.ThreadLocal.ThreadLocalMap inheritableThreadLocals,private java.security.AccessControlContext inheritedAccessControlContext,private volatile boolean interrupted,private volatile java.lang.String name,volatile java.lang.Object parkBlocker,private int priority,private final long stackSize,private boolean stillborn,private java.lang.Runnable target,private static int threadInitNumber,int threadLocalRandomProbe,int threadLocalRandomSecondarySeed,long threadLocalRandomSeed,java.lang.ThreadLocal.ThreadLocalMap threadLocals,private static long threadSeqNumber,private volatile int threadStatus,private final long tid,private volatile java.lang.Thread.UncaughtExceptionHandler uncaughtExceptionHandler
gephi_gephi
gephi/modules/TimelineAPI/src/main/java/org/gephi/timeline/TimelineChartImpl.java
TimelineChartImpl
getY
class TimelineChartImpl implements TimelineChart { private final String column; private final Number[] x; private final Number[] y; private final Number minY; private final Number maxY; private final Number minX; private final Number maxX; public TimelineChartImpl(String column, Number[] x, Number[] y) { this.column = column; this.x = x; this.y = y; this.minY = calculateMin(y); this.maxY = calculateMax(y); this.minX = calculateMin(x); this.maxX = calculateMax(x); } public static TimelineChartImpl of(Graph graph, String column) { if (graph != null && column != null) { Object dynamicValue = graph.getAttribute(column); if (dynamicValue instanceof IntervalMap) { return TimelineChartImpl.of(column, (IntervalMap) dynamicValue); } else if (dynamicValue instanceof TimestampMap) { return TimelineChartImpl.of(column, (TimestampMap) dynamicValue); } } return null; } public static TimelineChartImpl of(String column, IntervalMap dynamicValue) { double[] lowsAndHighs = dynamicValue.getIntervals(); Object[] values = dynamicValue.toValuesArray(); final Number[] xs = new Number[lowsAndHighs.length]; final Number[] ys = new Number[lowsAndHighs.length]; for (int i = 0; i < lowsAndHighs.length; i += 2) { xs[i] = lowsAndHighs[i]; xs[i + 1] = lowsAndHighs[i + 1]; Number numValue = (Number) values[i]; if (numValue == null) { numValue = 0.0; } ys[i] = numValue; ys[i + 1] = numValue; } if (xs.length > 0) { return new TimelineChartImpl(column, xs, ys); } else { return null; } } public static TimelineChartImpl of(String column, TimestampMap dynamicValue) { double[] timestamps = dynamicValue.getTimestamps(); Object[] values = dynamicValue.toValuesArray(); final Number[] xs = new Number[timestamps.length]; final Number[] ys = new Number[timestamps.length]; for (int i = 0; i < timestamps.length; i++) { xs[i] = timestamps[i]; Number numValue = (Number) values[i]; if (numValue == null) { numValue = 0.0; } ys[i] = numValue; } if (xs.length > 0) { return new TimelineChartImpl(column, xs, ys); } else { return null; } } @Override public Number[] getX() { return x; } @Override public Number[] getY() { return y; } @Override public Number getY(Number posX) {<FILL_FUNCTION_BODY>} @Override public Number getMinY() { return minY; } @Override public Number getMaxY() { return maxY; } @Override public Number getMinX() { return minX; } @Override public Number getMaxX() { return maxX; } @Override public String getColumn() { return column; } private Number calculateMin(Number[] yValues) { double min = yValues[0].doubleValue(); for (Number d : yValues) { min = Math.min(min, d.doubleValue()); } Number t = yValues[0]; if (t instanceof Double) { return min; } else if (t instanceof Float) { return new Float(min); } else if (t instanceof Short) { return (short) min; } else if (t instanceof Long) { return (long) min; } else if (t instanceof BigInteger) { return new BigDecimal(min); } return min; } private Number calculateMax(Number[] yValues) { double max = yValues[0].doubleValue(); for (Number d : yValues) { max = Math.max(max, d.doubleValue()); } Number t = yValues[0]; if (t instanceof Double) { return max; } else if (t instanceof Float) { return new Float(max); } else if (t instanceof Short) { return (short) max; } else if (t instanceof Long) { return (long) max; } else if (t instanceof BigInteger) { return new BigDecimal(max); } return max; } }
double pos = posX.doubleValue(); Double value = null; if (pos <= maxX.doubleValue()) { for (int i = 0; i < x.length; i++) { if (pos < x[i].doubleValue()) { return value; } value = y[i].doubleValue(); } } return value;
1,296
98
1,394
<no_super_class>
gephi_gephi
gephi/modules/TimelineAPI/src/main/java/org/gephi/timeline/TimelineModelImpl.java
TimelineModelImpl
getIntervalEnd
class TimelineModelImpl implements TimelineModel { private final GraphModel graphModel; private final AtomicBoolean playing; private boolean enabled; private double customMin; private double customMax; //Animation private int playDelay; private double playStep; private PlayMode playMode; //Chart private TimelineChart chart; //MinMax private double previousMin; private double previousMax; // private Interval interval; public TimelineModelImpl(GraphModel dynamicModel) { this.graphModel = dynamicModel; this.customMin = dynamicModel.getTimeBounds().getLow(); this.customMax = dynamicModel.getTimeBounds().getHigh(); this.previousMin = customMin; this.previousMax = customMax; playDelay = 100; playStep = 0.01; playing = new AtomicBoolean(false); playMode = PlayMode.TWO_BOUNDS; interval = new Interval(customMin, customMax); } @Override public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } @Override public double getMin() { return graphModel.getTimeBounds().getLow(); } @Override public double getMax() { return graphModel.getTimeBounds().getHigh(); } public double getPreviousMin() { return previousMin; } public void setPreviousMin(double previousMin) { this.previousMin = previousMin; } public double getPreviousMax() { return previousMax; } public void setPreviousMax(double previousMax) { this.previousMax = previousMax; } @Override public double getCustomMin() { return customMin; } public void setCustomMin(double customMin) { this.customMin = customMin; } @Override public double getCustomMax() { return customMax; } public void setCustomMax(double customMax) { this.customMax = customMax; } @Override public boolean hasCustomBounds() { Interval tm = graphModel.getTimeBounds(); return customMax != tm.getHigh() || customMin != tm.getLow(); } @Override public double getIntervalStart() { double vi = interval.getLow(); if (Double.isInfinite(vi)) { return getCustomMin(); } return vi; } @Override public double getIntervalEnd() {<FILL_FUNCTION_BODY>} @Override public TimeFormat getTimeFormat() { return graphModel.getTimeFormat(); } public void setInterval(double start, double end) { this.interval = new Interval(start, end); } @Override public boolean hasValidBounds() { Interval i = graphModel.getTimeBounds(); return !Double.isInfinite(i.getLow()) && !Double.isInfinite(i.getHigh()); } public GraphModel getGraphModel() { return graphModel; } @Override public boolean isPlaying() { return playing.get(); } public void setPlaying(boolean playing) { this.playing.set(playing); } @Override public int getPlayDelay() { return playDelay; } public void setPlayDelay(int playDelay) { this.playDelay = playDelay; } @Override public double getPlayStep() { return playStep; } public void setPlayStep(double playStep) { this.playStep = playStep; } @Override public PlayMode getPlayMode() { return playMode; } public void setPlayMode(PlayMode playMode) { this.playMode = playMode; } @Override public TimelineChart getChart() { return chart; } public void setChart(TimelineChart chart) { this.chart = chart; } }
double vi = interval.getHigh(); if (Double.isInfinite(vi)) { return getCustomMax(); } return vi;
1,080
41
1,121
<no_super_class>
gephi_gephi
gephi/modules/ToolsPlugin/src/main/java/org/gephi/tools/plugin/Brush.java
Brush
brush
class Brush implements Tool { //Architecture private ToolEventListener[] listeners; private BrushPanel brushPanel; //Settings private float[] color = {1f, 0f, 0f}; private float intensity = 0.3f; private DiffusionMethods.DiffusionMethod diffusionMethod = DiffusionMethods.DiffusionMethod.NEIGHBORS; @Override public void select() { } @Override public void unselect() { listeners = null; brushPanel = null; } private void brush(Node[] nodes) {<FILL_FUNCTION_BODY>} private Node[] getDiffusedNodes(Node[] input) { GraphModel model = Lookup.getDefault().lookup(GraphController.class).getGraphModel(); switch (diffusionMethod) { case NEIGHBORS: return DiffusionMethods.getNeighbors(model.getGraphVisible(), input); case NEIGHBORS_OF_NEIGHBORS: return DiffusionMethods.getNeighborsOfNeighbors(model.getGraphVisible(), input); case PREDECESSORS: if (model.isDirected()) { return DiffusionMethods.getPredecessors(model.getDirectedGraphVisible(), input); } else { return DiffusionMethods.getNeighbors(model.getGraphVisible(), input); } case SUCCESSORS: if (model.isDirected()) { return DiffusionMethods.getSuccessors(model.getDirectedGraphVisible(), input); } else { return DiffusionMethods.getNeighbors(model.getGraphVisible(), input); } } return new Node[0]; } @Override public ToolEventListener[] getListeners() { listeners = new ToolEventListener[1]; listeners[0] = new NodePressingEventListener() { @Override public void pressingNodes(Node[] nodes) { diffusionMethod = brushPanel.getDiffusionMethod(); color = brushPanel.getColor().getColorComponents(color); intensity = brushPanel.getIntensity(); brush(nodes); } @Override public void released() { } }; return listeners; } @Override public ToolUI getUI() { return new ToolUI() { @Override public JPanel getPropertiesBar(Tool tool) { brushPanel = new BrushPanel(); brushPanel.setDiffusionMethod(diffusionMethod); brushPanel.setColor(new Color(color[0], color[1], color[2])); brushPanel.setIntensity(intensity); return brushPanel; } @Override public String getName() { return NbBundle.getMessage(Brush.class, "Brush.name"); } @Override public Icon getIcon() { return ImageUtilities.loadImageIcon("ToolsPlugin/brush.png", false); } @Override public String getDescription() { return NbBundle.getMessage(Painter.class, "Brush.description"); } @Override public int getPosition() { return 110; } }; } @Override public ToolSelectionType getSelectionType() { return ToolSelectionType.SELECTION; } }
for (Node node : nodes) { float r = node.r(); float g = node.g(); float b = node.b(); r = intensity * color[0] + (1 - intensity) * r; g = intensity * color[1] + (1 - intensity) * g; b = intensity * color[2] + (1 - intensity) * b; node.setR(r); node.setG(g); node.setB(b); } for (Node node : getDiffusedNodes(nodes)) { float r = node.r(); float g = node.g(); float b = node.b(); r = intensity * color[0] + (1 - intensity) * r; g = intensity * color[1] + (1 - intensity) * g; b = intensity * color[2] + (1 - intensity) * b; node.setR(r); node.setG(g); node.setB(b); }
843
258
1,101
<no_super_class>
gephi_gephi
gephi/modules/ToolsPlugin/src/main/java/org/gephi/tools/plugin/DiffusionMethods.java
DiffusionMethods
getNeighborsOfNeighbors
class DiffusionMethods { public static Node[] getNeighbors(Graph graph, Node[] nodes) { Set<Node> nodeTree = new HashSet<>(); graph.readLock(); try { for (Node n : nodes) { nodeTree.addAll(graph.getNeighbors(n).toCollection()); } } finally { graph.readUnlock(); } //remove original nodes for (Node n : nodes) { nodeTree.remove(n); } return nodeTree.toArray(new Node[0]); } public static Node[] getNeighborsOfNeighbors(Graph graph, Node[] nodes) {<FILL_FUNCTION_BODY>} public static Node[] getPredecessors(DirectedGraph graph, Node[] nodes) { Set<Node> nodeTree = new HashSet<>(); graph.readLock(); try { for (Node n : nodes) { nodeTree.addAll(graph.getPredecessors(n).toCollection()); } } finally { graph.readUnlock(); } //remove original nodes for (Node n : nodes) { nodeTree.remove(n); } return nodeTree.toArray(new Node[0]); } public static Node[] getSuccessors(DirectedGraph graph, Node[] nodes) { Set<Node> nodeTree = new HashSet<>(); graph.readLock(); try { for (Node n : nodes) { nodeTree.addAll(graph.getSuccessors(n).toCollection()); } } finally { graph.readUnlock(); } //remove original nodes for (Node n : nodes) { nodeTree.remove(n); } return nodeTree.toArray(new Node[0]); } public static enum DiffusionMethod { NONE("DiffusionMethod.None"), NEIGHBORS("DiffusionMethod.Neighbors"), NEIGHBORS_OF_NEIGHBORS("DiffusionMethod.NeighborsOfNeighbors"), PREDECESSORS("DiffusionMethod.Predecessors"), SUCCESSORS("DiffusionMethod.Successors"); private final String name; DiffusionMethod(String name) { this.name = name; } public String getName() { return NbBundle.getMessage(DiffusionMethods.class, name); } @Override public String toString() { return getName(); } } }
Set<Node> nodeTree = new HashSet<>(); graph.readLock(); try { for (Node n : nodes) { nodeTree.addAll(graph.getNeighbors(n).toCollection()); } //remove original nodes for (Node n : nodes) { nodeTree.remove(n); } for (Node n : nodeTree.toArray(new Node[0])) { nodeTree.addAll(graph.getNeighbors(n).toCollection()); } } finally { graph.readUnlock(); } //remove original nodes for (Node n : nodes) { nodeTree.remove(n); } return nodeTree.toArray(new Node[0]);
652
193
845
<no_super_class>
gephi_gephi
gephi/modules/ToolsPlugin/src/main/java/org/gephi/tools/plugin/EdgePencil.java
EdgePencil
getListeners
class EdgePencil implements Tool { //Architecture private ToolEventListener[] listeners; private EdgePencilPanel edgePencilPanel; //Settings private Color color; private float weight; //State private Node sourceNode; public EdgePencil() { //Default settings color = Color.GRAY; weight = 1f; //Add workspace listener for updating edge pencil panel options and status Lookup.getDefault().lookup(ProjectController.class).addWorkspaceListener(new WorkspaceListener() { @Override public void initialize(Workspace workspace) { updatePanel(); } @Override public void select(Workspace workspace) { updatePanel(); } @Override public void unselect(Workspace workspace) { } @Override public void close(Workspace workspace) { } @Override public void disable() { } }); } private void updatePanel() { if (edgePencilPanel != null) { GraphController gc = Lookup.getDefault().lookup(GraphController.class); if (gc.getGraphModel() != null) { edgePencilPanel.setType(gc.getGraphModel().isDirected() || gc.getGraphModel().isMixed()); } sourceNode = null; edgePencilPanel.setStatus(NbBundle.getMessage(EdgePencil.class, "EdgePencil.status1")); } } @Override public void select() { } @Override public void unselect() { listeners = null; sourceNode = null; color = edgePencilPanel.getColor(); weight = edgePencilPanel.getWeight(); } @Override public ToolEventListener[] getListeners() {<FILL_FUNCTION_BODY>} @Override public ToolUI getUI() { return new ToolUI() { @Override public JPanel getPropertiesBar(Tool tool) { edgePencilPanel = new EdgePencilPanel(); edgePencilPanel.setColor(color); edgePencilPanel.setWeight(weight); updatePanel(); return edgePencilPanel; } @Override public String getName() { return NbBundle.getMessage(EdgePencil.class, "EdgePencil.name"); } @Override public Icon getIcon() { return ImageUtilities.loadImageIcon("ToolsPlugin/edgepencil.png", false); } @Override public String getDescription() { return NbBundle.getMessage(EdgePencil.class, "EdgePencil.description"); } @Override public int getPosition() { return 130; } }; } @Override public ToolSelectionType getSelectionType() { return ToolSelectionType.SELECTION; } }
listeners = new ToolEventListener[2]; listeners[0] = new NodeClickEventListener() { @Override public void clickNodes(Node[] nodes) { Node n = nodes[0]; if (sourceNode == null) { sourceNode = n; edgePencilPanel.setStatus(NbBundle.getMessage(EdgePencil.class, "EdgePencil.status2")); } else { color = edgePencilPanel.getColor(); weight = edgePencilPanel.getWeight(); boolean directed = edgePencilPanel.isDirected; Edge edge = Lookup.getDefault().lookup(GraphElementsController.class).createEdge(sourceNode, n, directed); edge.setColor(color); sourceNode = null; edgePencilPanel.setStatus(NbBundle.getMessage(EdgePencil.class, "EdgePencil.status1")); } } }; listeners[1] = new MouseClickEventListener() { @Override public void mouseClick(int[] positionViewport, float[] position3d) { if (sourceNode != null) { //Cancel edgePencilPanel.setStatus(NbBundle.getMessage(EdgePencil.class, "EdgePencil.status1")); sourceNode = null; } } }; return listeners;
747
332
1,079
<no_super_class>
gephi_gephi
gephi/modules/ToolsPlugin/src/main/java/org/gephi/tools/plugin/Edit.java
Edit
getListeners
class Edit implements Tool { private EditWindowController edc; @Override public void select() { edc = Lookup.getDefault().lookup(EditWindowController.class); edc.openEditWindow(); } @Override public void unselect() { edc.disableEdit(); edc.closeEditWindow(); } @Override public ToolEventListener[] getListeners() {<FILL_FUNCTION_BODY>} @Override public ToolUI getUI() { return new ToolUI() { @Override public JPanel getPropertiesBar(Tool tool) { return new JPanel(); } @Override public Icon getIcon() { return ImageUtilities.loadImageIcon("ToolsPlugin/edit.png", false); } @Override public String getName() { return NbBundle.getMessage(Edit.class, "Edit.name"); } @Override public String getDescription() { return NbBundle.getMessage(Edit.class, "Edit.description"); } @Override public int getPosition() { return 10; } }; } @Override public ToolSelectionType getSelectionType() { return ToolSelectionType.SELECTION; } }
return new ToolEventListener[] {new NodeClickEventListener() { @Override public void clickNodes(Node[] nodes) { if (nodes.length > 0) { edc.editNode(nodes[0]); } else { edc.disableEdit(); } } }};
335
80
415
<no_super_class>
gephi_gephi
gephi/modules/ToolsPlugin/src/main/java/org/gephi/tools/plugin/HeatMap.java
HeatMap
clickNodes
class HeatMap implements Tool { //Architecture private ToolEventListener[] listeners; private HeatMapPanel heatMapPanel; //Settings private Color[] gradientColors; private float[] gradientPositions; //All between 0 and 1 private boolean dontPaintUnreachable = true; public HeatMap() { //Default settings gradientColors = new Color[] {new Color(227, 74, 51), new Color(253, 187, 132), new Color(254, 232, 200)}; gradientPositions = new float[] {0f, 0.5f, 1f}; } @Override public void select() { } @Override public void unselect() { listeners = null; heatMapPanel = null; } @Override public ToolEventListener[] getListeners() { listeners = new ToolEventListener[1]; listeners[0] = new NodeClickEventListener() { @Override public void clickNodes(Node[] nodes) {<FILL_FUNCTION_BODY>} }; return listeners; } @Override public ToolUI getUI() { return new ToolUI() { @Override public JPanel getPropertiesBar(Tool tool) { heatMapPanel = new HeatMapPanel(gradientColors, gradientPositions, dontPaintUnreachable); return heatMapPanel; } @Override public String getName() { return NbBundle.getMessage(HeatMap.class, "HeatMap.name"); } @Override public Icon getIcon() { return ImageUtilities.loadImageIcon("ToolsPlugin/heatmap.png", false); } @Override public String getDescription() { return NbBundle.getMessage(ShortestPath.class, "HeatMap.description"); } @Override public int getPosition() { return 150; } }; } @Override public ToolSelectionType getSelectionType() { return ToolSelectionType.SELECTION; } }
try { Node n = nodes[0]; Color[] colors; float[] positions; if (heatMapPanel.isUsePalette()) { colors = heatMapPanel.getSelectedPalette().getColors(); positions = heatMapPanel.getSelectedPalette().getPositions(); dontPaintUnreachable = true; } else { gradientColors = colors = heatMapPanel.getGradientColors(); gradientPositions = positions = heatMapPanel.getGradientPositions(); dontPaintUnreachable = heatMapPanel.isDontPaintUnreachable(); } GraphController gc = Lookup.getDefault().lookup(GraphController.class); AbstractShortestPathAlgorithm algorithm; if (gc.getGraphModel().isDirected()) { DirectedGraph graph = gc.getGraphModel().getDirectedGraphVisible(); algorithm = new BellmanFordShortestPathAlgorithm(graph, n); algorithm.compute(); } else { Graph graph = gc.getGraphModel().getGraphVisible(); algorithm = new DijkstraShortestPathAlgorithm(graph, n); algorithm.compute(); } //Color LinearGradient linearGradient = new LinearGradient(colors, positions); //Algorithm double maxDistance = algorithm.getMaxDistance(); if (!dontPaintUnreachable) { maxDistance++; //+1 to have the maxdistance nodes a ratio<1 } if (maxDistance > 0) { for (Entry<Node, Double> entry : algorithm.getDistances().entrySet()) { Node node = entry.getKey(); if (!Double.isInfinite(entry.getValue())) { float ratio = (float) (entry.getValue() / maxDistance); Color c = linearGradient.getValue(ratio); node.setColor(c); } else if (!dontPaintUnreachable) { Color c = colors[colors.length - 1]; node.setColor(c); } } } Color c = colors[0]; n.setColor(c); heatMapPanel.setStatus(NbBundle.getMessage(HeatMap.class, "HeatMap.status.maxdistance") + new DecimalFormat("#.##").format(algorithm.getMaxDistance())); } catch (Exception e) { Logger.getLogger("").log(Level.SEVERE, "", e); }
547
621
1,168
<no_super_class>
gephi_gephi
gephi/modules/ToolsPlugin/src/main/java/org/gephi/tools/plugin/NodePencil.java
NodePencil
mouseClick
class NodePencil implements Tool { //Architecture private ToolEventListener[] listeners; private NodePencilPanel nodePencilPanel; //Settings private Color color; private float size; public NodePencil() { //Default settings color = new Color(153, 153, 153);//Default gray of nodes size = 10f; } @Override public void select() { } @Override public void unselect() { listeners = null; nodePencilPanel = null; } @Override public ToolEventListener[] getListeners() { listeners = new ToolEventListener[1]; listeners[0] = new MouseClickEventListener() { @Override public void mouseClick(int[] positionViewport, float[] position3d) {<FILL_FUNCTION_BODY>} }; return listeners; } @Override public ToolUI getUI() { return new ToolUI() { @Override public JPanel getPropertiesBar(Tool tool) { nodePencilPanel = new NodePencilPanel(); nodePencilPanel.setColor(color); nodePencilPanel.setNodeSize(size); return nodePencilPanel; } @Override public String getName() { return NbBundle.getMessage(NodePencil.class, "NodePencil.name"); } @Override public Icon getIcon() { return ImageUtilities.loadImageIcon("ToolsPlugin/nodepencil.png", false); } @Override public String getDescription() { return NbBundle.getMessage(NodePencil.class, "NodePencil.description"); } @Override public int getPosition() { return 120; } }; } @Override public ToolSelectionType getSelectionType() { return ToolSelectionType.NONE; } }
color = nodePencilPanel.getColor(); size = nodePencilPanel.getNodeSize(); GraphController gc = Lookup.getDefault().lookup(GraphController.class); GraphModel gm = gc.getGraphModel(); Graph graph = gm.getGraph(); Node node = gm.factory().newNode(); node.setX(position3d[0]); node.setY(position3d[1]); node.setSize(size); node.setColor(color); graph.addNode(node);
497
140
637
<no_super_class>
gephi_gephi
gephi/modules/ToolsPlugin/src/main/java/org/gephi/tools/plugin/Painter.java
Painter
pressingNodes
class Painter implements Tool { private ToolEventListener[] listeners; private PainterPanel painterPanel; //Settings private float[] color = {1f, 0f, 0f}; private float intensity = 0.3f; @Override public void select() { } @Override public void unselect() { listeners = null; painterPanel = null; } @Override public ToolEventListener[] getListeners() { listeners = new ToolEventListener[1]; listeners[0] = new NodePressingEventListener() { @Override public void pressingNodes(Node[] nodes) {<FILL_FUNCTION_BODY>} @Override public void released() { } }; return listeners; } @Override public ToolUI getUI() { return new ToolUI() { @Override public JPanel getPropertiesBar(Tool tool) { painterPanel = new PainterPanel(); painterPanel.setColor(new Color(color[0], color[1], color[2])); return painterPanel; } @Override public String getName() { return NbBundle.getMessage(Painter.class, "Painter.name"); } @Override public Icon getIcon() { return ImageUtilities.loadImageIcon("ToolsPlugin/painter.png", false); } @Override public String getDescription() { return NbBundle.getMessage(Painter.class, "Painter.description"); } @Override public int getPosition() { return 100; } }; } @Override public ToolSelectionType getSelectionType() { return ToolSelectionType.SELECTION; } }
color = painterPanel.getColor().getColorComponents(color); for (Node node : nodes) { float r = node.r(); float g = node.g(); float b = node.b(); r = intensity * color[0] + (1 - intensity) * r; g = intensity * color[1] + (1 - intensity) * g; b = intensity * color[2] + (1 - intensity) * b; node.setR(r); node.setG(g); node.setB(b); }
460
145
605
<no_super_class>
gephi_gephi
gephi/modules/ToolsPlugin/src/main/java/org/gephi/tools/plugin/Sizer.java
Sizer
getListeners
class Sizer implements Tool { private final float INTENSITY = 0.4f; private final float LIMIT = 0.1f; private SizerPanel sizerPanel; private ToolEventListener[] listeners; //Vars private Node[] nodes; private float[] sizes; @Override public void select() { } @Override public void unselect() { listeners = null; sizerPanel = null; nodes = null; sizes = null; } @Override public ToolEventListener[] getListeners() {<FILL_FUNCTION_BODY>} @Override public ToolUI getUI() { return new ToolUI() { @Override public JPanel getPropertiesBar(Tool tool) { sizerPanel = new SizerPanel(); return sizerPanel; } @Override public String getName() { return NbBundle.getMessage(Sizer.class, "Sizer.name"); } @Override public Icon getIcon() { return ImageUtilities.loadImageIcon("ToolsPlugin/sizer.png", false); } @Override public String getDescription() { return NbBundle.getMessage(Sizer.class, "Sizer.description"); } @Override public int getPosition() { return 105; } }; } @Override public ToolSelectionType getSelectionType() { return ToolSelectionType.SELECTION_AND_DRAGGING; } }
listeners = new ToolEventListener[1]; listeners[0] = new NodePressAndDraggingEventListener() { @Override public void pressNodes(Node[] nodes) { Sizer.this.nodes = nodes; sizes = new float[nodes.length]; for (int i = 0; i < nodes.length; i++) { Node n = nodes[i]; sizes[i] = n.size(); } } @Override public void released() { nodes = null; sizerPanel.setAvgSize(-1); } @Override public void drag(float displacementX, float displacementY) { if (nodes != null) { float averageSize = 0f; for (int i = 0; i < nodes.length; i++) { Node n = nodes[i]; float size = sizes[i]; size += displacementY * INTENSITY; if (size < LIMIT) { size = LIMIT; } averageSize += size; n.setSize(size); } averageSize /= nodes.length; sizerPanel.setAvgSize(averageSize); } } }; return listeners;
394
312
706
<no_super_class>
gephi_gephi
gephi/modules/ToolsPlugin/src/main/java/org/gephi/ui/tools/plugin/BrushPanel.java
BrushPanel
initComponents
class BrushPanel extends javax.swing.JPanel { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton colorButton; private javax.swing.JComboBox diffusionCombobox; private javax.swing.JSpinner intensitySpinner; private javax.swing.JLabel jLabel1; private javax.swing.JLabel labelColor; private javax.swing.JLabel labelDiffusion; private javax.swing.JLabel labelIntensity; // End of variables declaration//GEN-END:variables /** * Creates new form BrushPanel */ public BrushPanel() { initComponents(); DefaultComboBoxModel diffusionComboModel = new DefaultComboBoxModel(DiffusionMethods.DiffusionMethod.values()); diffusionCombobox.setModel(diffusionComboModel); } public float getIntensity() { return ((Integer) intensitySpinner.getModel().getValue()).floatValue() / 100f; } public void setIntensity(float intensity) { intensitySpinner.setValue((int) (intensity * 100)); } public Color getColor() { return ((JColorButton) colorButton).getColor(); } public void setColor(Color color) { ((JColorButton) colorButton).setColor(color); } public DiffusionMethods.DiffusionMethod getDiffusionMethod() { return (DiffusionMethods.DiffusionMethod) diffusionCombobox.getSelectedItem(); } public void setDiffusionMethod(DiffusionMethods.DiffusionMethod diffusionMethod) { diffusionCombobox.setSelectedItem(diffusionMethod); } /** * 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") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() {<FILL_FUNCTION_BODY>}// </editor-fold>//GEN-END:initComponents }
labelDiffusion = new javax.swing.JLabel(); labelColor = new javax.swing.JLabel(); diffusionCombobox = new javax.swing.JComboBox(); colorButton = new JColorButton(Color.BLACK); labelIntensity = new javax.swing.JLabel(); intensitySpinner = new javax.swing.JSpinner(); jLabel1 = new javax.swing.JLabel(); labelDiffusion.setFont(labelDiffusion.getFont().deriveFont((float) 10)); labelDiffusion.setText( org.openide.util.NbBundle.getMessage(BrushPanel.class, "BrushPanel.labelDiffusion.text")); // NOI18N labelColor.setFont(labelColor.getFont().deriveFont((float) 10)); labelColor .setText(org.openide.util.NbBundle.getMessage(BrushPanel.class, "BrushPanel.labelColor.text")); // NOI18N diffusionCombobox.setFont(diffusionCombobox.getFont().deriveFont((float) 10)); diffusionCombobox .setModel(new javax.swing.DefaultComboBoxModel(new String[] {"Item 1", "Item 2", "Item 3", "Item 4"})); colorButton .setText(org.openide.util.NbBundle.getMessage(BrushPanel.class, "BrushPanel.colorButton.text")); // NOI18N colorButton.setContentAreaFilled(false); colorButton.setFocusPainted(false); labelIntensity.setFont(labelIntensity.getFont().deriveFont((float) 10)); labelIntensity.setText( org.openide.util.NbBundle.getMessage(BrushPanel.class, "BrushPanel.labelIntensity.text")); // NOI18N intensitySpinner.setFont(intensitySpinner.getFont().deriveFont((float) 10)); intensitySpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, 100, 1)); jLabel1.setFont(jLabel1.getFont().deriveFont((float) 10)); jLabel1.setText(org.openide.util.NbBundle.getMessage(BrushPanel.class, "BrushPanel.jLabel1.text")); // NOI18N 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() .addComponent(labelColor) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(colorButton, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(labelIntensity) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(intensitySpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 239, Short.MAX_VALUE) .addComponent(labelDiffusion) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(diffusionCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(2, 2, 2)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(labelColor, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(colorButton, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(labelIntensity, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(intensitySpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(diffusionCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(labelDiffusion, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)) );
562
1,417
1,979
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/ToolsPlugin/src/main/java/org/gephi/ui/tools/plugin/HeatMapPanel.java
PaletteListCellRenderer
getListCellRendererComponent
class PaletteListCellRenderer extends JLabel implements ListCellRenderer { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {<FILL_FUNCTION_BODY>} }
//int selectedIndex = ((Integer) value).intValue(); if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } //Set icon Palette p = (Palette) value; PaletteIcon icon = new PaletteIcon(p.getColors()); setIcon(icon); return this;
68
129
197
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/ToolsPlugin/src/main/java/org/gephi/ui/tools/plugin/NodePencilPanel.java
NodePencilPanel
initComponents
class NodePencilPanel extends javax.swing.JPanel { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton colorButton; private javax.swing.JLabel labelColor; private javax.swing.JLabel labelSize; private javax.swing.JSpinner sizeSpinner; private javax.swing.JLabel statusLabel; // End of variables declaration//GEN-END:variables /** * Creates new form NodePencilPanel */ public NodePencilPanel() { initComponents(); } public void setStatus(String status) { statusLabel.setText(status); } public Color getColor() { return ((JColorButton) colorButton).getColor(); } public void setColor(Color color) { ((JColorButton) colorButton).setColor(color); } public float getNodeSize() { return (Float) sizeSpinner.getModel().getValue(); } public void setNodeSize(float size) { sizeSpinner.getModel().setValue(new Float(size)); } /** * 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") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() {<FILL_FUNCTION_BODY>}// </editor-fold>//GEN-END:initComponents }
sizeSpinner = new javax.swing.JSpinner(); labelSize = new javax.swing.JLabel(); colorButton = new JColorButton(Color.BLACK); labelColor = new javax.swing.JLabel(); statusLabel = new javax.swing.JLabel(); sizeSpinner.setFont(sizeSpinner.getFont().deriveFont((float) 10)); sizeSpinner.setModel( new javax.swing.SpinnerNumberModel(Float.valueOf(1.0f), Float.valueOf(0.0f), null, Float.valueOf(0.5f))); labelSize.setFont(labelSize.getFont().deriveFont((float) 10)); labelSize.setText( org.openide.util.NbBundle.getMessage(NodePencilPanel.class, "NodePencilPanel.labelSize.text")); // NOI18N colorButton.setText( org.openide.util.NbBundle.getMessage(NodePencilPanel.class, "NodePencilPanel.colorButton.text")); // NOI18N colorButton.setContentAreaFilled(false); colorButton.setFocusPainted(false); labelColor.setFont(labelColor.getFont().deriveFont((float) 10)); labelColor.setText( org.openide.util.NbBundle.getMessage(NodePencilPanel.class, "NodePencilPanel.labelColor.text")); // NOI18N statusLabel.setFont(statusLabel.getFont().deriveFont((float) 10)); statusLabel.setText( org.openide.util.NbBundle.getMessage(NodePencilPanel.class, "NodePencilPanel.statusLabel.text")); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addComponent(statusLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 238, Short.MAX_VALUE) .addComponent(labelColor) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(colorButton, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(labelSize) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(sizeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(sizeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(labelSize, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(labelColor, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(statusLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(colorButton, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) );
421
1,056
1,477
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/ToolsPlugin/src/main/java/org/gephi/ui/tools/plugin/PainterPanel.java
PainterPanel
initComponents
class PainterPanel extends javax.swing.JPanel { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton colorButton; private javax.swing.JLabel labelColor; // End of variables declaration//GEN-END:variables public PainterPanel() { initComponents(); } public Color getColor() { return ((JColorButton) colorButton).getColor(); } public void setColor(Color color) { ((JColorButton) colorButton).setColor(color); } /** * 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") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() {<FILL_FUNCTION_BODY>}// </editor-fold>//GEN-END:initComponents }
colorButton = new JColorButton(Color.BLACK); labelColor = new javax.swing.JLabel(); colorButton.setText( org.openide.util.NbBundle.getMessage(PainterPanel.class, "PainterPanel.colorButton.text")); // NOI18N colorButton.setContentAreaFilled(false); colorButton.setFocusPainted(false); labelColor.setFont(labelColor.getFont().deriveFont((float) 10)); labelColor.setText( org.openide.util.NbBundle.getMessage(PainterPanel.class, "PainterPanel.labelColor.text")); // NOI18N 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() .addComponent(labelColor) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(colorButton, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(465, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(labelColor, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(colorButton, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)) );
277
507
784
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/ToolsPlugin/src/main/java/org/gephi/ui/tools/plugin/SizerPanel.java
SizerPanel
setAvgSize
class SizerPanel extends javax.swing.JPanel { private float avgSize; private DecimalFormat formatter; // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel1; private javax.swing.JLabel labelSize; private javax.swing.JLabel sizeLabel; // End of variables declaration//GEN-END:variables /** * Creates new form SizePanel */ public SizerPanel() { initComponents(); formatter = new DecimalFormat(); formatter.setMaximumFractionDigits(2); } public float getAvgSize() { return avgSize; } public void setAvgSize(float avgSize) {<FILL_FUNCTION_BODY>} /** * 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") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; jLabel1 = new javax.swing.JLabel(); labelSize = new javax.swing.JLabel(); sizeLabel = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); jLabel1.setFont(jLabel1.getFont().deriveFont((float) 10)); jLabel1.setText(org.openide.util.NbBundle.getMessage(SizerPanel.class, "SizerPanel.jLabel1.text")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0); add(jLabel1, gridBagConstraints); labelSize.setFont(labelSize.getFont().deriveFont((float) 10)); labelSize .setText(org.openide.util.NbBundle.getMessage(SizerPanel.class, "SizerPanel.labelSize.text")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4); add(labelSize, gridBagConstraints); sizeLabel.setFont(sizeLabel.getFont().deriveFont((float) 10)); sizeLabel .setText(org.openide.util.NbBundle.getMessage(SizerPanel.class, "SizerPanel.sizeLabel.text")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 3); add(sizeLabel, gridBagConstraints); }// </editor-fold>//GEN-END:initComponents }
this.avgSize = avgSize; if (avgSize == -1) { sizeLabel.setText("NaN"); } else { String str = formatter.format(avgSize); if (!str.equals(sizeLabel.getText())) { sizeLabel.setText(str); } }
973
85
1,058
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/ToolsPlugin/src/main/java/org/gephi/ui/tools/plugin/edit/EditNodes.java
MultipleNodesPropertiesWrapper
setNodesSize
class MultipleNodesPropertiesWrapper { private final Node[] nodes; //Methods and fields for multiple nodes editing: private Float nodesX = null; private Float nodesY = null; private Float nodesZ = null; private Float nodesSize = null; private Color nodesColor = null; private Color labelsColor = null; private Float labelsSize = null; private Boolean labelsVisible = null; public MultipleNodesPropertiesWrapper(Node[] nodes) { this.nodes = nodes; } public Float getNodesX() { return nodesX; } public void setNodesX(Float x) { nodesX = x; for (Node node : nodes) { node.setX(x); } } public Float getNodesY() { return nodesY; } public void setNodesY(Float y) { nodesY = y; for (Node node : nodes) { node.setY(y); } } public Float getNodesZ() { return nodesZ; } public void setNodesZ(Float z) { nodesZ = z; for (Node node : nodes) { node.setZ(z); } } public Color getNodesColor() { return nodesColor; } public void setNodesColor(Color c) { if (c != null) { nodesColor = c; for (Node node : nodes) { node.setR(c.getRed() / 255f); node.setG(c.getGreen() / 255f); node.setB(c.getBlue() / 255f); node.setAlpha(c.getAlpha() / 255f); } } } public Float getNodesSize() { return nodesSize; } public void setNodesSize(Float size) {<FILL_FUNCTION_BODY>} public Color getLabelsColor() { return labelsColor; } public void setLabelsColor(Color c) { if (c != null) { labelsColor = c; for (Node node : nodes) { TextProperties textProps = node.getTextProperties(); textProps.setR(c.getRed() / 255f); textProps.setG(c.getGreen() / 255f); textProps.setB(c.getBlue() / 255f); textProps.setAlpha(c.getAlpha() / 255f); } } } public Float getLabelsSize() { return labelsSize; } public void setLabelsSize(Float size) { labelsSize = size; for (Node node : nodes) { TextProperties textProps = node.getTextProperties(); textProps.setSize(size); } } public Boolean getLabelsVisible() { return labelsVisible; } public void setLabelsVisible(Boolean visible) { labelsVisible = visible; for (Node node : nodes) { TextProperties textProps = node.getTextProperties(); textProps.setVisible(visible); } } }
nodesSize = size; for (Node node : nodes) { node.setSize(size); }
843
32
875
<no_super_class>
gephi_gephi
gephi/modules/ToolsPlugin/src/main/java/org/gephi/ui/tools/plugin/edit/EditToolTopComponent.java
EditToolTopComponent
readProperties
class EditToolTopComponent extends TopComponent { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel propertySheet; // End of variables declaration//GEN-END:variables public EditToolTopComponent() { initComponents(); setName(NbBundle.getMessage(EditToolTopComponent.class, "CTL_EditToolTopComponent")); putClientProperty(TopComponent.PROP_MAXIMIZATION_DISABLED, Boolean.TRUE); ((PropertySheet) propertySheet).setDescriptionAreaVisible(false); Lookup.getDefault().lookup(ProjectController.class).addWorkspaceListener(new WorkspaceListener() { @Override public void initialize(Workspace workspace) { } @Override public void select(Workspace workspace) { SwingUtilities.invokeLater(() -> { propertySheet.setEnabled(true); }); } @Override public void unselect(Workspace workspace) { disableEdit(); } @Override public void close(Workspace workspace) { } @Override public void disable() { SwingUtilities.invokeLater(() -> { propertySheet.setEnabled(false); EditToolTopComponent.this.close(); }); } }); } public void editNode(Node node) { ((PropertySheet) propertySheet).setNodes(new org.openide.nodes.Node[] {new EditNodes(node)}); } public void editNodes(Node[] nodes) { ((PropertySheet) propertySheet).setNodes(new org.openide.nodes.Node[] {new EditNodes(nodes)}); } public void editEdge(Edge edge) { ((PropertySheet) propertySheet).setNodes(new org.openide.nodes.Node[] {new EditEdges(edge)}); } public void editEdges(Edge[] edges) { ((PropertySheet) propertySheet).setNodes(new org.openide.nodes.Node[] {new EditEdges(edges)}); } public void disableEdit() { ((PropertySheet) propertySheet).setNodes(new org.openide.nodes.Node[] {}); } /** * 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. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; propertySheet = new PropertySheet(); setLayout(new java.awt.GridBagLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); add(propertySheet, gridBagConstraints); }// </editor-fold>//GEN-END:initComponents @Override public void componentOpened() { // TODO add custom code on component opening } @Override public void componentClosed() { // TODO add custom code on component closing } void writeProperties(java.util.Properties p) { // better to version settings since initial version as advocated at // http://wiki.apidesign.org/wiki/PropertyFiles p.setProperty("version", "1.0"); // TODO store your settings } void readProperties(java.util.Properties p) {<FILL_FUNCTION_BODY>} }
String version = p.getProperty("version"); // TODO read your settings according to their version
1,027
26
1,053
<no_super_class>
gephi_gephi
gephi/modules/ToolsPlugin/src/main/java/org/gephi/ui/tools/plugin/edit/EditWindowControllerImpl.java
IsOpenRunnable
run
class IsOpenRunnable implements Runnable { boolean open = false; @Override public void run() {<FILL_FUNCTION_BODY>} }
EditToolTopComponent topComponent = findInstance(); open = topComponent != null && topComponent.isOpened();
47
32
79
<no_super_class>
gephi_gephi
gephi/modules/ToolsPlugin/src/main/java/org/gephi/ui/tools/plugin/edit/MultipleRowsAttributeValueWrapper.java
MultipleRowsAttributeValueWrapper
convertToStringIfNotNull
class MultipleRowsAttributeValueWrapper implements AttributeValueWrapper { private final Element[] rows; private final Column column; private final TimeFormat currentTimeFormat; private final DateTimeZone dateTimeZone; private Object value; public MultipleRowsAttributeValueWrapper(Element[] rows, Column column, TimeFormat currentTimeFormat, DateTimeZone dateTimeZone) { this.rows = rows; this.column = column; this.currentTimeFormat = currentTimeFormat; this.dateTimeZone = dateTimeZone; this.value = null; } private String convertToStringIfNotNull() {<FILL_FUNCTION_BODY>} private void setValueToAllElements(Object object) { this.value = object; for (Element row : rows) { row.setAttribute(column, value); } } @Override public Byte getValueByte() { return (Byte) value; } @Override public void setValueByte(Byte object) { setValueToAllElements(object); } @Override public Short getValueShort() { return (Short) value; } @Override public void setValueShort(Short object) { setValueToAllElements(object); } @Override public Character getValueCharacter() { return (Character) value; } @Override public void setValueCharacter(Character object) { setValueToAllElements(object); } @Override public String getValueString() { return (String) value; } @Override public void setValueString(String object) { setValueToAllElements(object); } @Override public Double getValueDouble() { return (Double) value; } @Override public void setValueDouble(Double object) { setValueToAllElements(object); } @Override public Float getValueFloat() { return (Float) value; } @Override public void setValueFloat(Float object) { setValueToAllElements(object); } @Override public Integer getValueInteger() { return (Integer) value; } @Override public void setValueInteger(Integer object) { setValueToAllElements(object); } @Override public Boolean getValueBoolean() { return (Boolean) value; } @Override public void setValueBoolean(Boolean object) { setValueToAllElements(object); } @Override public Long getValueLong() { return (Long) value; } @Override public void setValueLong(Long object) { setValueToAllElements(object); } @Override public String getValueAsString() { return convertToStringIfNotNull(); } @Override public void setValueAsString(String value) { setValueToAllElements(AttributeUtils.parse(value, column.getTypeClass())); } }
if (value != null) { return AttributeUtils.print(value, currentTimeFormat, dateTimeZone); } else { return null; }
779
45
824
<no_super_class>
gephi_gephi
gephi/modules/ToolsPlugin/src/main/java/org/gephi/ui/tools/plugin/edit/SingleRowAttributeValueWrapper.java
SingleRowAttributeValueWrapper
convertToStringIfNotNull
class SingleRowAttributeValueWrapper implements EditWindowUtils.AttributeValueWrapper { private final Element row; private final Column column; private final TimeFormat currentTimeFormat; private final DateTimeZone dateTimeZone; public SingleRowAttributeValueWrapper(Element row, Column column, TimeFormat currentTimeFormat, DateTimeZone dateTimeZone) { this.row = row; this.column = column; this.currentTimeFormat = currentTimeFormat; this.dateTimeZone = dateTimeZone; } private String convertToStringIfNotNull() {<FILL_FUNCTION_BODY>} @Override public Byte getValueByte() { return (Byte) row.getAttribute(column); } @Override public void setValueByte(Byte object) { row.setAttribute(column, object); } @Override public Short getValueShort() { return (Short) row.getAttribute(column); } @Override public void setValueShort(Short object) { row.setAttribute(column, object); } @Override public Character getValueCharacter() { return (Character) row.getAttribute(column); } @Override public void setValueCharacter(Character object) { row.setAttribute(column, object); } @Override public String getValueString() { return (String) row.getAttribute(column); } @Override public void setValueString(String object) { row.setAttribute(column, object); } @Override public Double getValueDouble() { return (Double) row.getAttribute(column); } @Override public void setValueDouble(Double object) { row.setAttribute(column, object); } @Override public Float getValueFloat() { return (Float) row.getAttribute(column); } @Override public void setValueFloat(Float object) { row.setAttribute(column, object); } @Override public Integer getValueInteger() { return (Integer) row.getAttribute(column); } @Override public void setValueInteger(Integer object) { row.setAttribute(column, object); } @Override public Boolean getValueBoolean() { return (Boolean) row.getAttribute(column); } @Override public void setValueBoolean(Boolean object) { row.setAttribute(column, object); } @Override public Long getValueLong() { return (Long) row.getAttribute(column); } @Override public void setValueLong(Long object) { row.setAttribute(column, object); } @Override public String getValueAsString() { return convertToStringIfNotNull(); } @Override public void setValueAsString(String value) { row.setAttribute(column, AttributeUtils.parse(value, column.getTypeClass())); } }
Object value = row.getAttribute(column); if (value != null) { return AttributeUtils.print(value, currentTimeFormat, dateTimeZone); } else { return null; }
770
57
827
<no_super_class>
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/BusyUtils.java
BusyLabel
setBusy
class BusyLabel { private final JScrollPane scrollPane; private final JXBusyLabel busyLabel; private JComponent component; private BusyLabel(JScrollPane scrollpane, String text, JComponent component) { this.scrollPane = scrollpane; this.component = component; busyLabel = new JXBusyLabel(new Dimension(20, 20)); busyLabel.setText(text); busyLabel.setHorizontalAlignment(SwingConstants.CENTER); } public void setBusy(boolean busy) {<FILL_FUNCTION_BODY>} public void setBusy(boolean busy, JComponent component) { this.component = component; setBusy(busy); } }
if (busy) { if (scrollPane != null) { scrollPane.setViewportView(busyLabel); } busyLabel.setBusy(true); } else { busyLabel.setBusy(false); if (scrollPane != null) { scrollPane.setViewportView(component); } }
197
96
293
<no_super_class>
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/CloseButton.java
CloseButton
init
class CloseButton extends JButton { public CloseButton(Action a) { super(a); init(); } public CloseButton() { super(); init(); } private void init() {<FILL_FUNCTION_BODY>} @Override public void setAction(Action a) { super.setAction(a); init(); } }
if (UIUtils.isGTKLookAndFeel()) { setIcon( ImageUtilities.loadImageIcon("UIComponents/gtk_bigclose_enabled.png", false)); setRolloverIcon( ImageUtilities.loadImageIcon("UIComponents/gtk_bigclose_rollover.png", false)); setPressedIcon( ImageUtilities.loadImageIcon("UIComponents/gtk_bigclose_pressed.png", false)); } else if (UIUtils.isWindowsClassicLookAndFeel()) { setIcon( ImageUtilities.loadImageIcon("UIComponents/win_bigclose_enabled.png", false)); setRolloverIcon( ImageUtilities.loadImageIcon("UIComponents/win_bigclose_rollover.png", false)); setPressedIcon( ImageUtilities.loadImageIcon("UIComponents/win_bigclose_pressed.png", false)); } else if (UIUtils.isWindowsXPLookAndFeel()) { setIcon( ImageUtilities.loadImageIcon("UIComponents/xp_bigclose_enabled.png", false)); setRolloverIcon( ImageUtilities.loadImageIcon("UIComponents/xp_bigclose_rollover.png", false)); setPressedIcon( ImageUtilities.loadImageIcon("UIComponents/xp_bigclose_pressed.png", false)); } else if (UIUtils.isWindowsVistaLookAndFeel()) { setIcon( ImageUtilities.loadImageIcon("UIComponents/vista_bigclose_enabled.png", false)); setRolloverIcon(ImageUtilities.loadImageIcon("UIComponents/vista_bigclose_rollover.png", false)); setPressedIcon( ImageUtilities.loadImageIcon("UIComponents/vista_bigclose_pressed.png", false)); } else if (UIUtils.isAquaLookAndFeel()) { setIcon( ImageUtilities.loadImageIcon("UIComponents/mac_bigclose_enabled.png", false)); setRolloverIcon( ImageUtilities.loadImageIcon("UIComponents/mac_bigclose_rollover.png", false)); setPressedIcon( ImageUtilities.loadImageIcon("UIComponents/mac_bigclose_pressed.png", false)); } setText(""); setBorder(javax.swing.BorderFactory.createEmptyBorder()); setBorderPainted(false); setContentAreaFilled(false); setFocusable(false); setOpaque(false);
105
641
746
<methods>public void <init>() ,public void <init>(javax.swing.Icon) ,public void <init>(java.lang.String) ,public void <init>(javax.swing.Action) ,public void <init>(java.lang.String, javax.swing.Icon) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public java.lang.String getUIClassID() ,public boolean isDefaultButton() ,public boolean isDefaultCapable() ,public void removeNotify() ,public void setDefaultCapable(boolean) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/ColumnSelectionPanel.java
ColumnSelectionPanel
showColumnSelectionDialog
class ColumnSelectionPanel extends JPanel { private final Map<ColumnSelectionModel, JCheckBox> checkBoxes; public ColumnSelectionPanel(ColumnSelectionModel[] columns) { checkBoxes = new HashMap<>(); setLayout(new GridBagLayout()); init(columns); } public static void showColumnSelectionPopup(ColumnSelectionModel[] columns, Component c) { JPopupMenu popup = new JPopupMenu(); for (int col = 0; col < columns.length; col++) { final ColumnSelectionModel column = columns[col]; final JCheckBoxMenuItem checkBox = new JCheckBoxMenuItem(); checkBox.setText(column.getName()); checkBox.setSelected(column.isSelected()); checkBox.setEnabled(column.isEnabled()); checkBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { column.setSelected(checkBox.isSelected()); } }); popup.add(checkBox); } popup.show(c, 8, 8); } public static void showColumnSelectionDialog(ColumnSelectionModel[] columns, String dialogTitle) {<FILL_FUNCTION_BODY>} public void init(ColumnSelectionModel[] columns) { int i = 0; int j = 0; int width = 1; int rows = columns.length / width; for (int col = 0; col < columns.length; col++) { if (i >= rows) { i = 0; j++; } ColumnSelectionModel column = columns[col]; JCheckBox checkBox = new JCheckBox(); checkBox.setText(column.getName()); checkBox.setSelected(column.isSelected()); checkBox.setEnabled(column.isEnabled()); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = j; gridBagConstraints.gridy = i + i; gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 12); gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1; add(checkBox, gridBagConstraints); checkBoxes.put(column, checkBox); i++; } } private void applyDialogChanges() { for (Iterator<ColumnSelectionModel> it = checkBoxes.keySet().iterator(); it.hasNext(); ) { ColumnSelectionModel columnModel = it.next(); JCheckBox checkBox = checkBoxes.get(columnModel); columnModel.setSelected(checkBox.isSelected()); } } public interface ColumnSelectionModel { boolean isEnabled(); boolean isSelected(); void setSelected(boolean selected); String getName(); } }
ColumnSelectionPanel panel = new ColumnSelectionPanel(columns); int res = JOptionPane.showConfirmDialog(null, panel, dialogTitle, JOptionPane.OK_CANCEL_OPTION); if (res == JOptionPane.OK_OPTION) { panel.applyDialogChanges(); }
752
79
831
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/DecoratedIcon.java
DecoratedIcon
paintIcon
class DecoratedIcon implements Icon { private final Icon orig; private final Icon decoration; private final DecorationController decorationController; public DecoratedIcon(Icon orig, Icon decoration) { this.orig = orig; this.decoration = decoration; this.decorationController = null; } public DecoratedIcon(Icon orig, Icon decoration, DecorationController decorationController) { this.orig = orig; this.decoration = decoration; this.decorationController = decorationController; } @Override public void paintIcon(Component c, Graphics g, int x, int y) {<FILL_FUNCTION_BODY>} @Override public int getIconWidth() { return orig.getIconWidth(); } @Override public int getIconHeight() { return orig.getIconHeight(); } public interface DecorationController { boolean isDecorated(); } }
orig.paintIcon(c, g, x, y); if (decorationController == null || decorationController.isDecorated()) { decoration.paintIcon(c, g, x + orig.getIconWidth() - decoration.getIconWidth(), y); }
247
70
317
<no_super_class>
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/IconWithArrow.java
IconWithArrow
paintIcon
class IconWithArrow implements Icon { private static final String ARROW_IMAGE_NAME = "org/openide/awt/resources/arrow.png"; //NOI18N private static final int GAP = 6; private final Icon orig; private final Icon arrow = ImageUtilities.image2Icon(ImageUtilities.loadImage(ARROW_IMAGE_NAME, false)); private final boolean paintRollOver; public IconWithArrow(Icon orig, boolean paintRollOver) { this.orig = orig; this.paintRollOver = paintRollOver; } public static int getArrowAreaWidth() { return GAP / 2 + 5; } @Override public void paintIcon(Component c, Graphics g, int x, int y) {<FILL_FUNCTION_BODY>} @Override public int getIconWidth() { return orig.getIconWidth() + GAP + arrow.getIconWidth(); } @Override public int getIconHeight() { return Math.max(orig.getIconHeight(), arrow.getIconHeight()); } }
int height = getIconHeight(); orig.paintIcon(c, g, x, y + (height - orig.getIconHeight()) / 2); arrow.paintIcon(c, g, x + GAP + orig.getIconWidth(), y + (height - arrow.getIconHeight()) / 2); if (paintRollOver) { Color brighter = UIManager.getColor("controlHighlight"); //NOI18N Color darker = UIManager.getColor("controlShadow"); //NOI18N if (null == brighter || null == darker) { brighter = c.getBackground().brighter(); darker = c.getBackground().darker(); } if (null != brighter && null != darker) { g.setColor(brighter); g.drawLine(x + orig.getIconWidth() + 1, y, x + orig.getIconWidth() + 1, y + getIconHeight()); g.setColor(darker); g.drawLine(x + orig.getIconWidth() + 2, y, x + orig.getIconWidth() + 2, y + getIconHeight()); } }
292
305
597
<no_super_class>
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/JColorBlackWhiteSwitcher.java
JColorBlackWhiteSwitcher
refreshIcon
class JColorBlackWhiteSwitcher extends JButton { private final static int ICON_WIDTH = 16; private final static int ICON_HEIGHT = 16; private final static Color DISABLED_BORDER = new Color(200, 200, 200); private final static Color DISABLED_FILL = new Color(220, 220, 220); public static String EVENT_COLOR = "color"; private Color color; private boolean includeOpacity; public JColorBlackWhiteSwitcher(Color color) { this(color, false); } public JColorBlackWhiteSwitcher(Color originalColor, boolean includeOpacity) { this.includeOpacity = includeOpacity; this.color = originalColor; refreshIcon(); /** * Right click action: choose color */ addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { Color newColor = ColorPicker.showDialog(WindowManager.getDefault().getMainWindow(), color, JColorBlackWhiteSwitcher.this.includeOpacity); if (newColor != null) { setColor(newColor); } } } }); /** * Left click action: switch between white and black */ addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (!color.equals(Color.BLACK) && !color.equals(Color.WHITE)) { //Color is not white or black. Set to white to be swithed un future clicks setColor(Color.WHITE); } else { setColor(new Color(0xffffff - color.getRGB()));//switch black-white } } }); } private void refreshIcon() {<FILL_FUNCTION_BODY>} public Color getColor() { return color; } public void setColor(Color color) { if (color != this.color || (color != null && !color.equals(this.color))) { Color oldColor = this.color; this.color = color; firePropertyChange(EVENT_COLOR, oldColor, color); refreshIcon(); repaint(); } } public float[] getColorArray() { return new float[] {color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f}; } public void setIncludeOpacity(boolean includeOpacity) { this.includeOpacity = includeOpacity; } class ColorIcon implements Icon { @Override public int getIconWidth() { return ICON_WIDTH; } @Override public int getIconHeight() { return ICON_HEIGHT; } @Override public void paintIcon(Component c, Graphics g, int x, int y) { if (c.isEnabled()) { g.setColor(Color.BLACK); g.drawRect(x + 2, y + 2, ICON_WIDTH - 5, ICON_HEIGHT - 5); if (color != null) { g.setColor(color); g.fillRect(x + 3, y + 3, ICON_WIDTH - 6, ICON_HEIGHT - 6); } } else { g.setColor(DISABLED_BORDER); g.drawRect(x + 2, y + 2, ICON_WIDTH - 5, ICON_HEIGHT - 5); g.setColor(DISABLED_FILL); g.fillRect(x + 3, y + 3, ICON_WIDTH - 6, ICON_HEIGHT - 6); } } } }
if (color.equals(Color.WHITE)) {//White color, show a lightbulb on: setIcon(ImageUtilities.loadImageIcon("UIComponents/light-bulb.png", false)); } else if (color.equals(Color.BLACK)) {//Black color, show a lightbulb off: setIcon(ImageUtilities.loadImageIcon("UIComponents/light-bulb-off.png", false)); } else { setIcon(new ColorIcon());//Other color, show the color in a square as the icon }
1,014
139
1,153
<methods>public void <init>() ,public void <init>(javax.swing.Icon) ,public void <init>(java.lang.String) ,public void <init>(javax.swing.Action) ,public void <init>(java.lang.String, javax.swing.Icon) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public java.lang.String getUIClassID() ,public boolean isDefaultButton() ,public boolean isDefaultCapable() ,public void removeNotify() ,public void setDefaultCapable(boolean) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/JColorButton.java
JColorButton
paintIcon
class JColorButton extends JButton { private final static int ICON_WIDTH = 16; private final static int ICON_HEIGHT = 16; private final static Color DISABLED_BORDER = new Color(200, 200, 200); private final static Color DISABLED_FILL = new Color(220, 220, 220); public static String EVENT_COLOR = "color"; private Color color; private boolean includeOpacity; public JColorButton(Color originalColor) { this(originalColor, false, false); } public JColorButton(Color originalColor, boolean rightClick, boolean includeOpacity) { this.includeOpacity = includeOpacity; this.color = originalColor; setIcon(new Icon() { @Override public int getIconWidth() { return ICON_WIDTH; } @Override public int getIconHeight() { return ICON_HEIGHT; } @Override public void paintIcon(Component c, Graphics g, int x, int y) {<FILL_FUNCTION_BODY>} }); if (rightClick) { addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (SwingUtilities.isRightMouseButton(e)) { Color newColor = ColorPicker.showDialog(WindowManager.getDefault().getMainWindow(), color, JColorButton.this.includeOpacity); if (newColor != null) { setColor(newColor); } } } }); } else { addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color newColor = ColorPicker.showDialog(WindowManager.getDefault().getMainWindow(), color, JColorButton.this.includeOpacity); if (newColor != null) { setColor(newColor); } } }); } } public Color getColor() { return color; } public void setColor(Color color) { if (color != this.color || (color != null && !color.equals(this.color))) { Color oldColor = this.color; this.color = color; firePropertyChange(EVENT_COLOR, oldColor, color); repaint(); } } public float[] getColorArray() { return new float[] {color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f}; } public void setIncludeOpacity(boolean includeOpacity) { this.includeOpacity = includeOpacity; } }
if (c.isEnabled()) { g.setColor(Color.BLACK); g.drawRect(x + 2, y + 2, ICON_WIDTH - 5, ICON_HEIGHT - 5); if (color != null) { g.setColor(color); g.fillRect(x + 3, y + 3, ICON_WIDTH - 6, ICON_HEIGHT - 6); } } else { g.setColor(DISABLED_BORDER); g.drawRect(x + 2, y + 2, ICON_WIDTH - 5, ICON_HEIGHT - 5); g.setColor(DISABLED_FILL); g.fillRect(x + 3, y + 3, ICON_WIDTH - 6, ICON_HEIGHT - 6); }
733
216
949
<methods>public void <init>() ,public void <init>(javax.swing.Icon) ,public void <init>(java.lang.String) ,public void <init>(javax.swing.Action) ,public void <init>(java.lang.String, javax.swing.Icon) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public java.lang.String getUIClassID() ,public boolean isDefaultButton() ,public boolean isDefaultCapable() ,public void removeNotify() ,public void setDefaultCapable(boolean) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/JImagePanel.java
JImagePanel
setPreferredBackground
class JImagePanel extends JPanel { //~ Static fields/initializers ----------------------------------------------------------------------------------------------- private static final MediaTracker mTracker = new MediaTracker(new JPanel()); //~ Instance fields ---------------------------------------------------------------------------------------------------------- private Image image; private int imageAlign; // Use SwingConstants.TOP, BOTTOM (LEFT & RIGHT not implemented) //~ Constructors ------------------------------------------------------------------------------------------------------------- public JImagePanel(Image image) { this(image, SwingConstants.TOP); } public JImagePanel(Image image, int imageAlign) { setImage(image); setImageAlign(imageAlign); } protected static Image loadImage(Image image) { mTracker.addImage(image, 0); try { mTracker.waitForID(0); } catch (InterruptedException e) { return null; } mTracker.removeImage(image, 0); return image; } //~ Methods ------------------------------------------------------------------------------------------------------------------ public void setImage(Image image) { this.image = loadImage(image); if (this.image == null) { throw new RuntimeException("JImagePanel failed to load image"); // NOI18N } setPreferredBackground(); setPreferredSize(new Dimension(this.image.getWidth(null), this.image.getHeight(null))); refresh(); } public void setImageAlign(int imageAlign) { this.imageAlign = imageAlign; setPreferredBackground(); refresh(); } protected void setPreferredBackground() {<FILL_FUNCTION_BODY>} @Override protected void paintComponent(Graphics graphics) { graphics.setColor(getBackground()); graphics.fillRect(0, 0, getWidth(), getHeight()); switch (imageAlign) { case (SwingConstants.TOP): graphics.drawImage(image, (getWidth() - image.getWidth(null)) / 2, 0, this); break; case (SwingConstants.BOTTOM): graphics.drawImage(image, (getWidth() - image.getWidth(null)) / 2, getHeight() - image.getHeight(null), this); break; default: graphics.drawImage(image, (getWidth() - image.getWidth(null)) / 2, 0, this); } } private void refresh() { if (isShowing()) { invalidate(); repaint(); } } }
int[] pixels = new int[1]; PixelGrabber pg = null; switch (imageAlign) { case (SwingConstants.TOP): pg = new PixelGrabber(image, 0, image.getHeight(null) - 1, 1, 1, pixels, 0, 1); break; case (SwingConstants.BOTTOM): pg = new PixelGrabber(image, 0, 0, 1, 1, pixels, 0, 1); break; default: pg = new PixelGrabber(image, 0, image.getHeight(null) - 1, 1, 1, pixels, 0, 1); } try { if ((pg != null) && pg.grabPixels()) { setBackground(new Color(pixels[0])); } } catch (InterruptedException e) { }
664
247
911
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/JMenuToggleButton.java
LineIcon
paintIcon
class LineIcon implements Icon { private final Icon origIcon; private final int arrowWidth; public LineIcon(Icon origIcon, int arrowWidth) { this.origIcon = origIcon; this.arrowWidth = arrowWidth; } @Override public void paintIcon(Component c, Graphics g, int x, int y) {<FILL_FUNCTION_BODY>} @Override public int getIconWidth() { return origIcon.getIconWidth(); } @Override public int getIconHeight() { return origIcon.getIconHeight(); } }
origIcon.paintIcon(c, g, x, y); g.setColor(UIManager.getColor("controlHighlight")); //NOI18N g.drawLine(x + origIcon.getIconWidth() - arrowWidth - 2, y, x + origIcon.getIconWidth() - arrowWidth - 2, y + getIconHeight()); g.setColor(UIManager.getColor("controlShadow")); //NOI18N g.drawLine(x + origIcon.getIconWidth() - arrowWidth - 3, y, x + origIcon.getIconWidth() - arrowWidth - 3, y + getIconHeight());
159
169
328
<methods>public void <init>() ,public void <init>(javax.swing.Icon) ,public void <init>(java.lang.String) ,public void <init>(javax.swing.Action) ,public void <init>(javax.swing.Icon, boolean) ,public void <init>(java.lang.String, boolean) ,public void <init>(java.lang.String, javax.swing.Icon) ,public void <init>(java.lang.String, javax.swing.Icon, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public java.lang.String getUIClassID() ,public void requestFocus(java.awt.event.FocusEvent.Cause) ,public boolean requestFocusInWindow(java.awt.event.FocusEvent.Cause) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/JPopupButton.java
JPopupButton
setSelectedItem
class JPopupButton extends JButton { private final ArrayList<JPopupButtonItem> items; private JPopupButtonItem selectedItem; private ChangeListener listener; public JPopupButton() { items = new ArrayList<>(); addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JPopupMenu menu = createPopup(); menu.show(JPopupButton.this, 0, getHeight()); } }); } public JPopupMenu createPopup() { JPopupMenu menu = new JPopupMenu(); for (final JPopupButtonItem item : items) { JRadioButtonMenuItem r = new JRadioButtonMenuItem(item.object.toString(), item.icon, item == selectedItem); r.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (item != selectedItem) { selectedItem = item; fireChangeEvent(); } } }); menu.add(r); } return menu; } public void addItem(Object object, Icon icon) { items.add(new JPopupButtonItem(object, icon)); } public Object getSelectedItem() { return selectedItem.object; } public void setSelectedItem(Object item) {<FILL_FUNCTION_BODY>} public void setChangeListener(ChangeListener changeListener) { listener = changeListener; } private void fireChangeEvent() { if (listener != null) { listener.stateChanged(new ChangeEvent(selectedItem.object)); } } private class JPopupButtonItem { private final Object object; private final Icon icon; public JPopupButtonItem(Object object, Icon icon) { this.object = object; this.icon = icon; } } }
for (JPopupButtonItem i : items) { if (i.object == item) { selectedItem = i; return; } } throw new IllegalArgumentException("This elemen doesn't exist.");
508
60
568
<methods>public void <init>() ,public void <init>(javax.swing.Icon) ,public void <init>(java.lang.String) ,public void <init>(javax.swing.Action) ,public void <init>(java.lang.String, javax.swing.Icon) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public java.lang.String getUIClassID() ,public boolean isDefaultButton() ,public boolean isDefaultCapable() ,public void removeNotify() ,public void setDefaultCapable(boolean) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/JPopupPane.java
HideAWTListener
eventDispatched
class HideAWTListener extends ComponentAdapter implements AWTEventListener, WindowStateListener { @Override public void eventDispatched(java.awt.AWTEvent aWTEvent) {<FILL_FUNCTION_BODY>} @Override public void windowStateChanged(WindowEvent windowEvent) { if (showingPopup) { int oldState = windowEvent.getOldState(); int newState = windowEvent.getNewState(); if (((oldState & Frame.ICONIFIED) == 0) && ((newState & Frame.ICONIFIED) == Frame.ICONIFIED)) { hidePopup(); // } else if (((oldState & Frame.ICONIFIED) == Frame.ICONIFIED) && // ((newState & Frame.ICONIFIED) == 0 )) { // //TODO remember we showed before and show again? I guess not worth the efford, not part of spec. } } } @Override public void componentResized(ComponentEvent evt) { if (showingPopup) { resizePopup(); } } @Override public void componentMoved(ComponentEvent evt) { if (showingPopup) { resizePopup(); } } }
if (aWTEvent instanceof MouseEvent) { MouseEvent mv = (MouseEvent) aWTEvent; if (mv.getClickCount() > 0) { if (!(aWTEvent.getSource() instanceof Component)) { return; } Component comp = (Component) aWTEvent.getSource(); Container par = SwingUtilities.getAncestorNamed("jpopuppane", comp); //NOI18N Container barpar = SwingUtilities.getAncestorOfClass(ancestor.getClass(), comp); if (par == null && barpar == null) { hidePopup(); } } }
330
176
506
<no_super_class>
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/JRangeSlider.java
RangeTrackListener
mousePressed
class RangeTrackListener extends TrackListener { @Override public void mousePressed(MouseEvent e) {<FILL_FUNCTION_BODY>} @Override public void mouseReleased(MouseEvent e) { lowerDragging = false; upperDragging = false; slider.setValueIsAdjusting(false); super.mouseReleased(e); } @Override public void mouseDragged(MouseEvent e) { if (!slider.isEnabled()) { return; } currentMouseX = e.getX(); currentMouseY = e.getY(); if (lowerDragging) { slider.setValueIsAdjusting(true); moveLowerThumb(); } else if (upperDragging) { slider.setValueIsAdjusting(true); moveUpperThumb(); } } @Override public boolean shouldScroll(int direction) { return false; } /** * Moves the location of the lower thumb, and sets its corresponding * value in the slider. */ private void moveLowerThumb() { int thumbMiddle = 0; switch (slider.getOrientation()) { case JSlider.VERTICAL: int halfThumbHeight = thumbRect.height / 2; int thumbTop = currentMouseY - offset; int trackTop = trackRect.y; int trackBottom = trackRect.y + (trackRect.height - 1); int vMax = yPositionForValue(slider.getValue() + slider.getExtent()); // Apply bounds to thumb position. if (drawInverted()) { trackBottom = vMax; } else { trackTop = vMax; } thumbTop = Math.max(thumbTop, trackTop - halfThumbHeight); thumbTop = Math.min(thumbTop, trackBottom - halfThumbHeight); setThumbLocation(thumbRect.x, thumbTop); // Update slider value. thumbMiddle = thumbTop + halfThumbHeight; slider.setValue(valueForYPosition(thumbMiddle)); break; case JSlider.HORIZONTAL: int halfThumbWidth = thumbRect.width / 2; int thumbLeft = currentMouseX - offset; int trackLeft = trackRect.x; int trackRight = trackRect.x + (trackRect.width - 1); int hMax = xPositionForValue(slider.getValue() + slider.getExtent()); // Apply bounds to thumb position. if (drawInverted()) { trackLeft = hMax; } else { trackRight = hMax; } thumbLeft = Math.max(thumbLeft, trackLeft - halfThumbWidth); thumbLeft = Math.min(thumbLeft, trackRight - halfThumbWidth); setThumbLocation(thumbLeft, thumbRect.y); // Update slider value. thumbMiddle = thumbLeft + halfThumbWidth; slider.setValue(valueForXPosition(thumbMiddle)); break; default: return; } } /** * Moves the location of the upper thumb, and sets its corresponding * value in the slider. */ private void moveUpperThumb() { int thumbMiddle = 0; switch (slider.getOrientation()) { case JSlider.VERTICAL: int halfThumbHeight = thumbRect.height / 2; int thumbTop = currentMouseY - offset; int trackTop = trackRect.y; int trackBottom = trackRect.y + (trackRect.height - 1); int vMin = yPositionForValue(slider.getValue()); // Apply bounds to thumb position. if (drawInverted()) { trackTop = vMin; } else { trackBottom = vMin; } thumbTop = Math.max(thumbTop, trackTop - halfThumbHeight); thumbTop = Math.min(thumbTop, trackBottom - halfThumbHeight); setUpperThumbLocation(thumbRect.x, thumbTop); // Update slider extent. thumbMiddle = thumbTop + halfThumbHeight; slider.setExtent(valueForYPosition(thumbMiddle) - slider.getValue()); break; case JSlider.HORIZONTAL: int halfThumbWidth = thumbRect.width / 2; int thumbLeft = currentMouseX - offset; int trackLeft = trackRect.x; int trackRight = trackRect.x + (trackRect.width - 1); int hMin = xPositionForValue(slider.getValue()); // Apply bounds to thumb position. if (drawInverted()) { trackRight = hMin; } else { trackLeft = hMin; } thumbLeft = Math.max(thumbLeft, trackLeft - halfThumbWidth); thumbLeft = Math.min(thumbLeft, trackRight - halfThumbWidth); setUpperThumbLocation(thumbLeft, thumbRect.y); // Update slider extent. thumbMiddle = thumbLeft + halfThumbWidth; slider.setExtent(valueForXPosition(thumbMiddle) - slider.getValue()); break; default: return; } } }
if (!slider.isEnabled()) { return; } currentMouseX = e.getX(); currentMouseY = e.getY(); if (slider.isRequestFocusEnabled()) { slider.requestFocus(); } // Determine which thumb is pressed. If the upper thumb is // selected (last one dragged), then check its position first; // otherwise check the position of the lower thumb first. boolean lowerPressed = false; boolean upperPressed = false; if (upperThumbSelected) { if (upperThumbRect.contains(currentMouseX, currentMouseY)) { upperPressed = true; } else if (thumbRect.contains(currentMouseX, currentMouseY)) { lowerPressed = true; } } else { if (thumbRect.contains(currentMouseX, currentMouseY)) { lowerPressed = true; } else if (upperThumbRect.contains(currentMouseX, currentMouseY)) { upperPressed = true; } } // Handle lower thumb pressed. if (lowerPressed) { switch (slider.getOrientation()) { case JSlider.VERTICAL: offset = currentMouseY - thumbRect.y; break; case JSlider.HORIZONTAL: offset = currentMouseX - thumbRect.x; break; } upperThumbSelected = false; lowerDragging = true; return; } lowerDragging = false; // Handle upper thumb pressed. if (upperPressed) { switch (slider.getOrientation()) { case JSlider.VERTICAL: offset = currentMouseY - upperThumbRect.y; break; case JSlider.HORIZONTAL: offset = currentMouseX - upperThumbRect.x; break; } upperThumbSelected = true; upperDragging = true; return; } upperDragging = false;
1,374
518
1,892
<methods>public void <init>() ,public void <init>(int) ,public void <init>(javax.swing.BoundedRangeModel) ,public void <init>(int, int) ,public void <init>(int, int, int) ,public void <init>(int, int, int, int) ,public void addChangeListener(javax.swing.event.ChangeListener) ,public Hashtable<java.lang.Integer,javax.swing.JComponent> createStandardLabels(int) ,public Hashtable<java.lang.Integer,javax.swing.JComponent> createStandardLabels(int, int) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.event.ChangeListener[] getChangeListeners() ,public int getExtent() ,public boolean getInverted() ,public Dictionary#RAW getLabelTable() ,public int getMajorTickSpacing() ,public int getMaximum() ,public int getMinimum() ,public int getMinorTickSpacing() ,public javax.swing.BoundedRangeModel getModel() ,public int getOrientation() ,public boolean getPaintLabels() ,public boolean getPaintTicks() ,public boolean getPaintTrack() ,public boolean getSnapToTicks() ,public javax.swing.plaf.SliderUI getUI() ,public java.lang.String getUIClassID() ,public int getValue() ,public boolean getValueIsAdjusting() ,public boolean imageUpdate(java.awt.Image, int, int, int, int, int) ,public void removeChangeListener(javax.swing.event.ChangeListener) ,public void setExtent(int) ,public void setFont(java.awt.Font) ,public void setInverted(boolean) ,public void setLabelTable(Dictionary#RAW) ,public void setMajorTickSpacing(int) ,public void setMaximum(int) ,public void setMinimum(int) ,public void setMinorTickSpacing(int) ,public void setModel(javax.swing.BoundedRangeModel) ,public void setOrientation(int) ,public void setPaintLabels(boolean) ,public void setPaintTicks(boolean) ,public void setPaintTrack(boolean) ,public void setSnapToTicks(boolean) ,public void setUI(javax.swing.plaf.SliderUI) ,public void setValue(int) ,public void setValueIsAdjusting(boolean) ,public void updateUI() <variables>protected transient javax.swing.event.ChangeEvent changeEvent,protected javax.swing.event.ChangeListener changeListener,private boolean isInverted,private Dictionary#RAW labelTable,protected int majorTickSpacing,protected int minorTickSpacing,protected int orientation,private boolean paintLabels,private boolean paintTicks,private boolean paintTrack,protected javax.swing.BoundedRangeModel sliderModel,protected boolean snapToTicks,boolean snapToValue,private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/JSqueezeBoxPanel.java
VerticalLayout
minimumLayoutSize
class VerticalLayout implements LayoutManager { //~ Methods -------------------------------------------------------------------------------------------------------------- @Override public void addLayoutComponent(final String name, final Component comp) { } @Override public void layoutContainer(final Container parent) { final Insets insets = parent.getInsets(); final int posX = insets.left; int posY = insets.top; final int width = parent.getWidth() - insets.left - insets.right; final Component[] comps = parent.getComponents(); for (int i = 0; i < comps.length; i++) { final Component comp = comps[i]; if (comp.isVisible()) { int height = comp.getPreferredSize().height; if (i == (comps.length - 1)) // last component { if ((posY + height) < (parent.getHeight() - insets.bottom)) { height = parent.getHeight() - insets.bottom - posY; } } comp.setBounds(posX, posY, width, height); posY += height; } } } @Override public Dimension minimumLayoutSize(final Container parent) {<FILL_FUNCTION_BODY>} @Override public Dimension preferredLayoutSize(final Container parent) { final Dimension d = new Dimension(parent.getInsets().left + parent.getInsets().right, parent.getInsets().top + parent.getInsets().bottom); int maxWidth = 0; int height = 0; final Component[] comps = parent.getComponents(); for (int i = 0; i < comps.length; i++) { final Component comp = comps[i]; if (comp.isVisible()) { final Dimension size = comp.getPreferredSize(); maxWidth = Math.max(maxWidth, size.width); height += size.height; } } d.width += maxWidth; d.height += height; return d; } @Override public void removeLayoutComponent(final Component comp) { } }
final Dimension d = new Dimension(parent.getInsets().left + parent.getInsets().right, parent.getInsets().top + parent.getInsets().bottom); int maxWidth = 0; int height = 0; final Component[] comps = parent.getComponents(); for (int i = 0; i < comps.length; i++) { final Component comp = comps[i]; if (comp.isVisible()) { final Dimension size = comp.getMinimumSize(); maxWidth = Math.max(maxWidth, size.width); height += size.height; } } d.width += maxWidth; d.height += height; return d;
560
188
748
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/PaletteIcon.java
PaletteIcon
paintIcon
class PaletteIcon implements Icon { private static final int COLOR_WIDTH = 13; private static final int COLOR_HEIGHT = 13; private static final Color BORDER_COLOR = new Color(0x444444); private final Color[] colors; private final int maxColors; public PaletteIcon(Color[] colors) { this(colors, colors.length); } public PaletteIcon(Color[] colors, int maxColors) { this.colors = colors; this.maxColors = Math.min(maxColors, colors.length); } @Override public int getIconWidth() { return COLOR_WIDTH * maxColors; } @Override public int getIconHeight() { return COLOR_HEIGHT + 2; } @Override public void paintIcon(Component c, Graphics g, int x, int y) {<FILL_FUNCTION_BODY>} }
Graphics2D g2 = (Graphics2D) g; g2.setStroke(new BasicStroke(1)); for (int i = 0; i < maxColors; i++) { g2.setColor(colors[i]); g2.fillRect(x + 2 + i * COLOR_WIDTH, y, COLOR_WIDTH, COLOR_HEIGHT); g2.setColor(BORDER_COLOR); g2.drawRect(x + 2 + i * COLOR_WIDTH, y, COLOR_WIDTH, COLOR_HEIGHT); }
254
151
405
<no_super_class>
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/WrapLayout.java
WrapLayout
layoutContainer
class WrapLayout extends FlowLayout { private Dimension preferredLayoutSize; /** * Constructs a new <code>WrapLayout</code> with a left * alignment and a default 5-unit horizontal and vertical gap. */ public WrapLayout() { super(); } /** * Constructs a new <code>FlowLayout</code> with the specified * alignment and a default 5-unit horizontal and vertical gap. * The value of the alignment argument must be one of * <code>WrapLayout</code>, <code>WrapLayout</code>, * or <code>WrapLayout</code>. * * @param align the alignment value */ public WrapLayout(int align) { super(align); } /** * Creates a new flow layout manager with the indicated alignment * and the indicated horizontal and vertical gaps. * <p> * The value of the alignment argument must be one of * <code>WrapLayout</code>, <code>WrapLayout</code>, * or <code>WrapLayout</code>. * * @param align the alignment value * @param hgap the horizontal gap between components * @param vgap the vertical gap between components */ public WrapLayout(int align, int hgap, int vgap) { super(align, hgap, vgap); } /** * Returns the preferred dimensions for this layout given the * <i>visible</i> components in the specified target container. * * @param target the component which needs to be laid out * @return the preferred dimensions to lay out the * subcomponents of the specified container */ @Override public Dimension preferredLayoutSize(Container target) { return layoutSize(target, true); } /** * Returns the minimum dimensions needed to layout the <i>visible</i> * components contained in the specified target container. * * @param target the component which needs to be laid out * @return the minimum dimensions to lay out the * subcomponents of the specified container */ @Override public Dimension minimumLayoutSize(Container target) { return layoutSize(target, false); } /** * Returns the minimum or preferred dimension needed to layout the target * container. * * @param target target to get layout size for * @param preferred should preferred size be calculated * @return the dimension to layout the target container */ private Dimension layoutSize(Container target, boolean preferred) { synchronized (target.getTreeLock()) { // Each row must fit with the width allocated to the containter. // When the container width = 0, the preferred width of the container // has not yet been calculated so lets ask for the maximum. int targetWidth = target.getSize().width; if (targetWidth == 0) { targetWidth = Integer.MAX_VALUE; } int hgap = getHgap(); int vgap = getVgap(); Insets insets = target.getInsets(); int horizontalInsetsAndGap = insets.left + insets.right + (hgap * 2); int maxWidth = targetWidth - horizontalInsetsAndGap; // Fit components into the allowed width Dimension dim = new Dimension(0, 0); int rowWidth = 0; int rowHeight = 0; int nmembers = target.getComponentCount(); for (int i = 0; i < nmembers; i++) { Component m = target.getComponent(i); if (m.isVisible()) { Dimension d = preferred ? m.getPreferredSize() : m.getMinimumSize(); // Can't add the component to current row. Start a new row. if (rowWidth + d.width > maxWidth) { addRow(dim, rowWidth, rowHeight); rowWidth = 0; rowHeight = 0; } // Add a horizontal gap for all components after the first if (rowWidth != 0) { rowWidth += hgap; } rowWidth += d.width; rowHeight = Math.max(rowHeight, d.height); } } addRow(dim, rowWidth, rowHeight); dim.width += horizontalInsetsAndGap; dim.height += insets.top + insets.bottom + vgap * 2; //When using a scroll pane or the DecoratedLookAndFeel we need to //make sure the preferred size is less than the size of the //target containter so shrinking the container size works //correctly. Removing the horizontal gap is an easy way to do this. dim.width -= (hgap + 1); return dim; } } /** * Layout the components in the Container using the layout logic of the * parent FlowLayout class. * * @param target the Container using this WrapLayout */ @Override public void layoutContainer(Container target) {<FILL_FUNCTION_BODY>} /* * A new row has been completed. Use the dimensions of this row * to update the preferred size for the container. * * @param dim update the width and height when appropriate * @param rowWidth the width of the row to add * @param rowHeight the height of the row to add */ private void addRow(Dimension dim, int rowWidth, int rowHeight) { dim.width = Math.max(dim.width, rowWidth); if (dim.height > 0) { dim.height += getVgap(); } dim.height += rowHeight; } }
Dimension size = preferredLayoutSize(target); // When a frame is minimized or maximized the preferred size of the // Container is assumed not to change. Therefore we need to force a // validate() to make sure that space, if available, is allocated to // the panel using a WrapLayout. if (size.equals(preferredLayoutSize)) { super.layoutContainer(target); } else { preferredLayoutSize = size; Container top = target; while (top.getParent() != null) { top = top.getParent(); } top.validate(); }
1,466
164
1,630
<methods>public void <init>() ,public void <init>(int) ,public void <init>(int, int, int) ,public void addLayoutComponent(java.lang.String, java.awt.Component) ,public boolean getAlignOnBaseline() ,public int getAlignment() ,public int getHgap() ,public int getVgap() ,public void layoutContainer(java.awt.Container) ,public java.awt.Dimension minimumLayoutSize(java.awt.Container) ,public java.awt.Dimension preferredLayoutSize(java.awt.Container) ,public void removeLayoutComponent(java.awt.Component) ,public void setAlignOnBaseline(boolean) ,public void setAlignment(int) ,public void setHgap(int) ,public void setVgap(int) ,public java.lang.String toString() <variables>public static final int CENTER,public static final int LEADING,public static final int LEFT,public static final int RIGHT,public static final int TRAILING,int align,private boolean alignOnBaseline,private static final int currentSerialVersion,int hgap,int newAlign,private int serialVersionOnStream,private static final long serialVersionUID,int vgap
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/gradientslider/PaintUtils.java
PaintUtils
paintFocus
class PaintUtils { /** * Four shades of white, each with increasing opacity. */ public final static Color[] whites = new Color[] { new Color(255, 255, 255, 50), new Color(255, 255, 255, 100), new Color(255, 255, 255, 150) }; /** * Four shades of black, each with increasing opacity. */ public final static Color[] blacks = new Color[] { new Color(0, 0, 0, 50), new Color(0, 0, 0, 100), new Color(0, 0, 0, 150) }; /** * @return the color used to indicate when a component has * focus. By default this uses the color (64,113,167), but you can * override this by calling: * <BR><code>UIManager.put("focusRing",customColor);</code> */ public static Color getFocusRingColor() { Object obj = UIManager.getColor("focusRing"); if (obj instanceof Color) { return (Color) obj; } return new Color(64, 113, 167); } /** * Paints 3 different strokes around a shape to indicate focus. * The widest stroke is the most transparent, so this achieves a nice * "glow" effect. * <P>The catch is that you have to render this underneath the shape, * and the shape should be filled completely. * * @param g the graphics to paint to * @param shape the shape to outline * @param biggestStroke the widest stroke to use. */ public static void paintFocus(Graphics2D g, Shape shape, int biggestStroke) {<FILL_FUNCTION_BODY>} /** * Uses translucent shades of white and black to draw highlights * and shadows around a rectangle, and then frames the rectangle * with a shade of gray (120). * <P>This should be called to add a finishing touch on top of * existing graphics. * * @param g the graphics to paint to. * @param r the rectangle to paint. */ public static void drawBevel(Graphics g, Rectangle r) { drawColors(blacks, g, r.x, r.y + r.height, r.x + r.width, r.y + r.height, SwingConstants.SOUTH); drawColors(blacks, g, r.x + r.width, r.y, r.x + r.width, r.y + r.height, SwingConstants.EAST); drawColors(whites, g, r.x, r.y, r.x + r.width, r.y, SwingConstants.NORTH); drawColors(whites, g, r.x, r.y, r.x, r.y + r.height, SwingConstants.WEST); g.setColor(new Color(120, 120, 120)); g.drawRect(r.x, r.y, r.width, r.height); } private static void drawColors(Color[] colors, Graphics g, int x1, int y1, int x2, int y2, int direction) { for (int a = 0; a < colors.length; a++) { g.setColor(colors[colors.length - a - 1]); if (direction == SwingConstants.SOUTH) { g.drawLine(x1, y1 - a, x2, y2 - a); } else if (direction == SwingConstants.NORTH) { g.drawLine(x1, y1 + a, x2, y2 + a); } else if (direction == SwingConstants.EAST) { g.drawLine(x1 - a, y1, x2 - a, y2); } else if (direction == SwingConstants.WEST) { g.drawLine(x1 + a, y1, x2 + a, y2); } } } }
Color focusColor = getFocusRingColor(); Color[] focusArray = new Color[] { new Color(focusColor.getRed(), focusColor.getGreen(), focusColor.getBlue(), 255), new Color(focusColor.getRed(), focusColor.getGreen(), focusColor.getBlue(), 170), new Color(focusColor.getRed(), focusColor.getGreen(), focusColor.getBlue(), 110) }; g.setStroke(new BasicStroke(biggestStroke)); g.setColor(focusArray[2]); g.draw(shape); g.setStroke(new BasicStroke(biggestStroke - 1)); g.setColor(focusArray[1]); g.draw(shape); g.setStroke(new BasicStroke(biggestStroke - 2)); g.setColor(focusArray[0]); g.draw(shape); g.setStroke(new BasicStroke(1));
1,093
248
1,341
<no_super_class>
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/richtooltip/JRichTooltipPanel.java
JRichTooltipPanel
updateUI
class JRichTooltipPanel extends JPanel { /** * @see #getUIClassID */ public static final String uiClassID = "RichTooltipPanelUI"; protected RichTooltip tooltipInfo; public JRichTooltipPanel(RichTooltip tooltipInfo) { this.tooltipInfo = tooltipInfo; } /* * (non-Javadoc) * * @see javax.swing.JPanel#getUI() */ @Override public RichTooltipPanelUI getUI() { return (RichTooltipPanelUI) ui; } /** * Sets the look and feel (L&amp;F) object that renders this component. * * @param ui The UI delegate. */ protected void setUI(RichTooltipPanelUI ui) { super.setUI(ui); } /* * (non-Javadoc) * * @see javax.swing.JPanel#getUIClassID() */ @Override public String getUIClassID() { return uiClassID; } /* * (non-Javadoc) * * @see javax.swing.JPanel#updateUI() */ @Override public void updateUI() {<FILL_FUNCTION_BODY>} public RichTooltip getTooltipInfo() { return tooltipInfo; } }
if (UIManager.get(getUIClassID()) != null) { setUI((RichTooltipPanelUI) UIManager.getUI(this)); } else { setUI(BasicRichTooltipPanelUI.createUI(this)); }
368
70
438
<methods>public void <init>() ,public void <init>(java.awt.LayoutManager) ,public void <init>(boolean) ,public void <init>(java.awt.LayoutManager, boolean) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public javax.swing.plaf.PanelUI getUI() ,public java.lang.String getUIClassID() ,public void setUI(javax.swing.plaf.PanelUI) ,public void updateUI() <variables>private static final java.lang.String uiClassID
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/splineeditor/Java2dHelper.java
Java2dHelper
createCompatibleImage
class Java2dHelper { public static BufferedImage createCompatibleImage(int width, int height) {<FILL_FUNCTION_BODY>} public static BufferedImage loadCompatibleImage(URL resource) throws IOException { BufferedImage image = ImageIO.read(resource); BufferedImage compatibleImage = createCompatibleImage(image.getWidth(), image.getHeight()); Graphics g = compatibleImage.getGraphics(); g.drawImage(image, 0, 0, null); g.dispose(); image = null; return compatibleImage; } public static BufferedImage createThumbnail(BufferedImage image, int requestedThumbSize) { float ratio = (float) image.getWidth() / (float) image.getHeight(); int width = image.getWidth(); BufferedImage thumb = image; do { width /= 2; if (width < requestedThumbSize) { width = requestedThumbSize; } BufferedImage temp = new BufferedImage(width, (int) (width / ratio), BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = temp.createGraphics(); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g2.drawImage(thumb, 0, 0, temp.getWidth(), temp.getHeight(), null); g2.dispose(); thumb = temp; } while (width != requestedThumbSize); return thumb; } }
GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice screenDevice = environment.getDefaultScreenDevice(); GraphicsConfiguration configuration = screenDevice.getDefaultConfiguration(); return configuration.createCompatibleImage(width, height);
404
58
462
<no_super_class>
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/splineeditor/SplineDisplay.java
SelectionHandler
mousePressed
class SelectionHandler extends MouseAdapter { @Override public void mousePressed(MouseEvent e) {<FILL_FUNCTION_BODY>} @Override public void mouseReleased(MouseEvent e) { resetSelection(); } }
Ellipse2D area1 = getDraggableArea(control1); Ellipse2D area2 = getDraggableArea(control2); if (area1.contains(e.getPoint())) { selected = control1; dragStart = e.getPoint(); Rectangle bounds = area1.getBounds(); repaint(bounds.x, bounds.y, bounds.width, bounds.height); } else if (area2.contains(e.getPoint())) { selected = control2; dragStart = e.getPoint(); Rectangle bounds = area2.getBounds(); repaint(bounds.x, bounds.y, bounds.width, bounds.height); } else { resetSelection(); }
69
193
262
<methods>public void <init>(double, double, double, double, double, double, double, int, double, int) ,public void addEquation(org.gephi.ui.components.splineeditor.equation.AbstractEquation, java.awt.Color) ,public List<org.gephi.ui.components.splineeditor.equation.EquationDisplay.DrawableEquation> getEquations() ,public java.awt.Dimension getPreferredSize() ,public boolean isDrawText() ,public void propertyChange(java.beans.PropertyChangeEvent) ,public void removeEquation(org.gephi.ui.components.splineeditor.equation.AbstractEquation) ,public void setDrawText(boolean) ,public void setEnabled(boolean) <variables>private static final float COEFF_ZOOM,private static final float STROKE_AXIS,private static final float STROKE_GRID,private final non-sealed java.awt.Color colorAxis,private final non-sealed java.awt.Color colorBackground,private final non-sealed java.awt.Color colorMajorGrid,private final non-sealed java.awt.Color colorMinorGrid,private java.awt.Point dragStart,private boolean drawText,private final non-sealed List<org.gephi.ui.components.splineeditor.equation.EquationDisplay.DrawableEquation> equations,private final non-sealed java.text.NumberFormat formatter,private final non-sealed double majorX,private final non-sealed double majorY,protected double maxX,protected double maxY,protected double minX,protected double minY,private final non-sealed int minorX,private final non-sealed int minorY,private final non-sealed double originX,private final non-sealed double originY,private final non-sealed org.gephi.ui.components.splineeditor.equation.EquationDisplay.PanHandler panHandler,private final non-sealed org.gephi.ui.components.splineeditor.equation.EquationDisplay.PanMotionHandler panMotionHandler,private final non-sealed org.gephi.ui.components.splineeditor.equation.EquationDisplay.ZoomHandler zoomHandler
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/splineeditor/SplineEditor.java
SplineEditor
buildHeader
class SplineEditor extends JDialog { private SplineControlPanel splineControlPanel; public SplineEditor(String title) throws HeadlessException { super(WindowManager.getDefault().getMainWindow(), title, true); add(buildHeader(), BorderLayout.NORTH); add(buildControlPanel(), BorderLayout.CENTER); setResizable(false); pack(); setLocationRelativeTo(getParent()); } private Component buildHeader() {<FILL_FUNCTION_BODY>} private Component buildControlPanel() { splineControlPanel = new SplineControlPanel(this); return splineControlPanel; } public Point2D getControl1() { SplineDisplay display = splineControlPanel.getDisplay(); return display.getControl1(); } public void setControl1(Point2D control1) { SplineDisplay display = splineControlPanel.getDisplay(); display.setControl1(control1); } public Point2D getControl2() { SplineDisplay display = splineControlPanel.getDisplay(); return display.getControl2(); } public void setControl2(Point2D control2) { SplineDisplay display = splineControlPanel.getDisplay(); display.setControl2(control2); } }
ImageIcon icon = ImageUtilities.loadImageIcon("UIComponents/simulator.png", false); JXHeader header = new JXHeader(NbBundle.getMessage(SplineEditor.class, "splineEditor_title"), NbBundle.getMessage(SplineEditor.class, "splineEditor_header"), icon); return header;
351
91
442
<methods>public void <init>() ,public void <init>(java.awt.Frame) ,public void <init>(java.awt.Dialog) ,public void <init>(java.awt.Window) ,public void <init>(java.awt.Frame, boolean) ,public void <init>(java.awt.Frame, java.lang.String) ,public void <init>(java.awt.Dialog, boolean) ,public void <init>(java.awt.Dialog, java.lang.String) ,public void <init>(java.awt.Window, java.awt.Dialog.ModalityType) ,public void <init>(java.awt.Window, java.lang.String) ,public void <init>(java.awt.Frame, java.lang.String, boolean) ,public void <init>(java.awt.Dialog, java.lang.String, boolean) ,public void <init>(java.awt.Window, java.lang.String, java.awt.Dialog.ModalityType) ,public void <init>(java.awt.Frame, java.lang.String, boolean, java.awt.GraphicsConfiguration) ,public void <init>(java.awt.Dialog, java.lang.String, boolean, java.awt.GraphicsConfiguration) ,public void <init>(java.awt.Window, java.lang.String, java.awt.Dialog.ModalityType, java.awt.GraphicsConfiguration) ,public javax.accessibility.AccessibleContext getAccessibleContext() ,public java.awt.Container getContentPane() ,public int getDefaultCloseOperation() ,public java.awt.Component getGlassPane() ,public java.awt.Graphics getGraphics() ,public javax.swing.JMenuBar getJMenuBar() ,public javax.swing.JLayeredPane getLayeredPane() ,public javax.swing.JRootPane getRootPane() ,public javax.swing.TransferHandler getTransferHandler() ,public static boolean isDefaultLookAndFeelDecorated() ,public void remove(java.awt.Component) ,public void repaint(long, int, int, int, int) ,public void setContentPane(java.awt.Container) ,public void setDefaultCloseOperation(int) ,public static void setDefaultLookAndFeelDecorated(boolean) ,public void setGlassPane(java.awt.Component) ,public void setJMenuBar(javax.swing.JMenuBar) ,public void setLayeredPane(javax.swing.JLayeredPane) ,public void setLayout(java.awt.LayoutManager) ,public void setTransferHandler(javax.swing.TransferHandler) ,public void update(java.awt.Graphics) <variables>protected javax.accessibility.AccessibleContext accessibleContext,private int defaultCloseOperation,private static final java.lang.Object defaultLookAndFeelDecoratedKey,protected javax.swing.JRootPane rootPane,protected boolean rootPaneCheckingEnabled,private javax.swing.TransferHandler transferHandler
gephi_gephi
gephi/modules/UIComponents/src/main/java/org/gephi/ui/components/splineeditor/equation/AbstractEquation.java
AbstractEquation
firePropertyChange
class AbstractEquation implements Equation { protected List<PropertyChangeListener> listeners; protected AbstractEquation() { this.listeners = new LinkedList<>(); } public void addPropertyChangeListener(PropertyChangeListener listener) { if (listener != null && !listeners.contains(listener)) { listeners.add(listener); } } public void removePropertyChangeListener(PropertyChangeListener listener) { if (listener != null) { listeners.remove(listener); } } protected void firePropertyChange(String propertyName, double oldValue, double newValue) {<FILL_FUNCTION_BODY>} }
PropertyChangeEvent changeEvent = new PropertyChangeEvent(this, propertyName, oldValue, newValue); for (PropertyChangeListener listener : listeners) { listener.propertyChange(changeEvent); }
177
58
235
<no_super_class>
gephi_gephi
gephi/modules/UIUtils/src/main/java/org/gephi/lib/validation/BetweenZeroAndOneValidator.java
BetweenZeroAndOneValidator
validate
class BetweenZeroAndOneValidator implements Validator<String> { @Override public void validate(Problems problems, String compName, String model) {<FILL_FUNCTION_BODY>} @Override public Class<String> modelType() { return String.class; } }
boolean result = false; try { Double d = Double.parseDouble(model); result = d >= 0 && d <= 1; } catch (Exception e) { } if (!result) { String message = NbBundle.getMessage(BetweenZeroAndOneValidator.class, "BetweenZeroAndOneValidator_NOT_IN_RANGE", compName); problems.add(message); }
77
108
185
<no_super_class>
gephi_gephi
gephi/modules/UIUtils/src/main/java/org/gephi/lib/validation/DialogDescriptorWithValidation.java
DialogDescriptorWithValidation
dialog
class DialogDescriptorWithValidation implements ValidationUI { private final DialogDescriptor dialogDescriptor; private DialogDescriptorWithValidation(DialogDescriptor dialogDescriptor) { this.dialogDescriptor = dialogDescriptor; } public static DialogDescriptor dialog(Object innerPane, String title) {<FILL_FUNCTION_BODY>} @Override public void showProblem(Problem problem) { dialogDescriptor.setValid(!problem.isFatal()); } @Override public void clearProblem() { dialogDescriptor.setValid(true); } }
DialogDescriptor dd = new DialogDescriptor(innerPane, title); if (innerPane instanceof ValidationPanel) { ((ValidationPanel) innerPane).getValidationGroup().addUI(new DialogDescriptorWithValidation(dd)); } return dd;
146
67
213
<no_super_class>
gephi_gephi
gephi/modules/UIUtils/src/main/java/org/gephi/lib/validation/Multiple4NumberValidator.java
Multiple4NumberValidator
validate
class Multiple4NumberValidator implements Validator<String> { @Override public void validate(Problems problems, String compName, String model) {<FILL_FUNCTION_BODY>} @Override public Class<String> modelType() { return String.class; } }
boolean result = false; try { Integer i = Integer.parseInt(model); result = i > 0 && i % 4 == 0; } catch (Exception e) { } if (!result) { String message = NbBundle.getMessage(Multiple4NumberValidator.class, "Multiple4NumberValidator_NOT_MULTIPLE", compName); problems.add(message); }
77
109
186
<no_super_class>
gephi_gephi
gephi/modules/UIUtils/src/main/java/org/gephi/lib/validation/PositiveNumberValidator.java
PositiveNumberValidator
validate
class PositiveNumberValidator implements Validator<String> { @Override public void validate(Problems problems, String compName, String model) {<FILL_FUNCTION_BODY>} @Override public Class<String> modelType() { return String.class; } }
boolean result = false; try { Integer i = Integer.parseInt(model); result = i > 0; } catch (Exception e) { } if (!result) { String message = NbBundle.getMessage(PositiveNumberValidator.class, "PositiveNumberValidator_NOT_POSITIVE", compName); problems.add(message); }
76
99
175
<no_super_class>
gephi_gephi
gephi/modules/UIUtils/src/main/java/org/gephi/ui/propertyeditor/AbstractAttributeColumnPropertyEditor.java
AbstractAttributeColumnPropertyEditor
getColumns
class AbstractAttributeColumnPropertyEditor extends PropertyEditorSupport { private final EditorClass editorClass; private final AttributeTypeClass attributeTypeClass; private Column[] columns; private Column selectedColumn; protected AbstractAttributeColumnPropertyEditor(EditorClass editorClass, AttributeTypeClass attributeClass) { this.editorClass = editorClass; this.attributeTypeClass = attributeClass; } protected Column[] getColumns() {<FILL_FUNCTION_BODY>} @Override public String[] getTags() { columns = getColumns(); //selectedColumn = columns[0]; String[] tags = new String[columns.length]; for (int i = 0; i < columns.length; i++) { tags[i] = columns[i].getTitle(); } return tags; } @Override public Object getValue() { return selectedColumn; } @Override public void setValue(Object value) { Column column = (Column) value; this.selectedColumn = column; } @Override public String getAsText() { if (selectedColumn == null) { return "---"; } return selectedColumn.getTitle(); } @Override public void setAsText(String text) throws IllegalArgumentException { if (columns == null) { columns = getColumns(); } for (Column c : columns) { if (c.getTitle().equals(text)) { this.selectedColumn = c; } } } public boolean isDynamicNumberColumn(Column column) { return AttributeUtils.isDynamicType(column.getTypeClass()) && AttributeUtils.isNumberType(column.getTypeClass()); } public boolean isNumberColumn(Column column) { return AttributeUtils.isNumberType(column.getTypeClass()) && !AttributeUtils.isArrayType(column.getTypeClass()) && !AttributeUtils.isDynamicType(column.getTypeClass()); } public boolean isStringColumn(Column column) { return column.getTypeClass().equals(String.class); } public enum EditorClass { NODE, EDGE, NODEEDGE } public enum AttributeTypeClass { ALL, NUMBER, STRING, DYNAMIC_NUMBER, ALL_NUMBER } }
List<Column> cols = new ArrayList<>(); GraphModel model = Lookup.getDefault().lookup(GraphController.class).getGraphModel(); if (model != null) { if (editorClass.equals(EditorClass.NODE) || editorClass.equals(EditorClass.NODEEDGE)) { for (Column column : model.getNodeTable()) { if (attributeTypeClass.equals(AttributeTypeClass.NUMBER) && isNumberColumn(column)) { cols.add(column); } else if (attributeTypeClass.equals(AttributeTypeClass.DYNAMIC_NUMBER) && isDynamicNumberColumn(column)) { cols.add(column); } else if (attributeTypeClass.equals(AttributeTypeClass.ALL_NUMBER) && (isDynamicNumberColumn(column) || isNumberColumn(column))) { cols.add(column); } else if (attributeTypeClass.equals(AttributeTypeClass.ALL)) { cols.add(column); } else if (attributeTypeClass.equals(AttributeTypeClass.STRING) && isStringColumn(column)) { cols.add(column); } } } if (editorClass.equals(EditorClass.EDGE) || editorClass.equals(EditorClass.NODEEDGE)) { for (Column column : model.getEdgeTable()) { if (attributeTypeClass.equals(AttributeTypeClass.NUMBER) && isNumberColumn(column)) { cols.add(column); } else if (attributeTypeClass.equals(AttributeTypeClass.DYNAMIC_NUMBER) && isDynamicNumberColumn(column)) { cols.add(column); } else if (attributeTypeClass.equals(AttributeTypeClass.ALL_NUMBER) && (isDynamicNumberColumn(column) || isNumberColumn(column))) { cols.add(column); } else if (attributeTypeClass.equals(AttributeTypeClass.ALL)) { cols.add(column); } else if (attributeTypeClass.equals(AttributeTypeClass.STRING) && isStringColumn(column)) { cols.add(column); } } } } return cols.toArray(new Column[0]);
604
552
1,156
<methods>public void <init>() ,public void <init>(java.lang.Object) ,public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener) ,public void firePropertyChange() ,public java.lang.String getAsText() ,public java.awt.Component getCustomEditor() ,public java.lang.String getJavaInitializationString() ,public java.lang.Object getSource() ,public java.lang.String[] getTags() ,public java.lang.Object getValue() ,public boolean isPaintable() ,public void paintValue(java.awt.Graphics, java.awt.Rectangle) ,public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener) ,public void setAsText(java.lang.String) throws java.lang.IllegalArgumentException,public void setSource(java.lang.Object) ,public void setValue(java.lang.Object) ,public boolean supportsCustomEditor() <variables>private Vector<java.beans.PropertyChangeListener> listeners,private java.lang.Object source,private java.lang.Object value
gephi_gephi
gephi/modules/UIUtils/src/main/java/org/gephi/ui/utils/ColorUtils.java
ColorUtils
encode
class ColorUtils { public static String encode(Color color) {<FILL_FUNCTION_BODY>} public static Color decode(String nm) throws NumberFormatException { int i = (int) Long.parseLong(nm, 16); //Bug 4215269 return new Color((i >> 24) & 0xFF, (i >> 16) & 0xFF, (i >> 8) & 0xFF, i & 0xFF); } public static Color decode(float[] array) { if (array.length == 3) { return new Color(array[0], array[1], array[2]); } else if (array.length == 4) { return new Color(array[0], array[1], array[2], array[3]); } else { throw new IllegalArgumentException("Must be a 3 or 4 length array"); } } }
char[] buf = new char[8]; String s = Integer.toHexString(color.getRed()); if (s.length() == 1) { buf[0] = '0'; buf[1] = s.charAt(0); } else { buf[0] = s.charAt(0); buf[1] = s.charAt(1); } s = Integer.toHexString(color.getGreen()); if (s.length() == 1) { buf[2] = '0'; buf[3] = s.charAt(0); } else { buf[2] = s.charAt(0); buf[3] = s.charAt(1); } s = Integer.toHexString(color.getBlue()); if (s.length() == 1) { buf[4] = '0'; buf[5] = s.charAt(0); } else { buf[4] = s.charAt(0); buf[5] = s.charAt(1); } s = Integer.toHexString(color.getAlpha()); if (s.length() == 1) { buf[6] = '0'; buf[7] = s.charAt(0); } else { buf[6] = s.charAt(0); buf[7] = s.charAt(1); } return String.valueOf(buf);
238
378
616
<no_super_class>
gephi_gephi
gephi/modules/UIUtils/src/main/java/org/gephi/ui/utils/ColumnTitleValidator.java
ColumnTitleValidator
validate
class ColumnTitleValidator implements Validator<String> { private Table table; private boolean allowNoTitle; public ColumnTitleValidator(Table table) { this(table, false); } public ColumnTitleValidator(Table table, boolean allowNoTitle) { this.table = table; this.allowNoTitle = allowNoTitle; } @Override public void validate(Problems prblms, String string, String t) {<FILL_FUNCTION_BODY>} @Override public Class<String> modelType() { return String.class; } public boolean isAllowNoTitle() { return allowNoTitle; } public void setAllowNoTitle(boolean allowNoTitle) { this.allowNoTitle = allowNoTitle; } public Table getTable() { return table; } public void setTable(Table table) { this.table = table; } }
if (!allowNoTitle && (t == null || t.isEmpty())) { prblms.add(NbBundle.getMessage(ColumnTitleValidator.class, "ColumnTitleValidator.title.empty")); } else if (table.hasColumn(t)) { prblms.add(NbBundle.getMessage(ColumnTitleValidator.class, "ColumnTitleValidator.title.repeated")); }
283
104
387
<no_super_class>
gephi_gephi
gephi/modules/UIUtils/src/main/java/org/gephi/ui/utils/DialogFileFilter.java
DialogFileFilter
accept
class DialogFileFilter extends javax.swing.filechooser.FileFilter { private String description; private final List<String> extensions; public DialogFileFilter(String description) { if (description == null) { Logger.getLogger(DialogFileFilter.class.getName()) .throwing(getClass().getName(), "constructor", new NullPointerException("Description cannot be null.")); } this.description = description; this.extensions = new ArrayList<>(); } @Override public boolean accept(File file) {<FILL_FUNCTION_BODY>} @Override public String getDescription() { StringBuffer buffer = new StringBuffer(description); buffer.append(" ("); for (String extension : extensions) { buffer.append("*" + extension).append(" "); } buffer.deleteCharAt(buffer.length() - 1); return buffer.append(")").toString(); } public void setDescription(String description) { if (description == null) { Logger.getLogger(DialogFileFilter.class.getName()).throwing(getClass().getName(), "setDescription", new NullPointerException("Description cannot be null.")); } this.description = description; } public void addExtension(String extension) { if (extension == null) { Logger.getLogger(DialogFileFilter.class.getName()).throwing(getClass().getName(), "addExtension", new NullPointerException("Description cannot be null.")); } extensions.add(extension); } public void addExtensions(String[] extension) { if (extension == null) { Logger.getLogger(DialogFileFilter.class.getName()).throwing(getClass().getName(), "addExtensions", new NullPointerException("Description cannot be null.")); } for (int i = 0; i < extension.length; i++) { extensions.add(extension[i]); } } public void removeExtension(String extension) { extensions.remove(extension); } public void clearExtensions() { extensions.clear(); } public List<String> getExtensions() { return extensions; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final DialogFileFilter other = (DialogFileFilter) obj; if (!Objects.equals(this.description, other.description)) { return false; } return Objects.equals(this.extensions, other.extensions); } @Override public int hashCode() { int hash = 3; hash = 43 * hash + Objects.hashCode(this.description); hash = 43 * hash + Objects.hashCode(this.extensions); return hash; } //TODO define hashCode }
if (file.isDirectory() || extensions.isEmpty()) { return true; } String fileName = file.getName().toLowerCase(); for (String extension : extensions) { if (fileName.endsWith(extension)) { return true; } } return false;
770
79
849
<methods>public abstract boolean accept(java.io.File) ,public abstract java.lang.String getDescription() <variables>
gephi_gephi
gephi/modules/UIUtils/src/main/java/org/gephi/ui/utils/FontUtils.java
FontUtils
encode
class FontUtils { public static String encode(Font font) {<FILL_FUNCTION_BODY>} }
StringBuffer fontAsString = new StringBuffer(); fontAsString.append(font.getName()); if (!font.isPlain()) { fontAsString.append('-'); if (font.isBold()) { fontAsString.append("bold"); } if (font.isItalic()) { fontAsString.append("italic"); } } fontAsString.append('-'); fontAsString.append(font.getSize()); return fontAsString.toString();
31
133
164
<no_super_class>
gephi_gephi
gephi/modules/UIUtils/src/main/java/org/gephi/ui/utils/GradientUtils.java
LinearGradient
getValue
class LinearGradient { private Color[] colors; private float[] positions; public LinearGradient(Color[] colors, float[] positions) { if (colors == null || positions == null) { throw new NullPointerException(); } if (colors.length != positions.length) { throw new IllegalArgumentException(); } this.colors = colors; this.positions = positions; } public Color getValue(float pos) {<FILL_FUNCTION_BODY>} private Color tween(Color c1, Color c2, float p) { return new Color( (int) (c1.getRed() * (1 - p) + c2.getRed() * (p)), (int) (c1.getGreen() * (1 - p) + c2.getGreen() * (p)), (int) (c1.getBlue() * (1 - p) + c2.getBlue() * (p)), (int) (c1.getAlpha() * (1 - p) + c2.getAlpha() * (p))); } public Color[] getColors() { return colors; } public void setColors(Color[] colors) { this.colors = colors; } public float[] getPositions() { return positions; } public void setPositions(float[] positions) { this.positions = positions; } }
for (int a = 0; a < positions.length - 1; a++) { if (positions[a] == pos) { return colors[a]; } if (positions[a] < pos && pos < positions[a + 1]) { float v = (pos - positions[a]) / (positions[a + 1] - positions[a]); return tween(colors[a], colors[a + 1], v); } } if (pos <= positions[0]) { return colors[0]; } if (pos >= positions[positions.length - 1]) { return colors[colors.length - 1]; } return null;
373
175
548
<no_super_class>
gephi_gephi
gephi/modules/UIUtils/src/main/java/org/gephi/ui/utils/IntervalBoundValidator.java
IntervalBoundValidator
validate
class IntervalBoundValidator implements Validator<String> { /** * If not null, interval start &lt;= end is also validated. */ private JTextComponent intervalStartTextField = null; public IntervalBoundValidator() { } public IntervalBoundValidator(JTextComponent intervalStartTextField) { this.intervalStartTextField = intervalStartTextField; } @Override public void validate(Problems prblms, String componentName, String value) {<FILL_FUNCTION_BODY>} @Override public Class<String> modelType() { return String.class; } }
try { double time = AttributeUtils.parseDateTimeOrTimestamp(value); if (intervalStartTextField != null) { //Also validate that this (end time) is greater or equal than start time. try { double startTime = AttributeUtils.parseDateTimeOrTimestamp(intervalStartTextField.getText()); if (time < startTime) { prblms.add(NbBundle.getMessage(IntervalBoundValidator.class, "IntervalBoundValidator.invalid.interval.message")); } } catch (Exception parseException) { } } } catch (Exception ex) { prblms .add(NbBundle.getMessage(IntervalBoundValidator.class, "IntervalBoundValidator.invalid.bound.message")); }
186
206
392
<no_super_class>
gephi_gephi
gephi/modules/UIUtils/src/main/java/org/gephi/ui/utils/PrefsUtils.java
PrefsUtils
floatArrayToString
class PrefsUtils { public static final String floatArrayToString(float[] array) {<FILL_FUNCTION_BODY>} public static final float[] stringToFloatArray(String string) { StringTokenizer tokenizer = new StringTokenizer(string, ","); float[] array = new float[tokenizer.countTokens()]; for (int i = 0; i < array.length; i++) { array[i] = Float.parseFloat(tokenizer.nextToken()); } return array; } }
StringBuilder builder = new StringBuilder(); for (int i = 0; i < array.length; i++) { if (i > 0) { builder.append(','); } builder.append(array[i]); } return builder.toString();
139
72
211
<no_super_class>
gephi_gephi
gephi/modules/UIUtils/src/main/java/org/gephi/ui/utils/SupportedColumnTypeWrapper.java
SupportedColumnTypeWrapper
compareTo
class SupportedColumnTypeWrapper implements Comparable<SupportedColumnTypeWrapper> { private static final List<Class> SIMPLE_TYPES_ORDER = Arrays.asList(new Class[] { String.class, Integer.class, Long.class, Float.class, Double.class, Boolean.class, BigInteger.class, BigDecimal.class, Byte.class, Short.class, Character.class }); private final Class<?> type; public SupportedColumnTypeWrapper(Class type) { this.type = type; } /** * Build a list of column type wrappers from GraphStore supported types. * * @param graphModel * @return Ordered column type wrappers list */ public static List<SupportedColumnTypeWrapper> buildOrderedSupportedTypesList(GraphModel graphModel) { TimeRepresentation timeRepresentation = graphModel.getConfiguration().getTimeRepresentation(); return buildOrderedSupportedTypesList(timeRepresentation); } /** * Build a list of column type wrappers from GraphStore supported types. * * @param timeRepresentation * @return Ordered column type wrappers list */ public static List<SupportedColumnTypeWrapper> buildOrderedSupportedTypesList( TimeRepresentation timeRepresentation) { List<SupportedColumnTypeWrapper> supportedTypesWrappers = new ArrayList<>(); for (Class<?> type : AttributeUtils.getSupportedTypes()) { if (type.equals(Map.class) || type.equals(List.class) || type.equals(Set.class)) { continue; //Not yet supported in Gephi } if (AttributeUtils.isStandardizedType(type) && Attributes.isTypeAvailable(type, timeRepresentation)) { supportedTypesWrappers.add(new SupportedColumnTypeWrapper(type)); } } Collections.sort(supportedTypesWrappers); return supportedTypesWrappers; } @Override public String toString() { if (AttributeUtils.isArrayType(type)) { return String.format("%s list", type.getComponentType().getSimpleName()); } else { return type.getSimpleName(); } } public Class<?> getType() { return type; } @Override public int hashCode() { int hash = 7; hash = 17 * hash + (this.type != null ? this.type.hashCode() : 0); return hash; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final SupportedColumnTypeWrapper other = (SupportedColumnTypeWrapper) obj; return this.type == other.type || (this.type != null && this.type.equals(other.type)); } /** * Order for column types by name. Simple types appear first, then dynamic types and then array/list types. * * @param other * @return */ @Override public int compareTo(SupportedColumnTypeWrapper other) {<FILL_FUNCTION_BODY>} }
boolean isArray = type.isArray(); boolean isArrayOther = other.type.isArray(); if (isArray != isArrayOther) { if (isArray) { return 1; } else { return -1; } } else { boolean isDynamic = AttributeUtils.isDynamicType(type); boolean isDynamicOther = AttributeUtils.isDynamicType(other.type); if (isDynamic != isDynamicOther) { if (isDynamic) { return 1; } else { return -1; } } else { int i1 = SIMPLE_TYPES_ORDER.indexOf(type); int i2 = SIMPLE_TYPES_ORDER.indexOf(other.type); if (i1 != -1 && i2 != -1) { return i1 - i2; } else { return type.getSimpleName().compareTo(other.type.getSimpleName()); } } }
952
293
1,245
<no_super_class>
gephi_gephi
gephi/modules/UIUtils/src/main/java/org/gephi/ui/utils/TimeFormatWrapper.java
TimeFormatWrapper
hashCode
class TimeFormatWrapper { private final TimeFormat timeFormat; public TimeFormatWrapper(TimeFormat timeFormat) { this.timeFormat = timeFormat; } @Override public int hashCode() {<FILL_FUNCTION_BODY>} @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TimeFormatWrapper other = (TimeFormatWrapper) obj; return this.timeFormat == other.timeFormat; } public TimeFormat getTimeFormat() { return timeFormat; } @Override public String toString() { return NbBundle.getMessage(TimeFormatWrapper.class, "TimeFormatWrapper.timeFormat." + timeFormat.name()); } }
int hash = 7; hash = 53 * hash + (this.timeFormat != null ? this.timeFormat.hashCode() : 0); return hash;
238
45
283
<no_super_class>
gephi_gephi
gephi/modules/UIUtils/src/main/java/org/gephi/ui/utils/TimeRepresentationWrapper.java
TimeRepresentationWrapper
equals
class TimeRepresentationWrapper { private final TimeRepresentation timeRepresentation; public TimeRepresentationWrapper(TimeRepresentation timeRepresentation) { this.timeRepresentation = timeRepresentation; } @Override public int hashCode() { int hash = 3; hash = 41 * hash + (this.timeRepresentation != null ? this.timeRepresentation.hashCode() : 0); return hash; } @Override public boolean equals(Object obj) {<FILL_FUNCTION_BODY>} @Override public String toString() { return NbBundle.getMessage(TimeRepresentationWrapper.class, "TimeRepresentationWrapper.timeRepresentation." + timeRepresentation.name()); } public TimeRepresentation getTimeRepresentation() { return timeRepresentation; } }
if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TimeRepresentationWrapper other = (TimeRepresentationWrapper) obj; return this.timeRepresentation == other.timeRepresentation;
232
96
328
<no_super_class>
gephi_gephi
gephi/modules/UIUtils/src/main/java/org/gephi/ui/utils/TimeZoneWrapper.java
TimeZoneWrapper
hashCode
class TimeZoneWrapper { private final TimeZone timeZone; private final long currentTimestamp; public TimeZoneWrapper(TimeZone timeZone, long currentTimestamp) { this.timeZone = timeZone; this.currentTimestamp = currentTimestamp; } private String getTimeZoneText() { int offset = timeZone.getOffset(currentTimestamp); long hours = TimeUnit.MILLISECONDS.toHours(offset); long minutes = TimeUnit.MILLISECONDS.toMinutes(offset) - TimeUnit.HOURS.toMinutes(hours); minutes = Math.abs(minutes); if (hours >= 0) { return String.format("%s (GMT+%d:%02d)", timeZone.getID(), hours, minutes); } else { return String.format("%s (GMT%d:%02d)", timeZone.getID(), hours, minutes); } } @Override public int hashCode() {<FILL_FUNCTION_BODY>} @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TimeZoneWrapper other = (TimeZoneWrapper) obj; return this.timeZone == other.timeZone || (this.timeZone != null && this.timeZone.equals(other.timeZone)); } @Override public String toString() { return getTimeZoneText(); } public TimeZone getTimeZone() { return timeZone; } }
int hash = 5; hash = 97 * hash + (this.timeZone != null ? this.timeZone.hashCode() : 0); return hash;
432
45
477
<no_super_class>
gephi_gephi
gephi/modules/UIUtils/src/main/java/org/gephi/ui/utils/WhiteFilter.java
WhiteFilter
filterRGB
class WhiteFilter extends RGBImageFilter { //~ Instance fields ------------------------------------------------------------------------------------------------------ private final float[] hsv = new float[3]; //~ Constructors --------------------------------------------------------------------------------------------------------- /** * Constructs a GrayFilter object that filters a color image to a * grayscale image. Used by buttons to create disabled ("grayed out") * button images. */ public WhiteFilter() { // canFilterIndexColorModel indicates whether or not it is acceptable // to apply the color filtering of the filterRGB method to the color // table entries of an IndexColorModel object in lieu of pixel by pixel // filtering. canFilterIndexColorModel = true; } //~ Methods -------------------------------------------------------------------------------------------------------------- /** * Creates a disabled image */ public static Image createDisabledImage(final Image i) { final WhiteFilter filter = new WhiteFilter(); final ImageProducer prod = new FilteredImageSource(i.getSource(), filter); return Toolkit.getDefaultToolkit().createImage(prod); } /** * Overrides <code>RGBImageFilter.filterRGB</code>. */ @Override public int filterRGB(final int x, final int y, final int rgb) {<FILL_FUNCTION_BODY>} }
int transparency = (rgb >> 24) & 0xFF; if (transparency <= 1) { return rgb; // do not alter fully transparent pixels (those would end up being black) } transparency /= 2; // set transparency to 50% of original Color.RGBtoHSB((rgb >> 16) & 0xFF, (rgb >> 8) & 0xFF, (rgb >> 0) & 0xFF, hsv); hsv[1] = 0; return Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]) + (transparency << 24);
327
172
499
<methods>public java.awt.image.IndexColorModel filterIndexColorModel(java.awt.image.IndexColorModel) ,public abstract int filterRGB(int, int, int) ,public void filterRGBPixels(int, int, int, int, int[], int, int) ,public void setColorModel(java.awt.image.ColorModel) ,public void setPixels(int, int, int, int, java.awt.image.ColorModel, byte[], int, int) ,public void setPixels(int, int, int, int, java.awt.image.ColorModel, int[], int, int) ,public void substituteColorModel(java.awt.image.ColorModel, java.awt.image.ColorModel) <variables>protected boolean canFilterIndexColorModel,protected java.awt.image.ColorModel newmodel,protected java.awt.image.ColorModel origmodel
gephi_gephi
gephi/modules/Utils/src/main/java/org/gephi/utils/Attributes.java
Attributes
isTypeAvailable
class Attributes { public static boolean isTypeAvailable(Class<?> type, TimeRepresentation timeRepresentation) {<FILL_FUNCTION_BODY>} public static boolean isTimestampType(Class<?> type) { return TimestampSet.class.isAssignableFrom(type) || TimestampMap.class.isAssignableFrom(type); } public static boolean isIntervalType(Class<?> type) { return IntervalSet.class.isAssignableFrom(type) || IntervalMap.class.isAssignableFrom(type); } }
if (AttributeUtils.isDynamicType(type)) { switch (timeRepresentation) { case INTERVAL: return isIntervalType(type); case TIMESTAMP: return isTimestampType(type); default: throw new IllegalArgumentException("Unknown timeRepresentation"); } } else { return true; }
152
93
245
<no_super_class>
gephi_gephi
gephi/modules/Utils/src/main/java/org/gephi/utils/HTMLEscape.java
HTMLEscape
stringToHTMLString
class HTMLEscape { /**Code previously used in web applications, adapted from a google search**/ /** * Escape html from a string to make it safe to show. * * @param string String to escape html * @return Result string */ public static String stringToHTMLString(String string) {<FILL_FUNCTION_BODY>} }
StringBuilder sb = new StringBuilder(string.length()); // true if last char was blank boolean lastWasBlankChar = false; int len = string.length(); char c; for (int i = 0; i < len; i++) { c = string.charAt(i); if (c == ' ') { // blank gets extra work, // this solves the problem you get if you replace all // blanks with &nbsp;, if you do that you loss // word breaking if (lastWasBlankChar) { lastWasBlankChar = false; sb.append("&nbsp;"); } else { lastWasBlankChar = true; sb.append(' '); } } else { lastWasBlankChar = false; // // HTML Special Chars if (c == '"') { sb.append("&quot;"); } else if (c == '&') { sb.append("&amp;"); } else if (c == '<') { sb.append("&lt;"); } else if (c == '>') { sb.append("&gt;"); } else if (c == '\n') { sb.append("<br>\n"); } else if (c == '\r') { } else { int ci = 0xffff & c; if (ci < 160) { // nothing special only 7 Bit sb.append(c); } else { // Not 7 Bit use the unicode system sb.append("&#"); sb.append(new Integer(ci)); sb.append(';'); } } } } return sb.toString();
96
444
540
<no_super_class>
gephi_gephi
gephi/modules/Utils/src/main/java/org/gephi/utils/NumberUtils.java
NumberUtils
equals
class NumberUtils { public static final double EPS = 1e-5; public static <T extends Number> T parseNumber(String str, Class<T> type) throws UnsupportedOperationException { try { /* * Try to access the staticFactory method for: * Byte, Short, Integer, Long, Double, and Float */ Method m = type.getMethod("valueOf", String.class); Object o = m.invoke(type, str); return type.cast(o); } catch (NoSuchMethodException e1) { /* Try to access the constructor for BigDecimal or BigInteger*/ try { Constructor<? extends Number> ctor = type .getConstructor(String.class); return (T) ctor.newInstance(str); } catch (ReflectiveOperationException e2) { /* AtomicInteger and AtomicLong not supported */ throw new UnsupportedOperationException( "Cannot convert string to " + type.getName()); } } catch (ReflectiveOperationException e2) { throw new UnsupportedOperationException("Cannot convert string to " + type.getName()); } } public static boolean equalsEpsilon(double a, double b) { return equals(a, b, EPS); } public static boolean equals(double a, double b, double epsilon) {<FILL_FUNCTION_BODY>} }
return a == b || Math.abs(a - b) < epsilon;
352
22
374
<no_super_class>
gephi_gephi
gephi/modules/Utils/src/main/java/org/gephi/utils/TempDirUtils.java
TempDirUtils
createTempDirectory
class TempDirUtils { public static TempDir createTempDir() throws IOException { return new TempDir(createTempDirectory()); } public static File createTempDirectory() throws IOException {<FILL_FUNCTION_BODY>} public static class TempDir { private final File tempDir; private TempDir(File tempDir) { this.tempDir = tempDir; } public File createFile(String fileName) { File file = new File(tempDir, fileName); file.deleteOnExit(); return file; } public File getTempDir() { return tempDir; } } }
final File temp; temp = File.createTempFile("temp", Long.toString(System.nanoTime())); temp.deleteOnExit(); if (!(temp.delete())) { throw new IOException("Could not delete temp file: " + temp.getAbsolutePath()); } if (!(temp.mkdir())) { throw new IOException("Could not create temp directory: " + temp.getAbsolutePath()); } return (temp);
174
119
293
<no_super_class>
gephi_gephi
gephi/modules/Utils/src/main/java/org/gephi/utils/sparklines/SparklineComponent.java
SparklineComponent
paintComponent
class SparklineComponent extends JComponent { private final Number[] xValues; private final Number[] yValues; private final Number yMinValue; private final Number yMaxValue; private final SparklineParameters sparklineParameters; public SparklineComponent(Number[] yValues, SparklineParameters sparklineParameters, boolean updateMouseXPosition) { this(null, yValues, null, null, sparklineParameters, updateMouseXPosition); } public SparklineComponent(Number[] yValues, Number yMinValue, Number yMaxValue, SparklineParameters sparklineParameters, boolean updateMouseXPosition) { this(null, yValues, yMinValue, yMaxValue, sparklineParameters, updateMouseXPosition); } public SparklineComponent(Number[] xValues, Number[] yValues, SparklineParameters sparklineParameters, boolean updateMouseXPosition) { this(xValues, yValues, null, null, sparklineParameters, updateMouseXPosition); } public SparklineComponent(Number[] xValues, Number[] yValues, Number yMinValue, Number yMaxValue, SparklineParameters sparklineParameters, boolean updateMouseXPosition) { this.xValues = xValues; this.yValues = yValues; this.yMinValue = yMinValue; this.yMaxValue = yMaxValue; this.sparklineParameters = sparklineParameters; if (updateMouseXPosition) { initEvents(); } } private void initEvents() { MouseEvents listener = new MouseEvents(); addMouseListener(listener); addMouseMotionListener(listener); } @Override protected void paintComponent(Graphics g) {<FILL_FUNCTION_BODY>} class MouseEvents extends MouseAdapter implements MouseMotionListener { @Override public void mouseEntered(MouseEvent e) { sparklineParameters.setHighlightedValueXPosition(e.getX()); repaint(); } @Override public void mouseExited(MouseEvent e) { sparklineParameters.setHighlightedValueXPosition(null); repaint(); } @Override public void mouseMoved(MouseEvent e) { sparklineParameters.setHighlightedValueXPosition(e.getX()); repaint(); } } }
sparklineParameters.setWidth(getWidth()); sparklineParameters.setHeight(getHeight()); BufferedImage image = SparklineGraph.draw(xValues, yValues, yMinValue, yMaxValue, sparklineParameters); g.drawImage(image, 0, 0, this);
591
76
667
<methods>public void <init>() ,public void addAncestorListener(javax.swing.event.AncestorListener) ,public void addNotify() ,public synchronized void addVetoableChangeListener(java.beans.VetoableChangeListener) ,public void computeVisibleRect(java.awt.Rectangle) ,public boolean contains(int, int) ,public javax.swing.JToolTip createToolTip() ,public void disable() ,public void enable() ,public void firePropertyChange(java.lang.String, boolean, boolean) ,public void firePropertyChange(java.lang.String, int, int) ,public void firePropertyChange(java.lang.String, char, char) ,public java.awt.event.ActionListener getActionForKeyStroke(javax.swing.KeyStroke) ,public final javax.swing.ActionMap getActionMap() ,public float getAlignmentX() ,public float getAlignmentY() ,public javax.swing.event.AncestorListener[] getAncestorListeners() ,public boolean getAutoscrolls() ,public int getBaseline(int, int) ,public java.awt.Component.BaselineResizeBehavior getBaselineResizeBehavior() ,public javax.swing.border.Border getBorder() ,public java.awt.Rectangle getBounds(java.awt.Rectangle) ,public final java.lang.Object getClientProperty(java.lang.Object) ,public javax.swing.JPopupMenu getComponentPopupMenu() ,public int getConditionForKeyStroke(javax.swing.KeyStroke) ,public int getDebugGraphicsOptions() ,public static java.util.Locale getDefaultLocale() ,public java.awt.FontMetrics getFontMetrics(java.awt.Font) ,public java.awt.Graphics getGraphics() ,public int getHeight() ,public boolean getInheritsPopupMenu() ,public final javax.swing.InputMap getInputMap() ,public final javax.swing.InputMap getInputMap(int) ,public javax.swing.InputVerifier getInputVerifier() ,public java.awt.Insets getInsets() ,public java.awt.Insets getInsets(java.awt.Insets) ,public T[] getListeners(Class<T>) ,public java.awt.Point getLocation(java.awt.Point) ,public java.awt.Dimension getMaximumSize() ,public java.awt.Dimension getMinimumSize() ,public java.awt.Component getNextFocusableComponent() ,public java.awt.Point getPopupLocation(java.awt.event.MouseEvent) ,public java.awt.Dimension getPreferredSize() ,public javax.swing.KeyStroke[] getRegisteredKeyStrokes() ,public javax.swing.JRootPane getRootPane() ,public java.awt.Dimension getSize(java.awt.Dimension) ,public java.awt.Point getToolTipLocation(java.awt.event.MouseEvent) ,public java.lang.String getToolTipText() ,public java.lang.String getToolTipText(java.awt.event.MouseEvent) ,public java.awt.Container getTopLevelAncestor() ,public javax.swing.TransferHandler getTransferHandler() ,public javax.swing.plaf.ComponentUI getUI() ,public java.lang.String getUIClassID() ,public boolean getVerifyInputWhenFocusTarget() ,public synchronized java.beans.VetoableChangeListener[] getVetoableChangeListeners() ,public java.awt.Rectangle getVisibleRect() ,public int getWidth() ,public int getX() ,public int getY() ,public void grabFocus() ,public void hide() ,public boolean isDoubleBuffered() ,public static boolean isLightweightComponent(java.awt.Component) ,public boolean isManagingFocus() ,public boolean isOpaque() ,public boolean isOptimizedDrawingEnabled() ,public final boolean isPaintingForPrint() ,public boolean isPaintingTile() ,public boolean isRequestFocusEnabled() ,public boolean isValidateRoot() ,public void paint(java.awt.Graphics) ,public void paintImmediately(java.awt.Rectangle) ,public void paintImmediately(int, int, int, int) ,public void print(java.awt.Graphics) ,public void printAll(java.awt.Graphics) ,public final void putClientProperty(java.lang.Object, java.lang.Object) ,public void registerKeyboardAction(java.awt.event.ActionListener, javax.swing.KeyStroke, int) ,public void registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int) ,public void removeAncestorListener(javax.swing.event.AncestorListener) ,public void removeNotify() ,public synchronized void removeVetoableChangeListener(java.beans.VetoableChangeListener) ,public void repaint(java.awt.Rectangle) ,public void repaint(long, int, int, int, int) ,public boolean requestDefaultFocus() ,public void requestFocus() ,public boolean requestFocus(boolean) ,public boolean requestFocusInWindow() ,public void resetKeyboardActions() ,public void reshape(int, int, int, int) ,public void revalidate() ,public void scrollRectToVisible(java.awt.Rectangle) ,public final void setActionMap(javax.swing.ActionMap) ,public void setAlignmentX(float) ,public void setAlignmentY(float) ,public void setAutoscrolls(boolean) ,public void setBackground(java.awt.Color) ,public void setBorder(javax.swing.border.Border) ,public void setComponentPopupMenu(javax.swing.JPopupMenu) ,public void setDebugGraphicsOptions(int) ,public static void setDefaultLocale(java.util.Locale) ,public void setDoubleBuffered(boolean) ,public void setEnabled(boolean) ,public void setFocusTraversalKeys(int, Set<? extends java.awt.AWTKeyStroke>) ,public void setFont(java.awt.Font) ,public void setForeground(java.awt.Color) ,public void setInheritsPopupMenu(boolean) ,public final void setInputMap(int, javax.swing.InputMap) ,public void setInputVerifier(javax.swing.InputVerifier) ,public void setMaximumSize(java.awt.Dimension) ,public void setMinimumSize(java.awt.Dimension) ,public void setNextFocusableComponent(java.awt.Component) ,public void setOpaque(boolean) ,public void setPreferredSize(java.awt.Dimension) ,public void setRequestFocusEnabled(boolean) ,public void setToolTipText(java.lang.String) ,public void setTransferHandler(javax.swing.TransferHandler) ,public void setVerifyInputWhenFocusTarget(boolean) ,public void setVisible(boolean) ,public void unregisterKeyboardAction(javax.swing.KeyStroke) ,public void update(java.awt.Graphics) ,public void updateUI() <variables>private static final int ACTIONMAP_CREATED,private static final int ANCESTOR_INPUTMAP_CREATED,private static final int ANCESTOR_USING_BUFFER,private static final int AUTOSCROLLS_SET,private static final int COMPLETELY_OBSCURED,private static final int CREATED_DOUBLE_BUFFER,static boolean DEBUG_GRAPHICS_LOADED,private static final int FOCUS_INPUTMAP_CREATED,private static final int FOCUS_TRAVERSAL_KEYS_BACKWARD_SET,private static final int FOCUS_TRAVERSAL_KEYS_FORWARD_SET,private static final int INHERITS_POPUP_MENU,private static final java.lang.Object INPUT_VERIFIER_SOURCE_KEY,private static final int IS_DOUBLE_BUFFERED,private static final int IS_OPAQUE,private static final int IS_PAINTING_TILE,private static final int IS_PRINTING,private static final int IS_PRINTING_ALL,private static final int IS_REPAINTING,private static final java.lang.String KEYBOARD_BINDINGS_KEY,private static final int KEY_EVENTS_ENABLED,private static final java.lang.String NEXT_FOCUS,private static final int NOT_OBSCURED,private static final int OPAQUE_SET,private static final int PARTIALLY_OBSCURED,private static final int REQUEST_FOCUS_DISABLED,private static final int RESERVED_1,private static final int RESERVED_2,private static final int RESERVED_3,private static final int RESERVED_4,private static final int RESERVED_5,private static final int RESERVED_6,public static final java.lang.String TOOL_TIP_TEXT_KEY,public static final int UNDEFINED_CONDITION,public static final int WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,public static final int WHEN_FOCUSED,public static final int WHEN_IN_FOCUSED_WINDOW,private static final java.lang.String WHEN_IN_FOCUSED_WINDOW_BINDINGS,private static final int WIF_INPUTMAP_CREATED,private static final int WRITE_OBJ_COUNTER_FIRST,private static final int WRITE_OBJ_COUNTER_LAST,private transient java.lang.Object aaHint,private javax.swing.ActionMap actionMap,private float alignmentX,private float alignmentY,private javax.swing.InputMap ancestorInputMap,private boolean autoscrolls,private javax.swing.border.Border border,private transient javax.swing.ArrayTable clientProperties,private static java.awt.Component componentObtainingGraphicsFrom,private static java.lang.Object componentObtainingGraphicsFromLock,private static final java.lang.String defaultLocale,private int flags,static final sun.awt.RequestFocusController focusController,private javax.swing.InputMap focusInputMap,private javax.swing.InputVerifier inputVerifier,private boolean isAlignmentXSet,private boolean isAlignmentYSet,private transient java.lang.Object lcdRenderingHint,protected javax.swing.event.EventListenerList listenerList,private static Set<javax.swing.KeyStroke> managingFocusBackwardTraversalKeys,private static Set<javax.swing.KeyStroke> managingFocusForwardTraversalKeys,transient java.awt.Component paintingChild,private javax.swing.JPopupMenu popupMenu,private static final Hashtable<java.io.ObjectInputStream,javax.swing.JComponent.ReadObjectCallback> readObjectCallbacks,private transient java.util.concurrent.atomic.AtomicBoolean revalidateRunnableScheduled,private static List<java.awt.Rectangle> tempRectangles,protected transient javax.swing.plaf.ComponentUI ui,private static final java.lang.String uiClassID,private boolean verifyInputWhenFocusTarget,private java.beans.VetoableChangeSupport vetoableChangeSupport,private javax.swing.ComponentInputMap windowInputMap
gephi_gephi
gephi/modules/VisualizationImpl/src/main/java/org/gephi/lib/gleem/linalg/Line.java
Line
recalc
class Line { private Vec3f point; /** * Normalized */ private Vec3f direction; /** * For computing projections along line */ private final Vec3f alongVec; /** * Default constructor initializes line to point (0, 0, 0) and * direction (1, 0, 0) */ public Line() { point = new Vec3f(0, 0, 0); direction = new Vec3f(1, 0, 0); alongVec = new Vec3f(); recalc(); } /** * Line goes in direction <b>direction</b> through the point * <b>point</b>. <b>direction</b> does not need to be normalized but must * not be the zero vector. */ public Line(Vec3f direction, Vec3f point) { direction = new Vec3f(direction); direction.normalize(); point = new Vec3f(point); alongVec = new Vec3f(); recalc(); } /** * Direction is normalized internally, so <b>direction</b> is not * necessarily equal to <code>plane.setDirection(direction); * plane.getDirection();</code> */ public Vec3f getDirection() { return direction; } /** * Setter does some work to maintain internal caches. * <b>direction</b> does not need to be normalized but must not be * the zero vector. */ public void setDirection(Vec3f direction) { this.direction.set(direction); this.direction.normalize(); recalc(); } public Vec3f getPoint() { return point; } /** * Setter does some work to maintain internal caches. */ public void setPoint(Vec3f point) { this.point.set(point); recalc(); } /** * Project a point onto the line */ public void projectPoint(Vec3f pt, Vec3f projPt) { float dotp = direction.dot(pt); projPt.set(direction); projPt.scale(dotp); projPt.add(alongVec); } /** * Find closest point on this line to the given ray, specified by * start point and direction. If ray is parallel to this line, * returns false and closestPoint is not modified. */ public boolean closestPointToRay(Vec3f rayStart, Vec3f rayDirection, Vec3f closestPoint) { // Line 1 is this one. Line 2 is the incoming one. Mat2f A = new Mat2f(); A.set(0, 0, -direction.lengthSquared()); A.set(1, 1, -rayDirection.lengthSquared()); A.set(0, 1, direction.dot(rayDirection)); A.set(1, 0, A.get(0, 1)); if (Math.abs(A.determinant()) == 0.0f) { return false; } if (!A.invert()) { return false; } Vec2f b = new Vec2f(); b.setX(point.dot(direction) - rayStart.dot(direction)); b.setY(rayStart.dot(rayDirection) - point.dot(rayDirection)); Vec2f x = new Vec2f(); A.xformVec(b, x); if (x.y() < 0) { // Means that ray start is closest point to this line closestPoint.set(rayStart); } else { closestPoint.set(direction); closestPoint.scale(x.x()); closestPoint.add(point); } return true; } //---------------------------------------------------------------------- // Internals only below this point // private void recalc() {<FILL_FUNCTION_BODY>} }
float denom = direction.lengthSquared(); if (denom == 0.0f) { throw new RuntimeException("Line.recalc: ERROR: direction was the zero vector " + "(not allowed)"); } alongVec.set(point.minus(direction.times(point.dot(direction))));
1,077
85
1,162
<no_super_class>
gephi_gephi
gephi/modules/VisualizationImpl/src/main/java/org/gephi/lib/gleem/linalg/Mat2f.java
Mat2f
makeIdent
class Mat2f { private final float[] data; /** * Creates new matrix initialized to the zero matrix */ public Mat2f() { data = new float[4]; } /** * Initialize to the identity matrix. */ public void makeIdent() {<FILL_FUNCTION_BODY>} /** * Gets the (i,j)th element of this matrix, where i is the row * index and j is the column index */ public float get(int i, int j) { return data[2 * i + j]; } /** * Sets the (i,j)th element of this matrix, where i is the row * index and j is the column index */ public void set(int i, int j, float val) { data[2 * i + j] = val; } /** * Set column i (i=[0..1]) to vector v. */ public void setCol(int i, Vec2f v) { set(0, i, v.x()); set(1, i, v.y()); } /** * Set row i (i=[0..1]) to vector v. */ public void setRow(int i, Vec2f v) { set(i, 0, v.x()); set(i, 1, v.y()); } /** * Transpose this matrix in place. */ public void transpose() { float t = get(0, 1); set(0, 1, get(1, 0)); set(1, 0, t); } /** * Return the determinant. */ public float determinant() { return (get(0, 0) * get(1, 1) - get(1, 0) * get(0, 1)); } /** * Full matrix inversion in place. If matrix is singular, returns * false and matrix contents are untouched. If you know the matrix * is orthonormal, you can call transpose() instead. */ public boolean invert() { float det = determinant(); if (det == 0.0f) { return false; } // Create transpose of cofactor matrix in place float t = get(0, 0); set(0, 0, get(1, 1)); set(1, 1, t); set(0, 1, -get(0, 1)); set(1, 0, -get(1, 0)); // Now divide by determinant for (int i = 0; i < 4; i++) { data[i] /= det; } return true; } /** * Multiply a 2D vector by this matrix. NOTE: src and dest must be * different vectors. */ public void xformVec(Vec2f src, Vec2f dest) { dest.set(get(0, 0) * src.x() + get(0, 1) * src.y(), get(1, 0) * src.x() + get(1, 1) * src.y()); } /** * Returns this * b; creates new matrix */ public Mat2f mul(Mat2f b) { Mat2f tmp = new Mat2f(); tmp.mul(this, b); return tmp; } /** * this = a * b */ public void mul(Mat2f a, Mat2f b) { for (int rc = 0; rc < 2; rc++) { for (int cc = 0; cc < 2; cc++) { float tmp = 0.0f; for (int i = 0; i < 2; i++) { tmp += a.get(rc, i) * b.get(i, cc); } set(rc, cc, tmp); } } } public Matf toMatf() { Matf out = new Matf(2, 2); for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { out.set(i, j, get(i, j)); } } return out; } @Override public String toString() { String endl = System.getProperty("line.separator"); return "(" + get(0, 0) + ", " + get(0, 1) + endl + get(1, 0) + ", " + get(1, 1) + ")"; } }
for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { if (i == j) { set(i, j, 1.0f); } else { set(i, j, 0.0f); } } }
1,222
88
1,310
<no_super_class>
gephi_gephi
gephi/modules/VisualizationImpl/src/main/java/org/gephi/lib/gleem/linalg/Mat3f.java
Mat3f
mul
class Mat3f { private final float[] data; /** * Creates new matrix initialized to the zero matrix */ public Mat3f() { data = new float[9]; } /** * Initialize to the identity matrix. */ public void makeIdent() { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { if (i == j) { set(i, j, 1.0f); } else { set(i, j, 0.0f); } } } } /** * Gets the (i,j)th element of this matrix, where i is the row * index and j is the column index */ public float get(int i, int j) { return data[3 * i + j]; } /** * Sets the (i,j)th element of this matrix, where i is the row * index and j is the column index */ public void set(int i, int j, float val) { data[3 * i + j] = val; } /** * Set column i (i=[0..2]) to vector v. */ public void setCol(int i, Vec3f v) { set(0, i, v.x()); set(1, i, v.y()); set(2, i, v.z()); } /** * Set row i (i=[0..2]) to vector v. */ public void setRow(int i, Vec3f v) { set(i, 0, v.x()); set(i, 1, v.y()); set(i, 2, v.z()); } /** * Transpose this matrix in place. */ public void transpose() { float t; t = get(0, 1); set(0, 1, get(1, 0)); set(1, 0, t); t = get(0, 2); set(0, 2, get(2, 0)); set(2, 0, t); t = get(1, 2); set(1, 2, get(2, 1)); set(2, 1, t); } /** * Return the determinant. Computed across the zeroth row. */ public float determinant() { return (get(0, 0) * (get(1, 1) * get(2, 2) - get(2, 1) * get(1, 2)) + get(0, 1) * (get(2, 0) * get(1, 2) - get(1, 0) * get(2, 2)) + get(0, 2) * (get(1, 0) * get(2, 1) - get(2, 0) * get(1, 1))); } /** * Full matrix inversion in place. If matrix is singular, returns * false and matrix contents are untouched. If you know the matrix * is orthonormal, you can call transpose() instead. */ public boolean invert() { float det = determinant(); if (det == 0.0f) { return false; } // Form cofactor matrix Mat3f cf = new Mat3f(); cf.set(0, 0, get(1, 1) * get(2, 2) - get(2, 1) * get(1, 2)); cf.set(0, 1, get(2, 0) * get(1, 2) - get(1, 0) * get(2, 2)); cf.set(0, 2, get(1, 0) * get(2, 1) - get(2, 0) * get(1, 1)); cf.set(1, 0, get(2, 1) * get(0, 2) - get(0, 1) * get(2, 2)); cf.set(1, 1, get(0, 0) * get(2, 2) - get(2, 0) * get(0, 2)); cf.set(1, 2, get(2, 0) * get(0, 1) - get(0, 0) * get(2, 1)); cf.set(2, 0, get(0, 1) * get(1, 2) - get(1, 1) * get(0, 2)); cf.set(2, 1, get(1, 0) * get(0, 2) - get(0, 0) * get(1, 2)); cf.set(2, 2, get(0, 0) * get(1, 1) - get(1, 0) * get(0, 1)); // Now copy back transposed for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { set(i, j, cf.get(j, i) / det); } } return true; } /** * Multiply a 3D vector by this matrix. NOTE: src and dest must be * different vectors. */ public void xformVec(Vec3f src, Vec3f dest) { dest.set(get(0, 0) * src.x() + get(0, 1) * src.y() + get(0, 2) * src.z(), get(1, 0) * src.x() + get(1, 1) * src.y() + get(1, 2) * src.z(), get(2, 0) * src.x() + get(2, 1) * src.y() + get(2, 2) * src.z()); } /** * Returns this * b; creates new matrix */ public Mat3f mul(Mat3f b) { Mat3f tmp = new Mat3f(); tmp.mul(this, b); return tmp; } /** * this = a * b */ public void mul(Mat3f a, Mat3f b) {<FILL_FUNCTION_BODY>} public Matf toMatf() { Matf out = new Matf(3, 3); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { out.set(i, j, get(i, j)); } } return out; } @Override public String toString() { String endl = System.getProperty("line.separator"); return "(" + get(0, 0) + ", " + get(0, 1) + ", " + get(0, 2) + endl + get(1, 0) + ", " + get(1, 1) + ", " + get(1, 2) + endl + get(2, 0) + ", " + get(2, 1) + ", " + get(2, 2) + ")"; } }
for (int rc = 0; rc < 3; rc++) { for (int cc = 0; cc < 3; cc++) { float tmp = 0.0f; for (int i = 0; i < 3; i++) { tmp += a.get(rc, i) * b.get(i, cc); } set(rc, cc, tmp); } }
1,887
107
1,994
<no_super_class>
gephi_gephi
gephi/modules/VisualizationImpl/src/main/java/org/gephi/lib/gleem/linalg/Matf.java
Matf
mul
class Matf { private final float[] data; private final int nCol; // number of columns private final int nRow; // number of columns public Matf(int nRow, int nCol) { data = new float[nRow * nCol]; this.nCol = nCol; this.nRow = nRow; } public Matf(Matf arg) { nRow = arg.nRow; nCol = arg.nCol; data = new float[nRow * nCol]; System.arraycopy(arg.data, 0, data, 0, data.length); } public int nRow() { return nRow; } public int nCol() { return nCol; } /** * Gets the (i,j)th element of this matrix, where i is the row * index and j is the column index */ public float get(int i, int j) { return data[nCol * i + j]; } /** * Sets the (i,j)th element of this matrix, where i is the row * index and j is the column index */ public void set(int i, int j, float val) { data[nCol * i + j] = val; } /** * Returns transpose of this matrix; creates new matrix */ public Matf transpose() { Matf tmp = new Matf(nCol, nRow); for (int i = 0; i < nRow; i++) { for (int j = 0; j < nCol; j++) { tmp.set(j, i, get(i, j)); } } return tmp; } /** * Returns this * b; creates new matrix */ public Matf mul(Matf b) throws DimensionMismatchException { if (nCol() != b.nRow()) { throw new DimensionMismatchException(); } Matf tmp = new Matf(nRow(), b.nCol()); for (int i = 0; i < nRow(); i++) { for (int j = 0; j < b.nCol(); j++) { float val = 0; for (int t = 0; t < nCol(); t++) { val += get(i, t) * b.get(t, j); } tmp.set(i, j, val); } } return tmp; } /** * Returns this * v, assuming v is a column vector. */ public Vecf mul(Vecf v) throws DimensionMismatchException {<FILL_FUNCTION_BODY>} /** * If this is a 2x2 matrix, returns it as a Mat2f. */ public Mat2f toMat2f() throws DimensionMismatchException { if (nRow() != 2 || nCol() != 2) { throw new DimensionMismatchException(); } Mat2f tmp = new Mat2f(); for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { tmp.set(i, j, get(i, j)); } } return tmp; } /** * If this is a 3x3 matrix, returns it as a Mat3f. */ public Mat3f toMat3f() throws DimensionMismatchException { if (nRow() != 3 || nCol() != 3) { throw new DimensionMismatchException(); } Mat3f tmp = new Mat3f(); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { tmp.set(i, j, get(i, j)); } } return tmp; } /** * If this is a 4x4 matrix, returns it as a Mat4f. */ public Mat4f toMat4f() throws DimensionMismatchException { if (nRow() != 4 || nCol() != 4) { throw new DimensionMismatchException(); } Mat4f tmp = new Mat4f(); for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { tmp.set(i, j, get(i, j)); } } return tmp; } }
if (nCol() != v.length()) { throw new DimensionMismatchException(); } Vecf out = new Vecf(nRow()); for (int i = 0; i < nRow(); i++) { float tmp = 0; for (int j = 0; j < nCol(); j++) { tmp += get(i, j) * v.get(j); } out.set(i, tmp); } return out;
1,166
127
1,293
<no_super_class>
gephi_gephi
gephi/modules/VisualizationImpl/src/main/java/org/gephi/lib/gleem/linalg/MathUtil.java
MathUtil
makePerpendicular
class MathUtil { /** * Makes an arbitrary vector perpendicular to <B>src</B> and * inserts it into <B>dest</B>. Returns false if the source vector * was equal to (0, 0, 0). */ public static boolean makePerpendicular(Vec3f src, Vec3f dest) {<FILL_FUNCTION_BODY>} /** * Returns 1 if the sign of the given argument is positive; -1 if * negative; 0 if 0. */ public static int sgn(float f) { if (f > 0) { return 1; } else if (f < 0) { return -1; } return 0; } /** * Clamps argument between min and max values. */ public static float clamp(float val, float min, float max) { if (val < min) { return min; } if (val > max) { return max; } return val; } /** * Clamps argument between min and max values. */ public static int clamp(int val, int min, int max) { if (val < min) { return min; } if (val > max) { return max; } return val; } }
if ((src.x() == 0.0f) && (src.y() == 0.0f) && (src.z() == 0.0f)) { return false; } if (src.x() != 0.0f) { if (src.y() != 0.0f) { dest.set(-src.y(), src.x(), 0.0f); } else { dest.set(-src.z(), 0.0f, src.x()); } } else { dest.set(1.0f, 0.0f, 0.0f); } return true;
356
167
523
<no_super_class>
gephi_gephi
gephi/modules/VisualizationImpl/src/main/java/org/gephi/lib/gleem/linalg/Plane.java
Plane
intersectRay
class Plane { /** * Constant for faster projection and intersection */ float c; /** * Normalized */ private final Vec3f normal; private final Vec3f point; /** * Default constructor initializes normal to (0, 1, 0) and point to * (0, 0, 0) */ public Plane() { normal = new Vec3f(0, 1, 0); point = new Vec3f(0, 0, 0); recalc(); } /** * Sets all parameters of plane. Plane has normal <b>normal</b> and * goes through the point <b>point</b>. Normal does not need to be * unit length but must not be the zero vector. */ public Plane(Vec3f normal, Vec3f point) { this.normal = new Vec3f(normal); this.normal.normalize(); this.point = new Vec3f(point); recalc(); } /** * Normal is normalized internally, so <b>normal</b> is not * necessarily equal to <code>plane.setNormal(normal); * plane.getNormal();</code> */ public Vec3f getNormal() { return normal; } /** * Setter does some work to maintain internal caches. Normal does * not need to be unit length but must not be the zero vector. */ public void setNormal(Vec3f normal) { this.normal.set(normal); this.normal.normalize(); recalc(); } public Vec3f getPoint() { return point; } /** * Setter does some work to maintain internal caches */ public void setPoint(Vec3f point) { this.point.set(point); recalc(); } /** * Project a point onto the plane */ public void projectPoint(Vec3f pt, Vec3f projPt) { float scale = normal.dot(pt) - c; projPt.set(pt.minus(normal.times(normal.dot(point) - c))); } /** * Intersect a ray with the plane. Returns true if intersection occurred, false * otherwise. This is a two-sided ray cast. */ public boolean intersectRay(Vec3f rayStart, Vec3f rayDirection, IntersectionPoint intPt) {<FILL_FUNCTION_BODY>} //---------------------------------------------------------------------- // Internals only below this point // private void recalc() { c = normal.dot(point); } }
float denom = normal.dot(rayDirection); if (denom == 0) { return false; } intPt.setT((c - normal.dot(rayStart)) / denom); intPt.setIntersectionPoint(rayStart.plus(rayDirection.times(intPt.getT()))); return true;
720
90
810
<no_super_class>
gephi_gephi
gephi/modules/VisualizationImpl/src/main/java/org/gephi/lib/gleem/linalg/PlaneUV.java
PlaneUV
projectPoint
class PlaneUV { private final Vec3f origin = new Vec3f(); /** * Normalized */ private final Vec3f normal = new Vec3f(); private final Vec3f uAxis = new Vec3f(); private final Vec3f vAxis = new Vec3f(); /** * Default constructor initializes normal to (0, 1, 0), origin to * (0, 0, 0), U axis to (1, 0, 0) and V axis to (0, 0, -1). */ public PlaneUV() { setEverything(new Vec3f(0, 1, 0), new Vec3f(0, 0, 0), new Vec3f(1, 0, 0), new Vec3f(0, 0, -1)); } /** * Takes normal vector and a point which the plane goes through * (which becomes the plane's "origin"). Normal does NOT have to be * normalized, but may not be zero vector. U and V axes are * initialized to arbitrary values. */ public PlaneUV(Vec3f normal, Vec3f origin) { setOrigin(origin); setNormal(normal); } /** * Takes normal vector, point which plane goes through, and the "u" * axis in the plane. Computes the "v" axis by taking the cross * product of the normal and the u axis. Axis must be perpendicular * to normal. Normal and uAxis do NOT have to be normalized, but * neither may be the zero vector. */ public PlaneUV(Vec3f normal, Vec3f origin, Vec3f uAxis) { setOrigin(origin); setNormalAndU(normal, uAxis); } /** * Takes normal vector, point which plane goes through, and both * the u and v axes. u axis cross v axis = normal. Normal, uAxis, and * vAxis do NOT have to be normalized, but none may be the zero * vector. */ public PlaneUV(Vec3f normal, Vec3f origin, Vec3f uAxis, Vec3f vAxis) { setEverything(normal, origin, uAxis, vAxis); } public Vec3f getOrigin() { return new Vec3f(origin); } /** * Set the origin, through which this plane goes and with respect * to which U and V coordinates are computed */ public void setOrigin(Vec3f origin) { this.origin.set(origin); } /** * Normal, U and V axes must be orthogonal and satisfy U cross V = * normal, do not need to be unit length but must not be the zero * vector. */ public void setNormalAndUV(Vec3f normal, Vec3f uAxis, Vec3f vAxis) { setEverything(normal, origin, uAxis, vAxis); } /** * This version computes the V axis from (normal cross U). */ public void setNormalAndU(Vec3f normal, Vec3f uAxis) { Vec3f vAxis = normal.cross(uAxis); setEverything(normal, origin, uAxis, vAxis); } /** * Normal, U and V axes are normalized internally, so, for example, * <b>normal</b> is not necessarily equal to * <code>plane.setNormal(normal); plane.getNormal();</code> */ public Vec3f getNormal() { return normal; } /** * This version sets the normal vector and generates new U and V * axes. */ public void setNormal(Vec3f normal) { Vec3f uAxis = new Vec3f(); MathUtil.makePerpendicular(normal, uAxis); Vec3f vAxis = normal.cross(uAxis); setEverything(normal, origin, uAxis, vAxis); } public Vec3f getUAxis() { return uAxis; } public Vec3f getVAxis() { return vAxis; } /** * Project a point onto the plane */ public void projectPoint(Vec3f point, Vec3f projPt, Vec2f uvCoords) {<FILL_FUNCTION_BODY>} /** * Intersect a ray with this plane, outputting not only the 3D * intersection point but also the U, V coordinates of the * intersection. Returns true if intersection occurred, false * otherwise. This is a two-sided ray cast. */ public boolean intersectRay(Vec3f rayStart, Vec3f rayDirection, IntersectionPoint intPt, Vec2f uvCoords) { float denom = rayDirection.dot(normal); if (denom == 0.0f) { return false; } Vec3f tmpDir = new Vec3f(); tmpDir.sub(origin, rayStart); float t = tmpDir.dot(normal) / denom; // Find intersection point Vec3f tmpPt = new Vec3f(); tmpPt.set(rayDirection); tmpPt.scale(t); tmpPt.add(rayStart); intPt.setIntersectionPoint(tmpPt); intPt.setT(t); // Find UV coords tmpDir.sub(intPt.getIntersectionPoint(), origin); uvCoords.set(tmpDir.dot(uAxis), tmpDir.dot(vAxis)); return true; } private void setEverything(Vec3f normal, Vec3f origin, Vec3f uAxis, Vec3f vAxis) { this.normal.set(normal); this.origin.set(origin); this.uAxis.set(uAxis); this.vAxis.set(vAxis); this.normal.normalize(); this.uAxis.normalize(); this.vAxis.normalize(); } }
// Using projPt as a temporary projPt.sub(point, origin); float dotp = normal.dot(projPt); // Component perpendicular to plane Vec3f tmpDir = new Vec3f(); tmpDir.set(normal); tmpDir.scale(dotp); projPt.sub(projPt, tmpDir); // Take dot products with basis vectors uvCoords.set(projPt.dot(uAxis), projPt.dot(vAxis)); // Add on center to intersection point projPt.add(origin);
1,612
157
1,769
<no_super_class>
gephi_gephi
gephi/modules/VisualizationImpl/src/main/java/org/gephi/lib/gleem/linalg/Vec2f.java
Vec2f
addScaled
class Vec2f { private float x; private float y; public Vec2f() { } public Vec2f(Vec2f arg) { this(arg.x, arg.y); } public Vec2f(float x, float y) { set(x, y); } public Vec2f copy() { return new Vec2f(this); } public void set(Vec2f arg) { set(arg.x, arg.y); } public void set(float x, float y) { this.x = x; this.y = y; } /** * Sets the ith component, 0 &lt;= i &lt; 2 */ public void set(int i, float val) { switch (i) { case 0: x = val; break; case 1: y = val; break; default: throw new IndexOutOfBoundsException(); } } /** * Gets the ith component, 0 &lt;= i &lt; 2 */ public float get(int i) { switch (i) { case 0: return x; case 1: return y; default: throw new IndexOutOfBoundsException(); } } public float x() { return x; } public float y() { return y; } public void setX(float x) { this.x = x; } public void setY(float y) { this.y = y; } public float dot(Vec2f arg) { return x * arg.x + y * arg.y; } public float length() { return (float) Math.sqrt(lengthSquared()); } public float lengthSquared() { return this.dot(this); } public void normalize() { float len = length(); if (len == 0.0f) { return; } scale(1.0f / len); } /** * Returns this * val; creates new vector */ public Vec2f times(float val) { Vec2f tmp = new Vec2f(this); tmp.scale(val); return tmp; } /** * this = this * val */ public void scale(float val) { x *= val; y *= val; } /** * Returns this + arg; creates new vector */ public Vec2f plus(Vec2f arg) { Vec2f tmp = new Vec2f(); tmp.add(this, arg); return tmp; } /** * this = this + b */ public void add(Vec2f b) { add(this, b); } /** * this = a + b */ public void add(Vec2f a, Vec2f b) { x = a.x + b.x; y = a.y + b.y; } /** * Returns this + s * arg; creates new vector */ public Vec2f addScaled(float s, Vec2f arg) {<FILL_FUNCTION_BODY>} /** * this = a + s * b */ public void addScaled(Vec2f a, float s, Vec2f b) { x = a.x + s * b.x; y = a.y + s * b.y; } /** * Returns this - arg; creates new vector */ public Vec2f minus(Vec2f arg) { Vec2f tmp = new Vec2f(); tmp.sub(this, arg); return tmp; } /** * this = this - b */ public void sub(Vec2f b) { sub(this, b); } /** * this = a - b */ public void sub(Vec2f a, Vec2f b) { x = a.x - b.x; y = a.y - b.y; } public Vecf toVecf() { Vecf out = new Vecf(2); for (int i = 0; i < 2; i++) { out.set(i, get(i)); } return out; } @Override public String toString() { return "(" + x + ", " + y + ")"; } }
Vec2f tmp = new Vec2f(); tmp.addScaled(this, s, arg); return tmp;
1,234
36
1,270
<no_super_class>
gephi_gephi
gephi/modules/VisualizationImpl/src/main/java/org/gephi/lib/gleem/linalg/Vec3d.java
Vec3d
addScaled
class Vec3d { private double x; private double y; private double z; public Vec3d() { } public Vec3d(Vec3d arg) { set(arg); } public Vec3d(double x, double y, double z) { set(x, y, z); } public Vec3d copy() { return new Vec3d(this); } /** * Convert to single-precision */ public Vec3f toFloat() { return new Vec3f((float) x, (float) y, (float) z); } public void set(Vec3d arg) { set(arg.x, arg.y, arg.z); } public void set(double x, double y, double z) { this.x = x; this.y = y; this.z = z; } /** * Sets the ith component, 0 &lt;= i &lt; 3 */ public void set(int i, double val) { switch (i) { case 0: x = val; break; case 1: y = val; break; case 2: z = val; break; default: throw new IndexOutOfBoundsException(); } } /** * Gets the ith component, 0 &lt;= i &lt; 3 */ public double get(int i) { switch (i) { case 0: return x; case 1: return y; case 2: return z; default: throw new IndexOutOfBoundsException(); } } public double x() { return x; } public double y() { return y; } public double z() { return z; } public void setX(double x) { this.x = x; } public void setY(double y) { this.y = y; } public void setZ(double z) { this.z = z; } public double dot(Vec3d arg) { return x * arg.x + y * arg.y + z * arg.z; } public double length() { return Math.sqrt(lengthSquared()); } public double lengthSquared() { return this.dot(this); } public void normalize() { double len = length(); if (len == 0.0) { return; } scale(1.0f / len); } /** * Returns this * val; creates new vector */ public Vec3d times(double val) { Vec3d tmp = new Vec3d(this); tmp.scale(val); return tmp; } /** * this = this * val */ public void scale(double val) { x *= val; y *= val; z *= val; } /** * Returns this + arg; creates new vector */ public Vec3d plus(Vec3d arg) { Vec3d tmp = new Vec3d(); tmp.add(this, arg); return tmp; } /** * this = this + b */ public void add(Vec3d b) { add(this, b); } /** * this = a + b */ public void add(Vec3d a, Vec3d b) { x = a.x + b.x; y = a.y + b.y; z = a.z + b.z; } /** * Returns this + s * arg; creates new vector */ public Vec3d addScaled(double s, Vec3d arg) { Vec3d tmp = new Vec3d(); tmp.addScaled(this, s, arg); return tmp; } /** * this = a + s * b */ public void addScaled(Vec3d a, double s, Vec3d b) {<FILL_FUNCTION_BODY>} /** * Returns this - arg; creates new vector */ public Vec3d minus(Vec3d arg) { Vec3d tmp = new Vec3d(); tmp.sub(this, arg); return tmp; } /** * this = this - b */ public void sub(Vec3d b) { sub(this, b); } /** * this = a - b */ public void sub(Vec3d a, Vec3d b) { x = a.x - b.x; y = a.y - b.y; z = a.z - b.z; } /** * Returns this cross arg; creates new vector */ public Vec3d cross(Vec3d arg) { Vec3d tmp = new Vec3d(); tmp.cross(this, arg); return tmp; } /** * this = a cross b. NOTE: "this" must be a different vector than * both a and b. */ public void cross(Vec3d a, Vec3d b) { x = a.y * b.z - a.z * b.y; y = a.z * b.x - a.x * b.z; z = a.x * b.y - a.y * b.x; } @Override public String toString() { return "(" + x + ", " + y + ", " + z + ")"; } }
x = a.x + s * b.x; y = a.y + s * b.y; z = a.z + s * b.z;
1,533
45
1,578
<no_super_class>
gephi_gephi
gephi/modules/VisualizationImpl/src/main/java/org/gephi/lib/gleem/linalg/Vec3f.java
Vec3f
cross
class Vec3f { public static final Vec3f X_AXIS = new Vec3f(1, 0, 0); public static final Vec3f Y_AXIS = new Vec3f(0, 1, 0); public static final Vec3f Z_AXIS = new Vec3f(0, 0, 1); public static final Vec3f NEG_X_AXIS = new Vec3f(-1, 0, 0); public static final Vec3f NEG_Y_AXIS = new Vec3f(0, -1, 0); public static final Vec3f NEG_Z_AXIS = new Vec3f(0, 0, -1); private float x; private float y; private float z; public Vec3f() { } public Vec3f(Vec3f arg) { set(arg); } public Vec3f(float x, float y, float z) { set(x, y, z); } public Vec3f copy() { return new Vec3f(this); } /** * Convert to double-precision */ public Vec3d toDouble() { return new Vec3d(x, y, z); } public void set(Vec3f arg) { set(arg.x, arg.y, arg.z); } public void set(float x, float y, float z) { this.x = x; this.y = y; this.z = z; } /** * Sets the ith component, 0 &lt;= i &lt; 3 */ public void set(int i, float val) { switch (i) { case 0: x = val; break; case 1: y = val; break; case 2: z = val; break; default: throw new IndexOutOfBoundsException(); } } /** * Gets the ith component, 0 &lt;= i &lt; 3 */ public float get(int i) { switch (i) { case 0: return x; case 1: return y; case 2: return z; default: throw new IndexOutOfBoundsException(); } } public float x() { return x; } public float y() { return y; } public float z() { return z; } public void setX(float x) { this.x = x; } public void setY(float y) { this.y = y; } public void setZ(float z) { this.z = z; } public float dot(Vec3f arg) { return x * arg.x + y * arg.y + z * arg.z; } public float length() { return (float) Math.sqrt(lengthSquared()); } public float lengthSquared() { return this.dot(this); } public void normalize() { float len = length(); if (len == 0.0f) { return; } scale(1.0f / len); } /** * Returns this * val; creates new vector */ public Vec3f times(float val) { Vec3f tmp = new Vec3f(this); tmp.scale(val); return tmp; } /** * this = this * val */ public void scale(float val) { x *= val; y *= val; z *= val; } /** * Returns this + arg; creates new vector */ public Vec3f plus(Vec3f arg) { Vec3f tmp = new Vec3f(); tmp.add(this, arg); return tmp; } /** * this = this + b */ public void add(Vec3f b) { add(this, b); } /** * this = a + b */ public void add(Vec3f a, Vec3f b) { x = a.x + b.x; y = a.y + b.y; z = a.z + b.z; } /** * Returns this + s * arg; creates new vector */ public Vec3f addScaled(float s, Vec3f arg) { Vec3f tmp = new Vec3f(); tmp.addScaled(this, s, arg); return tmp; } /** * this = a + s * b */ public void addScaled(Vec3f a, float s, Vec3f b) { x = a.x + s * b.x; y = a.y + s * b.y; z = a.z + s * b.z; } /** * Returns this - arg; creates new vector */ public Vec3f minus(Vec3f arg) { Vec3f tmp = new Vec3f(); tmp.sub(this, arg); return tmp; } /** * this = this - b */ public void sub(Vec3f b) { sub(this, b); } /** * this = a - b */ public void sub(Vec3f a, Vec3f b) { x = a.x - b.x; y = a.y - b.y; z = a.z - b.z; } /** * Returns this cross arg; creates new vector */ public Vec3f cross(Vec3f arg) { Vec3f tmp = new Vec3f(); tmp.cross(this, arg); return tmp; } /** * this = a cross b. NOTE: "this" must be a different vector than * both a and b. */ public void cross(Vec3f a, Vec3f b) {<FILL_FUNCTION_BODY>} /** * Sets each component of this vector to the product of the * component with the corresponding component of the argument * vector. */ public void componentMul(Vec3f arg) { x *= arg.x; y *= arg.y; z *= arg.z; } public Vecf toVecf() { Vecf out = new Vecf(3); for (int i = 0; i < 3; i++) { out.set(i, get(i)); } return out; } @Override public String toString() { return "(" + x + ", " + y + ", " + z + ")"; } }
x = a.y * b.z - a.z * b.y; y = a.z * b.x - a.x * b.z; z = a.x * b.y - a.y * b.x;
1,838
63
1,901
<no_super_class>
gephi_gephi
gephi/modules/VisualizationImpl/src/main/java/org/gephi/lib/gleem/linalg/Vec4f.java
Vec4f
dot
class Vec4f { private float x; private float y; private float z; private float w; public Vec4f() { } public Vec4f(Vec4f arg) { set(arg); } public Vec4f(float x, float y, float z, float w) { set(x, y, z, w); } public Vec4f copy() { return new Vec4f(this); } public void set(Vec4f arg) { set(arg.x, arg.y, arg.z, arg.w); } public void set(float x, float y, float z, float w) { this.x = x; this.y = y; this.z = z; this.w = w; } /** * Sets the ith component, 0 &lt;= i &lt; 4 */ public void set(int i, float val) { switch (i) { case 0: x = val; break; case 1: y = val; break; case 2: z = val; break; case 3: w = val; break; default: throw new IndexOutOfBoundsException(); } } /** * Gets the ith component, 0 &lt;= i &lt; 4 */ public float get(int i) { switch (i) { case 0: return x; case 1: return y; case 2: return z; case 3: return w; default: throw new IndexOutOfBoundsException(); } } public float x() { return x; } public float y() { return y; } public float z() { return z; } public float w() { return w; } public void setX(float x) { this.x = x; } public void setY(float y) { this.y = y; } public void setZ(float z) { this.z = z; } public void setW(float w) { this.w = w; } public float dot(Vec4f arg) {<FILL_FUNCTION_BODY>} public float length() { return (float) Math.sqrt(lengthSquared()); } public float lengthSquared() { return this.dot(this); } public void normalize() { float len = length(); if (len == 0.0f) { return; } scale(1.0f / len); } /** * Returns this * val; creates new vector */ public Vec4f times(float val) { Vec4f tmp = new Vec4f(this); tmp.scale(val); return tmp; } /** * this = this * val */ public void scale(float val) { x *= val; y *= val; z *= val; w *= val; } /** * Returns this + arg; creates new vector */ public Vec4f plus(Vec4f arg) { Vec4f tmp = new Vec4f(); tmp.add(this, arg); return tmp; } /** * this = this + b */ public void add(Vec4f b) { add(this, b); } /** * this = a + b */ public void add(Vec4f a, Vec4f b) { x = a.x + b.x; y = a.y + b.y; z = a.z + b.z; w = a.w + b.w; } /** * Returns this + s * arg; creates new vector */ public Vec4f addScaled(float s, Vec4f arg) { Vec4f tmp = new Vec4f(); tmp.addScaled(this, s, arg); return tmp; } /** * this = a + s * b */ public void addScaled(Vec4f a, float s, Vec4f b) { x = a.x + s * b.x; y = a.y + s * b.y; z = a.z + s * b.z; w = a.w + s * b.w; } /** * Returns this - arg; creates new vector */ public Vec4f minus(Vec4f arg) { Vec4f tmp = new Vec4f(); tmp.sub(this, arg); return tmp; } /** * this = this - b */ public void sub(Vec4f b) { sub(this, b); } /** * this = a - b */ public void sub(Vec4f a, Vec4f b) { x = a.x - b.x; y = a.y - b.y; z = a.z - b.z; w = a.w - b.w; } /** * Sets each component of this vector to the product of the * component with the corresponding component of the argument * vector. */ public void componentMul(Vec4f arg) { x *= arg.x; y *= arg.y; z *= arg.z; w *= arg.w; } public Vecf toVecf() { Vecf out = new Vecf(4); for (int i = 0; i < 4; i++) { out.set(i, get(i)); } return out; } @Override public String toString() { return "(" + x + ", " + y + ", " + z + ")"; } }
return x * arg.x + y * arg.y + z * arg.z + w * arg.w;
1,616
30
1,646
<no_super_class>
gephi_gephi
gephi/modules/VisualizationImpl/src/main/java/org/gephi/lib/gleem/linalg/Vecf.java
Vecf
toVec3f
class Vecf { private final float[] data; public Vecf(int n) { data = new float[n]; } public Vecf(Vecf arg) { data = new float[arg.data.length]; System.arraycopy(arg.data, 0, data, 0, data.length); } public int length() { return data.length; } public float get(int i) { return data[i]; } public void set(int i, float val) { data[i] = val; } public Vec2f toVec2f() throws DimensionMismatchException { if (length() != 2) { throw new DimensionMismatchException(); } Vec2f out = new Vec2f(); for (int i = 0; i < 2; i++) { out.set(i, get(i)); } return out; } public Vec3f toVec3f() throws DimensionMismatchException {<FILL_FUNCTION_BODY>} public Veci toInt() { Veci out = new Veci(length()); for (int i = 0; i < length(); i++) { out.set(i, (int) get(i)); } return out; } }
if (length() != 3) { throw new DimensionMismatchException(); } Vec3f out = new Vec3f(); for (int i = 0; i < 3; i++) { out.set(i, get(i)); } return out;
361
79
440
<no_super_class>
gephi_gephi
gephi/modules/VisualizationImpl/src/main/java/org/gephi/lib/gleem/linalg/Veci.java
Veci
toVecf
class Veci { private final int[] data; public Veci(int n) { data = new int[n]; } public Veci(Veci arg) { data = new int[arg.data.length]; System.arraycopy(arg.data, 0, data, 0, data.length); } public int length() { return data.length; } public int get(int i) { return data[i]; } public void set(int i, int val) { data[i] = val; } public Vec2f toVec2f() throws DimensionMismatchException { if (length() != 2) { throw new DimensionMismatchException(); } Vec2f out = new Vec2f(); for (int i = 0; i < 2; i++) { out.set(i, get(i)); } return out; } public Vec3f toVec3f() throws DimensionMismatchException { if (length() != 3) { throw new DimensionMismatchException(); } Vec3f out = new Vec3f(); for (int i = 0; i < 3; i++) { out.set(i, get(i)); } return out; } public Vecf toVecf() {<FILL_FUNCTION_BODY>} }
Vecf out = new Vecf(length()); for (int i = 0; i < length(); i++) { out.set(i, get(i)); } return out;
385
54
439
<no_super_class>
gephi_gephi
gephi/modules/VisualizationImpl/src/main/java/org/gephi/visualization/GraphLimits.java
GraphLimits
getDistanceFromPoint
class GraphLimits { private float minXoctree; private float maxXoctree; private float minYoctree; private float maxYoctree; private float minZoctree; private float maxZoctree; private Vec3f closestPoint = new Vec3f(0, 0, 0); private float maxWeight; private float minWeight; public synchronized float getMaxXoctree() { return maxXoctree; } public synchronized void setMaxXoctree(float maxXoctree) { this.maxXoctree = maxXoctree; } public synchronized float getMaxYoctree() { return maxYoctree; } public synchronized void setMaxYoctree(float maxYoctree) { this.maxYoctree = maxYoctree; } public synchronized float getMaxZoctree() { return maxZoctree; } public synchronized void setMaxZoctree(float maxZoctree) { this.maxZoctree = maxZoctree; } public synchronized float getMinXoctree() { return minXoctree; } public synchronized void setMinXoctree(float minXoctree) { this.minXoctree = minXoctree; } public synchronized float getMinYoctree() { return minYoctree; } public synchronized void setMinYoctree(float minYoctree) { this.minYoctree = minYoctree; } public synchronized float getMinZoctree() { return minZoctree; } public synchronized void setMinZoctree(float minZoctree) { this.minZoctree = minZoctree; } public synchronized float getDistanceFromPoint(float x, float y, float z) {<FILL_FUNCTION_BODY>} public void setClosestPoint(Vec3f closestPoint) { this.closestPoint = closestPoint; } public float getMaxWeight() { return maxWeight; } public void setMaxWeight(float maxWeight) { this.maxWeight = maxWeight; } public float getMinWeight() { return minWeight; } public void setMinWeight(float minWeight) { this.minWeight = minWeight; } }
float dis = (float) Math.sqrt( (closestPoint.x() - x) * (closestPoint.x() - x) + (closestPoint.y() - y) * (closestPoint.y() - y) + (closestPoint.z() - z) * (closestPoint.z() - z)); return dis; //Minimum distance with the 8 points of the cube, poor method /*double min = Double.POSITIVE_INFINITY; min = Math.min(min,Math.sqrt((minXoctree-x)*(minXoctree-x)+(minYoctree-y)*(minYoctree-y)+(maxZoctree-z)*(maxZoctree-z))); min = Math.min(min,Math.sqrt((maxXoctree-x)*(maxXoctree-x)+(minYoctree-y)*(minYoctree-y)+(maxZoctree-z)*(maxZoctree-z))); min = Math.min(min,Math.sqrt((minXoctree-x)*(minXoctree-x)+(maxYoctree-y)*(maxYoctree-y)+(maxZoctree-z)*(maxZoctree-z))); min = Math.min(min,Math.sqrt((maxXoctree-x)*(maxXoctree-x)+(maxYoctree-y)*(maxYoctree-y)+(maxZoctree-z)*(maxZoctree-z))); min = Math.min(min,Math.sqrt((minXoctree-x)*(minXoctree-x)+(minYoctree-y)*(minYoctree-y)+(minZoctree-z)*(minZoctree-z))); min = Math.min(min,Math.sqrt((maxXoctree-x)*(maxXoctree-x)+(minYoctree-y)*(minYoctree-y)+(minZoctree-z)*(minZoctree-z))); min = Math.min(min,Math.sqrt((minXoctree-x)*(minXoctree-x)+(maxYoctree-y)*(maxYoctree-y)+(minZoctree-z)*(minZoctree-z))); min = Math.min(min,Math.sqrt((maxXoctree-x)*(maxXoctree-x)+(maxYoctree-y)*(maxYoctree-y)+(minZoctree-z)*(minZoctree-z))); return (float)min;*/
632
639
1,271
<no_super_class>
gephi_gephi
gephi/modules/VisualizationImpl/src/main/java/org/gephi/visualization/VizModelPersistenceProvider.java
VizModelPersistenceProvider
writeXML
class VizModelPersistenceProvider implements WorkspaceXMLPersistenceProvider { @Override public void writeXML(XMLStreamWriter writer, Workspace workspace) {<FILL_FUNCTION_BODY>} @Override public void readXML(XMLStreamReader reader, Workspace workspace) { VizModel vizModel = workspace.getLookup().lookup(VizModel.class); if (vizModel == null) { vizModel = new VizModel(workspace); workspace.add(vizModel); } Lookup.getDefault().lookup(VizController.class) .refreshWorkspace();//Necessary to get events from reading xml properties such as background color changed try { vizModel.readXML(reader, workspace); } catch (XMLStreamException ex) { throw new RuntimeException(ex); } } @Override public String getIdentifier() { return "vizmodel"; } }
VizModel model = workspace.getLookup().lookup(VizModel.class); if (model != null) { try { model.writeXML(writer); } catch (XMLStreamException ex) { throw new RuntimeException(ex); } }
249
75
324
<no_super_class>
gephi_gephi
gephi/modules/VisualizationImpl/src/main/java/org/gephi/visualization/api/selection/SelectionManager.java
SelectionManager
resetSelection
class SelectionManager implements VizArchitecture { private final List<ChangeListener> listeners; private VizConfig vizConfig; private AbstractEngine engine; //Settings private int mouseSelectionDiameter; private boolean mouseSelectionZoomProportionnal; private boolean selectionUpdateWhileDragging; //States private boolean blocked = false; private boolean wasAutoSelectNeighbors = false; private boolean wasRectangleSelection = false; private boolean wasDragSelection = false; private boolean wasDirectSelection = false; public SelectionManager() { listeners = new ArrayList<>(); } @Override public void initArchitecture() { this.vizConfig = VizController.getInstance().getVizConfig(); this.engine = VizController.getInstance().getEngine(); mouseSelectionDiameter = vizConfig.getMouseSelectionDiameter(); selectionUpdateWhileDragging = vizConfig.isMouseSelectionUpdateWhileDragging(); } public void blockSelection(boolean block) { if (vizConfig.isRectangleSelection()) { this.blocked = block; vizConfig.setSelectionEnable(!block); fireChangeEvent(); } else { setDirectMouseSelection(); } } public void disableSelection() { vizConfig.setSelectionEnable(false); this.blocked = false; fireChangeEvent(); } public void setDraggingEnable(boolean dragging) { vizConfig.setMouseSelectionUpdateWhileDragging(!dragging); fireChangeEvent(); } public void setRectangleSelection() { vizConfig.setDraggingEnable(false); vizConfig.setCustomSelection(false); vizConfig.setSelectionEnable(true); engine.setRectangleSelection(true); this.blocked = false; fireChangeEvent(); } public void setDirectMouseSelection() { vizConfig.setSelectionEnable(true); vizConfig.setDraggingEnable(false); vizConfig.setCustomSelection(false); engine.setRectangleSelection(false); this.blocked = false; fireChangeEvent(); } public void setDraggingMouseSelection() { vizConfig.setDraggingEnable(true); vizConfig.setMouseSelectionUpdateWhileDragging(false); vizConfig.setSelectionEnable(true); vizConfig.setCustomSelection(false); engine.setRectangleSelection(false); this.blocked = false; fireChangeEvent(); } public void setCustomSelection() { vizConfig.setSelectionEnable(false); vizConfig.setDraggingEnable(false); vizConfig.setCustomSelection(true); engine.setRectangleSelection(false); //this.blocked = true; fireChangeEvent(); } public void resetSelection(VizModel vizModel) {<FILL_FUNCTION_BODY>} public List<Node> getSelectedNodes() { return engine.getSelectedUnderlyingNodes(); } public List<Edge> getSelectedEdges() { return engine.getSelectedUnderlyingEdges(); } public void selectNodes(Node[] nodes, VizModel vizModel) { if (!isCustomSelection()) { wasAutoSelectNeighbors = vizModel.isAutoSelectNeighbor(); wasDragSelection = isDraggingEnabled(); wasDirectSelection = isDirectMouseSelection(); wasRectangleSelection = isRectangleSelection(); vizModel.setAutoSelectNeighbor(false); setCustomSelection(); } Model[] models = engine.getNodeModelsForNodes(nodes); engine.selectObject(models); } public void selectEdges(Edge[] edges, VizModel vizModel) { if (!isCustomSelection()) { wasAutoSelectNeighbors = vizModel.isAutoSelectNeighbor(); wasDragSelection = isDraggingEnabled(); wasDirectSelection = isDirectMouseSelection(); wasRectangleSelection = isRectangleSelection(); vizModel.setAutoSelectNeighbor(false); setCustomSelection(); } Model[] models = engine.getEdgeModelsForEdges(edges); engine.selectObject(models); } public void centerOnNode(Node node) { if (node != null) { VizController.getInstance().getGraphIO() .centerOnCoordinate(node.x(), node.y(), node.z() + node.size() * 40); engine.getScheduler().requireUpdateVisible(); } } public void centerOnEdge(Edge edge) { if (edge != null) { Node source = edge.getSource(); Node target = edge.getTarget(); float len = (float) Math.hypot(source.x() - target.x(), source.y() - target.y()); VizController.getInstance().getGraphIO() .centerOnCoordinate((source.x() + target.x()) / 2f, (source.y() + target.y()) / 2f, (source.z() + target.z()) / 2f + len * 5); engine.getScheduler().requireUpdateVisible(); } } public int getMouseSelectionDiameter() { return mouseSelectionDiameter; } public void setMouseSelectionDiameter(int mouseSelectionDiameter) { this.mouseSelectionDiameter = mouseSelectionDiameter; } public boolean isMouseSelectionZoomProportionnal() { return mouseSelectionZoomProportionnal; } public void setMouseSelectionZoomProportionnal(boolean mouseSelectionZoomProportionnal) { this.mouseSelectionZoomProportionnal = mouseSelectionZoomProportionnal; } public boolean isSelectionUpdateWhileDragging() { return selectionUpdateWhileDragging; } public void setSelectionUpdateWhileDragging(boolean selectionUpdateWhileDragging) { this.selectionUpdateWhileDragging = selectionUpdateWhileDragging; } public boolean isBlocked() { return blocked; } public boolean isRectangleSelection() { return vizConfig.isSelectionEnable() && vizConfig.isRectangleSelection(); } public boolean isDirectMouseSelection() { return vizConfig.isSelectionEnable() && !vizConfig.isRectangleSelection() && !vizConfig.isDraggingEnable(); } public boolean isCustomSelection() { return vizConfig.isCustomSelection(); } public boolean isSelectionEnabled() { return vizConfig.isSelectionEnable(); } public boolean isDraggingEnabled() { return vizConfig.isDraggingEnable(); } //Event public void addChangeListener(ChangeListener changeListener) { listeners.add(changeListener); } public void removeChangeListener(ChangeListener changeListener) { listeners.remove(changeListener); } private void fireChangeEvent() { ChangeEvent evt = new ChangeEvent(this); for (ChangeListener l : listeners) { l.stateChanged(evt); } } }
if (isCustomSelection()) { engine.resetSelection(); vizModel.setAutoSelectNeighbor(wasAutoSelectNeighbors); if (wasRectangleSelection) { setRectangleSelection(); } else if (wasDragSelection) { setDraggingMouseSelection(); } else if (wasDirectSelection) { setDirectMouseSelection(); } }
1,814
100
1,914
<no_super_class>