drools-examples pacman patch
----------------------------
Key: JBRULES-2496
URL:
https://jira.jboss.org/jira/browse/JBRULES-2496
Project: Drools
Issue Type: Patch
Security Level: Public (Everyone can see)
Environment: OS X platform
Reporter: Randy Secrist
Assignee: Mark Proctor
Priority: Trivial
pacman example needs to better support UIManager calls for non windows platforms. Also,
the monster rule has a missing common on the GoUp rule.
------
begin patch
------
Index: drools-examples-drl/src/main/java/org/drools/examples/pacman/PacmanGui.java
===================================================================
--- drools-examples-drl/src/main/java/org/drools/examples/pacman/PacmanGui.java (revision
32679)
+++ drools-examples-drl/src/main/java/org/drools/examples/pacman/PacmanGui.java (working
copy)
@@ -27,9 +27,19 @@
public static void init(final StatefulKnowledgeSession ksession) {
try {
- UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel" );
-
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
-
//UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
+ String osName = System.getProperty("os.name");
+ if (osName.indexOf("Linux") >= 0) {
+
UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
+ }
+ else if (osName.indexOf("Windows") >= 0) {
+ UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel" );
+ }
+ else if (osName.indexOf("Mac") >= 0) {
+ UIManager.setLookAndFeel("com.apple.laf.AquaLookAndFeel");
+ }
+ else {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ }
} catch ( UnsupportedLookAndFeelException ex ) {
ex.printStackTrace();
} catch ( IllegalAccessException ex ) {
Index: drools-examples-drl/src/main/rules/org/drools/examples/pacman/monster.drl
===================================================================
--- drools-examples-drl/src/main/rules/org/drools/examples/pacman/monster.drl (revision
32679)
+++ drools-examples-drl/src/main/rules/org/drools/examples/pacman/monster.drl (working
copy)
@@ -122,7 +122,7 @@
then
retract( $d );
retract( $df );
- insert( new Direction($df.fromChar, 0 Direction.UP ) );
+ insert( new Direction($df.fromChar, 0, Direction.UP ) );
end
/**
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira