|
@@ -25,31 +25,16 @@ public class Module extends Group implements IGUIEventClient{
|
|
|
|
|
|
public String ID = "";
|
|
|
public Vector<String> Prefix;
|
|
|
+ protected String Type = "module";
|
|
|
public HBox hlayout = new HBox();
|
|
|
public VBox inputs = new VBox();
|
|
|
public VBox outputs = new VBox();
|
|
|
public boolean isSelected = false;
|
|
|
|
|
|
- public static Module DefaultModule(){
|
|
|
- return new Module(new Vector<String>(), "", Color.DARKBLUE);
|
|
|
- }
|
|
|
-
|
|
|
- public Module(Vector<String> prefix, String id, Color color){
|
|
|
+ private void init(Color color){
|
|
|
setFocusTraversable(true);
|
|
|
_eventHandler = GUIEventHandler.getEventHandler();
|
|
|
_eventHandler.addEventListener(this);
|
|
|
- Prefix = prefix;
|
|
|
- ID = id;
|
|
|
- Rectangle titlebar;
|
|
|
- Rectangle background;
|
|
|
- Text caption;
|
|
|
- addInput(new Input(this,"1"));
|
|
|
- addInput(new Input(this,"2"));
|
|
|
- addInput(new Input(this,"3"));
|
|
|
-
|
|
|
- addOutput(new Output(this,"1"));
|
|
|
- addOutput(new Output(this,"2"));
|
|
|
- addOutput(new Output(this,"3"));
|
|
|
|
|
|
inputs.setSpacing(10);
|
|
|
|
|
@@ -62,8 +47,10 @@ public class Module extends Group implements IGUIEventClient{
|
|
|
hlayout.setTranslateY(30);
|
|
|
|
|
|
// System.out.println("[Module]: pressed: "+ hbox.getPrefWidth());
|
|
|
+ Rectangle titlebar;
|
|
|
+ Rectangle background;
|
|
|
+ Text caption;
|
|
|
|
|
|
- // JSONObject parameters
|
|
|
titlebar = new Rectangle(0.0f, 0.0f, 150-20, 20.0f);
|
|
|
titlebar.setArcWidth(10.0f);
|
|
|
titlebar.setArcHeight(10.0f);
|
|
@@ -74,7 +61,7 @@ public class Module extends Group implements IGUIEventClient{
|
|
|
background.setFill(Color.GRAY);
|
|
|
caption = new Text("TEST");
|
|
|
caption.setFont(new Font("Arial", 15));
|
|
|
- caption.setFill(Color.WHITE);
|
|
|
+ caption.getStyleClass().add("text");
|
|
|
caption.setX(10);
|
|
|
caption.setY(15);
|
|
|
|
|
@@ -111,6 +98,30 @@ public class Module extends Group implements IGUIEventClient{
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ public static Module DefaultModule(){
|
|
|
+ return new Module(new Vector<String>(), "", Color.DARKBLUE);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public Module(JSONObject json){
|
|
|
+ init(Color.DARKCYAN);
|
|
|
+ }
|
|
|
+
|
|
|
+ public Module(Vector<String> prefix, String id, Color color){
|
|
|
+ Prefix = prefix;
|
|
|
+ ID = id;
|
|
|
+
|
|
|
+ addInput(new Input(this,"1"));
|
|
|
+ addInput(new Input(this,"2"));
|
|
|
+ addInput(new Input(this,"3"));
|
|
|
+
|
|
|
+ addOutput(new Output(this,"1"));
|
|
|
+ addOutput(new Output(this,"2"));
|
|
|
+ addOutput(new Output(this,"3"));
|
|
|
+
|
|
|
+ init(color);
|
|
|
+ }
|
|
|
+
|
|
|
public void addInput(Input in){
|
|
|
inputs.getChildren().add(in);
|
|
|
}
|
|
@@ -151,6 +162,7 @@ public class Module extends Group implements IGUIEventClient{
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("prefix", Prefix);
|
|
|
json.put("id", ID);
|
|
|
+ json.put("type", Type);
|
|
|
return json;
|
|
|
}
|
|
|
|