Commit 4f569e82 authored by stram's avatar stram
Browse files

bug fix regarding graph display size

git-svn-id: https://dynaq.opendfki.de/repos/application/trunk@1044 8b50620d-ddf8-0310-9f5d-8b2f31fd9ac4
parent 6cfef2e5
package org.dynaq.documents.graph;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
......@@ -113,7 +114,6 @@ public class DynaQDocumentGraph extends JPanel implements ActionListener, Compon
graph_button.addActionListener(this);
}
buttonsPanel.add(graph_button);
buttonsPanel.addComponentListener(this);
this.add(buttonsPanel, BorderLayout.NORTH);
} else {
......@@ -370,6 +370,12 @@ public class DynaQDocumentGraph extends JPanel implements ActionListener, Compon
int height = this.getHeight();
int x = this.getX();
int y = this.getY();
/*
if(slider!=null){
int sliderHeight = slider.getHeight();
height -= sliderHeight;
}
*/
rectangle.setRect(x, y, width, height);
return rectangle;
......@@ -380,8 +386,15 @@ public class DynaQDocumentGraph extends JPanel implements ActionListener, Compon
int height = this.getHeight();
int x = this.getX();
int y = this.getY();
if(rectangle!=null){
rectangle.setRect(x, y, width, height);
if(graphPanel!=null){
BorderLayout graphLayout = (BorderLayout) graphPanel.getLayout();
Component graphDisplay = graphLayout.getLayoutComponent(BorderLayout.CENTER);
rectangle.setFrame(graphDisplay.getBounds());
} else {
rectangle.setRect(x, y, width, height);
}
}
}
......@@ -464,11 +477,13 @@ public class DynaQDocumentGraph extends JPanel implements ActionListener, Compon
edge_nrm_date.setValueRange(slider.getMinimum(), slider.getMaximum(), slider.getMinimum(), slider.getMaximum());
}
//add the graph panel
//add the graph and slider panel
graphPanel = new JPanel(new BorderLayout());
graphPanel.add(slider, BorderLayout.PAGE_END);
graphPanel.add(display, BorderLayout.CENTER);
graphPanel.add(slider, BorderLayout.SOUTH);
graphPanel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
graphPanel.addComponentListener(this);
this.add(graphPanel, BorderLayout.CENTER);
this.setVisible(true); // show the window
......
......@@ -61,8 +61,9 @@ public class UnderlyingGraph {
//updating the authors information, including adding new nodes
for(String authorName:creators){
if(creatorMap.containsKey(authorName)){ //updating author date in case already exists
Node authorNode = creatorMap.get(authorName);
String pAuthorName = authorName.toLowerCase().trim();
if(creatorMap.containsKey(pAuthorName)){ //updating author date in case already exists
Node authorNode = creatorMap.get(pAuthorName);
Date authorDate = authorNode.getDate(DATE);
if(date!=null && date.before(authorDate)){
authorNode.setDate(DATE, date);
......@@ -74,7 +75,7 @@ public class UnderlyingGraph {
if(date!=null){
authorNode.setDate(DATE, date);
}
creatorMap.put(authorName, authorNode);
creatorMap.put(pAuthorName, authorNode);
}
}
......@@ -82,10 +83,10 @@ public class UnderlyingGraph {
if(creators.size()>1){
for(int i=0; i<(creators.size()-1); i++){
String author1name = creators.get(i);
Node author1 = creatorMap.get(author1name);
Node author1 = creatorMap.get(author1name.toLowerCase().trim());
for(int j=i+1; j<creators.size(); j++){
String author2name = creators.get(j);
Node author2 = creatorMap.get(author2name);
Node author2 = creatorMap.get(author2name.toLowerCase().trim());
author1.setInt(DEGREE, author1.getInt(DEGREE)+1);
author2.setInt(DEGREE, author2.getInt(DEGREE)+1);
addEdgeToGraph(graph,author1,author2,date);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment