-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
195 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
src/main/java/org/gecko/viewmodel/AutomatonEditorViewModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.gecko.viewmodel; | ||
|
||
public class AutomatonEditorViewModel extends EditorViewModel { | ||
public AutomatonEditorViewModel(SystemViewModel currentSystem) { | ||
super(currentSystem); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.gecko.viewmodel; | ||
|
||
import javafx.beans.property.Property; | ||
import javafx.beans.value.ObservableObjectValue; | ||
import javafx.collections.FXCollections; | ||
import javafx.collections.ObservableList; | ||
import javafx.geometry.Point2D; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.gecko.tools.Tool; | ||
|
||
import java.util.List; | ||
|
||
@Getter @Setter | ||
public abstract class EditorViewModel { | ||
private Property<Point2D> pivot; | ||
private Property<Double> zoomScale; | ||
private ObservableObjectValue<Tool> currentTool; | ||
private ObservableObjectValue<PositionableViewModelElement<?>> focusedElement; | ||
private final SystemViewModel currentSystem; | ||
private final ObservableList<PositionableViewModelElement<?>> containedPositionableViewModelElements; | ||
private List<Tool> tools; | ||
private SelectionManager selectionManager; | ||
|
||
protected EditorViewModel(SystemViewModel systemViewModel) { | ||
currentSystem = systemViewModel; | ||
containedPositionableViewModelElements = FXCollections.observableArrayList(); | ||
//TODO stub | ||
} | ||
|
||
public List<RegionViewModel> getRegionViewModels(StateViewModel stateViewModel) { | ||
//TODO stub | ||
return null; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,31 @@ | ||
package org.gecko.viewmodel; | ||
|
||
import javafx.beans.property.ListProperty; | ||
import javafx.beans.property.SimpleListProperty; | ||
import javafx.beans.value.ObservableObjectValue; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.gecko.model.Element; | ||
import org.gecko.model.GeckoModel; | ||
|
||
import java.util.HashMap; | ||
|
||
@Getter @Setter | ||
public class GeckoViewModel { | ||
private final HashMap<Element, PositionableViewModelElement<?>> modelToViewModel; | ||
private final GeckoModel geckoModel; | ||
private final ViewModelFactory viewModelFactory; | ||
private ObservableObjectValue<EditorViewModel> currentEditor; | ||
private final ListProperty<EditorViewModel> openedEditors; | ||
|
||
public GeckoViewModel(GeckoModel geckoModel) { | ||
modelToViewModel = new HashMap<>(); | ||
this.geckoModel = geckoModel; | ||
viewModelFactory = new ViewModelFactory(this, geckoModel.getModelFactory()); | ||
openedEditors = new SimpleListProperty<>(); | ||
} | ||
|
||
public void switchEditor(SystemViewModel nextSystemViewModel, boolean isAutomatonEditor) { | ||
//TODO stub | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/org/gecko/viewmodel/PositionableViewModelElementVisitor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.gecko.viewmodel; | ||
|
||
public interface PositionableViewModelElementVisitor { | ||
void visit(SystemViewModel systemViewModel); | ||
void visit(RegionViewModel regionViewModel); | ||
void visit(SystemConnectionViewModel systemConnectionViewModel); | ||
void visit(EdgeViewModel edgeViewModel); | ||
void visit(StateViewModel stateViewModel); | ||
void visit(PortViewModel portViewModel); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.gecko.viewmodel; | ||
|
||
import javafx.collections.ObservableList; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.util.List; | ||
import java.util.Stack; | ||
|
||
@Getter @Setter | ||
public class SelectionManager { | ||
private Stack<List<PositionableViewModelElement<?>>> undoSelectionStack; | ||
private Stack<List<PositionableViewModelElement<?>>> redoSelectionStack; | ||
private ObservableList<PositionableViewModelElement<?>> currentSelection; | ||
|
||
public void goBack() { | ||
//TODO stub | ||
} | ||
public void goForward() { | ||
//TODO stub | ||
} | ||
public void select(PositionableViewModelElement<?> element) { | ||
//TODO stub | ||
} | ||
public void select(List<PositionableViewModelElement<?>> elements) { | ||
//TODO stub | ||
} | ||
public void deselect(PositionableViewModelElement<?> element) { | ||
//TODO stub | ||
} | ||
public void deselect(List<PositionableViewModelElement<?>> elements) { | ||
//TODO stub | ||
} | ||
public void deselectAll() { | ||
//TODO stub | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.gecko.viewmodel; | ||
|
||
public class SystemEditorViewModel extends EditorViewModel{ | ||
public SystemEditorViewModel(SystemViewModel currentSystem) { | ||
super(currentSystem); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package org.gecko.viewmodel; | ||
|
||
import org.gecko.model.*; | ||
import org.gecko.model.System; | ||
|
||
public class ViewModelFactory { | ||
private final ModelFactory modelFactory; | ||
private final GeckoViewModel geckoViewModel; | ||
|
||
public ViewModelFactory(GeckoViewModel geckoViewModel, ModelFactory modelFactory) { | ||
this.geckoViewModel = geckoViewModel; | ||
this.modelFactory = modelFactory; | ||
} | ||
public EditorViewModel createEditorViewModel(SystemViewModel systemViewModel, boolean isAutomatonEditor) { | ||
//TODO stub | ||
return null; | ||
} | ||
public StateViewModel createStateViewModelIn(SystemViewModel parentSystem) { | ||
//TODO stub | ||
return null; | ||
} | ||
public StateViewModel createStateViewModelFrom(State state) { | ||
//TODO stub | ||
return null; | ||
} | ||
public EdgeViewModel createEdgeViewModelIn(SystemViewModel parentSystem) { | ||
//TODO stub | ||
return null; | ||
} | ||
public EdgeViewModel createEdgeViewModelFrom(Edge edge) { | ||
//TODO stub | ||
return null; | ||
} | ||
public SystemConnectionViewModel createSystemConnectionViewModelIn(SystemViewModel parentSystem) { | ||
//TODO stub | ||
return null; | ||
} | ||
public SystemConnectionViewModel createSystemConnectionViewModelFrom(SystemConnection systemConnection) { | ||
//TODO stub | ||
return null; | ||
} | ||
public SystemViewModel createSystemViewModelIn(SystemViewModel parentSystem) { | ||
//TODO stub | ||
return null; | ||
} | ||
public SystemViewModel createSystemViewModelFrom(System system) { | ||
//TODO stub | ||
return null; | ||
} | ||
public RegionViewModel createRegionViewModelIn(SystemViewModel parentSystem) { | ||
//TODO stub | ||
return null; | ||
} | ||
public RegionViewModel createRegionViewModelFrom(Region region) { | ||
//TODO stub | ||
return null; | ||
} | ||
public PortViewModel createPortViewModelIn(SystemViewModel systemViewModel) { | ||
//TODO stub | ||
return null; | ||
} | ||
public PortViewModel createPortViewModelFrom(Variable variable) { | ||
//TODO stub | ||
return null; | ||
} | ||
public ContractViewModel createContractViewModelIn(StateViewModel stateViewModel) { | ||
//TODO stub | ||
return null; | ||
} | ||
|
||
} |