-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Kevin Harrington
committed
Jul 11, 2024
1 parent
041a9c3
commit 0e3afaa
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
src/main/java/com/neuronrobotics/bowlerstudio/scripting/FXMLBowlerLoader.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,56 @@ | ||
package com.neuronrobotics.bowlerstudio.scripting; | ||
|
||
import java.io.File; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
|
||
import com.neuronrobotics.bowlerstudio.vitamins.Vitamins; | ||
|
||
import eu.mihosoft.vrl.v3d.CSG; | ||
import javafx.fxml.FXMLLoader; | ||
import javafx.scene.control.Tab; | ||
import javafx.scene.layout.Pane; | ||
|
||
public class FXMLBowlerLoader implements IScriptingLanguage { | ||
|
||
@Override | ||
public Object inlineScriptRun(File xml, ArrayList<Object> args) throws Exception { | ||
FXMLLoader loader = new FXMLLoader(xml.toURI().toURL()); | ||
Pane newLoadedPane = loader.load(); | ||
// Create a tab | ||
Tab myTab = new Tab(); | ||
//set the title of the new tab | ||
myTab.setContent(newLoadedPane); | ||
return myTab; | ||
} | ||
|
||
@Override | ||
public Object inlineScriptRun(String code, ArrayList<Object> args) throws Exception { | ||
throw new RuntimeException("This engine only supports files"); | ||
} | ||
|
||
@Override | ||
public String getShellType() { | ||
// TODO Auto-generated method stub | ||
return "fxml"; | ||
} | ||
@Override | ||
public boolean getIsTextFile() { | ||
// TODO Auto-generated method stub | ||
return true; | ||
} | ||
/** | ||
* Get the contents of an empty file | ||
* | ||
* @return | ||
*/ | ||
public String getDefaultContents() { | ||
return ""; | ||
} | ||
@Override | ||
public ArrayList<String> getFileExtenetion() { | ||
// TODO Auto-generated method stub | ||
return new ArrayList<>(Arrays.asList("fxml","FXML","FxML")); | ||
} | ||
|
||
} |
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