Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

Commit

Permalink
Classes navigation in trees
Browse files Browse the repository at this point in the history
  • Loading branch information
Rauks committed Nov 20, 2013
1 parent 5895633 commit 852ba28
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public void loadTreeChart(final ObservableClass classe){
this.bottomMessage.setText("");
this.unloadTreeChart();

TreeChartTask treeBuilder = new TreeChartTask(classe);
TreeChartTask treeBuilder = new TreeChartTask(classe, this);
treeBuilder.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
@Override
public void handle(WorkerStateEvent t) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.Cursor;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.scene.control.TitledPane;
Expand Down Expand Up @@ -97,6 +98,7 @@ public void updateItem(ObservableClass item, boolean empty) {

tooltip.setText(item.getType().getName());
this.setTooltip(tooltip);
this.setCursor(Cursor.HAND);
}
}
}; // ListCell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@ public TreePane getTreePane(){
}
}


private final BigBrotherGuiController caller;
private final ObservableClass rootClasse;

private static final double X_SPACING = 80d;
private static final double Y_SPACING = 100d;

public TreeChartTask(ObservableClass rootClasse){
public TreeChartTask(ObservableClass rootClasse, BigBrotherGuiController caller){
this.rootClasse = rootClasse;
this.caller = caller;
}

/**
Expand All @@ -82,6 +83,7 @@ private Node loadTreeNode(ObservableClass classe, String titlePrefix){
element = (Node) fxmlLoader.load();
TreeNodeController elementController = fxmlLoader.<TreeNodeController>getController();
elementController.setObservation(classe);
elementController.setParentController(this.caller);
if(titlePrefix != null){
elementController.setTitlePrefix(titlePrefix);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import bigbrother.core.model.ObservableClassException;
import bigbrother.core.model.ObservableField;
import bigbrother.core.model.ObservableMethod;
import bigbrother.gui.BigBrotherGuiController;
import java.net.URL;
import java.util.Collection;
import java.util.Collections;
Expand All @@ -21,10 +22,12 @@
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableStringValue;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.Cursor;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.scene.control.SelectionMode;
Expand Down Expand Up @@ -85,6 +88,7 @@ public void updateItem(ObservableMethod item, boolean empty){

tooltip.setText((item.isStatic()?"Statique ":"") + item.getVisibility().getName());
this.setTooltip(tooltip);
this.setCursor(Cursor.HAND);
}
}
};
Expand Down Expand Up @@ -120,6 +124,7 @@ public void updateItem(ObservableField item, boolean empty){

tooltip.setText((item.isStatic()?"Statique ":"") + item.getVisibility().getName());
this.setTooltip(tooltip);
this.setCursor(Cursor.HAND);
}
}
};
Expand Down Expand Up @@ -183,4 +188,19 @@ public int compare(ObservableField t, ObservableField t1) {
public void setTitlePrefix(String prefix){
this.titlePre.set(prefix);
}

public void setParentController(final BigBrotherGuiController controler){
this.fieldsList.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ObservableField>() {
@Override
public void changed(ObservableValue observableObject, ObservableField oldValue, ObservableField newValue) {
controler.loadTreeChart(newValue.getType());
}
});
this.methodsList.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ObservableMethod>() {
@Override
public void changed(ObservableValue observableObject, ObservableMethod oldValue, ObservableMethod newValue) {
controler.loadTreeChart(newValue.getReturnType());
}
});
}
}

0 comments on commit 852ba28

Please sign in to comment.