Skip to content

Commit 8d6fe21

Browse files
committed
cont
1 parent 31d866c commit 8d6fe21

File tree

2 files changed

+200
-28
lines changed

2 files changed

+200
-28
lines changed

stylesheets/bio/gatk/jsonx2fxml.xsl

Lines changed: 94 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,58 @@
88
<xsl:output method="xml" indent="yes"/>
99

1010
<xsl:template match="/">
11+
12+
<xsl:processing-instruction name="import">javafx.scene.layout.*</xsl:processing-instruction>
13+
<xsl:processing-instruction name="import">javafx.scene.paint.*</xsl:processing-instruction>
14+
<xsl:processing-instruction name="import">javafx.scene.control.*</xsl:processing-instruction>
15+
<xsl:processing-instruction name="import">javafx.geometry.*</xsl:processing-instruction>
16+
<xsl:processing-instruction name="import">xx.CheckboxOpt</xsl:processing-instruction>
17+
<VBox>
18+
<MenuBar>
19+
<Menu text="File">
20+
<MenuItem text="Quit" />
21+
</Menu>
22+
</MenuBar>
23+
<TabPane>
24+
25+
<Tab>
26+
<xsl:attribute name="text">
27+
<xsl:value-of select="/j:object/j:string[@name='name']"/>
28+
</xsl:attribute>
29+
<ScrollPane>
30+
<VBox alignment="CENTER_RIGHT" style="-fx-padding: 15px;">
1131
<xsl:apply-templates select="/j:object/j:array[@name='arguments']/j:object"/>
32+
</VBox>
33+
</ScrollPane>
34+
</Tab>
35+
36+
<Tab text="Reference" >
37+
</Tab>
38+
39+
</TabPane>
40+
</VBox>
1241
</xsl:template>
1342

14-
<xsl:template match="j:object[j:string[@name='type'] = 'Boolean']">
43+
<xsl:template match="j:object[j:string[@name='type'] = 'Boolean' or j:string[@name='type'] = 'boolean'] ">
1544
<xsl:text>
1645

1746
</xsl:text>
18-
<fx:root type="javafx.scene.layout.HBox" xmlns:fx="http://javafx.com/fxml">
19-
<TextField editable="false" fx:id="textField" />
20-
<Checbox text="Select..." onAction="#doSelectFile">
21-
<xsl:attribute name="text">
22-
<xsl:value-of select="j:string[@name='summary']"/>
23-
</xsl:attribute>
24-
</Checbox>
25-
26-
<Button text="&#x232b;" onAction="#doClear" >
27-
<tooltip>
28-
<Tooltip text="Remove File" />
29-
</tooltip>
30-
</Button>
31-
</fx:root>
47+
<BorderPane style="-fx-padding: 5 5 5 5;">
48+
49+
<center>
50+
<FlowPane style="-fx-padding: 5 0 5 0;">
51+
<CheckBox style="-fx-font-weight:bold;" BorderPane.alignment="CENTER_LEFT" >
52+
<xsl:apply-templates select="." mode="variable"/>
53+
<xsl:attribute name="text">
54+
<xsl:value-of select="j:string[@name='summary']"/>
55+
</xsl:attribute>
56+
<xsl:apply-templates select="." mode="tooltip"/>
57+
58+
</CheckBox>
59+
</FlowPane>
60+
</center>
61+
</BorderPane>
62+
<Separator/>
3263
<xsl:text>
3364

3465
</xsl:text>
@@ -38,22 +69,57 @@
3869
<xsl:text>
3970

4071
</xsl:text>
41-
<fx:root type="javafx.scene.layout.HBox" xmlns:fx="http://javafx.com/fxml">
42-
<TextField editable="false" fx:id="textField" />
43-
<Button text="Select..." onAction="#doSelectFile">
44-
<tooltip>
45-
<Tooltip text="Select File... " />
46-
</tooltip>
47-
</Button>
48-
<Button text="&#x232b;" onAction="#doClear" >
49-
<tooltip>
50-
<Tooltip text="Remove File" />
51-
</tooltip>
52-
</Button>
53-
</fx:root>
72+
<BorderPane style="-fx-padding: 5 5 5 5;">
73+
<xsl:apply-templates select="." mode="summary"/>
74+
<center>
75+
<FlowPane style="-fx-padding: 5 0 5 20;">
76+
<TextField prefColumnCount="50">
77+
<xsl:apply-templates select="." mode="variable"/>
78+
<xsl:attribute name="promptText">
79+
<xsl:value-of select="j:string[@name='summary']"/>
80+
</xsl:attribute>
81+
</TextField>
82+
</FlowPane>
83+
</center>
84+
<bottom>
85+
<CheckboxOpt/>
86+
</bottom>
87+
</BorderPane>
88+
<Separator/>
5489
<xsl:text>
5590

5691
</xsl:text>
5792
</xsl:template>
5893

94+
95+
<xsl:template match="j:object" mode="variable">
96+
<xsl:attribute name="id">
97+
<xsl:value-of select="substring(j:string[@name='name'],3)"/>
98+
</xsl:attribute>
99+
<xsl:attribute name="fx:id">
100+
<xsl:value-of select="substring(j:string[@name='name'],3)"/>
101+
</xsl:attribute>
102+
</xsl:template>
103+
104+
<xsl:template match="j:object" mode="summary">
105+
<top>
106+
<Label style="-fx-font-weight:bold;">
107+
<xsl:attribute name="text">
108+
<xsl:value-of select="j:string[@name='summary']"/>
109+
</xsl:attribute>
110+
<xsl:apply-templates select="." mode="tooltip"/>
111+
</Label>
112+
</top>
113+
</xsl:template>
114+
115+
<xsl:template match="j:object" mode="tooltip">
116+
<tooltip>
117+
<Tooltip>
118+
<xsl:attribute name="text">
119+
<xsl:value-of select="j:string[@name='fulltext']"/>
120+
</xsl:attribute>
121+
</Tooltip>
122+
</tooltip>
123+
</xsl:template>
124+
59125
</xsl:stylesheet>
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xsl:stylesheet
3+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4+
xmlns:j="http://www.ibm.com/xmlns/prod/2009/jsonx"
5+
xmlns:fx="http://javafx.com/fxml"
6+
version="1.0"
7+
>
8+
<xsl:output method="text" indent="yes"/>
9+
10+
<xsl:template match="/">
11+
<xsl:variable name="engine" select="/j:object/j:string[@name='name']"/>
12+
13+
import javafx.application.Application;
14+
import javafx.application.Platform;
15+
import javafx.event.ActionEvent;
16+
import javafx.event.EventHandler;
17+
import javafx.scene.Scene;
18+
import javafx.scene.control.Button;
19+
import javafx.scene.layout.*;
20+
import javafx.stage.Stage;
21+
import java.util.ResourceBundle;
22+
import javafx.fxml.*;
23+
import javafx.fxml.Initializable;
24+
import javafx.scene.control.*;
25+
import javafx.scene.*;
26+
import javafx.geometry.Rectangle2D;
27+
import javafx.stage.Screen;
28+
29+
public class <xsl:value-of select="$engine"/>
30+
extends Application
31+
{
32+
public <xsl:value-of select="$engine"/>()
33+
{
34+
35+
}
36+
37+
@Override
38+
public void start(Stage stage) throws Exception {
39+
final Parent root;
40+
41+
try
42+
{
43+
root = FXMLLoader.load( getClass().getResource("<xsl:value-of select="$engine"/>.fxml"));
44+
}
45+
catch(Exception err)
46+
{
47+
err.printStackTrace();
48+
throw err;
49+
}
50+
51+
xx.CheckboxOpt x=null;
52+
53+
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
54+
Scene scene = new Scene(root);
55+
56+
stage.setTitle("<xsl:value-of select="$engine"/>");
57+
stage.setScene(scene);
58+
59+
stage.setX(50);
60+
stage.setY(50);
61+
stage.setWidth(primaryScreenBounds.getWidth()-100);
62+
stage.setHeight(primaryScreenBounds.getHeight()-100);
63+
stage.show();
64+
}
65+
66+
@FXML
67+
private void doMenuQuit(final ActionEvent event)
68+
{
69+
Platform.exit();
70+
}
71+
72+
public static void main(String[] args) {
73+
launch( <xsl:value-of select="$engine"/>.class,args);
74+
}
75+
76+
<xsl:apply-templates select="/j:object/j:array[@name='arguments']/j:object"/>
77+
78+
}
79+
80+
</xsl:template>
81+
82+
<xsl:template match="j:object[j:string[@name='type'] = 'Boolean' or j:string[@name='type'] = 'boolean']">
83+
@FXML
84+
<xsl:apply-templates select="." mode="GATK"/>
85+
private CheckBox <xsl:apply-templates select="." mode="variable"/>;
86+
</xsl:template>
87+
88+
<xsl:template match="j:object">
89+
@FXML
90+
<xsl:apply-templates select="." mode="GATK"/>
91+
private TextField <xsl:apply-templates select="." mode="variable"/>;
92+
<xsl:text>
93+
94+
</xsl:text>
95+
</xsl:template>
96+
97+
98+
<xsl:template match="j:object" mode="variable">
99+
<xsl:value-of select="substring(j:string[@name='name'],3)"/>
100+
</xsl:template>
101+
102+
<xsl:template match="j:object" mode="GATK">
103+
@GATK(param="<xsl:value-of select="j:string[@name='name']"/>",type="<xsl:value-of select="j:string[@name='type']"/>")
104+
</xsl:template>
105+
106+
</xsl:stylesheet>

0 commit comments

Comments
 (0)