mirror of
https://codeberg.org/qg-info-unterricht/zpg-graphentester.git
synced 2026-03-25 04:58:24 +01:00
Sync with upstream
This commit is contained in:
parent
39a2f13410
commit
66e8fa72bf
135 changed files with 38902 additions and 37757 deletions
|
|
@ -7,11 +7,13 @@ import javafx.fxml.*;
|
|||
import javafx.scene.control.*;
|
||||
import javafx.event.*;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.input.ContextMenuEvent;
|
||||
import javafx.scene.layout.*;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.text.*;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.scene.control.Alert.AlertType;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -25,7 +27,8 @@ import javafx.collections.ObservableList;
|
|||
* oder eine Kante fokussiert.
|
||||
*
|
||||
* @author Thomas Schaller
|
||||
* @version v6.7 (9.12.2020)
|
||||
* @version 24.06.2021 (v6.9)
|
||||
* v6.9: Context-Menü für die ToDo-Liste: Knoten löschen
|
||||
*/
|
||||
|
||||
public class UnterTabMitController extends TabMitController {
|
||||
|
|
@ -33,7 +36,6 @@ public class UnterTabMitController extends TabMitController {
|
|||
@FXML
|
||||
private VBox infoBox;
|
||||
|
||||
|
||||
@FXML
|
||||
private Button wertButton;
|
||||
|
||||
|
|
@ -58,19 +60,18 @@ public class UnterTabMitController extends TabMitController {
|
|||
@FXML
|
||||
Button bStatus;
|
||||
|
||||
|
||||
@FXML
|
||||
Button bGehezu;
|
||||
|
||||
|
||||
@FXML
|
||||
Button bAnfang;
|
||||
|
||||
|
||||
@FXML
|
||||
Button bEnde;
|
||||
|
||||
|
||||
@FXML
|
||||
Button bSortieren;
|
||||
|
||||
|
||||
@FXML
|
||||
private CheckBox cbFarbeAutomatisch;
|
||||
|
||||
|
|
@ -91,14 +92,12 @@ public class UnterTabMitController extends TabMitController {
|
|||
getTabPane().getTabs().remove(this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
buildAuswahl();
|
||||
|
||||
|
||||
this.bAnfang.managedProperty().bind(bAnfang.visibleProperty());
|
||||
this.bEnde.managedProperty().bind(bEnde.visibleProperty());
|
||||
this.bSortieren.managedProperty().bind(bSortieren.visibleProperty());
|
||||
|
||||
|
||||
viewer.setGraph(graph,options);
|
||||
viewer.setHvalue(0.5);
|
||||
|
|
@ -138,11 +137,11 @@ public class UnterTabMitController extends TabMitController {
|
|||
|
||||
super.initialize();
|
||||
}
|
||||
|
||||
|
||||
public void setGraph(Graph graph, GraphOptions options) {
|
||||
if(graph.getAnzahlKnoten()==0) {
|
||||
getTabPane().getTabs().remove(this);
|
||||
return;
|
||||
getTabPane().getTabs().remove(this);
|
||||
return;
|
||||
}
|
||||
options.fokusArt = this.options.fokusArt;
|
||||
options.auswahl = this.options.auswahl;
|
||||
|
|
@ -154,12 +153,10 @@ public class UnterTabMitController extends TabMitController {
|
|||
viewer.setRestrictTo(null);
|
||||
buildAuswahl();
|
||||
super.setGraph(graph,options);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void buildAuswahl() {
|
||||
|
||||
auswahl = new ArrayList<GraphElement>();
|
||||
if(options.auswahl == 0) { // Alle Knoten/Kanten gewählt
|
||||
if(options.fokusArt == 0) // Knoten
|
||||
|
|
@ -192,10 +189,10 @@ public class UnterTabMitController extends TabMitController {
|
|||
Knoten k = (Knoten) ge;
|
||||
String beschreibung="";
|
||||
if(options.showVertexInfo && !k.getInfotext().isEmpty())
|
||||
beschreibung = k.getInfotext();
|
||||
beschreibung = k.getInfotext();
|
||||
else
|
||||
beschreibung = "Knoten"+ graph.getNummer(k);
|
||||
|
||||
beschreibung = "Knoten"+ graph.getNummer(k);
|
||||
|
||||
if(options.showVertexValue) {
|
||||
if(k.getDoubleWert() == k.getIntWert())
|
||||
beschreibung += " ("+k.getIntWert()+")";
|
||||
|
|
@ -318,7 +315,7 @@ public class UnterTabMitController extends TabMitController {
|
|||
public void updateInfofeld() {
|
||||
GraphElement f = viewer.getRestrictTo();
|
||||
if( f instanceof Knoten) {
|
||||
this.setText(viewer.getGraph().getKnoteninfo((Knoten) f, false));
|
||||
this.setText(viewer.getGraph().getKnoteninfo((Knoten) f, false));
|
||||
}
|
||||
Knoten k = viewer.getSelectedKnoten();
|
||||
Kante ka = viewer.getSelectedKante();
|
||||
|
|
@ -364,7 +361,7 @@ public class UnterTabMitController extends TabMitController {
|
|||
else
|
||||
infoBox.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
|
|
@ -441,6 +438,25 @@ public class UnterTabMitController extends TabMitController {
|
|||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
void toDoContextMenu(ContextMenuEvent event) {
|
||||
if(lvAuswahl.getSelectionModel().getSelectedIndex() >= 0) {
|
||||
|
||||
Alert alert =
|
||||
new Alert(AlertType.NONE,
|
||||
"Soll der Knoten aus der ToDo-Liste gelöscht werden?",
|
||||
ButtonType.OK,
|
||||
ButtonType.CANCEL);
|
||||
alert.setTitle("ToDo-Liste");
|
||||
Optional<ButtonType> result = alert.showAndWait();
|
||||
|
||||
if (result.get() == ButtonType.OK) {
|
||||
auswahl.remove(lvAuswahl.getSelectionModel().getSelectedIndex());
|
||||
fillLvAuswahl();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
void bNaechster(ActionEvent event) {
|
||||
|
||||
|
|
@ -453,18 +469,18 @@ public class UnterTabMitController extends TabMitController {
|
|||
|
||||
// @FXML
|
||||
// void bListeAnpassen(ActionEvent event) {
|
||||
// buildAuswahl();
|
||||
// fillLvAuswahl();
|
||||
// buildAuswahl();
|
||||
// fillLvAuswahl();
|
||||
|
||||
// }
|
||||
|
||||
// @FXML
|
||||
// void bNeuerTab(ActionEvent event) {
|
||||
// GraphOptions neu = options.copy();
|
||||
// neu.parent = viewer.getRestrictTo();
|
||||
// if(neu.parent == null) neu.parent = viewer.getSelectedKnoten();
|
||||
// neu.bildAnzeigen = false;
|
||||
// tabOeffnen(neu);
|
||||
// GraphOptions neu = options.copy();
|
||||
// neu.parent = viewer.getRestrictTo();
|
||||
// if(neu.parent == null) neu.parent = viewer.getSelectedKnoten();
|
||||
// neu.bildAnzeigen = false;
|
||||
// tabOeffnen(neu);
|
||||
// }
|
||||
|
||||
@FXML
|
||||
|
|
@ -497,7 +513,7 @@ public class UnterTabMitController extends TabMitController {
|
|||
double v = Double.parseDouble(result.get());
|
||||
k.setWert(v);
|
||||
this.fillLvAuswahl();
|
||||
|
||||
|
||||
viewer.updateImage();
|
||||
updateInfofeld();
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue