annotated tag v2.0.0-beta-1 created (now 70b1b81)
This is an automated email from the git hooks/post-receive script. New change to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git at 70b1b81 (tag) tagging 9da47a036a0035e3664b4e05e992bf024a4888df (commit) replaces jaxx-1.6.0-alpha-1@1425 tagged by Tony Chemit on Fri Nov 13 10:33:12 2009 +0000 - Log ----------------------------------------------------------------- create an intermediaire version for Vradi release ----------------------------------------------------------------------- This annotated tag includes the following new commits: new b42200f create version 2.X of jaxx, with non compatible api with jaxx > 1.7.2 new b127410 simplify modules + refactor NavigationTree and Decorator api + add real JComboBox tag handler (incompatible with JAXX 1.X) new 92bf054 simplify modules + refactor NavigationTree and Decorator api + add real JComboBox tag handler (incompatible with JAXX 1.X) new a3d4ea3 [Evolution #74] : pouvoir generer les classes swing (JComboBox, JList,...) new 8f386d6 refactor jaxx 2.x new 6f521a8 refactor jaxx 2.x new d401452 fix javadocs + improve messages in goal new 045c2e4 debut doc de migration 2.0 new 4d9797b changement logs (on veut pas voir nuiton-util en console :)) new 659716f ending migration new 9747dbc evolution #78 : rendre le système d'aide multi-langue + JAXXContext is returned to jaxx.runtime package new 52a8238 - add encoding on goals (should be in JAXXCompiler) - simplify helpIdsStore (only store ids, path will be computed if needed) - maven-helper-plugin common code new a81de5b generate help search index (still does not works everywhere, a shame the code is from com.sun we do not have the source...) new 32d6e7a fix javadoc + documentation new 267de1b utilisation de mavenpom 1.1.0, maven-license-plugin new 1cce9a1 use VelocityTemplateGenerator from maven-helper-plugin new fbdd0b4 no using maven.src.dir in src default-value (this is not a maven property) new bd9a48e Syntax highlighting in demo sources new 380205f use nuiton thirdparty rsyntaxtextarea... It seems somebody does not listen what I said :) new 6ade2c2 do not expose jaxx files new ca721ba Bug categorie item in ItemTreeNavigation fixed new 63569fd Adding helper to return typed selected node new 74a248b fix generics on Class new d105bce fix generics on List new a8119ef do not make equals on class, prefer use method isAssignableFrom new 00bf8b1 move context entry def static methods to jaxx.runtime.Util new 06c2367 Adding repaint node mathods new c9ccdc2 - add a contract NavigationContentUI and use it in NavigationTreeHandler new 56fdd48 - add a contract NavigationContentUI and use it in NavigationTreeHandler - improve demo new bea7197 add gotoChildNode in NavigationTreeHelper new 3177389 Evolution #100: amélioration du design du compilateur new 1a7edad - Evolution #100: amélioration du design du compilateur - Evolution #99: Améliorer le code généré - Evolution #98: les objets JAXX sont serializable new c5fef28 amelioration demo du NavigationTreeHandler new 092ed9f - Evolution #100: amélioration du design du compilateur - Evolution #99: Améliorer le code généré - Evolution #98: les objets JAXX sont serializable new 15a6bbe clean code new 2b1b175 remover verbose flag on tests new 8c4f66c - Evolution #100: amélioration du design du compilateur - Evolution #99: Améliorer le code généré - amelioration des test dans le plugin new 9be82c2 - Evolution #100: amélioration du design du compilateur - Evolution #99: Améliorer le code généré - amelioration des test dans le plugin new e142a7a remove commented unused code new f0c338a remove commented unused code clean code new 1f08b92 remove commented unused code clean code add javadoc new ff7a0b4 - remove commented unused code, clean code, add javadoc - improve warning and error management in JAXXEngine and plugin - improve databinding generation (do not test nullity on root object) - remove when possible the root object prefix in method invocation new 3520056 update license header new a74f64d update jaxx files license header new ee16396 update java files license header new 667ba30 put the Generated By JavaCC comment line at top of file new 0006802 in Util.initContext add a entry in ui context when parentContext is a JAXXOBbject (it will make possible to walk into UI ancestor without using the getParentContainer method new c71ec82 - Evolution #105: permettre l'initialisation des objets sans JavaBean - Evolution #100: amélioration du design du compilateur - Evolution #99: Améliorer le code généré new 8571111 amelioration des renderer sur Decorator (et deplacement vers jaxx.runtime.swing.renderer) new 67318a5 - ajout test sur bindings - les fichiers generes sont dans target/generated-sources new 26dbf5e update demo from changes in compiler and runtime new 0845b8b add multi table decorator new 526a1f8 ajout license new 8560e74 remove a old empty package new dbc2ade ajout license new ebd8813 remove binding from jaxx.compiler package new 0156041 - add a DecoratorProvider to store your decorators - deprecate all states in DecoratorUtils (use a DecoratorProvider to store decorators) new 8d98187 add a DecoratorProviderListCellRenderer new fe25968 add a DecoratorProviderTableCellRenderer new 25b43e3 - use DecoratorProviderListCellRenderer new a5e0262 svn:ingore idea files new 5a2a7f3 fix context error new 12fc47f Evolution #106: Amélioration de l'api des Decorator new 5abed97 use maven-helper-plugin 1.1.0 new test dir layout new d86ecc0 svn ignore idea files new 6b2c33a use mavenpom 1.1.0 new 01cdb08 fix javadoc new f6544f0 add selected-ui in context accessible via helper.getSelectedUi() new e34f786 new icons new 7711568 add fillList + deprecated some code new 6953eed fix error message new ef6a13f Anomalie #120: NPE sur un removeDataBinding new 89dd54b use generics (avoid to generate cast :)) new db92c17 add HidorButton widget, prefer of JXCollapsePanel since it does not works very well out of the JX framework... This widget does not modify any layout new c206fcb add getSimpleName method to obtain the simple name of the class new b5e93d9 - review JAXXContext api (remove getParentContainer methods) - improve JAXXObject api (add getParentContainer + make it javaBeans compatible for PropertyChange events) - improve generation code (avoid use of FQN when possible) - fix bug of name collisions on event generated method from css - the maven-jaxx-plugin tests are all compiling, we should compile them on integration-test - add getSimpleName on class descriptor - clean code, add javadoc, reformat, ... - add L [...] new 891a8fc remove import of SwingUtil in jaxx scripts (auto-import) new ccc92ef add hidor on ListSelector (must finish the ui refresh, still problems) new 437016f multi-selection + double click pour supprimer des elements sur un ListSelector new 863f267 - remove selectUI from context, it is too messy (can not know exactly where it is stored...) - add getParentNode to obtain the first ancestor with a matching internalClass - open api new e20de57 fix NPE if object is root new 2b1c73a remove unused import and code new e74596b fix i18n label new f578cfa fix i18n label new 875cd54 stay for the moment on i18n 1.0.1 new 2acd55d patch pom since can't use at the moment mavenpom 1.1.1 (not released... new 1281dda prepare beta release new 03b93ab prepare beta release new 7a9a1dd [maven-release-plugin] prepare release jaxx-2.0.0-beta-1 new 1bad470 [maven-scm] copy for tag jaxx-2.0.0-beta-1 new fda0a64 [maven-release-plugin] prepare for next development iteration new aefcdd6 [maven-release-plugin] rollback the release of jaxx-2.0.0-beta-1 new c925772 prepare a false release fro Vradi (not a true release since we are on a branch) new 9da47a0 create an intermediaire version for Vradi release The 94 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 9da47a036a0035e3664b4e05e992bf024a4888df Merge: 1bad470 c925772 Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 13 10:33:12 2009 +0000 create an intermediaire version for Vradi release commit c9257727d4557add830d4e0b1e9277d7de3dcfcc Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 13 10:27:16 2009 +0000 prepare a false release fro Vradi (not a true release since we are on a branch) commit aefcdd65ad582d1b5a51e23659d7438f0ddcd67b Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 13 10:10:27 2009 +0000 [maven-release-plugin] rollback the release of jaxx-2.0.0-beta-1 commit fda0a64eae767cb3776ec5b61f1ee36b107d3ad9 Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 13 09:35:04 2009 +0000 [maven-release-plugin] prepare for next development iteration commit 1bad470834165da511b11ac70ff41f75098065fa Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 13 09:34:59 2009 +0000 [maven-scm] copy for tag jaxx-2.0.0-beta-1 commit 7a9a1dd17f3c5647ee9a4a2b18e66994d2294d46 Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 13 09:34:56 2009 +0000 [maven-release-plugin] prepare release jaxx-2.0.0-beta-1 commit 03b93abf1eaa984c52d69610114e8e1df789d7ba Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 13 09:21:35 2009 +0000 prepare beta release commit 1281dda773a17ef82866ef35716951d2c7e6811f Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 13 09:21:03 2009 +0000 prepare beta release commit 2acd55dfcc387609dd75ad809e0fadb5439afdcf Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 13 09:09:54 2009 +0000 patch pom since can't use at the moment mavenpom 1.1.1 (not released... commit 875cd5450c492cf881b4de482925a0854339dfdc Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 13 09:07:03 2009 +0000 stay for the moment on i18n 1.0.1 commit f578cfa2db55c847da9d655e7c594c14729e88df Author: Tony Chemit <chemit@codelutin.com> Date: Mon Nov 9 10:41:36 2009 +0000 fix i18n label commit e74596b01dbb55e383ef4577e93efa92d1d79d33 Author: Tony Chemit <chemit@codelutin.com> Date: Mon Nov 9 10:01:17 2009 +0000 fix i18n label commit 2b1c73a53464d6bcb1b2eed349c5e76237a7ef06 Author: Tony Chemit <chemit@codelutin.com> Date: Sat Nov 7 13:26:40 2009 +0000 remove unused import and code commit e20de57c885b38c1fefdf9bd15cf51c55da601e8 Author: Tony Chemit <chemit@codelutin.com> Date: Sat Nov 7 12:39:42 2009 +0000 fix NPE if object is root commit 863f26763e703a6d27cf76cf2b3d43a79093e2c4 Author: Tony Chemit <chemit@codelutin.com> Date: Sat Nov 7 06:12:53 2009 +0000 - remove selectUI from context, it is too messy (can not know exactly where it is stored...) - add getParentNode to obtain the first ancestor with a matching internalClass - open api commit 437016fe76115c3de844b494264fe9eb9a70f381 Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 6 11:36:48 2009 +0000 multi-selection + double click pour supprimer des elements sur un ListSelector commit ccc92ef37718a3fe00172371635cc0b8984b9950 Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 6 01:00:03 2009 +0000 add hidor on ListSelector (must finish the ui refresh, still problems) commit 891a8fc0068d5f888c946b69a2d529f88857b0ab Author: Tony Chemit <chemit@codelutin.com> Date: Thu Nov 5 22:25:07 2009 +0000 remove import of SwingUtil in jaxx scripts (auto-import) commit b5e93d99cf400e3e55cf53d4403f61acf85501fe Author: Tony Chemit <chemit@codelutin.com> Date: Thu Nov 5 20:44:42 2009 +0000 - review JAXXContext api (remove getParentContainer methods) - improve JAXXObject api (add getParentContainer + make it javaBeans compatible for PropertyChange events) - improve generation code (avoid use of FQN when possible) - fix bug of name collisions on event generated method from css - the maven-jaxx-plugin tests are all compiling, we should compile them on integration-test - add getSimpleName on class descriptor - clean code, add javadoc, reformat, ... - add ListSelectorUI widget commit c206fcb8de8166194f412f0ced990eba01e2b611 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Nov 5 17:02:40 2009 +0000 add getSimpleName method to obtain the simple name of the class commit db92c1700d5fa2005818e18aa16a5c858947cf66 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Nov 5 02:25:48 2009 +0000 add HidorButton widget, prefer of JXCollapsePanel since it does not works very well out of the JX framework... This widget does not modify any layout commit 89dd54ba4dda09bd07a6ea4517c2952738741887 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Nov 5 02:22:45 2009 +0000 use generics (avoid to generate cast :)) commit ef6a13f60052daff7718c8d310d481a84fc490e1 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Nov 5 02:21:58 2009 +0000 Anomalie #120: NPE sur un removeDataBinding commit 6953eeda1d47b08b0e959267a4e296e50c58a4f3 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Nov 4 21:13:46 2009 +0000 fix error message commit 7711568c4363aa8135cfd415ccd264b9d9a98852 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Nov 4 20:35:40 2009 +0000 add fillList + deprecated some code commit e34f786fc61ba040710b7e35961920ab5eb64471 Author: Tony Chemit <chemit@codelutin.com> Date: Tue Nov 3 23:15:39 2009 +0000 new icons commit f6544f0e320083a01050e0c4dcd2449556025112 Author: Tony Chemit <chemit@codelutin.com> Date: Tue Nov 3 21:02:20 2009 +0000 add selected-ui in context accessible via helper.getSelectedUi() commit 01cdb0852e8043ff63d6a815829153880594d7d0 Author: Tony Chemit <chemit@codelutin.com> Date: Mon Nov 2 07:52:03 2009 +0000 fix javadoc commit 6b2c33ae69cd2a3e774e6006f46c091ec62a5d53 Author: Tony Chemit <chemit@codelutin.com> Date: Mon Nov 2 03:47:28 2009 +0000 use mavenpom 1.1.0 commit d86ecc08d7978251ed7c7555f8b253b5b8af2da5 Author: Tony Chemit <chemit@codelutin.com> Date: Mon Nov 2 03:38:30 2009 +0000 svn ignore idea files commit 5abed9713a9d4aca9da5e61fa7c74a9fa966c5a6 Author: Tony Chemit <chemit@codelutin.com> Date: Sun Nov 1 16:21:04 2009 +0000 use maven-helper-plugin 1.1.0 new test dir layout commit 12fc47f2cea51f9fa5a2feea2dd20e082615955f Author: Tony Chemit <chemit@codelutin.com> Date: Fri Oct 30 11:09:43 2009 +0000 Evolution #106: Amélioration de l'api des Decorator commit 5a2a7f3a339b04c6eb88c88c924a231b0cc3c927 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 29 18:21:10 2009 +0000 fix context error commit a5e0262dd45cfc4c454379842e72bd645a72b825 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 29 17:06:25 2009 +0000 svn:ingore idea files commit 25b43e3c7686e768bbe685fa3638bd631b9486b6 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 29 16:48:10 2009 +0000 - use DecoratorProviderListCellRenderer commit fe25968fa478801f14330ced814999792543e1c0 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 29 14:55:21 2009 +0000 add a DecoratorProviderTableCellRenderer commit 8d981876146bbd02d1c4cac22e1653531db466f8 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 29 02:08:58 2009 +0000 add a DecoratorProviderListCellRenderer commit 0156041f3e0e8ab1b651b74538dfcdd7a080f3d4 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 29 01:42:54 2009 +0000 - add a DecoratorProvider to store your decorators - deprecate all states in DecoratorUtils (use a DecoratorProvider to store decorators) commit ebd88138a62a203b1b5796432e87eba5a461b054 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 28 07:54:21 2009 +0000 remove binding from jaxx.compiler package commit dbc2adeddaa0ac612b959ee0a868fedbd23fd6a7 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 28 07:51:37 2009 +0000 ajout license commit 8560e7448a08cb70c1a181bbf64f63a771de2259 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 28 07:44:28 2009 +0000 remove a old empty package commit 526a1f84e6da375665ab29fcb6bc3b492f0f46c3 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 28 07:42:33 2009 +0000 ajout license commit 0845b8bca264c90df225b77b2d038dd7c89befad Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 28 07:38:25 2009 +0000 add multi table decorator commit 26dbf5e85e8f5b8059a8ae23b3a91030e34d9f48 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 28 07:29:27 2009 +0000 update demo from changes in compiler and runtime commit 67318a5c95a436da6a48edbba40ac2264210fe38 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 28 07:20:17 2009 +0000 - ajout test sur bindings - les fichiers generes sont dans target/generated-sources commit 85711119c038ed63927a522afbca45d8c755cc48 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 28 07:19:17 2009 +0000 amelioration des renderer sur Decorator (et deplacement vers jaxx.runtime.swing.renderer) commit c71ec82f3031a32f51a660be4bc2b2a4870a6fc0 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 28 07:18:13 2009 +0000 - Evolution #105: permettre l'initialisation des objets sans JavaBean - Evolution #100: amélioration du design du compilateur - Evolution #99: Améliorer le code généré commit 00068020f877dc881ed42d1d01a61f9440677db8 Author: Tony Chemit <chemit@codelutin.com> Date: Tue Oct 27 10:46:23 2009 +0000 in Util.initContext add a entry in ui context when parentContext is a JAXXOBbject (it will make possible to walk into UI ancestor without using the getParentContainer method commit 667ba30e052c7b08c15d32db3097784895523aac Author: Tony Chemit <chemit@codelutin.com> Date: Tue Oct 27 00:40:30 2009 +0000 put the Generated By JavaCC comment line at top of file commit ee163961bdd380b7630ed209d619d0b8845b363d Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 26 19:13:36 2009 +0000 update java files license header commit a74f64d5d0b7fed2b39bcbd518330c2430dd1de2 Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 26 19:11:57 2009 +0000 update jaxx files license header commit 352005675825bde3344d3039683740c7e813170a Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 26 19:08:21 2009 +0000 update license header commit ff7a0b4aa621f2fd21228f200442531c15f2f757 Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 26 02:47:48 2009 +0000 - remove commented unused code, clean code, add javadoc - improve warning and error management in JAXXEngine and plugin - improve databinding generation (do not test nullity on root object) - remove when possible the root object prefix in method invocation commit 1f08b928326b9be4549c292825db1ae07f0fba3b Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 26 02:45:10 2009 +0000 remove commented unused code clean code add javadoc commit f0c338a9532b1770514a9026245a2790b5a055ad Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 26 02:40:51 2009 +0000 remove commented unused code clean code commit e142a7a6a1fa7306253dd9bedbd3041908f55833 Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 26 02:36:35 2009 +0000 remove commented unused code commit 9be82c2570dc176f1b4bdd4ae6923959f32541de Author: Tony Chemit <chemit@codelutin.com> Date: Sun Oct 25 19:49:15 2009 +0000 - Evolution #100: amélioration du design du compilateur - Evolution #99: Améliorer le code généré - amelioration des test dans le plugin commit 8c4f66cdb64c946efcb1149741422681d723dde1 Author: Tony Chemit <chemit@codelutin.com> Date: Sun Oct 25 19:48:54 2009 +0000 - Evolution #100: amélioration du design du compilateur - Evolution #99: Améliorer le code généré - amelioration des test dans le plugin commit 2b1b1756e88120fb26b9bb8b890f87e32cf2af57 Author: Tony Chemit <chemit@codelutin.com> Date: Sat Oct 24 13:56:24 2009 +0000 remover verbose flag on tests commit 15a6bbe22a694c9924fd9efdf877888a34b4c859 Author: Tony Chemit <chemit@codelutin.com> Date: Sat Oct 24 11:36:16 2009 +0000 clean code commit 092ed9fc20fee8930c452de63305cb844af03723 Author: Tony Chemit <chemit@codelutin.com> Date: Sat Oct 24 11:34:52 2009 +0000 - Evolution #100: amélioration du design du compilateur - Evolution #99: Améliorer le code généré - Evolution #98: les objets JAXX sont serializable commit c5fef28ab28ff91f4833cb7d377cb956c436d0b1 Author: Tony Chemit <chemit@codelutin.com> Date: Sat Oct 24 11:32:31 2009 +0000 amelioration demo du NavigationTreeHandler commit 1a7edadc94dddc6f49b61c6e29834545e8454aa5 Author: Tony Chemit <chemit@codelutin.com> Date: Sat Oct 24 11:31:57 2009 +0000 - Evolution #100: amélioration du design du compilateur - Evolution #99: Améliorer le code généré - Evolution #98: les objets JAXX sont serializable commit 3177389c7e3bc88f388160bde4f5ead8c13a1cf8 Author: Tony Chemit <chemit@codelutin.com> Date: Sat Oct 24 11:30:36 2009 +0000 Evolution #100: amélioration du design du compilateur commit bea7197f9fc62c151cf500db64e972ab4a77571a Author: Tony Chemit <chemit@codelutin.com> Date: Fri Oct 23 18:01:04 2009 +0000 add gotoChildNode in NavigationTreeHelper commit 56fdd488dbc233b71e28d28f22680f7ff8e8761c Author: Tony Chemit <chemit@codelutin.com> Date: Fri Oct 23 16:44:44 2009 +0000 - add a contract NavigationContentUI and use it in NavigationTreeHandler - improve demo commit c9ccdc2cccb135412543975b7a25aaf59c0ef2cc Author: Tony Chemit <chemit@codelutin.com> Date: Fri Oct 23 16:42:17 2009 +0000 - add a contract NavigationContentUI and use it in NavigationTreeHandler commit 06c236729dfbf929cd9ccc53ce1227395c52f5f1 Author: Sylvain Letellier <???> Date: Fri Oct 23 14:30:44 2009 +0000 Adding repaint node mathods commit 00bf8b1f6bcaa1ee8cfd2db4b5095edd330d8d8b Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 22 10:57:40 2009 +0000 move context entry def static methods to jaxx.runtime.Util commit a8119eff3328884bd0848d4647c090c02a402a1d Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 21 13:16:51 2009 +0000 do not make equals on class, prefer use method isAssignableFrom commit d105bce77e02f9d47bee567098a409bd44f24e50 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 21 12:56:13 2009 +0000 fix generics on List commit 74a248bad84816b51ecf80b0258f3066fd42feaf Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 21 12:54:56 2009 +0000 fix generics on Class commit 63569fd6bc3af0e7f11823bb1a6859c7ac166c49 Author: Sylvain Letellier <???> Date: Tue Oct 20 12:59:39 2009 +0000 Adding helper to return typed selected node commit ca721bafbe101b6ffd494ee722f1e787d73e88c7 Author: Sylvain Letellier <???> Date: Tue Oct 20 12:58:57 2009 +0000 Bug categorie item in ItemTreeNavigation fixed commit 6ade2c28beb3873fb08161b0edd4f82968411744 Author: Tony Chemit <chemit@codelutin.com> Date: Fri Oct 16 14:05:07 2009 +0000 do not expose jaxx files commit 380205f49e1b0c295975480f75502c354d78212c Author: Tony Chemit <chemit@codelutin.com> Date: Fri Oct 16 12:47:28 2009 +0000 use nuiton thirdparty rsyntaxtextarea... It seems somebody does not listen what I said :) commit bd9a48e4f9cc96fbd2c6feab7d4354dc0e00d35e Author: Sylvain Letellier <???> Date: Wed Oct 14 10:04:28 2009 +0000 Syntax highlighting in demo sources commit fbdd0b4da7951107fea2b46b33da7374b5744bf9 Author: Tony Chemit <chemit@codelutin.com> Date: Tue Oct 13 09:07:59 2009 +0000 no using maven.src.dir in src default-value (this is not a maven property) commit 1cce9a1da829847ccea5323dfd1e47e223805b2c Author: Tony Chemit <chemit@codelutin.com> Date: Sun Oct 11 13:10:37 2009 +0000 use VelocityTemplateGenerator from maven-helper-plugin commit 267de1be5f39e97aab41dd5cb9ef10888b6fbb3b Author: Tony Chemit <chemit@codelutin.com> Date: Sat Oct 10 16:48:11 2009 +0000 utilisation de mavenpom 1.1.0, maven-license-plugin commit 32d6e7a0ee5a7dbb06daf5c89df842cda5dbbbf4 Author: Tony Chemit <chemit@codelutin.com> Date: Fri Oct 9 07:23:00 2009 +0000 fix javadoc + documentation commit a81de5ba45fb8d709e5fe7f937e1843dc6d92d47 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 8 21:10:15 2009 +0000 generate help search index (still does not works everywhere, a shame the code is from com.sun we do not have the source...) commit 52a8238fb5c6e2693c04a31bb3d3fe3daa225edc Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 8 19:10:44 2009 +0000 - add encoding on goals (should be in JAXXCompiler) - simplify helpIdsStore (only store ids, path will be computed if needed) - maven-helper-plugin common code commit 9747dbc86ffa84cb7177af414923bba6e40157c2 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 8 16:48:27 2009 +0000 evolution #78 : rendre le système d'aide multi-langue + JAXXContext is returned to jaxx.runtime package commit 659716f65625a1aaf5794ee345219c366b8f892d Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 7 21:03:42 2009 +0000 ending migration commit 4d9797bc53f07ef53c076af980212b69474073f6 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 7 18:15:26 2009 +0000 changement logs (on veut pas voir nuiton-util en console :)) commit 045c2e4959e5dcb11270fb57bdab111d790f2223 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 7 17:57:38 2009 +0000 debut doc de migration 2.0 commit d4014526f7d0a901a33c55f755f81a326485b179 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 7 17:37:55 2009 +0000 fix javadocs + improve messages in goal commit 6f521a81dce0d63a33c34c01b87c1cdc3912e4c5 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 7 14:23:35 2009 +0000 refactor jaxx 2.x commit 8f386d69ffeeb5c6b247c4134cc4376c8f9922e0 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 7 14:22:07 2009 +0000 refactor jaxx 2.x commit a3d4ea33ae86725e76b7d4a832e366b0b48fa5bd Author: Tony Chemit <chemit@codelutin.com> Date: Tue Oct 6 04:59:00 2009 +0000 [Evolution #74] : pouvoir generer les classes swing (JComboBox, JList,...) commit 92bf054b4edf6d7188c9af9b4ba1b9598915e885 Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 5 19:16:52 2009 +0000 simplify modules + refactor NavigationTree and Decorator api + add real JComboBox tag handler (incompatible with JAXX 1.X) commit b12741015a10ab8044ec7e29dbadc94fe7814b8a Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 5 19:15:44 2009 +0000 simplify modules + refactor NavigationTree and Decorator api + add real JComboBox tag handler (incompatible with JAXX 1.X) commit b42200fd21ebbcc53fb3096272a3c9042e840b3c Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 5 13:18:45 2009 +0000 create version 2.X of jaxx, with non compatible api with jaxx > 1.7.2 -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit b42200fd21ebbcc53fb3096272a3c9042e840b3c Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 5 13:18:45 2009 +0000 create version 2.X of jaxx, with non compatible api with jaxx > 1.7.2 -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit b12741015a10ab8044ec7e29dbadc94fe7814b8a Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 5 19:15:44 2009 +0000 simplify modules + refactor NavigationTree and Decorator api + add real JComboBox tag handler (incompatible with JAXX 1.X) --- jaxx-compiler/pom.xml | 16 +- .../src/main/java/jaxx/SwingInitializer.java | 81 +-- .../src/main/java/jaxx/compiler/JAXXCompiler.java | 29 +- .../java/jaxx/tags/DefaultComponentHandler.java | 6 +- .../main/java/jaxx/tags/DefaultObjectHandler.java | 86 +-- .../src/main/java/jaxx/tags/TagManager.java | 26 +- .../java/jaxx/tags/swing/EnumEditorHandler.java | 56 -- .../src/main/java/jaxx/tags/swing/ItemHandler.java | 29 +- .../java/jaxx/tags/swing/JComboBoxHandler.java | 35 +- .../main/java/jaxx/tags/swing/JSliderHandler.java | 19 +- .../main/java/jaxx/tags/swing/JWindowHandler.java | 2 +- .../java/jaxx/tags/swing/LocaleEditorHandler.java | 56 -- .../src/main/java/jaxx/tags/swing/RowHandler.java | 5 +- .../src/main/java/jaxx/tags/swing/TabHandler.java | 2 + .../jaxx/tags/validator/BeanValidatorHandler.java | 2 +- .../validator/ExcludeFieldValidatorHandler.java | 2 + .../jaxx/tags/validator/FieldValidatorHandler.java | 2 + .../test/java/jaxx/beaninfos/BeanIntoUtilTest.java | 2 +- .../src/test/java/jaxx/junit/TagManagerTest.java | 6 +- .../swing/navigation/NavigationTreeModelTest.java | 394 -------------- jaxx-demo/pom.xml | 12 +- jaxx-demo/src/main/filters/jaxx-demo.properties | 3 + jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx | 195 ++++--- .../src/main/java/jaxx/demo/DemoTreeHelper.java | 47 +- jaxx-demo/src/main/java/jaxx/demo/DemoUI.css | 33 +- jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx | 192 ++++--- .../src/main/java/jaxx/demo/DemoUIHandler.java | 38 +- .../demo/component/jaxx/BoxedDecoratorDemo.jaxx | 20 + .../component/jaxx/StatusMessagePanelDemo.jaxx | 20 + .../component/jaxx/editor/ComboEditorDemo.jaxx | 20 + .../demo/component/jaxx/editor/I18nEditorDemo.jaxx | 20 + .../component/jaxx/editor/NumberEditorDemo.jaxx | 20 + .../jaxx/navigation/full/BaseContent.jaxx | 79 --- .../navigation/full/FullNavigationTreeDemo.jaxx | 58 -- .../navigation/full/FullNavigationTreeHelper.java | 230 -------- .../demo/component/jaxx/navigation/full/Movie.java | 127 ----- .../component/jaxx/navigation/full/People.java | 117 ---- .../navigation/item/ItemTreeNavigationDemo.jaxx | 20 + .../jaxx/demo/component/swing/JButtonDemo.jaxx | 20 + .../jaxx/demo/component/swing/JCheckBoxDemo.jaxx | 20 + .../component/swing/JCheckBoxMenuItemDemo.jaxx | 20 + .../jaxx/demo/component/swing/JComboBoxDemo.jaxx | 85 ++- .../jaxx/demo/component/swing/JDialogDemo.jaxx | 20 + .../java/jaxx/demo/component/swing/JListDemo.jaxx | 20 + .../jaxx/demo/component/swing/JMenuItemDemo.jaxx | 20 + .../demo/component/swing/JPasswordFieldDemo.jaxx | 20 + .../demo/component/swing/JProgressBarDemo.jaxx | 20 + .../demo/component/swing/JRadioButtonDemo.jaxx | 20 + .../component/swing/JRadioButtonMenuItemDemo.jaxx | 20 + .../jaxx/demo/component/swing/JSliderDemo.jaxx | 20 + .../jaxx/demo/component/swing/JSpinnerDemo.jaxx | 20 + .../jaxx/demo/component/swing/JSplitPaneDemo.jaxx | 20 + .../jaxx/demo/component/swing/JTextAreaDemo.jaxx | 20 + .../jaxx/demo/component/swing/JTextFieldDemo.jaxx | 20 + .../demo/component/swing/JToggleButtonDemo.jaxx | 20 + .../feature/databinding/BaseBeanDataBinding.jaxx | 20 + .../feature/databinding/BeanDataBindingDemo.jaxx | 20 + .../feature/validation/ValidationListDemo.jaxx | 24 +- .../feature/validation/ValidationTableDemo.jaxx | 24 +- .../main/java/jaxx/demo/fun/CalculatorDemo.jaxx | 20 + .../src/main/java/jaxx/demo/fun/CounterDemo.jaxx | 20 + .../main/java/jaxx/demo/fun/LabelStyleDemo.jaxx | 20 + .../main/resources/i18n/jaxx-demo-en_GB.properties | 7 +- .../main/resources/i18n/jaxx-demo-fr_FR.properties | 7 +- jaxx-demo/src/main/resources/log4j.properties | 4 +- jaxx-example/changelog.txt | 18 - jaxx-example/pom.xml | 256 --------- .../main/java/jaxx/demo/BaseBeanDataBinding.jaxx | 21 - .../main/java/jaxx/demo/BeanDataBindingDemo.jaxx | 47 -- .../main/java/jaxx/demo/BoxedDecoratorDemo.jaxx | 91 ---- .../src/main/java/jaxx/demo/Calculator.css | 68 --- .../src/main/java/jaxx/demo/CalculatorDemo.jaxx | 89 ---- .../src/main/java/jaxx/demo/CalculatorEngine.java | 177 ------- .../src/main/java/jaxx/demo/ComboEditorDemo.jaxx | 35 -- .../src/main/java/jaxx/demo/CounterDemo.jaxx | 12 - .../src/main/java/jaxx/demo/DemoPanel.jaxx | 45 -- .../src/main/java/jaxx/demo/EmptyDemo.jaxx | 5 - .../demo/ExempleItemTreeNavigationAdapter.java | 60 --- .../src/main/java/jaxx/demo/I18nEditorDemo.jaxx | 46 -- jaxx-example/src/main/java/jaxx/demo/Identity.java | 103 ---- .../java/jaxx/demo/ItemTreeNavigationDemo.jaxx | 41 -- jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx | 134 ----- .../src/main/java/jaxx/demo/JButtonDemo.jaxx | 29 - .../src/main/java/jaxx/demo/JCheckBoxDemo.jaxx | 38 -- .../main/java/jaxx/demo/JCheckBoxMenuItemDemo.jaxx | 59 --- .../src/main/java/jaxx/demo/JComboBoxDemo.jaxx | 22 - .../src/main/java/jaxx/demo/JDialogDemo.jaxx | 79 --- .../src/main/java/jaxx/demo/JListDemo.jaxx | 59 --- .../src/main/java/jaxx/demo/JMenuItemDemo.jaxx | 23 - .../main/java/jaxx/demo/JPasswordFieldDemo.jaxx | 10 - .../src/main/java/jaxx/demo/JProgressBarDemo.jaxx | 77 --- .../src/main/java/jaxx/demo/JRadioButtonDemo.jaxx | 11 - .../java/jaxx/demo/JRadioButtonMenuItemDemo.jaxx | 14 - .../src/main/java/jaxx/demo/JSliderDemo.jaxx | 12 - .../src/main/java/jaxx/demo/JSpinnerDemo.jaxx | 13 - .../src/main/java/jaxx/demo/JSplitPaneDemo.jaxx | 13 - .../src/main/java/jaxx/demo/JTextAreaDemo.jaxx | 33 -- .../src/main/java/jaxx/demo/JTextFieldDemo.jaxx | 22 - .../src/main/java/jaxx/demo/JToggleButtonDemo.jaxx | 9 - .../src/main/java/jaxx/demo/LabelStyle.css | 43 -- .../src/main/java/jaxx/demo/LabelStyleDemo.jaxx | 85 --- jaxx-example/src/main/java/jaxx/demo/Model.java | 66 --- .../src/main/java/jaxx/demo/NumberEditorDemo.jaxx | 132 ----- .../main/java/jaxx/demo/NumberEditorDemoModel.java | 78 --- .../java/jaxx/demo/StatusMessagePanelDemo.jaxx | 11 - .../src/main/java/jaxx/demo/Validation.css | 5 - .../main/java/jaxx/demo/ValidationListDemo.jaxx | 325 ------------ .../main/java/jaxx/demo/ValidationTableDemo.jaxx | 331 ------------ jaxx-example/src/main/jnlp/jxlayer.jnlp | 12 - jaxx-example/src/main/jnlp/sun.jnlp | 12 - .../resources/i18n/jaxx-example-en_GB.properties | 142 ----- .../resources/i18n/jaxx-example-fr_FR.properties | 134 ----- .../src/main/resources/icons/action-accept.png | Bin 781 -> 0 bytes .../src/main/resources/icons/action-block.png | Bin 576 -> 0 bytes .../jaxx/demo/Identity-error-validation.xml | 49 -- .../jaxx/demo/Identity-info-validation.xml | 49 -- .../jaxx/demo/Identity-warning-validation.xml | 49 -- .../resources/jaxx/demo/Model-error-validation.xml | 35 -- .../resources/jaxx/demo/Model-info-validation.xml | 13 - .../jaxx/demo/Model-warning-validation.xml | 18 - .../main/resources/jaxx/demo/images/Amethyst.jpg | Bin 24619 -> 0 bytes .../src/main/resources/jaxx/demo/images/Lynx.jpg | Bin 40463 -> 0 bytes .../src/main/resources/jaxx/demo/images/Tomato.jpg | Bin 22862 -> 0 bytes .../resources/jaxx/demo/images/pencil_black.gif | Bin 190 -> 0 bytes jaxx-example/src/main/resources/log4j.properties | 10 - jaxx-example/src/site/site.xml | 27 - .../java/jaxx/demo/BeanValidatorDetectorTest.java | 34 -- .../src/main/java/jaxx/runtime/Decorator.java | 36 -- .../src/main/java/jaxx/runtime/DecoratorUtils.java | 111 ---- .../main/java/jaxx/runtime/JXPathDecorator.java | 278 ---------- .../java/jaxx/runtime/MultiJXPathDecorator.java | 129 ----- .../main/java/jaxx/runtime/PropertyDecorator.java | 94 ---- .../i18n/jaxx-runtime-api-en_GB.properties | 3 - .../i18n/jaxx-runtime-api-fr_FR.properties | 3 - .../java/jaxx/runtime/JXPathDecoratorTest.java | 163 ------ .../jaxx/runtime/MultiJXPathDecoratorTest.java | 184 ------- jaxx-runtime-swing-widget/LICENSE.txt | 166 ------ jaxx-runtime-swing-widget/README.txt | 2 - .../src/site/rst/images/Components-screenshot.gif | Bin 46663 -> 0 bytes .../src/site/rst/images/webstart.gif | Bin 1806 -> 0 bytes jaxx-runtime-swing-widget/src/site/rst/index.rst | 40 -- jaxx-runtime-swing/LICENSE.txt | 166 ------ jaxx-runtime-swing/README.txt | 2 - jaxx-runtime-swing/changelog.txt | 114 ---- jaxx-runtime-swing/pom.xml | 53 -- .../runtime/swing/DecoratorTableCellRenderer.java | 33 -- .../navigation/NavigationTreeCellRenderer.java | 137 ----- .../navigation/NavigationTreeContextHelper.java | 133 ----- .../swing/navigation/NavigationTreeHandler.java | 307 ----------- .../NavigationTreeHandlerWithCardLayout.java | 129 ----- .../swing/navigation/NavigationTreeHelper.java | 123 ----- .../swing/navigation/NavigationTreeModel.java | 589 --------------------- .../navigation/NavigationTreeModelBuilder.java | 210 -------- .../navigation/NavigationTreeSelectionAdapter.java | 248 --------- ...vigationTreeSelectionAdapterWithCardLayout.java | 110 ---- .../runtime/swing/navigation/NavigationUtil.java | 264 --------- .../i18n/jaxx-runtime-swing-en_GB.properties | 9 - jaxx-runtime-swing/src/site/site.xml | 25 - {jaxx-example => jaxx-runtime}/LICENSE.txt | 0 {jaxx-example => jaxx-runtime}/README.txt | 0 {jaxx-runtime-api => jaxx-runtime}/changelog.txt | 0 {jaxx-runtime-api => jaxx-runtime}/pom.xml | 16 +- .../src/main/java/jaxx/Base64Coder.java | 0 .../src/main/java/jaxx/beaninfos/HBoxBeanInfo.java | 0 .../src/main/java/jaxx/beaninfos/VBoxBeanInfo.java | 0 .../src/main/java/jaxx/css/Rule.java | 0 .../src/main/java/jaxx/css/Selector.java | 0 .../src/main/java/jaxx/css/Stylesheet.java | 0 .../java/jaxx/runtime/ComponentDescriptor.java | 0 .../java/jaxx/runtime/DataBindingListener.java | 0 .../jaxx/runtime/DataBindingUpdateListener.java | 0 .../src/main/java/jaxx/runtime/DataContext.java | 32 +- .../jaxx/runtime/DefaultApplicationContext.java | 8 +- .../main/java/jaxx/runtime/DefaultJAXXContext.java | 0 .../src/main/java/jaxx/runtime/JAXXAction.java | 0 .../src/main/java/jaxx/runtime/JAXXContext.java | 8 + .../java/jaxx/runtime/JAXXContextEntryDef.java | 0 .../main/java/jaxx/runtime/JAXXInitialContext.java | 0 .../src/main/java/jaxx/runtime/JAXXObject.java | 0 .../java/jaxx/runtime/JAXXObjectDescriptor.java | 0 .../src/main/java/jaxx/runtime/JAXXValidator.java | 0 .../src/main/java/jaxx/runtime/JaxxHelpUI.java | 0 .../src/main/java/jaxx/runtime/SwingUtil.java | 35 +- .../src/main/java/jaxx/runtime/Util.java | 72 +-- .../main/java/jaxx/runtime/css/DataBinding.java | 0 .../main/java/jaxx/runtime/css/Pseudoclasses.java | 0 .../main/java/jaxx/runtime/swing/Application.java | 0 .../java/jaxx/runtime/swing/BlockingLayerUI.java | 0 .../java/jaxx/runtime/swing/BlockingLayerUI2.java | 0 .../jaxx/runtime/swing/BooleanCellRenderer.java | 0 .../main/java/jaxx/runtime/swing/CardLayout2.java | 0 .../java/jaxx/runtime/swing/CardLayout2Ext.java | 0 .../swing/EmptyNumberTableCellRenderer.java | 0 .../jaxx/runtime/swing/EnumTableCellRenderer.java | 0 .../src/main/java/jaxx/runtime/swing/GBC.java | 0 .../src/main/java/jaxx/runtime/swing/HBox.java | 0 .../main/java/jaxx/runtime/swing/HBoxLayout.java | 0 .../jaxx/runtime/swing/I18nTableCellRenderer.java | 0 .../src/main/java/jaxx/runtime/swing/Item.java | 0 .../java/jaxx/runtime/swing/JAXXButtonGroup.java | 0 .../main/java/jaxx/runtime/swing/JAXXComboBox.java | 0 .../src/main/java/jaxx/runtime/swing/JAXXList.java | 0 .../src/main/java/jaxx/runtime/swing/JAXXTab.java | 0 .../java/jaxx/runtime/swing/JAXXToggleButton.java | 0 .../src/main/java/jaxx/runtime/swing/JAXXTree.java | 518 +++++++++--------- .../java/jaxx/runtime/swing/JaxxHelpBroker.java | 0 .../jaxx/runtime/swing/LocaleListCellRenderer.java | 0 .../jaxx/runtime/swing/MyDefaultCellEditor.java | 0 .../runtime/swing/OneClicListSelectionModel.java | 0 .../src/main/java/jaxx/runtime/swing/Spacer.java | 0 .../src/main/java/jaxx/runtime/swing/TabInfo.java | 0 .../swing/TabInfoPropertyChangeListener.java | 0 .../src/main/java/jaxx/runtime/swing/Table.java | 0 .../src/main/java/jaxx/runtime/swing/VBox.java | 0 .../main/java/jaxx/runtime/swing/VBoxLayout.java | 0 .../jaxx/runtime/swing/editor/ClassCellEditor.java | 0 .../java/jaxx/runtime/swing/editor/EnumEditor.java | 0 .../jaxx/runtime/swing/editor/LocaleEditor.java | 0 .../swing/navigation/ItemNavigationCardPanel.java | 39 +- .../swing/navigation/ItemNavigationPanel.java | 0 .../navigation/ItemTreeNavigationAdapter.java | 0 .../jaxx/runtime/swing/wizard/WizardModel.java | 0 .../swing/wizard/WizardOperationAction.java | 0 .../swing/wizard/WizardOperationActionThread.java | 0 .../runtime/swing/wizard/WizardOperationModel.java | 0 .../runtime/swing/wizard/WizardOperationState.java | 0 .../runtime/swing/wizard/WizardOperationStep.java | 0 .../java/jaxx/runtime/swing/wizard/WizardStep.java | 0 .../jaxx/runtime/swing/wizard/WizardStepUI.java | 0 .../java/jaxx/runtime/swing/wizard/WizardUI.java | 0 .../jaxx/runtime/swing/wizard/WizardUILancher.java | 0 .../java/jaxx/runtime/swing/wizard/WizardUtil.java | 0 .../java/jaxx/runtime/swing/wizard/package.html | 0 .../java/jaxx/runtime/validator/BeanValidator.java | 1 - .../runtime/validator/BeanValidatorDetector.java | 0 .../jaxx/runtime/validator/BeanValidatorEvent.java | 8 +- .../jaxx/runtime/validator/BeanValidatorField.java | 4 +- .../runtime/validator/BeanValidatorListener.java | 0 .../runtime/validator/BeanValidatorMessage.java | 12 +- .../jaxx/runtime/validator/BeanValidatorScope.java | 0 .../jaxx/runtime/validator}/BeanValidatorUtil.java | 2 +- .../jaxx/runtime/validator/XWorkBeanValidator.java | 9 +- .../field/CollectionFieldExpressionValidator.java | 0 .../field/CollectionUniqueKeyValidator.java | 0 .../field/ExistingDirectoryFieldValidator.java | 1 + .../field/ExistingFileFieldValidator.java | 1 + .../field/FieldExpressionWithParamsValidator.java | 0 .../field/NotExistingDirectoryFieldValidator.java | 0 .../field/NotExistingFileFieldValidator.java | 0 .../field/RequiredFileFieldValidator.java | 1 + .../runtime/validator/swing/SwingValidator.java | 4 +- .../validator/swing/SwingValidatorMessage.java | 4 +- .../swing/SwingValidatorMessageListModel.java | 8 +- .../SwingValidatorMessageListMouseListener.java | 0 .../swing/SwingValidatorMessageListRenderer.java | 1 - .../swing/SwingValidatorMessageTableModel.java | 20 +- .../SwingValidatorMessageTableMouseListener.java | 0 .../swing/SwingValidatorMessageTableRenderer.java | 1 - .../validator/swing}/SwingValidatorUtil.java | 5 +- .../swing/ui/AbstractBeanValidatorUI.java | 4 +- .../validator/swing/ui/IconValidationUI.java | 2 +- .../validator/swing/ui/ImageValidationUI.java | 2 +- .../swing/ui/TranslucentValidationUI.java | 2 +- .../resources/i18n/jaxx-runtime-en_GB.properties | 12 + .../resources/i18n/jaxx-runtime-fr_FR.properties | 3 + .../src/main/resources/icons/action-delete.png | Bin .../resources/icons/action-wizard-config-16.png | Bin .../main/resources/icons/action-wizard-config.png | Bin .../resources/icons/action-wizard-message-16.png | Bin .../main/resources/icons/action-wizard-message.png | Bin .../main/resources/icons/action-wizard-next-16.png | Bin .../main/resources/icons/action-wizard-next.png | Bin .../resources/icons/action-wizard-pause-16.png | Bin .../main/resources/icons/action-wizard-pause.png | Bin .../resources/icons/action-wizard-previous-16.png | Bin .../resources/icons/action-wizard-previous.png | Bin .../resources/icons/action-wizard-refresh-16.png | Bin .../main/resources/icons/action-wizard-refresh.png | Bin .../resources/icons/action-wizard-start-16.png | Bin .../main/resources/icons/action-wizard-start.png | Bin .../icons/action-wizard-state-canceled-16.png | Bin .../icons/action-wizard-state-canceled.png | Bin .../icons/action-wizard-state-failed-16.png | Bin .../resources/icons/action-wizard-state-failed.png | Bin .../icons/action-wizard-state-need_fix-16.png | Bin .../icons/action-wizard-state-need_fix.png | Bin .../icons/action-wizard-state-pending-16.png | Bin .../icons/action-wizard-state-pending.png | Bin .../icons/action-wizard-state-running-16.png | Bin .../icons/action-wizard-state-running.png | Bin .../icons/action-wizard-state-successed-16.png | Bin .../icons/action-wizard-state-successed.png | Bin .../src/main/resources/icons/error.png | Bin .../src/main/resources/icons/info.png | Bin .../src/main/resources/icons/warning.png | Bin .../src/main/resources/validators.xml | 0 .../src/site/site.xml | 0 .../runtime/DefaultApplicationContextTest.java | 0 .../java/jaxx/runtime/DefaultJAXXContextTest.java | 0 .../src/test/java/jaxx/runtime/UtilTest.java | 0 .../AbstractBeanValidatorDetectorTest.java | 0 .../validator/BeanValidatorDetectorTest.java | 0 .../jaxx/runtime/validator/BeanValidatorTest.java | 0 .../java/jaxx/runtime/validator/SimpleBean.java | 0 .../runtime/validator/XWorkBeanValidatorTest.java | 0 .../field/AbstractFieldValidatorTest.java | 0 .../AbstractValidatorBeanFieldValidatorTest.java | 0 .../CollectionFieldExpressionValidatorTest.java | 0 .../field/CollectionUniqueKeyValidatorTest.java | 0 .../field/ExistingDirectoryFieldValidatorTest.java | 0 .../field/ExistingFileFieldValidatorTest.java | 0 .../validator/field/FieldExpressionBean.java | 0 .../FieldExpressionWithParamsValidatorTest.java | 0 .../NotExistingDirectoryFieldValidatorTest.java | 0 .../field/NotExistingFileFieldValidatorTest.java | 0 .../field/RequiredFileFieldValidatorTest.java | 0 .../runtime/validator/field/ValidatorBean.java | 0 .../validator/SimpleBean-error-validation.xml | 0 .../validator/SimpleBean-info-validation.xml | 0 .../validator/SimpleBean-simple-validation.xml | 0 .../validator/SimpleBean-warning-validation.xml | 0 .../field/FieldExpressionBean-error-validation.xml | 0 .../field/ValidatorBean-error-validation.xml | 0 .../src/test/resources/log4j.properties | 2 +- .../src/test/resources/validators.xml | 0 jaxx-swing-action/pom.xml | 8 +- {jaxx-runtime-api => jaxx-widgets}/LICENSE.txt | 0 {jaxx-runtime-api => jaxx-widgets}/README.txt | 0 .../changelog.txt | 0 .../pom.xml | 16 +- .../main/java/jaxx/runtime/swing/AboutPanel.jaxx | 0 .../main/java/jaxx/runtime/swing/ClockWidget.jaxx | 0 .../java/jaxx/runtime/swing/EntityComboBox.jaxx | 3 +- .../jaxx/runtime/swing/EntityComboBoxHandler.java | 15 +- .../java/jaxx/runtime/swing/ErrorDialogUI.jaxx | 0 .../jaxx/runtime/swing/MemoryStatusWidget.jaxx | 0 .../jaxx/runtime/swing/StatusMessagePanel.jaxx | 0 .../runtime/swing/StatusMessagePanelHandler.java | 0 .../jaxx/runtime/swing/editor/ColumnSelector.jaxx | 0 .../java/jaxx/runtime/swing/editor/I18nEditor.jaxx | 0 .../jaxx/runtime/swing/editor/NumberEditor.jaxx | 0 .../runtime/swing/editor/NumberEditorHandler.java | 0 .../runtime/swing/editor/NumberEditorPopup.css | 0 .../java/jaxx/runtime/swing/editor/TimeEditor.css | 0 .../java/jaxx/runtime/swing/editor/TimeEditor.jaxx | 0 .../runtime/swing/editor/TimeEditorHandler.java | 0 .../swing/editor/config/ConfigCategoryUI.css | 0 .../swing/editor/config/ConfigCategoryUI.jaxx | 0 .../swing/editor/config/ConfigTableEditor.java | 0 .../swing/editor/config/ConfigTableRenderer.java | 0 .../jaxx/runtime/swing/editor/config/ConfigUI.css | 0 .../jaxx/runtime/swing/editor/config/ConfigUI.jaxx | 0 .../swing/editor/config/ConfigUIBuilder.java | 0 .../swing/editor/config/model/CategoryModel.java | 0 .../editor/config/model/ConfigTableModel.java | 0 .../swing/editor/config/model/ConfigUIModel.java | 0 .../swing/editor/config/model/OptionModel.java | 0 .../jaxx-runtime-swing-widget-en_GB.properties | 3 +- .../jaxx-runtime-swing-widget-fr_FR.properties | 3 +- .../main/resources/icons/action-config-quit.png | Bin .../main/resources/icons/action-config-reset.png | Bin .../main/resources/icons/action-config-save.png | Bin .../src/main/resources/icons/action-i18n-be.png | Bin .../src/main/resources/icons/action-i18n-ca.png | Bin .../src/main/resources/icons/action-i18n-ch.png | Bin .../src/main/resources/icons/action-i18n-de.png | Bin .../src/main/resources/icons/action-i18n-dk.png | Bin .../src/main/resources/icons/action-i18n-es.png | Bin .../src/main/resources/icons/action-i18n-fi.png | Bin .../src/main/resources/icons/action-i18n-fr.png | Bin .../src/main/resources/icons/action-i18n-gb.png | Bin .../src/main/resources/icons/action-i18n-it.png | Bin .../src/main/resources/icons/action-i18n-nl.png | Bin .../src/main/resources/icons/action-i18n-no.png | Bin .../src/main/resources/icons/action-i18n-se.png | Bin .../src/main/resources/icons/action-i18n-us.png | Bin .../icons/action-numbereditor-calculator.png | Bin .../resources/icons/action-numbereditor-reset.png | Bin .../icons/action-numbereditor-validate.png | Bin .../src/site/rst/images/Components-screenshot.gif | Bin .../src/site/rst/images/webstart.gif | Bin .../src/site/rst/index.rst | 0 .../src/site/site.xml | 0 maven-jaxx-plugin/pom.xml | 364 ++++++++++++- .../org/nuiton/jaxx/plugin/AbstractJaxxMojo.java | 40 -- .../org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java | 28 +- .../SpecialSubclassing/JComboBoxTest1.jaxx | 4 +- .../SpecialSubclassing/JComboBoxTest2.jaxx | 4 +- pom.xml | 15 +- 389 files changed, 1889 insertions(+), 9421 deletions(-) diff --git a/jaxx-compiler/pom.xml b/jaxx-compiler/pom.xml index 5b9c73a..4ce78f2 100644 --- a/jaxx-compiler/pom.xml +++ b/jaxx-compiler/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>1.7.2-SNAPSHOT</version> + <version>2.0.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> @@ -22,16 +22,10 @@ <dependency> <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-api</artifactId> + <artifactId>jaxx-runtime</artifactId> <version>${project.version}</version> </dependency> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-swing</artifactId> - <version>${project.version}</version> - </dependency> - + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> @@ -43,8 +37,8 @@ <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>${project.artifactId}</name> - <description>Jaxx compiler api</description> + <name>JAXX Compiler</name> + <description>JAXX Compiler api</description> <!-- ************************************************************* --> <!-- *** Build Settings ****************************************** --> diff --git a/jaxx-compiler/src/main/java/jaxx/SwingInitializer.java b/jaxx-compiler/src/main/java/jaxx/SwingInitializer.java index cdd4663..e849f42 100644 --- a/jaxx-compiler/src/main/java/jaxx/SwingInitializer.java +++ b/jaxx-compiler/src/main/java/jaxx/SwingInitializer.java @@ -4,64 +4,29 @@ */ package jaxx; -import jaxx.tags.swing.JTextComponentHandler; -import jaxx.tags.swing.JTabbedPaneHandler; -import jaxx.tags.swing.TabHandler; -import jaxx.tags.swing.CellHandler; -import jaxx.tags.swing.JComboBoxHandler; -import jaxx.tags.swing.JSliderHandler; -import jaxx.tags.swing.RowHandler; -import jaxx.tags.swing.JSpinnerHandler; -import jaxx.tags.swing.TableHandler; -import jaxx.tags.swing.JScrollPaneHandler; -import jaxx.tags.swing.JProgressBarHandler; -import jaxx.tags.swing.JInternalFrameHandler; -import jaxx.tags.swing.JToolBarHandler; -import jaxx.tags.swing.JRadioButtonHandler; -import jaxx.tags.swing.JSplitPaneHandler; -import jaxx.tags.swing.LocaleEditorHandler; -import jaxx.tags.swing.JCheckBoxHandler; -import jaxx.tags.swing.EnumEditorHandler; -import jaxx.tags.swing.JWindowHandler; -import jaxx.tags.swing.JAXXTabHandler; -import jaxx.tags.swing.JPasswordFieldHandler; -import jaxx.tags.swing.ApplicationHandler; -import jaxx.tags.swing.JMenuHandler; -import jaxx.tags.swing.ItemHandler; -import jaxx.tags.swing.JListHandler; -import jaxx.tags.swing.JPopupMenuHandler; -import jaxx.tags.swing.JTreeHandler; -import jaxx.tags.swing.*; -import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.runtime.swing.Application; -import jaxx.runtime.swing.JAXXButtonGroup; -import jaxx.runtime.swing.JAXXComboBox; -import jaxx.runtime.swing.JAXXList; -import jaxx.runtime.swing.JAXXTab; -import jaxx.runtime.swing.JAXXTree; -import jaxx.runtime.swing.Table; -import jaxx.spi.Initializer; -import jaxx.tags.DefaultObjectHandler; -import jaxx.tags.TagManager; -import jaxx.types.ColorConverter; -import jaxx.types.GridBagConstraintsConverter; -import jaxx.types.InsetsConverter; -import jaxx.types.KeyStrokeConverter; -import jaxx.types.TypeManager; import jaxx.beaninfos.BeanInfoUtil; -import javax.swing.*; -import javax.swing.text.JTextComponent; -import java.awt.Color; -import java.awt.GridBagConstraints; -import java.awt.Insets; +import jaxx.compiler.JAXXCompiler; import jaxx.compiler.BoxedCompiledObjectDecorator; import jaxx.compiler.CompiledObjectDecorator; import jaxx.compiler.HelpRootCompiledObjectDecorator; + +import jaxx.reflect.ClassDescriptorLoader; + import jaxx.runtime.swing.editor.EnumEditor; import jaxx.runtime.swing.editor.LocaleEditor; +import jaxx.spi.Initializer; + +import jaxx.runtime.swing.*; +import jaxx.tags.*; +import jaxx.tags.swing.*; +import jaxx.types.*; + +import java.awt.*; +import javax.swing.text.JTextComponent; +import javax.swing.*; + public class SwingInitializer implements Initializer { @Override @@ -69,15 +34,21 @@ public class SwingInitializer implements Initializer { BeanInfoUtil.addJaxxBeanInfoPath("jaxx.beaninfos"); - TagManager.registerTag("java.awt.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class))); + //TC-20091005 why the namespace was on awt ? ButtonGroup is from javax.swing + TagManager.registerTag("javax.swing.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class))); +// TagManager.registerTag("java.awt.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class))); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(Application.class), ApplicationHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JCheckBox.class), JCheckBoxHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JCheckBoxMenuItem.class), JCheckBoxHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(EnumEditor.class), EnumEditorHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(LocaleEditor.class), LocaleEditorHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class), JComboBoxHandler.class); - TagManager.registerTag("javax.swing.*", "JComboBox", new JComboBoxHandler(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class))); + //TC-20091005 : JAXXComboBox and JComboBox are not the same +// TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class), JComboBoxHandler.class); +// TagManager.registerTag("javax.swing.*", "JComboBox", new JComboBoxHandler(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class))); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JComboBox.class), JComboBoxHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(EnumEditor.class), JComboBoxHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(LocaleEditor.class), JComboBoxHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class), JAXXComboBoxHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JDialog.class), JWindowHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JFrame.class), JWindowHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JInternalFrame.class), JInternalFrameHandler.class); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java index 6a22bb0..b34cd3a 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java @@ -371,6 +371,7 @@ public class JAXXCompiler { final String finalClassName = fullClassName; registerInitializer(new Runnable() { // register an initializer which will create the CompiledObject after pass 1 + @Override public void run() { DefaultObjectHandler handler = (DefaultObjectHandler) TagManager.getTagHandler(null, finalClassName, JAXXCompiler.this); if (handler == null) { @@ -725,15 +726,15 @@ public class JAXXCompiler { lineNumber = lineAttr; } } - File src = sourceFiles.peek(); + File srcFile = sourceFiles.peek(); try { - src = src.getCanonicalFile(); + srcFile = srcFile.getCanonicalFile(); } catch (IOException e) { // ignore ? } - System.err.print(src); + System.err.print(srcFile); if (lineNumber != null) { System.err.print(":" + ((sourceFiles.size() == 1) ? Integer.parseInt(lineNumber) + lineOffset : lineOffset + 1)); } @@ -789,17 +790,17 @@ public class JAXXCompiler { } public void reportError(int lineNumber, String error) { - File src = sourceFiles.isEmpty() ? null : sourceFiles.peek(); + File errorFile = sourceFiles.isEmpty() ? null : sourceFiles.peek(); try { - if (src != null) { - src = src.getCanonicalFile(); + if (errorFile != null) { + errorFile = errorFile.getCanonicalFile(); } } catch (IOException e) { // ignore ? } - System.err.print(src != null ? src.getPath() : "<unknown source>"); + System.err.print(errorFile != null ? errorFile.getPath() : "<unknown source>"); if (lineNumber > 0) { System.err.print(":" + lineNumber); } @@ -970,12 +971,12 @@ public class JAXXCompiler { components[i].getStyleClass(), parentIndex != -1 ? descriptors[parentIndex] : null); } - Stylesheet stylesheet = getStylesheet(); - if (stylesheet == null) { - stylesheet = new Stylesheet(); + Stylesheet css = getStylesheet(); + if (css == null) { + css = new Stylesheet(); } - return new JAXXObjectDescriptor(descriptors, stylesheet); + return new JAXXObjectDescriptor(descriptors, css); } /*---------------------------------------------------------------------------------*/ @@ -1227,6 +1228,7 @@ public class JAXXCompiler { break; } else { reportError("error parsing parameter list: " + parameters); + break; } default: current.append(c); @@ -1381,7 +1383,7 @@ public class JAXXCompiler { } // 1.5 adds getCanonicalName; unfortunately we can't depend on 1.5 features yet - public static String getCanonicalName(Class clazz) { + public static String getCanonicalName(Class<?> clazz) { if (clazz.isArray()) { String canonicalName = getCanonicalName(clazz.getComponentType()); if (canonicalName != null) { @@ -1496,14 +1498,17 @@ public class JAXXCompiler { TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); transformer.setErrorListener(new ErrorListener() { + @Override public void warning(TransformerException ex) throws TransformerException { throw ex; } + @Override public void error(TransformerException ex) throws TransformerException { throw ex; } + @Override public void fatalError(TransformerException ex) throws TransformerException { throw ex; } diff --git a/jaxx-compiler/src/main/java/jaxx/tags/DefaultComponentHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/DefaultComponentHandler.java index 4b68988..4a63e97 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/DefaultComponentHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/DefaultComponentHandler.java @@ -183,9 +183,9 @@ public class DefaultComponentHandler extends DefaultObjectHandler { return ""; } if (ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass()) && name.equals("layout")) { // handle containerDelegate (e.g. contentPane on JFrame) - String containerDelegate = (String) getJAXXBeanInfo().getJAXXBeanDescriptor().getValue("containerDelegate"); - if (containerDelegate != null) { - return id + '.' + containerDelegate + "().setLayout(" + valueCode + ");"; + String cDelegate = (String) getJAXXBeanInfo().getJAXXBeanDescriptor().getValue("containerDelegate"); + if (cDelegate != null) { + return id + '.' + cDelegate + "().setLayout(" + valueCode + ");"; } } // ajout du support i18n diff --git a/jaxx-compiler/src/main/java/jaxx/tags/DefaultObjectHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/DefaultObjectHandler.java index 584b771..538a8dc 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/DefaultObjectHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/DefaultObjectHandler.java @@ -57,21 +57,17 @@ import jaxx.compiler.CompiledObjectDecorator; * name of a property (e.g. <code>"document"</code>). */ public class DefaultObjectHandler implements TagHandler { + /** The class that this handler provides support for. */ private ClassDescriptor beanClass; - /** The JAXXBeanInfo for the beanClass. */ protected JAXXBeanInfo jaxxBeanInfo; - /** Maps property names to their respective JAXXPropertyDescriptors. */ private Map<String, JAXXPropertyDescriptor> properties; - /** Maps event names to their respective JAXXEventSetDescriptors. */ private Map<String, JAXXEventSetDescriptor> events; - /** Maps property names to their respective ProxyEventInfos. */ private Map<String, ProxyEventInfo> eventInfos; - /** Maps XML tags to the CompiledObjects created from them. */ protected static Map<Element, CompiledObject> objectMap = new WeakHashMap<Element, CompiledObject>(); @@ -82,12 +78,11 @@ public class DefaultObjectHandler implements TagHandler { * normally throw something else, like <code>DocumentEvent</code>. */ private class ProxyEventInfo { + /** The name of the method or field being proxied, e.g. "getText". */ String memberName; - /** The "actual" event listener for the property in question, e.g. DocumentListener. */ ClassDescriptor listenerClass; - /** * In cases where a different object (such as a model) is more directly responsible for * managing the property, this is the name of the property where that object can be @@ -97,15 +92,12 @@ public class DefaultObjectHandler implements TagHandler { * attached to the new value, and the data binding to be processed. */ String modelName; - /** The name of the method used to add the "native" event listener, e.g. "addDocumentListener". */ String addMethod; - /** The name of the method used to remove the "native" event listener, e.g. "removeDocumentListener". */ String removeMethod; } - /** * Creates a new <code>DefaultObjectHandler</code> which provides support for the specified class. The * class is not actually introspected until the {@link #compileFirstPass} method is invoked. @@ -116,7 +108,6 @@ public class DefaultObjectHandler implements TagHandler { this.beanClass = beanClass; } - /** * Performs introspection on the beanClass and stores the results. * @@ -147,7 +138,6 @@ public class DefaultObjectHandler implements TagHandler { } } - /** * Returns * @@ -157,7 +147,6 @@ public class DefaultObjectHandler implements TagHandler { return beanClass; } - /** * @return the <code>JAXXBeanInfo</code> for the class which this <code>DefaultObjectHandler</code> * supports. @@ -171,7 +160,6 @@ public class DefaultObjectHandler implements TagHandler { return jaxxBeanInfo; } - /** * Returns the <code>JAXXBeanInfo</code> for the specified class. * @@ -184,7 +172,6 @@ public class DefaultObjectHandler implements TagHandler { return JAXXIntrospector.getJAXXBeanInfo(beanClass); } - /** * Returns the type of the named property. This is the return type of the property's <code>get</code> method; * for instance <code>JLabel</code>'s <code>text</code> property is a <code>String</code>. @@ -209,7 +196,6 @@ public class DefaultObjectHandler implements TagHandler { throw new UnsupportedAttributeException("property '" + propertyName + "' not found in " + object); } - /** * @param name ? * @return <code>true</code> if the named member is <i>bound</i> (fires <code>PropertyChangeEvent</code> @@ -253,12 +239,10 @@ public class DefaultObjectHandler implements TagHandler { } } - private static ClassDescriptor getEventClass(ClassDescriptor listenerClass) { return listenerClass.getMethodDescriptors()[0].getParameterTypes()[0]; } - /** * @param memberName name of the member * @return an array of members on which the given property depends. For @@ -270,7 +254,6 @@ public class DefaultObjectHandler implements TagHandler { return eventInfo == null ? null : new String[]{eventInfo.modelName}; } - /** * Returns a snippet of Java code which will cause a <code>PropertyChangeListener</code> to be notified * when the member's value changes. The <code>PropertyChangeListener</code> is provided in the form @@ -342,7 +325,6 @@ public class DefaultObjectHandler implements TagHandler { } } - public String getRemoveMemberListenerCode(String objectCode, String dataBinding, String memberName, String propertyChangeListenerCode, JAXXCompiler compiler) { if ("getClass".equals(memberName)) { return null; @@ -370,8 +352,7 @@ public class DefaultObjectHandler implements TagHandler { compiler)); } return result.toString(); - } - catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { throw new CompilerException("Internal error: " + e); } } else { @@ -403,7 +384,6 @@ public class DefaultObjectHandler implements TagHandler { } } - /** * Configures the event handling for members which do not fire <code>PropertyChangeEvent</code> when * modified. The default implementation does nothing. Subclasses should override this method to call @@ -412,7 +392,6 @@ public class DefaultObjectHandler implements TagHandler { protected void configureProxyEventInfo() { } - /** * Configures a proxy event handler which fires <code>PropertyChangeEvents</code> when a non-bound * member is updated. This is necessary for all fields (which cannot be bound) and for methods that are @@ -427,11 +406,10 @@ public class DefaultObjectHandler implements TagHandler { * @param memberName the name of the field or method being proxied * @param listenerClass the type of listener which receives events when the field or method is updated */ - public void addProxyEventInfo(String memberName, Class listenerClass) { + public void addProxyEventInfo(String memberName, Class<?> listenerClass) { addProxyEventInfo(memberName, listenerClass, null); } - /** * Configures a proxy event handler which fires <code>PropertyChangeEvents</code> when a non-bound * member is updated. This is necessary for all fields (which cannot be bound) and for methods that are @@ -453,16 +431,15 @@ public class DefaultObjectHandler implements TagHandler { * @param listenerClass the type of listener which receives events when the field or method is updated * @param modelName the JavaBeans-style name of the model property */ - public void addProxyEventInfo(String memberName, Class listenerClass, String modelName) { + public void addProxyEventInfo(String memberName, Class<?> listenerClass, String modelName) { String listenerName = listenerClass.getName(); listenerName = listenerName.substring(listenerName.lastIndexOf(".") + 1); addProxyEventInfo(memberName, listenerClass, modelName, "add" + listenerName, "remove" + listenerName); } - // TODO: remove this temporary method, complete switchover to ClassDescriptors - public void addProxyEventInfo(String memberName, Class listenerClass, - String modelName, String addMethod, String removeMethod) { + public void addProxyEventInfo(String memberName, Class<?> listenerClass, + String modelName, String addMethod, String removeMethod) { try { addProxyEventInfo(memberName, ClassDescriptorLoader.getClassDescriptor(listenerClass.getName()), modelName, addMethod, removeMethod); } catch (ClassNotFoundException e) { @@ -470,7 +447,6 @@ public class DefaultObjectHandler implements TagHandler { } } - /** * Configures a proxy event handler which fires <code>PropertyChangeEvents</code> when a non-bound * member is updated. This is necessary for all fields (which cannot be bound) and for methods that are @@ -499,7 +475,7 @@ public class DefaultObjectHandler implements TagHandler { * @param removeMethod remove method name */ public void addProxyEventInfo(String memberName, ClassDescriptor listenerClass, - String modelName, String addMethod, String removeMethod) { + String modelName, String addMethod, String removeMethod) { ProxyEventInfo info = new ProxyEventInfo(); info.memberName = memberName; info.listenerClass = listenerClass; @@ -512,14 +488,12 @@ public class DefaultObjectHandler implements TagHandler { eventInfos.put(memberName, info); } - @Override public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { scanAttributesForDependencies(tag, compiler); compileChildrenFirstPass(tag, compiler); } - @Override public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { try { @@ -548,7 +522,6 @@ public class DefaultObjectHandler implements TagHandler { compileChildrenSecondPass(tag, compiler); } - public void registerCompiledObject(Element tag, JAXXCompiler compiler) { String id = tag.getAttribute("id"); if (id == null || id.length() == 0) { @@ -563,7 +536,6 @@ public class DefaultObjectHandler implements TagHandler { compiler.registerCompiledObject(object); } - /** * Creates the <code>CompiledObject</code> which will represent the object created by this <code>TagHandler</code>. * @@ -575,7 +547,6 @@ public class DefaultObjectHandler implements TagHandler { return new CompiledObject(id, getBeanClass(), compiler); } - /** * Initializes the default settings of the object, prior to setting its attribute values. The default * implementation does nothing. @@ -587,7 +558,6 @@ public class DefaultObjectHandler implements TagHandler { protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) { } - /** * @param property property name to test * @return <code>true</code> if the specified property should be inherited by child components when specified @@ -599,7 +569,6 @@ public class DefaultObjectHandler implements TagHandler { return false; } - /** * @param name name of event * @return <code>true</code> if the specified name has the form of an event handler attribute @@ -609,7 +578,6 @@ public class DefaultObjectHandler implements TagHandler { return name.length() > 2 && name.startsWith("on") && Character.isUpperCase(name.charAt(2)); } - /** * Scans all attributes for any dependency classes and adds them to the current compilation * set. Called by <code>compileFirstPass()</code> (it is an error to add dependencies after @@ -632,7 +600,7 @@ public class DefaultObjectHandler implements TagHandler { if (name.equals("javaBean")) { //compiler.preprocessScript(value); continue; - } + } if (name.equals("constraints") || isEventHandlerName(name)) { compiler.preprocessScript(value); // adds dependencies as a side effect } else if (name.equals("constructorParams")) { @@ -645,7 +613,6 @@ public class DefaultObjectHandler implements TagHandler { } } - /** * Processes the attributes of an XML tag. Four kinds of attributes are supported: simple property values (of any * datatype supported by {@link #convertFromString}), data binding expressions (attributes containing curly-brace @@ -663,7 +630,7 @@ public class DefaultObjectHandler implements TagHandler { attributes.add((Attr) children.item(i)); } Collections.sort(attributes, getAttributeComparator()); - + for (Attr attribute : attributes) { String name = attribute.getName(); String value = attribute.getValue().trim(); @@ -702,7 +669,7 @@ public class DefaultObjectHandler implements TagHandler { if (name.equals("genericType")) { //TC-20090313 check after all atributes been processed - if (object == compiler.getRootObject() ) { + if (object == compiler.getRootObject()) { compiler.setGenericType(value); } else { object.setGenericTypes(value.split(",")); @@ -741,7 +708,6 @@ public class DefaultObjectHandler implements TagHandler { } } - /** * Returns a <code>Comparator</code> which defines the ordering in which the tag's attributes should be processed. The * default implementation sorts the attributes according to the order defined by the {@link #getAttributeOrdering} method. @@ -750,6 +716,7 @@ public class DefaultObjectHandler implements TagHandler { */ protected Comparator<Attr> getAttributeComparator() { return new Comparator<Attr>() { + @Override public int compare(Attr a, Attr b) { int aOrder = getAttributeOrdering(a); @@ -760,7 +727,6 @@ public class DefaultObjectHandler implements TagHandler { }; } - /** * Returns the priority with which a particular attribute should be processed. Lower numbers should be processed before * higher numbers. This value is used by the {@link #getAttributeComparator} method to define the sort ordering. @@ -775,7 +741,6 @@ public class DefaultObjectHandler implements TagHandler { return 0; } - public String getApplyPropertyOrDataBindingCode(CompiledObject object, String propertyName, String stringValue, JAXXCompiler compiler) { ClassDescriptor type = getPropertyType(object, propertyName, compiler); String binding = compiler.processDataBindings(stringValue, type); @@ -783,7 +748,7 @@ public class DefaultObjectHandler implements TagHandler { return ""; } try { - Class typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null; + Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null; Object value = convertFromString(propertyName, stringValue, typeClass); return getSetPropertyCode(object.getJavaCode(), propertyName, TypeManager.getJavaCode(value), compiler); } catch (NumberFormatException e) { @@ -796,7 +761,6 @@ public class DefaultObjectHandler implements TagHandler { return ""; } - /** * Set a single property on an object. The value may be either a simple value or contain data binding expressions. * Simple values are first converted to the property's type using {@link #convertFromString}. @@ -843,7 +807,7 @@ public class DefaultObjectHandler implements TagHandler { compiler.addInlineStyle(object, propertyName, false); } try { - Class typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null; + Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null; Object value = convertFromString(propertyName, stringValue, typeClass); setProperty(object, propertyName, value, compiler); } catch (NumberFormatException e) { @@ -859,17 +823,14 @@ public class DefaultObjectHandler implements TagHandler { } } - public void applyStylesheets(CompiledObject object, JAXXCompiler compiler) { applyStylesheets(object, compiler, null); } - private void applyStylesheets(final CompiledObject object, JAXXCompiler compiler, Stylesheet overrides) { applyStylesheets(object, compiler, overrides, true); } - private void applyStylesheets(final CompiledObject object, JAXXCompiler compiler, Stylesheet overrides, boolean recurse) { try { Stylesheet stylesheet = compiler.getStylesheet(); @@ -883,7 +844,7 @@ public class DefaultObjectHandler implements TagHandler { String id = isRoot ? object.getId() + ' ' + descriptor.getId() : "( " + object.getId() + " ) " + descriptor.getId(); CompiledObject child = new CompiledObject(id, "((" + JAXXCompiler.getCanonicalName(classDescriptor) + ") " + - object.getJavaCode() + ".getObjectById(" + TypeManager.getJavaCode(descriptor.getId()) + "))", + object.getJavaCode() + ".getObjectById(" + TypeManager.getJavaCode(descriptor.getId()) + "))", classDescriptor, compiler, true); @@ -916,15 +877,13 @@ public class DefaultObjectHandler implements TagHandler { } else if (stylesheet != null) { StylesheetHelper.applyTo(object, compiler, stylesheet, overrides); } - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { throw new CompilerException(e); } catch (IllegalArgumentException e) { compiler.reportError(e.getMessage()); } } - /** * Adds the necessary Java code to a <code>CompiledObject</code> to add an event listener at runtime. * @@ -958,7 +917,6 @@ public class DefaultObjectHandler implements TagHandler { } } - /** * Returns a snippet of Java code which will retrieve an object property at runtime. Typically the code is * just a call to the property's <code>get</code> method, but it can be arbitrarily complex. @@ -986,7 +944,6 @@ public class DefaultObjectHandler implements TagHandler { throw new UnsupportedAttributeException("property '" + name + "' could not be found in class " + getBeanClass().getName()); } - /** * Returns a snippet of Java code which will set an object property at runtime. Typically the code is * just a call to the property's <code>set</code> method, but it can be arbitrarily complex. @@ -1009,7 +966,6 @@ public class DefaultObjectHandler implements TagHandler { throw new UnsupportedAttributeException("property '" + name + "' could not be found in class " + getBeanClass().getName()); } - /** * Appends Java code to a <code>CompiledObject</code> in order to implement a property assignment. * <code>setProperty</code> is invoked in response to most XML attributes (those which are not more @@ -1029,7 +985,6 @@ public class DefaultObjectHandler implements TagHandler { object.appendInitializationCode(getSetPropertyCode(object.getJavaCodeForProperty(name), name, TypeManager.getJavaCode(value), compiler)); } - /** * Maps string values onto integers, so that int-valued enumeration properties can be specified by strings. For * example, when passed a key of 'alignment', this method should normally map the values 'left', 'center', and @@ -1074,7 +1029,6 @@ public class DefaultObjectHandler implements TagHandler { throw new NumberFormatException(value); } - /** * As {@link TypeManager#convertFromString(String, Class)}, except that it additionally supports constant names * for <code>int</code>-valued types. @@ -1085,7 +1039,7 @@ public class DefaultObjectHandler implements TagHandler { * @return the converted object * @see #constantValue */ - protected Object convertFromString(String key, String value, Class type) { + protected Object convertFromString(String key, String value, Class<?> type) { if (type == null || type == Object.class) { return value; } @@ -1100,7 +1054,6 @@ public class DefaultObjectHandler implements TagHandler { } } - /** * Compiles the child tags of the current tag. The default implementation invokes {@link #compileChildTagFirstPass} * for each child tag. @@ -1122,7 +1075,6 @@ public class DefaultObjectHandler implements TagHandler { } } - /** * Compiles the child tags of the current tag. The default implementation invokes {@link #compileChildTagFirstPass} * for each child tag. @@ -1149,7 +1101,6 @@ public class DefaultObjectHandler implements TagHandler { } } - /** * Compiles a child of the current tag. The default implementation calls {@link JAXXCompiler#compileFirstPass * JAXXCompiler.compileFirstPass}. @@ -1163,7 +1114,6 @@ public class DefaultObjectHandler implements TagHandler { compiler.compileFirstPass(tag); } - /** * Compiles a child of the current tag. The default implementation calls {@link JAXXCompiler#compileFirstPass * JAXXCompiler.compileSecondPass}. @@ -1181,4 +1131,4 @@ public class DefaultObjectHandler implements TagHandler { public String toString() { return getClass().getName() + "[" + getBeanClass().getName() + "]"; } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/TagManager.java b/jaxx-compiler/src/main/java/jaxx/tags/TagManager.java index 8c2090b..d4ae0f0 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/TagManager.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/TagManager.java @@ -53,8 +53,9 @@ public class TagManager { private String localPart; public QName(String namespaceURI, String localPart) { - if (localPart == null) + if (localPart == null) { throw new NullPointerException(); + } this.namespaceURI = namespaceURI; this.localPart = localPart; } @@ -71,8 +72,9 @@ public class TagManager { @Override public boolean equals(Object o) { - if (o == null || !(o instanceof QName)) + if (o == null || !(o instanceof QName)) { return false; + } QName qname = (QName) o; return qname.getNamespaceURI().equals(getNamespaceURI()) && qname.getLocalPart().equals(getLocalPart()); } @@ -101,6 +103,7 @@ public class TagManager { * encountered (either the class' simple name, if it is unambiguous, or its fully-qualified name), the specified * <code>TagHandler</code> will be invoked to compile it. * + * @param <T> * @param beanClass the class to associate with a <code>TagHandler</code> * @param handler the <code>TagHandler</code> class, which must descend from <code>DefaultObjectHandler</code> * @throws IllegalArgumentException if the handler class does not descend from <code>DefaultObjectHandler</code> @@ -152,6 +155,7 @@ public class TagManager { * It is not an error to register an already-registered tag and namespace combination. The new mapping * will replace the old mapping. * + * @param <T> * @param namespace the tag's namespace * @param tag the simple name of the tag * @param handler the <code>TagHandler</code> which should process the tag @@ -385,15 +389,18 @@ public class TagManager { * @return the resolved fqn class name */ public static String resolveClassName(String name, JAXXCompiler compiler) { - if (name.endsWith("[]")) + if (name.endsWith("[]")) { return resolveClassName(name.substring(0, name.length() - 2), compiler) + "[]"; - if (name.indexOf("<") != -1) + } + if (name.indexOf("<") != -1) { name = name.substring(0, name.indexOf("<")); // strip off generic types + } name = name.intern(); if (name.equals("boolean") || name.equals("byte") || name.equals("short") || name.equals("int") || - name.equals("long") || name.equals("float") || name.equals("double") || name.equals("char")) + name.equals("long") || name.equals("float") || name.equals("double") || name.equals("char")) { return name; + } String result = null; String originalName = name; @@ -452,14 +459,16 @@ public class TagManager { // else we found a class by the same name, but in the wrong package } - if (dotPos <= 0) + if (dotPos <= 0) { break; + } dotPos = originalName.lastIndexOf('.', dotPos - 1); } } - if (result != null && !result.equals(originalName)) + if (result != null && !result.equals(originalName)) { result = resolveClassName(result, compiler); // check for aliases against the new name as well + } return result; } @@ -468,8 +477,9 @@ public class TagManager { public static ClassDescriptor resolveClass(String className, JAXXCompiler compiler) { try { className = resolveClassName(className, compiler); - if (className == null) + if (className == null) { return null; + } return ClassDescriptorLoader.getClassDescriptor(className, compiler.getClassLoader()); } catch (ClassNotFoundException e) { diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/EnumEditorHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/EnumEditorHandler.java deleted file mode 100644 index fda7b29..0000000 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/EnumEditorHandler.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.tags.swing; - -import jaxx.CompilerException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; - -import java.awt.event.ItemListener; -import jaxx.runtime.swing.editor.EnumEditor; - -public class EnumEditorHandler extends DefaultComponentHandler { - - public EnumEditorHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, EnumEditor.class); - } - - @Override - protected void configureProxyEventInfo() { - super.configureProxyEventInfo(); - addProxyEventInfo("getSelectedIndex", ItemListener.class); - addProxyEventInfo("getSelectedItem", ItemListener.class); - } - - @Override - protected CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { - return new CompiledItemContainer(id, getBeanClass(), compiler); - } -// @Override -// public void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { -// super.compileChildrenSecondPass(tag, compiler); -// CompiledItemContainer list = (CompiledItemContainer) compiler.getOpenComponent(); -// List<Item> items = list.getItems(); -// if (items != null && !items.isEmpty()) { -// String listName = list.getId() + "$items"; -// list.appendAdditionCode("java.util.List<jaxx.runtime.swing.Item> " + listName + " = new java.util.ArrayList<jaxx.runtime.swing.Item>();"); -// for (Item item : items) { -// String id = item.getId(); -// CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(Item.class), compiler); -// compiledItem.setConstructorParams(TypeManager.getJavaCode(id) + ", " + TypeManager.getJavaCode(item.getLabel()) + ", " + TypeManager.getJavaCode(item.getValue()) + ", " + item.isSelected()); -// compiler.registerCompiledObject(compiledItem); -// list.appendAdditionCode(listName + ".add(" + id + ");"); -// } -// list.appendAdditionCode(list.getId() + ".setItems(" + listName + ");"); -// } -// } -} - - - diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/ItemHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/ItemHandler.java index 9de9b60..fa491a3 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/ItemHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/swing/ItemHandler.java @@ -24,14 +24,17 @@ import java.util.List; public class ItemHandler implements TagHandler { private String DATA_BINDING = "<data binding has not been processed yet>"; + @Override public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { compileChildrenFirstPass(tag, compiler); } + @Override public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { String id = tag.getAttribute("id"); - if (id == null || id.length() == 0) + if (id == null || id.length() == 0) { id = compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(Item.class)); + } String label = null; String value = null; boolean selected = false; @@ -47,10 +50,12 @@ public class ItemHandler implements TagHandler { } if (name.equals(Item.LABEL_PROPERTY)) { String labelBinding = compiler.processDataBindings(attrValue, ClassDescriptorLoader.getClassDescriptor(String.class)); - if (labelBinding != null) + if (labelBinding != null) { compiler.registerDataBinding(labelBinding, id + ".label", id + ".setLabel(" + labelBinding + ");"); - else + } + else { label = attrValue; + } continue; } if (name.equals(Item.VALUE_PROPERTY)) { @@ -58,16 +63,19 @@ public class ItemHandler implements TagHandler { if (valueBinding != null) { value = DATA_BINDING; compiler.registerDataBinding(valueBinding, id + ".value", id + ".setValue(" + valueBinding + ");"); - } else + } else { value = attrValue; + } continue; } if (name.equals(Item.SELECTED_PROPERTY)) { String selectedBinding = compiler.processDataBindings(attrValue, ClassDescriptorLoader.getClassDescriptor(Boolean.class)); - if (selectedBinding != null) + if (selectedBinding != null) { compiler.registerDataBinding(selectedBinding, id + ".selected", id + ".setSelected(" + selectedBinding + ");"); - else + } + else { selected = (Boolean) TypeManager.convertFromString(attrValue, Boolean.class); + } continue; } @@ -78,8 +86,9 @@ public class ItemHandler implements TagHandler { Item item = new Item(id, label, value, selected); CompiledItemContainer list = (CompiledItemContainer) compiler.getOpenComponent(); - if (value == null) + if (value == null) { compiler.reportError("<item> tag is missing required 'value' attribute"); + } else { if (!value.equals(DATA_BINDING)) { List<Item> items = list.getItems(); @@ -108,8 +117,9 @@ public class ItemHandler implements TagHandler { } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { String text = ((Text) node).getData().trim(); - if (text.length() > 0) + if (text.length() > 0) { compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); + } } } } @@ -126,8 +136,9 @@ public class ItemHandler implements TagHandler { } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { String text = ((Text) node).getData().trim(); - if (text.length() > 0) + if (text.length() > 0) { compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); + } } } } diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JComboBoxHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/JComboBoxHandler.java index 56a1d8d..456ef98 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JComboBoxHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/swing/JComboBoxHandler.java @@ -4,26 +4,23 @@ */ package jaxx.tags.swing; +import java.io.IOException; import jaxx.CompilerException; -import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; import jaxx.reflect.ClassDescriptor; import jaxx.reflect.ClassDescriptorLoader; -import jaxx.runtime.swing.Item; -import jaxx.runtime.swing.JAXXComboBox; import jaxx.tags.DefaultComponentHandler; -import jaxx.types.TypeManager; -import org.w3c.dom.Element; import java.awt.event.ItemListener; -import java.io.IOException; -import java.util.List; +import javax.swing.JComboBox; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; public class JComboBoxHandler extends DefaultComponentHandler { public JComboBoxHandler(ClassDescriptor beanClass) { super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JAXXComboBox.class); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JComboBox.class); } @Override @@ -34,26 +31,10 @@ public class JComboBoxHandler extends DefaultComponentHandler { } @Override - protected CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { - return new CompiledItemContainer(id, getBeanClass(), compiler); - } - - @Override public void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - super.compileChildrenSecondPass(tag, compiler); - CompiledItemContainer list = (CompiledItemContainer) compiler.getOpenComponent(); - List<Item> items = list.getItems(); - if (items != null && !items.isEmpty()) { - String listName = list.getId() + "$items"; - list.appendAdditionCode("java.util.List<jaxx.runtime.swing.Item> " + listName + " = new java.util.ArrayList<jaxx.runtime.swing.Item>();"); - for (Item item : items) { - String id = item.getId(); - CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(Item.class), compiler); - compiledItem.setConstructorParams(TypeManager.getJavaCode(id) + ", " + TypeManager.getJavaCode(item.getLabel()) + ", " + TypeManager.getJavaCode(item.getValue()) + ", " + item.isSelected()); - compiler.registerCompiledObject(compiledItem); - list.appendAdditionCode(listName + ".add(" + id + ");"); - } - list.appendAdditionCode(list.getId() + ".setItems(" + listName + ");"); + NodeList children = tag.getChildNodes(); + if (children.getLength() > 0) { + compiler.reportError("JComboBox does not accept childs"); } } } diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JSliderHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/JSliderHandler.java index 195bf5c..a09a73d 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JSliderHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/swing/JSliderHandler.java @@ -17,29 +17,32 @@ import javax.swing.JSlider; import javax.swing.event.ChangeListener; public class JSliderHandler extends DefaultComponentHandler { + public JSliderHandler(ClassDescriptor beanClass) { super(beanClass); - if (!ClassDescriptorLoader.getClassDescriptor(JSlider.class).isAssignableFrom(beanClass)) + if (!ClassDescriptorLoader.getClassDescriptor(JSlider.class).isAssignableFrom(beanClass)) { throw new IllegalArgumentException(getClass().getName() + " does not support the class " + beanClass.getName()); + } } - + @Override protected int getAttributeOrdering(Attr attr) { - if (attr.getName().equals("value")) + if (attr.getName().equals("value")) { return 1; - else + } else { return super.getAttributeOrdering(attr); + } } - - protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { + @Override + protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { super.setDefaults(object, tag, compiler); setAttribute(object, "value", "0", false, compiler); } - + @Override protected void configureProxyEventInfo() { super.configureProxyEventInfo(); addProxyEventInfo("getValue", ChangeListener.class, "model"); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JWindowHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/JWindowHandler.java index b5ae451..22a4c91 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JWindowHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/swing/JWindowHandler.java @@ -53,7 +53,7 @@ public class JWindowHandler extends DefaultComponentHandler { public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { super.compileSecondPass(tag, compiler); CompiledObject object = objectMap.get(tag); - Map properties = object.getProperties(); + Map<?,?> properties = object.getProperties(); if (!properties.containsKey("width") && !properties.containsKey("height")) { compiler.appendLateInitializer(object.getId() + ".pack();\n"); } diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/LocaleEditorHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/LocaleEditorHandler.java deleted file mode 100644 index 256db56..0000000 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/LocaleEditorHandler.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.tags.swing; - -import jaxx.CompilerException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; - -import java.awt.event.ItemListener; -import jaxx.runtime.swing.editor.LocaleEditor; - -public class LocaleEditorHandler extends DefaultComponentHandler { - - public LocaleEditorHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, LocaleEditor.class); - } - - @Override - protected void configureProxyEventInfo() { - super.configureProxyEventInfo(); - addProxyEventInfo("getSelectedIndex", ItemListener.class); - addProxyEventInfo("getSelectedItem", ItemListener.class); - } - - @Override - protected CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { - return new CompiledItemContainer(id, getBeanClass(), compiler); - } -// @Override -// public void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { -// super.compileChildrenSecondPass(tag, compiler); -// CompiledItemContainer list = (CompiledItemContainer) compiler.getOpenComponent(); -// List<Item> items = list.getItems(); -// if (items != null && !items.isEmpty()) { -// String listName = list.getId() + "$items"; -// list.appendAdditionCode("java.util.List<jaxx.runtime.swing.Item> " + listName + " = new java.util.ArrayList<jaxx.runtime.swing.Item>();"); -// for (Item item : items) { -// String id = item.getId(); -// CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(Item.class), compiler); -// compiledItem.setConstructorParams(TypeManager.getJavaCode(id) + ", " + TypeManager.getJavaCode(item.getLabel()) + ", " + TypeManager.getJavaCode(item.getValue()) + ", " + item.isSelected()); -// compiler.registerCompiledObject(compiledItem); -// list.appendAdditionCode(listName + ".add(" + id + ");"); -// } -// list.appendAdditionCode(list.getId() + ".setItems(" + listName + ");"); -// } -// } -} - - - diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/RowHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/RowHandler.java index 61e1db8..a5db9a9 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/RowHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/swing/RowHandler.java @@ -18,10 +18,13 @@ import java.awt.GridBagConstraints; import java.io.IOException; public class RowHandler implements TagHandler { + + @Override public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { compileChildrenFirstPass(tag, compiler); } + @Override public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { if (!ClassDescriptorLoader.getClassDescriptor(Table.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) { compiler.reportError("row tag may only appear within Table tag"); @@ -82,4 +85,4 @@ public class RowHandler implements TagHandler { protected void compileChildTagSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { compiler.compileSecondPass(tag); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/TabHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/TabHandler.java index 913c9cc..a8b3b0f 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/TabHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/swing/TabHandler.java @@ -26,11 +26,13 @@ import java.io.IOException; public class TabHandler implements TagHandler { + @Override public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { compileChildrenFirstPass(tag, compiler); } + @Override public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { if (!ClassDescriptorLoader.getClassDescriptor(JTabbedPane.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) { compiler.reportError("tab tag may only appear within JTabbedPane tag"); diff --git a/jaxx-compiler/src/main/java/jaxx/tags/validator/BeanValidatorHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/validator/BeanValidatorHandler.java index c59423e..c4bd76d 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/validator/BeanValidatorHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/validator/BeanValidatorHandler.java @@ -11,7 +11,7 @@ import jaxx.introspection.JAXXBeanInfo; import jaxx.introspection.JAXXPropertyDescriptor; import jaxx.reflect.ClassDescriptor; import jaxx.reflect.ClassDescriptorLoader; -import jaxx.runtime.SwingValidatorUtil; +import jaxx.runtime.validator.swing.SwingValidatorUtil; import jaxx.runtime.validator.swing.SwingValidator; import jaxx.runtime.validator.swing.ui.AbstractBeanValidatorUI; import jaxx.tags.DefaultObjectHandler; diff --git a/jaxx-compiler/src/main/java/jaxx/tags/validator/ExcludeFieldValidatorHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/validator/ExcludeFieldValidatorHandler.java index 70aaafa..fbb6141 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/validator/ExcludeFieldValidatorHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/validator/ExcludeFieldValidatorHandler.java @@ -25,6 +25,7 @@ public class ExcludeFieldValidatorHandler implements TagHandler { /** to use log facility, just put in your code: log.info(\"...\"); */ static private Log log = LogFactory.getLog(ExcludeFieldValidatorHandler.class); + @Override public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { if (compiler.getOptions().isVerbose()) { log.info(tag); @@ -32,6 +33,7 @@ public class ExcludeFieldValidatorHandler implements TagHandler { //todo check there is no child } + @Override public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { if (compiler.getOptions().isVerbose()) { log.debug(tag); diff --git a/jaxx-compiler/src/main/java/jaxx/tags/validator/FieldValidatorHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/validator/FieldValidatorHandler.java index 1a3167f..d5864ff 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/validator/FieldValidatorHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/validator/FieldValidatorHandler.java @@ -25,6 +25,7 @@ public class FieldValidatorHandler implements TagHandler { /** to use log facility, just put in your code: log.info(\"...\"); */ static private Log log = LogFactory.getLog(FieldValidatorHandler.class); + @Override public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { if (compiler.getOptions().isVerbose()) { log.info(tag); @@ -32,6 +33,7 @@ public class FieldValidatorHandler implements TagHandler { //todo check there is no child } + @Override public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { if (compiler.getOptions().isVerbose()) { log.info(tag); diff --git a/jaxx-compiler/src/test/java/jaxx/beaninfos/BeanIntoUtilTest.java b/jaxx-compiler/src/test/java/jaxx/beaninfos/BeanIntoUtilTest.java index 5852bb9..057f278 100644 --- a/jaxx-compiler/src/test/java/jaxx/beaninfos/BeanIntoUtilTest.java +++ b/jaxx-compiler/src/test/java/jaxx/beaninfos/BeanIntoUtilTest.java @@ -21,7 +21,7 @@ public class BeanIntoUtilTest { BeanInfoUtil.reset(); Assert.assertEquals(searchPath0.length, Introspector.getBeanInfoSearchPath().length); - String packageName = getClass().getPackage().getName()+".dummy"; + String packageName = getClass().getPackage().getName() + ".dummy"; BeanInfoUtil.addJaxxBeanInfoPath("jaxx.beaninfos", packageName); searchPath = Introspector.getBeanInfoSearchPath(); diff --git a/jaxx-compiler/src/test/java/jaxx/junit/TagManagerTest.java b/jaxx-compiler/src/test/java/jaxx/junit/TagManagerTest.java index 446a4ac..0055cb6 100644 --- a/jaxx-compiler/src/test/java/jaxx/junit/TagManagerTest.java +++ b/jaxx-compiler/src/test/java/jaxx/junit/TagManagerTest.java @@ -135,8 +135,10 @@ public class TagManagerTest { @Test public void testAliasing() { - Assert.assertEquals("JComboBox is not aliased to jaxx.runtime.swing.JAXXComboBox", "jaxx.runtime.swing.JAXXComboBox", TagManager.resolveClassName("JComboBox", compiler)); - Assert.assertEquals("javax.swing.JComboBox is not aliased to jaxx.runtime.swing.JAXXComboBox", "jaxx.runtime.swing.JAXXComboBox", TagManager.resolveClassName("javax.swing.JComboBox", compiler)); + Assert.assertEquals("ButtonGroup is not aliased to jaxx.runtime.swing.JAXXButtonGroup", "jaxx.runtime.swing.JAXXButtonGroup", TagManager.resolveClassName("ButtonGroup", compiler)); + Assert.assertEquals("javax.swing.ButtonGroup is not aliased to jaxx.runtime.swing.JAXXButtonGroup", "jaxx.runtime.swing.JAXXButtonGroup", TagManager.resolveClassName("javax.swing.ButtonGroup", compiler)); +// Assert.assertEquals("JComboBox is not aliased to jaxx.runtime.swing.JAXXComboBox", "jaxx.runtime.swing.JAXXComboBox", TagManager.resolveClassName("JComboBox", compiler)); +// Assert.assertEquals("javax.swing.JComboBox is not aliased to jaxx.runtime.swing.JAXXComboBox", "jaxx.runtime.swing.JAXXComboBox", TagManager.resolveClassName("javax.swing.JComboBox", compiler)); } diff --git a/jaxx-compiler/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java b/jaxx-compiler/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java deleted file mode 100644 index 90564a7..0000000 --- a/jaxx-compiler/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java +++ /dev/null @@ -1,394 +0,0 @@ -package jaxx.runtime.swing.navigation; - -import jaxx.runtime.swing.navigation.*; -import jaxx.runtime.DefaultJAXXContext; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXContextEntryDef; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import org.junit.Assert; -import org.junit.Test; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - - -/** - * Test du model de navigation. - * - * @author chemit - */ -public class NavigationTreeModelTest { - - private static final String ROOT_CONTEXT = "$root"; - private static final String FAKE = "-fake"; - - private static final String separator = "/"; - - @Test - public void testFindNode() throws Exception { - - NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder(separator); - - NavigationTreeNode rootNode = builder.build(null, (String) null, (String) null, ROOT_CONTEXT, null, null); - - for (int i = 0; i < 4; i++) { - NavigationTreeNode sonNode = builder.build(rootNode, (String) null, (String) null, getNodeContext(i), null, null); - for (int j = 0; j < 4; j++) { - NavigationTreeNode sonSonNode = builder.build(sonNode, (String) null, (String) null, getNodeContext(i, j), null, null); - for (int k = 0; k < 4; k++) { - builder.build(sonSonNode, (String) null, (String) null, getNodeContext(i, j, k), null, null); - } - } - } - - NavigationTreeModel model = builder.getModel(); - - NavigationTreeNode node; - String contextPath; - String currentNode; - - contextPath = ROOT_CONTEXT; - node = model.findNode(contextPath); - assertNodeEquals(contextPath, ROOT_CONTEXT, 0, node, true); - - node = model.findNode(ROOT_CONTEXT + FAKE); - Assert.assertNull(node); - - for (int i = 0; i < 4; i++) { - currentNode = getNodeContext(i); - contextPath = ROOT_CONTEXT + separator + currentNode; - node = model.findNode(contextPath); - assertNodeEquals(contextPath, currentNode, 1, node, false); - - for (int j = 0; j < 4; j++) { - currentNode = getNodeContext(i, j); - contextPath = ROOT_CONTEXT + separator + getNodeContext(i) + separator + currentNode; - node = model.findNode(contextPath); - assertNodeEquals(contextPath, currentNode, 2, node, false); - - for (int k = 0; k < 4; k++) { - currentNode = getNodeContext(i, j, k); - contextPath = ROOT_CONTEXT + separator + getNodeContext(i) + separator + getNodeContext(i, j) + separator + currentNode; - node = model.findNode(contextPath); - assertNodeEquals(contextPath, currentNode, 3, node, false); - } - - node = model.findNode(ROOT_CONTEXT + separator + getNodeContext(i) + separator + getNodeContext(i, j) + separator + currentNode + FAKE); - Assert.assertNull(node); - } - - node = model.findNode(ROOT_CONTEXT + separator + getNodeContext(i) + separator + currentNode + FAKE); - Assert.assertNull(node); - - } - - } - - /** - * Test the {@link NavigationTreeModel#getJAXXContextValue(jaxx.runtime.JAXXContext, String)} with an entry point - * as a bean. - * <p/> - * Tree is like this - * <pre> - * $root + - * - name <-- attached to context entry : java.lang.String.class,"name" - * - name2 <-- attached to context entry : java.lang.String.class,"name2" - * - model + <-- attached to context entry : Model.class,null - * - name - * -integerValue - * - sons + - * - 0 + - * - name - * - integerValue - * - sons - * - 1 + - * - name - * - integerValue - * - sons - * - 2 + - * - name - * - integerValue - * - sons - * </pre> - * <p/> - * With this tree, we will have to results : - * <pre> - * $root.name => context.get(String.class,"name") - * $root.name2 => context.get(String.class,"name2") - * $root.model => context.get(Model.class) - * $root.model.name => context.get(Model.class).getName() - * $root.model.integerValue => context.get(Model.class).getIntegerValue() - * $root.model.sons => context.get(Model.class).getSons() - * $root.model.sons.0 => context.get(Model.class).getSons().get(0) - * </pre> - * - * @throws Exception if any pb - */ - @Test - public void testGetJAXXContextValue() throws Exception { - - NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder(separator); - - NavigationTreeNode rootNode = builder.build(null, (String) null, (String) null, ROOT_CONTEXT, null, null); - - NavigationTreeNode sonNode; - NavigationTreeNode sonSonNode; - NavigationTreeNode sonSonSonNode; - - builder.build(rootNode, (String) null, JAXXContextEntryDef.newDef("name", String.class), "name", null, null); - builder.build(rootNode, (String) null, JAXXContextEntryDef.newDef("name2", String.class), "name2", null, null); - - sonNode = builder.build(rootNode, (String) null, JAXXContextEntryDef.newDef(Model.class), "model", null, null); - - builder.build(sonNode, (String) null, "../name", "name", null, null); - builder.build(sonNode, (String) null, "../integerValue", "integerValue", null, null); - - sonSonNode = builder.build(sonNode, (String) null, "../sons", "sons", null, null); - - sonSonSonNode = builder.build(sonSonNode, (String) null, "..[1]", 0 + "", null, null); - - builder.build(sonSonSonNode, (String) null, "../name", "name", null, null); - builder.build(sonSonSonNode, (String) null, "../integerValue", "integerValue", null, null); - builder.build(sonSonSonNode, (String) null, "../sons", "sons", null, null); - - sonSonSonNode = builder.build(sonSonNode, (String) null, "..[2]", 1 + "", null, null); - - builder.build(sonSonSonNode, (String) null, "../name", "name", null, null); - builder.build(sonSonSonNode, (String) null, "../integerValue", "integerValue", null, null); - builder.build(sonSonSonNode, (String) null, "../sons", "sons", null, null); - - sonSonSonNode = builder.build(sonSonNode, (String) null, (String) null, 2 + "", null, null); - //sonSonSonNode = model.new NavigationTreeNode(null, "..[3]", 2 + "", null, null); - sonSonNode.insert(sonSonSonNode, 2); - builder.build(sonSonSonNode, (String) null, "../..[3]/name", "name", null, null); - builder.build(sonSonSonNode, (String) null, "../..[3]/integerValue", "integerValue", null, null); - builder.build(sonSonSonNode, (String) null, "../..[3]/sons", "sons", null, null); - - NavigationTreeModel model = builder.getModel(); - - JAXXContext context = new DefaultJAXXContext(); - context.setContextValue("the name", "name"); - context.setContextValue("the name2", "name2"); - - - context.setContextValue( - new Model("modelName", 10, - Arrays.asList( - new Model("one", 1, Collections.<Model>emptyList()), - new Model("two", 2, Collections.<Model>emptyList()), - new Model("three", 3, Collections.<Model>emptyList()) - ) - ) - ); - - Assert.assertNull(model.getJAXXContextValue(context, "$root.name" + FAKE)); - - testBinding(model, context, "$root/name", context.getContextValue(String.class, "name")); - testBinding(model, context, "$root/name2", context.getContextValue(String.class, "name2")); - - Model bean = context.getContextValue(Model.class); - - testBinding(model, context, "$root/model", bean); - testBinding(model, context, "$root/model/name", bean.getName()); - testBinding(model, context, "$root/model/integerValue", bean.getIntegerValue()); - testBinding(model, context, "$root/model/sons", bean.getSons()); - - testBinding(model, context, "$root/model/sons/0/name", bean.getSons().get(0).getName()); - testBinding(model, context, "$root/model/sons/0/integerValue", bean.getSons().get(0).getIntegerValue()); - testBinding(model, context, "$root/model/sons/0/sons", bean.getSons().get(0).getSons()); - - - testBinding(model, context, "$root/model/sons/1/name", bean.getSons().get(1).getName()); - testBinding(model, context, "$root/model/sons/1/integerValue", bean.getSons().get(1).getIntegerValue()); - testBinding(model, context, "$root/model/sons/1/sons", bean.getSons().get(1).getSons()); - - testBinding(model, context, "$root/model/sons/2/name", bean.getSons().get(2).getName()); - testBinding(model, context, "$root/model/sons/2/integerValue", bean.getSons().get(2).getIntegerValue()); - testBinding(model, context, "$root/model/sons/2/sons", bean.getSons().get(2).getSons()); - } - - /** - * Test the {@link NavigationTreeModel#getJAXXContextValue(jaxx.runtime.JAXXContext, String)} with an entry point - * as a list. - * <p/> - * Tree is like this - * <pre> - * $root + - * - models + <-- attached to context entry : java.util.List.class,"models" - * - 0 + - * - name - * -integerValue - * - sons + - * - 0 + - * - name - * - 1 + - * - name - * - integerValue - * - sons - * - 2 + - * - name - * - integerValue - * - sons - * </pre> - * <p/> - * With this tree, we will have to results : - * <pre> - * $root.models => context.get(List.class,"models") - * $root.models.0 => context.get(List.class,"models").get(0) - * $root.models.0.name => context.get(List.class,"models").get(0).getName() - * </pre> - * - * @throws Exception if any pb - */ - @Test - public void testGetJAXXContextValueFromList() throws Exception { - - NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder(separator); - - NavigationTreeNode rootNode = builder.build(null, (String) null, (String) null, ROOT_CONTEXT, null, null); - - NavigationTreeNode sonNode; - NavigationTreeNode sonSonNode; - NavigationTreeNode sonSonSonNode; - - // first son is a list of models - sonNode = builder.build(rootNode, (String) null, JAXXContextEntryDef.newListDef("models"), "models", null, null); - - // first son son is a model - sonSonNode = builder.build(sonNode, (String) null, "..[1]", "0", null, null); - - builder.build(sonSonNode, (String) null, "../name", "name", null, null); - builder.build(sonSonNode, (String) null, "../integerValue", "integerValue", null, null); - sonSonNode = builder.build(sonSonNode, (String) null, "../sons", "sons", null, null); - - sonSonSonNode = builder.build(sonSonNode, (String) null, "..[1]", "0", null, null); - builder.build(sonSonSonNode, (String) null, "../name", "name", null, null); - - // second son son is a model - sonSonNode = builder.build(sonNode, (String) null, "..[2]", "1", null, null); - - builder.build(sonSonNode, (String) null, "../name", "name", null, null); - builder.build(sonSonNode, (String) null, "../integerValue", "integerValue", null, null); - builder.build(sonSonNode, (String) null, "../sons", "sons", null, null); - - // third son son is a model - sonSonNode = builder.build(sonNode, (String) null, "..[3]", "2", null, null); - - builder.build(sonSonNode, (String) null, "../name", "name", null, null); - builder.build(sonSonNode, (String) null, "../integerValue", "integerValue", null, null); - builder.build(sonSonNode, (String) null, "../sons", "sons", null, null); - - NavigationTreeModel model = builder.getModel(); - - - List<Model> list = Arrays.asList( - new Model("entryOne", 10, - Arrays.asList( - new Model("one", 1, Collections.<Model>emptyList()), - new Model("two", 2, Collections.<Model>emptyList()), - new Model("three", 3, Collections.<Model>emptyList()) - ) - ), - new Model("entryTwo", 20, - Arrays.asList( - new Model("2one", 1, Collections.<Model>emptyList()), - new Model("2two", 2, Collections.<Model>emptyList()), - new Model("2three", 3, Collections.<Model>emptyList()) - ) - ), - new Model("entryThree", 30, - Arrays.asList( - new Model("3one", 1, Collections.<Model>emptyList()), - new Model("3two", 2, Collections.<Model>emptyList()), - new Model("3three", 3, Collections.<Model>emptyList()) - ) - ) - ); - JAXXContext context = new DefaultJAXXContext(); - context.setContextValue(list, "models"); - - Model bean; - - testBinding(model, context, "$root/models", list); - - bean = list.get(0); - testBinding(model, context, "$root/models/0", bean); - testBinding(model, context, "$root/models/0/name", bean.getName()); - testBinding(model, context, "$root/models/0/integerValue", bean.getIntegerValue()); - testBinding(model, context, "$root/models/0/sons", bean.getSons()); - testBinding(model, context, "$root/models/0/sons/0", bean.getSons().get(0)); - testBinding(model, context, "$root/models/0/sons/0/name", bean.getSons().get(0).getName()); - - bean = list.get(1); - testBinding(model, context, "$root/models/1", bean); - testBinding(model, context, "$root/models/1/name", bean.getName()); - testBinding(model, context, "$root/models/1/integerValue", bean.getIntegerValue()); - testBinding(model, context, "$root/models/1/sons", bean.getSons()); - - bean = list.get(2); - testBinding(model, context, "$root/models/2", bean); - testBinding(model, context, "$root/models/2/name", bean.getName()); - testBinding(model, context, "$root/models/2/integerValue", bean.getIntegerValue()); - testBinding(model, context, "$root/models/2/sons", bean.getSons()); - - } - - protected void testBinding(NavigationTreeModel model, JAXXContext context, String contextPath, Object expected) throws Exception { - - Object value; - value = model.getJAXXContextValue(context, contextPath); - Assert.assertNotNull(value); - Assert.assertEquals(expected, value); - } - - protected String getNodeContext(int... context) { - String result = ""; - for (int i : context) { - result += i; - } - return result; - } - - protected void assertNodeEquals(String contextPath, String nodeContext, int level, NavigationTreeNode node, boolean root) { - //System.out.println(contextPath + " : " + (node == null ? null : node.getContextPath())); - Assert.assertNotNull(node); - Assert.assertEquals(root, node.isRoot()); - Assert.assertEquals(level, node.getLevel()); - Assert.assertEquals(nodeContext, node.getNavigationPath()); - Assert.assertEquals(contextPath, node.getContextPath()); - } - - public static class Model { - - protected String name; - - protected int integerValue; - - protected List<Model> sons; - - public Model(String name, int integerValue, List<Model> sons) { - this.name = name; - this.integerValue = integerValue; - this.sons = sons; - } - - public String getName() { - return name; - } - - public int getIntegerValue() { - return integerValue; - } - - public List<Model> getSons() { - return sons; - } - - @Override - public String toString() { - return super.toString() + "<name:" + name + ",integerValue:" + integerValue + ",sons: " + sons + ">"; - } - } - -} diff --git a/jaxx-demo/pom.xml b/jaxx-demo/pom.xml index f468a2b..852b698 100644 --- a/jaxx-demo/pom.xml +++ b/jaxx-demo/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>1.7.2-SNAPSHOT</version> + <version>2.0.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> @@ -22,12 +22,12 @@ <dependency> <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-swing</artifactId> + <artifactId>jaxx-runtime</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-swing-widget</artifactId> + <artifactId>jaxx-widgets</artifactId> <version>${project.version}</version> </dependency> @@ -35,7 +35,7 @@ <dependency> <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-api</artifactId> + <artifactId>jaxx-runtime</artifactId> <version>${project.version}</version> <scope>test</scope> <classifier>tests</classifier> @@ -52,8 +52,8 @@ <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>${project.artifactId}</name> - <description>Jaxx Demo module</description> + <name>JAXX Demo</name> + <description>JAXX Demo</description> <!-- ************************************************************* --> <!-- *** Build Settings ****************************************** --> diff --git a/jaxx-demo/src/main/filters/jaxx-demo.properties b/jaxx-demo/src/main/filters/jaxx-demo.properties index e518e36..4be97da 100644 --- a/jaxx-demo/src/main/filters/jaxx-demo.properties +++ b/jaxx-demo/src/main/filters/jaxx-demo.properties @@ -1,6 +1,9 @@ application.name=${project.name} application.version=${project.version} application.site.url=http://maven-site.nuiton.org/jaxx/jaxx-example +application.icon.path=/icons/jaxx.png +application.license.path=META-INF/${project.artifactId}-LICENSE.txt +application.third-party.path=META-INF/${project.artifactId}-THIRD-PARTY.txt #licence.name=${project.licenses[0].license.name} #licence.url=${project.licenses.0.url} application.organisation.name=${project.organization.name} diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx b/jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx index 1bd60a2..73f77ce 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx @@ -1,87 +1,110 @@ - -<JTabbedPane id='top'> - - <script><![CDATA[ -import org.apache.commons.io.IOUtils; - -protected String[] getSources() { - if (getClass() == DemoPanel.class) { - return new String[0]; - } - return new String[]{ getDefaultSource() }; -} - -protected String getDefaultSource() { - return getClass().getSimpleName() + ".jaxx"; -} - -public String getLabel() { - String name = getClass().getSimpleName(); - if (name.endsWith("Demo")) { - name = name.substring(0, name.length() - "Demo".length()); - } - return name; -} - -public String getDemoTabTitle() { - return getLabel() + " Demo"; -} - -public String loadSource(String filename) { - try { - if (log.isDebugEnabled()) { - log.debug(filename + " from " + getClass()); - } - String result = IOUtils.toString(getClass().getResourceAsStream(filename)); - - return result; - } catch (Exception e) { - log.error("could not load file " + filename, e); - return "could not load file " + filename; - } -} - -private void $afterCompleteSetup() { - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - if (getSources().length == 0) { - top.remove(sourceTabs); - return; - } - for (String extra : getSources()) { - JScrollPane pane = new JScrollPane( - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, - JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - pane.setBorder(null); - // creation du contenu du fichier - JTextArea content = new JTextArea(); - content.setFont(content.getFont().deriveFont((float) 11)); - content.setMinimumSize(jaxx.runtime.SwingUtil.newMinDimension()); - content.setEditable(false); - content.setWrapStyleWord(false); - content.setText(loadSource(extra)); - content.setColumns(80); - pane.getViewport().add(content); - // ajout de l'onglet - sourceTabs.addTab(extra, pane); - int index = sourceTabs.indexOfComponent(pane); - JLabel l = new JLabel(extra); - l.setFont(l.getFont().deriveFont((float) 10)); - sourceTabs.setTabComponentAt(index,l); - } - } - }); -} - ]]> - </script> - - <tab title='{getDemoTabTitle()}'> - <JPanel id='demoPanel'/> - </tab> - - <tab title='Sources'> - <JTabbedPane id='sourceTabs' tabPlacement='{JTabbedPane.BOTTOM}'/> - </tab> +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> + +<JTabbedPane id='top'> + + <script><![CDATA[ +import org.apache.commons.io.IOUtils; + +protected String[] getSources() { + if (getClass() == DemoPanel.class) { + return new String[0]; + } + return new String[]{ getDefaultSource() }; +} + +protected String getDefaultSource() { + return getClass().getSimpleName() + ".jaxx"; +} + +public String getLabel() { + String name = getClass().getSimpleName(); + if (name.endsWith("Demo")) { + name = name.substring(0, name.length() - "Demo".length()); + } + return name; +} + +public String getDemoTabTitle() { + return getLabel() + " Demo"; +} + +public String loadSource(String filename) { + try { + if (log.isDebugEnabled()) { + log.debug(filename + " from " + getClass()); + } + String result = IOUtils.toString(getClass().getResourceAsStream(filename)); + + return result; + } catch (Exception e) { + log.error("could not load file " + filename, e); + return "could not load file " + filename; + } +} + +private void $afterCompleteSetup() { + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + if (getSources().length == 0) { + top.remove(sourceTabs); + return; + } + for (String extra : getSources()) { + JScrollPane pane = new JScrollPane( + JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + pane.setBorder(null); + //pane.setMinimumSize(jaxx.runtime.SwingUtil.newMinDimension()); + // creation du contenu du fichier + JTextArea content = new JTextArea(); + content.setFont(content.getFont().deriveFont((float) 11)); + content.setMinimumSize(jaxx.runtime.SwingUtil.newMinDimension()); + content.setEditable(false); + content.setWrapStyleWord(false); + content.setText(loadSource(extra)); + content.setColumns(80); + content.setLineWrap(true); + pane.getViewport().add(content); + content.setCaretPosition(0); + // ajout de l'onglet + sourceTabs.addTab(extra, pane); + int index = sourceTabs.indexOfComponent(pane); + JLabel l = new JLabel(extra); + l.setFont(l.getFont().deriveFont((float) 10)); + sourceTabs.setTabComponentAt(index,l); + } + } + }); +} + ]]> + </script> + + <tab title='{getDemoTabTitle()}'> + <JPanel id='demoPanel'/> + </tab> + + <tab title='Sources'> + <JTabbedPane id='sourceTabs' tabPlacement='{JTabbedPane.BOTTOM}'/> + </tab> </JTabbedPane> \ No newline at end of file diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java b/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java index 130cfee..2450bce 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java @@ -25,8 +25,8 @@ import javax.swing.JPanel; import jaxx.demo.component.swing.*; import jaxx.demo.component.jaxx.*; import jaxx.demo.component.jaxx.editor.*; -import jaxx.demo.component.jaxx.navigation.full.FullNavigationTreeDemo; import jaxx.demo.component.jaxx.navigation.item.ItemTreeNavigationDemo; +import jaxx.demo.component.jaxx.tree.FullNavigationTreeDemo; import jaxx.demo.feature.databinding.BeanDataBindingDemo; import jaxx.demo.feature.validation.*; import jaxx.demo.fun.*; @@ -38,13 +38,8 @@ import jaxx.runtime.JAXXContextEntryDef; import jaxx.runtime.JAXXObject; import jaxx.runtime.swing.CardLayout2; import jaxx.runtime.swing.ErrorDialogUI; -import jaxx.runtime.swing.navigation.NavigationTreeModel; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder; -import jaxx.runtime.swing.navigation.NavigationTreeHandler; -import jaxx.runtime.swing.navigation.NavigationTreeHandler.Strategy; -import jaxx.runtime.swing.navigation.NavigationTreeHandlerWithCardLayout; -import jaxx.runtime.swing.navigation.NavigationTreeHelper; +import jaxx.runtime.swing.tree.*; +import jaxx.runtime.swing.tree.NavigationTreeHandler.Strategy; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -67,7 +62,7 @@ public class DemoTreeHelper extends NavigationTreeHelper { log.debug("start creating demo model"); } - TreeModelBuilder builder = new TreeModelBuilder(); + TreeModelBuilder builder = new TreeModelBuilder(context); builder.addText(n_("jaxxdemo.tree.component.swing")). addText(n_("jaxxdemo.tree.component.swing.buttons")). @@ -121,6 +116,7 @@ public class DemoTreeHelper extends NavigationTreeHelper { addDemo(ValidationListDemo.class). addDemo(ValidationTableDemo.class). goUp(). + goUp(). addText(n_("jaxxdemo.tree.fun")). addDemo(LabelStyleDemo.class). addDemo(CounterDemo.class). @@ -129,7 +125,7 @@ public class DemoTreeHelper extends NavigationTreeHelper { NavigationTreeModel model = builder.getModel(); if (log.isDebugEnabled()) { - builder.printModel(context, model.getRoot()); + builder.printModel(model.getRoot()); } // save tree model in context setTreeModel(context, model); @@ -139,10 +135,10 @@ public class DemoTreeHelper extends NavigationTreeHelper { @Override public NavigationTreeHandler createTreeHandler(JAXXObject context) { - NavigationTreeHandler handler = new NavigationTreeHandlerWithCardLayout( + NavigationTreeHandler handler; + + handler = new NavigationTreeHandlerWithCardLayout( getPrefix(), - DemoPanel.class, - null, context, Strategy.PER_UI_TYPE) { @@ -168,7 +164,8 @@ public class DemoTreeHelper extends NavigationTreeHelper { ErrorDialogUI.showError(e); } - protected DemoUI getContext() { + @Override + public DemoUI getContext() { return (DemoUI) context; } }; @@ -189,34 +186,34 @@ public class DemoTreeHelper extends NavigationTreeHelper { /** * la pile des noeuds parent */ - protected Stack<NavigationTreeNode> parentNodes; + protected Stack<NavigationTreeNode> nodes; - protected TreeModelBuilder() { - super("/"); - parentNodes = new Stack<NavigationTreeNode>(); - parentNodes.add(buildEmptyRoot(def, "$root")); + protected TreeModelBuilder(JAXXContext context) { + super("/", context, DemoPanel.class, null); + nodes = new Stack<NavigationTreeNode>(); + nodes.add(buildEmptyRoot(def, "$root")); } protected TreeModelBuilder goUp() { - parentNodes.pop(); + nodes.pop(); return this; } protected TreeModelBuilder addText(String label) { - NavigationTreeNode parentNode = parentNodes.peek(); + NavigationTreeNode parentNode = nodes.peek(); parentNode = build(parentNode, label, def, label, null, null); if (log.isDebugEnabled()) { - log.debug(label + " [" + parentNode.getContextPath() + "]"); + log.debug(label + " [" + parentNode.getFullPath() + "]"); } - parentNodes.push(parentNode); + nodes.push(parentNode); return this; } protected TreeModelBuilder addDemo(Class<? extends DemoPanel> demoClass) { - NavigationTreeNode parentNode = parentNodes.peek(); + NavigationTreeNode parentNode = nodes.peek(); String label = demoClass.getSimpleName(); if (log.isDebugEnabled()) { - log.debug(label + " [" + parentNode.getContextPath() + "]"); + log.debug(label + " [" + parentNode.getFullPath() + "]"); } build(parentNode, label, def, label, demoClass, null); return this; diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoUI.css b/jaxx-demo/src/main/java/jaxx/demo/DemoUI.css index b7a11f4..b111b55 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoUI.css +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoUI.css @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. ##%* - */ +*/ JToolBar { borderPainted:false; floatable:false; @@ -28,6 +28,12 @@ JSplitPane { dividerSize:6; } +#mainFrame { + title:"JAXX Demo"; + iconImage:{jaxx.runtime.SwingUtil.createIcon(getConfig().getOption("application.icon.path")).getImage()}; + undecorated:{getConfig().isFullScreen()}; +} + #menu { _help:{"ui.main.menu"}; } @@ -61,8 +67,8 @@ JSplitPane { toolTipText:"jaxxdemo.action.locale.fr.tip"; actionIcon:"i18n-fr"; enabled:{!acceptLocale(getConfig().getLocale(), "fr_FR")}; - mnemonic:F; - _help:{"ui.main.menu.file.locale.fr"}; +mnemonic:F; +_help:{"ui.main.menu.file.locale.fr"}; } #menuFileLanguageUK { @@ -70,8 +76,8 @@ JSplitPane { toolTipText:"jaxxdemo.action.locale.uk.tip"; actionIcon:"i18n-uk"; enabled:{!acceptLocale(getConfig().getLocale(), "en_GB")}; - mnemonic:U; - _help:{"ui.main.menu.file.locale.uk"}; +mnemonic:U; +_help:{"ui.main.menu.file.locale.uk"}; } #menuFileFullscreen { @@ -80,7 +86,7 @@ JSplitPane { actionIcon:"fullscreen"; mnemonic:P; visible:{!isUndecorated()}; - _help:{"ui.main.menu.file.fullscreen"}; +_help:{"ui.main.menu.file.fullscreen"}; } #menuFileNormalscreen { @@ -89,7 +95,7 @@ JSplitPane { actionIcon:"leave-fullscreen"; mnemonic:N; visible:{isUndecorated()}; - _help:{"ui.main.menu.file.leave-fullscreen"}; +_help:{"ui.main.menu.file.leave-fullscreen"}; } #menuFileExit{ @@ -137,17 +143,24 @@ JSplitPane { visible:true; } +#navigationPane{ + border:{null}; +minimumSize:{new Dimension(230,0)}; +horizontalScrollBarPolicy:{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}; +} + #navigation{ rootVisible:false; + showsRootHandles:false; largeModel:true; font-size:11; } -/* + #splitpane{ orientation:{JSplitPane.HORIZONTAL_SPLIT}; _help:{"ui.main.body.db"}; resizeWeight:1.0; -}*/ +} #contentLayout{ useOnlyVisibleComponentDimension:true; @@ -155,7 +168,7 @@ JSplitPane { #content{ layout:{contentLayout}; - _help:{"ui.main.body.db.view.content"}; +_help:{"ui.main.body.db.view.content"}; } /* #toolbar { diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx index 09ad1e4..38ef966 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx @@ -1,81 +1,113 @@ - -<JFrame id='mainFrame' - title="JAXX Demo" - width='1024' - height='800' - decorator='help' - undecorated='{getConfig().isFullScreen()}' - onWindowClosing='getHandler().close(mainFrame)'> - - <style source='DemoUI.css'/> - - <jaxx.runtime.swing.CardLayout2 id='contentLayout'/> - - <script><![CDATA[ -import jaxx.runtime.swing.navigation.*; -import java.util.Locale; - -public DemoConfig getConfig() { - return getContextValue(DemoConfig.class); -} - -protected DemoUIHandler getHandler() { - return getContextValue(DemoUIHandler.class); -} - -protected DemoTreeHelper getTreeHelper() { - return getContextValue(DemoTreeHelper.class); -} - -public boolean acceptLocale(Locale l, String expected) { - return l !=null && l.toString().equals(expected); -} - -]]> - </script> - - <JMenuBar id='menu'> - - <JMenu id='menuFile'> - <JMenuItem id='menuFileConfiguration' - onActionPerformed="getHandler().showConfig(this)"/> - <JMenu id='menuFileLanguage'> - <JMenuItem id='menuFileLanguageFR' - onActionPerformed="getHandler().changeLanguage(this, Locale.FRANCE)"/> - <JMenuItem id='menuFileLanguageUK' - onActionPerformed="getHandler().changeLanguage(this, Locale.UK)"/> - </JMenu> - <JSeparator/> - <JMenuItem id='menuFileFullscreen' - onActionPerformed="getHandler().changeScreen(this, true)"/> - <JMenuItem id='menuFileNormalscreen' - onActionPerformed="getHandler().changeScreen(this, false)"/> - <JSeparator/> - <JMenuItem id='menuFileExit' - onActionPerformed="getHandler().close(this)"/> - </JMenu> - - <JMenu id='menuHelp'> - <JMenuItem id='menuHelpHelp' - onActionPerformed="getHandler().showHelp(this, null)"/> - <JMenuItem id='menuHelpSite' - onActionPerformed="getHandler().gotoSite(this)"/> - <JMenuItem id='menuHelpAbout' - onActionPerformed="getHandler().showAbout(this)"/> - </JMenu> - - </JMenuBar> - - <JSplitPane id='splitPane'> - <JScrollPane border='{null}'> - <JTree id='navigation' - model='{getTreeHelper().createTreeModel(this)}' - selectionModel="{getTreeHelper().createTreeHandler(this)}" - cellRenderer='{new NavigationTreeCellRenderer(this, 200)}'> - </JTree> - </JScrollPane> - - <JPanel id='content'/> - - </JSplitPane> +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> + +<JFrame id='mainFrame' width='1024' height='800' + decorator='help' + onWindowClosing='getHandler().close(mainFrame)'> + + <style source='DemoUI.css'/> + + <jaxx.runtime.swing.CardLayout2 id='contentLayout'/> + + <script><![CDATA[ +import jaxx.runtime.SwingUtil; +import jaxx.runtime.swing.tree.*; +import java.util.Locale; + +public DemoConfig getConfig() { + return getContextValue(DemoConfig.class); +} + +protected DemoUIHandler getHandler() { + return getContextValue(DemoUIHandler.class); +} + +protected DemoTreeHelper getTreeHelper() { + return getContextValue(DemoTreeHelper.class); +} + +public boolean acceptLocale(Locale l, String expected) { + return l !=null && l.toString().equals(expected); +} + +private void $afterCompleteSetup() { + // share the tree + getTreeHelper().setTree(this, navigation); + // auto-expand node when selected + SwingUtil.addExpandOnClickListener(navigation); + +} + +]]> + </script> + + <JMenuBar id='menu'> + + <JMenu id='menuFile'> + <JMenuItem id='menuFileConfiguration' + onActionPerformed="getHandler().showConfig(this)"/> + <JMenu id='menuFileLanguage'> + <JMenuItem id='menuFileLanguageFR' + onActionPerformed="getHandler().changeLanguage(this, Locale.FRANCE)"/> + <JMenuItem id='menuFileLanguageUK' + onActionPerformed="getHandler().changeLanguage(this, Locale.UK)"/> + </JMenu> + <JSeparator/> + <JMenuItem id='menuFileFullscreen' + onActionPerformed="getHandler().changeScreen(this, true)"/> + <JMenuItem id='menuFileNormalscreen' + onActionPerformed="getHandler().changeScreen(this, false)"/> + <JSeparator/> + <JMenuItem id='menuFileExit' + onActionPerformed="getHandler().close(this)"/> + </JMenu> + + <JMenu id='menuHelp'> + <JMenuItem id='menuHelpHelp' + onActionPerformed="getHandler().showHelp(this, null)"/> + <JMenuItem id='menuHelpSite' + onActionPerformed="getHandler().gotoSite(this)"/> + <JMenuItem id='menuHelpAbout' + onActionPerformed="getHandler().showAbout(this)"/> + </JMenu> + + </JMenuBar> + + <JPanel id='mainPane' layout='{new BorderLayout()}'> + + <JSplitPane id='splitPane' constraints='BorderLayout.CENTER'> + <JScrollPane id='navigationPane'> + <JTree id='navigation' + model='{getTreeHelper().createTreeModel(this)}' + selectionModel="{getTreeHelper().createTreeHandler(this)}"> + <!--cellRenderer='{new NavigationTreeCellRenderer(this)}'>--> + <!--cellRenderer='{new NavigationTreeCellRenderer(this,185)}'>--> + </JTree> + </JScrollPane> + + <JPanel id='content'/> + + </JSplitPane> + + <jaxx.runtime.swing.StatusMessagePanel id='p' constraints='BorderLayout.SOUTH'/> + + </JPanel> </JFrame> \ No newline at end of file diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java b/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java index 8a66d58..d57e290 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java @@ -23,7 +23,7 @@ package jaxx.demo; import jaxx.runtime.swing.ErrorDialogUI; import jaxx.runtime.JAXXContext; import jaxx.runtime.JAXXInitialContext; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; +import jaxx.runtime.swing.tree.NavigationTreeNode; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import static org.nuiton.i18n.I18n._; @@ -102,8 +102,6 @@ public class DemoUIHandler { //implements JAXXHelp { @Override public void run() { -// // use best dimensions -// ui.getSplitPane().resetToPreferredSizes(); String path; if (node == null) { @@ -111,23 +109,25 @@ public class DemoUIHandler { //implements JAXXHelp { path = "$root/jaxxdemo.tree.component.swing"; } else { // take selected node - path = node.getContextPath(); + path = node.getFullPath(); } + log.info("node to re select " + path); // select node - ui.getTreeHelper().selectNode(ui, ui.getNavigation(), path); -// -// // show ui -// ui.setVisible(true); + ui.getTreeHelper().selectNode(ui, path); + + // use best dimensions + ui.getSplitPane().resetToPreferredSizes(); } }); + + // show ui after all (in another invocation, tu avoid layout adjustement + // to be seen). + SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - // use best dimensions - ui.getSplitPane().resetToPreferredSizes(); - // show ui ui.setVisible(true); } @@ -154,7 +154,7 @@ public class DemoUIHandler { //implements JAXXHelp { node = ui.getTreeHelper().getSelectedNode(ui); if (node != null) { - log.info("selected node " + node.getContextPath()); + log.info("selected node " + node.getFullPath()); } ErrorDialogUI.init(null); @@ -284,14 +284,20 @@ public class DemoUIHandler { //implements JAXXHelp { public void showAbout(DemoUI ui) { - AboutPanel about = new AboutPanel(); + DemoConfig config = ui.getConfig(); + + String iconPath = config.getOption("application.icon.path"); + String licensePath = config.getOption("application.license.path"); + String thirdPartyPath = config.getOption("application.third-party.path"); + AboutPanel about = new AboutPanel(); about.setTitle(_("jaxxdemo.title.about")); - about.setIconPath("/icons/jaxx.png"); about.setAboutText(_("jaxxdemo.about.message")); about.setBottomText(ui.getConfig().getCopyrightText()); - about.setLicenseFile("META-INF/jaxx-example-LICENSE.txt"); - about.setThirdpartyFile("META-INF/jaxx-example-THIRD-PARTY.txt"); + about.setIconPath(iconPath); + about.setLicenseFile(licensePath); + about.setThirdpartyFile(thirdPartyPath); + about.buildTopPanel(); about.init(); about.showInDialog(ui, true); } diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.jaxx index 157068c..1343bd6 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <jaxx.runtime.swing.BlockingLayerUI id='layerUI' diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/StatusMessagePanelDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/StatusMessagePanelDemo.jaxx index f6f4c61..89c2879 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/StatusMessagePanelDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/StatusMessagePanelDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <JPanel id='demoPanel' layout='{new BorderLayout()}'> <JPanel layout='{new GridLayout(0,1)}' constraints='BorderLayout.CENTER'> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/ComboEditorDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/ComboEditorDemo.jaxx index d72b548..7942049 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/ComboEditorDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/ComboEditorDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <Table id='demoPanel' fill='both'> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx index 8833eda..a3b706e 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <script><![CDATA[ diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemo.jaxx index ce336ce..3357a6c 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <script><![CDATA[ diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/BaseContent.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/BaseContent.jaxx deleted file mode 100644 index 7160eda..0000000 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/BaseContent.jaxx +++ /dev/null @@ -1,79 +0,0 @@ -<JPanel layout='{new BorderLayout()}'> - - <Object id='data' javaBean='helper.getSelectedBean(this)'/> - - <script><![CDATA[ -import jaxx.runtime.SwingUtil; - -private final FullNavigationTreeHelper helper = new FullNavigationTreeHelper(); - -String getType(Object data) { - if (data == null) { - return "no type"; - } - if (data instanceof java.util.List<?>) { - java.util.List<?> l = (java.util.List<?>) data; - if (l.isEmpty()) { - return "Empty collection"; - } - return "Collection of " + l.size() + " " + l.get(0).getClass().getSimpleName() + "(s)"; - } - return data.getClass().getSimpleName(); -} - -String getContent(Object data) { - if (data == null) { - return "no content"; - } - StringBuilder buffer = new StringBuilder(); - if (data instanceof java.util.List) { - for (Object o : ((java.util.List)data)) { - buffer.append(o).append("\n"); - } - } else { - buffer.append(data); - } - return buffer.toString(); -} - -ImageIcon getImage(Object data) { - if (data == null) { - return null; - } - if (data instanceof Movie) { - return SwingUtil.createIcon(((Movie)data).getImage()); - } - if (data instanceof People) { - return SwingUtil.createIcon(((People)data).getImage()); - } - return null; -} - ]]> - </script> - - <JSplitPane id='splitPane' - orientation='{JSplitPane.VERTICAL_SPLIT}' - resizeWeight='0.5' - constraints='BorderLayout.CENTER' - oneTouchExpandable='true'> - - <JScrollPane border='{null}' - horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' - verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> - <JTextPane border='{new TitledBorder("Content Type : " + getType(getData()))}' - editable='false' - font-size='11' - text='{getContent(getData())}'/> - </JScrollPane> - - <JScrollPane border='{new TitledBorder("Picture")}' - horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED}' - verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}' - minimumSize='{SwingUtil.newMinDimension()}'> - - <JLabel horizontalAlignment='center' icon='{getImage(getData())}'/> - - </JScrollPane> - - </JSplitPane> -</JPanel> \ No newline at end of file diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/FullNavigationTreeDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/FullNavigationTreeDemo.jaxx deleted file mode 100644 index 60479ff..0000000 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/FullNavigationTreeDemo.jaxx +++ /dev/null @@ -1,58 +0,0 @@ - -<jaxx.demo.DemoPanel> - - <jaxx.runtime.swing.CardLayout2 id='contentLayout' - useOnlyVisibleComponentDimension='true'/> - - <script><![CDATA[ -import jaxx.runtime.swing.navigation.NavigationTreeCellRenderer; - -private final FullNavigationTreeHelper helper = new FullNavigationTreeHelper(); - -helper.createModel(this); - -@Override -protected String[] getSources() { - return new String[]{ getDefaultSource(), "BaseContent.jaxx", "FullNavigationTreeHelper.java", "Movie.java", "People.java" }; -} - -private void $afterCompleteSetup() { - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - navigation.setSelectionInterval(0, 0); - splitPane.resetToPreferredSizes(); - } - }); - jaxx.runtime.SwingUtil.expandTree(navigation); -} - ]]> - </script> - - <JPanel id='demoPanel' layout='{new BorderLayout()}'> - - <JSplitPane id='splitPane' - constraints='BorderLayout.CENTER' - oneTouchExpandable='true'> - - <JScrollPane border='{null}' - horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' - verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_NEVER}'> - - <JTree id="navigation" - font-size='11' - rootVisible='false' - model='{helper.createTreeModel(this)}' - selectionModel="{helper.createTreeHandler(this)}" - cellRenderer='{new NavigationTreeCellRenderer(this, 150)}' /> - - </JScrollPane> - - <JPanel id="content" layout="{contentLayout}" /> - - </JSplitPane> - - </JPanel> - -</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/FullNavigationTreeHelper.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/FullNavigationTreeHelper.java deleted file mode 100644 index 862af11..0000000 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/FullNavigationTreeHelper.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * *##% - * jaxx-demo - * Copyright (C) 2008 - 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * ##%* - */ -package jaxx.demo.component.jaxx.navigation.full; - -import java.util.Arrays; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder; - -import static jaxx.runtime.JAXXContextEntryDef.newListDef; -import static org.nuiton.i18n.I18n._; - -import java.util.List; -import jaxx.runtime.Decorator; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.MultiJXPathDecorator; - - -import javax.swing.JPanel; -import jaxx.runtime.JAXXContextEntryDef; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.swing.CardLayout2; -import jaxx.runtime.swing.ErrorDialogUI; -import jaxx.runtime.swing.navigation.NavigationTreeHandler; -import jaxx.runtime.swing.navigation.NavigationTreeHandler.Strategy; -import jaxx.runtime.swing.navigation.NavigationTreeHandlerWithCardLayout; -import jaxx.runtime.swing.navigation.NavigationTreeHelper; -import jaxx.runtime.swing.navigation.NavigationTreeModel; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * - * @author chemit - */ -public class FullNavigationTreeHelper extends NavigationTreeHelper { - - /** - * Logger - */ - static private final Log log = LogFactory.getLog(FullNavigationTreeHelper.class); - /** - * where the movies are hold in context - */ - static public final JAXXContextEntryDef<List<Movie>> MOVIES = JAXXContextEntryDef.newListDef("movies"); - /** - * where the actors are hold in context - */ - static public final JAXXContextEntryDef<List<People>> ACTORS = JAXXContextEntryDef.newListDef("actors"); - - public FullNavigationTreeHelper() { - super("full"); - } - - /** - * Create the model and store it in the given context. - * - * @param context the context where to hold the model - */ - public void createModel(JAXXContext context) { - People a = new People("0", "Jack", "Black", 0, "/jaxx/demo/images/jack.jpg"); - People a2 = new People("1", "Héctor", "Jiménez", 0, "/jaxx/demo/images/hector.jpg"); - People a3 = new People("2", "Ana", "de la Reguera", 0, "/jaxx/demo/images/ana.jpg"); - - Movie m = new Movie("0", "Nacho libre", 1996, "/jaxx/demo/images/nacho.jpg"); - m.addActor(a); - m.addActor(a2); - m.addActor(a3); - - Movie m2 = new Movie("1", "Nacho 2", 2009, "/jaxx/demo/images/nacho2.png"); - m2.addActor(a); - m2.addActor(a2); - - MOVIES.setContextValue(context, Arrays.asList(m, m2)); - ACTORS.setContextValue(context, Arrays.asList(a, a2, a3)); - } - - @Override - public NavigationTreeModel createTreeModel(JAXXContext context) { - - List<Movie> movies = MOVIES.getContextValue(context); - List<People> actors = ACTORS.getContextValue(context); - - if (log.isDebugEnabled()) { - log.debug("for " + movies.size() + " movie(s)"); - } - - NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder("/"); - - Decorator<Movie> mDecorator = MultiJXPathDecorator.newDecorator(Movie.class, "${title}$s##${year}$s", "##", " - "); - Decorator<People> pDecorator = MultiJXPathDecorator.newDecorator(People.class, "${firstName}$s##${lastName}$s", "##", " "); - - // construction du noeud root - // il ne contient pas de context et ne sera pas visible - NavigationTreeNode rootNode = builder.buildEmptyRoot(null, "$root"); - - // construction du noeud avec les films recupere la liste des films - // dans le context avec la clef movies - // navigation path = $root/movies - NavigationTreeNode moviesNode = builder.build( - rootNode, - _("movies"), - newListDef("movies"), - "movies", - null, - null); - - for (Movie m : movies) { - - // navigation path = $root/movies/m.id - NavigationTreeNode movieNode = builder.build( - moviesNode, - mDecorator, - "..[@id=\"" + m.getId() + "\"]", - m.getId(), - null, - null); - - // navigation path = $root/movies/m.id/actors - NavigationTreeNode actorsNode = builder.build( - movieNode, - _("actors"), - "../actors", - "actors", - null, - null); - - for (People p : m.getActors()) { - // navigation path = $root/movies/m.id/actors/p.id - builder.build( - actorsNode, - pDecorator, - "..[@id=\"" + p.getId() + "\"]", - p.getId(), - null, - null); - } - } - - // construction du noeud avec les acteurs - NavigationTreeNode actorsNode = builder.build(rootNode, _("actors"), - newListDef("actors"), - "actors", null, null); - - for (People p : actors) { - // navigation path = $root/actors/p.id - builder.build( - actorsNode, - pDecorator, - "..[@id=\"" + p.getId() + "\"]", - p.getId(), - null, - null); - } - NavigationTreeModel model = builder.getModel(); - - if (log.isDebugEnabled()) { - builder.printModel(context, model.getRoot()); - } - - // save tree model in context - setTreeModel(context, model); - return model; - } - - @Override - public NavigationTreeHandler createTreeHandler(JAXXObject context) { - - if (log.isDebugEnabled()) { - log.debug("create handler"); - } - - NavigationTreeHandler handler = new NavigationTreeHandlerWithCardLayout( - getPrefix(), - BaseContent.class, - null, - context, - Strategy.PER_NODE) { - - private static final long serialVersionUID = 1L; - - @Override - protected NavigationTreeModel getNavigationTreeModel() { - return getSafeTreeModel(getContext()); - } - - @Override - protected JPanel getContentContainer() { - return getContext().getContent(); - } - - @Override - protected CardLayout2 getContentLayout() { - return getContext().getContentLayout(); - } - - @Override - protected void treateError(Exception e) { - ErrorDialogUI.showError(e); - } - - FullNavigationTreeDemo getContext() { - return (FullNavigationTreeDemo) this.context; - } - }; - // on ne peut selectionner qu'un seul noeud a la fois - handler.setSelectionMode(NavigationTreeHandler.SINGLE_TREE_SELECTION); - - // save handler in ui context - setTreeHandler(context, handler); - return handler; - } -} diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/Movie.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/Movie.java deleted file mode 100644 index ec18350..0000000 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/Movie.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * *##% - * jaxx-demo - * Copyright (C) 2008 - 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * ##%* - */ -package jaxx.demo.component.jaxx.navigation.full; - -import java.util.ArrayList; -import java.util.List; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; - -/** - * - * @author chemit - */ -public class Movie { - - protected String id; - protected String title; - protected String image; - protected int year; - protected List<People> actors; - - public Movie(String id, String title, int year,String image) { - this(); - this.id = id; - this.title = title; - this.year = year; - this.image=image; - } - - public Movie() { - actors = new ArrayList<People>(); - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public List<People> getActors() { - return actors; - } - - public void setActors(List<People> actors) { - this.actors = actors; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public int getYear() { - return year; - } - - public void setYear(int year) { - this.year = year; - } - - public String getImage() { - return image; - } - - public void setImage(String image) { - this.image = image; - } - - public void addActor(People actor) { - actors.add(actor); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final Movie other = (Movie) obj; - if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) { - return false; - } - return true; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 41 * hash + (this.id != null ? this.id.hashCode() : 0); - return hash; - } - - @Override - public String toString() { - ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE); - b.append("id", id); - b.append("title", title); - b.append("year", year); - b.append("actors", actors); - return b.toString(); - } -} diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/People.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/People.java deleted file mode 100644 index 0a9ac0b..0000000 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/full/People.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * *##% - * jaxx-demo - * Copyright (C) 2008 - 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * ##%* - */ -package jaxx.demo.component.jaxx.navigation.full; - -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; - -/** - * - * @author chemit - */ -public class People { - - protected String id; - protected String image; - protected String firstName; - protected String lastName; - protected int age; - - public People(String id, String firstName, String lastName, int age, String image) { - this.id = id; - this.firstName = firstName; - this.lastName = lastName; - this.age = age; - this.image = image; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getImage() { - return image; - } - - public void setImage(String image) { - this.image = image; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final People other = (People) obj; - if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) { - return false; - } - return true; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 97 * hash + (this.id != null ? this.id.hashCode() : 0); - return hash; - } - - @Override - public String toString() { - ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE); - b.append("id", id); - b.append("firstName", firstName); - b.append("lastName", lastName); - b.append("age", age); - return b.toString(); - } -} diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ItemTreeNavigationDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ItemTreeNavigationDemo.jaxx index 4970c4f..de0ac8b 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ItemTreeNavigationDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ItemTreeNavigationDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <String id='string' javaBean='null'/> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JButtonDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JButtonDemo.jaxx index a13b810..a1e8d16 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JButtonDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JButtonDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <style> JButton.fancy { diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxDemo.jaxx index 3058d26..9ab5279 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <script><![CDATA[ public String getText(boolean bold, boolean italic, boolean underline) { diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxMenuItemDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxMenuItemDemo.jaxx index 8769306..d63be41 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxMenuItemDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxMenuItemDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <JMenuItemDemo> <style> .form { diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JComboBoxDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JComboBoxDemo.jaxx index c551abc..f2d5141 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JComboBoxDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JComboBoxDemo.jaxx @@ -1,22 +1,65 @@ - -<jaxx.demo.DemoPanel> - <Table id='demoPanel'> - <row> - <cell> - <JLabel text='Button label:'/> - </cell> - - <cell> - <JComboBox id='comboBox' editable='true'> - <item value='OK' selected='true'/> - <item value='Cancel'/> - <item value='Help'/> - </JComboBox> - </cell> - - <cell> - <JButton text='{comboBox.getSelectedItem()}'/> - </cell> - </row> - </Table> +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> + +<jaxx.demo.DemoPanel> + <script><![CDATA[ +import static org.nuiton.i18n.I18n.n_; + +private void $afterCompleteSetup() { + jaxxComboBox.setSelectedIndex(0); +} +]]> + </script> + <Table id='demoPanel'> + <row> + <cell> + <JLabel text='Button label:'/> + </cell> + + <cell> + <JAXXComboBox id='jaxxComboBox' editable='true'> + <item value='{_("OK")}' selected='true'/> + <item value='{_("Cancel")}'/> + <item value='{_("Help")}'/> + </JAXXComboBox> + </cell> + + <cell> + <JButton text='{jaxxComboBox.getSelectedItem()}'/> + </cell> + </row> + <row> + <cell> + <JLabel text='Button label:'/> + </cell> + + <cell> + <JComboBox id='comboBox' + editable='true' + model='{new DefaultComboBoxModel(new Object[]{n_("OK"),n_("Cancel"),n_("Help")})}'/> + </cell> + + <cell> + <JButton text='{comboBox.getSelectedItem()}'/> + </cell> + </row> + </Table> </jaxx.demo.DemoPanel> \ No newline at end of file diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JDialogDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JDialogDemo.jaxx index 6add75a..c6a870c 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JDialogDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JDialogDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <script> String username; diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JListDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JListDemo.jaxx index 8f77798..093f15d 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JListDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JListDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <Table id='demoPanel'> <row> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JMenuItemDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JMenuItemDemo.jaxx index e81da1b..7849888 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JMenuItemDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JMenuItemDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <script> void $afterCompleteSetup(){} diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JPasswordFieldDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JPasswordFieldDemo.jaxx index 0a7bd43..f824ede 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JPasswordFieldDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JPasswordFieldDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> <HBox> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JProgressBarDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JProgressBarDemo.jaxx index df432e0..ac8f81e 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JProgressBarDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JProgressBarDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <script><![CDATA[ import javax.swing.Timer; diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonDemo.jaxx index 388bd77..caf6633 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> <VBox> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonMenuItemDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonMenuItemDemo.jaxx index 62a3996..71f0b0e 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonMenuItemDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonMenuItemDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <JMenuItemDemo> <JMenuBar id='menuBar'> <JMenu text='Font size'> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSliderDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSliderDemo.jaxx index dead1e8..200f208 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSliderDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSliderDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> <VBox> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSpinnerDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSpinnerDemo.jaxx index 9de8059..82e00d3 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSpinnerDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSpinnerDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> <JLabel text='Spacing:' displayedMnemonic='S' labelFor='{spinner}'/> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSplitPaneDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSplitPaneDemo.jaxx index b2efd26..a14dd2a 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSplitPaneDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSplitPaneDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <JPanel id='demoPanel' layout='{new BorderLayout()}'> <JSplitPane> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextAreaDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextAreaDemo.jaxx index 8184c53..b24accf 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextAreaDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextAreaDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <Table id='demoPanel' anchor='northwest'> <row> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextFieldDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextFieldDemo.jaxx index f6f78fb..20a4eec 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextFieldDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextFieldDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <JPanel id='demoPanel'> <Table> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JToggleButtonDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JToggleButtonDemo.jaxx index dbce7e0..8a32208 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JToggleButtonDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JToggleButtonDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> <JToggleButton text='1' id='one'/> diff --git a/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BaseBeanDataBinding.jaxx b/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BaseBeanDataBinding.jaxx index 978930a..12f1096 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BaseBeanDataBinding.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BaseBeanDataBinding.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <!-- a full java bean property of the class --> diff --git a/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BeanDataBindingDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BeanDataBindingDemo.jaxx index 6e79259..fc16673 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BeanDataBindingDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BeanDataBindingDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <BaseBeanDataBinding> <Boolean id='editing3' javaBean='true'/> diff --git a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx index ed7a992..fcfcb1d 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx @@ -1,8 +1,30 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <style source="Validation.css"/> <script><![CDATA[ import static org.nuiton.i18n.I18n.n_; +import jaxx.runtime.validator.swing.SwingValidatorMessageListRenderer; + void $afterCompleteSetup() { } @Override @@ -310,7 +332,7 @@ protected String[] getSources() { width='500'> <JScrollPane> <JList id='errorList' model='{errors}' - cellRenderer='{new jaxx.runtime.validator.swing.SwingValidatorMessageListRenderer()}'/> + cellRenderer='{new SwingValidatorMessageListRenderer()}'/> </JScrollPane> </JPanel> </cell> diff --git a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx index 3bb0d23..a68c9c8 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <style source="Validation.css"/> @@ -31,9 +51,11 @@ <script><![CDATA[ import static org.nuiton.i18n.I18n.n_; import jaxx.runtime.SwingUtil; +import jaxx.runtime.validator.swing.SwingValidatorUtil; +import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer; void $afterCompleteSetup() { - jaxx.runtime.SwingValidatorUtil.installUI(errorTable, new jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer()); + SwingValidatorUtil.installUI(errorTable, new SwingValidatorMessageTableRenderer()); } @Override diff --git a/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorDemo.jaxx index fe6c850..d1d73b5 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <style source='Calculator.css'/> <script><![CDATA[ diff --git a/jaxx-demo/src/main/java/jaxx/demo/fun/CounterDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/fun/CounterDemo.jaxx index f4a954c..eeaa1f3 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/fun/CounterDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/fun/CounterDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <script>int count;</script> <JPanel id='demoPanel'> diff --git a/jaxx-demo/src/main/java/jaxx/demo/fun/LabelStyleDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/fun/LabelStyleDemo.jaxx index c6e28be..88078b2 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/fun/LabelStyleDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/fun/LabelStyleDemo.jaxx @@ -1,3 +1,23 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> <jaxx.demo.DemoPanel> <style source="LabelStyle.css"/> <script><![CDATA[ diff --git a/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties b/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties index 7876d4b..8d66355 100644 --- a/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties +++ b/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties @@ -47,6 +47,7 @@ Fool\ me\ twice= Green= Green\:= Greet= +Help= I18n\ editor\ with\ no\ icon\ \:= I18n\ editor\ with\ no\ text\ \:= I18n\ editor\:= @@ -111,7 +112,7 @@ form.text2=Text 2 form2.ratio=Form 2 Ratio form2.text=Form 2 Text form2.text2=Form 2 Text 2 -jaxxdemo.about.message=<h3>JAXX Demo</h3>Demo du framework JAXX <hr/><p>Ce projet a \u00E9t\u00E9 r\u00E9alis\u00E9 par la soci\u00E9t\u00E9 <a href\="http\://codelutin.com">Codelutin</a> en 2009.</p><br/><hr/>Pour plus d'informations, vous pouvez visiter le <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-example">site du projet</a>. +jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>For more informations, viste the <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-demo">website of the project</a>. jaxxdemo.action.about=About... jaxxdemo.action.about.tip=About JAXXDemo... jaxxdemo.action.configuration=Preferences @@ -120,7 +121,7 @@ jaxxdemo.action.exit=Quit jaxxdemo.action.exit.tip=Quit JAXXDemo jaxxdemo.action.fullscreen=Full screen jaxxdemo.action.fullscreen.tip=Change to full screen mode -jaxxdemo.action.help=Help +jaxxdemo.action.help= jaxxdemo.action.help.tip=Display help jaxxdemo.action.locale.fr=French jaxxdemo.action.locale.fr.tip=Change to french language @@ -142,7 +143,7 @@ jaxxdemo.init.context.done=Context initialized in %1$s jaxxdemo.init.ui.done=UI initialized. jaxxdemo.menu.file=File jaxxdemo.menu.file.locale=Languages -jaxxdemo.menu.help=Help +jaxxdemo.menu.help= jaxxdemo.message.config.loaded=Configuration of JAXXDemo v. %1$s loaded. jaxxdemo.message.goto.site=Go to JAXXDemo Web site jaxxdemo.title.about=About JAXXDemo... diff --git a/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties b/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties index b4f3013..033f0fe 100644 --- a/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties +++ b/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties @@ -20,7 +20,7 @@ Animal=Animal Blue=Bleu Blue\:=bleu \: Bold=En gras -Button\ label\:=Libell\u00E9 du label +Button\ label\:=Libell\u00E9 de l'action C=C CE=CE Cancel=Annuler @@ -47,6 +47,7 @@ Fool\ me\ twice= Green=Vert Green\:=Vert \: Greet= +Help= I18n\ editor\ with\ no\ icon\ \:=Editeur I18n sans icone \: I18n\ editor\ with\ no\ text\ \:=Editeur I18n sans texte \: I18n\ editor\:=Editeur I18n @@ -111,7 +112,7 @@ form.text2=Form \: text2 form2.ratio=Form2 \: ratio form2.text=Form2 \: text form2.text2=Form2 \: text2 -jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>Pour plus d'informations, vous pouvez visiter le <a href\="http\://maven-site.nuiton.org/kaxx/jaxx-demo">site du projet</a>. +jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>Pour plus d'informations, vous pouvez visiter le <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-demo">site du projet</a>. jaxxdemo.action.about=A propos jaxxdemo.action.about.tip=A propos de JAXX Demo... jaxxdemo.action.configuration=Configuration @@ -159,7 +160,7 @@ jaxxdemo.tree.component.swing.window=Fen\u00EAtres jaxxdemo.tree.feature=Fonctionnalit\u00E9s jaxxdemo.tree.features.databinding=Data binding jaxxdemo.tree.features.validation=Validation -jaxxdemo.tree.fun=Contestes +jaxxdemo.tree.fun=Fun jaxxdemo.warning.nimbus.landf=Le look and Feel Nimbus n'a pas \u00E9t\u00E9 trouv\u00E9, il faut au moins la version 1.6u10 de java. jaxxdemo.warning.no.ui=Aucun environnement graphique d\u00E9tect\u00E9 movies=Films diff --git a/jaxx-demo/src/main/resources/log4j.properties b/jaxx-demo/src/main/resources/log4j.properties index 30a3c28..d0a87ec 100644 --- a/jaxx-demo/src/main/resources/log4j.properties +++ b/jaxx-demo/src/main/resources/log4j.properties @@ -6,5 +6,7 @@ log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n log4j.logger.jaxx.demo=INFO -#log4j.logger.jaxx.runtime.swing.navigation.NavigationTreeHandler=DEBUG +#log4j.logger.jaxx.runtime.swing.tree.NavigationTreeCellRenderer=DEBUG +#log4j.logger.jaxx.runtime.swing.tree.NavigationTreeNodeRenderer=DEBUG +#log4j.logger.jaxx.runtime.swing.tree.NavigationTreeModel=DEBUG log4j.logger.org.nuiton=WARN diff --git a/jaxx-example/changelog.txt b/jaxx-example/changelog.txt deleted file mode 100644 index bd48171..0000000 --- a/jaxx-example/changelog.txt +++ /dev/null @@ -1,18 +0,0 @@ -1.5 - * 20090404 [chemit] - use module jaxx-runtime-swing-widget - -1.3 chemit 20090409 - * 20090319 [chemit] - refactor Validator : now can deal with scopes, improve design - * 20090313 [chemit] - improve demo - -1.1 chemit 20090220 - * 20090202 [chemit] - no more scope attribute on validator - - fix I18NTableCellRenderer (must have tip inside) - * 20090122 [chemit] - refactor poms (sibling dependencies, pluginsManagment,...) - - rename i18n bundles according artifactId - -1.0 chemit 20090111 - * 20090111 [chemit] - use lutinproject 3.3 - - refactor examples : now onyl one module, with one webstart demo (cost very less time to release) -0.7 chemit 200812?? - * 20081207 [chemit] use lutinproject 3.1 \ No newline at end of file diff --git a/jaxx-example/pom.xml b/jaxx-example/pom.xml deleted file mode 100644 index 45d2135..0000000 --- a/jaxx-example/pom.xml +++ /dev/null @@ -1,256 +0,0 @@ - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <!-- ************************************************************* --> - <!-- *** POM Relationships *************************************** --> - <!-- ************************************************************* --> - - <parent> - <groupId>org.nuiton</groupId> - <artifactId>jaxx</artifactId> - <version>1.7.2-SNAPSHOT</version> - </parent> - - <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-example</artifactId> - - <dependencies> - - <!-- sibiling dependencies --> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-swing</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-swing-widget</artifactId> - <version>${project.version}</version> - </dependency> - - <!-- test dependencies --> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-api</artifactId> - <version>${project.version}</version> - <scope>test</scope> - <classifier>tests</classifier> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </dependency> - - </dependencies> - - <!-- ************************************************************* --> - <!-- *** Project Information ************************************* --> - <!-- ************************************************************* --> - - <name>${project.artifactId}</name> - <description>Jaxx Examples</description> - - <!-- ************************************************************* --> - <!-- *** Build Settings ****************************************** --> - <!-- ************************************************************* --> - - <packaging>jar</packaging> - - <properties> - - <maven.jar.main.class>jaxx.demo.JAXXDemo</maven.jar.main.class> - - <jaxx.addProjectClassPath>true</jaxx.addProjectClassPath> - <jaxx.addSourcesToClassPath>true</jaxx.addSourcesToClassPath> - </properties> - - <build> - - <resources> - <resource> - <directory>src/main/java</directory> - <includes> - <include>**/*.jaxx</include> - </includes> - </resource> - <resource> - <directory>src/main/resources</directory> - <includes> - <include>**/*</include> - </includes> - </resource> - </resources> - - <pluginManagement> - <plugins> - - <plugin> - <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <manifest> - <addClasspath>true</addClasspath> - <classpathPrefix>./lib/</classpathPrefix> - </manifest> - </archive> - </configuration> - </plugin> - - <plugin> - <groupId>org.nuiton.thirdparty</groupId> - <artifactId>webstart-maven-plugin</artifactId> - <configuration> - <jnlpExtensions> - <jnlpExtension> - <name>sun</name> - <title>Sun MicroSystems</title> - <vendor>Sun MicroSystems, Inc.</vendor> - <includes> - <include>javax.help:javahelp</include> - </includes> - </jnlpExtension> - <jnlpExtension> - <name>jxlayer</name> - <title>Swing labs JXLayer </title> - <vendor>Swing Labs</vendor> - <includes> - <include>org.swinglabs:jxlayer</include> - </includes> - </jnlpExtension> - </jnlpExtensions> - <!--<sign> - <verify>false</verify> - </sign>--> - </configuration> - </plugin> - - </plugins> - - </pluginManagement> - - <plugins> - - <plugin> - <groupId>org.nuiton.jaxx</groupId> - <artifactId>maven-jaxx-plugin</artifactId> - <version>${project.version}</version> - <executions> - <execution> - <goals> - <goal>generate</goal> - </goals> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.nuiton.i18n</groupId> - <artifactId>maven-i18n-plugin</artifactId> - <configuration> - <entries> - <entry> - <basedir>${maven.gen.dir}/java/</basedir> - <includes> - <param>**\/**.java</param> - </includes> - </entry> - </entries> - </configuration> - <executions> - <execution> - <goals> - <goal>parserJava</goal> - <goal>gen</goal> - </goals> - </execution> - </executions> - </plugin> - - </plugins> - </build> - - <reporting> - <plugins> - <plugin> - <groupId>org.nuiton.thirdparty</groupId> - <artifactId>webstart-maven-plugin</artifactId> - <version>1.0-alpha-2-cl_20091001</version> - </plugin> - </plugins> - </reporting> - - <!-- ************************************************************* --> - <!-- *** Build Environment ************************************** --> - <!-- ************************************************************* --> - - <profiles> - <!-- by default jnlp is only perform on a release stage when using the maven-release-plugin --> - <profile> - <id>release-profile</id> - <activation> - <property> - <name>performRelease</name> - <value>true</value> - </property> - </activation> - <build> - <plugins> - <!-- key store secrets availables --> - <plugin> - <groupId>org.nuiton</groupId> - <artifactId>maven-helper-plugin</artifactId> - <version>${helper.version}</version> - <executions> - <execution> - <id>get-jnlp-keystore</id> - <goals> - <goal>share-server-secret</goal> - </goals> - <phase>package</phase> - <configuration> - <serverId>codelutin-keystore</serverId> - <usernameOut>keystorepath</usernameOut> - <passwordOut>keystorepass</passwordOut> - </configuration> - </execution> - <execution> - <id>get-jnlp-key</id> - <goals> - <goal>share-server-secret</goal> - </goals> - <phase>package</phase> - <configuration> - <serverId>codelutin-keystore-nuiton-key</serverId> - <usernameOut>keyalias</usernameOut> - <passwordOut>keypass</passwordOut> - </configuration> - </execution> - </executions> - </plugin> - - <!-- make webstart --> - <plugin> - <groupId>org.nuiton.thirdparty</groupId> - <artifactId>webstart-maven-plugin</artifactId> - <executions> - <execution> - <id>generate-jnlp</id> - <phase>package</phase> - <goals> - <goal>jnlp-inline</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - - </profiles> - -</project> diff --git a/jaxx-example/src/main/java/jaxx/demo/BaseBeanDataBinding.jaxx b/jaxx-example/src/main/java/jaxx/demo/BaseBeanDataBinding.jaxx deleted file mode 100644 index 9ff1ab9..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/BaseBeanDataBinding.jaxx +++ /dev/null @@ -1,21 +0,0 @@ -<DemoPanel> - - <!-- a full java bean property of the class --> - <Boolean id='editing' javaBean='false'/> - - <!-- not full java bean property (must add script...) --> - <Boolean id='editing2' constructorParams='false'/> - - <String id='contentMessage' javaBean='"message..."'/> - - <script> - public Boolean isEditing2() { return editing2; } - - public void setEditing2(Boolean newValue) { - Boolean oldValue = this.editing2; - this.editing2 = newValue; - firePropertyChange("editing2", oldValue, newValue) ; - } - </script> - -</DemoPanel> diff --git a/jaxx-example/src/main/java/jaxx/demo/BeanDataBindingDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/BeanDataBindingDemo.jaxx deleted file mode 100644 index 031d308..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/BeanDataBindingDemo.jaxx +++ /dev/null @@ -1,47 +0,0 @@ -<BaseBeanDataBinding> - - <Boolean id='editing3' javaBean='true'/> - - <Table id='demoPanel'> - <row> - <cell columns='2'> - <JLabel text='{getContentMessage()}'/> - </cell> - </row> - <row> - <cell> - <JPanel> - <JButton visible='{!isEditing()}' text='edit' onActionPerformed='setEditing(true);'/> - <JButton visible='{isEditing()}' text='close' onActionPerformed='setEditing(false);'/> - </JPanel> - </cell> - <cell weightx='1' fill='both'> - <JTextField enabled='{isEditing()}' text='to edit'/> - </cell> - </row> - <row> - <cell> - <JPanel> - <JButton visible='{!isEditing2()}' text='edit2' onActionPerformed='setEditing2(true);'/> - <JButton visible='{isEditing2()}' text='close2' onActionPerformed='setEditing2(false);'/> - </JPanel> - </cell> - <cell weightx='1' fill='both'> - <JTextField enabled='{isEditing2()}' text="to edit 2"/> - </cell> - </row> - <row> - <cell> - <JPanel> - <JButton visible='{!isEditing3()}' text='edit3' onActionPerformed='setEditing3(true);'/> - <JButton visible='{isEditing3()}' text='close3' onActionPerformed='setEditing3(false);'/> - </JPanel> - </cell> - <cell weightx='1' fill='both'> - <JTextField id='edit3' enabled='{isEditing3()}' text="{getContentMessage()}" - onKeyReleased='setContentMessage(edit3.getText())'/> - </cell> - </row> - </Table> - -</BaseBeanDataBinding> diff --git a/jaxx-example/src/main/java/jaxx/demo/BoxedDecoratorDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/BoxedDecoratorDemo.jaxx deleted file mode 100644 index 763199f..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/BoxedDecoratorDemo.jaxx +++ /dev/null @@ -1,91 +0,0 @@ - -<DemoPanel> - <jaxx.runtime.swing.BlockingLayerUI id='layerUI' - blockIcon='{SwingUtil.createImageIcon("action-block.png")}' - acceptIcon='{SwingUtil.createImageIcon("action-accept.png")}' - useIcon='true' - blockingColor='{new Color(50,50,50)}' - acceptAction='{new AbstractAction() { private static final long serialVersionUID = 1L; - @Override - public void actionPerformed(ActionEvent e) { - accept(e, "from icon of layer"); - } - }}' /> - <jaxx.runtime.swing.BlockingLayerUI2 id='layerUI2' - blockIcon='{SwingUtil.createImageIcon("action-block.png")}' - acceptIcon='{SwingUtil.createImageIcon("action-accept.png")}' - acceptAction='{new AbstractAction() { private static final long serialVersionUID = 1L; - @Override - public void actionPerformed(ActionEvent e) { - accept(e, "from icon of layer"); - } - }}' /> - <script><![CDATA[ -import jaxx.runtime.SwingUtil; - -void $afterCompleteSetup() { - for (JComponent boxed : SwingUtil.getLayeredComponents(this)) { - if (boxed == d) { - SwingUtil.getLayer(boxed).setUI(layerUI2); - continue; - } - - jaxx.runtime.swing.BlockingLayerUI ui = layerUI.clone(); - if ( boxed == c) { - ui.setBlock(true); - } - SwingUtil.getLayer(boxed).setUI(ui); - } -} - -public void setLayer(boolean active) { - for (JComponent boxed : SwingUtil.getLayeredComponents(this)) { - if (boxed == d) { - continue; - } - jaxx.runtime.swing.BlockingLayerUI ui = (jaxx.runtime.swing.BlockingLayerUI)SwingUtil.getLayer(boxed).getUI(); - if ( boxed == c) { - ui.setBlock(active); - } - ui.setUseIcon(active); - } -} - -protected void accept(ActionEvent e, String suffix) { - JButton source = (JButton) e.getSource(); - String clickedMessage = (String) source.getClientProperty("clickedText"); - String msg = "'" + source.getText() + "' clicked - " + suffix + " : " + clickedMessage; - ((DefaultListModel)messages.getModel()).addElement(msg); -}]]> - </script> - <Table id='demoPanel' fill='both' weightx='1'> - <row> - <cell> - <JCheckBox id='toggle' selected='true' - text='{toggle.isSelected() ? "Active layer" : "No layer"}' - onActionPerformed='setLayer(toggle.isSelected());'/> - </cell> - </row> - <row> - <cell weighty='0.5'> - <JPanel layout='{new GridLayout(1,3,3,3)}'> - <JButton text='button A' decorator='boxed' _clickedText='"button A was clicked"' - onActionPerformed='accept(event, "from button (no layer)")'/> - <JButton text='button B' decorator='boxed' _clickedText='"button B was clicked"' - onActionPerformed='accept(event, "from button (no layer)")'/> - <JButton id='c' text='button C (full block)' decorator='boxed' _clickedText='"button C was clicked"' - onActionPerformed='accept(event, "from button (no layer)");'/> - <JButton id='d' text='button D (full block 2)' decorator='boxed' _clickedText='"button D was clicked"' - onActionPerformed='accept(event, "from button (no layer)");'/> - </JPanel> - </cell> - </row> - <row> - <cell weighty='0.5'> - <JScrollPane> - <JList id='messages' model='{new DefaultListModel()}'/> - </JScrollPane> - </cell> - </row> - </Table> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/Calculator.css b/jaxx-example/src/main/java/jaxx/demo/Calculator.css deleted file mode 100644 index 9abfe7c..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/Calculator.css +++ /dev/null @@ -1,68 +0,0 @@ -#table { - border: { BorderFactory . createEmptyBorder( 4, 4, 4, 4 ) -} - -; -font-face: - -"Trebuchet MS" -; -} - -#display { - background: #BCE5AD; - opaque: true; - horizontalAlignment: right; - border: { BorderFactory . createBevelBorder( BevelBorder . LOWERED ) -} - -; -font-size: - -22 -; -font-weight: bold - -; -} - -#display:{ - object . getText( ) . startsWith( "-" ) -} - -{ -foreground: red - -; -} - -JButton { - font-size: 18; - width: 80; - height: 35; -} - -JButton.digit { - foreground: blue; -} - -JButton#dot { - font-size: 20; -} - -JButton.operator { - font-size: 16; - foreground: #009900; -} - -JButton.clear { - foreground: red; -} - -JButton:mouseover { - font-weight: bold; -} - -JButton.operator:mouseover { - font-weight: normal; -} \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/CalculatorDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/CalculatorDemo.jaxx deleted file mode 100644 index ebc8134..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/CalculatorDemo.jaxx +++ /dev/null @@ -1,89 +0,0 @@ -<DemoPanel> - <style source='Calculator.css'/> - <script><![CDATA[ - plus.setText("+"); - sign.setText("+/-"); -]]></script> - <!-- use fully-qualified name just in case this is compiled into a different package --> - <CalculatorEngine id='engine'/> - - <Table id='demoPanel' fill='both'> - <row> - <cell columns='4'> - <JLabel id='display' text='{engine.getDisplayText()}'/> - </cell> - </row> - - <row> - <cell columns='2'> - <JButton id='c' text='C' onActionPerformed='engine.clear()' styleClass='clear'/> - </cell> - <cell> - <JButton id='ce' text='CE' onActionPerformed='engine.clearEntry()' styleClass='clear'/> - </cell> - <cell> - <JButton id='equals' text='=' onActionPerformed='engine.equal()' styleClass='operator'/> - </cell> - </row> - - <row> - <cell> - <JButton id='d7' text='7' onActionPerformed='engine.digit(7)' styleClass='digit'/> - </cell> - <cell> - <JButton id='d8' text='8' onActionPerformed='engine.digit(8)' styleClass='digit'/> - </cell> - <cell> - <JButton id='d9' text='9' onActionPerformed='engine.digit(9)' styleClass='digit'/> - </cell> - <cell> - <JButton id='plus' onActionPerformed='engine.add()' styleClass='operator'/> - </cell> - </row> - - <row> - <cell> - <JButton id='d4' text='4' onActionPerformed='engine.digit(4)' styleClass='digit'/> - </cell> - <cell> - <JButton id='d5' text='5' onActionPerformed='engine.digit(5)' styleClass='digit'/> - </cell> - <cell> - <JButton id='d6' text='6' onActionPerformed='engine.digit(6)' styleClass='digit'/> - </cell> - <cell> - <JButton id='subtract' text='-' onActionPerformed='engine.subtract()' styleClass='operator'/> - </cell> - </row> - - <row> - <cell> - <JButton id='d1' text='1' onActionPerformed='engine.digit(1)' styleClass='digit'/> - </cell> - <cell> - <JButton id='d2' text='2' onActionPerformed='engine.digit(2)' styleClass='digit'/> - </cell> - <cell> - <JButton id='d3' text='3' onActionPerformed='engine.digit(3)' styleClass='digit'/> - </cell> - <cell> - <JButton id='multiply' text='x' onActionPerformed='engine.multiply()' styleClass='operator'/> - </cell> - </row> - - <row> - <cell> - <JButton id='d0' text='0' onActionPerformed='engine.digit(0)' styleClass='digit'/> - </cell> - <cell> - <JButton id='sign' onActionPerformed='engine.toggleSign()' styleClass='operator'/> - </cell> - <cell> - <JButton id='dot' text='.' onActionPerformed='engine.dot()' styleClass='digit'/> - </cell> - <cell> - <JButton id='divide' text='÷' onActionPerformed='engine.divide()' styleClass='operator'/> - </cell> - </row> - </Table> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/CalculatorEngine.java b/jaxx-example/src/main/java/jaxx/demo/CalculatorEngine.java deleted file mode 100644 index 7476e76..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/CalculatorEngine.java +++ /dev/null @@ -1,177 +0,0 @@ -package jaxx.demo; - -import java.beans.*; -import java.math.*; - -public class CalculatorEngine { - public static final String DISPLAY_TEXT_PROPERTY = "displayText"; - - public static final int ADD = 0; - public static final int SUBTRACT = 1; - public static final int MULTIPLY = 2; - public static final int DIVIDE = 3; - public static final int RESULT = 4; - - private int operation = -1; - private boolean clear = true; // true to clear on next key - private String displayText = "0"; - private BigDecimal value; - private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this); - - - public String getDisplayText() { - return displayText; - } - - - public void setDisplayText(String displayText) { - String oldDisplayText = this.displayText; - this.displayText = displayText; - firePropertyChange(DISPLAY_TEXT_PROPERTY, oldDisplayText, displayText); - } - - - public void clear() { - clearEntry(); - value = new BigDecimal(0); - operation = -1; - } - - - public void clearEntry() { - setDisplayText("0"); - clear = true; - } - - - private void checkClear() { - if (clear) { - setDisplayText(""); - clear = false; - } - } - - - public void digit(int digit) { - checkClear(); - setDisplayText(getDisplayText() + String.valueOf(digit)); - } - - - public void dot() { - checkClear(); - if (getDisplayText().indexOf('.') == -1) { - if (getDisplayText().length() == 0) { - setDisplayText("0."); - } else { - setDisplayText(getDisplayText() + '.'); - } - } - } - - - public void toggleSign() { - String text = getDisplayText(); - if (text.startsWith("-")) { - text = text.substring(1); - } else if (!text.equals("0")) { - text = '-' + text; - } - setDisplayText(text); - } - - - public void equal() { - BigDecimal displayValue = new BigDecimal(getDisplayText()); - BigDecimal newValue = displayValue; - switch (operation) { - case ADD: - newValue = value.add(displayValue); - break; - case SUBTRACT: - newValue = value.subtract(displayValue); - break; - case MULTIPLY: - newValue = value.multiply(displayValue); - break; - case DIVIDE: - newValue = value.divide(displayValue, 8, BigDecimal.ROUND_HALF_UP); - break; - } - value = newValue; - setDisplayText(toString(newValue)); - clear = true; - operation = -1; - } - - - public static String toString(BigDecimal decimal) { - // can't use stripTrailingZeros, as it wasn't introduced until 1.5 - String result = decimal.toString(); - if (result.indexOf(".") != -1) { - while (result.endsWith("0")) { - result = result.substring(0, result.length() - 1); - } - if (result.endsWith(".")) { - result = result.substring(0, result.length() - 1); - } - } - return result; - } - - - public void operation(int operation) { - if (this.operation != -1) { - equal(); - } else { - value = new BigDecimal(getDisplayText()); - clear = true; - } - this.operation = operation; - } - - - public void add() { - operation(ADD); - } - - - public void subtract() { - operation(SUBTRACT); - } - - - public void multiply() { - operation(MULTIPLY); - } - - - public void divide() { - operation(DIVIDE); - } - - - public void addPropertyChangeListener(PropertyChangeListener listener) { - propertyChangeSupport.addPropertyChangeListener(listener); - } - - - public void addPropertyChangeListener(String property, PropertyChangeListener listener) { - propertyChangeSupport.addPropertyChangeListener(property, listener); - } - - - public void removePropertyChangeListener(PropertyChangeListener listener) { - propertyChangeSupport.removePropertyChangeListener(listener); - } - - - public void removePropertyChangeListener(String property, PropertyChangeListener listener) { - propertyChangeSupport.removePropertyChangeListener(property, listener); - } - - - protected void firePropertyChange(String property, Object oldValue, Object newValue) { - propertyChangeSupport.firePropertyChange(property, oldValue, newValue); - } -} \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/ComboEditorDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/ComboEditorDemo.jaxx deleted file mode 100644 index d1cc7de..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/ComboEditorDemo.jaxx +++ /dev/null @@ -1,35 +0,0 @@ - -<DemoPanel> - <Table id='demoPanel' fill='both'> - <row> - <cell> - <JLabel text='Locale editor:' labelFor='{localeEditor}'/> - </cell> - - <cell> - <LocaleEditor id='localeEditor'/> - </cell> - </row> - <row> - <cell> - <JLabel text='EnumEditor (language) :' labelFor='{languageEditor}'/> - </cell> - <cell> - <EnumEditor id='languageEditor' constructorParams='org.nuiton.i18n.LanguageEnum.class'/> - </cell> - </row> - <row> - <cell> - <JLabel text='EnumEditor (country) :' labelFor='{countryEditor}'/> - </cell> - <cell> - <EnumEditor id='countryEditor' constructorParams='org.nuiton.i18n.CountryEnum.class'/> - </cell> - </row> - <row> - <cell columns="2"> - <JTextArea text='{"locale : "+ localeEditor.getSelectedItem() + "\nlanguage : "+ languageEditor.getSelectedItem() + "\ncountry : " + countryEditor.getSelectedItem()}'/> - </cell> - </row> - </Table> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/CounterDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/CounterDemo.jaxx deleted file mode 100644 index 9f706ff..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/CounterDemo.jaxx +++ /dev/null @@ -1,12 +0,0 @@ -<DemoPanel> - <script>int count;</script> - <JPanel id='demoPanel'> - <JTextField text='{count}' constraints='BorderLayout.NORTH'/> - <HBox constraints='BorderLayout.SOUTH'> - <JButton text='Dec (-)' onActionPerformed='count--'/> - <JButton text='Reset' onActionPerformed='count = 0'/> - <JButton text='Inc (+)' onActionPerformed='count++'/> - </HBox> - </JPanel> - -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/DemoPanel.jaxx b/jaxx-example/src/main/java/jaxx/demo/DemoPanel.jaxx deleted file mode 100644 index 1d6fac5..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/DemoPanel.jaxx +++ /dev/null @@ -1,45 +0,0 @@ -<JTabbedPane id='top'> - <script><![CDATA[ - import java.io.*; - - public String getLabel() { - String name = getClass().getName(); - name = name.substring(name.lastIndexOf(".") + 1); - if (name.endsWith("Demo")) - name = name.substring(0, name.length() - "Demo".length()); - return name; - } - - - public String getDemoTabTitle() { - return getLabel() + " Demo"; - } - - - public String loadSource() { - try { - String className = getClass().getName(); - Reader in = new InputStreamReader(getClass().getResourceAsStream(className.substring(className.lastIndexOf(".") + 1) + ".jaxx")); - StringWriter out = new StringWriter(); - char[] buffer = new char[2048]; - int c; - while ((c = in.read(buffer)) > 0) - out.write(buffer, 0, c); - return out.toString(); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - ]]></script> - - <tab title='{getDemoTabTitle()}'> - <JPanel id='demoPanel'/> - </tab> - - <tab title='Source'> - <JScrollPane height='100'> - <JTextArea text='{loadSource()}' editable='false'/> - </JScrollPane> - </tab> -</JTabbedPane> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/EmptyDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/EmptyDemo.jaxx deleted file mode 100644 index 0c38829..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/EmptyDemo.jaxx +++ /dev/null @@ -1,5 +0,0 @@ -<DemoPanel> -<JPanel id='demoPanel'> - <JLabel text='emptyNode'/> -</JPanel> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/ExempleItemTreeNavigationAdapter.java b/jaxx-example/src/main/java/jaxx/demo/ExempleItemTreeNavigationAdapter.java deleted file mode 100644 index b1dcfba..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/ExempleItemTreeNavigationAdapter.java +++ /dev/null @@ -1,60 +0,0 @@ -package jaxx.demo; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.Date; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.swing.Item; -import jaxx.runtime.swing.JAXXTree; -import jaxx.runtime.swing.JAXXTree.JAXXTreeModel; -import jaxx.runtime.swing.navigation.ItemNavigationCardPanel; -import jaxx.runtime.swing.navigation.ItemTreeNavigationAdapter; - -/** - * - * @author letellier - */ -public class ExempleItemTreeNavigationAdapter extends ItemTreeNavigationAdapter{ - - Item currentItem = null; - - public ExempleItemTreeNavigationAdapter(JAXXObject context, JAXXTree tree, ItemNavigationCardPanel cardPanel){ - super(context, tree, cardPanel); - - ItemTreeNavigationDemo demo = (ItemTreeNavigationDemo)context; - demo.addPropertyChangeListener("date", new PropertyChangeListener() { - - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (currentItem != null && !(currentItem.getValue() instanceof Class)){ - currentItem.setValue((Date)evt.getNewValue()); - } - } - }); - - demo.addPropertyChangeListener("string", new PropertyChangeListener() { - - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (currentItem != null && !(currentItem.getValue() instanceof Class)){ - currentItem.setValue((String)evt.getNewValue()); - } - } - }); - } - - @Override - protected void valueChanged(Object data) { - ItemTreeNavigationDemo demo = (ItemTreeNavigationDemo)context; - currentItem = ((JAXXTreeModel)tree.getModel()).findItem(data); - if (data instanceof String){ - demo.setString((String)data); - } else if (data instanceof Date){ - demo.setDate((Date)data); - } else { - demo.setString(""); - demo.setDate(null); - } - } - -} diff --git a/jaxx-example/src/main/java/jaxx/demo/I18nEditorDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/I18nEditorDemo.jaxx deleted file mode 100644 index 2efd86a..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/I18nEditorDemo.jaxx +++ /dev/null @@ -1,46 +0,0 @@ - -<DemoPanel> - <script><![CDATA[ -//localeEditor.loadI18nBundles(); -]]> - </script> - <Table id='demoPanel' fill='both'> - <row> - <cell> - <JLabel text='Empty I18n editor:' labelFor='{localeEmptyEditor}'/> - </cell> - <cell> - <jaxx.runtime.swing.editor.I18nEditor id='localeEmptyEditor' /> - </cell> - </row> - <row> - <cell> - <JLabel text='I18n editor:' labelFor='{localeEditor}'/> - </cell> - <cell> - <jaxx.runtime.swing.editor.I18nEditor id='localeEditor' - locales='{java.util.Arrays.asList(org.nuiton.i18n.I18n.getLoader().getLocales())}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='I18n editor with no text :' labelFor='{localeWithNoTextEditor}'/> - </cell> - <cell> - <jaxx.runtime.swing.editor.I18nEditor id='localeWithNoTextEditor' - locales='{java.util.Arrays.asList(org.nuiton.i18n.I18n.getLoader().getLocales())}' - showText='false'/> - </cell> - </row> - <row> - <cell> - <JLabel text='I18n editor with no icon :' labelFor='{localeWithNoIconEditor}'/> - </cell> - <cell> - <jaxx.runtime.swing.editor.I18nEditor id='localeWithNoIconEditor' - locales='{java.util.Arrays.asList(org.nuiton.i18n.I18n.getLoader().getLocales())}' - showIcon='false'/> - </cell> - </row> - </Table> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/Identity.java b/jaxx-example/src/main/java/jaxx/demo/Identity.java deleted file mode 100644 index 2166c2c..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/Identity.java +++ /dev/null @@ -1,103 +0,0 @@ -package jaxx.demo; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.io.File; - -public class Identity { - - protected String firstName = ""; - - protected String lastName = ""; - - protected String email = "dummy@codelutin.com"; - - protected int age = 51; - - protected File config = new File("/tmp"); - - protected File dir = new File("/tmp"); - - PropertyChangeSupport p; - - public Identity() { - p = new PropertyChangeSupport(this); - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - p.addPropertyChangeListener(listener); - } - - public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { - p.addPropertyChangeListener(propertyName, listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - p.removePropertyChangeListener(listener); - } - - public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { - p.removePropertyChangeListener(propertyName, listener); - } - - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - public String getEmail() { - return email; - } - - public int getAge() { - return age; - } - - public File getConfig() { - return config; - } - - public File getDir() { - return dir; - } - - public void setFirstName(String firstName) { - String oldFirstName = this.firstName; - this.firstName = firstName; - p.firePropertyChange("firstName", oldFirstName, firstName); - } - - public void setLastName(String lastName) { - String oldLastName = this.lastName; - this.lastName = lastName; - p.firePropertyChange("lastName", oldLastName, lastName); - } - - public void setEmail(String email) { - String oldEmail = this.email; - this.email = email; - p.firePropertyChange("email", oldEmail, email); - } - - public void setAge(int age) { - int oldAge = this.age; - this.age = age; - p.firePropertyChange("age", oldAge, age); - } - - public void setConfig(File config) { - File oldConfig = this.config; - this.config = config; - p.firePropertyChange("config", oldConfig, config); - } - - public void setDir(File dir) { - File oldDir = this.dir; - this.dir = dir; - p.firePropertyChange("dir", oldDir, dir); - } -} \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/ItemTreeNavigationDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/ItemTreeNavigationDemo.jaxx deleted file mode 100644 index 130502c..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/ItemTreeNavigationDemo.jaxx +++ /dev/null @@ -1,41 +0,0 @@ -<DemoPanel> - - <String id='string' javaBean='null'/> - <Date id='date' javaBean='null'/> - - <script> -import jaxx.runtime.swing.navigation.*; -import org.jdesktop.swingx.JXDatePicker; - -void $afterCompleteSetup() { - new ExempleItemTreeNavigationAdapter(this, nav, content); -} - </script> - - <JPanel id='demoPanel' layout='{new BorderLayout()}'> - <JSplitPane constraints='BorderLayout.CENTER'> - <JScrollPane> - <JTree id='nav' rootVisible='{false}'> - <!-- Allow to diplay associated pane without value --> - <item id='stringItemParent' label='String' value='{String.class}'> - <item id='string1Item' label='String1' value='{new String("Ceci est un String")}' selected='true'/> - <item id='string2Item' label='String2' value='{new String("Celui-ci un autre")}'/> - </item> - <item id='dateItemParent' label='Date' value='{Date.class}'> - <item id='dateItem' label='CurrentDate' value='{new Date()}'/> - </item> - </JTree> - </JScrollPane> - <!-- Card panel, only ItemNavigationPanel children is alowed --> - <ItemNavigationCardPanel id="content"> - <!-- The associated type is passed by the constructor --> - <ItemNavigationPanel id='stringPanel' constructorParams='String.class' layout='{new FlowLayout()}'> - <JTextField id='stringTextField' text='{getString()}' onKeyReleased='setString(stringTextField.getText())'/> - </ItemNavigationPanel> - <ItemNavigationPanel id='datePanel' constructorParams='Date.class' layout='{new FlowLayout()}'> - <JXDatePicker id='datePicker' date='{getDate()}' onActionPerformed='setDate(datePicker.getDate())'/> - </ItemNavigationPanel> - </ItemNavigationCardPanel> - </JSplitPane> - </JPanel> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx deleted file mode 100644 index beae928..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx +++ /dev/null @@ -1,134 +0,0 @@ -<Application title="JAXX Demo" width='1024' height='800' defaultCloseOperation='exit_on_close'> - <script><![CDATA[ - -static { -org.nuiton.i18n.I18n.init("fr", "FR"); -} - -void $afterCompleteSetup() { - - - try { jaxx.runtime.SwingUtil.initNimbusLoookAndFeel(); } catch (Exception e) { log.error(e.getMessage(), e); } - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - int i=0; - while( i < list.getRowCount()) { - list.expandRow(i++); - } - } - }); -} - -]]></script> - <JSplitPane> - <!--JSplitPane dividerLocation='200'--> - <JScrollPane> - <JTree id='list' showsRootHandles='true' - onValueChanged='cardLayout.show(preview, list.getSelectionValue() instanceof DemoPanel ? ((DemoPanel) list.getSelectionValue()).getLabel() : emptyDemo.getLabel())' - cellRenderer='{new javax.swing.tree.DefaultTreeCellRenderer() { - public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { - if (value instanceof DemoPanel) - value = ((DemoPanel) value).getLabel(); - return super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); - } - } - }'> - <item value="Components"> - <item value='Buttons'> - <item value='{buttonDemo}'/> - <item value='{checkBoxDemo}'/> - <item value='{radioButtonDemo}'/> - <item value='{toggleButtonDemo}'/> - </item> - - <item value='Form elements'> - <item value='Text'> - <item value='{passwordFieldDemo}'/> - <item value='{textFieldDemo}'/> - <item value='{textAreaDemo}'/> - </item> - - <item value='{comboBoxDemo}'/> - <item value='{listDemo}'/> - <item value='{sliderDemo}'/> - <item value='{spinnerDemo}'/> - </item> - - <item value='Layout components'> - <item value='{splitPaneDemo}'/> - </item> - - <item value='Menus'> - <item value='{menuItemDemo}'/> - <item value='{checkBoxMenuItemDemo}'/> - <item value='{radioButtonMenuItemDemo}'/> - </item> - - <item value='Windows'> - <item value='{dialogDemo}'/> - </item> - - <item value='{progressBarDemo}'/> - - </item> - - <item value='{labelStyleDemo}'/> - - <item value='{counterDemo}'/> - <item value='{calculatorDemo}'/> - - <item value='New features'> - <item value='Validation'> - <item value='{validationDemo1}'/> - <item value='{validationDemo2}'/> - </item> - <item value='{itemTreeNavigationDemo}'/> - <item value='{dataBindingDemo}'/> - <item value='{boxedDecoratorDemo}'/> - <item value='{statusMessagePanelDemo}'/> - <item value='Editors'> - <item value='{numberEditorDemo}'/> - <item value='{comboEditorDemo}'/> - <item value='{i18nEditorDemo}'/> - </item> - </item> - </JTree> - </JScrollPane> - - <java.awt.CardLayout id='cardLayout'/> - - <JPanel id='preview' layout='{cardLayout}'> - <EmptyDemo id='emptyDemo' constraints='emptyDemo.getLabel()'/> - <JButtonDemo id='buttonDemo' constraints='buttonDemo.getLabel()'/> - <JCheckBoxDemo id='checkBoxDemo' constraints='checkBoxDemo.getLabel()'/> - <JCheckBoxMenuItemDemo id='checkBoxMenuItemDemo' constraints='checkBoxMenuItemDemo.getLabel()'/> - <JComboBoxDemo id='comboBoxDemo' constraints='comboBoxDemo.getLabel()'/> - <JDialogDemo id='dialogDemo' constraints='dialogDemo.getLabel()'/> - <JListDemo id='listDemo' constraints='listDemo.getLabel()'/> - <JMenuItemDemo id='menuItemDemo' constraints='menuItemDemo.getLabel()'/> - <JPasswordFieldDemo id='passwordFieldDemo' constraints='passwordFieldDemo.getLabel()'/> - <JProgressBarDemo id='progressBarDemo' constraints='progressBarDemo.getLabel()'/> - <JSliderDemo id='sliderDemo' constraints='sliderDemo.getLabel()'/> - <JSpinnerDemo id='spinnerDemo' constraints='spinnerDemo.getLabel()'/> - <JSplitPaneDemo id='splitPaneDemo' constraints='splitPaneDemo.getLabel()'/> - <JRadioButtonDemo id='radioButtonDemo' constraints='radioButtonDemo.getLabel()'/> - <JRadioButtonMenuItemDemo id='radioButtonMenuItemDemo' constraints='radioButtonMenuItemDemo.getLabel()'/> - <JToggleButtonDemo id='toggleButtonDemo' constraints='toggleButtonDemo.getLabel()'/> - <JTextFieldDemo id='textFieldDemo' constraints='textFieldDemo.getLabel()'/> - <JTextAreaDemo id='textAreaDemo' constraints='textAreaDemo.getLabel()'/> - <ValidationListDemo id='validationDemo1' constraints='validationDemo1.getLabel()'/> - <ValidationTableDemo id='validationDemo2' constraints='validationDemo2.getLabel()'/> - <ItemTreeNavigationDemo id='itemTreeNavigationDemo' constraints='itemTreeNavigationDemo.getLabel()'/> - <BeanDataBindingDemo id='dataBindingDemo' constraints='dataBindingDemo.getLabel()'/> - <LabelStyleDemo id='labelStyleDemo' constraints='labelStyleDemo.getLabel()'/> - <CounterDemo id='counterDemo' constraints='counterDemo.getLabel()'/> - <CalculatorDemo id='calculatorDemo' constraints='calculatorDemo.getLabel()'/> - <BoxedDecoratorDemo id='boxedDecoratorDemo' constraints='boxedDecoratorDemo.getLabel()'/> - <NumberEditorDemo id='numberEditorDemo' constraints='numberEditorDemo.getLabel()'/> - <ComboEditorDemo id='comboEditorDemo' constraints='comboEditorDemo.getLabel()'/> - <I18nEditorDemo id='i18nEditorDemo' constraints='i18nEditorDemo.getLabel()'/> - <StatusMessagePanelDemo id='statusMessagePanelDemo' constraints='statusMessagePanelDemo.getLabel()'/> - </JPanel> - </JSplitPane> -</Application> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JButtonDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JButtonDemo.jaxx deleted file mode 100644 index db42c63..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JButtonDemo.jaxx +++ /dev/null @@ -1,29 +0,0 @@ -<DemoPanel> - <style> - JButton.fancy { - foreground: blue; - font-face: Arial; - font-size: 18; - } - - JButton.fancy:mouseover { - foreground: red; - font-style: italic; - } - </style> - - <script> - public void buttonClicked(JButton button) { - JOptionPane.showMessageDialog(this, button.getText() + " clicked!", "onActionPerformed", - JOptionPane.INFORMATION_MESSAGE); - } - </script> - - <javax.swing.ImageIcon id='pencil' constructorParams='getClass().getResource("images/pencil_black.gif")'/> - - <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <JButton text='Simple Button' onActionPerformed='buttonClicked((JButton) event.getSource())'/> - <JButton text='Fancy Button' styleClass='fancy' icon='{pencil}' - onActionPerformed='buttonClicked((JButton) event.getSource())'/> - </VBox> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JCheckBoxDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JCheckBoxDemo.jaxx deleted file mode 100644 index 19fb5ec..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JCheckBoxDemo.jaxx +++ /dev/null @@ -1,38 +0,0 @@ -<DemoPanel> - <script><![CDATA[ - public String getText(boolean bold, boolean italic, boolean underline) { - String text ="Sample Text"; - if (bold) - text = "<b>" + text + "</b>"; - if (italic) - text = "<i>" + text + "</i>"; - if (underline) - text = "<u>" + text + "</u>"; - return "<html>" + text; - } - ]]></script> - - <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <Table anchor='west'> - <row> - <cell> - <JCheckBox id='bold' text='Bold' mnemonic='B'/> - </cell> - <cell rows='3'> - <JLabel font='{new Font("Arial", 0, 18)}' - text='{getText(bold.isSelected(), italic.isSelected(), underline.isSelected())}'/> - </cell> - </row> - <row> - <cell> - <JCheckBox id='italic' text='Italic' mnemonic='I'/> - </cell> - </row> - <row> - <cell> - <JCheckBox id='underline' text='Underline' mnemonic='U'/> - </cell> - </row> - </Table> - </VBox> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JCheckBoxMenuItemDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JCheckBoxMenuItemDemo.jaxx deleted file mode 100644 index 8769306..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JCheckBoxMenuItemDemo.jaxx +++ /dev/null @@ -1,59 +0,0 @@ -<JMenuItemDemo> - <style> - .form { - enabled: { enabledCheckBox.isSelected() }; - editable: { editableCheckBox.isSelected() }; - } - </style> - - <JMenuBar id='menuBar'> - <JMenu text='View'> - <JCheckBoxMenuItem id='enabledCheckBox' text='Enabled' selected='true'/> - <JCheckBoxMenuItem id='editableCheckBox' text='Editable' selected='true'/> - </JMenu> - </JMenuBar> - - <Table id='framePanel' anchor='northwest'> - <row> - <cell> - <JLabel text='First Name:' displayedMnemonic='F' labelFor='{firstName}'/> - </cell> - - <cell weightx='1' fill='horizontal'> - <JTextField id='firstName' styleClass="form"/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Last Name:' displayedMnemonic='L' labelFor='{lastName}'/> - </cell> - - <cell fill='horizontal'> - <JTextField id='lastName' styleClass="form"/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Email Address:' displayedMnemonic='E' labelFor='{email}'/> - </cell> - - <cell fill='horizontal'> - <JTextField id='email' styleClass="form"/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Comments:' displayedMnemonic='C' labelFor='{comments}'/> - </cell> - - <cell weightx='1' weighty='1' fill='both'> - <JScrollPane width='150' height='75'> - <JTextArea id='comments' styleClass="form"/> - </JScrollPane> - </cell> - </row> - </Table> -</JMenuItemDemo> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JComboBoxDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JComboBoxDemo.jaxx deleted file mode 100644 index 1ce9790..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JComboBoxDemo.jaxx +++ /dev/null @@ -1,22 +0,0 @@ - -<DemoPanel> - <Table id='demoPanel'> - <row> - <cell> - <JLabel text='Button label:'/> - </cell> - - <cell> - <JComboBox id='comboBox' editable='true'> - <item value='OK' selected='true'/> - <item value='Cancel'/> - <item value='Help'/> - </JComboBox> - </cell> - - <cell> - <JButton text='{comboBox.getSelectedItem()}'/> - </cell> - </row> - </Table> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JDialogDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JDialogDemo.jaxx deleted file mode 100644 index 565d5b2..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JDialogDemo.jaxx +++ /dev/null @@ -1,79 +0,0 @@ -<DemoPanel> - <script> - String username; - String password; - - private class OKAction extends javax.swing.AbstractAction { - public OKAction() { - putValue(NAME, "OK"); - } - - - public void actionPerformed(ActionEvent e) { - username = usernameField.getText(); - password = new String(passwordField.getPassword()); - dialog.dispose(); - } - } - - - private class CancelAction extends javax.swing.AbstractAction { - public CancelAction() { - putValue(NAME, "Cancel"); - } - - - public void actionPerformed(ActionEvent e) { - dialog.dispose(); - } - } - { - JRootPane rootPane = dialog.getRootPane(); - rootPane.setDefaultButton(ok); - rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "cancel"); - rootPane.getActionMap().put("cancel", new CancelAction()); - } - </script> - - <JDialog title='Sign on' id='dialog' modal='true' onWindowOpened='dialog.setLocationRelativeTo(demoPanel); - passwordField.setText("");'> - <Table> - <row> - <cell> - <JLabel text='Username:' displayedMnemonic='U' labelFor='{usernameField}'/> - </cell> - - <cell> - <JTextField id='usernameField'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Password:' displayedMnemonic='P' labelFor='{passwordField}'/> - </cell> - - <cell> - <JPasswordField id='passwordField'/> - </cell> - </row> - - <row> - <cell columns='2'> - <JPanel layout='{new GridLayout(1, 0, 6, 6)}'> - <JButton id='ok' text='OK' action='{new OKAction()}'/> - <JButton text='Cancel' action='{new CancelAction()}'/> - </JPanel> - </cell> - </row> - </Table> - </JDialog> - - <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <JButton text='Show password dialog' onActionPerformed='dialog.setVisible(true)'/> - <VBox> - <JLabel text='{username != null ? "Username: " + username : ""}'/> - <JLabel text='{password != null ? "Password: " + password : ""}'/> - </VBox> - </VBox> -</DemoPanel> diff --git a/jaxx-example/src/main/java/jaxx/demo/JListDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JListDemo.jaxx deleted file mode 100644 index 6ec324f..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JListDemo.jaxx +++ /dev/null @@ -1,59 +0,0 @@ -<DemoPanel> - <Table id='demoPanel'> - <row> - <cell> - <JLabel text='Supported Swing components:'/> - </cell> - </row> - - <row> - <cell> - <JScrollPane> - <JList> - <item value='JApplet'/> - <item value='JButton'/> - <item value='JCheckBox'/> - <item value='JCheckBoxMenuItem'/> - <item value='JColorChooser'/> - <item value='JComboBox'/> - <item value='JDesktopPane'/> - <item value='JDialog'/> - <item value='JEditorPane'/> - <item value='JFileChooser'/> - <item value='JFormattedTextField'/> - <item value='JFrame'/> - <item value='JInternalFrame'/> - <item value='JLabel'/> - <item value='JLayeredPane'/> - <item value='JList'/> - <item value='JMenu'/> - <item value='JMenuBar'/> - <item value='JMenuItem'/> - <item value='JOptionPane'/> - <item value='JPanel'/> - <item value='JPasswordField'/> - <item value='JPopupMenu'/> - <item value='JProgressBar'/> - <item value='JRadioButton'/> - <item value='JRadioButtonMenuItem'/> - <item value='JScrollBar'/> - <item value='JScrollPane'/> - <item value='JSeparator'/> - <item value='JSlider'/> - <item value='JSpinner'/> - <item value='JSplitPane'/> - <item value='JTabbedPane'/> - <item value='JTable'/> - <item value='JTextArea'/> - <item value='JTextField'/> - <item value='JTextPane'/> - <item value='JToggleButton'/> - <item value='JToolBar'/> - <item value='JTree'/> - <item value='JWindow'/> - </JList> - </JScrollPane> - </cell> - </row> - </Table> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JMenuItemDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JMenuItemDemo.jaxx deleted file mode 100644 index 8cd5da5..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JMenuItemDemo.jaxx +++ /dev/null @@ -1,23 +0,0 @@ -<DemoPanel> - <script> - private void displayMessage() { - JOptionPane.showMessageDialog(demoPanel, "Menu item clicked"); - } - </script> - - <JPanel id='demoPanel'> - <JDesktopPane width='350' height='400' background='{null}'> - <JInternalFrame title='JMenu demo' width='300' height='250' resizable='true'> - <JMenuBar id='menuBar'> - <JMenu text='Demo'> - <JMenuItem text='Message Box' onActionPerformed='displayMessage()'/> - </JMenu> - </JMenuBar> - - <JPanel id='framePanel'> - <JLabel text='JMenu demo' id='demoMessage' horizontalAlignment='center'/> - </JPanel> - </JInternalFrame> - </JDesktopPane> - </JPanel> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JPasswordFieldDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JPasswordFieldDemo.jaxx deleted file mode 100644 index b266c65..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JPasswordFieldDemo.jaxx +++ /dev/null @@ -1,10 +0,0 @@ -<DemoPanel> - <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <HBox> - <JLabel text='Password:' displayedMnemonic='P' labelFor='{password}'/> - <JPasswordField id='password'/> - </HBox> - - <JLabel text='You entered: {new String(password.getPassword())}'/> - </VBox> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JProgressBarDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JProgressBarDemo.jaxx deleted file mode 100644 index 8c38933..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JProgressBarDemo.jaxx +++ /dev/null @@ -1,77 +0,0 @@ -<DemoPanel> - <script><![CDATA[ - import javax.swing.Timer; - - int red = 0; - int green = 0; - int blue = 0; - int speed = 2; - int redDirection = 1; - int greenDirection = 1; - int blueDirection = 1; - - Timer redTimer = new Timer(5, new ActionListener() { - public void actionPerformed(ActionEvent e) { - red = Math.max(0, Math.min(255, red + speed * redDirection)); - if (red == 0 || red == 255) - redDirection = -redDirection; - } - }); - - Timer greenTimer = new Timer(50, new ActionListener() { - public void actionPerformed(ActionEvent e) { - green = Math.max(0, Math.min(255, green + speed * greenDirection)); - if (green == 0 || green == 255) - greenDirection = -greenDirection; - } - }); - - Timer blueTimer = new Timer(500, new ActionListener() { - public void actionPerformed(ActionEvent e) { - blue = Math.max(0, Math.min(255, blue + speed * blueDirection)); - if (blue == 0 || blue == 255) - blueDirection = -blueDirection; - } - }); - - redTimer.start(); - greenTimer.start(); - blueTimer.start(); - ]]></script> - - <Table insets='6' id='demoPanel'> - <row> - <cell columns='3'> - <JLabel text='Welcome to the JAXX framework!' font='{UIManager.getFont("Label.font").deriveFont(18f)}' - foreground='{new Color(red, green, blue)}'/> - </cell> - </row> - - <row> - <cell columns='3' fill='horizontal'> - <JProgressBar foreground='{new Color(red, 0, 0)}' value='{red}' maximum='255'/> - </cell> - </row> - - <row> - <cell columns='3' fill='horizontal'> - <JProgressBar foreground='{new Color(0, green, 0)}' value='{green}' maximum='255'/> - </cell> - </row> - - <row> - <cell columns='3' fill='horizontal'> - <JProgressBar foreground='{new Color(0, 0, blue)}' value='{blue}' maximum='255'/> - </cell> - </row> - - <row> - <cell weightx='1' anchor='east'> - <JButton text='Start' onActionPerformed='redTimer.start(); greenTimer.start(); blueTimer.start()'/> - </cell> - <cell> - <JButton text='Stop' onActionPerformed='redTimer.stop(); greenTimer.stop(); blueTimer.stop()'/> - </cell> - </row> - </Table> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JRadioButtonDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JRadioButtonDemo.jaxx deleted file mode 100644 index ccd4088..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JRadioButtonDemo.jaxx +++ /dev/null @@ -1,11 +0,0 @@ -<DemoPanel> - <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <VBox> - <JRadioButton text='Animal' value='Lynx.jpg' buttonGroup='radioButtons' selected='true'/> - <JRadioButton text='Vegetable' buttonGroup='radioButtons' value='Tomato.jpg'/> - <JRadioButton text='Mineral' buttonGroup='radioButtons' value='Amethyst.jpg'/> - </VBox> - - <JLabel icon='{new ImageIcon(getClass().getResource("images/" + radioButtons.getSelectedValue()))}'/> - </HBox> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JRadioButtonMenuItemDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JRadioButtonMenuItemDemo.jaxx deleted file mode 100644 index 62a3996..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JRadioButtonMenuItemDemo.jaxx +++ /dev/null @@ -1,14 +0,0 @@ -<JMenuItemDemo> - <JMenuBar id='menuBar'> - <JMenu text='Font size'> - <JRadioButtonMenuItem text='10' value='{new Integer(10)}' buttonGroup='fontSize'/> - <JRadioButtonMenuItem text='12' value='{new Integer(12)}' buttonGroup='fontSize' selected='true'/> - <JRadioButtonMenuItem text='14' value='{new Integer(14)}' buttonGroup='fontSize'/> - <JRadioButtonMenuItem text='18' value='{new Integer(18)}' buttonGroup='fontSize'/> - <JRadioButtonMenuItem text='24' value='{new Integer(24)}' buttonGroup='fontSize'/> - </JMenu> - </JMenuBar> - - <JLabel id='demoMessage' text='Font size: {fontSize.getSelectedValue()}' horizontalAlignment='center' - font='{UIManager.getFont("Label.font").deriveFont(fontSize.getSelectedValue() != null ? (float) ((Integer) fontSize.getSelectedValue()).intValue() : 12)}'/> -</JMenuItemDemo> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JSliderDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JSliderDemo.jaxx deleted file mode 100644 index fcebefb..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JSliderDemo.jaxx +++ /dev/null @@ -1,12 +0,0 @@ -<DemoPanel> - <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <VBox> - <JSlider id='red' maximum='255' value='200'/> - <JSlider id='green' maximum='255' value='180'/> - <JSlider id='blue' maximum='255' value='240'/> - </VBox> - - <JPanel border='{BorderFactory.createEtchedBorder()}' width='64' height='64' - background='{new Color(red.getValue(), green.getValue(), blue.getValue())}'/> - </HBox> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JSpinnerDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JSpinnerDemo.jaxx deleted file mode 100644 index a4c74ae..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JSpinnerDemo.jaxx +++ /dev/null @@ -1,13 +0,0 @@ -<DemoPanel> - <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <JLabel text='Spacing:' displayedMnemonic='S' labelFor='{spinner}'/> - - <JSpinner minimum='0' maximum='50' id='spinner'/> - - <VBox spacing='{((Integer) spinner.getValue()).intValue()}'> - <JLabel text='Use the spinner to'/> - <JLabel text='adjust the spacing'/> - <JLabel text='between these lines'/> - </VBox> - </HBox> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JSplitPaneDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JSplitPaneDemo.jaxx deleted file mode 100644 index 4aafbc4..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JSplitPaneDemo.jaxx +++ /dev/null @@ -1,13 +0,0 @@ -<DemoPanel> - <JPanel id='demoPanel' layout='{new BorderLayout()}'> - <JSplitPane> - <JScrollPane> - <JLabel icon='{new ImageIcon(getClass().getResource("images/Amethyst.jpg"))}'/> - </JScrollPane> - - <JScrollPane> - <JLabel icon='{new ImageIcon(getClass().getResource("images/Lynx.jpg"))}'/> - </JScrollPane> - </JSplitPane> - </JPanel> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JTextAreaDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JTextAreaDemo.jaxx deleted file mode 100644 index 4cac85a..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JTextAreaDemo.jaxx +++ /dev/null @@ -1,33 +0,0 @@ -<DemoPanel> - <Table id='demoPanel' anchor='northwest'> - <row> - <cell> - <JLabel text='Normal text:' displayedMnemonic='N' labelFor='{textArea}'/> - </cell> - - <cell weightx='1' fill='both'> - <JScrollPane height='120'> - <JTextArea id='textArea' text='Try typing some text here.'/> - </JScrollPane> - </cell> - </row> - - <row> - <cell> - <JLabel text='Upper case text:'/> - </cell> - - <cell weightx='1' fill='both'> - <JScrollPane height='120'> - <JTextArea editable='false' background='{null}' text='{textArea.getText().toUpperCase()}'/> - </JScrollPane> - </cell> - </row> - - <row> - <cell weighty='1'> - <JPanel/> - </cell> - </row> - </Table> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JTextFieldDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JTextFieldDemo.jaxx deleted file mode 100644 index 584f6dc..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JTextFieldDemo.jaxx +++ /dev/null @@ -1,22 +0,0 @@ -<DemoPanel> - <JPanel id='demoPanel'> - <Table> - <row> - <cell> - <JLabel text='Your name:' displayedMnemonic='n' labelFor='{textField}'/> - </cell> - - <cell> - <JTextField id='textField'/> - </cell> - </row> - - <row> - <cell columns='2'> - <JButton text='Greet' - onActionPerformed='JOptionPane.showMessageDialog(demoPanel, "Hello, " + textField.getText() + "!")'/> - </cell> - </row> - </Table> - </JPanel> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/JToggleButtonDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/JToggleButtonDemo.jaxx deleted file mode 100644 index 01f29de..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/JToggleButtonDemo.jaxx +++ /dev/null @@ -1,9 +0,0 @@ -<DemoPanel> - <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <JToggleButton text='1' id='one'/> - <JToggleButton text='2' id='two'/> - <JToggleButton text='3' id='three'/> - - <JLabel text='Total: {(one.isSelected() ? 1 : 0) + (two.isSelected() ? 2 : 0) + (three.isSelected() ? 3 : 0)}'/> - </HBox> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/LabelStyle.css b/jaxx-example/src/main/java/jaxx/demo/LabelStyle.css deleted file mode 100644 index 8fe50a3..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/LabelStyle.css +++ /dev/null @@ -1,43 +0,0 @@ -JSlider { - paintTicks: true; -} - -JSlider.color { - minorTickSpacing: 10; - majorTickSpacing: 50; - border: { BorderFactory . createEmptyBorder( 1, 1, 1, 1 ) -} - -; -} - -JSlider.color:focused { - border: { BorderFactory . createLineBorder( Color . BLACK, 1 ) -} - -; -} - -JSlider#red:focused { - background: #E7ADAD; -} - -JSlider#green:focused { - background: #B2E7AD; -} - -JSlider#blue:focused { - background: #ADB2E7; -} - -JSlider#dummySize { - minorTickSpacing: 2; - majorTickSpacing: 6; -} - -JRadioButton { - enabled: { backgroundCheckbox . isSelected( ) -} - -; -} \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/LabelStyleDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/LabelStyleDemo.jaxx deleted file mode 100644 index 8862635..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/LabelStyleDemo.jaxx +++ /dev/null @@ -1,85 +0,0 @@ -<DemoPanel> - <style source="LabelStyle.css"/> - - <Table id='demoPanel' anchor='north' fill='both'> - <row> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JTextField id='text' text='Data Binding'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Red:'/> - </cell> - <cell> - <JSlider id='red' value='128' maximum='255' styleClass='color'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Green:'/> - </cell> - <cell> - <JSlider id='green' value='0' maximum='255' styleClass='color'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Blue:'/> - </cell> - <cell> - <JSlider id='blue' value='255' maximum='255' styleClass='color'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Size:'/> - </cell> - <cell> - <JSlider id='dummySize' value='36' minimum='6' maximum='60'/> - </cell> - </row> - - <row> - <cell columns='2' fill='both' weighty='1'> - <JPanel border='{BorderFactory.createTitledBorder("Preview")}' - height='90' - layout='{new BorderLayout()}'> - <VBox background='{(Color)( backgroundCheckbox.isSelected() ? backgroundColor.getSelectedValue() : null)}' - margin='0' - horizontalAlignment='center' - verticalAlignment='middle'> - <JLabel text='{text.getText()}' font-size='{dummySize.getValue()}' - foreground='{new Color(red.getValue(), green.getValue(), blue.getValue())}'/> - </VBox> - </JPanel> - </cell> - </row> - </Table> - </cell> - - <cell> - <VBox spacing='0' border='{BorderFactory.createTitledBorder("Background")}'> - <JCheckBox id='backgroundCheckbox' text='Show Background'/> - <JRadioButton text='Red' buttonGroup='backgroundColor' value='{Color.RED}' selected='true'/> - <JRadioButton text='Orange' buttonGroup='backgroundColor' value='{Color.ORANGE}'/> - <JRadioButton text='Yellow' buttonGroup='backgroundColor' value='{Color.YELLOW}'/> - <JRadioButton text='Green' buttonGroup='backgroundColor' value='{Color.GREEN}'/> - <JRadioButton text='Cyan' buttonGroup='backgroundColor' value='{Color.CYAN}'/> - <JRadioButton text='Blue' buttonGroup='backgroundColor' value='{Color.BLUE}'/> - <JRadioButton text='Purple' buttonGroup='backgroundColor' value='{new Color(160, 30, 255)}'/> - </VBox> - </cell> - </row> - </Table> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/Model.java b/jaxx-example/src/main/java/jaxx/demo/Model.java deleted file mode 100644 index 873d638..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/Model.java +++ /dev/null @@ -1,66 +0,0 @@ -package jaxx.demo; - -import java.beans.*; - -public class Model { - - protected String text = "text"; - - protected String text2 = "text2"; - - protected int ratio = 51; - - - PropertyChangeSupport p; - - public Model() { - p = new PropertyChangeSupport(this); - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - p.addPropertyChangeListener(listener); - } - - public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { - p.addPropertyChangeListener(propertyName, listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - p.removePropertyChangeListener(listener); - } - - public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { - p.removePropertyChangeListener(propertyName, listener); - } - - - public String getText() { - return text; - } - - public String getText2() { - return text2; - } - - public int getRatio() { - return ratio; - } - - public void setText(String text) { - String oldText = this.text; - this.text = text; - p.firePropertyChange("text", oldText, text); - } - - public void setText2(String text2) { - String oldText2 = this.text2; - this.text2 = text2; - p.firePropertyChange("text2", oldText2, text2); - } - - public void setRatio(int ratio) { - int oldRatio = this.ratio; - this.ratio = ratio; - p.firePropertyChange("ratio", oldRatio, ratio); - } -} \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/NumberEditorDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/NumberEditorDemo.jaxx deleted file mode 100644 index c7d822d..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/NumberEditorDemo.jaxx +++ /dev/null @@ -1,132 +0,0 @@ - -<DemoPanel> - <script><![CDATA[ -import jaxx.runtime.swing.editor.NumberEditor; - -void $afterCompleteSetup() { - positifIntegerEditor.init(); - positifIntegerEditor2.init(); - normalIntegerEditor.init(); - normalIntegerEditor2.init(); - positifFloatEditor.init(); - positifFloatEditor2.init(); - normalFloatEditor.init(); - normalFloatEditor2.init(); -} -]]> - </script> - - <!-- model --> - <NumberEditorDemoModel id='demoModel'/> - - <Table id='demoPanel' insets='0' fill='both'> - <row> - <cell weightx='0.5'> - <JLabel horizontalAlignment='center' text='numbereditor.type'/> - </cell> - <cell weightx='0.25'> - <JLabel horizontalAlignment='center' text='numbereditor.without.auto.popup'/> - </cell> - <cell weightx='0.25'> - <JLabel horizontalAlignment='center' text='numbereditor.with.auto.popup'/> - </cell> - </row> - <row> - <cell> - <JLabel text='{_("numbereditor.positive.int", demoModel.getPositifInteger())}'/> - </cell> - <cell> - <NumberEditor id='positifIntegerEditor' - property='positifInteger' - constructorParams='this' - bean='{demoModel}' - autoPopup='false' - showPopupButton='true' - showReset='true'/> - </cell> - <cell> - <NumberEditor id='positifIntegerEditor2' - property='positifInteger' - constructorParams='this' - bean='{demoModel}' - autoPopup='true' - showPopupButton='true' - showReset='true'/> - </cell> - </row> - <row> - <cell> - <JLabel text='{_("numbereditor.normal.int", demoModel.getNormalInteger())}'/> - </cell> - <cell> - <NumberEditor id='normalIntegerEditor' - property='normalInteger' - constructorParams='this' - bean='{demoModel}' - autoPopup='false' - showPopupButton='true' - showReset='true' - useSign='true'/> - </cell> - <cell> - <NumberEditor id='normalIntegerEditor2' - property='normalInteger' - constructorParams='this' - bean='{demoModel}' - autoPopup='true' - showPopupButton='true' - showReset='true' - useSign='true'/> - </cell> - </row> - <row> - <cell> - <JLabel text='{_("numbereditor.positive.float", demoModel.getPositifFloat())}'/> - </cell> - <cell> - <NumberEditor id='positifFloatEditor' - property='positifFloat' - constructorParams='this' - bean='{demoModel}' - autoPopup='false' - showPopupButton='true' - showReset='true'/> - </cell> - <cell> - <NumberEditor id='positifFloatEditor2' - property='positifFloat' - constructorParams='this' - bean='{demoModel}' - autoPopup='true' - showPopupButton='true' - showReset='true'/> - </cell> - </row> - <row> - <cell> - <JLabel text='{_("numbereditor.normal.float", demoModel.getNormalFloat())}'/> - </cell> - <cell> - <NumberEditor id='normalFloatEditor' - property='normalFloat' - constructorParams='this' - bean='{demoModel}' - autoPopup='false' - showPopupButton='true' - showReset='true' - useSign='true'/> - </cell> - <cell> - <NumberEditor id='normalFloatEditor2' - property='normalFloat' - constructorParams='this' - bean='{demoModel}' - autoPopup='true' - showPopupButton='true' - showReset='true' - useSign='true'/> - </cell> - </row> - </Table> - -</DemoPanel> diff --git a/jaxx-example/src/main/java/jaxx/demo/NumberEditorDemoModel.java b/jaxx-example/src/main/java/jaxx/demo/NumberEditorDemoModel.java deleted file mode 100644 index 0e64f8d..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/NumberEditorDemoModel.java +++ /dev/null @@ -1,78 +0,0 @@ -package jaxx.demo; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; - -/** - * - * @author chemit - * @since 1.5 - */ -public class NumberEditorDemoModel { - - protected PropertyChangeSupport p; - protected int positifInteger; - protected int normalInteger; - protected float positifFloat; - protected float normalFloat; - - public NumberEditorDemoModel() { - p = new PropertyChangeSupport(this); - } - - public float getNormalFloat() { - return normalFloat; - } - - public int getNormalInteger() { - return normalInteger; - } - - public float getPositifFloat() { - return positifFloat; - } - - public int getPositifInteger() { - return positifInteger; - } - - public void setNormalFloat(float normalFloat) { - float old = this.normalFloat; - this.normalFloat = normalFloat; - p.firePropertyChange("normalFloat", old, normalFloat); - } - - public void setNormalInteger(int normalInteger) { - int old = this.normalInteger; - this.normalInteger = normalInteger; - p.firePropertyChange("normalInteger", old, normalInteger); - } - - public void setPositifFloat(float positifFloat) { - float old = this.positifFloat; - this.positifFloat = positifFloat; - p.firePropertyChange("positifFloat", old, positifFloat); - } - - public void setPositifInteger(int positifInteger) { - int old = this.positifInteger; - this.positifInteger = positifInteger; - p.firePropertyChange("positifInteger", old, positifInteger); - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - p.addPropertyChangeListener(listener); - } - - public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { - p.addPropertyChangeListener(propertyName, listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - p.removePropertyChangeListener(listener); - } - - public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { - p.removePropertyChangeListener(propertyName, listener); - } -} diff --git a/jaxx-example/src/main/java/jaxx/demo/StatusMessagePanelDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/StatusMessagePanelDemo.jaxx deleted file mode 100644 index 45ee421..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/StatusMessagePanelDemo.jaxx +++ /dev/null @@ -1,11 +0,0 @@ -<DemoPanel> - <JPanel id='demoPanel' layout='{new BorderLayout()}'> - <JPanel layout='{new GridLayout(0,1)}' constraints='BorderLayout.CENTER'> - <JButton text='Fool me once' - onActionPerformed='p.setStatus(((JButton)event.getSource()).getText() + " ? shame on you!")'/> - <JButton text='Fool me twice' - onActionPerformed='p.setStatus(((JButton)event.getSource()).getText() + " ? shame on ...")'/> - </JPanel> - <jaxx.runtime.swing.StatusMessagePanel id='p' constraints='BorderLayout.SOUTH'/> - </JPanel> -</DemoPanel> \ No newline at end of file diff --git a/jaxx-example/src/main/java/jaxx/demo/Validation.css b/jaxx-example/src/main/java/jaxx/demo/Validation.css deleted file mode 100644 index 7479d16..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/Validation.css +++ /dev/null @@ -1,5 +0,0 @@ -JSlider { - paintTicks: true; - minorTickSpacing: 5; - majorTickSpacing: 10; -} diff --git a/jaxx-example/src/main/java/jaxx/demo/ValidationListDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/ValidationListDemo.jaxx deleted file mode 100644 index 888c5df..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/ValidationListDemo.jaxx +++ /dev/null @@ -1,325 +0,0 @@ -<DemoPanel> - <style source="Validation.css"/> - -<script><![CDATA[ -import static org.nuiton.i18n.I18n.n_; -void $afterCompleteSetup() { -}]]> -</script> - <!-- models --> - <Model id='model1'/> - <Model id='model2'/> - <Identity id='identity'/> - - <!-- errors model --> - <!-- Not existing :) --> - <!--jaxx.runtime.validator.gwt.GWTValidatorMessageListModel id='errors'--> - <jaxx.runtime.validator.swing.SwingValidatorMessageListModel id='errors' - onContentsChanged='ok.setEnabled(errors.isEmpty())'/> - - <!-- validators --> - <BeanValidator id='validator' bean='model1' uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - <field name="text"/> - <field name="text2"/> - <field name="ratio"/> - </BeanValidator> - <BeanValidator id='validator2' bean='model2' uiClass="jaxx.runtime.validator.swing.ui.IconValidationUI"> - <field name="text" component="_text"/> - <field name="text2" component="_text2"/> - <field name="ratio" component="_ratio"/> - </BeanValidator> - <BeanValidator id='validator3' autoField='true' bean='identity' - uiClass="jaxx.runtime.validator.swing.ui.TranslucentValidationUI"> - <field name="email" component="email2"/> - </BeanValidator> - - <Table fill='both' id='demoPanel'> - <row> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Form")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JTextField id='text' text='{model1.getText()}' - _validatorLabel='{n_("form.text")}' - onKeyReleased='model1.setText(text.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JTextField id='text2' text='{model1.getText2()}' - _validatorLabel='{n_("form.text2")}' - onKeyReleased='model1.setText2(text2.getText())'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JSlider id='ratio' minimum='0' maximum='100' - value='{model1.getRatio()}' - _validatorLabel='{n_("form.ratio")}' - onStateChanged='model1.setRatio(ratio.getValue())'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Model")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model1.getText()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model1.getText2()}'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JLabel text='{model1.getRatio()}'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - </row> - <row> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Form2")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JTextField id='_text' text='{model2.getText()}' - _validatorLabel='{n_("form2.text")}' - onKeyReleased='model2.setText(_text.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JTextField id='_text2' text='{model2.getText2()}' - _validatorLabel='{n_("form2.text2")}' - onKeyReleased='model2.setText2(_text2.getText())'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JSlider id='_ratio' minimum='0' maximum='100' - value='{model2.getRatio()}' - _validatorLabel='{n_("form2.ratio")}' - onStateChanged='model2.setRatio(_ratio.getValue())'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Model2")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model2.getText()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model2.getText2()}'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JLabel text='{model2.getRatio()}'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - </row> - <row> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Identify Form")}' - layout='{new GridLayout()}' width='250' height='180'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='FirstName:'/> - </cell> - <cell weightx='1'> - <JTextField id='firstName' text='{identity.getFirstName()}' - onKeyReleased='identity.setFirstName(firstName.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='LastName:'/> - </cell> - <cell weightx='1'> - <JTextField id='lastName' text='{identity.getLastName()}' - onKeyReleased='identity.setLastName(lastName.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Email:'/> - </cell> - <cell weightx='1'> - <JTextField id='email2' text='{identity.getEmail()}' - onKeyReleased='identity.setEmail(email2.getText())'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Age:'/> - </cell> - <cell> - <JSlider id='age' minimum='0' maximum='100' value='{identity.getAge()}' - onStateChanged='identity.setAge(age.getValue())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Config file :'/> - </cell> - <cell> - <JTextField id='config' text='{identity.getConfig()}' - onKeyReleased='identity.setConfig(new java.io.File(config.getText()))'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Working directory:'/> - </cell> - <cell> - <JTextField id='dir' text='{identity.getDir()}' - onKeyReleased='identity.setDir(new java.io.File(dir.getText()))'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Identity Model")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='FirstName:'/> - </cell> - <cell weightx='1'> - <JLabel text='{identity.getFirstName()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='LastName:'/> - </cell> - <cell weightx='1'> - <JLabel text='{identity.getLastName()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Email:'/> - </cell> - <cell weightx='1'> - <JLabel text='{identity.getEmail()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Age:'/> - </cell> - <cell> - <JLabel text='{identity.getAge()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Config file:'/> - </cell> - <cell> - <JLabel text='{identity.getConfig()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Directory file:'/> - </cell> - <cell> - <JLabel text='{identity.getDir()}'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - </row> - <row> - <cell columns='2' fill="both"> - <JPanel border='{BorderFactory.createTitledBorder("Messages")}' layout='{new GridLayout()}' height='200' - width='500'> - <JScrollPane> - <JList id='errorList' model='{errors}' - cellRenderer='{new jaxx.runtime.validator.swing.SwingValidatorMessageListRenderer()}'/> - </JScrollPane> - </JPanel> - </cell> - </row> - <row> - <cell columns='2' fill="both"> - <JPanel layout='{new GridLayout(1,2,0,0)}'> - <JButton id='cancel' text='cancel' - onActionPerformed='JOptionPane.showMessageDialog(this, cancel.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> - <JButton id='ok' text='valid' - onActionPerformed='JOptionPane.showMessageDialog(this, ok.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> - </JPanel> - </cell> - </row> - </Table> - -</DemoPanel> diff --git a/jaxx-example/src/main/java/jaxx/demo/ValidationTableDemo.jaxx b/jaxx-example/src/main/java/jaxx/demo/ValidationTableDemo.jaxx deleted file mode 100644 index 41b586d..0000000 --- a/jaxx-example/src/main/java/jaxx/demo/ValidationTableDemo.jaxx +++ /dev/null @@ -1,331 +0,0 @@ -<DemoPanel> - <style source="Validation.css"/> - - <!-- models --> - <Model id='model1'/> - <Model id='model2'/> - <Identity id='identity'/> - - <!-- errors model --> - <!-- Not existing :) --> - <!--jaxx.runtime.validator.gwt.GWTValidatorMessageTableModel id='errors2'/--> - <jaxx.runtime.validator.swing.SwingValidatorMessageTableModel id='errors2' - onTableChanged='ok.setEnabled(errors2.getRowCount()==0)'/> - - <!-- validators --> - <BeanValidator id='validator' bean='model1' uiClass="jaxx.runtime.validator.swing.ui.ImageValidationUI"> - <field name="text"/> - <field name="text2"/> - <field name="ratio"/> - </BeanValidator> - <BeanValidator id='validator2' bean='model2' uiClass="jaxx.runtime.validator.swing.ui.IconValidationUI"> - <field name="text" component="_text"/> - <field name="text2" component="_text2"/> - <field name="ratio" component="_ratio"/> - </BeanValidator> - <BeanValidator id='validator3' autoField='true' bean='identity' - uiClass="jaxx.runtime.validator.swing.ui.TranslucentValidationUI"> - <field name="email" component="email2"/> - </BeanValidator> - - <script><![CDATA[ -import static org.nuiton.i18n.I18n.n_; -import jaxx.runtime.SwingUtil; - -void $afterCompleteSetup() { - jaxx.runtime.SwingValidatorUtil.installUI(errorTable, new jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer()); -} -]]></script> - - <Table fill='both' id='demoPanel'> - <row> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Form")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JTextField id='text' text='{model1.getText()}' - onKeyReleased='model1.setText(text.getText())' - _validatorLabel='{n_("form.text")}' - /> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JTextField id='text2' text='{model1.getText2()}' - onKeyReleased='model1.setText2(text2.getText())' - _validatorLabel='{n_("form.text2")}' - /> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JSlider id='ratio' minimum='0' maximum='100' - value='{model1.getRatio()}' - _validatorLabel='{n_("form.ratio")}' - onStateChanged='model1.setRatio(ratio.getValue())'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Model")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model1.getText()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model1.getText2()}'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JLabel text='{model1.getRatio()}'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - </row> - <row> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Form2")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JTextField id='_text' text='{model2.getText()}' - _validatorLabel='{n_("form2.text")}' - onKeyReleased='model2.setText(_text.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JTextField id='_text2' text='{model2.getText2()}' - _validatorLabel='{n_("form2.text2")}' - onKeyReleased='model2.setText2(_text2.getText())'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JSlider id='_ratio' minimum='0' maximum='100' - value='{model2.getRatio()}' - _validatorLabel='{n_("form2.ratio")}' - onStateChanged='model2.setRatio(_ratio.getValue())'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Model2")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='Text:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model2.getText()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Text2:'/> - </cell> - <cell weightx='1'> - <JLabel text='{model2.getText2()}'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Ratio:'/> - </cell> - <cell> - <JLabel text='{model2.getRatio()}'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - </row> - <row> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Identify Form")}' - layout='{new GridLayout()}' width='250' height='180'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='FirstName:'/> - </cell> - <cell weightx='1'> - <JTextField id='firstName' text='{identity.getFirstName()}' - onKeyReleased='identity.setFirstName(firstName.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='LastName:'/> - </cell> - <cell weightx='1'> - <JTextField id='lastName' text='{identity.getLastName()}' - onKeyReleased='identity.setLastName(lastName.getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Email:'/> - </cell> - <cell weightx='1'> - <JTextField id='email2' text='{identity.getEmail()}' - onKeyReleased='identity.setEmail(email2.getText())'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Age:'/> - </cell> - <cell> - <JSlider id='age' minimum='0' maximum='100' value='{identity.getAge()}' - onStateChanged='identity.setAge(age.getValue())'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Config file :'/> - </cell> - <cell> - <JTextField id='config' text='{identity.getConfig()}' - onKeyReleased='identity.setConfig(new java.io.File(config.getText()))'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Working directory:'/> - </cell> - <cell> - <JTextField id='dir' text='{identity.getDir()}' - onKeyReleased='identity.setDir(new java.io.File(dir.getText()))'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - <cell weightx='1' weighty='1' insets='6, 3, 0, 0'> - <JPanel border='{BorderFactory.createTitledBorder("Identity Model")}' - layout='{new GridLayout()}' width='250' height='120'> - <Table anchor='west' fill='both'> - <row> - <cell> - <JLabel text='FirstName:'/> - </cell> - <cell weightx='1'> - <JLabel text='{identity.getFirstName()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='LastName:'/> - </cell> - <cell weightx='1'> - <JLabel text='{identity.getLastName()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Email:'/> - </cell> - <cell weightx='1'> - <JLabel text='{identity.getEmail()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Age:'/> - </cell> - <cell> - <JLabel text='{identity.getAge()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Config file:'/> - </cell> - <cell> - <JLabel text='{identity.getConfig()}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='Directory file:'/> - </cell> - <cell> - <JLabel text='{identity.getDir()}'/> - </cell> - </row> - </Table> - </JPanel> - </cell> - </row> - <row> - <cell columns='2' fill="both"> - <JPanel border='{BorderFactory.createTitledBorder("Messages")}' layout='{new GridLayout()}' height='200' - width='500'> - <JScrollPane columnHeaderView='{errorTable.getTableHeader()}'> - <JTable id='errorTable' model='{errors2}' rowSelectionAllowed='true' autoCreateRowSorter='true' - autoResizeMode='2' cellSelectionEnabled='false' selectionMode='0'/> - </JScrollPane> - </JPanel> - </cell> - </row> - <row> - <cell columns='2' fill="both"> - <JPanel layout='{new GridLayout(1,2,0,0)}'> - <JButton id='cancel' text='cancel' - onActionPerformed='JOptionPane.showMessageDialog(this, cancel.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> - <JButton id='ok' text='valid' - onActionPerformed='JOptionPane.showMessageDialog(this, ok.getText() + " clicked!", "onActionPerformed", JOptionPane.INFORMATION_MESSAGE);'/> - </JPanel> - </cell> - </row> - </Table> - -</DemoPanel> diff --git a/jaxx-example/src/main/jnlp/jxlayer.jnlp b/jaxx-example/src/main/jnlp/jxlayer.jnlp deleted file mode 100644 index ef01376..0000000 --- a/jaxx-example/src/main/jnlp/jxlayer.jnlp +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<jnlp spec="1.0+" codebase="@url@" href="jxlayer.jnlp"> - <information> - <title>Sun MicroSystems</title> - <vendor>Sun MicroSystems, Inc.</vendor> - <offline-allowed/> - </information> - <resources> - <jar href="lib/@lib@"/> - </resources> - <component-desc/> -</jnlp> \ No newline at end of file diff --git a/jaxx-example/src/main/jnlp/sun.jnlp b/jaxx-example/src/main/jnlp/sun.jnlp deleted file mode 100644 index f345d95..0000000 --- a/jaxx-example/src/main/jnlp/sun.jnlp +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<jnlp spec="1.0+" codebase="@url@" href="sun.jnlp"> - <information> - <title>Sun MicroSystems</title> - <vendor>Sun MicroSystems, Inc.</vendor> - <offline-allowed/> - </information> - <resources> - <jar href="lib/@lib@"/> - </resources> - <component-desc/> -</jnlp> \ No newline at end of file diff --git a/jaxx-example/src/main/resources/i18n/jaxx-example-en_GB.properties b/jaxx-example/src/main/resources/i18n/jaxx-example-en_GB.properties deleted file mode 100644 index 48f0c56..0000000 --- a/jaxx-example/src/main/resources/i18n/jaxx-example-en_GB.properties +++ /dev/null @@ -1,142 +0,0 @@ --= -.= -0= -1= -10= -12= -14= -18= -2= -24= -3= -4= -5= -6= -7= -8= -9= -Age\:= -Animal= -Blue= -Blue\:= -Bold= -Button\ label\:= -C= -CE= -Cancel= -Change\ layer\ state= -Click\ me= -Comments\:= -Config\ file\ \:= -Config\ file\:= -Cyan= -Dec\ (-)= -Demo= -Directory\ file\:= -Editable= -Email\ Address\:= -Email\:= -Empty\ I18n\ editor\:= -Enabled= -EnumEditor\ (country)\ \:= -EnumEditor\ (language)\ \:= -Fancy\ Button= -First\ Name\:= -FirstName\:= -Font\ size= -Fool\ me\ once= -Fool\ me\ twice= -Green= -Green\:= -Greet= -I18n\ editor\ with\ no\ icon\ \:= -I18n\ editor\ with\ no\ text\ \:= -I18n\ editor\:= -Inc\ (+)= -Italic= -JAXX\ Demo= -JMenu\ demo= -Last\ Name\:= -LastName\:= -Locale\ editor\:= -Message\ Box= -Mineral= -Normal\ text\:= -OK= -Orange= -Password\:= -Purple= -Ratio\:= -Red= -Red\:= -Reset= -Show\ Background= -Show\ password\ dialog= -Sign\ on= -Simple\ Button= -Size\:= -Source= -Spacing\:= -Start= -Stop= -Supported\ Swing\ components\:= -Text2\:= -Text\:= -Underline= -Upper\ case\ text\:= -Use\ the\ spinner\ to= -Username\:= -Vegetable= -View= -Welcome\ to\ the\ JAXX\ framework\!= -Working\ directory\:= -Yellow= -Your\ name\:= -\\u00f7= -adjust\ the\ spacing= -between\ these\ lines= -button\ A= -button\ B= -button\ C= -button\ C\ (full\ block)= -button\ D\ (full\ block\ 2)= -button\ with\ layer= -cancel= -close= -close2= -close3= -edit= -edit2= -edit3= -emptyNode=< empty node > -form.ratio=Form \: ratio -form.text=Form \: text -form.text2=Form \: text2 -form2.ratio=Form2 \: ratio -form2.text=Form2 \: text -form2.text2=Form2 \: text2 -no\ layer= -numbereditor.normal.float= -numbereditor.normal.float.value= -numbereditor.normal.int= -numbereditor.normal.int.value= -numbereditor.positive.float= -numbereditor.positive.float.value= -numbereditor.positive.int= -numbereditor.positive.int.value= -numbereditor.positive.integer=Simple positive integer editor -numbereditor.type= -numbereditor.with.auto.popup= -numbereditor.without.auto.popup= -valid= -validator.field=Champ -validator.field.header.tip= -validator.field.tip= -validator.message=Message -validator.message.header.tip= -validator.message.tip= -validator.scope=... -validator.scope.header.tip= -validator.scope.tip= -with\ layer= -x= diff --git a/jaxx-example/src/main/resources/i18n/jaxx-example-fr_FR.properties b/jaxx-example/src/main/resources/i18n/jaxx-example-fr_FR.properties deleted file mode 100644 index d96a3a3..0000000 --- a/jaxx-example/src/main/resources/i18n/jaxx-example-fr_FR.properties +++ /dev/null @@ -1,134 +0,0 @@ --= -.= -0= -1= -10= -12= -14= -18= -2= -24= -3= -4= -5= -6= -7= -8= -9= -Age\:= -Animal= -Blue= -Blue\:= -Bold= -Button\ label\:= -C= -CE= -Cancel= -Change\ layer\ state= -Click\ me= -Comments\:= -Config\ file\ \:= -Config\ file\:= -Cyan= -Dec\ (-)= -Demo= -Directory\ file\:= -Editable= -Email\ Address\:= -Email\:= -Empty\ I18n\ editor\:= -Enabled= -EnumEditor\ (country)\ \:= -EnumEditor\ (language)\ \:= -Fancy\ Button= -First\ Name\:= -FirstName\:= -Font\ size= -Fool\ me\ once= -Fool\ me\ twice= -Green= -Green\:= -Greet= -I18n\ editor\ with\ no\ icon\ \:= -I18n\ editor\ with\ no\ text\ \:= -I18n\ editor\:= -Inc\ (+)= -Italic= -JAXX\ Demo= -JMenu\ demo= -Last\ Name\:= -LastName\:= -Locale\ editor\:= -Message\ Box= -Mineral= -Normal\ text\:= -OK= -Orange= -Password\:= -Purple= -Ratio\:= -Red= -Red\:= -Reset= -Show\ Background= -Show\ password\ dialog= -Sign\ on= -Simple\ Button= -Size\:= -Source= -Spacing\:= -Start= -Stop= -Supported\ Swing\ components\:= -Text2\:= -Text\:= -Underline= -Upper\ case\ text\:= -Use\ the\ spinner\ to= -Username\:= -Vegetable= -View= -Welcome\ to\ the\ JAXX\ framework\!= -Working\ directory\:= -Yellow= -Your\ name\:= -\\u00f7= -adjust\ the\ spacing= -between\ these\ lines= -button\ A= -button\ B= -button\ C= -button\ C\ (full\ block)= -button\ D\ (full\ block\ 2)= -button\ with\ layer= -cancel= -close= -close2= -close3= -edit= -edit2= -edit3= -emptyNode=< empty node > -form.ratio=Form \: ratio -form.text=Form \: text -form.text2=Form \: text2 -form2.ratio=Form2 \: ratio -form2.text=Form2 \: text -form2.text2=Form2 \: text2 -no\ layer= -numbereditor.normal.float=D\u00E9cimal primitif \: [%1$s] -numbereditor.normal.int=Entier primitif \: [%1$s] -numbereditor.positive.float=D\u00E9cimal primitif positif \: [%1$s] -numbereditor.positive.int=Entier primitif positif \: [%1$s] -numbereditor.type=Type d'\u00E9diteur -numbereditor.with.auto.popup=Avec popup auto -numbereditor.without.auto.popup=Sans popup auto -valid= -validator.field= -validator.field.header.tip= -validator.message= -validator.message.header.tip= -validator.scope= -validator.scope.header.tip= -with\ layer= -x= diff --git a/jaxx-example/src/main/resources/icons/action-accept.png b/jaxx-example/src/main/resources/icons/action-accept.png deleted file mode 100644 index 89c8129..0000000 Binary files a/jaxx-example/src/main/resources/icons/action-accept.png and /dev/null differ diff --git a/jaxx-example/src/main/resources/icons/action-block.png b/jaxx-example/src/main/resources/icons/action-block.png deleted file mode 100644 index aba044b..0000000 Binary files a/jaxx-example/src/main/resources/icons/action-block.png and /dev/null differ diff --git a/jaxx-example/src/main/resources/jaxx/demo/Identity-error-validation.xml b/jaxx-example/src/main/resources/jaxx/demo/Identity-error-validation.xml deleted file mode 100644 index 86da73d..0000000 --- a/jaxx-example/src/main/resources/jaxx/demo/Identity-error-validation.xml +++ /dev/null @@ -1,49 +0,0 @@ -<!DOCTYPE validators PUBLIC - "-//OpenSymphony Group//XWork Validator 1.0.2//EN" - "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> -<validators> - <field name="firstName"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a firstName.</message> - </field-validator> - </field> - <field name="lastName"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a lastName.</message> - </field-validator> - </field> - - <field name="email"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a value for email.</message> - </field-validator> - <field-validator type="email" short-circuit="true"> - <message>Not a valid e-mail.</message> - </field-validator> - </field> - - <field name="config"> - <field-validator type="requiredFile" short-circuit="true"> - <message>You must enter a value for config.</message> - </field-validator> - <field-validator type="existingFile" short-circuit="true"> - <message>The configuration file ${config} does not exist.</message> - </field-validator> - </field> - - <field name="dir"> - <field-validator type="requiredFile" short-circuit="true"> - <message>You must enter a value for dir.</message> - </field-validator> - <field-validator type="existingDirectory" short-circuit="true"> - <message>The directory ${dir} does not exist.</message> - </field-validator> - </field> - - <field name="age"> - <field-validator type="int"> - <param name="min">18</param> - <message>Your are too young (min ${min} )</message> - </field-validator> - </field> -</validators> \ No newline at end of file diff --git a/jaxx-example/src/main/resources/jaxx/demo/Identity-info-validation.xml b/jaxx-example/src/main/resources/jaxx/demo/Identity-info-validation.xml deleted file mode 100644 index b515a92..0000000 --- a/jaxx-example/src/main/resources/jaxx/demo/Identity-info-validation.xml +++ /dev/null @@ -1,49 +0,0 @@ -<!DOCTYPE validators PUBLIC - "-//OpenSymphony Group//XWork Validator 1.0.2//EN" - "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> -<validators> - <!--field name="firstName"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a firstName.</message> - </field-validator> - </field> - <field name="lastName"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a lastName.</message> - </field-validator> - </field> - - <field name="email"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a value for email.</message> - </field-validator> - <field-validator type="email" short-circuit="true"> - <message>Not a valid e-mail.</message> - </field-validator> - </field> - - <field name="config"> - <field-validator type="requiredFile" short-circuit="true"> - <message>You must enter a value for config.</message> - </field-validator> - <field-validator type="existingFile" short-circuit="true"> - <message>The configuration file ${config} does not exist.</message> - </field-validator> - </field> - - <field name="dir"> - <field-validator type="requiredFile" short-circuit="true"> - <message>You must enter a value for dir.</message> - </field-validator> - <field-validator type="existingDirectory" short-circuit="true"> - <message>The directory ${dir} does not exist.</message> - </field-validator> - </field--> - - <field name="age"> - <field-validator type="int"> - <param name="min">25</param> - <message>You are still young ( old ${min} ) </message> - </field-validator> - </field> -</validators> \ No newline at end of file diff --git a/jaxx-example/src/main/resources/jaxx/demo/Identity-warning-validation.xml b/jaxx-example/src/main/resources/jaxx/demo/Identity-warning-validation.xml deleted file mode 100644 index ece44f3..0000000 --- a/jaxx-example/src/main/resources/jaxx/demo/Identity-warning-validation.xml +++ /dev/null @@ -1,49 +0,0 @@ -<!DOCTYPE validators PUBLIC - "-//OpenSymphony Group//XWork Validator 1.0.2//EN" - "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> -<validators> - <!--field name="firstName"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a firstName.</message> - </field-validator> - </field> - <field name="lastName"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a lastName.</message> - </field-validator> - </field> - - <field name="email"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a value for email.</message> - </field-validator> - <field-validator type="email" short-circuit="true"> - <message>Not a valid e-mail.</message> - </field-validator> - </field> - - <field name="config"> - <field-validator type="requiredFile" short-circuit="true"> - <message>You must enter a value for config.</message> - </field-validator> - <field-validator type="existingFile" short-circuit="true"> - <message>The configuration file ${config} does not exist.</message> - </field-validator> - </field> - - <field name="dir"> - <field-validator type="requiredFile" short-circuit="true"> - <message>You must enter a value for dir.</message> - </field-validator> - <field-validator type="existingDirectory" short-circuit="true"> - <message>The directory ${dir} does not exist.</message> - </field-validator> - </field--> - - <field name="age"> - <field-validator type="int"> - <param name="max">88</param> - <message>Info : Your are older than ${max} !</message> - </field-validator> - </field> -</validators> \ No newline at end of file diff --git a/jaxx-example/src/main/resources/jaxx/demo/Model-error-validation.xml b/jaxx-example/src/main/resources/jaxx/demo/Model-error-validation.xml deleted file mode 100644 index 05c0d34..0000000 --- a/jaxx-example/src/main/resources/jaxx/demo/Model-error-validation.xml +++ /dev/null @@ -1,35 +0,0 @@ -<!DOCTYPE validators PUBLIC - "-//OpenSymphony Group//XWork Validator 1.0.2//EN" - "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> -<validators> - <!-- Field Validators for email field --> - <field name="text"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a value for text.</message> - </field-validator> - </field> - - <field name="text2"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a value for text2.</message> - </field-validator> - </field> - - <field name="ratio"> - <field-validator type="int"> - <param name="min">20</param> - <param name="max">50</param> - <message>Ratio needs to be between ${min} and ${max}</message> - </field-validator> - </field> - - <!-- Plain Validator 1 --> - <validator type="expression"> - <param name="expression">text.startsWith("poussin")</param> - <message>Email not starts with poussin</message> - </validator> - <validator type="expression"> - <param name="expression">text2.startsWith("chemit")</param> - <message>Email not starts with chemit</message> - </validator> -</validators> \ No newline at end of file diff --git a/jaxx-example/src/main/resources/jaxx/demo/Model-info-validation.xml b/jaxx-example/src/main/resources/jaxx/demo/Model-info-validation.xml deleted file mode 100644 index efd6249..0000000 --- a/jaxx-example/src/main/resources/jaxx/demo/Model-info-validation.xml +++ /dev/null @@ -1,13 +0,0 @@ -<!DOCTYPE validators PUBLIC - "-//OpenSymphony Group//XWork Validator 1.0.2//EN" - "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> -<validators> - <!-- Field Validators for email field --> - <field name="text"> - <field-validator type="fieldexpression"> - <param name="expression"><![CDATA[ text != null && text.length() > 10]]></param> - <message>Text should have more than 10 caracters</message> - </field-validator> - </field> - -</validators> \ No newline at end of file diff --git a/jaxx-example/src/main/resources/jaxx/demo/Model-warning-validation.xml b/jaxx-example/src/main/resources/jaxx/demo/Model-warning-validation.xml deleted file mode 100644 index 2e2e90d..0000000 --- a/jaxx-example/src/main/resources/jaxx/demo/Model-warning-validation.xml +++ /dev/null @@ -1,18 +0,0 @@ -<!DOCTYPE validators PUBLIC - "-//OpenSymphony Group//XWork Validator 1.0.2//EN" - "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> -<validators> - <!-- Field Validators for email field --> - <field name="text"> - <field-validator type="email" short-circuit="true"> - <message>Not a valid e-mail for text.</message> - </field-validator> - </field> - - <field name="text2"> - <field-validator type="requiredstring" short-circuit="true"> - <message>You must enter a value for text2.</message> - </field-validator> - </field> - -</validators> \ No newline at end of file diff --git a/jaxx-example/src/main/resources/jaxx/demo/images/Amethyst.jpg b/jaxx-example/src/main/resources/jaxx/demo/images/Amethyst.jpg deleted file mode 100644 index 72aabd2..0000000 Binary files a/jaxx-example/src/main/resources/jaxx/demo/images/Amethyst.jpg and /dev/null differ diff --git a/jaxx-example/src/main/resources/jaxx/demo/images/Lynx.jpg b/jaxx-example/src/main/resources/jaxx/demo/images/Lynx.jpg deleted file mode 100644 index 779ef43..0000000 Binary files a/jaxx-example/src/main/resources/jaxx/demo/images/Lynx.jpg and /dev/null differ diff --git a/jaxx-example/src/main/resources/jaxx/demo/images/Tomato.jpg b/jaxx-example/src/main/resources/jaxx/demo/images/Tomato.jpg deleted file mode 100644 index f6223b2..0000000 Binary files a/jaxx-example/src/main/resources/jaxx/demo/images/Tomato.jpg and /dev/null differ diff --git a/jaxx-example/src/main/resources/jaxx/demo/images/pencil_black.gif b/jaxx-example/src/main/resources/jaxx/demo/images/pencil_black.gif deleted file mode 100644 index 1dae579..0000000 Binary files a/jaxx-example/src/main/resources/jaxx/demo/images/pencil_black.gif and /dev/null differ diff --git a/jaxx-example/src/main/resources/log4j.properties b/jaxx-example/src/main/resources/log4j.properties deleted file mode 100644 index e49816c..0000000 --- a/jaxx-example/src/main/resources/log4j.properties +++ /dev/null @@ -1,10 +0,0 @@ -# Global logging configuration -log4j.rootLogger=ERROR, stdout -# Console output... -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n - -log4j.logger.demo=DEBUG -log4j.logger.jaxx=INFO -log4j.logger.org.nuiton=INFO diff --git a/jaxx-example/src/site/site.xml b/jaxx-example/src/site/site.xml deleted file mode 100644 index 9174ab8..0000000 --- a/jaxx-example/src/site/site.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="${project.name}"> - - <bannerLeft> - <name>${project.name}</name> - <src>${site.home.url}/jaxx.png</src> - <href>index.html</href> - </bannerLeft> - - <body> - - <breadcrumbs> - <item name="${project.name}" href="${project.url}" /> - </breadcrumbs> - - <menu ref="parent"/> - - <menu name="Utilisateur" inherited="top"> - <item name="Lancer la démo" href="launch-demo.jnlp"/> - </menu> - - <menu ref="reports"/> - - <menu ref="modules"/> - - </body> -</project> diff --git a/jaxx-example/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java b/jaxx-example/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java deleted file mode 100644 index e49ff8b..0000000 --- a/jaxx-example/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package jaxx.demo; - -import java.io.File; -import java.util.Iterator; -import java.util.SortedSet; -import jaxx.runtime.validator.AbstractBeanValidatorDetectorTest; -import jaxx.runtime.validator.BeanValidator; -import org.junit.BeforeClass; -import static org.junit.Assert.*; - -/** - * - * @author chemit - */ -public class BeanValidatorDetectorTest extends AbstractBeanValidatorDetectorTest { - - @BeforeClass - public static void setUpClass() throws Exception { - AbstractBeanValidatorDetectorTest.setUpClass(); - } - - public BeanValidatorDetectorTest() { - super(new File(basedir, "src" + File.separator + "main" + File.separator + "resources"), Identity.class, Model.class); - } - - @Override - protected void assertDetect(SortedSet<BeanValidator<?>> validators) { - assertFalse(validators.isEmpty()); - assertEquals(2, validators.size()); - Iterator<BeanValidator<?>> itrV = validators.iterator(); - assertValidator(Identity.class, null, itrV.next()); - assertValidator(Model.class, null, itrV.next()); - } -} \ No newline at end of file diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/Decorator.java b/jaxx-runtime-api/src/main/java/jaxx/runtime/Decorator.java deleted file mode 100644 index 8cd51bb..0000000 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/Decorator.java +++ /dev/null @@ -1,36 +0,0 @@ -package jaxx.runtime; - -/** - * A simple contract to define a String decorator on any java objet. - * - * @param <O> the type of decorated object - * @author chemit - */ -public abstract class Decorator<O> implements java.io.Serializable { - - protected final Class<O> internalClass; - private static final long serialVersionUID = -1L; - - /** - * @param internalClass the class of objects to be decorated. - * @throws NullPointerException if internalClass parameter is null - */ - public Decorator(Class<O> internalClass) throws NullPointerException { - if (internalClass == null) { - throw new NullPointerException("internalClass can not be null."); - } - this.internalClass = internalClass; - } - - /** - * @param bean the bean to decorate - * @return the string value of the given bean - */ - public abstract String toString(Object bean); - - - public final Class<O> getInternalClass() { - return internalClass; - } - -} diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/DecoratorUtils.java b/jaxx-runtime-api/src/main/java/jaxx/runtime/DecoratorUtils.java deleted file mode 100644 index f1e1916..0000000 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/DecoratorUtils.java +++ /dev/null @@ -1,111 +0,0 @@ -package jaxx.runtime; - -import java.util.List; - -/** - * - * Some usefull methods on {@link Decorator} to store and obtain decorators. - * - * Use the method {@link #registerDecorator(String, Decorator)} to register a new - * decorator. - * - * Use the method {@link #getDecorator(String)} to obtain a registred - * decorator based on his registred name. - * - * Use the method {@link #getDecorator(Class, tring)} to obtain a registred - * decorator based on the type of decorator and the registred name. - * - * @author tony - * @since 1.3 - */ -public class DecoratorUtils { - - protected static List<DecoratorContext<?>> cache; - - public static <T> void registerDecorator(String context, Decorator<T> decorator) { - DecoratorContext<T> result = getDecoratorContext(decorator.getInternalClass(), context); - - if (result != null) { - throw new IllegalArgumentException("there is an already register decorator " + result); - } - - if (cache == null) { - cache = new java.util.ArrayList<DecoratorContext<?>>(); - } - cache.add(new DecoratorContext<T>(context, decorator)); - } - - public static <T> Decorator<T> getDecorator(String context) { - Decorator<T> result = getDecorator(null, context); - return result; - } - - public static <T> Decorator<T> getDecorator(Class<T> type, String context) { - DecoratorContext<T> decoratorContext = getDecoratorContext(type, context); - Decorator<T> result = decoratorContext == null ? null : decoratorContext.getDecorator(); - return result; - } - - public static void clear() { - if (cache != null) { - cache.clear(); - } - } - - @SuppressWarnings({"unchecked"}) - protected static <T> DecoratorContext<T> getDecoratorContext(Class<T> type, String context) { - DecoratorContext<T> result = null; - if (cache != null) { - for (DecoratorContext<?> d : cache) { - if (type == null) { - if (d.accept(context)) { - result = (DecoratorContext<T>) d; - break; - } - continue; - } - if (d.accept(type, context)) { - result = (DecoratorContext<T>) d; - break; - } - } - } - return result; - } - - public static class DecoratorContext<T> { - - final String context; - final Decorator<T> decorator; - - public DecoratorContext(String context, Decorator<T> decorator) { - this.context = context; - this.decorator = decorator; - } - - public String getContext() { - return context; - } - - public Decorator<T> getDecorator() { - return decorator; - } - - public Class<T> getType() { - return decorator.getInternalClass(); - } - - public boolean accept(Class<?> type, String context) { - return getType().isAssignableFrom(type) && accept(context); - } - - public boolean accept(String context) { - return ((this.context == null && context == null) || (this.context != null && this.context.equals(context))); - } - - @Override - public String toString() { - return super.toString() + "<type: " + getType().getName() + ", context :" + context + ">"; - } - } -} diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/JXPathDecorator.java b/jaxx-runtime-api/src/main/java/jaxx/runtime/JXPathDecorator.java deleted file mode 100644 index 81458fb..0000000 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/JXPathDecorator.java +++ /dev/null @@ -1,278 +0,0 @@ -package jaxx.runtime; - -import org.apache.commons.jxpath.JXPathContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * JXPath decorator based on {@link String#format(String, Object[])} method. - * <p/> - * To use it, give to him a expression where all jxpath to apply on bean are boxed in <code>${}</code>. - * <p/> - * After the jxpath token you must specifiy the formatter to apply of the jxpath token. - * <p/> - * For example : - * <pre> - * Decorator<Object> d = JXPathDecorator.newDecorator(JXPathDecorator.class,"expr = ${expressions}$s"); - * assert "expr = %1$s" == d.getExpression(); - * assert 1 == d.getNbToken(); - * assert java.util.Arrays.asList("expression") == d.getTokens(); - * assert "expr = %1$s" == d.toString(d); - * </pre> - * - * @param <O> type of data - * @author chemit - * @see Decorator - */ -public class JXPathDecorator<O> extends Decorator<O> { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - private static final Log log = LogFactory.getLog(JXPathDecorator.class); - private static final long serialVersionUID = 1L; - - /** - * Factory method to instanciate a new {@link JXPathDecorator} for the given class {@link O} and expression. - * - * @param internalClass the class of the objects decorated by the new decorator - * @param expression the expression to use to decorated objects - * @param <O> the generic type of class to be decorated by the new decorator - * @return the new instanciated decorator - * @throws IllegalArgumentException if the expression is not valid, says: - * <p/> - * - a missing right brace was detected. - * <p/> - * - a ${ was found in a jxpath token. - * @throws NullPointerException if internalClass parameter is null. - */ - public static <O> JXPathDecorator<O> newDecorator(Class<O> internalClass, String expression) - throws IllegalArgumentException, NullPointerException { - return new JXPathDecorator<O>(internalClass, expression, true); - } - - /** - * Sort a list of data based on the first token property of a given context - * in a given decorator. - * - * @param <O> type of data to sort - * @param decorator the decorator to use to sort - * @param datas the list of data to sort - * @param pos the index of context to used in decorator to obtain sorted property. - */ - public static <O> void sort(JXPathDecorator<O> decorator, List<O> datas, int pos) { - Comparator<O> c = null; - boolean cachedComparator = false; - try { - c = decorator.getComparator(pos); - cachedComparator = c instanceof JXPathComparator<?>; - - if (cachedComparator) { - ((JXPathComparator<O>) c).init(decorator, datas); - } - Collections.sort(datas, c); - } finally { - if (cachedComparator) { - ((JXPathComparator<?>) c).clear(); - } - } - } - - public static class JXPathComparator<O> implements Comparator<O> { - - protected Map<O, Comparable<Comparable<?>>> valueCache; - private final String expression; - - public JXPathComparator(String expression) { - this.expression = expression; - this.valueCache = new HashMap<O, Comparable<Comparable<?>>>(); - } - - @Override - public int compare(O o1, O o2) { - Comparable<Comparable<?>> c1 = valueCache.get(o1); - Comparable<Comparable<?>> c2 = valueCache.get(o2); - return c1.compareTo(c2); - } - - public void clear() { - valueCache.clear(); - } - - public void init(JXPathDecorator<O> decorator, List<O> datas) { - clear(); - for (O data : datas) { - JXPathContext jxcontext = JXPathContext.newContext(data); - Comparable<Comparable<?>> key = decorator.getTokenValue(jxcontext, expression); - valueCache.put(data, key); - } - } - } - - public static class Context<O> implements java.io.Serializable { - - /** - * expression to format using {@link String#format(String, Object[])}, all variables are compute - * using using the jxpath tokens. - */ - protected String expression; - /** list of jxpath tokens to apply on expression */ - protected String[] tokens; - protected transient Comparator<O> comparator; - private static final long serialVersionUID = 1L; - - public Context(String expression, String[] tokens) { - this.expression = expression; - this.tokens = tokens; - } - - public String getFirstProperty() { - return tokens[0]; - } - - public Comparator<O> getComparator(int pos) { - if (comparator == null) { - comparator = new JXPathComparator<O>(tokens[pos]); - } - return comparator; - } - - public void setComparator(Comparator<O> comparator) { - this.comparator = comparator; - } - - @Override - public String toString() { - return "<expression:" + expression + ", tokens:" + Arrays.toString(tokens) + ">"; - } - } - /** the computed context of the decorator */ - protected Context<O> context; - /** nb jxpath tokens to compute */ - protected int nbToken; - /** the initial expression used to compute the decorator context. */ - protected String initialExpression; - - @Override - public String toString(Object bean) { - if (bean == null) { - return null; - } - JXPathContext jxcontext = JXPathContext.newContext(bean); - Object[] args = new Object[nbToken]; - - for (int i = 0; i < nbToken; i++) { - try { - args[i] = getTokenValue(jxcontext, context.tokens[i]); - } catch (Exception e) { - log.error("can not obtain token " + context.tokens[i] + "on object " + bean + " for reason " + e.getMessage(), e); - - } - } - - return String.format(context.expression, args); - } - - @SuppressWarnings({"unchecked"}) - protected Comparable<Comparable<?>> getTokenValue(JXPathContext jxcontext, String token) { - // assume all values are comparable - return (Comparable<Comparable<?>>) jxcontext.getValue(token); - } - - public String getProperty(int pos) { - return getTokens()[pos]; - } - - public String getExpression() { - return context.expression; - } - - public String[] getTokens() { - return context.tokens; - } - - public int getNbToken() { - return nbToken; - } - - public String getInitialExpression() { - return initialExpression; - } - - @Override - public String toString() { - return super.toString() + "<" + context + ">"; - } - - public void setContext(Context<O> context) { - this.context = context; - this.nbToken = context.tokens.length; - // always reset comparator - //this.context.comparator = null; - if (log.isDebugEnabled()) { - log.debug(context); - } - } - - public JXPathDecorator(Class<O> internalClass, String expression, boolean creatContext) throws IllegalArgumentException, NullPointerException { - super(internalClass); - this.initialExpression = expression; - if (creatContext) { - setContext(JXPathDecorator.<O>createInitialContext(expression)); - if (log.isDebugEnabled()) { - log.debug(expression + " --> " + this.context); - } - } - } - - @SuppressWarnings({"unchecked"}) - protected Comparator<O> getComparator(int pos) { - ensureTokenIndex(this, pos); - return context.getComparator(pos); - } - - public static <O> Context<O> createInitialContext(String expression) { - List<String> lTokens = new ArrayList<String>(); - StringBuilder buffer = new StringBuilder(); - int size = expression.length(); - int end = -1; - int start; - while ((start = expression.indexOf("${", end + 1)) > -1) { - if (start > end + 1) { - // prefix of next jxpath token - buffer.append(expression.substring(end + 1, start)); - } - // seek end of jxpath - end = expression.indexOf("}", start + 1); - if (end == -1) { - throw new IllegalArgumentException("could not find the rigth brace starting at car " + start + " : " + expression.substring(start + 2)); - } - String jxpath = expression.substring(start + 2, end); - // not allowed ${ inside a jxpath token - if (jxpath.indexOf("${") > -1) { - throw new IllegalArgumentException("could not find a ${ inside a jxpath expression at car " + (start + 2) + " : " + jxpath); - } - // save the jxpath token - lTokens.add(jxpath); - // replace jxpath token in expresion with a string format variable - buffer.append("%").append(lTokens.size()); - } - if (size > (end + 1)) { - // suffix after end jxpath (or all expression if no jxpath) - buffer.append(expression.substring(end + 1)); - } - return new Context<O>(buffer.toString(), lTokens.toArray(new String[lTokens.size()])); - } - - protected static void ensureTokenIndex(JXPathDecorator<?> decorator, int pos) { - if (pos < -1 || pos > decorator.getNbToken()) { - throw new ArrayIndexOutOfBoundsException("token index " + pos + " is out of bound, can be inside [" + 0 + "," + decorator.nbToken + "]"); - } - } -} diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/MultiJXPathDecorator.java b/jaxx-runtime-api/src/main/java/jaxx/runtime/MultiJXPathDecorator.java deleted file mode 100644 index 21eb609..0000000 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/MultiJXPathDecorator.java +++ /dev/null @@ -1,129 +0,0 @@ -package jaxx.runtime; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.StringTokenizer; - -/** - * TODO - * - * @param <O> type of decorated objects - * @author chemit - * @see jaxx.runtime.Decorator - */ -public class MultiJXPathDecorator<O> extends JXPathDecorator<O> { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - private static final Log log = LogFactory.getLog(MultiJXPathDecorator.class); - - private static final long serialVersionUID = 1L; - - public static <O> MultiJXPathDecorator<O> newDecorator(Class<O> internalClass, - String expression, - String separator) - throws IllegalArgumentException, NullPointerException { - - return newDecorator(internalClass, expression, separator, separator); - } - - public static <O> MultiJXPathDecorator<O> newDecorator(Class<O> internalClass, - String expression, - String separator, - String separatorReplacement) - throws IllegalArgumentException, NullPointerException { - - Context<O>[] contexts = createInitialContexts(expression, separator, separatorReplacement); - - return new MultiJXPathDecorator<O>(internalClass, expression, separator, separatorReplacement, contexts); - } - - protected Context<O>[] contexts; - protected String separator; - protected String separatorReplacement; - - - public MultiJXPathDecorator(Class<O> internalClass, String expression, - String separator, String separatorReplacement, - Context<O>[] contexts) throws IllegalArgumentException, NullPointerException { - super(internalClass, expression, false); - this.separator = separator; - this.separatorReplacement = separatorReplacement; - this.contexts = contexts; - - setContextIndex(0); - - if (log.isDebugEnabled()) { - log.debug(expression + " --> " + this.context); - } - } - - public void setContextIndex(int index) { - ensureContextIndex(this, index); - setContext(contexts[index]); - } - - public int getNbContext() { - return contexts.length; - } - - public String getSeparator() { - return separator; - } - - public String getSeparatorReplacement() { - return separatorReplacement; - } - - @Override - protected Comparator<O> getComparator(int pos) { - ensureContextIndex(this, pos); - Context<O> context1 = contexts[pos]; - return context1.getComparator(0); - } - - public static <O> Context<O>[] createInitialContexts(String expression, String separator, String separatorReplacement) { - int sep = expression.indexOf(separator); - if (sep == -1) { - Context<O>[] result = MultiJXPathDecorator.newInstance(1); - result[0] = createInitialContext(expression); - return result; - } - - List<String> tokens = new ArrayList<String>(); - StringTokenizer stk = new StringTokenizer(expression, separator); - while (stk.hasMoreTokens()) { - tokens.add(stk.nextToken()); - } - - int nbTokens = tokens.size(); - Context<O>[] contexts = newInstance(nbTokens); - for (int i = 0; i < nbTokens; i++) { - StringBuilder buffer = new StringBuilder(expression.length()); - for (int j = 0; j < nbTokens; j++) { - int index = (i + j) % nbTokens; - String str = tokens.get(index); - //todo replace %index with %j - buffer.append(separatorReplacement).append(str); - } - contexts[i] = createInitialContext(buffer.substring(separatorReplacement.length())); - } - return contexts; - } - - protected static void ensureContextIndex(MultiJXPathDecorator<?> decorator, int pos) { - if (pos < -1 || pos > decorator.contexts.length) { - throw new ArrayIndexOutOfBoundsException("context index " + pos + " is out of bound, can be inside [" + 0 + "," + decorator.contexts.length + "]"); - } - } - - @SuppressWarnings("unchecked") - protected static <O> Context<O>[] newInstance(int size) { - // fixme how to instanciate a typed array with no checking warning ? - return new Context[size]; - } - -} \ No newline at end of file diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/PropertyDecorator.java b/jaxx-runtime-api/src/main/java/jaxx/runtime/PropertyDecorator.java deleted file mode 100644 index ce871a6..0000000 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/PropertyDecorator.java +++ /dev/null @@ -1,94 +0,0 @@ -package jaxx.runtime; - -import org.apache.commons.beanutils.PropertyUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.beans.PropertyDescriptor; -import java.lang.reflect.Method; - -/** - * Simple property decorator based on {@link String#format(String, Object[])} method. - * <p/> - * To use it, give him a class and the property name to render. - * <p/> - * For example : - * <pre> - * Decorator<Object> d = PropertyDecorator.newDecorator(PropertyDecorator.class,"expressions"); - * </pre> - * - * @param <O> type of decorated objects - * @author chemit - * @see Decorator - */ -public class PropertyDecorator<O> extends Decorator<O> { - - private static final long serialVersionUID = 1L; - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private final Log log = LogFactory.getLog(PropertyDecorator.class); - - /** - * Factory method to instanciate a new {@link jaxx.runtime.PropertyDecorator} for the given class {@link O} and a - * readable property name. - * - * @param internalClass the class of the objects decorated by the new decorator - * @param property the property - * @param <O> the generic type of class to be decorated by the new decorator - * @return the new instanciated decorator - * @throws IllegalArgumentException if the expression is not valid, says: - * <p/> - * - a missing right brace was detected. - * <p/> - * - a ${ was found in a jxpath token. - * @throws NullPointerException if internalClass parameter is null. - */ - public static <O> PropertyDecorator<O> newDecorator(Class<O> internalClass, String property) - throws IllegalArgumentException, NullPointerException { - return new PropertyDecorator<O>(internalClass, property); - } - - protected String property; - - protected transient Method m; - - @Override - public String toString(Object bean) { - try { - return getM().invoke(bean) + ""; - } catch (Exception e) { - log.error("could not convert for reason : " + e, e); - return ""; - } - } - - public String getProperty() { - return property; - } - - protected PropertyDecorator(Class<O> internalClass, String property) throws NullPointerException { - super(internalClass); - if (property == null) { - throw new NullPointerException("property can not be null."); - } - this.property = property; - // init method - getM(); - } - - - protected Method getM() { - if (m == null) { - for (PropertyDescriptor propertyDescriptor : PropertyUtils.getPropertyDescriptors(internalClass)) { - if (propertyDescriptor.getName().equals(property)) { - this.m = propertyDescriptor.getReadMethod(); - break; - } - } - if (m == null) { - throw new IllegalArgumentException("could not find the property " + property + " in " + internalClass); - } - } - return m; - } -} diff --git a/jaxx-runtime-api/src/main/resources/i18n/jaxx-runtime-api-en_GB.properties b/jaxx-runtime-api/src/main/resources/i18n/jaxx-runtime-api-en_GB.properties deleted file mode 100644 index 0474916..0000000 --- a/jaxx-runtime-api/src/main/resources/i18n/jaxx-runtime-api-en_GB.properties +++ /dev/null @@ -1,3 +0,0 @@ -validator.scope.error.label=Error -validator.scope.info.label=Information -validator.scope.warning.label=Warning diff --git a/jaxx-runtime-api/src/main/resources/i18n/jaxx-runtime-api-fr_FR.properties b/jaxx-runtime-api/src/main/resources/i18n/jaxx-runtime-api-fr_FR.properties deleted file mode 100644 index 0e3fddc..0000000 --- a/jaxx-runtime-api/src/main/resources/i18n/jaxx-runtime-api-fr_FR.properties +++ /dev/null @@ -1,3 +0,0 @@ -validator.scope.error.label=Erreur -validator.scope.info.label=Information -validator.scope.warning.label=Avertissement diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/JXPathDecoratorTest.java b/jaxx-runtime-api/src/test/java/jaxx/runtime/JXPathDecoratorTest.java deleted file mode 100644 index a67d758..0000000 --- a/jaxx-runtime-api/src/test/java/jaxx/runtime/JXPathDecoratorTest.java +++ /dev/null @@ -1,163 +0,0 @@ -package jaxx.runtime; - -import jaxx.runtime.JXPathDecorator.Context; -import org.junit.After; -import static org.junit.Assert.assertEquals; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -/** @author chemit */ -public class JXPathDecoratorTest { - - - protected JXPathDecorator<?> decorator; - protected String expected; - protected String result; - - @After - public void after() { - decorator = null; - } - - @Test(expected = NullPointerException.class) - public void testNullInternalClass() throws Exception { - decorator = JXPathDecorator.newDecorator(null, "hello"); - } - - @Test(expected = IllegalArgumentException.class) - public void testMissingRightBrace() throws Exception { - decorator = JXPathDecorator.newDecorator(Object.class, "${haha"); - } - - @Test(expected = IllegalArgumentException.class) - public void testMissingRightBrace2() throws Exception { - decorator = JXPathDecorator.newDecorator(Object.class, "${haha${hum}"); - } - - @Test - public void testNullBean() throws Exception { - decorator = JXPathDecorator.newDecorator(Object.class, "hello"); - expected = "hello"; - assertEquals(expected, decorator.getExpression()); - assertEquals(0, decorator.nbToken); - assertEquals(0, decorator.getTokens().length); - - result = decorator.toString(null); - assertEquals(null, result); - } - - @Test - public void testNoJXPath() throws Exception { - decorator = JXPathDecorator.newDecorator(Object.class, "hello"); - expected = "hello"; - assertEquals(expected, decorator.getExpression()); - assertEquals(0, decorator.nbToken); - assertEquals(0, decorator.getTokens().length); - - result = decorator.toString(this); - assertEquals(expected, result); - } - - @Test - public void testDecorator() throws Exception { - - decorator = JXPathDecorator.newDecorator(JXPathDecorator.class, "${expression}$s - ${nbToken}$d"); - assertEquals("%1$s - %2$d", decorator.getExpression()); - assertDecoratorInternal(); - - decorator = JXPathDecorator.newDecorator(JXPathDecorator.class, "${expression}${nbToken}"); - assertEquals("%1%2", decorator.getExpression()); - assertDecoratorInternal(); - - decorator = JXPathDecorator.newDecorator(JXPathDecorator.class, "before ${expression}$s - ${nbToken}$d after"); - assertEquals("before %1$s - %2$d after", decorator.getExpression()); - assertDecoratorInternal(); - - decorator = JXPathDecorator.newDecorator(JXPathDecorator.class, "before${expression}$s-${nbToken}$dafter"); - assertEquals("before%1$s-%2$dafter", decorator.getExpression()); - assertDecoratorInternal(); - } - - public static class Data { - int pos; - String name; - - protected static List<Data> generate(int nb) { - List<Data> datas = new ArrayList<Data>(nb); - for (int i = 0; i < nb; i++) { - datas.add(new Data(i, "name_" + (nb - i))); - } - return datas; - } - - Data(int pos, String name) { - this.pos = pos; - this.name = name; - } - - public int getPos() { - return pos; - } - - public String getName() { - return name; - } - - @Override - public String toString() { - return "Data{pos=" + pos + ", name='" + name + '\'' + '}'; - } - } - - @Test - public void testSort() throws Exception { - - List<Data> datas = Data.generate(10); - JXPathDecorator<Data> decorator = JXPathDecorator.newDecorator(Data.class, "${pos}$d ${name}$s"); - - List<Data> sortData = new ArrayList<Data>(datas); - JXPathDecorator.sort(decorator, sortData, 0); - for (int i = 0; i < datas.size(); i++) { - Data data = datas.get(i); - Data sData = sortData.get(i); - assertEquals(data, sData); - } - Collections.sort(datas, new Comparator<Data>() { - @Override - public int compare(Data o1, Data o2) { - return o1.name.compareTo(o2.name); - } - }); - Context<Data> context = decorator.context; - context.setComparator(null); - JXPathDecorator.sort(decorator, sortData, 1); - for (int i = 0; i < datas.size(); i++) { - Data data = datas.get(i); - Data sData = sortData.get(i); - assertEquals(data, sData); - } - } - - - public void assertDecoratorInternal(String... tokens) { - assertTokens(tokens); - expected = String.format(decorator.getExpression(), decorator.getExpression(), decorator.getNbToken()); - result = decorator.toString(decorator); - assertEquals(expected, result); - } - - private void assertTokens(String... tokens) { - if (tokens.length == 0) { - tokens = new String[]{"expression", "nbToken"}; - } - assertEquals(2, decorator.nbToken); - assertEquals(2, decorator.getTokens().length); - assertEquals(tokens[0], decorator.getTokens()[0]); - assertEquals(tokens[1], decorator.getTokens()[1]); - } - -} diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/MultiJXPathDecoratorTest.java b/jaxx-runtime-api/src/test/java/jaxx/runtime/MultiJXPathDecoratorTest.java deleted file mode 100644 index 4e3d4a4..0000000 --- a/jaxx-runtime-api/src/test/java/jaxx/runtime/MultiJXPathDecoratorTest.java +++ /dev/null @@ -1,184 +0,0 @@ -package jaxx.runtime; - -import jaxx.runtime.JXPathDecoratorTest.Data; -import org.junit.After; -import static org.junit.Assert.assertEquals; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -/** @author chemit */ -public class MultiJXPathDecoratorTest { - - - protected MultiJXPathDecorator<?> decorator; - protected String expected; - protected String result; - - @After - public void after() { - decorator = null; - } - - @Test(expected = NullPointerException.class) - public void testNullInternalClass() throws Exception { - decorator = MultiJXPathDecorator.newDecorator(null, "hello", "#"); - } - - @Test(expected = IllegalArgumentException.class) - public void testMissingRightBrace() throws Exception { - decorator = MultiJXPathDecorator.newDecorator(Object.class, "${haha", "#"); - } - - @Test(expected = IllegalArgumentException.class) - public void testMissingRightBrace2() throws Exception { - decorator = MultiJXPathDecorator.newDecorator(Object.class, "${haha${hum}", "#"); - } - - @Test - public void testNullBean() throws Exception { - decorator = MultiJXPathDecorator.newDecorator(Object.class, "hello", ""); - expected = "hello"; - assertEquals(expected, decorator.getExpression()); - assertEquals(0, decorator.nbToken); - assertEquals(0, decorator.getTokens().length); - - result = decorator.toString(null); - assertEquals(null, result); - } - - @Test - public void testMultiDecorator() throws Exception { - - decorator = MultiJXPathDecorator.newDecorator(JXPathDecorator.class, "${expression}$s#${nbToken}$d", "#", " - "); - assertEquals("%1$s - %2$d", decorator.getExpression()); - assertDecoratorInternal(); - assertEquals(2, decorator.contexts.length); - decorator.setContextIndex(1); - assertEquals("%1$d - %2$s", decorator.getExpression()); - assertTokens("nbToken", "expression"); - expected = String.format(decorator.getExpression(), decorator.getNbToken(), decorator.getExpression()); - result = decorator.toString(decorator); - assertEquals(expected, result); - - decorator = MultiJXPathDecorator.newDecorator(JXPathDecorator.class, "${expression}$s ## ${nbToken}$d", " ## ", " - "); - assertEquals("%1$s - %2$d", decorator.getExpression()); - assertDecoratorInternal(); - assertEquals(2, decorator.contexts.length); - decorator.setContextIndex(1); - assertEquals("%1$d - %2$s", decorator.getExpression()); - assertTokens("nbToken", "expression"); - expected = String.format(decorator.getExpression(), decorator.getNbToken(), decorator.getExpression()); - result = decorator.toString(decorator); - assertEquals(expected, result); - } - - @Test - public void testMultiDecorator2() throws Exception { - - decorator = MultiJXPathDecorator.newDecorator(JXPathDecorator.class, "${expression}$s#${nbToken}$d#${separator}$s", "#", " - "); - - assertEquals("%1$s - %2$d - %3$s", decorator.getExpression()); - assertTokens("expression", "nbToken", "separator"); - assertEquals(3, decorator.contexts.length); - - expected = String.format(decorator.getExpression(), decorator.getExpression(), decorator.getNbToken(), decorator.getSeparator()); - result = decorator.toString(decorator); - assertEquals(expected, result); - - decorator.setContextIndex(1); - assertEquals("%1$d - %2$s - %3$s", decorator.getExpression()); - assertTokens("nbToken", "separator", "expression"); - expected = String.format(decorator.getExpression(), decorator.getNbToken(), decorator.getSeparator(), decorator.getExpression()); - result = decorator.toString(decorator); - assertEquals(expected, result); - - decorator.setContextIndex(2); - assertEquals("%1$s - %2$s - %3$d", decorator.getExpression()); - assertTokens("separator", "expression", "nbToken"); - - expected = String.format(decorator.getExpression(), decorator.getSeparator(), decorator.getExpression(), decorator.getNbToken()); - result = decorator.toString(decorator); - assertEquals(expected, result); - } - - @Test - public void testMultiDecoratorWithMultiRef() throws Exception { - - decorator = MultiJXPathDecorator.newDecorator(JXPathDecorator.class, "${expression}$s#${nbToken}$d#${separator}$s %3$s", "#", " - "); - - assertEquals("%1$s - %2$d - %3$s %3$s", decorator.getExpression()); - assertTokens("expression", "nbToken", "separator"); - assertEquals(3, decorator.contexts.length); - - expected = String.format(decorator.getExpression(), decorator.getExpression(), decorator.getNbToken(), decorator.getSeparator()); - result = decorator.toString(decorator); - assertEquals(expected, result); - - decorator.setContextIndex(1); - assertEquals("%1$d - %2$s %3$s - %3$s", decorator.getExpression()); - assertTokens("nbToken", "separator", "expression"); - expected = String.format(decorator.getExpression(), decorator.getNbToken(), decorator.getSeparator(), decorator.getExpression()); - result = decorator.toString(decorator); - assertEquals(expected, result); - - decorator.setContextIndex(2); - assertEquals("%1$s %3$s - %2$s - %3$d", decorator.getExpression()); - assertTokens("separator", "expression", "nbToken"); - - expected = String.format(decorator.getExpression(), decorator.getSeparator(), decorator.getExpression(), decorator.getNbToken()); - result = decorator.toString(decorator); - assertEquals(expected, result); - } - - @Test - public void testSort() throws Exception { - - List<Data> datas = Data.generate(10); - - MultiJXPathDecorator<Data> decorator = MultiJXPathDecorator.newDecorator(Data.class, "${pos}$d-${name}$s", "-"); - - List<Data> sortData = new ArrayList<Data>(datas); - JXPathDecorator.sort(decorator, sortData, 0); - for (int i = 0; i < datas.size(); i++) { - Data data = datas.get(i); - Data sData = sortData.get(i); - assertEquals(data, sData); - } - Collections.sort(datas, new Comparator<Data>() { - @Override - public int compare(Data o1, Data o2) { - return o1.name.compareTo(o2.name); - } - }); - decorator.setContextIndex(1); - JXPathDecorator.sort(decorator, sortData, 1); - for (int i = 0; i < datas.size(); i++) { - Data data = datas.get(i); - Data sData = sortData.get(i); - assertEquals(data, sData); - } - } - - public void assertDecoratorInternal(String... tokens) { - assertTokens(tokens); - expected = String.format(decorator.getExpression(), decorator.getExpression(), decorator.getNbToken()); - result = decorator.toString(decorator); - assertEquals(expected, result); - } - - private void assertTokens(String... tokens) { - if (tokens.length == 0) { - tokens = new String[]{"expression", "nbToken"}; - } - assertEquals(tokens.length, decorator.nbToken); - assertEquals(tokens.length, decorator.getTokens().length); - for (int i = 0; i < tokens.length; i++) { - assertEquals(tokens[i], decorator.getTokens()[i]); - } - } - -} \ No newline at end of file diff --git a/jaxx-runtime-swing-widget/LICENSE.txt b/jaxx-runtime-swing-widget/LICENSE.txt deleted file mode 100644 index 3f7b8b1..0000000 --- a/jaxx-runtime-swing-widget/LICENSE.txt +++ /dev/null @@ -1,166 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. - diff --git a/jaxx-runtime-swing-widget/README.txt b/jaxx-runtime-swing-widget/README.txt deleted file mode 100644 index d2e50d3..0000000 --- a/jaxx-runtime-swing-widget/README.txt +++ /dev/null @@ -1,2 +0,0 @@ -To deploy new version of pom: mvn deploy -To install localy: mvn install diff --git a/jaxx-runtime-swing-widget/src/site/rst/images/Components-screenshot.gif b/jaxx-runtime-swing-widget/src/site/rst/images/Components-screenshot.gif deleted file mode 100644 index 68bec67..0000000 Binary files a/jaxx-runtime-swing-widget/src/site/rst/images/Components-screenshot.gif and /dev/null differ diff --git a/jaxx-runtime-swing-widget/src/site/rst/images/webstart.gif b/jaxx-runtime-swing-widget/src/site/rst/images/webstart.gif deleted file mode 100644 index 079fc1b..0000000 Binary files a/jaxx-runtime-swing-widget/src/site/rst/images/webstart.gif and /dev/null differ diff --git a/jaxx-runtime-swing-widget/src/site/rst/index.rst b/jaxx-runtime-swing-widget/src/site/rst/index.rst deleted file mode 100644 index 9e8f78f..0000000 --- a/jaxx-runtime-swing-widget/src/site/rst/index.rst +++ /dev/null @@ -1,40 +0,0 @@ -=================== -Examples/Components -=================== - -The Components demo displays many different Swing components being used in a variety of ways; it is JAXX's equivalent -of the SwingSet demo. Various pages use advanced features such as data binding, scripting, event handling, and -CSS stylesheets. - -Examples/Calculator -=================== - -This is an implementation of Challenge #2 from the `XUL Grand Coding Challenge 2004`_ . Because this example program -has been implemented in so many different languages, you can easily compare JAXX's -syntax against the competition and decide for yourself which you prefer. - -Screen shot ------------ - -.. image:: images/Components-screenshot.gif - -Set it in action ----------------- - -|webstart| - -To run this example in `Java Web Start`_, click the `following link`_. - - -Source code ------------ - -Unlike the other examples, the source code for Components is too big to display here. You can view it yourself by -downloading JAXX, and you can also view the source code for the individual demos by clicking the "Source" tabs. - - -.. _Java Web Start: http://java.sun.com/products/javawebstart/ - -.. |webstart| image:: images/webstart.gif - -.. _following link: ./launch-demo.jnlp diff --git a/jaxx-runtime-swing/LICENSE.txt b/jaxx-runtime-swing/LICENSE.txt deleted file mode 100644 index 3f7b8b1..0000000 --- a/jaxx-runtime-swing/LICENSE.txt +++ /dev/null @@ -1,166 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. - diff --git a/jaxx-runtime-swing/README.txt b/jaxx-runtime-swing/README.txt deleted file mode 100644 index d2e50d3..0000000 --- a/jaxx-runtime-swing/README.txt +++ /dev/null @@ -1,2 +0,0 @@ -To deploy new version of pom: mvn deploy -To install localy: mvn install diff --git a/jaxx-runtime-swing/changelog.txt b/jaxx-runtime-swing/changelog.txt deleted file mode 100644 index 459960e..0000000 --- a/jaxx-runtime-swing/changelog.txt +++ /dev/null @@ -1,114 +0,0 @@ -1.5 - * 20090506 [chemit] - add some usefull renderer and other stuffs - -1.3 chemit 20090409 - * 20090404 [chemit] - introduce dimension factory in SwingUtil for min and max dimensions - * 20090327 [chemit] - add javax help mecanism - * 20090318 [chemit] - introduce the BlockingLayerUI2 class (should be merge with BlockingLayerUI) - * 20090318 [chemit] - introduce the CardLayout2Ext class - * 20090312 [chemit] - add some usefull code from ObServe (load Nimbus L&F, load ui configuration) - * 20090309 [chemit] - in BlockingLayerUI, add a new state 'block' to enable/disable blocking mode with a blockingColor - * 20090303 [chemit] - in BlockingLayerUI, add a new state 'useIcon' to enable/disable use of the action icon - - add a simple WizardModel - * 20090301 [chemit] - add usefull methods in JAXXButtonGroup - -1.2 letellier 2009022? - * 20090223 [chemit] - rename jaxx.runtime.swing.Utils to jaxx.runtime.SwingUtil - -1.1 chemit 20090220 - * 20090124 [chemit] - add a cache on context path to improve performance on NavigationTreeNode - - improve I18nTableCellRenderer to display toolTipText - * 20090123 [chemit] - improve NavigationTreeNodeRenderer (now can customized node internalClass) - * 20090121 [letellier] - add some usefull methods in JAXXList and JAXXComboBox - -1.0 chemit 20090111 - * 20090111 [chemit] - integrate new architecture to allow to have runtime code with NO link with compiler :) - * 20090105 [chemit] - improve CardLayout2 -0.8 ??? 200812?? - * 20081228 [chemit] - generify ClassDescriptor - - introduce StylesheetHelper helper class to detach Stylesheet, Rule and Selector classes from - JAXXCompiler and make possible to extract compiler engine from runtime - - * 20081227 [chemit] - add PCS on ValidatorErrorTable to be used by table validation - * 20081218 [chemit] - improve generation of methods - * 20081214 [chemit] - can now in validation, put error with args (all args must be separated by a ##) - - improve event naming : replace the $evXXX by doMEthodName__on__field (except with optimize option) - - add jaww.runtime.swing.Utils.fillComboBox to fill a combobox model from a collection - - add addSourcesToClassPath property to add sources directories in class-path - - improve classloader managment - - keep in DataSource objetCode - - fix bug when processDataBinding on a null objectCode - - always clean node cached values when selected it - - add usefull databinding method in Util - -* 20081213 [chemit] - improve navigation tree node rendering with some caches - - introduce a ChildBuilder to simplify building of child nodes from a collection or array - -0.7 chemit 20081210 -* 20081210 [chemit] - fix bug 1751 -* 20081210 [chemit] - improve JAXXButtonGroup (add ActionChangeListener and toolTipText mecanism) -* 20081208 [chemit] - javabBean attribute use to initialize bean - - introduce Base64Coder to fix bug 1750 and control serailVersionUI (put them to 1L for the moment) - - introduce MultiJXPathDecorator - - add a resetAfterCompile parameter toCompilerOption to keep in test used compilers - - * 20081207 [chemit] use lutinproject 3.1 - - can exclude field from validator - * 20081202 [chemit] - add strategy for loading ui in NavigationTreeSelectionAdapter - - fix bug when searching for a inner class - - * 20081201 [chemit] - implements jaxx.runtime.JXPathDecorator - - add setcontextValue and removeContextValue on JAXXContextEntryDef - - introduce scope in BeanValidator (ERROR or WARNING) and related swing stuff - - only enter once in $initialize method in generated code - - 0.6 chemit 20081117 - * 20081118 [chemit] introduce NavigationUtil, save in context selected node - * 20081107 [chemit] improve data binding and code generation : - - make possible inheritance in binding - - add an attribute javaBean to an object : will generate a full java bean support property - - make possible binding to the javaBean added properties - - clean generated code - - * 20081105 [chemit] - introduce a CardLayout2 to extends awt CardLayout - - introduce a NavigationTreeModel - - introduce a Decorator to render Object - - propagate constructor JAXXContext(JAXXContext) in JAXXObject generation - - begin of rst documentation - - * 20081104 [chemit] can add extra beanInfoSearchPath in SwingInitializer - * 20081104 [chemit] add jaxxContextImplementorClass in option to make possible use of other JAXXContext implementor. - * 20081102 [chemit] improve JAXXContext : - - introduce a JAXXContextEntryDef to qualify an entry of a JAXXContext - - do javadoc in JAXXContext - - add logic in DefaultJAXXContext : seek in parent context if entry not found - * 20081102 [chemit] improve tests : - - fix the last failed test from Jaxx original version :) - - dumps tests to JUnit4 :) - * 20081030 [chemit] improve BeanValidator : - - add full PropertyChangeEvent java-bean support and a property valid - - when remove bean from validator, must remove errors from model - - make possible to have a dynamic errorListModel in jaxx files - * 20081030 [chemit] improve JAXXContext : - - fix setContextValue bug when setting twice a same type for a same key - - implements a DefaultJAXXContext - - use this default implementation with delegate pattern in JAXXObject - * 20081030 [chemit] add JAXXAction contract to simplify init of ui with JAXXInitialContext - * 20081027 [chemit] fix bug 1722 - * 20081027 [chemit] add conversion support in validator - * 20081025 [chemit] improve BeanValidator tag : - - add a errorList attribute for set a ErrorListMouseListener on the errorList - - add a beanInitializer attribute for set the validator's bean at runtime - - add a default errorListModel value 'errors' - * 20081025 [chemit] introduce JAXXInitialContext to fill JAXXContext at runtime before $initialize() method - * 20081024 [chemit] fix validator context lost if UI is launched from another thread - ver-0-5 chemit 20081002 - * 20081017 [chemit] add validator support - * 20081013 [chemit] can generate logger on jaxx files - * 20081011 [chemit] improve site - * 20081011 [chemit] fix bug on JavaFileParser : works again - * 20081002 [chemit] Using lutinproject 3.0, changing groupId to org.codelutin - * 20081002 [chemit] use a single module jaxx-core (no more core, runtime and jaxx-swing modules) - * 20081002 [chemit] Introduce JAXXContext - * 20081002 [chemit] Fix bug on method creation via scripting - * 20081002 [chemit] Improve i18n integration (works now also for tabs) diff --git a/jaxx-runtime-swing/pom.xml b/jaxx-runtime-swing/pom.xml deleted file mode 100644 index b6ced8a..0000000 --- a/jaxx-runtime-swing/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <!-- ************************************************************* --> - <!-- *** POM Relationships *************************************** --> - <!-- ************************************************************* --> - - <parent> - <groupId>org.nuiton</groupId> - <artifactId>jaxx</artifactId> - <version>1.7.2-SNAPSHOT</version> - </parent> - - <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-runtime-swing</artifactId> - - <dependencies> - - <!-- sibling dependencies --> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-api</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-utils</artifactId> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </dependency> - - </dependencies> - - <!-- ************************************************************* --> - <!-- *** Project Information ************************************* --> - <!-- ************************************************************* --> - - <name>${project.artifactId}</name> - <description>Jaxx runtime swing extension</description> - - <!-- ************************************************************* --> - <!-- *** Build Settings ****************************************** --> - <!-- ************************************************************* --> - <packaging>jar</packaging> - -</project> diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/DecoratorTableCellRenderer.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/DecoratorTableCellRenderer.java deleted file mode 100644 index 0760f28..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/DecoratorTableCellRenderer.java +++ /dev/null @@ -1,33 +0,0 @@ -package jaxx.runtime.swing; - -import jaxx.runtime.Decorator; - -import javax.swing.JTable; -import javax.swing.table.TableCellRenderer; -import java.awt.Component; - -/** - * A simple TableCellRenderer using a delegate TableCellRenderer to render everything elese thant the text : - * the text is I18nalize. - * - * @author chemit - */ -public class DecoratorTableCellRenderer implements TableCellRenderer { - - /** the delegate cell renderer */ - protected TableCellRenderer delegate; - - protected Decorator decorator; - - public DecoratorTableCellRenderer(TableCellRenderer delegate, Decorator decorator) { - this.delegate = delegate; - this.decorator = decorator; - } - - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasfocus, int row, int column) { - if (value != null) { - value = decorator.toString(value); - } - return delegate.getTableCellRendererComponent(table, value, isSelected, hasfocus, row, column); - } -} \ No newline at end of file diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeCellRenderer.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeCellRenderer.java deleted file mode 100644 index 4dd2a83..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeCellRenderer.java +++ /dev/null @@ -1,137 +0,0 @@ -package jaxx.runtime.swing.navigation; - -import jaxx.runtime.JAXXContext; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import jaxx.runtime.swing.navigation.NavigationUtil.NodeRenderer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.util.StringUtil; - -import javax.swing.JTree; -import javax.swing.UIManager; -import javax.swing.tree.DefaultTreeCellRenderer; -import javax.swing.tree.TreeCellRenderer; -import javax.swing.tree.TreePath; -import java.awt.Component; -import java.awt.Dimension; - -/** - * A simple cell renderer which use the {@link NavigationTreeNode#renderer} - * to display node. - * - * @author chemit - */ -public class NavigationTreeCellRenderer implements TreeCellRenderer { - - /** - * Logger - */ - static private final Log log = LogFactory.getLog(NavigationTreeCellRenderer.class); - /** - * underlying context where to seek datas - */ - protected JAXXContext context; - /** - * delegate renderer which really render the node - */ - protected DefaultTreeCellRenderer delegate; - protected static long t = 0; - /** - * If set, will check to have a this minimum width on render component - * to fix some display issues of nodes (too much cache in TreeUI). - */ - protected Integer minWidth = null; - - public NavigationTreeCellRenderer(JAXXContext context) { - this(context, null, null); - } - - public NavigationTreeCellRenderer(JAXXContext context, Integer minWidth) { - this(context, null, minWidth); - } - - public NavigationTreeCellRenderer(JAXXContext context, DefaultTreeCellRenderer delegate) { - this(context, delegate, null); - } - - public NavigationTreeCellRenderer(JAXXContext context, DefaultTreeCellRenderer delegate, Integer minWidth) { - this.context = context; - this.delegate = delegate == null ? new DefaultTreeCellRenderer() : delegate; - this.minWidth = minWidth; - UIManager.put("Tree.rendererFillBackground", false); - } - - @Override - public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { - Component result = delegate; - - TreePath path = tree.getPathForRow(row); - if (path != null) { - - if (value != null) { - long t0 = System.nanoTime(); - NodeRenderer renderer = getNodeRenderer(value); - long t1 = System.nanoTime(); - if (renderer != null) { - value = renderer.toString(context); - long t2 = System.nanoTime(); - if (log.isDebugEnabled()) { - log.debug("use renderer [" + (t++) + "]<" + row + ">" + renderer.decorator + " <" + StringUtil.convertTime(t0, t1) + "/" + StringUtil.convertTime(t1, t2) + ">"); - } - } - } - result = delegate.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); - } - - if (minWidth != null) { - if (delegate.getPreferredSize().getWidth() < minWidth) { - delegate.setPreferredSize(new Dimension(minWidth, (int) delegate.getPreferredSize().getHeight())); - } - } - - return result; - } - - /** - * @param value the value which should be a node - * @return the nodeRenderer attached to node via the {@link NavigationTreeNode#userObject}, - * or <code>null</code> if value is null, or value is not int good type. - */ - protected NodeRenderer getNodeRenderer(Object value) { - NodeRenderer render = null; - - if (value != null) { - NavigationTreeNode node = getNode(value); - - if (node != null && node.getUserObject() instanceof NodeRenderer) { - render = (NodeRenderer) node.getUserObject(); - } - } - return render; - } - - /** - * @param value the value which should be a node - * @return the cast {@link NavigationTreeNode}, or <code>null</code> if value is null. - */ - protected NavigationTreeNode getNode(Object value) { - return value instanceof NavigationTreeNode ? (NavigationTreeNode) value : null; - } - - /** - * @return min width to decorate nodes - */ - public Integer getMinWidth() { - return minWidth; - } - - /** - * This hack remove the ... from the node. For not use this, MinWidth can be null (by default). - * bugfix from http://forums.sun.com/thread.jspa?forumID=256&threadID=277338 - * hack from : http://forums.sun.com/thread.jspa?threadID=542069&tstart=824 - * @param minWidth minimum width to decorate nodes - */ - public void setMinWidth(Integer minWidth) { - this.minWidth = minWidth; - } -} diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java deleted file mode 100644 index 19415c5..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java +++ /dev/null @@ -1,133 +0,0 @@ -package jaxx.runtime.swing.navigation; - -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXContextEntryDef; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; - -/** - * To help getting and setting navigation tree objects from a {@link JAXXContext}. - * <p/> - * There is four type of data which can be hold in a context : - * <ul> - * <li>tree model : the navigation tree model</li> - * <li>tree handler : the navigation tree handler</li> - * <li>selected path : the navigation path of the selected node</li> - * <li>selected node : the selected node</li> - * <li>selected bean : the selected bean</li> - * </ul> - * - * To make possible the use of more than one navigation tree system in a same - * context, we <b>MUST</b> distinguish the context entries definition. For this - * purpose, entries definition are normalized and prefixed by a unique {@link #prefix}. - * <p/> - * Here is the keys used : - * <ul> - * <li>tree model : {@code prefix + "-tree-model"}</li> - * <li>tree handler : {@code prefix + "-tree-handler"}</li> - * <li>selected path : {@code prefix + "-selected-path"}</li> - * <li>selected node : {@code prefix + "-selected-node"}</li> - * <li>selected bean : {@code prefix + "-selected-bean"}</li> - * </ul> - * - * @author chemit - * @since 1.7.2 - */ -public class NavigationTreeContextHelper { - - protected final String prefix; - protected JAXXContextEntryDef<String> selectedPathContextEntry; - protected JAXXContextEntryDef<Object> selectedBeanContextEntry; - protected JAXXContextEntryDef<NavigationTreeNode> selectedNodeContextEntry; - protected JAXXContextEntryDef<NavigationTreeModel> treeModelContextEntry; - protected JAXXContextEntryDef<NavigationTreeHandler> treeHandlerContextEntry; - - public NavigationTreeContextHelper(String contextPrefix) { - this.prefix = contextPrefix; - treeModelContextEntry = JAXXContextEntryDef.newDef(contextPrefix + "-tree-model", NavigationTreeModel.class); - treeHandlerContextEntry = JAXXContextEntryDef.newDef(contextPrefix + "-tree-handler", NavigationTreeHandler.class); - selectedBeanContextEntry = JAXXContextEntryDef.newDef(contextPrefix + "-selected-bean", Object.class); - selectedNodeContextEntry = JAXXContextEntryDef.newDef(contextPrefix + "-selected-node", NavigationTreeNode.class); - selectedPathContextEntry = JAXXContextEntryDef.newDef(contextPrefix + "-selected-path", String.class); - } - - public String getPrefix() { - return prefix; - } - - public NavigationTreeModel getTreeModel(JAXXContext context) { - NavigationTreeModel r = getTreeModelContextEntry().getContextValue(context); - return r; - } - - public NavigationTreeHandler getTreeHandler(JAXXContext context) { - NavigationTreeHandler r = getTreeHandlerContextEntry().getContextValue(context); - return r; - } - - public String getSelectedPath(JAXXContext context) { - String r = getSelectedPathContextEntry().getContextValue(context); - return r; - } - - public NavigationTreeNode getSelectedNode(JAXXContext context) { - NavigationTreeNode r = getSelectedNodeContextEntry().getContextValue(context); - return r; - } - - public Object getSelectedBean(JAXXContext context) { - Object r = getSelectedBeanContextEntry().getContextValue(context); - return r; - } - - public void setTreeModel(JAXXContext context, NavigationTreeModel model) { - getTreeModelContextEntry().setContextValue(context, model); - } - - public void setTreeHandler(JAXXContext context, NavigationTreeHandler handler) { - getTreeHandlerContextEntry().setContextValue(context, handler); - } - - public void setSelectedPath(JAXXContext context, String path) { - if (path == null) { - getSelectedPathContextEntry().removeContextValue(context); - } else { - getSelectedPathContextEntry().setContextValue(context, path); - } - } - - public void setSelectedNode(JAXXContext context, NavigationTreeNode node) { - if (node == null) { - getSelectedNodeContextEntry().removeContextValue(context); - } else { - getSelectedNodeContextEntry().setContextValue(context, node); - } - } - - public void setSelectedBean(JAXXContext context, Object bean) { - if (bean == null) { - getSelectedBeanContextEntry().removeContextValue(context); - } else { - getSelectedBeanContextEntry().setContextValue(context, bean); - } - } - - public JAXXContextEntryDef<NavigationTreeModel> getTreeModelContextEntry() { - return treeModelContextEntry; - } - - public JAXXContextEntryDef<NavigationTreeHandler> getTreeHandlerContextEntry() { - return treeHandlerContextEntry; - } - - public JAXXContextEntryDef<Object> getSelectedBeanContextEntry() { - return selectedBeanContextEntry; - } - - public JAXXContextEntryDef<NavigationTreeNode> getSelectedNodeContextEntry() { - return selectedNodeContextEntry; - } - - public JAXXContextEntryDef<String> getSelectedPathContextEntry() { - return selectedPathContextEntry; - } -} diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java deleted file mode 100644 index 729c5a2..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java +++ /dev/null @@ -1,307 +0,0 @@ -package jaxx.runtime.swing.navigation; - -import java.awt.Component; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.DefaultTreeSelectionModel; -import javax.swing.tree.TreePath; -import jaxx.runtime.JAXXAction; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXContextEntryDef; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * The handler of a navigation tree. - * - * This is also the selection model to use, since we must check before moving - * from a node we can not just listen selection model changed, we must control - * it. - * - * - * @author tony - * @since 1.3 - */ -public abstract class NavigationTreeHandler extends DefaultTreeSelectionModel { - - public static final String DEFAULT_CONTEXT_PREFIX = "navigation"; - private static final long serialVersionUID = 1L; - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private final Log log = LogFactory.getLog(NavigationTreeHandler.class); - /** - * @deprecated since 1.7.2, is no more used (prefer use the dynamic context entry defs) - */ - @Deprecated - static public final String NAVIGATION_SELECTED_BEAN = "navigation-selected-bean"; - /** - * @deprecated since 1.7.2, is no more used (prefer use the dynamic context entry defs) - */ - @Deprecated - static public final JAXXContextEntryDef<String> NAVIGATION_SELECTED_PATH_ENTRY_DEF = JAXXContextEntryDef.newDef("navigation-selected-path", String.class); - /** - * @deprecated since 1.7.2, is no more used (prefer use the dynamic context entry defs) - */ - @Deprecated - static public final JAXXContextEntryDef<NavigationTreeNode> NAVIGATION_SELECTED_NODE_ENTRY_DEF = JAXXContextEntryDef.newDef("navigation-selected-node", NavigationTreeNode.class); - - /** - * Define the stategy of instanciation of ui - */ - public enum Strategy { - - /** - * instanciate a ui for a node - */ - PER_NODE, - /** - * instanciate only one a ui for a type,nodes will share the instanciation - */ - PER_UI_TYPE - } - /** - * default ui class to use if node does not define an ui class - */ - protected Class<? extends JAXXObject> defaultUIClass; - /** - * [optional] default action class - */ - protected Class<? extends JAXXAction> defaultUIHandlerClass; - /** - * UI which contains navigation tree - */ - protected JAXXObject context; - /** - * UI Instanciation strategy - */ - protected Strategy strategy; - /** - * JAXXContext access helper. - * - * @since 1.7.2 - */ - protected NavigationTreeContextHelper contextHelper; - - protected NavigationTreeHandler(Class<? extends JAXXObject> defaultUIClass, Class<? extends JAXXAction> defaultUIHandlerClass, JAXXObject context, Strategy strategy) { - this(DEFAULT_CONTEXT_PREFIX, defaultUIClass, defaultUIHandlerClass, context, strategy); - } - - protected NavigationTreeHandler(String contextPrefix, Class<? extends JAXXObject> defaultUIClass, Class<? extends JAXXAction> defaultUIHandlerClass, JAXXObject context, Strategy strategy) { - this.contextHelper = new NavigationTreeContextHelper(contextPrefix); - this.defaultUIClass = defaultUIClass; - this.defaultUIHandlerClass = defaultUIHandlerClass; - this.context = context; - this.strategy = strategy; - addTreeSelectionListener(new TreeSelectionListener() { - - @Override - public void valueChanged(TreeSelectionEvent event) { - if (event.getOldLeadSelectionPath() != null && event.getOldLeadSelectionPath().equals(event.getPath())) { - // do not treate this if no path changed - return; - } - NavigationTreeNode node = (NavigationTreeNode) event.getPath().getLastPathComponent(); - selectNodeUI(node); - } - }); - } - - /** - * @return le modèle de navigation associé - */ - protected abstract NavigationTreeModel getNavigationTreeModel(); - - /** - * @return le composent actuellement visible associé au noeud courant ou - * au noeud précédent lors d'un changement de noeud. - */ - protected abstract Component getCurrentUI(); - - /** - * @param node le noeud associé à l'ui à retrouver - * @return l'ui associé au novueau noeud sélectionné - */ - protected abstract Component getUI(NavigationTreeNode node); - - /** - * @param component le composent actuellement visible - * @return <code>true</code> si le composent a bien été fermé, <code>false</code> sinon - * @throws Exception if any - */ - protected abstract boolean closeUI(Component component) throws Exception; - - /** - * Instancie une nouvelle ui associé à un noeud de l'arbre de navigation - * - * @param node le noeud associé à l'ui à créer - * @return la nouvelle ui associée au noeud - * @throws Exception if any - */ - protected abstract Component createUI(NavigationTreeNode node) throws Exception; - - /** - * Prepare le context a utiliser pour initialiser une nouvelle ui. - * - * @param node le noeud associé à l'ui à créer - * @return le context à utiliser pour instancier l'ui - * @throws Exception if any - */ - protected abstract JAXXContext createUIContext(NavigationTreeNode node) throws Exception; - - /** - * Ouvre l'ui associée au noeud sélectionné dans l'arbre de navigation. - * - * @param newUI l'ui associé au noeud sélectionné à ouvrir - * @param node le node de l'ui a ouvrir - * @throws Exception if any - */ - protected abstract void openUI(Component newUI, NavigationTreeNode node) throws Exception; - - /** - * Traitement des exceptions. - * - * @param e l'erreur recontrée (ou null si pas d"erreur) - */ - protected abstract void treateError(Exception e); - - /** - * Prepare le nouveau noeud sélectionné. - * - * @param node le noeud a preparer - * @return le noeud selectionné et preparé - */ - protected NavigationTreeNode prepareNode(NavigationTreeNode node) { - - if (node.getJaxxClass() == null) { - // no ui is associated with this node, display a empty content - node.setJaxxClass(defaultUIClass); - } - - if (node.getJaxxActionClass() == null) { - node.setJaxxActionClass(defaultUIHandlerClass); - } - return node; - } - - @Override - public void setSelectionPath(TreePath path) { - if (path.equals(getSelectionPath())) { - // stay on same node, can skip - if (log.isDebugEnabled()) { - log.debug("skip stay on path " + path); - } - return; - } - Component component = getCurrentUI(); - - try { - if (!closeUI(component)) { - if (log.isDebugEnabled()) { - log.debug("changing node canceled!"); - } - // can not changed current node - return; - } - } catch (Exception ex) { - treateError(ex); - return; - } - if (log.isDebugEnabled()) { - log.debug("will select path " + path); - } - // ok can safely select the new path - super.setSelectionPath(path); - } - - public void selectNodeUI(NavigationTreeNode node) { - - try { - - node = prepareNode(node); - - String path = node.getContextPath(); - - if (log.isTraceEnabled()) { - log.trace(path); - } - - Component newUI = getUI(node); - - // now, we are free to open the ui associated with the selected node in navigation - - // always clean cache on the node before all - node.cachedBean = null; - if (node.renderer != null) { - node.renderer.setRendererCachedValue(null); - } - // before all, attach bean in context associated with the selected node in navigation tree - Object data = getNavigationTreeModel().getJAXXContextValue(context, path); - - addSelectedBeanInContext(node, data); - - if (newUI == null) { - // instanciate a new ui associated with the selected node - newUI = createUI(node); - } - - // save in context current node context path - getContextHelper().setSelectedPath(context, node.getContextPath()); -// NAVIGATION_SELECTED_PATH_ENTRY_DEF.setContextValue(context, node.getContextPath()); - - // save in context current node - getContextHelper().setSelectedNode(context, node); -// NAVIGATION_SELECTED_NODE_ENTRY_DEF.setContextValue(context, node); - - // really open the ui associated with the selected node - openUI(newUI, node); - - } catch (Exception e) { - // remove data from context - - // if any error, go back to previvous node - treateError(e); - } - } - - protected void addSelectedBeanInContext(NavigationTreeNode node, Object data) { - - if (log.isDebugEnabled()) { - log.debug("find data for contextPath <" + node.getContextPath() + "> : " + (data == null ? null : data.getClass())); - } - - getContextHelper().setSelectedBean(context, null); -// context.removeContextValue(Object.class, NAVIGATION_SELECTED_BEAN); - - if (data != null) { - getContextHelper().setSelectedBean(context, data); -// context.setContextValue(data, NAVIGATION_SELECTED_BEAN); - //todo should we not use this to avoid conflict in context ? - context.setContextValue(data); - } - } - - protected String getNodeConstraints(NavigationTreeNode node) { - String constraints; - switch (strategy) { - case PER_NODE: - constraints = node.getContextPath(); - break; - case PER_UI_TYPE: - constraints = node.getJaxxClass().getName(); - break; - default: - throw new IllegalArgumentException("could not find constraint for node : " + node); - } - return constraints; - } - - protected JAXXAction getJAXXAction(Class<? extends JAXXAction> jaxxActionClass) throws Exception { - JAXXAction action = jaxxActionClass.newInstance(); - return action; - } - - public NavigationTreeContextHelper getContextHelper() { - return contextHelper; - } -} diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java deleted file mode 100644 index 1aa694a..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java +++ /dev/null @@ -1,129 +0,0 @@ -package jaxx.runtime.swing.navigation; - -import jaxx.runtime.JAXXAction; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXInitialContext; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.swing.CardLayout2; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.swing.JPanel; -import java.awt.Component; - -/** - * Simple {@link NavigationTreeSelectionAdapter} implementation with a {@link jaxx.runtime.swing.CardLayout2} to manage components to - * associated with tree's nodes. - * <p/> - * For each node, the ui associated has a constraints in a cardlayout which is the node context path. - * <p/> - * A single container managed by the cardlayout is used to display the components associated with tree's nodes. - * - * @author chemit - */ -public abstract class NavigationTreeHandlerWithCardLayout extends NavigationTreeHandler { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private final Log log = LogFactory.getLog(NavigationTreeHandlerWithCardLayout.class); - - /** - * All components associated with a tree's node is displayed in a single container. - * - * @return the containter of components - */ - protected abstract JPanel getContentContainer(); - - /** - * the cardlayout managing components associated with tree node. The constraints - * of each component is the node contextPath. - * - * @return the layout used to display components associated with tree's nodes. - */ - protected abstract CardLayout2 getContentLayout(); - - public NavigationTreeHandlerWithCardLayout(String contextPrefix, Class<? extends JAXXObject> defaultUIClass, Class<? extends JAXXAction> defaultUIHandlerClass, JAXXObject context, Strategy strategy) { - super(contextPrefix, defaultUIClass, defaultUIHandlerClass, context, strategy); - if (getContentContainer() == null) { - throw new IllegalArgumentException("could not have a null 'contentContainer' in ui " + context); - } - if (getContentLayout() == null) { - throw new IllegalArgumentException("could not have a null 'contentLayout' in ui " + context); - } - } - - public NavigationTreeHandlerWithCardLayout(Class<? extends JAXXObject> defaultUIClass, Class<? extends JAXXAction> defaultUIHandlerClass, JAXXObject context, Strategy strategy) { - super(defaultUIClass, defaultUIHandlerClass, context, strategy); - - if (getContentContainer() == null) { - throw new IllegalArgumentException("could not have a null 'contentContainer' in ui " + context); - } - if (getContentLayout() == null) { - throw new IllegalArgumentException("could not have a null 'contentLayout' in ui " + context); - } - } - - @Override - protected Component getCurrentUI() { - CardLayout2 layout = getContentLayout(); - JPanel container = getContentContainer(); - return layout.getVisibleComponent(container); - } - - @Override - protected Component getUI(NavigationTreeNode node) { - CardLayout2 layout = getContentLayout(); - JPanel container = getContentContainer(); - String path = getNodeConstraints(node); - return layout.contains(path) ? layout.getComponent(container, path) : null; - } - - @Override - protected void openUI(Component newUI, NavigationTreeNode node) throws Exception { - - CardLayout2 layout = getContentLayout(); - JPanel container = getContentContainer(); - // switch layout - layout.show(container, getNodeConstraints(node)); - } - - @Override - protected boolean closeUI(Component component) throws Exception { - // by default, we says that component was succesfull closed - return true; - } - - @Override - protected JAXXContext createUIContext(NavigationTreeNode node) throws Exception { - - if (node.getJaxxActionClass() == null) { - if (log.isWarnEnabled()) { - log.warn("no action associated with ui " + node.getJaxxClass()); - } - // no action associated, just - return context; - } - - JAXXAction action = getJAXXAction(node.getJaxxActionClass()); - - // init context with - JAXXInitialContext uiContext = action.init(this.context); - return uiContext; - } - - @Override - protected Component createUI(NavigationTreeNode node) throws Exception { - - JAXXContext uiContext = createUIContext(node); - - JAXXObject newUI = node.getJaxxClass().getConstructor(JAXXContext.class).newInstance(uiContext); - - if (log.isDebugEnabled()) { - log.debug("instanciate new ui " + newUI); - } - - getContentContainer().add((Component) newUI, getNodeConstraints(node)); - return (Component) newUI; - } -} - diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java deleted file mode 100644 index 86f9d18..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java +++ /dev/null @@ -1,123 +0,0 @@ -package jaxx.runtime.swing.navigation; - -import java.lang.reflect.InvocationTargetException; -import java.util.regex.Pattern; -import javax.swing.JTree; -import javax.swing.tree.TreePath; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Helper object associated to a given navigation tree system. - * - * To helper is context safe (base on a {@link NavigationTreeContextHelper}. - * - * @author chemit - * @since 1.7.2 - * @see NavigationTreeCellRenderer - */ -public abstract class NavigationTreeHelper extends NavigationTreeContextHelper { - - static private final Log log = LogFactory.getLog(NavigationTreeHelper.class); - - public abstract NavigationTreeModel createTreeModel(JAXXContext context); - - public abstract NavigationTreeHandler createTreeHandler(JAXXObject context); - - public NavigationTreeHelper(String contextPrefix) { - super(contextPrefix); - } - - public Object getContextValue(JAXXContext context, String navigationPath) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException { - NavigationTreeModel treeModel = getSafeTreeModel(context); - return treeModel.getJAXXContextValue(context, navigationPath); - } - - public NavigationTreeNode findNode(JAXXContext context, String navigationPath) { - NavigationTreeModel treeModel = getSafeTreeModel(context); - return treeModel.findNode(navigationPath); - } - - public NavigationTreeNode findNode(JAXXContext context, String navigationPath, String regex) { - NavigationTreeModel treeModel = getSafeTreeModel(context); - return treeModel.findNode(navigationPath, regex); - } - - public NavigationTreeNode findNode(JAXXContext context, String navigationPath, Pattern regex) { - - NavigationTreeModel treeModel = getSafeTreeModel(context); - return treeModel.findNode(navigationPath, regex); - } - - public NavigationTreeNode findNode(JAXXContext context, String navigationPath, String regex, String suffix) { - - NavigationTreeModel treeModel = getSafeTreeModel(context); - - NavigationTreeNode navigationTreeNode = treeModel.findNode(navigationPath, regex); - if (navigationTreeNode != null && suffix != null) { - navigationTreeNode = treeModel.findNode(navigationTreeNode, suffix); - } - return navigationTreeNode; - } - - public NavigationTreeNode findNode(JAXXContext context, String navigationPath, Pattern regex, String suffix) { - - NavigationTreeModel treeModel = getSafeTreeModel(context); - - NavigationTreeNode navigationTreeNode = treeModel.findNode(navigationPath, regex); - if (navigationTreeNode != null && suffix != null) { - navigationTreeNode = treeModel.findNode(navigationTreeNode, suffix); - } - return navigationTreeNode; - } - - /** - * Sélection d'un noeud dans l'arbre de navigation à partir de son path. - * - * @param context le contexte applicatif - * @param tree l'arbre - * @param contextPath le path absolue du noeud dans l'arbre - */ - public void selectNode(JAXXContext context, JTree tree, String contextPath) { - NavigationTreeNode node = findNode(context, contextPath); - if (log.isDebugEnabled()) { - log.debug(contextPath + " :: " + node); - } - if (node != null) { - selectNode(context, tree, node); - } - } - - /** - * Sélection d'un noeud dans l'arbre de navigation. - * - * @param context le contexte applicatif - * @param tree l'arbre - * @param node le noeud à sélectionner dans l'arbre - */ - public void selectNode(JAXXContext context, JTree tree, NavigationTreeNode node) { - - NavigationTreeModel navigationModel = getSafeTreeModel(context); - if (log.isDebugEnabled()) { - log.debug(node); - } - TreePath path = new TreePath(navigationModel.getPathToRoot(node)); - tree.setSelectionPath(path); - tree.scrollPathToVisible(path); - if (!node.isLeaf() && !tree.isExpanded(path)) { - // expand the node to avoid a click :) - tree.expandPath(path); - } - } - - public NavigationTreeModel getSafeTreeModel(JAXXContext context) throws NullPointerException { - NavigationTreeModel treeModel = getTreeModel(context); - if (treeModel == null) { - throw new NullPointerException("could not find tree model with key " + getTreeModelContextEntry() + " in context " + context); - } - return treeModel; - } -} diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java deleted file mode 100644 index 39215f1..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java +++ /dev/null @@ -1,589 +0,0 @@ -package jaxx.runtime.swing.navigation; - - -import jaxx.runtime.JAXXAction; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXContextEntryDef; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.swing.navigation.NavigationUtil.NodeRenderer; -import org.apache.commons.jxpath.JXPathContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.TreeNode; -import java.util.Enumeration; -import java.util.StringTokenizer; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Le modele utilisé pour un arbre de navigation. - * <p/> - * Il est composé de {@link NavigationTreeModel.NavigationTreeNode} - * - * @author chemit - */ -public class NavigationTreeModel extends DefaultTreeModel { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private final Log log = LogFactory.getLog(NavigationTreeModel.class); - - static private final long serialVersionUID = 1L; - - /** the separator char used to produce the navigation path of a node. */ - protected final String navigationPathSeparator; - - public NavigationTreeModel(TreeNode root, String navigationPathSeparator) { - super(root); - this.navigationPathSeparator = navigationPathSeparator; - } - - @Override - public NavigationTreeNode getRoot() { - return (NavigationTreeNode) super.getRoot(); - } - - /** - * Search from the root node a node named by his fully path (concatenation of nodes - * {@link NavigationTreeNode#navigationPath} valued separated by dot. - * <p/> - * Example : - * <p/> - * <pre>$root.child1.leaf1</pre> - * - * @param path the fully path of the searched node. - * @return the node matching the fully context from the root node, or <code>null</code> if not find. - */ - public NavigationTreeNode findNode(String path) { - return findNode(getRoot(), path, (Pattern) null); - } - - /** - * Apply first the regex pattern to obtain the searched node fi the given <code>regex</code> is not null. - * <p/> - * Search then from the root node a node named by his fully path (concatenation of nodes - * {@link NavigationTreeNode#navigationPath} valued separated by {@link #navigationPathSeparator}. - * <p/> - * <p/> - * Example : - * <p/> - * <pre>$root.child1.leaf1</pre> - * - * @param path the fully path of the searched node. - * @param regex a optional regex to apply to path before searching - * @return the node matching the fully context from the root node, or <code>null</code> if not found. - */ - public NavigationTreeNode findNode(String path, String regex) { - return findNode(getRoot(), path, regex); - } - - /** - * Apply first the regex pattern to obtain the searched node. - * <p/> - * Search then from the root node a node named by his fully path (concatenation of nodes - * {@link NavigationTreeNode#navigationPath} valued separated by {@link #navigationPathSeparator}. - * <p/> - * Example : - * <p/> - * <pre>$root.child1.leaf1</pre> - * - * @param path the fully path of the searched node. - * @param regex a optional regex to apply to path before searching - * @return the node matching the fully context from the root node, or <code>null</code> if not found. - */ - public NavigationTreeNode findNode(String path, Pattern regex) { - return findNode(getRoot(), path, regex); - } - - - /** - * Search from a given root node a node named by his fully path (concatenation of nodes - * {@link NavigationTreeNode#navigationPath} valued separated by {@link #navigationPathSeparator}. - * - * @param root root node to be used - * @param path the fully path of the searched node. - * @return the node matching the fully context from the given root node, or <code>null</code> if not found. - */ - public NavigationTreeNode findNode(NavigationTreeNode root, String path) { - return findNode(root, path, (Pattern) null); - } - - /** - * Apply first the regex pattern to obtain the searched node. - * <p/> - * Search then from a given root node a node named by his fully path (concatenation of nodes) - * {@link NavigationTreeNode#navigationPath} valued separated by {@link #navigationPathSeparator}. - * - * @param root root node to be used - * @param path the fully path of the searched node. - * @param regex a previous regex to apply to path : must have a matches - * @return the node matching the fully context from the given root node, or <code>null</code> if not found. - */ - public NavigationTreeNode findNode(NavigationTreeNode root, String path, String regex) { - return findNode(root, path, regex == null ? null : Pattern.compile(regex)); - } - - /** - * Apply first the regex pattern to obtain the searched node. - * <p/> - * Search then from a given root node a node named by his fully path (concatenation of nodes - * {@link NavigationTreeNode#navigationPath} valued separated by {@link #navigationPathSeparator}. - * - * @param root root node to be used - * @param path the fully path of the searched node. - * @param regex a previous regex to apply to path : must have a matches - * @return the node matching the fully context from the given root node, or <code>null</code> if not found. - */ - public NavigationTreeNode findNode(NavigationTreeNode root, String path, Pattern regex) { - if (regex != null) { - Matcher matcher = regex.matcher(path); - if (!matcher.matches() || matcher.groupCount() < 1) { - log.warn("no matching regex " + regex + " to " + path); - return null; - } - path = matcher.group(1); - if (log.isDebugEnabled()) { - log.debug("matching regex " + regex + " : " + path); - } - } - StringTokenizer stk = new StringTokenizer(path, navigationPathSeparator); - NavigationTreeNode result = root; - // pas the first token (matches the root node) - if (root.isRoot() && stk.hasMoreTokens()) { - String rootPath = stk.nextToken(); - if (!rootPath.equals(root.getNavigationPath())) { - return null; - } - } - while (stk.hasMoreTokens()) { - result = result.getChild(stk.nextToken()); - } - return result; - } - - - /** - * Obtain the associated bean value from context corresponding to node from given navigation path. - * - * @param context the context where to seek value - * @param navigationPath the current context path of the node - * @return the value associated in context with the given navigation path - */ - public Object getJAXXContextValue(JAXXContext context, String navigationPath) { - Object result; - NavigationTreeNode node = findNode(navigationPath, (Pattern) null); - result = getJAXXContextValue(context, node); - return result; - } - - /** - * Obtain the associated bean value from context corresponding to node - * - * @param context the context where to seek value - * @param node the current node - * @return the value associated in context with the given node. - */ - public Object getJAXXContextValue(JAXXContext context, NavigationTreeNode node) { - if (node == null) { - return null; - //fixme should throw a NPE exception - //throw new NullPointerException("node can not be null"); - } - return node.getJAXXContextValue(context); - } - - - @Override - public void nodeChanged(TreeNode node) { - nodeChanged(node, false); - } - - public void nodeChanged(TreeNode node, boolean deep) { - NavigationTreeNode n = (NavigationTreeNode) node; - n.clearCache(!deep); - super.nodeChanged(node); - if (deep) { - Enumeration<?> childs = node.children(); - while (childs.hasMoreElements()) { - NavigationTreeNode o = (NavigationTreeNode) childs.nextElement(); - nodeChanged(o, true); - } - } - } - - /** - * la représentation d'un noeud dans le modele {@link NavigationTreeModel} - * - * @author chemit - */ - public class NavigationTreeNode extends DefaultMutableTreeNode { - - private static final long serialVersionUID = 1L; - - /** pour representer le context du noeud. */ - protected String navigationPath; - - /** - * the cached complete navigation path from root node - * used for performance issues. - */ - protected String cachedNavigationPath; - - /** the JAXXObject class associated with this node (can be null) */ - protected Class<? extends JAXXObject> jaxxClass; - - /** the JAXXAction class associated with this node and will be put in ui context */ - protected Class<? extends JAXXAction> jaxxActionClass; - - /** the definition of the JAXXContext entry associated to this node, if null will seek in parent */ - protected JAXXContextEntryDef<?> jaxxContextEntryDef; - - /** jxPath to process to obtain real value associated from context with the node (can be null) */ - protected String jaxxContextEntryPath; - - /** cache of bean associated with bean to improve performance */ - protected transient Object cachedBean; - - /** renderer of the node */ - protected NodeRenderer renderer; - - /** - * The type of the related bean associated with the node. - * <p/> - * Note: This type is here to override the NodeRenderer internalClass, since - * we could need to override this data. - * <p/> - * If this property is let to null, then we will use the NodeRenderer one - */ - protected Class<?> internalClass; - - public NavigationTreeNode(Object renderer, - Object jaxxContextEntryDef, - String navigationPath, - Class<? extends JAXXObject> jaxxClass, - Class<? extends JAXXAction> jaxxActionClass) { - super(renderer); - if (renderer instanceof NodeRenderer) { - // the renderer must keep a reference of the node - this.renderer = (NodeRenderer) renderer; - this.renderer.setNode(this); - } else if (renderer instanceof String) { - // nothing special to be done - } else if (renderer != null) { - // wrong renderer type - throw new IllegalArgumentException("to define a renderer, must be a String (simple libelle) or a " + NodeRenderer.class + ", but was " + renderer); - } - this.navigationPath = navigationPath; - this.jaxxClass = jaxxClass; - this.jaxxActionClass = jaxxActionClass; - - if (jaxxContextEntryDef instanceof JAXXContextEntryDef<?>) { - this.jaxxContextEntryDef = ((JAXXContextEntryDef<?>) jaxxContextEntryDef); - } else if (jaxxContextEntryDef instanceof String) { - this.jaxxContextEntryPath = (String) jaxxContextEntryDef; - } else if (jaxxContextEntryDef != null) { - // wrong context definition type - throw new IllegalArgumentException("to define a context link, must be a String (jxpath) or a " + JAXXContextEntryDef.class + ", but was " + jaxxContextEntryDef); - } - } - - public NavigationTreeNode(Object renderer, - JAXXContextEntryDef<?> jaxxContextEntryDef, - String jaxxContextEntryPath, - String navigationPath, - Class<? extends JAXXObject> jaxxClass, - Class<? extends JAXXAction> jaxxActionClass) { - super(renderer); - if (renderer instanceof NodeRenderer) { - // the renderer must keep a reference of the node - this.renderer = (NodeRenderer) renderer; - this.renderer.setNode(this); - } else if (renderer instanceof String) { - // nothing special to be done - } else if (renderer != null) { - // wrong renderer type - throw new IllegalArgumentException("to define a renderer, must be a String (simple libelle) or a " + NodeRenderer.class + ", but was " + renderer); - } - this.navigationPath = navigationPath; - this.jaxxClass = jaxxClass; - this.jaxxActionClass = jaxxActionClass; - this.jaxxContextEntryDef = jaxxContextEntryDef; - this.jaxxContextEntryPath = jaxxContextEntryPath; - } - - public String getNavigationPath() { - return navigationPath; - } - - public void setNavigationPath(String navigationPath) { - this.navigationPath = navigationPath; - } - - public Class<? extends JAXXObject> getJaxxClass() { - return jaxxClass; - } - - public void setJaxxClass(Class<? extends JAXXObject> jaxxClass) { - this.jaxxClass = jaxxClass; - } - - public void setInternalClass(Class<?> internalClass) { - this.internalClass = internalClass; - } - - public Class<? extends JAXXAction> getJaxxActionClass() { - return jaxxActionClass; - } - - public void setJaxxActionClass(Class<? extends JAXXAction> jaxxActionClass) { - this.jaxxActionClass = jaxxActionClass; - } - - public JAXXContextEntryDef<?> getJaxxContextEntryDef() { - return jaxxContextEntryDef; - } - - public void setJaxxContextEntryDef(JAXXContextEntryDef<?> jaxxContextEntryDef) { - this.jaxxContextEntryDef = jaxxContextEntryDef; - } - - public String getJaxxContextEntryPath() { - return jaxxContextEntryPath; - } - - public void setJaxxContextEntryPath(String jaxxContextEntryPath) { - this.jaxxContextEntryPath = jaxxContextEntryPath; - } - - public Class<?> getInternalClass() { - return internalClass == null ? renderer.getInternalClass() : internalClass; - } - - /** @return the fully context pathof the node from the root node to this. */ - public String getContextPath() { - if (cachedNavigationPath == null) { - TreeNode[] path = getPath(); - StringBuilder sb = new StringBuilder(); - for (TreeNode treeNode : path) { - NavigationTreeNode myNode = (NavigationTreeNode) treeNode; - sb.append(navigationPathSeparator).append(myNode.getNavigationPath()); - } - cachedNavigationPath = sb.substring(1); - } - return cachedNavigationPath; - } - - @Override - public NavigationTreeNode getChildAt(int index) { - return (NavigationTreeNode) super.getChildAt(index); - } - - @Override - public NavigationTreeNode getParent() { - return (NavigationTreeNode) super.getParent(); - } - - /** - * @param navigationPath the name of the {@link #navigationPath} to be matched in the cild of this node. - * @return the child of this node with given {@link # navigationPath} value. - */ - public NavigationTreeNode getChild(String navigationPath) { - for (int i = 0, max = getChildCount(); i < max; i++) { - NavigationTreeNode son = getChildAt(i); - if (navigationPath.equals(son.getNavigationPath())) { - return son; - } - } - return null; - } - - /** - * Obtain the associated bean value from context corresponding to node - * - * @param context the context to seek - * @return the value associated in context with the given context path - */ - public Object getJAXXContextValue(JAXXContext context) { - Object result; - - if (cachedBean != null) { - // use cached bean - return cachedBean; - } - - if (getJaxxContextEntryDef() != null && jaxxContextEntryPath == null) { - // the node maps directly a value in context, with no jxpath resolving - result = getJaxxContextEntryDef().getContextValue(context); - // save in cache - setCachedBean(result); - return result; - } - // find the first ancestor node with a context def - NavigationTreeNode parentNode = getFirstAncestorWithDef(); - if (parentNode == null) { - log.warn("could not find a ancestor node with a definition of a context entry from node (" + this + ")"); - // todo must be an error - // no parent found - return null; - } - - Object parentBean = parentNode.getJaxxContextEntryDef().getContextValue(context); - - if (parentBean == null) { - // must be an error no bean found - log.warn("culd not find a bean attached in context from context entry definition " + parentNode.getJaxxContextEntryDef()); - return null; - } - - if (parentNode.jaxxContextEntryPath != null) { - // apply the jxpath on parentBean - JXPathContext jxcontext = JXPathContext.newContext(parentBean); - - parentBean = jxcontext.getValue(parentNode.jaxxContextEntryPath); - } - - // save in cache - parentNode.setCachedBean(parentBean); - - if (this == parentNode) { - // current node is the node matching the context entry value and no jxpath is found - return parentBean; - } - - if (jaxxContextEntryPath == null) { - // todo must be an error - log.warn("must find a jaxxContextEntryPath on node (" + this + ")"); - return null; - } - - String jxpathExpression = computeJXPath(jaxxContextEntryPath, parentNode); - - if (jxpathExpression == null) { - /// todo must be an error - log.warn("could not build jxpath from node " + parentNode + " to " + this); - // could not retreave the jxpath... - return null; - } - if (jxpathExpression.startsWith("[")) { - // special case when we want to access a collection - jxpathExpression = '.' + jxpathExpression; - } - if (log.isDebugEnabled()) { - log.debug("jxpath : " + jxpathExpression); - } - - JXPathContext jxcontext = JXPathContext.newContext(parentBean); - - result = jxcontext.getValue(jxpathExpression); - - // save in cache - setCachedBean(result); - - return result; - } - - /** - * @return the first ancestor with a none null {@link #jaxxContextEntryDef} - * or <code>null</code> if none find.. - */ - protected NavigationTreeNode getFirstAncestorWithDef() { - if (jaxxContextEntryDef != null) { - return this; - } - return getParent() == null ? null : getParent().getFirstAncestorWithDef(); - } - - protected String computeJXPath(String expr, NavigationTreeNode parentNode) { - if (parentNode == this) { - // reach the parent limit node, return the expr computed - return expr; - } - int firstIndex = expr.indexOf(".."); - int lastIndex = expr.lastIndexOf(".."); - - if (firstIndex == -1) { - // this is a error, since current node is not parent limit node, - // we must find somewhere a way to go up in nodes - throw new IllegalArgumentException(expr + " should contains at least one \"..\""); - } - - if (firstIndex != 0) { - // this is a error, the ../ must be at the beginning of the expression - throw new IllegalArgumentException("\"..\" must be at the beginning but was : " + expr); - } - - NavigationTreeNode ancestor = getParent(); - - if (firstIndex == lastIndex) { - // found only one go up, so must be substitute by the parent node context - - String newExpr = expr.substring(2); - //String newExpr = expr.substring(expr.startsWith("../") ? 3 : 2); - - if (getParent().equals(parentNode)) { - - // parent node is the final parent node, so no substitution needed - return newExpr; - //return parentNode.computeJXPath(newExpr, parentNode); - } - - // ancestor must have a jaxxContextEntryPath - if (ancestor.jaxxContextEntryPath == null) { - throw new IllegalArgumentException("with the expression " + expr + ", the ancestor node (" + ancestor + ") must have a jaxxContextEntryPath definition, but was not "); - } - - newExpr = ancestor.jaxxContextEntryPath + newExpr; - - return ancestor.computeJXPath(newExpr, parentNode); - } - - // have more than one go up, so the ancestor node can not have a jaxxContextEntryPath - if (ancestor.jaxxContextEntryPath != null) { - throw new IllegalArgumentException("with the expression " + expr + ", the ancestor node can not have a jaxxContextEntryPath definition"); - } - - // substitute the last ..[/] and delegate to ancestor - String newExpr = expr.substring(0, lastIndex - 1) + expr.substring(lastIndex + (expr.charAt(lastIndex + 3) == '/' ? 3 : 2)); - - return ancestor.computeJXPath(newExpr, parentNode); - } - - public void clearCache() { - clearCache(false); - } - - public void clearCache(boolean deep) { - - // clear bean cache - cachedBean = null; - - // clear context navigation cache - cachedNavigationPath = null; - - // clear render cache - if (renderer != null) { - renderer.setRendererCachedValue(null); - } - - if (deep) { - // clear cache in childs - Enumeration<?> childs = this.children(); - while (childs.hasMoreElements()) { - NavigationTreeNode o = (NavigationTreeNode) childs.nextElement(); - o.clearCache(); - } - } - } - - public Object getCachedBean() { - return cachedBean; - } - - public void setCachedBean(Object cachedBean) { - this.cachedBean = cachedBean; - } - } - -} diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java deleted file mode 100644 index 1c69af6..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java +++ /dev/null @@ -1,210 +0,0 @@ -package jaxx.runtime.swing.navigation; - -import java.util.Enumeration; -import jaxx.runtime.Decorator; -import jaxx.runtime.JAXXAction; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXContextEntryDef; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import jaxx.runtime.swing.navigation.NavigationUtil.NodeRenderer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * This object is design to build a {@link NavigationTreeModel}. - * - * - * @author chemit - */ -public class NavigationTreeModelBuilder { - - /** - * Logger - */ - static private final Log log = LogFactory.getLog(NavigationTreeModelBuilder.class); - /** - * The model deal by the builder. - * - * <b>Note:</b> It is a good idea to keep only one instance of the model. - * If reset is required, should empty the model but not reinstanciate it. - */ - protected NavigationTreeModel model; - - public NavigationTreeModelBuilder(String navigationSeparator) { - model = new NavigationTreeModel(null, navigationSeparator); - } - - public NavigationTreeModel getModel() { - return model; - } - - public NavigationTreeNode buildEmptyRoot(JAXXContextEntryDef<?> entryDef, String contextName) { - NavigationTreeNode node = model.new NavigationTreeNode(new NodeRenderer(""), entryDef, null, contextName, null, null); - return addChildNode(null, node); - } - - public NavigationTreeNode build(NavigationTreeNode parentNode, String libelle, - JAXXContextEntryDef<?> entryDef, - String entryPath, - String contextName, - Class<? extends JAXXObject> uiClass, - Class<? extends JAXXAction> actionClass) { - NavigationTreeNode node = model.new NavigationTreeNode(new NodeRenderer(libelle), entryDef, entryPath, contextName, uiClass, actionClass); - return addChildNode(parentNode, node); - } - - public NavigationTreeNode build(NavigationTreeNode parentNode, String libelle, - JAXXContextEntryDef<?> entryDef, - String contextName, - Class<? extends JAXXObject> uiClass, - Class<? extends JAXXAction> actionClass) { - NavigationTreeNode node = model.new NavigationTreeNode(new NodeRenderer(libelle), entryDef, contextName, uiClass, actionClass); - return addChildNode(parentNode, node); - } - - public NavigationTreeNode build(NavigationTreeNode parentNode, String libelle, - String entryPath, - String contextName, - Class<? extends JAXXObject> uiClass, - Class<? extends JAXXAction> actionClass) { - NavigationTreeNode node = model.new NavigationTreeNode(new NodeRenderer(libelle), entryPath, contextName, uiClass, actionClass); - return addChildNode(parentNode, node); - } - - public NavigationTreeNode build(NavigationTreeNode parentNode, Decorator<?> decorator, - JAXXContextEntryDef<?> entryDef, - String entryPath, - String contextName, - Class<? extends JAXXObject> uiClass, - Class<? extends JAXXAction> actionClass) { - NavigationTreeNode node = model.new NavigationTreeNode(new NodeRenderer(decorator), entryDef, entryPath, contextName, uiClass, actionClass); - return addChildNode(parentNode, node); - } - - public NavigationTreeNode build(NavigationTreeNode parentNode, Decorator<?> decorator, - JAXXContextEntryDef<?> entryDef, - String contextName, - Class<? extends JAXXObject> uiClass, - Class<? extends JAXXAction> actionClass) { - NavigationTreeNode node = model.new NavigationTreeNode(new NodeRenderer(decorator), entryDef, contextName, uiClass, actionClass); - return addChildNode(parentNode, node); - } - - public NavigationTreeNode build(NavigationTreeNode parentNode, Decorator<?> decorator, - String entryPath, - String contextName, - Class<? extends JAXXObject> uiClass, - Class<? extends JAXXAction> actionClass) { - NavigationTreeNode node = model.new NavigationTreeNode(new NodeRenderer(decorator), entryPath, contextName, uiClass, actionClass); - return addChildNode(parentNode, node); - } - - protected NavigationTreeNode addChildNode(NavigationTreeNode parentNode, NavigationTreeNode node) { - if (parentNode == null) { - model.setRoot(node); - } else { - parentNode.add(node); - } - model.nodeStructureChanged(parentNode); - return node; - } - - public NavigationTreeNode removeChildNode(NavigationTreeNode node) { - NavigationTreeNode parentNode = node.getParent(); - model.removeNodeFromParent(node); - return parentNode; - } - - public void finalizeModel(NavigationTreeNode node, Class<? extends JAXXObject> defaultUIClass, Class<? extends JAXXAction> defaultUIHandlerClass) { - if (node == null) { - return; - } - if (node.getJaxxClass() == null) { - // no ui is associated with this node, display a empty content - node.setJaxxClass(defaultUIClass); - } - - if (node.getJaxxActionClass() == null) { - node.setJaxxActionClass(defaultUIHandlerClass); - } - Enumeration<?> children = node.children(); - while (children.hasMoreElements()) { - finalizeModel((NavigationTreeNode) children.nextElement(), defaultUIClass, defaultUIHandlerClass); - } - - } - - public void printModel(JAXXContext context, NavigationTreeNode node) { - if (node == null) { - return; - } - log.info("node " + node.getContextPath() + ", jxpath: " + node.getJaxxContextEntryPath() + ", entryContextDef: " + node.getJaxxContextEntryDef()); - if (log.isDebugEnabled()) { - log.debug("node userObject" + node.getUserObject()); - log.debug("value from node " + node.getJAXXContextValue(context)); - log.debug("value from model " + model.getJAXXContextValue(context, node)); - } - Enumeration<?> children = node.children(); - while (children.hasMoreElements()) { - printModel(context, (NavigationTreeNode) children.nextElement()); - } - } - - public static abstract class ChildBuilder<O> { - - protected NavigationTreeModelBuilder builder; - - protected ChildBuilder(NavigationTreeModelBuilder builder) { - this.builder = builder; - } - - protected abstract void init(Class<? extends O> klass); - - protected abstract Decorator<? extends O> getDecorator(O child); - - protected abstract String getJXPath(O child); - - protected abstract String getNavigationPath(O child); - - public void build(NavigationTreeNode parent, boolean cacheValues, Class<? extends O> klass, java.util.Collection<? extends O> beans, Class<? extends JAXXObject> ui, Class<? extends JAXXAction> actionClass) { - - if (beans == null || beans.isEmpty()) { - // no bean to treate - return; - } - - init(klass); - - NavigationTreeNode node; - - for (O o : beans) { - node = builder.build(parent, getDecorator(o), getJXPath(o), getNavigationPath(o), ui, actionClass); - if (cacheValues) { - // cache the bean value to improve performance - node.setCachedBean(o); - } - } - } - - public void build(NavigationTreeNode parent, boolean cacheValues, Class<? extends O> klass, O[] beans, Class<? extends JAXXObject> ui, Class<? extends JAXXAction> actionClass) { - - if (beans == null || beans.length == 0) { - // no bean to treate - return; - } - - init(klass); - - NavigationTreeNode node; - - for (O o : beans) { - node = builder.build(parent, getDecorator(o), getJXPath(o), getNavigationPath(o), ui, actionClass); - if (cacheValues) { - // cache the bean value to improve performance - node.setCachedBean(o); - } - } - } - } -} diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeSelectionAdapter.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeSelectionAdapter.java deleted file mode 100644 index 1564107..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeSelectionAdapter.java +++ /dev/null @@ -1,248 +0,0 @@ -package jaxx.runtime.swing.navigation; - -import jaxx.runtime.JAXXAction; -import jaxx.runtime.JAXXContextEntryDef; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.swing.JTree; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.TreePath; -import java.awt.Component; - -/** - * A {@link javax.swing.event.TreeSelectionListener} implementation - * @author chemit - * @deprecated since 1.7.2, use now {@link NavigationTreeHandler} - */ -@Deprecated -public abstract class NavigationTreeSelectionAdapter implements TreeSelectionListener { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private final Log log = LogFactory.getLog(NavigationTreeSelectionAdapter.class); - - //static public final String NAVIGATION_CONTEXT_PATH = "navigation-context-path"; - - //static public final String NAVIGATION_SELECTED_NODE = "navigation-selected-node"; - - static public final String NAVIGATION_SELECTED_BEAN = "navigation-selected-bean"; - - static public final JAXXContextEntryDef<String> NAVIGATION_SELECTED_PATH_ENTRY_DEF = JAXXContextEntryDef.newDef("navigation-selected-path", String.class); - - static public final JAXXContextEntryDef<NavigationTreeNode> NAVIGATION_SELECTED_NODE_ENTRY_DEF = JAXXContextEntryDef.newDef("navigation-selected-node", NavigationTreeNode.class); - - static public final JAXXContextEntryDef<Boolean> GO_BACK_DEF = JAXXContextEntryDef.newDef("goBack", Boolean.class); - - /** defined the stategy of instanciation of ui */ - public enum Strategy { - /** instanciate a ui for a node */ - PER_NODE, - /** instanciate only one a ui for a type,nodes will share the instanciation */ - PER_UI_TYPE - } - - /** la classe d'ui par defaut, associé à un noeud de l'arbe */ - protected Class<? extends JAXXObject> defaultUIClass; - - protected Class<? extends JAXXAction> defaultUIHandlerClass; - - /** l'ui contenant l'arbre de navigation */ - protected JAXXObject context; - - protected Strategy strategy; - - protected NavigationTreeSelectionAdapter(Class<? extends JAXXObject> defaultUIClass, Class<? extends JAXXAction> defaultUIHandlerClass, JAXXObject context, Strategy strategy) { - this.defaultUIClass = defaultUIClass; - this.defaultUIHandlerClass = defaultUIHandlerClass; - this.context = context; - this.strategy = strategy; - } - - - protected abstract NavigationTreeModel getNavigationTreeModel(); - - /** - * @return le composent actuellement visible associé au noeud courant ou au noeud précédent - * lors d'un changement de noeud. - */ - protected abstract Component getCurrentUI(); - - /** - * @param node le noeud associé à l'ui à retrouver - * @return l'ui associé au novueau noeud sélectionné - */ - protected abstract Component getUI(NavigationTreeNode node); - - /** - * @param event l'evenement de selection de noeud - * @param component le composent actuellement visible - * @return <code>true</code> si le composent a bien été fermé, <code>false</code> sinon - * @throws Exception if any - */ - protected abstract boolean closeUI(TreeSelectionEvent event, Component component) throws Exception; - - /** - * Instancie une nouvelle ui associé à un noeud de l'arbre de navigation - * - * @param node le noeud associé à l'ui à créer - * @return la nouvelle ui associée au noeud - * @throws Exception if any - */ - protected abstract Component createUI(NavigationTreeNode node) throws Exception; - - /** - * Ouvre l'ui associée au noeud sélectionné dans l'arbre de navigation. - * - * @param newUI l'ui associé au noeud sélectionné à ouvrir - * @param node le node de l'ui a ouvrir - * @throws Exception if any - */ - protected abstract void openUI(Component newUI, NavigationTreeNode node) throws Exception; - - /** - * Retourne au noeud précdemment sélectionné dans l'arbre de navigation, avec la possibilité de notifier - * une erreure survenue. - * - * @param event l'évènement de changement de noeud sélectionné. - * @param e l'erreur recontrée (ou null si pas d"erreur) - */ - protected abstract void goBackToPreviousNode(TreeSelectionEvent event, Exception e); - - /** - * Prepare le nouveau noeud sélectionné. - * - * @param event l'évènement de selection du noeud - * @return le noeud selectionné et preparé - */ - protected NavigationTreeNode prepareNode(TreeSelectionEvent event) { - NavigationTreeNode node = (NavigationTreeNode) event.getPath().getLastPathComponent(); - - if (node.getJaxxClass() == null) { - // no ui is associated with this node, display a empty content - node.setJaxxClass(defaultUIClass); - } - - if (node.getJaxxActionClass() == null) { - node.setJaxxActionClass(defaultUIHandlerClass); - } - return node; - } - - @Override - public void valueChanged(TreeSelectionEvent event) { - if (event.getOldLeadSelectionPath() != null && event.getOldLeadSelectionPath().equals(event.getPath())) { - // do not treate this if no path changed - return; - } - - Boolean goBack = GO_BACK_DEF.getContextValue(context); - if (goBack != null && goBack) { - // do not treate this, apsecial flag told us :) - GO_BACK_DEF.removeContextValue(context); - return; - } - - try { - - NavigationTreeNode node = prepareNode(event); - - String path = node.getContextPath(); - - if (log.isTraceEnabled()) { - log.trace(path); - } - - Component newUI = getUI(node); - Component component = getCurrentUI(); - - if (newUI != null && strategy == Strategy.PER_NODE && newUI.equals(component)) { - // call back from goto back to previous node, do nothing - return; - } - - if (!closeUI(event, component)) { - GO_BACK_DEF.setContextValue(context, Boolean.TRUE); - // previous ui was not closed, so reselect the previous node in navigation - goBackToPreviousNode(event, null); - // and quit - return; - } - - // now, we are free to open the ui associated with the selected node in navigation - - // always clean cache on the node before all - node.cachedBean = null; - if (node.renderer != null) { - node.renderer.setRendererCachedValue(null); - } - // before all, attach bean in context associated with the selected node in naivgation tree - Object data = getNavigationTreeModel().getJAXXContextValue(context, path); - - addSelectedBeanInContext(node, data); - - if (newUI == null) { - // instanciate a new ui associated with the selected node - newUI = createUI(node); - } - - // save in context current node context path - NAVIGATION_SELECTED_PATH_ENTRY_DEF.setContextValue(context, node.getContextPath()); - - // save in context current node - NAVIGATION_SELECTED_NODE_ENTRY_DEF.setContextValue(context, node); - - // really open the ui associated with the selected node - openUI(newUI, node); - - } catch (Exception e) { - // remove data from context - - // if any error, go back to previvous node - goBackToPreviousNode(event, e); - } - } - - protected void addSelectedBeanInContext(NavigationTreeNode node, Object data) { - - if (log.isDebugEnabled()) { - log.debug("find data for contextPath <" + node.getContextPath() + "> : " + (data == null ? null : data.getClass())); - } - - context.removeContextValue(Object.class, NAVIGATION_SELECTED_BEAN); - - if (data != null) { - context.setContextValue(data, NAVIGATION_SELECTED_BEAN); - //todo should we not use this to avoid conflict in context ? - context.setContextValue(data); - } - } - - protected String getNodeConstraints(NavigationTreeNode node) { - String constraints; - switch (strategy) { - case PER_NODE: - constraints = node.getContextPath(); - break; - case PER_UI_TYPE: - constraints = node.getJaxxClass().getName(); - break; - default: - throw new IllegalArgumentException("could not find constraint for node : " + node); - } - return constraints; - } - - protected void returnToPreviousNode(JTree tree, TreeSelectionEvent event) { - // go back to previous node - // put in context a tag to not come back again here - TreePath oldPath = event.getOldLeadSelectionPath(); - //NavigationTreeNode oldNode = (NavigationTreeNode) oldPath.getLastPathComponent(); - if (oldPath != null) { - tree.setSelectionPath(oldPath); - } - } - -} \ No newline at end of file diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeSelectionAdapterWithCardLayout.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeSelectionAdapterWithCardLayout.java deleted file mode 100644 index 1a79bd6..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeSelectionAdapterWithCardLayout.java +++ /dev/null @@ -1,110 +0,0 @@ -package jaxx.runtime.swing.navigation; - -import jaxx.runtime.JAXXAction; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXInitialContext; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.swing.CardLayout2; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.swing.JPanel; -import javax.swing.event.TreeSelectionEvent; -import java.awt.Component; - -/** - * Simple {@link NavigationTreeSelectionAdapter} implementation with a {@link jaxx.runtime.swing.CardLayout2} to manage components to - * associated with tree's nodes. - * <p/> - * For each node, the ui associated has a constraints in a cardlayout which is the node context path. - * <p/> - * A single container managed by the cardlayout is used to display the components associated with tree's nodes. - * - * @author chemit - * @deprecated since 1.7.2, use now {@link NavigationTreeHandler} - */ -@Deprecated -public abstract class NavigationTreeSelectionAdapterWithCardLayout extends NavigationTreeSelectionAdapter { - - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private final Log log = LogFactory.getLog(NavigationTreeSelectionAdapterWithCardLayout.class); - - /** - * All components associated with a tree's node is displayed in a single container. - * - * @return the containter of components - */ - protected abstract JPanel getContentContainer(); - - /** - * the cardlayout managing components associated with tree node. The constraints - * of each component is the node contextPath. - * - * @return the layout used to display components associated with tree's nodes. - */ - protected abstract CardLayout2 getContentLayout(); - - public NavigationTreeSelectionAdapterWithCardLayout(Class<? extends JAXXObject> defaultUIClass, Class<? extends JAXXAction> defaultUIHandlerClass, JAXXObject context, Strategy strategy) { - super(defaultUIClass, defaultUIHandlerClass, context,strategy); - - if (getContentContainer() == null) { - throw new IllegalArgumentException("could not have a null 'contentContainer' in ui " + context); - } - if (getContentLayout() == null) { - throw new IllegalArgumentException("could not have a null 'contentLayout' in ui " + context); - } - } - - protected Component getCurrentUI() { - CardLayout2 layout = getContentLayout(); - JPanel container = getContentContainer(); - return layout.getVisibleComponent(container); - } - - protected Component getUI(NavigationTreeNode node) { - CardLayout2 layout = getContentLayout(); - JPanel container = getContentContainer(); - String path = getNodeConstraints(node); - return layout.contains(path) ? layout.getComponent(container, path) : null; - } - - protected void openUI(Component newUI, NavigationTreeNode node) throws Exception { - - CardLayout2 layout = getContentLayout(); - JPanel container = getContentContainer(); - // switch layout - layout.show(container, getNodeConstraints(node)); - } - - protected boolean closeUI(TreeSelectionEvent event, Component component) throws Exception { - // by default, we says that component was succesfull closed - return true; - } - - protected Component createUI(NavigationTreeNode node) throws Exception { - JAXXObject newUI; - - if (node.getJaxxActionClass() != null) { - JAXXAction action = node.getJaxxActionClass().newInstance(); - // init context with - JAXXInitialContext context = action.init(this.context); - // must instanciate the ui with an JAXXInitialContext - newUI = node.getJaxxClass().getConstructor(JAXXContext.class).newInstance(context); - } else { - if (log.isWarnEnabled()) { - log.warn("no action associated with ui " + node.getJaxxClass()); - } - // no action associated, just - newUI = node.getJaxxClass().getConstructor(JAXXContext.class).newInstance(this.context); - } - if (log.isDebugEnabled()) { - log.debug("instanciate new ui " + newUI); - } - - getContentContainer().add((Component) newUI, getNodeConstraints(node)); - return (Component) newUI; - } -} - diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationUtil.java b/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationUtil.java deleted file mode 100644 index 1c8eb1b..0000000 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/NavigationUtil.java +++ /dev/null @@ -1,264 +0,0 @@ -package jaxx.runtime.swing.navigation; - -import jaxx.runtime.Decorator; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import static org.nuiton.i18n.I18n._; - -import java.lang.reflect.InvocationTargetException; -import java.util.regex.Pattern; - -/** - * Usefull methods on {@link NavigationTreeModel} and others. - * - * The class is deprecated since it is not safe context, and can not be used - * with more than one navigation tree in a same context. - * - * Now use the {@link NavigationTreeContextHelper} and {@link NavigationTreeHelper} - * which are context safe and more friendly. - * - * @author chemit - * - * @see jaxx.runtime.swing.navigation.NavigationTreeModel - * @see jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode - * - * @deprecated since 1.7.2, prefer use a {@link NavigationTreeHelper} or - * {@link NavigationTreeContextHelper} to access data releated to a tree navigation - */ -@Deprecated -public class NavigationUtil { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private final Log log = LogFactory.getLog(NavigationUtil.class); - - /** - * - * @param context - * @return - * @deprecated since 1.7.2, prefer use a {@link NavigationTreeContextHelper} - * to access data releated to a tree navigation - */ - @Deprecated - public static String getCurrentNavigationNath(JAXXContext context) { - return NavigationTreeSelectionAdapter.NAVIGATION_SELECTED_PATH_ENTRY_DEF.getContextValue(context); - } - - /** - * - * @param context - * @return - * @deprecated since 1.7.2, prefer use a {@link NavigationTreeContextHelper} - * to access data releated to a tree navigation - */ - @Deprecated - public static NavigationTreeNode getSelectedNode(JAXXContext context) { - return NavigationTreeSelectionAdapter.NAVIGATION_SELECTED_NODE_ENTRY_DEF.getContextValue(context); - } - - /** - * - * @param <O> - * @param context - * @param clazz - * @return - * @deprecated since 1.7.2, prefer use a {@link NavigationTreeContextHelper} - * to access data releated to a tree navigation - */ - @Deprecated - public static <O> O getSelectedBean(JAXXContext context, Class<O> clazz) { - return context.getContextValue(clazz, NavigationTreeSelectionAdapter.NAVIGATION_SELECTED_BEAN); - } - - /** - * - * @param context - * @param contextKey - * @param navigationPath - * @return - * @throws InvocationTargetException - * @throws NoSuchMethodException - * @throws IllegalAccessException - * @deprecated since 1.7.2, prefer use a {@link NavigationTreeHelper} - * to access data releated to a tree navigation - */ - @Deprecated - public static Object getContextValue(JAXXContext context, String contextKey, String navigationPath) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException { - - NavigationTreeModel navigationModel = context.getContextValue(NavigationTreeModel.class, contextKey); - - return navigationModel.getJAXXContextValue(context, navigationPath); - } - - /** - * - * @param context - * @param contextKey - * @param navigationPath - * @return - * @deprecated since 1.7.2, prefer use a {@link NavigationTreeHelper} - * to access data releated to a tree navigation - */ - @Deprecated - public static NavigationTreeNode findNode(JAXXContext context, String contextKey, String navigationPath) { - - NavigationTreeModel navigationModel = context.getContextValue(NavigationTreeModel.class, contextKey); - - return navigationModel.findNode(navigationPath); - } - - /** - * - * @param context - * @param contextKey - * @param navigationPath - * @param regex - * @return - * @deprecated since 1.7.2, prefer use a {@link NavigationTreeHelper} - * to access data releated to a tree navigation - */ - @Deprecated - public static NavigationTreeNode findNode(JAXXContext context, String contextKey, String navigationPath, String regex) { - - NavigationTreeModel navigationModel = context.getContextValue(NavigationTreeModel.class, contextKey); - - return navigationModel.findNode(navigationPath, regex); - } - - /** - * - * @param context - * @param contextKey - * @param navigationPath - * @param regex - * @return - * @deprecated since 1.7.2, prefer use a {@link NavigationTreeHelper} - * to access data releated to a tree navigation - */ - @Deprecated - public static NavigationTreeNode findNode(JAXXContext context, String contextKey, String navigationPath, Pattern regex) { - - NavigationTreeModel navigationModel = context.getContextValue(NavigationTreeModel.class, contextKey); - - return navigationModel.findNode(navigationPath, regex); - } - - /** - * - * @param context - * @param contextKey - * @param navigationPath - * @param regex - * @param suffix - * @return - * @deprecated since 1.7.2, prefer use a {@link NavigationTreeHelper} - * to access data releated to a tree navigation - */ - @Deprecated - public static NavigationTreeNode findNode(JAXXContext context, String contextKey, String navigationPath, String regex, String suffix) { - - NavigationTreeModel navigationModel = context.getContextValue(NavigationTreeModel.class, contextKey); - - NavigationTreeNode navigationTreeNode = navigationModel.findNode(navigationPath, regex); - if (navigationTreeNode != null && suffix != null) { - navigationTreeNode = navigationModel.findNode(navigationTreeNode, suffix); - } - return navigationTreeNode; - } - - /** - * - * @param context - * @param contextKey - * @param navigationPath - * @param regex - * @param suffix - * @return - * @deprecated since 1.7.2, prefer use a {@link NavigationTreeHelper} - * to access data releated to a tree navigation - */ - @Deprecated - public static NavigationTreeNode findNode(JAXXContext context, String contextKey, String navigationPath, Pattern regex, String suffix) { - - NavigationTreeModel navigationModel = context.getContextValue(NavigationTreeModel.class, contextKey); - - NavigationTreeNode navigationTreeNode = navigationModel.findNode(navigationPath, regex); - if (navigationTreeNode != null && suffix != null) { - navigationTreeNode = navigationModel.findNode(navigationTreeNode, suffix); - } - return navigationTreeNode; - } - - public static class NodeRenderer implements java.io.Serializable { - - protected String libelle; - - protected Decorator<?> decorator; - - protected NavigationTreeNode node; - - protected Class<?> internalClass; - - protected String rendererCachedValue; - - private static final long serialVersionUID = -1238962588426200861L; - - public NodeRenderer(String libelle) { - this.libelle = libelle; - this.internalClass = String.class; - } - - public NodeRenderer(Decorator<?> decorator) { - this.decorator = decorator; - this.internalClass = decorator.getInternalClass(); - } - - public String toString(JAXXContext context) { - if (rendererCachedValue != null) { - return rendererCachedValue; - } - - String result; - - if (libelle != null) { - // simple libelle renderer - result = _(libelle); - } else { - - // with decorator renderer - - try { - Object bean = node.getJAXXContextValue(context); - result = decorator.toString(bean); - - } catch (Exception e) { - result = ""; - } - } - setRendererCachedValue(result); - return result; - } - - public void setNode(NavigationTreeNode node) { - this.node = node; - } - - public Class<?> getInternalClass() { - return internalClass; - } - - public void setRendererCachedValue(String rendererCachedValue) { - this.rendererCachedValue = rendererCachedValue; - if (log.isDebugEnabled()) { - log.debug(rendererCachedValue); - } - } - - public String getRendererCachedValue() { - return rendererCachedValue; - } - - } - -} diff --git a/jaxx-runtime-swing/src/main/resources/i18n/jaxx-runtime-swing-en_GB.properties b/jaxx-runtime-swing/src/main/resources/i18n/jaxx-runtime-swing-en_GB.properties deleted file mode 100644 index 0374c36..0000000 --- a/jaxx-runtime-swing/src/main/resources/i18n/jaxx-runtime-swing-en_GB.properties +++ /dev/null @@ -1,9 +0,0 @@ -validator.field.header=Property -validator.field.header.tip=Property on which message occurs -validator.field.tip=Property '%1$s' -validator.message.header=Message -validator.message.header.tip=The message text -validator.message.tip=Message \: %1$s -validator.scope.header=... -validator.scope.header.tip=The message scope -validator.scope.tip=Message scope \: '%1$s' diff --git a/jaxx-runtime-swing/src/site/site.xml b/jaxx-runtime-swing/src/site/site.xml deleted file mode 100644 index 6c8144f..0000000 --- a/jaxx-runtime-swing/src/site/site.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="${project.name}"> - - <bannerLeft> - <name>${project.name}</name> - <src>${site.home.url}/jaxx.png</src> - <href>index.html</href> - </bannerLeft> - - <body> - - <breadcrumbs> - <item name="${project.name}" href="${project.url}" /> - </breadcrumbs> - - <menu ref="parent"/> - - <menu name="Utilisateur" inherited="top"/> - - <menu ref="reports"/> - - <menu ref="modules"/> - - </body> -</project> diff --git a/jaxx-example/LICENSE.txt b/jaxx-runtime/LICENSE.txt similarity index 100% rename from jaxx-example/LICENSE.txt rename to jaxx-runtime/LICENSE.txt diff --git a/jaxx-example/README.txt b/jaxx-runtime/README.txt similarity index 100% rename from jaxx-example/README.txt rename to jaxx-runtime/README.txt diff --git a/jaxx-runtime-api/changelog.txt b/jaxx-runtime/changelog.txt similarity index 100% rename from jaxx-runtime-api/changelog.txt rename to jaxx-runtime/changelog.txt diff --git a/jaxx-runtime-api/pom.xml b/jaxx-runtime/pom.xml similarity index 88% rename from jaxx-runtime-api/pom.xml rename to jaxx-runtime/pom.xml index 2792cdc..c0da43b 100644 --- a/jaxx-runtime-api/pom.xml +++ b/jaxx-runtime/pom.xml @@ -10,11 +10,11 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>1.7.2-SNAPSHOT</version> + <version>2.0.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-runtime-api</artifactId> + <artifactId>jaxx-runtime</artifactId> <dependencies> @@ -62,8 +62,8 @@ <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>${project.artifactId}</name> - <description>Jaxx runtime api</description> + <name>JAXX Runtime</name> + <description>JAXX Runtime api</description> <!-- ************************************************************* --> <!-- *** Build Settings ****************************************** --> @@ -81,6 +81,14 @@ <goal>parserJava</goal> <goal>gen</goal> </goals> + <configuration> + <treateDefaultEntry>false</treateDefaultEntry> + <entries> + <entry> + <basedir>src/main/java/jaxx/runtime/validator</basedir> + </entry> + </entries> + </configuration> </execution> </executions> </plugin> diff --git a/jaxx-runtime-api/src/main/java/jaxx/Base64Coder.java b/jaxx-runtime/src/main/java/jaxx/Base64Coder.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/Base64Coder.java rename to jaxx-runtime/src/main/java/jaxx/Base64Coder.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/beaninfos/HBoxBeanInfo.java b/jaxx-runtime/src/main/java/jaxx/beaninfos/HBoxBeanInfo.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/beaninfos/HBoxBeanInfo.java rename to jaxx-runtime/src/main/java/jaxx/beaninfos/HBoxBeanInfo.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/beaninfos/VBoxBeanInfo.java b/jaxx-runtime/src/main/java/jaxx/beaninfos/VBoxBeanInfo.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/beaninfos/VBoxBeanInfo.java rename to jaxx-runtime/src/main/java/jaxx/beaninfos/VBoxBeanInfo.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/css/Rule.java b/jaxx-runtime/src/main/java/jaxx/css/Rule.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/css/Rule.java rename to jaxx-runtime/src/main/java/jaxx/css/Rule.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/css/Selector.java b/jaxx-runtime/src/main/java/jaxx/css/Selector.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/css/Selector.java rename to jaxx-runtime/src/main/java/jaxx/css/Selector.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/css/Stylesheet.java b/jaxx-runtime/src/main/java/jaxx/css/Stylesheet.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/css/Stylesheet.java rename to jaxx-runtime/src/main/java/jaxx/css/Stylesheet.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/ComponentDescriptor.java b/jaxx-runtime/src/main/java/jaxx/runtime/ComponentDescriptor.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/ComponentDescriptor.java rename to jaxx-runtime/src/main/java/jaxx/runtime/ComponentDescriptor.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/DataBindingListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/DataBindingListener.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/DataBindingListener.java rename to jaxx-runtime/src/main/java/jaxx/runtime/DataBindingListener.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/DataBindingUpdateListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/DataBindingUpdateListener.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/DataBindingUpdateListener.java rename to jaxx-runtime/src/main/java/jaxx/runtime/DataBindingUpdateListener.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/DataContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/DataContext.java similarity index 91% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/DataContext.java rename to jaxx-runtime/src/main/java/jaxx/runtime/DataContext.java index 4d014d0..9fbfeb1 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/DataContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/DataContext.java @@ -150,12 +150,12 @@ public abstract class DataContext { return result; } - public void setContextValue(DataContextEntry entry, Object value, String key) { + public void setContextValue(DataContextEntry<?> entry, Object value, String key) { String contextKey = getKey(entry, key); delegate.setContextValue(value, contextKey); } - public void removeContextValue(DataContextEntry entry, Object value, String key) { + public void removeContextValue(DataContextEntry<?> entry, Object value, String key) { String contextKey = getKey(entry, key); delegate.removeContextValue(value.getClass(), contextKey); } @@ -246,7 +246,7 @@ public abstract class DataContext { pcs.firePropertyChange(name, oldValue, newValue); } - protected String getKey(DataContextEntry entry, String key) { + protected String getKey(DataContextEntry<?> entry, String key) { String result = null; if (key != null) { result = entry.hashCode() + "#" + key; @@ -259,7 +259,7 @@ public abstract class DataContext { // suppression des ecouteurs - for (PropertyChangeListener l : getPropertyChangeListeners()) { + for (PropertyChangeListener l : getPropertyChangeListeners()) { removePropertyChangeListener(l); } } @@ -272,14 +272,14 @@ public abstract class DataContext { private final int level; private final DataContextEntry<?> previous; - private final DataContextEntry[] parents; + private final DataContextEntry<?>[] parents; private Class<E> klass; public DataContextEntry(Class<E> klass, DataContextEntry<?> previous) { this.previous = previous; this.level = previous.level + 1; this.klass = klass; - this.parents = new DataContextEntry[level]; + this.parents = new DataContextEntry<?>[level]; int i = level; while (i > 0) { parents[--i] = previous; @@ -291,7 +291,7 @@ public abstract class DataContext { this.level = 0; this.klass = klass; this.previous = null; - this.parents = new DataContextEntry[0]; + this.parents = new DataContextEntry<?>[0]; } public Class<E> getKlass() { @@ -302,7 +302,7 @@ public abstract class DataContext { return level; } - public DataContextEntry[] getParents() { + public DataContextEntry<?>[] getParents() { return parents; } @@ -321,7 +321,7 @@ public abstract class DataContext { @Override public Iterator<DataContextEntry<?>> iterator() { int length = parents.length; - DataContextEntry[] t = new DataContextEntry[length + 1]; + DataContextEntry<?>[] t = new DataContextEntry<?>[length + 1]; System.arraycopy(parents, 0, t, 0, length); t[length] = this; return new DataContextEntryIterator(t, true); @@ -335,31 +335,31 @@ public abstract class DataContext { public static interface UpdateDataContext<D extends DataContext> { - void onRemovingData(D context, DataContextEntry<?> entry); + void onRemovingData(D context, DataContextEntry<D> entry); - void onAddingData(D context, DataContextEntry entry, String path); + void onAddingData(D context, DataContextEntry<D> entry, String path); } public static class DataContextEntryIterator implements Iterator<DataContextEntry<?>> { - protected final DataContextEntry[] datas; + protected final DataContextEntry<?>[] datas; protected final boolean reverse; protected final int level; protected int index; - public DataContextEntryIterator(DataContextEntry[] datas) { + public DataContextEntryIterator(DataContextEntry<?>[] datas) { this(datas, false, -1); } - public DataContextEntryIterator(DataContextEntry[] datas, int level) { + public DataContextEntryIterator(DataContextEntry<?>[] datas, int level) { this(datas, false, level); } - public DataContextEntryIterator(DataContextEntry[] datas, boolean reverse) { + public DataContextEntryIterator(DataContextEntry<?>[] datas, boolean reverse) { this(datas, reverse, -1); } - DataContextEntryIterator(DataContextEntry[] datas, boolean reverse, int level) { + DataContextEntryIterator(DataContextEntry<?>[] datas, boolean reverse, int level) { this.datas = datas; this.reverse = reverse; if (reverse) { diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/DefaultApplicationContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/DefaultApplicationContext.java similarity index 97% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/DefaultApplicationContext.java rename to jaxx-runtime/src/main/java/jaxx/runtime/DefaultApplicationContext.java index 895a32e..036be21 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/DefaultApplicationContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/DefaultApplicationContext.java @@ -78,11 +78,11 @@ public class DefaultApplicationContext extends DefaultJAXXContext { /** * Map of forwarded classes (key) to classes (values). */ - protected Map<Class, Class> forwards; + protected Map<Class<?>, Class<?>> forwards; public DefaultApplicationContext() { super(); - forwards = new HashMap<Class, Class>(); + forwards = new HashMap<Class<?>, Class<?>>(); pcs = new PropertyChangeSupport(this); } @@ -165,10 +165,10 @@ public class DefaultApplicationContext extends DefaultJAXXContext { @Override public <T> void removeContextValue(Class<T> klazz, String name) { - Entry<Class, Class> entry; + Entry<Class<?>, Class<?>> entry; if (name == null && forwards.containsValue(klazz)) { // remove forward - Iterator<Entry<Class, Class>> itr = forwards.entrySet().iterator(); + Iterator<Entry<Class<?>, Class<?>>> itr = forwards.entrySet().iterator(); while (itr.hasNext()) { entry = itr.next(); if (entry.getValue().equals(klazz)) { diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/DefaultJAXXContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/DefaultJAXXContext.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/DefaultJAXXContext.java rename to jaxx-runtime/src/main/java/jaxx/runtime/DefaultJAXXContext.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXAction.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXAction.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXAction.java rename to jaxx-runtime/src/main/java/jaxx/runtime/JAXXAction.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java similarity index 87% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXContext.java rename to jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java index 4d4a421..85db035 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java @@ -29,6 +29,7 @@ public interface JAXXContext { * <p/> * If a previous entry exists in context (unamed and same class), it will be removed. * + * @param <T> type of data to set in context * @param o the value to push in context */ public <T> void setContextValue(T o); @@ -38,6 +39,7 @@ public interface JAXXContext { * <p/> * If a previous entry exists in context (same name and class), it will be removed. * + * @param <T> type of data to set in context * @param o the value to push in context * @param name the name of the new entry */ @@ -46,6 +48,7 @@ public interface JAXXContext { /** * Remove from context the value with the given klazz as an unamed entry * + * @param <T> type of data to remove from context * @param klazz the klazz entry */ public <T> void removeContextValue(Class<T> klazz); @@ -53,6 +56,7 @@ public interface JAXXContext { /** * Remove from context the value with the given klazz as an unamed (if name is null) or named entry * + * @param <T> type of data to remove from context * @param klazz the klazz entry * @param name extra name of the entry */ @@ -66,6 +70,7 @@ public interface JAXXContext { * <p/> * <code><JButton onActionPerformed='{getContextValue(Action.class).method(args[])}'/></code> * + * @param <T> type of data to obtain from context * @param clazz the class of unamed entry to seek in context * @return the value of the unamed entry for the given class, or <code>null</code> if no such entry. */ @@ -74,6 +79,7 @@ public interface JAXXContext { /** * Seek for a named entry in the context * + * @param <T> type of data to obtain from context * @param clazz the class of named entry to seek in context * @param name the name of the entry to seek in context * @return the value of the named entry for the given class, or <code>null</code> if no such entry. @@ -83,6 +89,7 @@ public interface JAXXContext { /** * Return parent's container corresponding to the Class clazz * + * @param <O> type of container to obtain from context * @param clazz clazz desired * @return parent's container */ @@ -91,6 +98,7 @@ public interface JAXXContext { /** * Return parent's container corresponding to the Class clazz * + * @param <O> type of container to obtain from context * @param top the top container * @param clazz desired * @return parent's container diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXContextEntryDef.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContextEntryDef.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXContextEntryDef.java rename to jaxx-runtime/src/main/java/jaxx/runtime/JAXXContextEntryDef.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXInitialContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXInitialContext.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXInitialContext.java rename to jaxx-runtime/src/main/java/jaxx/runtime/JAXXInitialContext.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXObject.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXObject.java rename to jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java rename to jaxx-runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXValidator.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/JAXXValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/JAXXValidator.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/JaxxHelpUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/JaxxHelpUI.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/JaxxHelpUI.java rename to jaxx-runtime/src/main/java/jaxx/runtime/JaxxHelpUI.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java b/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java similarity index 95% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java rename to jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java index f195be8..13ab770 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java @@ -1,5 +1,6 @@ package jaxx.runtime; +import jaxx.runtime.*; import java.awt.Color; import java.awt.Component; import java.awt.Container; @@ -38,13 +39,11 @@ import java.util.Map; import java.util.Map.Entry; import java.util.NoSuchElementException; import java.util.Properties; -import javax.swing.DefaultListCellRenderer; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JLayeredPane; -import javax.swing.JList; import javax.swing.JRootPane; import javax.swing.JTabbedPane; import javax.swing.JTree; @@ -56,7 +55,6 @@ import javax.swing.table.DefaultTableCellRenderer; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import jaxx.runtime.swing.BooleanCellRenderer; -import jaxx.runtime.swing.DecoratorTableCellRenderer; import jaxx.runtime.swing.EmptyNumberTableCellRenderer; import jaxx.runtime.swing.EnumTableCellRenderer; import jaxx.runtime.swing.I18nTableCellRenderer; @@ -660,33 +658,6 @@ public class SwingUtil extends Util { } } - /** - * Génère un renderer de liste graphique basée sur un décorateur donné. - * - * @param <O> le type des données gérées par le décorateur - * @param decorator le décorateur à encapsuler - * @return le nouveau renderer - * @see Decorator - */ - public static <O> DefaultListCellRenderer newDecoratedListCellRenderer(final Decorator<O> decorator) { - return new DefaultListCellRenderer() { - - private static final long serialVersionUID = 1L; - - @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - String decorated; - if (value instanceof String) { - decorated = (String) value; - } else { - decorated = decorator.toString(value); - } - JComponent component = (JComponent) super.getListCellRendererComponent(list, decorated, index, isSelected, cellHasFocus); - return component; - } - }; - } - public static TableCellRenderer newDeleteCellRenderer(DefaultTableCellRenderer renderer) { Icon icon = UIManager.getIcon("Table.removeIcon"); if (icon == null) { @@ -700,10 +671,6 @@ public class SwingUtil extends Util { return new BooleanCellRenderer(renderer); } - public static DecoratorTableCellRenderer newDecorateTableCellRenderer(TableCellRenderer renderer, Decorator<?> decorator) { - return new DecoratorTableCellRenderer(renderer, decorator); - } - public static EmptyNumberTableCellRenderer newEmptyNumberTableCellRenderer(TableCellRenderer renderer) { return new EmptyNumberTableCellRenderer(renderer); } diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/Util.java b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java similarity index 92% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/Util.java rename to jaxx-runtime/src/main/java/jaxx/runtime/Util.java index 1f1ec83..7f39843 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/Util.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java @@ -4,11 +4,9 @@ import jaxx.Base64Coder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import javax.swing.DefaultListCellRenderer; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JComponent; -import javax.swing.JList; import javax.swing.UIManager; import java.awt.Component; import java.awt.Dimension; @@ -31,24 +29,20 @@ public class Util { public static final String DEFAULT_ICON_PATH = "/icons/"; public static final String DEFAULT_ICON_PATH_PROPERTY = "default.icon.path"; - /** to use log facility, just put in your code: log.info(\"...\"); */ static private final Log log = LogFactory.getLog(Util.class); - - // Maps root objects to lists of event listeners private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>(); private static Map<JAXXObject, WeakReference<List<DataBindingUpdateListener>>> dataBindingUpdateListeners = new WeakHashMap<JAXXObject, WeakReference<List<DataBindingUpdateListener>>>(); - private static class EventListenerDescriptor { - Class listenerClass; + + Class<?> listenerClass; String listenerMethodName; String methodName; Object eventListener; } - /** * Decodes the serialized representation of a JAXXObjectDescriptor. The string must be a byte-to-character mapping * of the binary serialization data for a JAXXObjectDescriptor. See the comments in JAXXCompiler.createJAXXObjectDescriptorField @@ -66,16 +60,13 @@ public class Util { //descriptor.getBytes(0, descriptor.length(), data, 0); ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(data)); return (JAXXObjectDescriptor) in.readObject();*/ - } - catch (IOException e) { + } catch (IOException e) { throw new RuntimeException("Internal error: can't-happen error", e); - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { throw new RuntimeException("Internal error: can't-happen error", e); } } - public static JAXXObjectDescriptor decodeCompressedJAXXObjectDescriptor(String descriptor) { try { return (JAXXObjectDescriptor) Base64Coder.deserialize(descriptor, true); @@ -86,16 +77,13 @@ public class Util { //descriptor.getBytes(0, descriptor.length(), data, 0); ObjectInputStream in = new ObjectInputStream(new GZIPInputStream(new ByteArrayInputStream(data))); return (JAXXObjectDescriptor) in.readObject();*/ - } - catch (IOException e) { + } catch (IOException e) { throw new RuntimeException("Internal error: can't-happen error", e); - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { throw new RuntimeException("Internal error: can't-happen error", e); } } - public static Object getEventListener(Class<? extends EventListener> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) { WeakReference<List<EventListenerDescriptor>> ref = eventListeners.get(methodContainer); List<EventListenerDescriptor> descriptors = ref != null ? ref.get() : null; @@ -131,22 +119,22 @@ public class Util { if (listenerMethodName != null && listenerMethod == null) { throw new IllegalArgumentException("no method named " + listenerMethodName + " found in class " + listenerClass.getName()); } - Class[] parameterTypes = listenerMethods.get(0).getParameterTypes(); + Class<?>[] parameterTypes = listenerMethods.get(0).getParameterTypes(); Class<?> methodContainerClass = methodContainer.getClass(); final Method targetMethod = methodContainerClass.getMethod(methodName, parameterTypes); descriptor.eventListener = Proxy.newProxyInstance(listenerClass.getClassLoader(), - new Class[]{listenerClass}, + new Class<?>[]{listenerClass}, new InvocationHandler() { + + @Override public Object invoke(Object proxy, Method method, Object[] args) { String methodName = method.getName(); if ((listenerMethodName == null && listenerMethods.contains(method)) || methodName.equals(listenerMethodName)) { try { return targetMethod.invoke(methodContainer, args); - } - catch (IllegalAccessException e) { + } catch (IllegalAccessException e) { throw new RuntimeException(e); - } - catch (InvocationTargetException e) { + } catch (InvocationTargetException e) { throw new RuntimeException(e); } } @@ -164,18 +152,15 @@ public class Util { }); descriptors.add(descriptor); return descriptor.eventListener; - } - catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { throw new RuntimeException(e); } } - public static Object getEventListener(Class<? extends EventListener> listenerClass, final Object methodContainer, final String methodName) { return getEventListener(listenerClass, null, methodContainer, methodName); } - public static DataBindingUpdateListener getDataBindingUpdateListener(JAXXObject object, String bindingName) { WeakReference<List<DataBindingUpdateListener>> ref = dataBindingUpdateListeners.get(object); List<DataBindingUpdateListener> listeners = ref == null ? null : ref.get(); @@ -194,7 +179,6 @@ public class Util { return listener; } - public static void setComponentWidth(Component component, int width) { component.setSize(width, component.getHeight()); if (component instanceof JComponent) { @@ -207,7 +191,6 @@ public class Util { } } - public static void setComponentHeight(Component component, int height) { component.setSize(component.getWidth(), height); if (component instanceof JComponent) { @@ -220,55 +203,46 @@ public class Util { } } - public static boolean assignment(boolean value, String name, JAXXObject src) { src.firePropertyChange(name.trim(), null, "dummy value"); return value; } - public static byte assignment(byte value, String name, JAXXObject src) { src.firePropertyChange(name.trim(), null, "dummy value"); return value; } - public static short assignment(short value, String name, JAXXObject src) { src.firePropertyChange(name.trim(), null, "dummy value"); return value; } - public static int assignment(int value, String name, JAXXObject src) { src.firePropertyChange(name.trim(), null, "dummy value"); return value; } - public static long assignment(long value, String name, JAXXObject src) { src.firePropertyChange(name.trim(), null, "dummy value"); return value; } - public static float assignment(float value, String name, JAXXObject src) { src.firePropertyChange(name.trim(), null, "dummy value"); return value; } - public static double assignment(double value, String name, JAXXObject src) { src.firePropertyChange(name.trim(), null, "dummy value"); return value; } - public static char assignment(char value, String name, JAXXObject src) { src.firePropertyChange(name.trim(), null, "dummy value"); return value; } - public static java.lang.Object assignment(java.lang.Object value, String name, JAXXObject src) { src.firePropertyChange(name.trim(), null, "dummy value"); return value; @@ -346,24 +320,6 @@ public class Util { } } - public static <O> DefaultListCellRenderer newDecoratedListCellRenderer(final Decorator<O> decorator) { - return new DefaultListCellRenderer() { - - private static final long serialVersionUID = 1L; - - @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - String decorated; - if (value instanceof String) { - decorated = (String) value; - } else { - decorated = decorator.toString(value); - } - return super.getListCellRendererComponent(list, decorated, index, isSelected, cellHasFocus); - } - }; - } - public static ImageIcon createIcon(String path) { java.net.URL imgURL = Util.class.getResource(path); if (imgURL != null) { @@ -400,7 +356,6 @@ public class Util { return getUIManagerIcon("action." + key); } - public static ImageIcon createActionIcon(String name) { String iconPath = getIconPath(); return createIcon(iconPath + "action-" + name + ".png"); @@ -461,5 +416,4 @@ public class Util { } return iconPath; } - } diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/css/DataBinding.java b/jaxx-runtime/src/main/java/jaxx/runtime/css/DataBinding.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/css/DataBinding.java rename to jaxx-runtime/src/main/java/jaxx/runtime/css/DataBinding.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/css/Pseudoclasses.java b/jaxx-runtime/src/main/java/jaxx/runtime/css/Pseudoclasses.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/css/Pseudoclasses.java rename to jaxx-runtime/src/main/java/jaxx/runtime/css/Pseudoclasses.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Application.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/Application.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Application.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/Application.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/BlockingLayerUI2.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI2.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/BlockingLayerUI2.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI2.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/BooleanCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/BooleanCellRenderer.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/BooleanCellRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/BooleanCellRenderer.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/CardLayout2.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/CardLayout2.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/CardLayout2Ext.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2Ext.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/CardLayout2Ext.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2Ext.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/EmptyNumberTableCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/EmptyNumberTableCellRenderer.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/EmptyNumberTableCellRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/EmptyNumberTableCellRenderer.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/EnumTableCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/EnumTableCellRenderer.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/EnumTableCellRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/EnumTableCellRenderer.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/GBC.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/GBC.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/GBC.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/GBC.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/HBox.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/HBox.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/HBox.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/HBox.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/HBoxLayout.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/HBoxLayout.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/HBoxLayout.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/HBoxLayout.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/I18nTableCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/I18nTableCellRenderer.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/I18nTableCellRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/I18nTableCellRenderer.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Item.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/Item.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Item.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/Item.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXButtonGroup.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXButtonGroup.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXButtonGroup.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXButtonGroup.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXComboBox.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXComboBox.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXComboBox.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXComboBox.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXList.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXList.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXList.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXList.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXTab.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXTab.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXTab.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXTab.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXToggleButton.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXToggleButton.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXToggleButton.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXToggleButton.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXTree.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXTree.java similarity index 97% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXTree.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXTree.java index 97f35d5..cdeda7f 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JAXXTree.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXTree.java @@ -1,259 +1,259 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime.swing; - -import javax.swing.JTree; -import javax.swing.event.TreeModelEvent; -import javax.swing.event.TreeModelListener; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.DefaultTreeCellRenderer; -import javax.swing.tree.TreeModel; -import javax.swing.tree.TreePath; -import java.awt.Component; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.ArrayList; -import java.util.List; - -public class JAXXTree extends JTree { - - private static final long serialVersionUID = 1L; - private static final String SYNTHETIC = "<synthetic root node>"; - - public class JAXXTreeModel implements TreeModel { - - private Item root; - private List<TreeModelListener> listeners = new ArrayList<TreeModelListener>(); - - public JAXXTreeModel(List<Item> items) { - if (items.size() == 1) { - this.root = items.get(0); - } else { - this.root = new Item(null, null, SYNTHETIC, false); - for (Item item : items) { - root.addChild(item); - } - } - - PropertyChangeListener listener = new PropertyChangeListener() { - - @Override - public void propertyChange(PropertyChangeEvent e) { - if (e.getPropertyName().equals(Item.SELECTED_PROPERTY)) { - Item item = (Item) e.getSource(); - if (item.isSelected()) { - addSelectionPath(getTreePath(item)); - } else { - removeSelectionPath(getTreePath(item)); - } - } else { - Item item = (Item) e.getSource(); - boolean root = item.getParent() == null; - TreePath path = !root ? getTreePath(item.getParent()) : null; - fireTreeNodesChanged(new TreeModelEvent(JAXXTreeModel.this, path, - !root ? new int[]{item.getParent().getChildren().indexOf(item)} : null, - new Object[]{item.getValue()})); - } - } - }; - addPropertyChangeListener(root, listener); - } - - private void addPropertyChangeListener(Item item, PropertyChangeListener listener) { - item.addPropertyChangeListener(listener); - List<Item> children = item.getChildren(); - for (Item aChildren : children) { - addPropertyChangeListener(aChildren, listener); - } - } - - @Override - public void addTreeModelListener(TreeModelListener listener) { - listeners.add(listener); - } - - - /* This is an inefficient implementation, but hand-coded tree structures are unlikely to contain - enough nodes for that to really matter. This could be sped up with caching. */ - public Item findItem(Object value) { - return findItem(root, value); - } - - private Item findItem(Item node, Object value) { - if (node.getValue() == value) { - return node; - } else { - List<Item> children = node.getChildren(); - for (Item aChildren : children) { - Item result = findItem(aChildren, value); - if (result != null) { - return result; - } - } - return null; - } - } - - private TreePath getTreePath(Item node) { - List<Object> path = new ArrayList<Object>(); - while (node != null) { - path.add(0, node.getValue()); - node = node.getParent(); - } - return new TreePath(path.toArray()); - } - - @Override - public Object getChild(Object parent, int index) { - Item node = findItem(parent); - return node.getChildren().get(index).getValue(); - } - - @Override - public int getChildCount(Object parent) { - Item node = findItem(parent); - if (node == null){ - return 0; - } - return node.getChildren().size(); - } - - @Override - public int getIndexOfChild(Object parent, Object child) { - Item node = findItem(parent); - List<Item> children = node.getChildren(); - for (int i = 0, j = children.size(); i < j; i++) { - if (children.get(i).getValue() == child) { - return i; - } - } - return -1; - } - - @Override - public Object getRoot() { - return root.getValue(); - } - - public Item getRootItem() { - return root; - } - - @Override - public boolean isLeaf(Object node) { - Item item = findItem(node); - return item != null && item.getChildren().size() == 0; - } - - @Override - public void removeTreeModelListener(TreeModelListener listener) { - listeners.remove(listener); - } - - public void fireTreeNodesChanged(TreeModelEvent e) { - for (TreeModelListener listener : listeners) { - listener.treeNodesChanged(e); - } - } - - @Override - public void valueForPathChanged(TreePath path, Object newValue) { - } - } - - public JAXXTree(TreeModel model) { - super(model); - } - - public JAXXTree() { - setCellRenderer(new DefaultTreeCellRenderer() { - - private static final long serialVersionUID = 1L; - - @Override - public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { - TreeModel model = tree.getModel(); - if (model instanceof JAXXTreeModel) { - Item item = ((JAXXTreeModel) model).findItem(value); - if (item != null) { - String label = item.getLabel(); - if (label != null) { - value = label; - } - } - } - return super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); - } - }); - - addTreeSelectionListener(new TreeSelectionListener() { - - @Override - public void valueChanged(TreeSelectionEvent e) { - TreeModel model = getModel(); - if (model instanceof JAXXTreeModel) { - scan((JAXXTreeModel) model, ((JAXXTreeModel) model).root); - } - } - - private void scan(JAXXTreeModel model, Item item) { - TreePath path = model.getTreePath(item); - if (item.isSelected() != isPathSelected(path)) { - item.setSelected(!item.isSelected()); - } - List<Item> children = item.getChildren(); - for (Item aChildren : children) { - scan(model, aChildren); - } - } - }); - } - - public void setItem(Item items) { - List<Item> newItems = new ArrayList<Item>(); - newItems.add(items); - setItems(newItems); - } - - public void setItems(List<Item> items) { - // Create model - JAXXTreeModel model = new JAXXTreeModel(items); - if (model.getRoot() != null) { - setRootVisible(model.getRoot() != SYNTHETIC); - } - // Atach model - setModel(model); - - // Appli selected items - if (items != null){ - List<TreePath> treePathSelected = new ArrayList<TreePath>(); - for (Item i : items){ - if (i.isSelected()){ - treePathSelected.add(model.getTreePath(i)); - } - } - this.setSelectionPaths(convertToTreePathArray(treePathSelected.toArray())); - } - } - - public Object getSelectionValue() { - TreePath selectionPath = getSelectionPath(); - return selectionPath != null ? selectionPath.getLastPathComponent() : null; - } - - public Item getRootItem(){ - if (getModel() instanceof JAXXTreeModel){ - return ((JAXXTreeModel)getModel()).getRootItem(); - } - return null; - } - - protected TreePath[] convertToTreePathArray(Object[] datas){ - TreePath[] params = new TreePath[datas.length]; - System.arraycopy(datas, 0, params, 0, datas.length); - return params; - } -} +/* + * Copyright 2006 Ethan Nicholas. All rights reserved. + * Use is subject to license terms. + */ +package jaxx.runtime.swing; + +import javax.swing.JTree; +import javax.swing.event.TreeModelEvent; +import javax.swing.event.TreeModelListener; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreePath; +import java.awt.Component; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.ArrayList; +import java.util.List; + +public class JAXXTree extends JTree { + + private static final long serialVersionUID = 1L; + private static final String SYNTHETIC = "<synthetic root node>"; + + public class JAXXTreeModel implements TreeModel { + + private Item root; + private List<TreeModelListener> listeners = new ArrayList<TreeModelListener>(); + + public JAXXTreeModel(List<Item> items) { + if (items.size() == 1) { + this.root = items.get(0); + } else { + this.root = new Item(null, null, SYNTHETIC, false); + for (Item item : items) { + root.addChild(item); + } + } + + PropertyChangeListener listener = new PropertyChangeListener() { + + @Override + public void propertyChange(PropertyChangeEvent e) { + if (e.getPropertyName().equals(Item.SELECTED_PROPERTY)) { + Item item = (Item) e.getSource(); + if (item.isSelected()) { + addSelectionPath(getTreePath(item)); + } else { + removeSelectionPath(getTreePath(item)); + } + } else { + Item item = (Item) e.getSource(); + boolean root = item.getParent() == null; + TreePath path = !root ? getTreePath(item.getParent()) : null; + fireTreeNodesChanged(new TreeModelEvent(JAXXTreeModel.this, path, + !root ? new int[]{item.getParent().getChildren().indexOf(item)} : null, + new Object[]{item.getValue()})); + } + } + }; + addPropertyChangeListener(root, listener); + } + + private void addPropertyChangeListener(Item item, PropertyChangeListener listener) { + item.addPropertyChangeListener(listener); + List<Item> children = item.getChildren(); + for (Item aChildren : children) { + addPropertyChangeListener(aChildren, listener); + } + } + + @Override + public void addTreeModelListener(TreeModelListener listener) { + listeners.add(listener); + } + + + /* This is an inefficient implementation, but hand-coded tree structures are unlikely to contain + enough nodes for that to really matter. This could be sped up with caching. */ + public Item findItem(Object value) { + return findItem(root, value); + } + + private Item findItem(Item node, Object value) { + if (node.getValue() == value) { + return node; + } else { + List<Item> children = node.getChildren(); + for (Item aChildren : children) { + Item result = findItem(aChildren, value); + if (result != null) { + return result; + } + } + return null; + } + } + + private TreePath getTreePath(Item node) { + List<Object> path = new ArrayList<Object>(); + while (node != null) { + path.add(0, node.getValue()); + node = node.getParent(); + } + return new TreePath(path.toArray()); + } + + @Override + public Object getChild(Object parent, int index) { + Item node = findItem(parent); + return node.getChildren().get(index).getValue(); + } + + @Override + public int getChildCount(Object parent) { + Item node = findItem(parent); + if (node == null){ + return 0; + } + return node.getChildren().size(); + } + + @Override + public int getIndexOfChild(Object parent, Object child) { + Item node = findItem(parent); + List<Item> children = node.getChildren(); + for (int i = 0, j = children.size(); i < j; i++) { + if (children.get(i).getValue() == child) { + return i; + } + } + return -1; + } + + @Override + public Object getRoot() { + return root.getValue(); + } + + public Item getRootItem() { + return root; + } + + @Override + public boolean isLeaf(Object node) { + Item item = findItem(node); + return item != null && item.getChildren().size() == 0; + } + + @Override + public void removeTreeModelListener(TreeModelListener listener) { + listeners.remove(listener); + } + + public void fireTreeNodesChanged(TreeModelEvent e) { + for (TreeModelListener listener : listeners) { + listener.treeNodesChanged(e); + } + } + + @Override + public void valueForPathChanged(TreePath path, Object newValue) { + } + } + + public JAXXTree(TreeModel model) { + super(model); + } + + public JAXXTree() { + setCellRenderer(new DefaultTreeCellRenderer() { + + private static final long serialVersionUID = 1L; + + @Override + public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { + TreeModel model = tree.getModel(); + if (model instanceof JAXXTreeModel) { + Item item = ((JAXXTreeModel) model).findItem(value); + if (item != null) { + String label = item.getLabel(); + if (label != null) { + value = label; + } + } + } + return super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); + } + }); + + addTreeSelectionListener(new TreeSelectionListener() { + + @Override + public void valueChanged(TreeSelectionEvent e) { + TreeModel model = getModel(); + if (model instanceof JAXXTreeModel) { + scan((JAXXTreeModel) model, ((JAXXTreeModel) model).root); + } + } + + private void scan(JAXXTreeModel model, Item item) { + TreePath path = model.getTreePath(item); + if (item.isSelected() != isPathSelected(path)) { + item.setSelected(!item.isSelected()); + } + List<Item> children = item.getChildren(); + for (Item aChildren : children) { + scan(model, aChildren); + } + } + }); + } + + public void setItem(Item items) { + List<Item> newItems = new ArrayList<Item>(); + newItems.add(items); + setItems(newItems); + } + + public void setItems(List<Item> items) { + // Create model + JAXXTreeModel model = new JAXXTreeModel(items); + if (model.getRoot() != null) { + setRootVisible(model.getRoot() != SYNTHETIC); + } + // Atach model + setModel(model); + + // Appli selected items + if (items != null){ + List<TreePath> treePathSelected = new ArrayList<TreePath>(); + for (Item i : items){ + if (i.isSelected()){ + treePathSelected.add(model.getTreePath(i)); + } + } + this.setSelectionPaths(convertToTreePathArray(treePathSelected.toArray())); + } + } + + public Object getSelectionValue() { + TreePath selectionPath = getSelectionPath(); + return selectionPath != null ? selectionPath.getLastPathComponent() : null; + } + + public Item getRootItem(){ + if (getModel() instanceof JAXXTreeModel){ + return ((JAXXTreeModel)getModel()).getRootItem(); + } + return null; + } + + protected TreePath[] convertToTreePathArray(Object[] datas){ + TreePath[] params = new TreePath[datas.length]; + System.arraycopy(datas, 0, params, 0, datas.length); + return params; + } +} diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/LocaleListCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/LocaleListCellRenderer.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/LocaleListCellRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/LocaleListCellRenderer.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/MyDefaultCellEditor.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/MyDefaultCellEditor.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/MyDefaultCellEditor.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/MyDefaultCellEditor.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/OneClicListSelectionModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/OneClicListSelectionModel.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/OneClicListSelectionModel.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/OneClicListSelectionModel.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Spacer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/Spacer.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Spacer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/Spacer.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/TabInfo.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/TabInfo.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/TabInfo.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/TabInfo.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/TabInfoPropertyChangeListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/TabInfoPropertyChangeListener.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/TabInfoPropertyChangeListener.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/TabInfoPropertyChangeListener.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Table.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/Table.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/Table.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/Table.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/VBox.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/VBox.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/VBox.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/VBox.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/VBoxLayout.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/VBoxLayout.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/VBoxLayout.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/VBoxLayout.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor/ClassCellEditor.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/ClassCellEditor.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor/ClassCellEditor.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/ClassCellEditor.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor/EnumEditor.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/EnumEditor.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor/EnumEditor.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/EnumEditor.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor/LocaleEditor.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/LocaleEditor.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/editor/LocaleEditor.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/LocaleEditor.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java similarity index 55% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java index addfb6f..e5de31d 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java @@ -1,8 +1,3 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - package jaxx.runtime.swing.navigation; import java.awt.CardLayout; @@ -15,38 +10,37 @@ import org.apache.commons.logging.LogFactory; /** * * @author letellier + * @since 1.7.2 */ -public class ItemNavigationCardPanel extends JPanel{ +public class ItemNavigationCardPanel extends JPanel { /** to use log facility, just put in your code: log.info(\"...\"); */ static private final Log log = LogFactory.getLog(ItemNavigationCardPanel.class); - private static final long serialVersionUID = 1L; - CardLayout layout; - public ItemNavigationCardPanel(){ + + public ItemNavigationCardPanel() { super(); layout = new CardLayout(); setLayout(layout); } - public void showItem(Item i){ - if (i != null && i.getValue() != null){ - if (i.getValue() instanceof Class){ + public void showItem(Item i) { + if (i != null && i.getValue() != null) { + if (i.getValue() instanceof Class<?>) { layout.show(this, i.getValue().getClass().getName()); - } - else { + } else { layout.show(this, i.getValue().getClass().getName()); } } } - public Component getShowedComponent(){ + public Component getShowedComponent() { Component[] components = getComponents(); - if (components != null){ - for (Component c : components){ - if (c.isVisible()){ + if (components != null) { + for (Component c : components) { + if (c.isVisible()) { return c; } } @@ -56,11 +50,10 @@ public class ItemNavigationCardPanel extends JPanel{ @Override public Component add(Component comp) { - if (!(comp instanceof ItemNavigationPanel)){ - throw new IllegalArgumentException("ItemNavigationCardPanel must be have only ItemNavigationPanel children"); + if (!(comp instanceof ItemNavigationPanel)) { + throw new IllegalArgumentException("ItemNavigationCardPanel must be have only ItemNavigationPanel children"); } - super.add(comp, ((ItemNavigationPanel)comp).getAssociatedClass().getName()); - return comp; + super.add(comp, ((ItemNavigationPanel) comp).getAssociatedClass().getName()); + return comp; } - } diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationPanel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationPanel.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationPanel.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationPanel.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/ItemTreeNavigationAdapter.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemTreeNavigationAdapter.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/navigation/ItemTreeNavigationAdapter.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemTreeNavigationAdapter.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardOperationModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationModel.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardOperationModel.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationModel.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardOperationState.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationState.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardOperationState.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationState.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardOperationStep.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationStep.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardOperationStep.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationStep.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardStep.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStep.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardStep.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStep.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardStepUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStepUI.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardStepUI.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStepUI.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUI.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardUI.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUI.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardUtil.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUtil.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/WizardUtil.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUtil.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/package.html b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/package.html similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/swing/wizard/package.html rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/package.html diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidator.java similarity index 99% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidator.java index f3df692..dcb93ca 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidator.java @@ -1,6 +1,5 @@ package jaxx.runtime.validator; -import jaxx.runtime.BeanValidatorUtil; import java.beans.EventSetDescriptor; import org.apache.commons.beanutils.ConversionException; import org.apache.commons.beanutils.Converter; diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorDetector.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorDetector.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorDetector.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorDetector.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorEvent.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorEvent.java similarity index 78% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorEvent.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorEvent.java index 19d2069..7e212d2 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorEvent.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorEvent.java @@ -17,7 +17,7 @@ public class BeanValidatorEvent extends java.util.EventObject { String[] messagestoAdd; String[] messagestoDelete; - public BeanValidatorEvent(BeanValidator source, BeanValidatorField<?> field, BeanValidatorScope scope, String[] toAdd, String[] toDelete) { + public BeanValidatorEvent(BeanValidator<?> source, BeanValidatorField<?> field, BeanValidatorScope scope, String[] toAdd, String[] toDelete) { super(source); this.field = field; this.scope = scope; @@ -26,8 +26,8 @@ public class BeanValidatorEvent extends java.util.EventObject { } @Override - public BeanValidator getSource() { - return (BeanValidator) super.getSource(); + public BeanValidator<?> getSource() { + return (BeanValidator<?>) super.getSource(); } public String getFieldName() { @@ -46,7 +46,7 @@ public class BeanValidatorEvent extends java.util.EventObject { return scope; } - public BeanValidatorField getField() { + public BeanValidatorField<?> getField() { return field; } } diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorField.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorField.java similarity index 98% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorField.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorField.java index 7277ab2..f4ab4c6 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorField.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorField.java @@ -192,11 +192,11 @@ public class BeanValidatorField<B> { if (this == o) { return true; } - if (!(o instanceof BeanValidatorField)) { + if (!(o instanceof BeanValidatorField<?>)) { return false; } - BeanValidatorField that = (BeanValidatorField) o; + BeanValidatorField<?> that = (BeanValidatorField<?>) o; return beanClass.equals(that.beanClass) && name.equals(that.name); } diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorListener.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorListener.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorListener.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorMessage.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorMessage.java similarity index 80% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorMessage.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorMessage.java index 6435c8a..34f3373 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorMessage.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorMessage.java @@ -8,16 +8,16 @@ package jaxx.runtime.validator; * @author chemit * @since 1.3 */ -public class BeanValidatorMessage<E extends BeanValidatorMessage> implements Comparable<E> { +public class BeanValidatorMessage<E extends BeanValidatorMessage<?>> implements Comparable<E> { /** * the validator that produce the message */ - protected BeanValidator validator; + protected BeanValidator<?> validator; /** * the field thatproduce the message */ - protected BeanValidatorField field; + protected BeanValidatorField<?> field; /** * the label of the message (to be displayed somewhere) */ @@ -27,18 +27,18 @@ public class BeanValidatorMessage<E extends BeanValidatorMessage> implements Com */ protected BeanValidatorScope scope; - public BeanValidatorMessage(BeanValidator validator, BeanValidatorField field, String message, BeanValidatorScope scope) { + public BeanValidatorMessage(BeanValidator<?> validator, BeanValidatorField<?> field, String message, BeanValidatorScope scope) { this.field = field; this.validator = validator; this.message = message; this.scope = scope; } - public BeanValidator getValidator() { + public BeanValidator<?> getValidator() { return validator; } - public BeanValidatorField getField() { + public BeanValidatorField<?> getField() { return field; } diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorScope.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorScope.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/BeanValidatorScope.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorScope.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/BeanValidatorUtil.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorUtil.java similarity index 99% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/BeanValidatorUtil.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorUtil.java index a819d04..aa4d9b6 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/BeanValidatorUtil.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorUtil.java @@ -1,4 +1,4 @@ -package jaxx.runtime; +package jaxx.runtime.validator; import jaxx.runtime.*; import com.opensymphony.xwork2.config.Configuration; diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/XWorkBeanValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/XWorkBeanValidator.java similarity index 96% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/XWorkBeanValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/XWorkBeanValidator.java index 7eced3d..007df28 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/XWorkBeanValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/XWorkBeanValidator.java @@ -20,7 +20,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; -import jaxx.runtime.BeanValidatorUtil; /** * @@ -182,10 +181,10 @@ public class XWorkBeanValidator<B> { } if (validationContext.hasFieldErrors()) { - Map messages = validationContext.getFieldErrors(); + Map<?,?> messages = validationContext.getFieldErrors(); result = new HashMap<String, List<String>>(messages.size()); for (Object fieldName : messages.keySet()) { - Collection c = (Collection) messages.get(fieldName); + Collection<?> c = (Collection<?>) messages.get(fieldName); List<String> mm = new java.util.ArrayList<String>(c.size()); for (Object message : c) { mm.add(message + ""); @@ -225,7 +224,7 @@ public class XWorkBeanValidator<B> { int skip = 0; if (contextName != null && !includeDefaultContext) { // count the number of validator to skip - for (Validator v : validator.getValidators(beanClass, null)) { + for (Validator<?> v : validator.getValidators(beanClass, null)) { // we only work on FieldValidator at the moment if (v instanceof FieldValidator) { skip++; @@ -233,7 +232,7 @@ public class XWorkBeanValidator<B> { } } - for (Validator v : validator.getValidators(beanClass, contextName)) { + for (Validator<?> v : validator.getValidators(beanClass, contextName)) { // we only work on FieldValidator at the moment if (v instanceof FieldValidator) { if (skip > 0) { diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidator.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidator.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidator.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidator.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidator.java similarity index 99% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidator.java index ee2e4a7..d37aa1d 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidator.java @@ -41,6 +41,7 @@ import java.io.File; */ public class ExistingDirectoryFieldValidator extends FieldValidatorSupport { + @Override public void validate(Object object) throws ValidationException { String fieldName = getFieldName(); Object value = this.getFieldValue(fieldName, object); diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/ExistingFileFieldValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/ExistingFileFieldValidator.java similarity index 99% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/ExistingFileFieldValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/field/ExistingFileFieldValidator.java index 72219b0..b7ef20a 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/ExistingFileFieldValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/ExistingFileFieldValidator.java @@ -41,6 +41,7 @@ import java.io.File; */ public class ExistingFileFieldValidator extends FieldValidatorSupport { + @Override public void validate(Object object) throws ValidationException { String fieldName = getFieldName(); Object value = this.getFieldValue(fieldName, object); diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidator.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidator.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidator.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidator.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/NotExistingFileFieldValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/NotExistingFileFieldValidator.java similarity index 100% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/NotExistingFileFieldValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/field/NotExistingFileFieldValidator.java diff --git a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/RequiredFileFieldValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/RequiredFileFieldValidator.java similarity index 99% rename from jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/RequiredFileFieldValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/field/RequiredFileFieldValidator.java index 6bf973a..23f5f03 100644 --- a/jaxx-runtime-api/src/main/java/jaxx/runtime/validator/field/RequiredFileFieldValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/RequiredFileFieldValidator.java @@ -41,6 +41,7 @@ import java.io.File; */ public class RequiredFileFieldValidator extends FieldValidatorSupport { + @Override public void validate(Object object) throws ValidationException { String fieldName = getFieldName(); Object value = this.getFieldValue(fieldName, object); diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java similarity index 99% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java index a01110f..72c1f77 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java @@ -253,7 +253,7 @@ public class SwingValidator<B> extends BeanValidator<B> { if (old != null) { // suppression du jxlayer sous l'ancien composant Container container = old.getParent(); - if (container instanceof JXLayer) { + if (container instanceof JXLayer<?>) { JXLayer<?> jx = (JXLayer<?>) container; Object ui = jx.getUI(); if (ui != null && ui instanceof AbstractBeanValidatorUI) { @@ -266,7 +266,7 @@ public class SwingValidator<B> extends BeanValidator<B> { if (c != null) { // ajout du jxlayer sous ce composant Container container = c.getParent(); - if (container instanceof JXLayer) { + if (container instanceof JXLayer<?>) { Constructor<? extends AbstractBeanValidatorUI> cons = uiClass.getConstructor(BeanValidatorField.class); AbstractBeanValidatorUI ui = cons.newInstance(field); ui.setEnabled(true); diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessage.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessage.java similarity index 84% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessage.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessage.java index cbb63c3..286a4d7 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessage.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessage.java @@ -20,13 +20,13 @@ public class SwingValidatorMessage extends BeanValidatorMessage<SwingValidatorMe protected JComponent editor; protected String fieldName; - public SwingValidatorMessage(SwingValidator validator, BeanValidatorField field, String message, BeanValidatorScope scope, JComponent editor) { + public SwingValidatorMessage(SwingValidator<?> validator, BeanValidatorField<?> field, String message, BeanValidatorScope scope, JComponent editor) { super(validator, field, message, scope); this.fieldName = field.getName(); this.editor = editor; } - public SwingValidatorMessage(SwingValidator validator, String fieldName, String message, BeanValidatorScope scope, JComponent editor) { + public SwingValidatorMessage(SwingValidator<?> validator, String fieldName, String message, BeanValidatorScope scope, JComponent editor) { super(validator, null, message, scope); this.fieldName = fieldName; this.editor = editor; diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListModel.java similarity index 91% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListModel.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListModel.java index a01ecf9..07d2d60 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListModel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListModel.java @@ -67,7 +67,7 @@ public class SwingValidatorMessageListModel public void onFieldChanged(BeanValidatorEvent event) { String[] toDelete = event.getMessagesToDelete(); String[] toAdd = event.getMessagesToAdd(); - BeanValidatorField field = event.getField(); + BeanValidatorField<?> field = event.getField(); BeanValidatorScope scope = event.getScope(); boolean mustAdd = toAdd != null && toAdd.length > 0; boolean mustDel = toDelete != null && toDelete.length > 0; @@ -78,7 +78,7 @@ public class SwingValidatorMessageListModel log.trace(field + " - (" + getSize() + ") toDelete " + mustDel); } - SwingValidator validator = (SwingValidator) event.getSource(); + SwingValidator<?> validator = (SwingValidator<?>) event.getSource(); if (mustDel) { @@ -99,7 +99,7 @@ public class SwingValidatorMessageListModel } } - protected void addMessages(SwingValidator validator, BeanValidatorField field, BeanValidatorScope scope, boolean sort, String... messages) { + protected void addMessages(SwingValidator<?> validator, BeanValidatorField<?> field, BeanValidatorScope scope, boolean sort, String... messages) { JComponent editor = validator.getFieldRepresentation(field.getName()); // add new errors @@ -121,7 +121,7 @@ public class SwingValidatorMessageListModel } } - protected void removeMessages(SwingValidator validator, BeanValidatorField field, BeanValidatorScope scope, boolean notify, String... messages) { + protected void removeMessages(SwingValidator<?> validator, BeanValidatorField<?> field, BeanValidatorScope scope, boolean notify, String... messages) { List<String> messagesToDel = new java.util.ArrayList<String>(java.util.Arrays.asList(messages)); diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListMouseListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListMouseListener.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListMouseListener.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListMouseListener.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListRenderer.java similarity index 98% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListRenderer.java index df6fcbd..5514f6e 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListRenderer.java @@ -6,7 +6,6 @@ import javax.swing.JList; import java.awt.Component; import javax.swing.DefaultListCellRenderer; import jaxx.runtime.validator.BeanValidatorScope; -import jaxx.runtime.SwingValidatorUtil; import static org.nuiton.i18n.I18n._; /** diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableModel.java similarity index 90% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableModel.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableModel.java index 400adab..3821695 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableModel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableModel.java @@ -54,7 +54,7 @@ public class SwingValidatorMessageTableModel validator.addBeanValidatorListener(this); } - public void addMessages(SwingValidator validator, String fieldName, BeanValidatorScope scope, String... messages) { + public void addMessages(SwingValidator<?> validator, String fieldName, BeanValidatorScope scope, String... messages) { addMessages(validator, fieldName, scope, true, messages); } @@ -62,7 +62,7 @@ public class SwingValidatorMessageTableModel addMessages(editor, fieldName, scope, true, messages); } - public void addMessages(SwingValidator validator, BeanValidatorField field, BeanValidatorScope scope, String... messages) { + public void addMessages(SwingValidator<?> validator, BeanValidatorField<?> field, BeanValidatorScope scope, String... messages) { addMessages(validator, field, scope, true, messages); } @@ -81,7 +81,7 @@ public class SwingValidatorMessageTableModel } } - public void removeMessages(SwingValidator validator, String fieldName, BeanValidatorScope scope, String... messages) { + public void removeMessages(SwingValidator<?> validator, String fieldName, BeanValidatorScope scope, String... messages) { removeMessages(validator, fieldName, scope, true, messages); } @@ -89,7 +89,7 @@ public class SwingValidatorMessageTableModel removeMessages(editor, fieldName, scope, true); } - public void removeMessages(SwingValidator validator, BeanValidatorField field, BeanValidatorScope scope, String... messages) { + public void removeMessages(SwingValidator<?> validator, BeanValidatorField<?> field, BeanValidatorScope scope, String... messages) { removeMessages(validator, field, scope, true, messages); } @@ -134,7 +134,7 @@ public class SwingValidatorMessageTableModel public void onFieldChanged(BeanValidatorEvent event) { String[] toDelete = event.getMessagesToDelete(); String[] toAdd = event.getMessagesToAdd(); - BeanValidatorField field = event.getField(); + BeanValidatorField<?> field = event.getField(); BeanValidatorScope scope = event.getScope(); boolean mustAdd = toAdd != null && toAdd.length > 0; boolean mustDel = toDelete != null && toDelete.length > 0; @@ -145,7 +145,7 @@ public class SwingValidatorMessageTableModel log.trace(field + " - (" + getRowCount() + ") toDelete " + mustDel); } - SwingValidator validator = (SwingValidator) event.getSource(); + SwingValidator<?> validator = (SwingValidator<?>) event.getSource(); if (mustDel) { @@ -205,7 +205,7 @@ public class SwingValidatorMessageTableModel } } - protected void addMessages(SwingValidator validator, BeanValidatorField field, BeanValidatorScope scope, boolean sort, String... messages) { + protected void addMessages(SwingValidator<?> validator, BeanValidatorField<?> field, BeanValidatorScope scope, boolean sort, String... messages) { JComponent editor = validator == null ? null : validator.getFieldRepresentation(field.getName()); // add new errors @@ -227,7 +227,7 @@ public class SwingValidatorMessageTableModel } } - protected void addMessages(SwingValidator validator, String fieldName, BeanValidatorScope scope, boolean sort, String... messages) { + protected void addMessages(SwingValidator<?> validator, String fieldName, BeanValidatorScope scope, boolean sort, String... messages) { JComponent editor = validator == null ? null : validator.getFieldRepresentation(fieldName); // add new errors @@ -270,7 +270,7 @@ public class SwingValidatorMessageTableModel } } - protected void removeMessages(SwingValidator validator, BeanValidatorField field, BeanValidatorScope scope, boolean notify, String... messages) { + protected void removeMessages(SwingValidator<?> validator, BeanValidatorField<?> field, BeanValidatorScope scope, boolean notify, String... messages) { List<String> messagesToDel = new java.util.ArrayList<String>(java.util.Arrays.asList(messages)); @@ -289,7 +289,7 @@ public class SwingValidatorMessageTableModel } } - protected void removeMessages(SwingValidator validator, String fieldName, BeanValidatorScope scope, boolean notify, String... messages) { + protected void removeMessages(SwingValidator<?> validator, String fieldName, BeanValidatorScope scope, boolean notify, String... messages) { List<String> messagesToDel = new java.util.ArrayList<String>(java.util.Arrays.asList(messages)); diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableMouseListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableMouseListener.java similarity index 100% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableMouseListener.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableMouseListener.java diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableRenderer.java similarity index 98% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableRenderer.java index d4e83bc..e770f42 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableRenderer.java @@ -6,7 +6,6 @@ import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; import java.awt.Component; import jaxx.runtime.validator.BeanValidatorScope; -import jaxx.runtime.SwingValidatorUtil; import static org.nuiton.i18n.I18n._; /** diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingValidatorUtil.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorUtil.java similarity index 98% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingValidatorUtil.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorUtil.java index bcb068e..fa7b4cd 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingValidatorUtil.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorUtil.java @@ -1,7 +1,7 @@ -package jaxx.runtime; +package jaxx.runtime.validator.swing; import jaxx.runtime.*; -import jaxx.runtime.validator.BeanValidatorScope; +import jaxx.runtime.validator.BeanValidatorUtil; import jaxx.runtime.validator.*; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -61,6 +61,7 @@ public class SwingValidatorUtil extends BeanValidatorUtil { * Prepare the ui where to display the validators messages. * * @param errorTable the table where to display validators messages + * @param render renderer to use */ public static void installUI(JTable errorTable, SwingValidatorMessageTableRenderer render) { errorTable.setDefaultRenderer(Object.class, render); diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java similarity index 90% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java index 38eb670..b8c0af9 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java @@ -17,9 +17,9 @@ public abstract class AbstractBeanValidatorUI extends AbstractLayerUI<javax.swin /** to use log facility, just put in your code: log.info(\"...\"); */ private static final Log log = LogFactory.getLog(AbstractBeanValidatorUI.class); /** the field to render */ - protected BeanValidatorField field; + protected BeanValidatorField<?> field; - public AbstractBeanValidatorUI(BeanValidatorField field) { + public AbstractBeanValidatorUI(BeanValidatorField<?> field) { this.field = field; if (log.isDebugEnabled()) { log.debug("install " + this + "<field:" + field + ">"); diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/IconValidationUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/IconValidationUI.java similarity index 97% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/IconValidationUI.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/IconValidationUI.java index 1e192ce..a4045b6 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/IconValidationUI.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/IconValidationUI.java @@ -19,7 +19,7 @@ public class IconValidationUI extends AbstractBeanValidatorUI { protected static BufferedImage warningIcon; protected static BufferedImage infoIcon; - public IconValidationUI(BeanValidatorField field) { + public IconValidationUI(BeanValidatorField<?> field) { super(field); if (errorIcon == null) { errorIcon = prepareIcon(Color.RED); diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/ImageValidationUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/ImageValidationUI.java similarity index 97% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/ImageValidationUI.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/ImageValidationUI.java index 868e09e..adc7fb9 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/ImageValidationUI.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/ImageValidationUI.java @@ -18,7 +18,7 @@ public class ImageValidationUI extends AbstractBeanValidatorUI { protected static BufferedImage warningIcon; protected static BufferedImage infoIcon; - public ImageValidationUI(BeanValidatorField field) { + public ImageValidationUI(BeanValidatorField<?> field) { super(field); if (errorIcon == null) { errorIcon = prepareIcon(jaxx.runtime.Util.createImageIcon("error.png")); diff --git a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/TranslucentValidationUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/TranslucentValidationUI.java similarity index 96% rename from jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/TranslucentValidationUI.java rename to jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/TranslucentValidationUI.java index ef21595..5057054 100644 --- a/jaxx-runtime-swing/src/main/java/jaxx/runtime/validator/swing/ui/TranslucentValidationUI.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/TranslucentValidationUI.java @@ -18,7 +18,7 @@ public class TranslucentValidationUI extends AbstractBeanValidatorUI { protected Color warningHightlight; protected Color infoHightlight; - public TranslucentValidationUI(BeanValidatorField field) { + public TranslucentValidationUI(BeanValidatorField<?> field) { super(field); errorHightlight = Color.RED; warningHightlight = Color.YELLOW; diff --git a/jaxx-runtime/src/main/resources/i18n/jaxx-runtime-en_GB.properties b/jaxx-runtime/src/main/resources/i18n/jaxx-runtime-en_GB.properties new file mode 100644 index 0000000..02a7317 --- /dev/null +++ b/jaxx-runtime/src/main/resources/i18n/jaxx-runtime-en_GB.properties @@ -0,0 +1,12 @@ +validator.field.header=Field +validator.field.header.tip=The field involved +validator.field.tip=Property '%1$s' +validator.message.header=Message +validator.message.header.tip=Message +validator.message.tip=Message \: %1$s +validator.scope.error.label=Error +validator.scope.header=... +validator.scope.header.tip=Severity of the message +validator.scope.info.label=Information +validator.scope.tip=Message scope \: '%1$s' +validator.scope.warning.label=Warning diff --git a/jaxx-runtime-swing/src/main/resources/i18n/jaxx-runtime-swing-fr_FR.properties b/jaxx-runtime/src/main/resources/i18n/jaxx-runtime-fr_FR.properties similarity index 76% rename from jaxx-runtime-swing/src/main/resources/i18n/jaxx-runtime-swing-fr_FR.properties rename to jaxx-runtime/src/main/resources/i18n/jaxx-runtime-fr_FR.properties index 77a14d0..8df2e5e 100644 --- a/jaxx-runtime-swing/src/main/resources/i18n/jaxx-runtime-swing-fr_FR.properties +++ b/jaxx-runtime/src/main/resources/i18n/jaxx-runtime-fr_FR.properties @@ -4,6 +4,9 @@ validator.field.tip=Propri\u00E9t\u00E9 '%1$s' validator.message.header=Message validator.message.header.tip=Le texte du message validator.message.tip=Message \: %1$s +validator.scope.error.label=Erreur validator.scope.header=... validator.scope.header.tip=Le de type de message +validator.scope.info.label=Information validator.scope.tip=Type de message \: '%1$s' +validator.scope.warning.label=Avertissement diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-delete.png b/jaxx-runtime/src/main/resources/icons/action-delete.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-delete.png rename to jaxx-runtime/src/main/resources/icons/action-delete.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-config-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-config-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-config-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-config-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-config.png b/jaxx-runtime/src/main/resources/icons/action-wizard-config.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-config.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-config.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-message-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-message-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-message-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-message-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-message.png b/jaxx-runtime/src/main/resources/icons/action-wizard-message.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-message.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-message.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-next-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-next-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-next-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-next-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-next.png b/jaxx-runtime/src/main/resources/icons/action-wizard-next.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-next.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-next.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-pause-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-pause-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-pause-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-pause-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-pause.png b/jaxx-runtime/src/main/resources/icons/action-wizard-pause.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-pause.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-pause.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-previous-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-previous-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-previous-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-previous-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-previous.png b/jaxx-runtime/src/main/resources/icons/action-wizard-previous.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-previous.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-previous.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-refresh-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-refresh-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-refresh-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-refresh-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-refresh.png b/jaxx-runtime/src/main/resources/icons/action-wizard-refresh.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-refresh.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-refresh.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-start-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-start-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-start-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-start-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-start.png b/jaxx-runtime/src/main/resources/icons/action-wizard-start.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-start.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-start.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-canceled-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-canceled-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-canceled-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-canceled-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-canceled.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-canceled.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-canceled.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-canceled.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-failed-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-failed-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-failed-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-failed-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-failed.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-failed.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-failed.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-failed.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-need_fix-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-need_fix-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-need_fix-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-need_fix-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-need_fix.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-need_fix.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-need_fix.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-need_fix.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-pending-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-pending-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-pending-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-pending-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-pending.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-pending.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-pending.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-pending.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-running-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-running-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-running-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-running-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-running.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-running.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-running.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-running.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-successed-16.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-successed-16.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-successed-16.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-successed-16.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-successed.png b/jaxx-runtime/src/main/resources/icons/action-wizard-state-successed.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/action-wizard-state-successed.png rename to jaxx-runtime/src/main/resources/icons/action-wizard-state-successed.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/error.png b/jaxx-runtime/src/main/resources/icons/error.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/error.png rename to jaxx-runtime/src/main/resources/icons/error.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/info.png b/jaxx-runtime/src/main/resources/icons/info.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/info.png rename to jaxx-runtime/src/main/resources/icons/info.png diff --git a/jaxx-runtime-swing/src/main/resources/icons/warning.png b/jaxx-runtime/src/main/resources/icons/warning.png similarity index 100% rename from jaxx-runtime-swing/src/main/resources/icons/warning.png rename to jaxx-runtime/src/main/resources/icons/warning.png diff --git a/jaxx-runtime-api/src/main/resources/validators.xml b/jaxx-runtime/src/main/resources/validators.xml similarity index 100% rename from jaxx-runtime-api/src/main/resources/validators.xml rename to jaxx-runtime/src/main/resources/validators.xml diff --git a/jaxx-runtime-api/src/site/site.xml b/jaxx-runtime/src/site/site.xml similarity index 100% rename from jaxx-runtime-api/src/site/site.xml rename to jaxx-runtime/src/site/site.xml diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/DefaultApplicationContextTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/DefaultApplicationContextTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/DefaultApplicationContextTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/DefaultApplicationContextTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/DefaultJAXXContextTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/DefaultJAXXContextTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/DefaultJAXXContextTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/DefaultJAXXContextTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/UtilTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/UtilTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/AbstractBeanValidatorDetectorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/AbstractBeanValidatorDetectorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/AbstractBeanValidatorDetectorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/AbstractBeanValidatorDetectorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/BeanValidatorDetectorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/BeanValidatorDetectorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/BeanValidatorDetectorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/BeanValidatorDetectorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/BeanValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/BeanValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/BeanValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/BeanValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/SimpleBean.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/SimpleBean.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/SimpleBean.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/SimpleBean.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/XWorkBeanValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/XWorkBeanValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/XWorkBeanValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/XWorkBeanValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/AbstractFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/AbstractFieldValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/AbstractFieldValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/AbstractFieldValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/AbstractValidatorBeanFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/AbstractValidatorBeanFieldValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/AbstractValidatorBeanFieldValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/AbstractValidatorBeanFieldValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/ExistingFileFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ExistingFileFieldValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/ExistingFileFieldValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ExistingFileFieldValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/FieldExpressionBean.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/FieldExpressionBean.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/FieldExpressionBean.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/FieldExpressionBean.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/NotExistingFileFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/NotExistingFileFieldValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/NotExistingFileFieldValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/NotExistingFileFieldValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/RequiredFileFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/RequiredFileFieldValidatorTest.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/RequiredFileFieldValidatorTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/RequiredFileFieldValidatorTest.java diff --git a/jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/ValidatorBean.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ValidatorBean.java similarity index 100% rename from jaxx-runtime-api/src/test/java/jaxx/runtime/validator/field/ValidatorBean.java rename to jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ValidatorBean.java diff --git a/jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/SimpleBean-error-validation.xml b/jaxx-runtime/src/test/resources/jaxx/runtime/validator/SimpleBean-error-validation.xml similarity index 100% rename from jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/SimpleBean-error-validation.xml rename to jaxx-runtime/src/test/resources/jaxx/runtime/validator/SimpleBean-error-validation.xml diff --git a/jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/SimpleBean-info-validation.xml b/jaxx-runtime/src/test/resources/jaxx/runtime/validator/SimpleBean-info-validation.xml similarity index 100% rename from jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/SimpleBean-info-validation.xml rename to jaxx-runtime/src/test/resources/jaxx/runtime/validator/SimpleBean-info-validation.xml diff --git a/jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/SimpleBean-simple-validation.xml b/jaxx-runtime/src/test/resources/jaxx/runtime/validator/SimpleBean-simple-validation.xml similarity index 100% rename from jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/SimpleBean-simple-validation.xml rename to jaxx-runtime/src/test/resources/jaxx/runtime/validator/SimpleBean-simple-validation.xml diff --git a/jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/SimpleBean-warning-validation.xml b/jaxx-runtime/src/test/resources/jaxx/runtime/validator/SimpleBean-warning-validation.xml similarity index 100% rename from jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/SimpleBean-warning-validation.xml rename to jaxx-runtime/src/test/resources/jaxx/runtime/validator/SimpleBean-warning-validation.xml diff --git a/jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/field/FieldExpressionBean-error-validation.xml b/jaxx-runtime/src/test/resources/jaxx/runtime/validator/field/FieldExpressionBean-error-validation.xml similarity index 100% rename from jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/field/FieldExpressionBean-error-validation.xml rename to jaxx-runtime/src/test/resources/jaxx/runtime/validator/field/FieldExpressionBean-error-validation.xml diff --git a/jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/field/ValidatorBean-error-validation.xml b/jaxx-runtime/src/test/resources/jaxx/runtime/validator/field/ValidatorBean-error-validation.xml similarity index 100% rename from jaxx-runtime-api/src/test/resources/jaxx/runtime/validator/field/ValidatorBean-error-validation.xml rename to jaxx-runtime/src/test/resources/jaxx/runtime/validator/field/ValidatorBean-error-validation.xml diff --git a/jaxx-runtime-api/src/test/resources/log4j.properties b/jaxx-runtime/src/test/resources/log4j.properties similarity index 91% rename from jaxx-runtime-api/src/test/resources/log4j.properties rename to jaxx-runtime/src/test/resources/log4j.properties index 8459ad0..7ff6dff 100644 --- a/jaxx-runtime-api/src/test/resources/log4j.properties +++ b/jaxx-runtime/src/test/resources/log4j.properties @@ -5,4 +5,4 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n -log4j.logger.jaxx=DEBUG +log4j.logger.jaxx=INFO diff --git a/jaxx-runtime-api/src/test/resources/validators.xml b/jaxx-runtime/src/test/resources/validators.xml similarity index 100% rename from jaxx-runtime-api/src/test/resources/validators.xml rename to jaxx-runtime/src/test/resources/validators.xml diff --git a/jaxx-swing-action/pom.xml b/jaxx-swing-action/pom.xml index 5f88aab..d304bb2 100644 --- a/jaxx-swing-action/pom.xml +++ b/jaxx-swing-action/pom.xml @@ -11,7 +11,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>1.7.2-SNAPSHOT</version> + <version>2.0.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> @@ -21,7 +21,7 @@ <dependency> <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-swing</artifactId> + <artifactId>jaxx-runtime</artifactId> <version>${project.version}</version> </dependency> @@ -42,8 +42,8 @@ <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>${project.artifactId}</name> - <description>Jaxx lutin library swing extension (tabs and actions)</description> + <name>JAXX Action</name> + <description>JAXX Action framework</description> <!-- ************************************************************* --> <!-- *** Build Settings ****************************************** --> diff --git a/jaxx-runtime-api/LICENSE.txt b/jaxx-widgets/LICENSE.txt similarity index 100% rename from jaxx-runtime-api/LICENSE.txt rename to jaxx-widgets/LICENSE.txt diff --git a/jaxx-runtime-api/README.txt b/jaxx-widgets/README.txt similarity index 100% rename from jaxx-runtime-api/README.txt rename to jaxx-widgets/README.txt diff --git a/jaxx-runtime-swing-widget/changelog.txt b/jaxx-widgets/changelog.txt similarity index 100% rename from jaxx-runtime-swing-widget/changelog.txt rename to jaxx-widgets/changelog.txt diff --git a/jaxx-runtime-swing-widget/pom.xml b/jaxx-widgets/pom.xml similarity index 87% rename from jaxx-runtime-swing-widget/pom.xml rename to jaxx-widgets/pom.xml index 2b4e92c..2acd569 100644 --- a/jaxx-runtime-swing-widget/pom.xml +++ b/jaxx-widgets/pom.xml @@ -10,11 +10,11 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>1.7.2-SNAPSHOT</version> + <version>2.0.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> - <artifactId>jaxx-runtime-swing-widget</artifactId> + <artifactId>jaxx-widgets</artifactId> <dependencies> @@ -22,7 +22,7 @@ <dependency> <groupId>${project.groupId}</groupId> - <artifactId>jaxx-runtime-swing</artifactId> + <artifactId>jaxx-runtime</artifactId> <version>${project.version}</version> </dependency> @@ -47,8 +47,8 @@ <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>${project.artifactId}</name> - <description>Jaxx runtime swing widgets</description> + <name>JAXX Widgets</name> + <description>Collection of swing widgets wrote with JAXX</description> <!-- ************************************************************* --> <!-- *** Build Settings ****************************************** --> @@ -97,13 +97,9 @@ <groupId>org.nuiton.i18n</groupId> <artifactId>maven-i18n-plugin</artifactId> <configuration> - <silent>true</silent> <entries> <entry> - <basedir>${maven.gen.dir}/java/</basedir> - <includes> - <param>**\/**.java</param> - </includes> + <basedir>${maven.gen.dir}/java</basedir> </entry> </entries> </configuration> diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/ClockWidget.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/ClockWidget.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/ClockWidget.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/ClockWidget.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx similarity index 97% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx index f2cf273..47b2496 100644 --- a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx @@ -76,6 +76,7 @@ <script><![CDATA[ import static org.nuiton.i18n.I18n.n_; +import jaxx.runtime.decorator.JXPathDecorator; public static final String DEFAULT_POPUP_LABEL = n_("entitycombobox.popup.label"); @@ -83,7 +84,7 @@ public static final String DEFAULT_SELECTED_TOOLTIP = n_("entitycombobox.sort.on public static final String DEFAULT_NOT_SELECTED_TOOLTIP = n_("entitycombobox.sort.off"); -public <O> void init(jaxx.runtime.JXPathDecorator<O> decorator, java.util.List<O> data) { +public <O> void init(JXPathDecorator<O> decorator, java.util.List<O> data) { handler.init(decorator, data); } diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java similarity index 96% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java index fcd3218..6c63f28 100644 --- a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java @@ -19,9 +19,6 @@ package jaxx.runtime.swing; import java.awt.Component; -import jaxx.runtime.JXPathDecorator; -import jaxx.runtime.MultiJXPathDecorator; -import jaxx.runtime.Util; import jaxx.runtime.SwingUtil; import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.logging.Log; @@ -46,7 +43,11 @@ import java.beans.PropertyDescriptor; import java.lang.reflect.Method; import java.util.List; import javax.swing.JComboBox; -import jaxx.runtime.Decorator; +import jaxx.runtime.decorator.Decorator; +import jaxx.runtime.decorator.JXPathDecorator; +import jaxx.runtime.decorator.MultiJXPathDecorator; +import jaxx.runtime.decorator.swing.DecoratorListCellRenderer; +import jaxx.runtime.decorator.DecoratorUtils; import org.jdesktop.swingx.autocomplete.AutoCompletePropertyChangeListener; /** @@ -119,12 +120,12 @@ public class EntityComboBoxHandler<O> implements PropertyChangeListener { // should clone decorator ? d = (MultiJXPathDecorator<O>) decorator; } else { - d = MultiJXPathDecorator.newDecorator(decorator.getInternalClass(), decorator.getInitialExpression(), " - "); + d = DecoratorUtils.newMultiJXPathDecorator(decorator.getInternalClass(), decorator.getInitialExpression(), " - "); } this.decorator = d; // init combobox renderer base on given decorator - ui.getCombobox().setRenderer(Util.newDecoratedListCellRenderer(d)); + ui.getCombobox().setRenderer(new DecoratorListCellRenderer(d)); this.convertor = newDecoratedObjectToStringConverter(d); @@ -233,7 +234,7 @@ public class EntityComboBoxHandler<O> implements PropertyChangeListener { try { // Sort data with the decorator jxpath tokens. - JXPathDecorator.sort(decorator, ui.getData(), newValue); + DecoratorUtils.sort(decorator, ui.getData(), newValue); } catch (Exception e) { log.warn(e.getMessage(), e); //System.out.println("newValue :: "+decorator+" : "+newValue); diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/ErrorDialogUI.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/ErrorDialogUI.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/ErrorDialogUI.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/ErrorDialogUI.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/MemoryStatusWidget.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/MemoryStatusWidget.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/MemoryStatusWidget.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/MemoryStatusWidget.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/StatusMessagePanel.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/StatusMessagePanel.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/StatusMessagePanel.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/StatusMessagePanel.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/StatusMessagePanelHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/StatusMessagePanelHandler.java similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/StatusMessagePanelHandler.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/StatusMessagePanelHandler.java diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/ColumnSelector.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/ColumnSelector.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/ColumnSelector.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/ColumnSelector.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditor.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditor.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditor.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditor.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorPopup.css b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditorPopup.css similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/NumberEditorPopup.css rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditorPopup.css diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditor.css b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/TimeEditor.css similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditor.css rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/TimeEditor.css diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditor.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/TimeEditor.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditor.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/TimeEditor.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditorHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/TimeEditorHandler.java similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/TimeEditorHandler.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/TimeEditorHandler.java diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.css b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.css similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.css rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.css diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableEditor.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableEditor.java similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableEditor.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableEditor.java diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableRenderer.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableRenderer.java similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableRenderer.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableRenderer.java diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.css b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.css similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.css rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.css diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUI.jaxx diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigTableModel.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigTableModel.java similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigTableModel.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigTableModel.java diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java diff --git a/jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java similarity index 100% rename from jaxx-runtime-swing-widget/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java rename to jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java diff --git a/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-en_GB.properties b/jaxx-widgets/src/main/resources/i18n/jaxx-runtime-swing-widget-en_GB.properties similarity index 98% rename from jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-en_GB.properties rename to jaxx-widgets/src/main/resources/i18n/jaxx-runtime-swing-widget-en_GB.properties index 27e055b..5430ac8 100644 --- a/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-en_GB.properties +++ b/jaxx-widgets/src/main/resources/i18n/jaxx-runtime-swing-widget-en_GB.properties @@ -2,8 +2,7 @@ aboutframe.about=About aboutframe.license=License aboutframe.ok=OK aboutframe.thirdparty=Third party -columnselection.action.tip= -columnselector.action.tip= +columnselector.action.tip=Select the columns config.action.quit=Quit config.action.quit.tip=Quit the configuration editor config.action.reset=Cancel diff --git a/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties b/jaxx-widgets/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties similarity index 98% rename from jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties rename to jaxx-widgets/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties index 533b545..4cc23a4 100644 --- a/jaxx-runtime-swing-widget/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties +++ b/jaxx-widgets/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties @@ -2,8 +2,7 @@ aboutframe.about=\u00C0 propos aboutframe.license=Licence aboutframe.ok=OK aboutframe.thirdparty=Tierce partie -columnselection.action.tip= -columnselector.action.tip= +columnselector.action.tip=S\u00E9lectionner les colonnes config.action.quit=Quitter config.action.quit.tip=Quitter l'\u00E9diteur de configuration config.action.reset=Annuler diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-config-quit.png b/jaxx-widgets/src/main/resources/icons/action-config-quit.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-config-quit.png rename to jaxx-widgets/src/main/resources/icons/action-config-quit.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-config-reset.png b/jaxx-widgets/src/main/resources/icons/action-config-reset.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-config-reset.png rename to jaxx-widgets/src/main/resources/icons/action-config-reset.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-config-save.png b/jaxx-widgets/src/main/resources/icons/action-config-save.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-config-save.png rename to jaxx-widgets/src/main/resources/icons/action-config-save.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-be.png b/jaxx-widgets/src/main/resources/icons/action-i18n-be.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-be.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-be.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-ca.png b/jaxx-widgets/src/main/resources/icons/action-i18n-ca.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-ca.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-ca.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-ch.png b/jaxx-widgets/src/main/resources/icons/action-i18n-ch.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-ch.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-ch.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-de.png b/jaxx-widgets/src/main/resources/icons/action-i18n-de.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-de.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-de.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-dk.png b/jaxx-widgets/src/main/resources/icons/action-i18n-dk.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-dk.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-dk.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-es.png b/jaxx-widgets/src/main/resources/icons/action-i18n-es.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-es.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-es.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-fi.png b/jaxx-widgets/src/main/resources/icons/action-i18n-fi.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-fi.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-fi.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-fr.png b/jaxx-widgets/src/main/resources/icons/action-i18n-fr.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-fr.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-fr.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-gb.png b/jaxx-widgets/src/main/resources/icons/action-i18n-gb.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-gb.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-gb.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-it.png b/jaxx-widgets/src/main/resources/icons/action-i18n-it.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-it.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-it.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-nl.png b/jaxx-widgets/src/main/resources/icons/action-i18n-nl.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-nl.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-nl.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-no.png b/jaxx-widgets/src/main/resources/icons/action-i18n-no.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-no.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-no.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-se.png b/jaxx-widgets/src/main/resources/icons/action-i18n-se.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-se.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-se.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-us.png b/jaxx-widgets/src/main/resources/icons/action-i18n-us.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-i18n-us.png rename to jaxx-widgets/src/main/resources/icons/action-i18n-us.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-numbereditor-calculator.png b/jaxx-widgets/src/main/resources/icons/action-numbereditor-calculator.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-numbereditor-calculator.png rename to jaxx-widgets/src/main/resources/icons/action-numbereditor-calculator.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-numbereditor-reset.png b/jaxx-widgets/src/main/resources/icons/action-numbereditor-reset.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-numbereditor-reset.png rename to jaxx-widgets/src/main/resources/icons/action-numbereditor-reset.png diff --git a/jaxx-runtime-swing-widget/src/main/resources/icons/action-numbereditor-validate.png b/jaxx-widgets/src/main/resources/icons/action-numbereditor-validate.png similarity index 100% rename from jaxx-runtime-swing-widget/src/main/resources/icons/action-numbereditor-validate.png rename to jaxx-widgets/src/main/resources/icons/action-numbereditor-validate.png diff --git a/jaxx-example/src/site/rst/images/Components-screenshot.gif b/jaxx-widgets/src/site/rst/images/Components-screenshot.gif similarity index 100% rename from jaxx-example/src/site/rst/images/Components-screenshot.gif rename to jaxx-widgets/src/site/rst/images/Components-screenshot.gif diff --git a/jaxx-example/src/site/rst/images/webstart.gif b/jaxx-widgets/src/site/rst/images/webstart.gif similarity index 100% rename from jaxx-example/src/site/rst/images/webstart.gif rename to jaxx-widgets/src/site/rst/images/webstart.gif diff --git a/jaxx-example/src/site/rst/index.rst b/jaxx-widgets/src/site/rst/index.rst similarity index 100% rename from jaxx-example/src/site/rst/index.rst rename to jaxx-widgets/src/site/rst/index.rst diff --git a/jaxx-runtime-swing-widget/src/site/site.xml b/jaxx-widgets/src/site/site.xml similarity index 100% rename from jaxx-runtime-swing-widget/src/site/site.xml rename to jaxx-widgets/src/site/site.xml diff --git a/maven-jaxx-plugin/pom.xml b/maven-jaxx-plugin/pom.xml index d4b7be2..36922fd 100644 --- a/maven-jaxx-plugin/pom.xml +++ b/maven-jaxx-plugin/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>1.7.2-SNAPSHOT</version> + <version>2.0.0-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> @@ -22,6 +22,12 @@ <dependency> <groupId>${project.groupId}</groupId> + <artifactId>jaxx-runtime</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>${project.groupId}</groupId> <artifactId>jaxx-compiler</artifactId> <version>${project.version}</version> </dependency> @@ -108,10 +114,9 @@ <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>${project.artifactId}</name> + <name>JAXX Maven plugin</name> <description> - Maven 2 plugin to generate java source from ui interface definitions - in jaxx format. + Maven 2 plugin to generate java sources from JAXX files. </description> <!-- ************************************************************* --> @@ -135,6 +140,188 @@ </plugin> </plugins> + + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-javadoc-plugin</artifactId> + <version>${javadoc.version}</version> + <configuration> + <taglets> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoAggregatorTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoComponentFieldTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoConfiguratorTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecuteTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecutionStrategyTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoGoalTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInheritByDefaultTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInstantiationStrategyTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoParameterFieldTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoPhaseTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoReadOnlyFieldTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiredFieldTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresDependencyResolutionTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresDirectInvocationTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresOnLineTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresProjectTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresReportsTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + + <taglet> + <tagletClass>org.codehaus.plexus.javadoc.PlexusComponentTaglet</tagletClass> + <tagletArtifact> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-javadoc</artifactId> + <version>1.0</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.codehaus.plexus.javadoc.PlexusConfigurationTaglet</tagletClass> + <tagletArtifact> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-javadoc</artifactId> + <version>1.0</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.codehaus.plexus.javadoc.PlexusRequirementTaglet</tagletClass> + <tagletArtifact> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-javadoc</artifactId> + <version>1.0</version> + </tagletArtifact> + </taglet> + </taglets> + </configuration> + <executions> + <execution> + <id>attach-javadocs</id> + <goals> + <goal>jar</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </pluginManagement> </build> <reporting> @@ -142,6 +329,175 @@ <plugin> <artifactId>maven-plugin-plugin</artifactId> </plugin> + <plugin> + <artifactId>maven-javadoc-plugin</artifactId> + <version>${javadoc.version}</version> + <configuration> + <taglets> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoAggregatorTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoComponentFieldTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoConfiguratorTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecuteTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecutionStrategyTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoGoalTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInheritByDefaultTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInstantiationStrategyTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoParameterFieldTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoPhaseTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoReadOnlyFieldTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiredFieldTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresDependencyResolutionTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresDirectInvocationTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresOnLineTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresProjectTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresReportsTypeTaglet</tagletClass> + <tagletArtifact> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-tools-javadoc</artifactId> + <version>2.4.2</version> + </tagletArtifact> + </taglet> + + <taglet> + <tagletClass>org.codehaus.plexus.javadoc.PlexusComponentTaglet</tagletClass> + <tagletArtifact> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-javadoc</artifactId> + <version>1.0</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.codehaus.plexus.javadoc.PlexusConfigurationTaglet</tagletClass> + <tagletArtifact> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-javadoc</artifactId> + <version>1.0</version> + </tagletArtifact> + </taglet> + <taglet> + <tagletClass>org.codehaus.plexus.javadoc.PlexusRequirementTaglet</tagletClass> + <tagletArtifact> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-javadoc</artifactId> + <version>1.0</version> + </tagletArtifact> + </taglet> + </taglets> + </configuration> + </plugin> </plugins> </reporting> diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java index 2b7690d..9669d8b 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java @@ -124,46 +124,6 @@ public abstract class AbstractJaxxMojo extends AbstractPlugin { protected boolean checkPackaging() { return project != null && !"pom".equals(project.getPackaging()) && !"site".equals(project.getPackaging()); } -// @Override -// public void execute() throws MojoExecutionException, MojoFailureException { -// -// try { -// init(); -// } catch (Exception e) { -// if (e instanceof MojoFailureException) { -// throw (MojoFailureException) e; -// } -// if (e instanceof MojoExecutionException) { -// throw (MojoExecutionException) e; -// } -// throw new MojoExecutionException("error in init : " + e.getMessage(), e); -// } -// -// if (skip) { -// if (verbose) { -// getLog().info("jaxx - skip!"); -// } -// return; -// } -// -// try { -// -// doAction(); -// -// } catch (Exception e) { -// //getLog().error(e); -// Throwable e2 = e; -// while (e2.getCause() != null) { -// e2 = e.getCause(); -// } -// getLog().error(e2); -// -// throw new MojoExecutionException(e2.getMessage(), e2); -// } finally { -// System.gc(); -// } -// -// } @Override public MavenProject getProject() { diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java index 4800041..7bfd8aa 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java @@ -182,9 +182,9 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { */ protected String jaxxContextImplementorClass; /** - * extra path to be added in {@link java.beans.Introspector#setBeanInfoSearchPath(String[])}. + * extra path to be added in {@link java.beans.Introspector#setBeanInfoSearchPath(java.lang.String[])}. * <p/> - * add beanInfoSearchPath to be registred by {@link BeanInfoUtil#addJaxxBeanInfoPath(String[])} + * add beanInfoSearchPath to be registred by {@link BeanInfoUtil#addJaxxBeanInfoPath(java.lang.String[])} * <p/> * and then will be use by {@link jaxx.tags.swing.SwingInitializer#initialize()}. * <p/> @@ -215,7 +215,8 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { * If not given, will use the one defined in validator * * @parameter expression="${jaxx.defaultErrorUIFQN}" - * @see jaxx.runtime.validator.swing.SwingValidator#DEFAULT_UI_CLASS + * + * @see jaxx.runtime.validator.swing.SwingValidator */ protected String defaultErrorUIFQN; /** @@ -284,13 +285,6 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { if (skip) { return true; } -// -// if (project != null && ("pom".equals(project.getPackaging()) || "site".equals(project.getPackaging()))) { -// // nothing to be done for this type of packaging -// skip = true; -// getLog().info("skip generate goal for packaging " + project.getPackaging()); -// return true; -// } if (generateHelp) { // check there is some bundle @@ -475,14 +469,7 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { return result; } - //TODO use the AbstractPublig method protected void fixCompileSourceRoots() { -// //fixme should remove this silly test when we will make real maven plugin tests :) -// if (project != null) { -// if (!project.getCompileSourceRoots().contains(outJava.getPath())) { -// project.addCompileSourceRoot(outJava.getPath()); -// } -// } if (project == null) { // no project defined, can not fix anything // this case could appears if we wanted to do some tests of the plugin @@ -525,13 +512,6 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { getLog().warn("??? : " + e.getMessage(), e); } } - - //fixme should remove this silly test when we will make real maven plugin tests :) - if (getPluginContext() != null) { - for (Object e : getPluginContext().keySet()) { - getLog().info("pluginContext " + e + " : " + getPluginContext().get(e)); - } - } } protected void checkJaxxContextImplementorClass() { diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JComboBoxTest1.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JComboBoxTest1.jaxx index 7a3d535..ee118a6 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JComboBoxTest1.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JComboBoxTest1.jaxx @@ -1,3 +1,3 @@ -<JComboBox> +<JAXXComboBox> <item value='Working' selected='true'/> -</JComboBox> \ No newline at end of file +</JAXXComboBox> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JComboBoxTest2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JComboBoxTest2.jaxx index e522ac0..e42d431 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JComboBoxTest2.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JComboBoxTest2.jaxx @@ -1,3 +1,3 @@ -<JComboBox> +<JAXXComboBox> <item value='Failed!'/> -</JComboBox> \ No newline at end of file +</JAXXComboBox> \ No newline at end of file diff --git a/pom.xml b/pom.xml index f8e3aad..e35291c 100644 --- a/pom.xml +++ b/pom.xml @@ -14,18 +14,17 @@ </parent> <artifactId>jaxx</artifactId> - <version>1.7.2-SNAPSHOT</version> + <version>2.0.0-SNAPSHOT</version> <modules> - <module>jaxx-runtime-api</module> - <module>jaxx-runtime-swing</module> + <module>jaxx-runtime</module> <module>jaxx-compiler</module> <module>jaxx-swing-action</module> <module>maven-jaxx-plugin</module> - <module>jaxx-runtime-swing-widget</module> + <module>jaxx-widgets</module> <!-- deprecated since 1.7.2, will be removed before 2.0.0 <module>jaxx-example</module--> @@ -256,7 +255,7 @@ <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> - <version>1.2.9</version> + <version>1.2.14</version> </dependency> <dependency> @@ -308,8 +307,8 @@ <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>${project.artifactId}</name> - <description>Jaxx library parent pom</description> + <name>JAXX Project</name> + <description>JAXX Project</description> <inceptionYear>2008</inceptionYear> <url>http://maven-site.nuiton.org/jaxx</url> @@ -325,7 +324,7 @@ <projectId>jaxx</projectId> <lutinutil.version>1.1.0</lutinutil.version> - <i18n.version>1.0.1-SNAPSHOT</i18n.version> + <i18n.version>1.0.2-SNAPSHOT</i18n.version> <jxlayer.version>3.0.3</jxlayer.version> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 92bf054b4edf6d7188c9af9b4ba1b9598915e885 Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 5 19:16:52 2009 +0000 simplify modules + refactor NavigationTree and Decorator api + add real JComboBox tag handler (incompatible with JAXX 1.X) --- .../java/jaxx/tags/swing/JAXXComboBoxHandler.java | 62 +++ .../jaxx/demo/component/jaxx/tree/BaseContent.jaxx | 99 +++++ .../jaxx/tree/FullNavigationTreeDemo.jaxx | 82 ++++ .../jaxx/tree/FullNavigationTreeHelper.java | 244 ++++++++++++ .../java/jaxx/demo/component/jaxx/tree/Movie.java | 128 +++++++ .../java/jaxx/demo/component/jaxx/tree/People.java | 118 ++++++ .../java/jaxx/runtime/decorator/Decorator.java | 34 ++ .../jaxx/runtime/decorator/DecoratorUtils.java | 294 ++++++++++++++ .../jaxx/runtime/decorator/JXPathDecorator.java | 197 ++++++++++ .../runtime/decorator/MultiJXPathDecorator.java | 80 ++++ .../jaxx/runtime/decorator/PropertyDecorator.java | 76 ++++ .../decorator/swing/DecoratorListCellRenderer.java | 47 +++ .../swing/DecoratorTableCellRenderer.java | 43 +++ .../swing/tree/NavigationTreeContextHelper.java | 150 ++++++++ .../runtime/swing/tree/NavigationTreeHandler.java | 275 +++++++++++++ .../tree/NavigationTreeHandlerWithCardLayout.java | 100 +++++ .../runtime/swing/tree/NavigationTreeHelper.java | 141 +++++++ .../runtime/swing/tree/NavigationTreeModel.java | 246 ++++++++++++ .../swing/tree/NavigationTreeModelBuilder.java | 242 ++++++++++++ .../runtime/swing/tree/NavigationTreeNode.java | 424 +++++++++++++++++++++ .../swing/tree/NavigationTreeNodeRenderer.java | 44 +++ .../NavigationTreeNodeRendererDecoratorImpl.java | 53 +++ .../tree/NavigationTreeNodeRendererI18nImpl.java | 48 +++ .../main/java/jaxx/runtime/swing/tree/package.html | 12 + .../src/test/java/jaxx/runtime/decorator/Data.java | 37 ++ .../runtime/decorator/JXPathDecoratorTest.java | 136 +++++++ .../decorator/MultiJXPathDecoratorTest.java | 185 +++++++++ .../swing/tree/NavigationTreeModelTest.java | 377 ++++++++++++++++++ .../resources/i18n/jaxx-widgets-en_GB.properties | 70 ++++ .../resources/i18n/jaxx-widgets-fr_FR.properties | 70 ++++ .../java/org/nuiton/jaxx/plugin/ComboBoxTest.java | 84 ++++ .../org/nuiton/jaxx/plugin/ComboBoxTest/error.xml | 27 ++ .../jaxx/plugin/ComboBoxTest/error/swingcombo.jaxx | 4 + .../org/nuiton/jaxx/plugin/ComboBoxTest/ok.xml | 26 ++ .../jaxx/plugin/ComboBoxTest/ok/jaxxcombo.jaxx | 4 + .../jaxx/plugin/ComboBoxTest/ok/swingcombo.jaxx | 2 + 36 files changed, 4261 insertions(+) diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXComboBoxHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXComboBoxHandler.java new file mode 100644 index 0000000..ebe6aa5 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXComboBoxHandler.java @@ -0,0 +1,62 @@ +/* + * Copyright 2006 Ethan Nicholas. All rights reserved. + * Use is subject to license terms. + */ +package jaxx.tags.swing; + +import jaxx.CompilerException; +import jaxx.compiler.CompiledObject; +import jaxx.compiler.JAXXCompiler; +import jaxx.reflect.ClassDescriptor; +import jaxx.reflect.ClassDescriptorLoader; +import jaxx.runtime.swing.Item; +import jaxx.runtime.swing.JAXXComboBox; +import jaxx.tags.DefaultComponentHandler; +import jaxx.types.TypeManager; +import org.w3c.dom.Element; + +import java.awt.event.ItemListener; +import java.io.IOException; +import java.util.List; + +public class JAXXComboBoxHandler extends DefaultComponentHandler { + + public JAXXComboBoxHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JAXXComboBox.class); + } + + @Override + protected void configureProxyEventInfo() { + super.configureProxyEventInfo(); + addProxyEventInfo("getSelectedIndex", ItemListener.class); + addProxyEventInfo("getSelectedItem", ItemListener.class); + } + + @Override + protected CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { + return new CompiledItemContainer(id, getBeanClass(), compiler); + } + + @Override + public void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + super.compileChildrenSecondPass(tag, compiler); + CompiledItemContainer list = (CompiledItemContainer) compiler.getOpenComponent(); + List<Item> items = list.getItems(); + if (items != null && !items.isEmpty()) { + String listName = list.getId() + "$items"; + list.appendAdditionCode("java.util.List<jaxx.runtime.swing.Item> " + listName + " = new java.util.ArrayList<jaxx.runtime.swing.Item>();"); + for (Item item : items) { + String id = item.getId(); + CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(Item.class), compiler); + compiledItem.setConstructorParams(TypeManager.getJavaCode(id) + ", " + TypeManager.getJavaCode(item.getLabel()) + ", " + TypeManager.getJavaCode(item.getValue()) + ", " + item.isSelected()); + compiler.registerCompiledObject(compiledItem); + list.appendAdditionCode(listName + ".add(" + id + ");"); + } + list.appendAdditionCode(list.getId() + ".setItems(" + listName + ");"); + } + } +} + + + diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/BaseContent.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/BaseContent.jaxx new file mode 100644 index 0000000..6087dbd --- /dev/null +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/BaseContent.jaxx @@ -0,0 +1,99 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> +<JPanel layout='{new BorderLayout()}'> + + <Object id='data' javaBean='helper.getSelectedBean(this)'/> + + <script><![CDATA[ +import jaxx.runtime.SwingUtil; + +private final FullNavigationTreeHelper helper = new FullNavigationTreeHelper(); + +String getType(Object data) { + if (data == null) { + return "no type"; + } + if (data instanceof java.util.List<?>) { + java.util.List<?> l = (java.util.List<?>) data; + if (l.isEmpty()) { + return "Empty collection"; + } + return "Collection of " + l.size() + " " + l.get(0).getClass().getSimpleName() + "(s)"; + } + return data.getClass().getSimpleName(); +} + +String getContent(Object data) { + if (data == null) { + return "no content"; + } + StringBuilder buffer = new StringBuilder(); + if (data instanceof java.util.List) { + for (Object o : ((java.util.List)data)) { + buffer.append(o).append("\n"); + } + } else { + buffer.append(data); + } + return buffer.toString(); +} + +ImageIcon getImage(Object data) { + if (data == null) { + return null; + } + if (data instanceof Movie) { + return SwingUtil.createIcon(((Movie)data).getImage()); + } + if (data instanceof People) { + return SwingUtil.createIcon(((People)data).getImage()); + } + return null; +} + ]]> + </script> + + <JSplitPane id='splitPane' + orientation='{JSplitPane.VERTICAL_SPLIT}' + resizeWeight='0.5' + constraints='BorderLayout.CENTER' + oneTouchExpandable='true'> + + <JScrollPane border='{null}' + horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' + verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> + <JTextPane border='{new TitledBorder("Content Type : " + getType(getData()))}' + editable='false' + font-size='11' + text='{getContent(getData())}'/> + </JScrollPane> + + <JScrollPane border='{new TitledBorder("Picture")}' + horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED}' + verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}' + minimumSize='{SwingUtil.newMinDimension()}'> + + <JLabel horizontalAlignment='center' icon='{getImage(getData())}'/> + + </JScrollPane> + + </JSplitPane> +</JPanel> \ No newline at end of file diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/FullNavigationTreeDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/FullNavigationTreeDemo.jaxx new file mode 100644 index 0000000..ea83673 --- /dev/null +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/FullNavigationTreeDemo.jaxx @@ -0,0 +1,82 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> + +<jaxx.demo.DemoPanel> + + <jaxx.runtime.swing.CardLayout2 id='contentLayout' + useOnlyVisibleComponentDimension='true'/> + + <script><![CDATA[ +import jaxx.runtime.SwingUtil; + +private final FullNavigationTreeHelper helper = new FullNavigationTreeHelper(); + +helper.createModel(this); + +@Override +protected String[] getSources() { + return new String[]{ getDefaultSource(), "BaseContent.jaxx", "FullNavigationTreeHelper.java", "Movie.java", "People.java" }; +} + +private void $afterCompleteSetup() { + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + navigation.setSelectionInterval(0, 0); + splitPane.resetToPreferredSizes(); + } + }); + // expand the tree + SwingUtil.expandTree(navigation); + // auto-expand node when selected + SwingUtil.addExpandOnClickListener(navigation); +} + ]]> + </script> + + <JPanel id='demoPanel' layout='{new BorderLayout()}'> + + <JSplitPane id='splitPane' + constraints='BorderLayout.CENTER' + oneTouchExpandable='true'> + + <JScrollPane border='{null}' + horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' + verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_NEVER}'> + + <JTree id="navigation" + font-size='11' + rootVisible='false' + showsRootHandles='false' + model='{helper.createTreeModel(this)}' + selectionModel="{helper.createTreeHandler(this)}"/> + <!--cellRenderer='{new NavigationTreeCellRenderer(this, 150)}' />--> + + </JScrollPane> + + <JPanel id="content" layout="{contentLayout}" /> + + </JSplitPane> + + </JPanel> + +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/FullNavigationTreeHelper.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/FullNavigationTreeHelper.java new file mode 100644 index 0000000..7bb9bf1 --- /dev/null +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/FullNavigationTreeHelper.java @@ -0,0 +1,244 @@ +/* + * *##% + * jaxx-demo + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.demo.component.jaxx.tree; + +import java.util.Arrays; + +import static jaxx.runtime.JAXXContextEntryDef.newListDef; +import static org.nuiton.i18n.I18n._; + +import java.util.List; +import jaxx.runtime.decorator.Decorator; +import jaxx.runtime.JAXXContext; + + +import javax.swing.JPanel; +import jaxx.runtime.JAXXContextEntryDef; +import jaxx.runtime.JAXXObject; +import jaxx.runtime.decorator.DecoratorUtils; +import jaxx.runtime.swing.CardLayout2; +import jaxx.runtime.swing.ErrorDialogUI; +import jaxx.runtime.swing.tree.NavigationTreeHandler; +import jaxx.runtime.swing.tree.NavigationTreeHandler.Strategy; +import jaxx.runtime.swing.tree.NavigationTreeHandlerWithCardLayout; +import jaxx.runtime.swing.tree.NavigationTreeHelper; +import jaxx.runtime.swing.tree.NavigationTreeModelBuilder; +import jaxx.runtime.swing.tree.NavigationTreeNode; +import jaxx.runtime.swing.tree.NavigationTreeModel; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author chemit + * @since 1.7.2 + */ +public class FullNavigationTreeHelper extends NavigationTreeHelper { + + static { + // register decorator one for all + + DecoratorUtils.register( + Movie.class.getSimpleName(), + DecoratorUtils.newMultiJXPathDecorator(Movie.class, "${title}$s##${year}$s", "##", " - ")); + + DecoratorUtils.register( + People.class.getSimpleName(), + DecoratorUtils.newMultiJXPathDecorator(People.class, "${firstName}$s##${lastName}$s", "##", " ")); + } + /** + * Logger + */ + static private final Log log = LogFactory.getLog(FullNavigationTreeHelper.class); + /** + * where the movies are hold in context + */ + static public final JAXXContextEntryDef<List<Movie>> MOVIES = JAXXContextEntryDef.newListDef("movies"); + /** + * where the actors are hold in context + */ + static public final JAXXContextEntryDef<List<People>> ACTORS = JAXXContextEntryDef.newListDef("actors"); + + public FullNavigationTreeHelper() { + super("full"); + } + + /** + * Create the model and store it in the given context. + * + * @param context the context where to hold the model + */ + public void createModel(JAXXContext context) { + People a = new People("0", "Jack", "Black", 0, "/jaxx/demo/images/jack.jpg"); + People a2 = new People("1", "Héctor", "Jiménez", 0, "/jaxx/demo/images/hector.jpg"); + People a3 = new People("2", "Ana", "de la Reguera", 0, "/jaxx/demo/images/ana.jpg"); + + Movie m = new Movie("0", "Nacho libre", 1996, "/jaxx/demo/images/nacho.jpg"); + m.addActor(a); + m.addActor(a2); + m.addActor(a3); + + Movie m2 = new Movie("1", "Nacho 2", 2009, "/jaxx/demo/images/nacho2.png"); + m2.addActor(a); + m2.addActor(a2); + + MOVIES.setContextValue(context, Arrays.asList(m, m2)); + ACTORS.setContextValue(context, Arrays.asList(a, a2, a3)); + } + + @Override + public NavigationTreeModel createTreeModel(JAXXContext context) { + + List<Movie> movies = MOVIES.getContextValue(context); + List<People> actors = ACTORS.getContextValue(context); + + if (log.isDebugEnabled()) { + log.debug("for " + movies.size() + " movie(s)"); + } + + NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder("/", context, BaseContent.class, + null); + + Decorator<Movie> mDecorator = DecoratorUtils.get(Movie.class.getSimpleName()); + Decorator<People> pDecorator = DecoratorUtils.get(People.class.getSimpleName()); + + // construction du noeud root + // il ne contient pas de context et ne sera pas visible + NavigationTreeNode rootNode = builder.buildEmptyRoot(null, "$root"); + + // construction du noeud avec les films recupere la liste des films + // dans le context avec la clef movies + // navigation path = $root/movies + NavigationTreeNode moviesNode = builder.build( + rootNode, + _("movies"), + newListDef("movies"), + "movies", + null, + null); + + for (Movie m : movies) { + + // navigation path = $root/movies/m.id + NavigationTreeNode movieNode = builder.build( + moviesNode, + mDecorator, + "..[@id=\"" + m.getId() + "\"]", + m.getId(), + null, + null); + + // navigation path = $root/movies/m.id/actors + NavigationTreeNode actorsNode = builder.build( + movieNode, + _("actors"), + "../actors", + "actors", + null, + null); + + for (People p : m.getActors()) { + // navigation path = $root/movies/m.id/actors/p.id + builder.build( + actorsNode, + pDecorator, + "..[@id=\"" + p.getId() + "\"]", + p.getId(), + null, + null); + } + } + + // construction du noeud avec les acteurs + NavigationTreeNode actorsNode = builder.build(rootNode, _("actors"), + newListDef("actors"), + "actors", null, null); + + for (People p : actors) { + // navigation path = $root/actors/p.id + builder.build( + actorsNode, + pDecorator, + "..[@id=\"" + p.getId() + "\"]", + p.getId(), + null, + null); + } + NavigationTreeModel model = builder.getModel(); + + if (log.isDebugEnabled()) { + builder.printModel(model.getRoot()); + } + + // save tree model in context + setTreeModel(context, model); + return model; + } + + @Override + public NavigationTreeHandler createTreeHandler(JAXXObject context) { + + if (log.isDebugEnabled()) { + log.debug("create handler"); + } + + NavigationTreeHandler handler; + + handler = new NavigationTreeHandlerWithCardLayout( + getPrefix(), + context, + Strategy.PER_NODE) { + + private static final long serialVersionUID = 1L; + + @Override + protected NavigationTreeModel getNavigationTreeModel() { + return getSafeTreeModel(getContext()); + } + + @Override + protected JPanel getContentContainer() { + return getContext().getContent(); + } + + @Override + protected CardLayout2 getContentLayout() { + return getContext().getContentLayout(); + } + + @Override + protected void treateError(Exception e) { + ErrorDialogUI.showError(e); + } + + @Override + public FullNavigationTreeDemo getContext() { + return (FullNavigationTreeDemo) this.context; + } + }; + // on ne peut selectionner qu'un seul noeud a la fois + handler.setSelectionMode(NavigationTreeHandler.SINGLE_TREE_SELECTION); + + // save handler in ui context + setTreeHandler(context, handler); + return handler; + } +} diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/Movie.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/Movie.java new file mode 100644 index 0000000..406ed63 --- /dev/null +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/Movie.java @@ -0,0 +1,128 @@ +/* + * *##% + * jaxx-demo + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.demo.component.jaxx.tree; + +import java.util.ArrayList; +import java.util.List; +import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; + +/** + * + * @author chemit + * @since 1.7.2 + */ +public class Movie { + + protected String id; + protected String title; + protected String image; + protected int year; + protected List<People> actors; + + public Movie(String id, String title, int year,String image) { + this(); + this.id = id; + this.title = title; + this.year = year; + this.image=image; + } + + public Movie() { + actors = new ArrayList<People>(); + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public List<People> getActors() { + return actors; + } + + public void setActors(List<People> actors) { + this.actors = actors; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public int getYear() { + return year; + } + + public void setYear(int year) { + this.year = year; + } + + public String getImage() { + return image; + } + + public void setImage(String image) { + this.image = image; + } + + public void addActor(People actor) { + actors.add(actor); + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final Movie other = (Movie) obj; + if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 41 * hash + (this.id != null ? this.id.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE); + b.append("id", id); + b.append("title", title); + b.append("year", year); + b.append("actors", actors); + return b.toString(); + } +} diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/People.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/People.java new file mode 100644 index 0000000..b92ad9f --- /dev/null +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/People.java @@ -0,0 +1,118 @@ +/* + * *##% + * jaxx-demo + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.demo.component.jaxx.tree; + +import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; + +/** + * + * @author chemit + * @since 1.7.2 + */ +public class People { + + protected String id; + protected String image; + protected String firstName; + protected String lastName; + protected int age; + + public People(String id, String firstName, String lastName, int age, String image) { + this.id = id; + this.firstName = firstName; + this.lastName = lastName; + this.age = age; + this.image = image; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getImage() { + return image; + } + + public void setImage(String image) { + this.image = image; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final People other = (People) obj; + if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 97 * hash + (this.id != null ? this.id.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE); + b.append("id", id); + b.append("firstName", firstName); + b.append("lastName", lastName); + b.append("age", age); + return b.toString(); + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/Decorator.java b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/Decorator.java new file mode 100644 index 0000000..45b48e8 --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/Decorator.java @@ -0,0 +1,34 @@ +package jaxx.runtime.decorator; + +/** + * A simple contract to define a String decorator on any java objet. + * + * @param <O> the type of data to decorate + * @author chemit + * @since 1.7.2 (was previously {@code jaxx.runtime.Decorator}) + */ +public abstract class Decorator<O> implements java.io.Serializable { + + private static final long serialVersionUID = -1L; + /** + * Type of the data to decorate + */ + protected final Class<O> internalClass; + + public Decorator(Class<O> internalClass) throws NullPointerException { + if (internalClass == null) { + throw new NullPointerException("internalClass can not be null."); + } + this.internalClass = internalClass; + } + + /** + * @param bean the bean to decorate + * @return the string value of the given bean + */ + public abstract String toString(Object bean); + + public Class<O> getInternalClass() { + return internalClass; + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java new file mode 100644 index 0000000..74971cf --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java @@ -0,0 +1,294 @@ +package jaxx.runtime.decorator; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.StringTokenizer; +import jaxx.runtime.decorator.JXPathDecorator.JXPathComparator; +import jaxx.runtime.decorator.JXPathDecorator.Context; + +/** + * + * Some usefull methods on {@link Decorator} to create, decorators and obtain decorators. + * + * To create a new decorator, use one of the methods : + * <ul> + * <li>{@link #newPropertyDecorator(Class, String)}</li> + * <li>{@link #newJXPathDecorator(Class, String)}</li> + * <li>{@link #newMultiJXPathDecorator(Class, String, String)})</li> + * <li>{@link #newMultiJXPathDecorator(Class, String, String, String)})</li> + * </ul> + * <p/> + * + * To register a new decorator, use the method {@link #register(String, Decorator)}. + * <p/> + * To obtain a registred decorator, use the method {@link #get(String)} + * (get the decorator based on his registred name). or the method {@link #get(Class, tring)} + * (get the decorator based on the type of decorator and the registred name). + * <p/> + * To sort a list of data, using a {@link JXPathDecorator}, use the method + * {@link #sort(JXPathDecorator, java.util.List, int)}. + * <p/> + * + * @author tony + * @since 1.7.2 (was previously {@code jaxx.runtime.DecoratorUtils}) + */ +public class DecoratorUtils { + + /** + * Registred decorators. + */ + protected static List<DecoratorContext<?>> decorators; + + /** + * Factory method to instanciate a new {@link PropertyDecorator} for the + * given class {@link O} and a readable property name. + * + * @param internalClass the class of the objects decorated by the new decorator + * @param property the property + * @param <O> the generic type of class to be decorated by the new decorator + * @return the new instanciated decorator + * @throws IllegalArgumentException if the expression is not valid, says: + * <p/> + * - a missing right brace was detected. + * <p/> + * - a ${ was found in a jxpath token. + * @throws NullPointerException if internalClass parameter is null. + */ + public static <O> PropertyDecorator<O> newPropertyDecorator(Class<O> internalClass, String property) + throws IllegalArgumentException, NullPointerException { + return new PropertyDecorator<O>(internalClass, property); + } + + /** + * Factory method to instanciate a new {@link JXPathDecorator} for the + * given class {@link O} and expression. + * + * @param internalClass the class of the objects decorated by the new decorator + * @param expression the expression to use to decorated objects + * @param <O> the generic type of class to be decorated by the new decorator + * @return the new instanciated decorator + * @throws IllegalArgumentException if the expression is not valid, says: + * <p/> + * - a missing right brace was detected. + * <p/> + * - a ${ was found in a jxpath token. + * @throws NullPointerException if internalClass parameter is null. + */ + public static <O> JXPathDecorator<O> newJXPathDecorator(Class<O> internalClass, String expression) + throws IllegalArgumentException, NullPointerException { + + Context<O> context = createJXPathContext(expression); + return new JXPathDecorator<O>(internalClass, expression, context); + } + + public static <O> MultiJXPathDecorator<O> newMultiJXPathDecorator(Class<O> internalClass, + String expression, + String separator) + throws IllegalArgumentException, NullPointerException { + + return newMultiJXPathDecorator(internalClass, expression, separator, separator); + } + + public static <O> MultiJXPathDecorator<O> newMultiJXPathDecorator(Class<O> internalClass, + String expression, + String separator, + String separatorReplacement) + throws IllegalArgumentException, NullPointerException { + + Context<O>[] contexts = createMultiJXPathContext(expression, separator, separatorReplacement); + + return new MultiJXPathDecorator<O>(internalClass, expression, separator, separatorReplacement, contexts); + } + + public static <T> Decorator<T> get(String context) { + Decorator<T> result = get(null, context); + return result; + } + + public static <T> Decorator<T> get(Class<T> type, String context) { + DecoratorContext<T> decoratorContext = getDecoratorContext(type, context); + Decorator<T> result = decoratorContext == null ? null : decoratorContext.getDecorator(); + return result; + } + + /** + * Register a new decorator in the cache. + * + * @param <T> type of data decorated + * @param context the name decorator + * @param decorator the decorator to register + */ + public static <T> void register(String context, Decorator<T> decorator) { + + DecoratorContext<T> result = getDecoratorContext(decorator.getInternalClass(), context); + + if (result != null) { + throw new IllegalArgumentException("there is an already register decorator " + result); + } + + if (decorators == null) { + decorators = new java.util.ArrayList<DecoratorContext<?>>(); + } + decorators.add(new DecoratorContext<T>(context, decorator)); + } + + public static void clear() { + if (decorators != null) { + decorators.clear(); + } + } + + /** + * Sort a list of data based on the first token property of a given context + * in a given decorator. + * + * @param <O> type of data to sort + * @param decorator the decorator to use to sort + * @param datas the list of data to sort + * @param pos the index of context to used in decorator to obtain sorted property. + */ + public static <O> void sort(JXPathDecorator<O> decorator, List<O> datas, int pos) { + Comparator<O> c = null; + boolean cachedComparator = false; + try { + c = decorator.getComparator(pos); + cachedComparator = c instanceof JXPathComparator<?>; + + if (cachedComparator) { + ((JXPathComparator<O>) c).init(decorator, datas); + } + Collections.sort(datas, c); + } finally { + if (cachedComparator) { + ((JXPathComparator<?>) c).clear(); + } + } + } + + @SuppressWarnings({"unchecked"}) + protected static <T> DecoratorContext<T> getDecoratorContext(Class<T> type, String context) { + DecoratorContext<T> result = null; + if (decorators != null) { + for (DecoratorContext<?> d : decorators) { + if (type == null) { + if (d.accept(context)) { + result = (DecoratorContext<T>) d; + break; + } + continue; + } + if (d.accept(type, context)) { + result = (DecoratorContext<T>) d; + break; + } + } + } + return result; + } + + public static class DecoratorContext<T> { + + final String context; + final Decorator<T> decorator; + + public DecoratorContext(String context, Decorator<T> decorator) { + this.context = context; + this.decorator = decorator; + } + + public String getContext() { + return context; + } + + public Decorator<T> getDecorator() { + return decorator; + } + + public Class<T> getType() { + return decorator.getInternalClass(); + } + + public boolean accept(Class<?> type, String context) { + return getType().isAssignableFrom(type) && accept(context); + } + + public boolean accept(String context) { + return ((this.context == null && context == null) || (this.context != null && this.context.equals(context))); + } + + @Override + public String toString() { + return super.toString() + "<type: " + getType().getName() + ", context :" + context + ">"; + } + } + + public static <O> Context<O> createJXPathContext(String expression) { + List<String> lTokens = new ArrayList<String>(); + StringBuilder buffer = new StringBuilder(); + int size = expression.length(); + int end = -1; + int start; + while ((start = expression.indexOf("${", end + 1)) > -1) { + if (start > end + 1) { + // prefix of next jxpath token + buffer.append(expression.substring(end + 1, start)); + } + // seek end of jxpath + end = expression.indexOf("}", start + 1); + if (end == -1) { + throw new IllegalArgumentException("could not find the rigth brace starting at car " + start + " : " + expression.substring(start + 2)); + } + String jxpath = expression.substring(start + 2, end); + // not allowed ${ inside a jxpath token + if (jxpath.indexOf("${") > -1) { + throw new IllegalArgumentException("could not find a ${ inside a jxpath expression at car " + (start + 2) + " : " + jxpath); + } + // save the jxpath token + lTokens.add(jxpath); + // replace jxpath token in expresion with a string format variable + buffer.append("%").append(lTokens.size()); + } + if (size > (end + 1)) { + // suffix after end jxpath (or all expression if no jxpath) + buffer.append(expression.substring(end + 1)); + } + return new Context<O>(buffer.toString(), lTokens.toArray(new String[lTokens.size()])); + } + + public static <O> Context<O>[] createMultiJXPathContext(String expression, String separator, String separatorReplacement) { + int sep = expression.indexOf(separator); + if (sep == -1) { + Context<O>[] result = newInstance(1); + result[0] = createJXPathContext(expression); + return result; + } + + List<String> tokens = new ArrayList<String>(); + StringTokenizer stk = new StringTokenizer(expression, separator); + while (stk.hasMoreTokens()) { + tokens.add(stk.nextToken()); + } + + int nbTokens = tokens.size(); + Context<O>[] contexts = newInstance(nbTokens); + for (int i = 0; i < nbTokens; i++) { + StringBuilder buffer = new StringBuilder(expression.length()); + for (int j = 0; j < nbTokens; j++) { + int index = (i + j) % nbTokens; + String str = tokens.get(index); + //todo replace %index with %j + buffer.append(separatorReplacement).append(str); + } + contexts[i] = createJXPathContext(buffer.substring(separatorReplacement.length())); + } + return contexts; + } + + @SuppressWarnings("unchecked") + protected static <O> Context<O>[] newInstance(int size) { + // fixme how to instanciate a typed array with no checking warning ? + return new Context[size]; + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java new file mode 100644 index 0000000..2d46e19 --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java @@ -0,0 +1,197 @@ +package jaxx.runtime.decorator; + +import org.apache.commons.jxpath.JXPathContext; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.util.Arrays; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * JXPath decorator based on {@link String#format(String, Object[])} method. + * <p/> + * To use it, give to him a expression where all jxpath to apply on bean are boxed in <code>${}</code>. + * <p/> + * After the jxpath token you must specifiy the formatter to apply of the jxpath token. + * <p/> + * For example : + * <pre> + * Decorator<Object> d = DecoratorUtils.newJXPathDecorator(JXPathDecorator.class,"expr = ${expressions}$s"); + * assert "expr = %1$s" == d.getExpression(); + * assert 1 == d.getNbToken(); + * assert java.util.Arrays.asList("expression") == d.getTokens(); + * assert "expr = %1$s" == d.toString(d); + * </pre> + * + * @param <O> type of data to decorate + * @author chemit + * @see Decorator + * @since 1.7.2 (was previously {@code jaxx.runtime.JXPathDecorat}) + */ +public class JXPathDecorator<O> extends Decorator<O> { + + private static final long serialVersionUID = 1L; + /** + * Logger + */ + private static final Log log = LogFactory.getLog(JXPathDecorator.class); + /** the computed context of the decorator */ + protected Context<O> context; + /** nb jxpath tokens to compute */ + protected int nbToken; + /** the initial expression used to compute the decorator context. */ + protected String initialExpression; + + protected JXPathDecorator(Class<O> internalClass, String expression, Context<O> context) throws IllegalArgumentException, NullPointerException { + super(internalClass); + this.initialExpression = expression; + if (context != null) { + setContext(context); + } + } + + @Override + public String toString(Object bean) { + if (bean == null) { + return null; + } + JXPathContext jxcontext = JXPathContext.newContext(bean); + Object[] args = new Object[nbToken]; + + for (int i = 0; i < nbToken; i++) { + try { + args[i] = getTokenValue(jxcontext, context.tokens[i]); + } catch (Exception e) { + log.error("can not obtain token " + context.tokens[i] + "on object " + bean + " for reason " + e.getMessage(), e); + + } + } + + return String.format(context.expression, args); + } + + public String getProperty(int pos) { + return getTokens()[pos]; + } + + public String getExpression() { + return context.expression; + } + + public String[] getTokens() { + return context.tokens; + } + + public int getNbToken() { + return nbToken; + } + + public String getInitialExpression() { + return initialExpression; + } + + @Override + public String toString() { + return super.toString() + "<" + context + ">"; + } + + public void setContext(Context<O> context) { + this.context = context; + this.nbToken = context.tokens.length; + // always reset comparator + //this.context.comparator = null; + if (log.isDebugEnabled()) { + log.debug(context); + } + } + + @SuppressWarnings({"unchecked"}) + protected Comparator<O> getComparator(int pos) { + ensureTokenIndex(this, pos); + return context.getComparator(pos); + } + + @SuppressWarnings({"unchecked"}) + protected Comparable<Comparable<?>> getTokenValue(JXPathContext jxcontext, String token) { + // assume all values are comparable + return (Comparable<Comparable<?>>) jxcontext.getValue(token); + } + + public static class JXPathComparator<O> implements Comparator<O> { + + protected Map<O, Comparable<Comparable<?>>> valueCache; + private final String expression; + + public JXPathComparator(String expression) { + this.expression = expression; + this.valueCache = new HashMap<O, Comparable<Comparable<?>>>(); + } + + @Override + public int compare(O o1, O o2) { + Comparable<Comparable<?>> c1 = valueCache.get(o1); + Comparable<Comparable<?>> c2 = valueCache.get(o2); + return c1.compareTo(c2); + } + + public void clear() { + valueCache.clear(); + } + + public void init(JXPathDecorator<O> decorator, List<O> datas) { + clear(); + for (O data : datas) { + JXPathContext jxcontext = JXPathContext.newContext(data); + Comparable<Comparable<?>> key = decorator.getTokenValue(jxcontext, expression); + valueCache.put(data, key); + } + } + } + + public static class Context<O> implements java.io.Serializable { + + /** + * expression to format using {@link String#format(String, Object[])}, all variables are compute + * using using the jxpath tokens. + */ + protected String expression; + /** list of jxpath tokens to apply on expression */ + protected String[] tokens; + protected transient Comparator<O> comparator; + private static final long serialVersionUID = 1L; + + public Context(String expression, String[] tokens) { + this.expression = expression; + this.tokens = tokens; + } + + public String getFirstProperty() { + return tokens[0]; + } + + public Comparator<O> getComparator(int pos) { + if (comparator == null) { + comparator = new JXPathComparator<O>(tokens[pos]); + } + return comparator; + } + + public void setComparator(Comparator<O> comparator) { + this.comparator = comparator; + } + + @Override + public String toString() { + return "<expression:" + expression + ", tokens:" + Arrays.toString(tokens) + ">"; + } + } + + protected static void ensureTokenIndex(JXPathDecorator<?> decorator, int pos) { + if (pos < -1 || pos > decorator.getNbToken()) { + throw new ArrayIndexOutOfBoundsException("token index " + pos + " is out of bound, can be inside [" + 0 + "," + decorator.nbToken + "]"); + } + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/MultiJXPathDecorator.java b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/MultiJXPathDecorator.java new file mode 100644 index 0000000..714bf3b --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/MultiJXPathDecorator.java @@ -0,0 +1,80 @@ +package jaxx.runtime.decorator; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.util.Comparator; + +/** + * TODO + * + * @param <O> type of data to decorate + * @author chemit + * @see Decorator + * @since 1.7.2 (was previously {@code jaxx.runtime.MultiJXPathDecorator}) + */ +public class MultiJXPathDecorator<O> extends JXPathDecorator<O> { + + private static final long serialVersionUID = 1L; + /** + * Logger + */ + private static final Log log = LogFactory.getLog(MultiJXPathDecorator.class); + /** + * Contexts of the decorator + */ + protected Context<O>[] contexts; + /** + * context separator + */ + protected String separator; + /** + * context separator replacement + */ + protected String separatorReplacement; + + protected MultiJXPathDecorator(Class<O> internalClass, String expression, + String separator, String separatorReplacement, + Context<O>[] contexts) throws IllegalArgumentException, NullPointerException { + super(internalClass, expression, null); + this.separator = separator; + this.separatorReplacement = separatorReplacement; + this.contexts = contexts; + + setContextIndex(0); + + if (log.isDebugEnabled()) { + log.debug(expression + " --> " + this.context); + } + } + + public void setContextIndex(int index) { + ensureContextIndex(this, index); + setContext(contexts[index]); + } + + public int getNbContext() { + return contexts.length; + } + + public String getSeparator() { + return separator; + } + + public String getSeparatorReplacement() { + return separatorReplacement; + } + + @Override + protected Comparator<O> getComparator(int pos) { + ensureContextIndex(this, pos); + Context<O> context1 = contexts[pos]; + return context1.getComparator(0); + } + + protected void ensureContextIndex(MultiJXPathDecorator<?> decorator, int pos) { + if (pos < -1 || pos > decorator.contexts.length) { + throw new ArrayIndexOutOfBoundsException("context index " + pos + " is out of bound, can be inside [" + 0 + "," + decorator.contexts.length + "]"); + } + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/PropertyDecorator.java b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/PropertyDecorator.java new file mode 100644 index 0000000..4394fb2 --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/PropertyDecorator.java @@ -0,0 +1,76 @@ +package jaxx.runtime.decorator; + +import org.apache.commons.beanutils.PropertyUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.beans.PropertyDescriptor; +import java.lang.reflect.Method; + +/** + * Simple property decorator based on {@link String#format(String, Object[])} method. + * <p/> + * To use it, give him a class and the property name to render. + * <p/> + * For example : + * <pre> + * Decorator<Object> d = DecoratorUtils.newPropertyDecorator(PropertyDecorator.class,"expressions"); + * </pre> + * + * @param <O> type of data to decorate + * @author chemit + * @see Decorator + * @since 1.7.2 (was previously {@code jaxx.runtime.PropertyDecorator}) + */ +public class PropertyDecorator<O> extends Decorator<O> { + + private static final long serialVersionUID = 1L; + /** + * Logger + */ + static private final Log log = LogFactory.getLog(PropertyDecorator.class); + /** + * name of property + */ + protected String property; + protected transient Method m; + + @Override + public String toString(Object bean) { + try { + return getM().invoke(bean) + ""; + } catch (Exception e) { + log.error("could not convert for reason : " + e, e); + return ""; + } + } + + public String getProperty() { + return property; + } + + protected PropertyDecorator(Class<O> internalClass, String property) throws NullPointerException { + super(internalClass); + if (property == null) { + throw new NullPointerException("property can not be null."); + } + this.property = property; + // init method + getM(); + } + + protected Method getM() { + if (m == null) { + for (PropertyDescriptor propertyDescriptor : PropertyUtils.getPropertyDescriptors(internalClass)) { + if (propertyDescriptor.getName().equals(property)) { + this.m = propertyDescriptor.getReadMethod(); + break; + } + } + if (m == null) { + throw new IllegalArgumentException("could not find the property " + property + " in " + internalClass); + } + } + return m; + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorListCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorListCellRenderer.java new file mode 100644 index 0000000..39bdb8c --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorListCellRenderer.java @@ -0,0 +1,47 @@ +package jaxx.runtime.decorator.swing; + +import jaxx.runtime.decorator.*; +import java.awt.Component; +import javax.swing.DefaultListCellRenderer; +import javax.swing.JList; +import javax.swing.ListCellRenderer; + +/** + * A {@link ListCellRenderer} which compute text with the given {@link #decorator} + * and leave the hand to the {@link #delegate} to perform the visual renderer. + * + * @author chemit + * @since 1.7.2 + */ +public class DecoratorListCellRenderer implements ListCellRenderer { + + /** + * Delegate cell renderer + */ + protected ListCellRenderer delegate; + /** + * Decorator to produce text to render + */ + protected Decorator<?> decorator; + + public DecoratorListCellRenderer(Decorator<?> decorator) { + this(new DefaultListCellRenderer(), decorator); + } + + public DecoratorListCellRenderer(ListCellRenderer delegate, Decorator<?> decorator) { + this.delegate = delegate; + this.decorator = decorator; + } + + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + if (value != null) { + if (value instanceof String) { + value = (String) value; + } else { + value = decorator.toString(value); + } + } + return delegate.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorTableCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorTableCellRenderer.java new file mode 100644 index 0000000..aed8ab3 --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorTableCellRenderer.java @@ -0,0 +1,43 @@ +package jaxx.runtime.decorator.swing; + +import jaxx.runtime.decorator.*; +import javax.swing.JTable; +import javax.swing.table.TableCellRenderer; +import java.awt.Component; +import javax.swing.table.DefaultTableCellRenderer; + +/** + * A {@link TableCellRenderer} which compute text with the given {@link #decorator} + * and leave the hand to the {@link #delegate} to perform the visual renderer. + * + * @author chemit + * @since 1.7.2 (was previously {@code jaxx.runtime.swing.DecoratorTableCellRenderer}). + */ +public class DecoratorTableCellRenderer implements TableCellRenderer { + + /** + * Delegate cell renderer + */ + protected TableCellRenderer delegate; + /** + * Decorator to produce text to render + */ + protected Decorator<?> decorator; + + public DecoratorTableCellRenderer(Decorator<?> decorator) { + this(new DefaultTableCellRenderer(), decorator); + } + + public DecoratorTableCellRenderer(TableCellRenderer delegate, Decorator<?> decorator) { + this.delegate = delegate; + this.decorator = decorator; + } + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasfocus, int row, int column) { + if (value != null) { + value = decorator.toString(value); + } + return delegate.getTableCellRendererComponent(table, value, isSelected, hasfocus, row, column); + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeContextHelper.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeContextHelper.java new file mode 100644 index 0000000..4ab55b1 --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeContextHelper.java @@ -0,0 +1,150 @@ +package jaxx.runtime.swing.tree; + +import javax.swing.JTree; +import jaxx.runtime.JAXXContext; +import jaxx.runtime.JAXXContextEntryDef; + +/** + * To help getting and setting navigation tree objects from a {@link JAXXContext}. + * <p/> + * There is six types of data which can be hold in a context : + * <ul> + * <li>tree : the tree </li> + * <li>tree model : the navigation tree model</li> + * <li>tree handler : the navigation tree handler</li> + * <li>selected path : the navigation path of the selected node</li> + * <li>selected node : the selected node</li> + * <li>selected bean : the selected bean</li> + * </ul> + * + * To make possible the use of more than one navigation tree system in a same + * context, we <b>MUST</b> distinguish the context entries definition. For this + * purpose, entries definition are normalized and prefixed by a unique {@link #prefix}. + * <p/> + * Here is the keys mapping : + * <ul> + * <li>tree : {@code prefix + "-tree"}</li> + * <li>tree model : {@code prefix + "-tree-model"}</li> + * <li>tree handler : {@code prefix + "-tree-handler"}</li> + * <li>selected path : {@code prefix + "-selected-path"}</li> + * <li>selected node : {@code prefix + "-selected-node"}</li> + * <li>selected bean : {@code prefix + "-selected-bean"}</li> + * </ul> + * + * @author chemit + * @since 1.7.2 + */ +public class NavigationTreeContextHelper { + + protected final String prefix; + protected JAXXContextEntryDef<String> selectedPathContextEntry; + protected JAXXContextEntryDef<Object> selectedBeanContextEntry; + protected JAXXContextEntryDef<NavigationTreeNode> selectedNodeContextEntry; + protected JAXXContextEntryDef<NavigationTreeModel> treeModelContextEntry; + protected JAXXContextEntryDef<NavigationTreeHandler> treeHandlerContextEntry; + protected JAXXContextEntryDef<JTree> treeContextEntry; + + public NavigationTreeContextHelper(String prefix) { + this.prefix = prefix; + treeContextEntry = JAXXContextEntryDef.newDef(prefix + "-tree", JTree.class); + treeModelContextEntry = JAXXContextEntryDef.newDef(prefix + "-tree-model", NavigationTreeModel.class); + treeHandlerContextEntry = JAXXContextEntryDef.newDef(prefix + "-tree-handler", NavigationTreeHandler.class); + selectedBeanContextEntry = JAXXContextEntryDef.newDef(prefix + "-selected-bean", Object.class); + selectedNodeContextEntry = JAXXContextEntryDef.newDef(prefix + "-selected-node", NavigationTreeNode.class); + selectedPathContextEntry = JAXXContextEntryDef.newDef(prefix + "-selected-path", String.class); + } + + public String getPrefix() { + return prefix; + } + + public JTree getTree(JAXXContext context) { + JTree r = getTreeContextEntry().getContextValue(context); + return r; + } + + public NavigationTreeModel getTreeModel(JAXXContext context) { + NavigationTreeModel r = getTreeModelContextEntry().getContextValue(context); + return r; + } + + public NavigationTreeHandler getTreeHandler(JAXXContext context) { + NavigationTreeHandler r = getTreeHandlerContextEntry().getContextValue(context); + return r; + } + + public String getSelectedPath(JAXXContext context) { + String r = getSelectedPathContextEntry().getContextValue(context); + return r; + } + + public NavigationTreeNode getSelectedNode(JAXXContext context) { + NavigationTreeNode r = getSelectedNodeContextEntry().getContextValue(context); + return r; + } + + public Object getSelectedBean(JAXXContext context) { + Object r = getSelectedBeanContextEntry().getContextValue(context); + return r; + } + + public void setTreeModel(JAXXContext context, NavigationTreeModel model) { + getTreeModelContextEntry().setContextValue(context, model); + } + + public void setTree(JAXXContext context, JTree tree) { + getTreeContextEntry().setContextValue(context, tree); + } + + public void setTreeHandler(JAXXContext context, NavigationTreeHandler handler) { + getTreeHandlerContextEntry().setContextValue(context, handler); + } + + public void setSelectedPath(JAXXContext context, String path) { + if (path == null) { + getSelectedPathContextEntry().removeContextValue(context); + } else { + getSelectedPathContextEntry().setContextValue(context, path); + } + } + + public void setSelectedNode(JAXXContext context, NavigationTreeNode node) { + if (node == null) { + getSelectedNodeContextEntry().removeContextValue(context); + } else { + getSelectedNodeContextEntry().setContextValue(context, node); + } + } + + public void setSelectedBean(JAXXContext context, Object bean) { + if (bean == null) { + getSelectedBeanContextEntry().removeContextValue(context); + } else { + getSelectedBeanContextEntry().setContextValue(context, bean); + } + } + + protected JAXXContextEntryDef<NavigationTreeModel> getTreeModelContextEntry() { + return treeModelContextEntry; + } + + protected JAXXContextEntryDef<NavigationTreeHandler> getTreeHandlerContextEntry() { + return treeHandlerContextEntry; + } + + protected JAXXContextEntryDef<Object> getSelectedBeanContextEntry() { + return selectedBeanContextEntry; + } + + protected JAXXContextEntryDef<NavigationTreeNode> getSelectedNodeContextEntry() { + return selectedNodeContextEntry; + } + + protected JAXXContextEntryDef<String> getSelectedPathContextEntry() { + return selectedPathContextEntry; + } + + protected JAXXContextEntryDef<JTree> getTreeContextEntry() { + return treeContextEntry; + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeHandler.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeHandler.java new file mode 100644 index 0000000..5d7e099 --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeHandler.java @@ -0,0 +1,275 @@ +package jaxx.runtime.swing.tree; + +import java.awt.Component; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultTreeSelectionModel; +import javax.swing.tree.TreePath; +import jaxx.runtime.JAXXAction; +import jaxx.runtime.JAXXContext; +import jaxx.runtime.JAXXInitialContext; +import jaxx.runtime.JAXXObject; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * The handler of a navigation tree. + * + * This is also the selection model to use, since we must check before moving + * from a node we can not just listen selection model changed, we must control + * it. + * + * @author tony + * @since 1.7.2 + */ +public abstract class NavigationTreeHandler extends DefaultTreeSelectionModel { + + private static final long serialVersionUID = 1L; + /** + * Logger + */ + static private final Log log = LogFactory.getLog(NavigationTreeHandler.class); + + /** + * Strategy of instanciation of ui. + * <p/> + * For a given {@code node}, the method {@link #getId(NavigationTreeNode)} + * returns the id of ui to use. + */ + public enum Strategy { + + /** + * instanciate a ui for a node + */ + PER_NODE { + + @Override + public String getId(NavigationTreeNode node) { + return node.getFullPath(); + } + }, + /** + * instanciate only one a ui for a type,nodes will share the instanciation + */ + PER_UI_TYPE { + + @Override + public String getId(NavigationTreeNode node) { + return node.getUIClass().getName(); + } + }; + + public abstract String getId(NavigationTreeNode node); + } + /** + * UI which contains navigation tree + */ + protected JAXXContext context; + /** + * UI Instanciation strategy + */ + protected Strategy strategy; + /** + * JAXXContext access helper. + * + * @since 1.7.2 + */ + protected NavigationTreeContextHelper contextHelper; + + protected NavigationTreeHandler(String contextPrefix, JAXXObject context, Strategy strategy) { + this.contextHelper = new NavigationTreeContextHelper(contextPrefix); + this.context = context; + this.strategy = strategy; + addTreeSelectionListener(new TreeSelectionListener() { + + @Override + public void valueChanged(TreeSelectionEvent event) { + if (event.getOldLeadSelectionPath() != null && event.getOldLeadSelectionPath().equals(event.getPath())) { + // do not treate this if no path changed + return; + } + NavigationTreeNode node = (NavigationTreeNode) event.getPath().getLastPathComponent(); + selectNodeUI(node); + } + }); + } + + /** + * @return le modèle de navigation associé + */ + protected abstract NavigationTreeModel getNavigationTreeModel(); + + /** + * @return le composent actuellement visible associé au noeud courant ou + * au noeud précédent lors d'un changement de noeud. + */ + protected abstract Component getCurrentUI(); + + /** + * @param node le noeud associé à l'ui à retrouver + * @return l'ui associé au novueau noeud sélectionné + */ + protected abstract Component getUI(NavigationTreeNode node); + + /** + * @param component le composent actuellement visible + * @return <code>true</code> si le composent a bien été fermé, <code>false</code> sinon + * @throws Exception if any + */ + protected abstract boolean closeUI(Component component) throws Exception; + + /** + * Instancie une nouvelle ui associé à un noeud de l'arbre de navigation + * + * @param node le noeud associé à l'ui à créer + * @return la nouvelle ui associée au noeud + * @throws Exception if any + */ + protected abstract Component createUI(NavigationTreeNode node) throws Exception; + + /** + * Ouvre l'ui associée au noeud sélectionné dans l'arbre de navigation. + * + * @param newUI l'ui associé au noeud sélectionné à ouvrir + * @param node le node de l'ui a ouvrir + * @throws Exception if any + */ + protected abstract void openUI(Component newUI, NavigationTreeNode node) throws Exception; + + /** + * Traitement des exceptions. + * + * @param e l'erreur recontrée (ou null si pas d"erreur) + */ + protected abstract void treateError(Exception e); + + public JAXXContext getContext() { + return context; + } + + public NavigationTreeContextHelper getContextHelper() { + return contextHelper; + } + + @Override + public void setSelectionPath(TreePath path) { + if (path.equals(getSelectionPath())) { + // stay on same node, can skip + if (log.isDebugEnabled()) { + log.debug("skip stay on path " + path); + } + return; + } + Component component = getCurrentUI(); + + try { + if (!closeUI(component)) { + if (log.isDebugEnabled()) { + log.debug("changing node canceled!"); + } + // can not changed current node + return; + } + } catch (Exception ex) { + treateError(ex); + return; + } + if (log.isDebugEnabled()) { + log.debug("will select path " + path); + } + // ok can safely select the new path + super.setSelectionPath(path); + } + + protected void selectNodeUI(NavigationTreeNode node) { + + try { + + String path = node.getFullPath(); + + if (log.isTraceEnabled()) { + log.trace(path); + } + + Component newUI = getUI(node); + + // now, we are free to open the ui associated with the selected node in navigation + + // get the bean associated with the node + Object data = getNavigationTreeModel().getBean(path); + + // save it in context (must be done before init ui) + addSelectedBeanInContext(node, data); + + if (newUI == null) { + + // a new ui instance is required + newUI = createUI(node); + } + + JAXXContext ctxt = getContext(); + NavigationTreeContextHelper helper = getContextHelper(); + + // save in context current node context path + helper.setSelectedPath(ctxt, node.getFullPath()); + + // save in context current node + helper.setSelectedNode(ctxt, node); + + // really open the ui associated with the selected node + openUI(newUI, node); + + } catch (Exception e) { + // remove data from context + + // if any error, go back to previvous node + treateError(e); + } + } + + /** + * Prepare le context a utiliser pour initialiser une nouvelle ui. + * + * @param node le noeud associé à l'ui à créer + * @return le context à utiliser pour instancier l'ui + * @throws Exception if any + */ + protected JAXXContext createUIContext(NavigationTreeNode node) throws Exception { + + if (node.getUIHandlerClass() == null) { + if (log.isWarnEnabled()) { + log.warn("no action associated with ui " + node.getUIClass()); + } + // no action associated, just + return getContext(); + } + + JAXXAction action = node.getUIHandlerClass().newInstance(); + + // init context with + JAXXInitialContext uiContext = action.init(getContext()); + return uiContext; + } + + protected void addSelectedBeanInContext(NavigationTreeNode node, Object data) { + + if (log.isDebugEnabled()) { + log.debug("find data for contextPath <" + node.getFullPath() + "> : " + (data == null ? null : data.getClass())); + } + JAXXContext ctxt = getContext(); + NavigationTreeContextHelper helper = getContextHelper(); + + // remove previous selected bean + //TODO-TC-20091004 should have an automatic clean context method while + // quiting a node ? + helper.setSelectedBean(ctxt, null); + + if (data != null) { + + helper.setSelectedBean(ctxt, data); + //FIXME-TC-20091004 : should really remove this, this is not context safe + //todo should we not use this to avoid conflict in context ? + //context.setContextValue(data); + } + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeHandlerWithCardLayout.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeHandlerWithCardLayout.java new file mode 100644 index 0000000..60f01c0 --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeHandlerWithCardLayout.java @@ -0,0 +1,100 @@ +package jaxx.runtime.swing.tree; + +import jaxx.runtime.JAXXContext; +import jaxx.runtime.JAXXObject; +import jaxx.runtime.swing.CardLayout2; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.swing.JPanel; +import java.awt.Component; + +/** + * Simple {@link NavigationTreeHandler} implementation with a {@link CardLayout2} to manage components to + * associated with tree's nodes. + * <p/> + * For each node, the ui associated has a constraints in a cardlayout which is the node context path. + * <p/> + * A single container managed by the cardlayout is used to display the components associated with tree's nodes. + * + * @author chemit + */ +public abstract class NavigationTreeHandlerWithCardLayout extends NavigationTreeHandler { + + /** + * Logger + */ + static private final Log log = LogFactory.getLog(NavigationTreeHandlerWithCardLayout.class); + + /** + * All components associated with a tree's node is displayed in a single container. + * + * @return the containter of components + */ + protected abstract JPanel getContentContainer(); + + /** + * the cardlayout managing components associated with tree node. The constraints + * of each component is the node contextPath. + * + * @return the layout used to display components associated with tree's nodes. + */ + protected abstract CardLayout2 getContentLayout(); + + public NavigationTreeHandlerWithCardLayout(String contextPrefix, JAXXObject context, Strategy strategy) { + super(contextPrefix, context, strategy); + if (getContentContainer() == null) { + throw new IllegalArgumentException("could not have a null 'contentContainer' in ui " + context); + } + if (getContentLayout() == null) { + throw new IllegalArgumentException("could not have a null 'contentLayout' in ui " + context); + } + } + + @Override + protected Component getCurrentUI() { + CardLayout2 layout = getContentLayout(); + JPanel container = getContentContainer(); + return layout.getVisibleComponent(container); + } + + @Override + protected Component getUI(NavigationTreeNode node) { + CardLayout2 layout = getContentLayout(); + JPanel container = getContentContainer(); + String constraints = strategy.getId(node); + return layout.contains(constraints) ? layout.getComponent(container, constraints) : null; + } + + @Override + protected void openUI(Component newUI, NavigationTreeNode node) throws Exception { + + CardLayout2 layout = getContentLayout(); + JPanel container = getContentContainer(); + // switch layout + String constraints = strategy.getId(node); + layout.show(container, constraints); + } + + @Override + protected boolean closeUI(Component component) throws Exception { + // by default, we says that component was succesfull closed + return true; + } + + @Override + protected Component createUI(NavigationTreeNode node) throws Exception { + + JAXXContext uiContext = createUIContext(node); + + JAXXObject newUI = node.getUIClass().getConstructor(JAXXContext.class).newInstance(uiContext); + + if (log.isDebugEnabled()) { + log.debug("instanciate new ui " + newUI); + } + String constraints = strategy.getId(node); + getContentContainer().add((Component) newUI, constraints); + return (Component) newUI; + } +} + diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeHelper.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeHelper.java new file mode 100644 index 0000000..aa30fac --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeHelper.java @@ -0,0 +1,141 @@ +package jaxx.runtime.swing.tree; + +import java.lang.reflect.InvocationTargetException; +import java.util.regex.Pattern; +import javax.swing.JTree; +import javax.swing.tree.TreePath; +import jaxx.runtime.JAXXContext; +import jaxx.runtime.JAXXObject; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Helper object associated to a given navigation tree system. + * + * To helper is context safe (base on a {@link NavigationTreeContextHelper}. + * + * @author chemit + * @since 1.7.2 + * @see NavigationTreeModel + */ +public abstract class NavigationTreeHelper extends NavigationTreeContextHelper { + + /** + * Logger + */ + static private final Log log = LogFactory.getLog(NavigationTreeHelper.class); + + /** + * Create the tree model. + * + * @param context the context to associate with fresh model + * @return the new model build with data from the given context + */ + public abstract NavigationTreeModel createTreeModel(JAXXContext context); + + /** + * Create the tree handler. + * + * @param context the context to associate with fresh handler + * @return the new handler + */ + public abstract NavigationTreeHandler createTreeHandler(JAXXObject context); + + public NavigationTreeHelper(String contextPrefix) { + super(contextPrefix); + } + + public Object getContextValue(JAXXContext context, String path) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException { + NavigationTreeModel treeModel = getSafeTreeModel(context); + return treeModel.getBean(path); + } + + public NavigationTreeNode findNode(JAXXContext context, String path) { + NavigationTreeModel treeModel = getSafeTreeModel(context); + return treeModel.findNode(path); + } + + public NavigationTreeNode findNode(JAXXContext context, String path, String regex) { + NavigationTreeModel treeModel = getSafeTreeModel(context); + return treeModel.findNode(path, regex); + } + + public NavigationTreeNode findNode(JAXXContext context, String path, Pattern regex) { + + NavigationTreeModel treeModel = getSafeTreeModel(context); + return treeModel.findNode(path, regex); + } + + public NavigationTreeNode findNode(JAXXContext context, String path, String regex, String suffix) { + + NavigationTreeModel treeModel = getSafeTreeModel(context); + + NavigationTreeNode navigationTreeNode = treeModel.findNode(path, regex); + if (navigationTreeNode != null && suffix != null) { + navigationTreeNode = treeModel.findNode(navigationTreeNode, suffix); + } + return navigationTreeNode; + } + + public NavigationTreeNode findNode(JAXXContext context, String path, Pattern regex, String suffix) { + + NavigationTreeModel treeModel = getSafeTreeModel(context); + + NavigationTreeNode navigationTreeNode = treeModel.findNode(path, regex); + if (navigationTreeNode != null && suffix != null) { + navigationTreeNode = treeModel.findNode(navigationTreeNode, suffix); + } + return navigationTreeNode; + } + + /** + * Sélection d'un noeud dans l'arbre de navigation à partir de son path. + * + * @param context le contexte applicatif + * @param path le path absolue du noeud dans l'arbre + */ + public void selectNode(JAXXContext context, String path) { + NavigationTreeNode node = findNode(context, path); + if (log.isDebugEnabled()) { + log.debug(path + " :: " + node); + } + if (node != null) { + selectNode(context, node); + } + } + + /** + * Sélection d'un noeud dans l'arbre de navigation. + * + * @param context le contexte applicatif + * @param node le noeud à sélectionner dans l'arbre + */ + public void selectNode(JAXXContext context, NavigationTreeNode node) { + + + NavigationTreeModel navigationModel = getSafeTreeModel(context); + if (log.isDebugEnabled()) { + log.debug(node); + } + TreePath path = new TreePath(navigationModel.getPathToRoot(node)); + JTree tree = getSafeTree(context); + tree.setSelectionPath(path); + tree.scrollPathToVisible(path); + } + + public NavigationTreeModel getSafeTreeModel(JAXXContext context) throws NullPointerException { + NavigationTreeModel treeModel = getTreeModel(context); + if (treeModel == null) { + throw new NullPointerException("could not find tree model with key " + getTreeModelContextEntry() + " in context " + context); + } + return treeModel; + } + + public JTree getSafeTree(JAXXContext context) throws NullPointerException { + JTree tree = getTree(context); + if (tree == null) { + throw new NullPointerException("could not find tree with key " + getTreeContextEntry() + " in context " + context); + } + return tree; + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeModel.java new file mode 100644 index 0000000..3094bec --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeModel.java @@ -0,0 +1,246 @@ +package jaxx.runtime.swing.tree; + +import jaxx.runtime.JAXXContext; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeNode; +import java.util.Enumeration; +import java.util.StringTokenizer; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Model of the tree used for a navigation tree. + * <p/> + * Il est composé de {@link NavigationTreeNode} + * + * @author chemit + * @since 1.7.2 + */ +public class NavigationTreeModel extends DefaultTreeModel { + + static private final long serialVersionUID = 1L; + /** + * Logger + */ + static private final Log log = LogFactory.getLog(NavigationTreeModel.class); + /** + * The path separator used to build the {@link #fullPath}. + * + * @see NavigationTreeNode#getNodePath() + * @see NavigationTreeNode#getFullPath() + */ + protected final String pathSeparator; + /** + * Context to retrieve beans + */ + private JAXXContext context; + + public NavigationTreeModel(String pathSeparator, JAXXContext context) { + super(null); + this.pathSeparator = pathSeparator; + this.context = context; + } + + @Override + public NavigationTreeNode getRoot() { + return (NavigationTreeNode) super.getRoot(); + } + + /** + * Search from the root node a node named by his fully path (concatenation of nodes + * {@link NavigationTreeNode#navigationPath} valued separated by dot. + * <p/> + * Example : + * <p/> + * <pre>$root.child1.leaf1</pre> + * + * @param path the fully path of the searched node. + * @return the node matching the fully context from the root node, or <code>null</code> if not find. + */ + public NavigationTreeNode findNode(String path) { + return findNode(getRoot(), path, (Pattern) null); + } + + /** + * Apply first the regex pattern to obtain the searched node fi the given <code>regex</code> is not null. + * <p/> + * Search then from the root node a node named by his fully path (concatenation of nodes + * {@link NavigationTreeNode#navigationPath} valued separated by {@link #pathSeparator}. + * <p/> + * <p/> + * Example : + * <p/> + * <pre>$root.child1.leaf1</pre> + * + * @param path the fully path of the searched node. + * @param regex a optional regex to apply to path before searching + * @return the node matching the fully context from the root node, or <code>null</code> if not found. + */ + public NavigationTreeNode findNode(String path, String regex) { + return findNode(getRoot(), path, regex); + } + + /** + * Apply first the regex pattern to obtain the searched node. + * <p/> + * Search then from the root node a node named by his fully path (concatenation of nodes + * {@link NavigationTreeNode#navigationPath} valued separated by {@link #pathSeparator}. + * <p/> + * Example : + * <p/> + * <pre>$root.child1.leaf1</pre> + * + * @param path the fully path of the searched node. + * @param regex a optional regex to apply to path before searching + * @return the node matching the fully context from the root node, or <code>null</code> if not found. + */ + public NavigationTreeNode findNode(String path, Pattern regex) { + return findNode(getRoot(), path, regex); + } + + /** + * Search from a given root node a node named by his fully path (concatenation of nodes + * {@link NavigationTreeNode#navigationPath} valued separated by {@link #pathSeparator}. + * + * @param root root node to be used + * @param path the fully path of the searched node. + * @return the node matching the fully context from the given root node, or <code>null</code> if not found. + */ + public NavigationTreeNode findNode(NavigationTreeNode root, String path) { + return findNode(root, path, (Pattern) null); + } + + /** + * Apply first the regex pattern to obtain the searched node. + * <p/> + * Search then from a given root node a node named by his fully path (concatenation of nodes) + * {@link NavigationTreeNode#navigationPath} valued separated by {@link #pathSeparator}. + * + * @param root root node to be used + * @param path the fully path of the searched node. + * @param regex a previous regex to apply to path : must have a matches + * @return the node matching the fully context from the given root node, or <code>null</code> if not found. + */ + public NavigationTreeNode findNode(NavigationTreeNode root, String path, String regex) { + return findNode(root, path, regex == null ? null : Pattern.compile(regex)); + } + + /** + * Apply first the regex pattern to obtain the searched node. + * <p/> + * Search then from a given root node a node named by his fully path (concatenation of nodes + * {@link NavigationTreeNode#path} valued separated by {@link #pathSeparator}. + * + * @param root root node to be used + * @param path the fully path of the searched node. + * @param regex a previous regex to apply to path : must have a matches + * @return the node matching the fully context from the given root node, or <code>null</code> if not found. + */ + public NavigationTreeNode findNode(NavigationTreeNode root, String path, Pattern regex) { + if (regex != null) { + Matcher matcher = regex.matcher(path); + if (!matcher.matches() || matcher.groupCount() < 1) { + log.warn("no matching regex " + regex + " to " + path); + return null; + } + path = matcher.group(1); + if (log.isDebugEnabled()) { + log.debug("matching regex " + regex + " : " + path); + } + } + StringTokenizer stk = new StringTokenizer(path, pathSeparator); + NavigationTreeNode result = root; + // pas the first token (matches the root node) + if (root.isRoot() && stk.hasMoreTokens()) { + String rootPath = stk.nextToken(); + if (!rootPath.equals(root.getNodePath())) { + return null; + } + } + while (stk.hasMoreTokens()) { + result = result.getChild(stk.nextToken()); + } + return result; + } + + public JAXXContext getContext() { + return context; + } + + /** + * Obtain the associated bean value from context corresponding to node from given navigation path. + * + * @param navigationPath the current context path of the node + * @return the value associated in context with the given navigation path + */ + public Object getBean(String navigationPath) { + Object result; + NavigationTreeNode node = findNode(navigationPath, (Pattern) null); + result = getBean(node); + return result; + } + + /** + * Obtain the associated bean value from context corresponding to node + * + * @param node the current node + * @return the value associated in context with the given node. + */ + public Object getBean(NavigationTreeNode node) { + if (node == null) { + return null; + //fixme should throw a NPE exception + //throw new NullPointerException("node can not be null"); + } + return node.getBean(getContext()); + } + + @Override + public void nodeChanged(TreeNode node) { + nodeChanged(node, false); + if (log.isDebugEnabled()) { + log.debug(node); + } + } + + @Override + public void nodeStructureChanged(TreeNode node) { + NavigationTreeNode n = (NavigationTreeNode) node; + //TC-20091004 never launch a deep reload + reload(n, true); + super.nodeStructureChanged(node); + if (log.isDebugEnabled()) { + log.debug(node); + } + } + + public void nodeChanged(TreeNode node, boolean deep) { + + NavigationTreeNode n = (NavigationTreeNode) node; + //TC-20091004 never launch a deep clean, since we do a deep nodeChanged. + reload(n, deep); + super.nodeChanged(node); + } + + protected void reload(NavigationTreeNode node) { + reload(node, false); + } + + protected void reload(NavigationTreeNode node, boolean deep) { + if (node == null) { + return; + } + node.reload(getContext()); + + if (deep) { + Enumeration<?> childs = node.children(); + while (childs.hasMoreElements()) { + NavigationTreeNode o = (NavigationTreeNode) childs.nextElement(); + reload(o, true); + } + } + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeModelBuilder.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeModelBuilder.java new file mode 100644 index 0000000..1a79faa --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeModelBuilder.java @@ -0,0 +1,242 @@ +package jaxx.runtime.swing.tree; + +import java.util.Enumeration; +import jaxx.runtime.JAXXAction; +import jaxx.runtime.JAXXContext; +import jaxx.runtime.JAXXContextEntryDef; +import jaxx.runtime.JAXXObject; +import jaxx.runtime.decorator.Decorator; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * This object is design to build a {@link NavigationTreeModel}. + * + * @author chemit + * @since 17.2 + */ +public class NavigationTreeModelBuilder { + + /** + * Logger + */ + static private final Log log = LogFactory.getLog(NavigationTreeModelBuilder.class); + /** + * The model dealed by the builder. + * + * <b>Note:</b> It is a good idea to keep only one instance of the model. + * If reset is required, should empty the model but not reinstanciate it. + */ + protected NavigationTreeModel model; + /** + * default ui class to use if node does not define an ui class + */ + protected Class<? extends JAXXObject> defaultUIClass; + /** + * [optional] default action class + */ + protected Class<? extends JAXXAction> defaultUIHandlerClass; + + public NavigationTreeModelBuilder(String pathSeparator, JAXXContext context, Class<? extends JAXXObject> defaultUIClass, Class<? extends JAXXAction> defaultUIHandlerClass) { + this(defaultUIClass, defaultUIHandlerClass, new NavigationTreeModel(pathSeparator, context)); + } + + public NavigationTreeModelBuilder(Class<? extends JAXXObject> defaultUIClass, Class<? extends JAXXAction> defaultUIHandlerClass, NavigationTreeModel model) { + this.defaultUIClass = defaultUIClass; + this.defaultUIHandlerClass = defaultUIHandlerClass; + this.model = model; + } + + public NavigationTreeModel getModel() { + return model; + } + + public NavigationTreeNode buildEmptyRoot(JAXXContextEntryDef<?> entryDef, String contextName) { + NavigationTreeNode node = new NavigationTreeNode(model.pathSeparator, contextName, entryDef, null); + addI18nNodeRenderer(node, ""); + return addChildNode(null, node); + } + + public NavigationTreeNode build(NavigationTreeNode parentNode, String libelle, + JAXXContextEntryDef<?> entryDef, + String entryPath, + String contextName, + Class<? extends JAXXObject> uiClass, + Class<? extends JAXXAction> actionClass) { + NavigationTreeNode node = new NavigationTreeNode(model.pathSeparator, contextName, entryDef, entryPath); + addI18nNodeRenderer(node, libelle); + addNodeJaxxClasses(node, uiClass, actionClass); + return addChildNode(parentNode, node); + } + + public NavigationTreeNode build(NavigationTreeNode parentNode, String libelle, + JAXXContextEntryDef<?> entryDef, + String contextName, + Class<? extends JAXXObject> uiClass, + Class<? extends JAXXAction> actionClass) { + NavigationTreeNode node = new NavigationTreeNode(model.pathSeparator, contextName, entryDef); + addI18nNodeRenderer(node, libelle); + addNodeJaxxClasses(node, uiClass, actionClass); + return addChildNode(parentNode, node); + } + + public NavigationTreeNode build(NavigationTreeNode parentNode, String libelle, + String entryPath, + String contextName, + Class<? extends JAXXObject> uiClass, + Class<? extends JAXXAction> actionClass) { + NavigationTreeNode node = new NavigationTreeNode(model.pathSeparator, contextName, entryPath); + addI18nNodeRenderer(node, libelle); + addNodeJaxxClasses(node, uiClass, actionClass); + return addChildNode(parentNode, node); + } + + public NavigationTreeNode build(NavigationTreeNode parentNode, Decorator<?> decorator, + JAXXContextEntryDef<?> entryDef, + String entryPath, + String contextName, + Class<? extends JAXXObject> uiClass, + Class<? extends JAXXAction> actionClass) { + NavigationTreeNode node = new NavigationTreeNode(model.pathSeparator, contextName, entryDef, entryPath); + addDecoratorNodeRenderer(node, decorator); + addNodeJaxxClasses(node, uiClass, actionClass); + return addChildNode(parentNode, node); + } + + public NavigationTreeNode build(NavigationTreeNode parentNode, Decorator<?> decorator, + JAXXContextEntryDef<?> entryDef, + String contextName, + Class<? extends JAXXObject> uiClass, + Class<? extends JAXXAction> actionClass) { + NavigationTreeNode node = new NavigationTreeNode(model.pathSeparator, contextName, entryDef); + addDecoratorNodeRenderer(node, decorator); + addNodeJaxxClasses(node, uiClass, actionClass); + return addChildNode(parentNode, node); + } + + public NavigationTreeNode build(NavigationTreeNode parentNode, Decorator<?> decorator, + String entryPath, + String contextName, + Class<? extends JAXXObject> uiClass, + Class<? extends JAXXAction> actionClass) { + NavigationTreeNode node = new NavigationTreeNode(model.pathSeparator, contextName, null, entryPath); + addDecoratorNodeRenderer(node, decorator); + addNodeJaxxClasses(node, uiClass, actionClass); + return addChildNode(parentNode, node); + } + + protected NavigationTreeNode addChildNode(NavigationTreeNode parentNode, NavigationTreeNode node) { + + if (node.getUIClass() == null) { + // no ui is associated with this node, use the default one + node.setUIClass(defaultUIClass); + } + + if (node.getUIHandlerClass() == null) { + // no ui handler associated with this node, use the default one + node.setUIHandlerClass(defaultUIHandlerClass); + } + if (parentNode == null) { + model.setRoot(node); + } else { + parentNode.add(node); + } + model.nodeStructureChanged(parentNode); + return node; + } + + public NavigationTreeNode removeChildNode(NavigationTreeNode node) { + NavigationTreeNode parentNode = node.getParent(); + model.removeNodeFromParent(node); + return parentNode; + } + + public void addI18nNodeRenderer(NavigationTreeNode node, String libelle) { + node.setRenderer(new NavigationTreeNodeRendererI18nImpl(libelle)); + } + + public void addDecoratorNodeRenderer(NavigationTreeNode node, Decorator<?> decorator) { + node.setRenderer(new NavigationTreeNodeRendererDecoratorImpl(decorator)); + } + + public void addNodeJaxxClasses( + NavigationTreeNode node, + Class<? extends JAXXObject> uIClass, + Class<? extends JAXXAction> uIHandlerClass) { + node.setUIClass(uIClass); + node.setUIHandlerClass(uIHandlerClass); + } + + public void printModel(NavigationTreeNode node) { + if (node == null) { + return; + } + log.info("node " + node.getFullPath() + ", jxpath: " + node.getJaxxContextEntryPath() + ", entryContextDef: " + node.getJaxxContextEntryDef()); + if (log.isDebugEnabled()) { + log.debug("node userObject" + node.getUserObject()); + log.debug("value from node " + node.getBean(getModel().getContext())); + log.debug("value from model " + getModel().getBean(node)); + } + Enumeration<?> children = node.children(); + while (children.hasMoreElements()) { + printModel((NavigationTreeNode) children.nextElement()); + } + } + + public static abstract class ChildBuilder<O> { + + protected NavigationTreeModelBuilder builder; + + protected ChildBuilder(NavigationTreeModelBuilder builder) { + this.builder = builder; + } + + protected abstract void init(Class<? extends O> klass); + + protected abstract Decorator<? extends O> getDecorator(O child); + + protected abstract String getJXPath(O child); + + protected abstract String getNavigationPath(O child); + + public void build(NavigationTreeNode parent, boolean cacheValues, Class<? extends O> klass, java.util.Collection<? extends O> beans, Class<? extends JAXXObject> ui, Class<? extends JAXXAction> actionClass) { + + if (beans == null || beans.isEmpty()) { + // no bean to treate + return; + } + + init(klass); + + NavigationTreeNode node; + + for (O o : beans) { + node = builder.build(parent, getDecorator(o), getJXPath(o), getNavigationPath(o), ui, actionClass); + if (cacheValues) { + // cache the bean value to improve performance + node.setBean(o); + } + } + } + + public void build(NavigationTreeNode parent, boolean cacheValues, Class<? extends O> klass, O[] beans, Class<? extends JAXXObject> ui, Class<? extends JAXXAction> actionClass) { + + if (beans == null || beans.length == 0) { + // no bean to treate + return; + } + + init(klass); + + NavigationTreeNode node; + + for (O o : beans) { + node = builder.build(parent, getDecorator(o), getJXPath(o), getNavigationPath(o), ui, actionClass); + if (cacheValues) { + // cache the bean value to improve performance + node.setBean(o); + } + } + } + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNode.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNode.java new file mode 100644 index 0000000..bc440fb --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNode.java @@ -0,0 +1,424 @@ +package jaxx.runtime.swing.tree; + +import java.util.Enumeration; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreeNode; +import jaxx.runtime.JAXXAction; +import jaxx.runtime.JAXXContext; +import jaxx.runtime.JAXXContextEntryDef; +import jaxx.runtime.JAXXObject; +import org.apache.commons.jxpath.JXPathContext; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Node of the {@link NavigationTreeModel}. + * + * Each node is associated with : + * <ul> + * <li> a {@code bean} coming from a {@link JAXXContext} </li> + * <li> a {@code uiClass} to build the associated ui </li> + * </ul> + * <p/> + * To retrieve the bean from the context, there is a huge logic in the + * method {@link #getBean(JAXXContext)}. + * + * In few words, if the {@link #jaxxContextEntryDef} is defined, it means + * that the object is taken from the {@code context}. + * <p/> + * Otherwise, find the first ancestor with an context entry and retrieve from + * here the bean. + * <p/> + * Then go down to the initial node by applying the jxpath expressions + * {@link #jaxxContextEntryPath} of each node on road back. + * <p/> + * + * To identify easly a node, each node has a {@link #path} and a + * {@link #fullPath} (full path from root node). + * <p/> + * + * To display the node we use a {@link NavigationTreeNodeRenderer} which is in + * fact the {@link #userObject}, the object can be synch with the bean via the + * {@link NavigationTreeNodeRenderer#reload(java.lang.Object)} method. + * + * @author chemit + * @see NavigationTreeModel + * @see NavigationTreeNodeRenderer + * @since 1.7.2 + */ +public class NavigationTreeNode extends DefaultMutableTreeNode { + + private static final long serialVersionUID = 1L; + /** + * Logger + */ + static private final Log log = LogFactory.getLog(NavigationTreeNode.class); + /** + * The path separator used to build the {@link #fullPath}. + * + * @see #path + * @see #fullPath + */ + protected final String pathSeparator; + /** + * The node path. + * <p/> + * Used to build the {@link #fullPath} which gives a unique identifier of the + * node. + * @see #pathSeparator + * @see #fullPath + */ + protected String path; + /** + * The full path for the node from the rood node. + * <p/> + * This path is build by appending nodes {@link #path} from the root node + * to this node, between each path we introduce the {@link #pathSeparator}. + * <p> + * Exemple : + * <pre> + * root + * $root + * `-- child1 + * `-- child2 + * </pre> + * will given {@code $root/child1/child2}. + * @see #pathSeparator + * @see #path + */ + protected String fullPath; + /** + * The UI class associated with the node. + * <p/> + * This class can be {@code null}, in that case, the + * {@link NavigationTreeModelBuilder#defaultUIClass} will be used while + * building the model. + */ + protected Class<? extends JAXXObject> uIClass; + /** + * The UI handler class associated with the node. + * <p/> + * This class can be {@code null}, in that case, the + * {@link NavigationTreeModelBuilder#defaultUIHandlerClass} will be used + * while building the model. + */ + protected Class<? extends JAXXAction> uIHandlerClass; + /** + * The context entry definition to retrieve the bean. + * + * <b>Note:</b> If not set - the {@code bean} will be retrieve on a ancestor + * node. + */ + protected JAXXContextEntryDef<?> jaxxContextEntryDef; + /** + * The jxPath to process to obtain real {@code bean} from the data retrieve + * in the context. + * + * <b>Note:</b> If not set -no jxpath will be apply on the bean from context. + */ + protected String jaxxContextEntryPath; + /** + * The bean associated with the node ( the value can be obtain via the + * method {@link #getBean(JAXXContext)} or directly set via method + * {@link #setBean(Object)}. + * <p/> + * cache of bean associated with bean to improve performance + */ + protected transient Object bean; + /** + * The type of the related bean associated with the node. + * <p/> + * Note: This type is here to override the NodeRenderer internalClass, since + * we could need to override this data. + * <p/> + * If this property is let to null, then we will use the NodeRenderer one + */ + protected Class<?> internalClass; + + public NavigationTreeNode(String pathSeparator, String navigationPath, Object jaxxContextEntryDef) { + super(); + this.pathSeparator = pathSeparator; + this.path = navigationPath; + if (jaxxContextEntryDef instanceof JAXXContextEntryDef<?>) { + this.jaxxContextEntryDef = ((JAXXContextEntryDef<?>) jaxxContextEntryDef); + } else if (jaxxContextEntryDef instanceof String) { + this.jaxxContextEntryPath = (String) jaxxContextEntryDef; + } else if (jaxxContextEntryDef != null) { + // wrong context definition type + throw new IllegalArgumentException("to define a context link, must be a String (jxpath) or a " + JAXXContextEntryDef.class + ", but was " + jaxxContextEntryDef); + } + } + + public NavigationTreeNode(String pathSeparator, String navigationPath, JAXXContextEntryDef<?> jaxxContextEntryDef, String jaxxContextEntryPath) { + super(); + this.pathSeparator = pathSeparator; + this.path = navigationPath; + this.jaxxContextEntryDef = jaxxContextEntryDef; + this.jaxxContextEntryPath = jaxxContextEntryPath; + } + + /** + * + * @return the text node renderer (store in {@link #userObject} property. + */ + public NavigationTreeNodeRenderer getRenderer() { + NavigationTreeNodeRenderer render = null; + Object o = getUserObject(); + if (o != null && o instanceof NavigationTreeNodeRenderer) { + render = (NavigationTreeNodeRenderer) o; + } + return render; + } + + public void setRenderer(NavigationTreeNodeRenderer renderer) { + // clear all cache + bean = null; + setUserObject(renderer); + } + + public String getPathSeparator() { + return pathSeparator; + } + + public String getNodePath() { + return path; + } + + public void setNodePath(String navigationPath) { + this.path = navigationPath; + } + + public Class<? extends JAXXObject> getUIClass() { + return uIClass; + } + + public void setUIClass(Class<? extends JAXXObject> uIClass) { + this.uIClass = uIClass; + } + + public void setInternalClass(Class<?> internalClass) { + this.internalClass = internalClass; + } + + public Class<? extends JAXXAction> getUIHandlerClass() { + return uIHandlerClass; + } + + public void setUIHandlerClass(Class<? extends JAXXAction> uIHandlerClass) { + this.uIHandlerClass = uIHandlerClass; + } + + public JAXXContextEntryDef<?> getJaxxContextEntryDef() { + return jaxxContextEntryDef; + } + + public void setJaxxContextEntryDef(JAXXContextEntryDef<?> jaxxContextEntryDef) { + this.jaxxContextEntryDef = jaxxContextEntryDef; + } + + public String getJaxxContextEntryPath() { + return jaxxContextEntryPath; + } + + public void setJaxxContextEntryPath(String jaxxContextEntryPath) { + this.jaxxContextEntryPath = jaxxContextEntryPath; + } + + public Class<?> getInternalClass() { + if (internalClass == null && getRenderer() != null) { + return getRenderer().getInternalClass(); + } + return internalClass; + } + + /** @return the fully context path of the node from the root node to this. */ + public String getFullPath() { + if (fullPath == null) { + StringBuilder sb = new StringBuilder(); + for (TreeNode treeNode : getPath()) { + NavigationTreeNode myNode = (NavigationTreeNode) treeNode; + sb.append(pathSeparator).append(myNode.getNodePath()); + } + fullPath = sb.substring(1); + } + return fullPath; + } + + @Override + public NavigationTreeNode getChildAt(int index) { + return (NavigationTreeNode) super.getChildAt(index); + } + + @Override + public NavigationTreeNode getParent() { + return (NavigationTreeNode) super.getParent(); + } + + /** + * @param path the name of the {@link #path} to be matched in the cild of this node. + * @return the child of this node with given {@link # path} value. + */ + public NavigationTreeNode getChild(String path) { + Enumeration<?> childs = children(); + while (childs.hasMoreElements()) { + NavigationTreeNode son = (NavigationTreeNode) childs.nextElement(); + if (path.equals(son.getNodePath())) { + return son; + } + } + return null; + } + + public Object getBean() { + return bean; + } + + public void setBean(Object bean) { + this.bean = bean; + } + + public void reload(JAXXContext context) { + + // clear bean cache + bean = null; + + // clear context navigation cache + fullPath = null; + + NavigationTreeNodeRenderer renderer = getRenderer(); + if (renderer == null) { + // this can't be ! + throw new NullPointerException("could not find the renderer for node " + this); + } + + Object b = getBean(context); + + renderer.reload(b); + } + + /** + * Obtain the associated bean value from context corresponding to node + * + * @param context the context to seek + * @return the value associated in context with the given context path + */ + public Object getBean(JAXXContext context) { + if (bean != null) { + // use cached bean + return bean; + } + Object result; + if (getJaxxContextEntryDef() != null && jaxxContextEntryPath == null) { + // the node maps directly a value in context, with no jxpath resolving + result = getJaxxContextEntryDef().getContextValue(context); + // save in cache + setBean(result); + return result; + } + // find the first ancestor node with a context def + NavigationTreeNode parentNode = getFirstAncestorWithDef(); + if (parentNode == null) { + log.warn("could not find a ancestor node with a definition of a context entry from node (" + this + ")"); + // todo must be an error + // no parent found + return null; + } + Object parentBean = parentNode.getJaxxContextEntryDef().getContextValue(context); + if (parentBean == null) { + // must be an error no bean found + log.warn("could not find a bean attached in context from context entry definition " + parentNode.getJaxxContextEntryDef()); + return null; + } + if (parentNode.jaxxContextEntryPath != null) { + // apply the jxpath on parentBean + JXPathContext jxcontext = JXPathContext.newContext(parentBean); + parentBean = jxcontext.getValue(parentNode.jaxxContextEntryPath); + } + // save in cache + parentNode.setBean(parentBean); + if (this == parentNode) { + // current node is the node matching the context entry value and no jxpath is found + return parentBean; + } + if (jaxxContextEntryPath == null) { + // todo must be an error + log.warn("must find a jaxxContextEntryPath on node (" + this + ")"); + return null; + } + String jxpathExpression = computeJXPath(jaxxContextEntryPath, parentNode); + if (jxpathExpression == null) { + /// todo must be an error + log.warn("could not build jxpath from node " + parentNode + " to " + this); + // could not retreave the jxpath... + return null; + } + if (jxpathExpression.startsWith("[")) { + // special case when we want to access a collection + jxpathExpression = '.' + jxpathExpression; + } + if (log.isDebugEnabled()) { + log.debug("jxpath : " + jxpathExpression); + } + JXPathContext jxcontext = JXPathContext.newContext(parentBean); + result = jxcontext.getValue(jxpathExpression); + // save in cache + setBean(result); + return result; + } + + /** + * @return the first ancestor with a none null {@link #jaxxContextEntryDef} + * or <code>null</code> if none find.. + */ + protected NavigationTreeNode getFirstAncestorWithDef() { + if (jaxxContextEntryDef != null) { + // find a node with a direct link with the context + return this; + } + // the node is not linked to context + // seek in his parent + NavigationTreeNode ancestor = getParent(); + return ancestor == null ? null : ancestor.getFirstAncestorWithDef(); + } + + protected String computeJXPath(String expr, NavigationTreeNode parentNode) { + if (parentNode == this) { + // reach the parent limit node, return the expr computed + return expr; + } + int firstIndex = expr.indexOf(".."); + int lastIndex = expr.lastIndexOf(".."); + if (firstIndex == -1) { + // this is a error, since current node is not parent limit node, + // we must find somewhere a way to go up in nodes + throw new IllegalArgumentException(expr + " should contains at least one \"..\""); + } + if (firstIndex != 0) { + // this is a error, the ../ must be at the beginning of the expression + throw new IllegalArgumentException("\"..\" must be at the beginning but was : " + expr); + } + NavigationTreeNode ancestor = getParent(); + if (firstIndex == lastIndex) { + // found only one go up, so must be substitute by the parent node context + String newExpr = expr.substring(2); + //String newExpr = expr.substring(expr.startsWith("../") ? 3 : 2); + if (getParent().equals(parentNode)) { + // parent node is the final parent node, so no substitution needed + return newExpr; + } + // ancestor must have a jaxxContextEntryPath + if (ancestor.jaxxContextEntryPath == null) { + throw new IllegalArgumentException("with the expression " + expr + ", the ancestor node (" + ancestor + ") must have a jaxxContextEntryPath definition, but was not "); + } + newExpr = ancestor.jaxxContextEntryPath + newExpr; + return ancestor.computeJXPath(newExpr, parentNode); + } + // have more than one go up, so the ancestor node can not have a jaxxContextEntryPath + if (ancestor.jaxxContextEntryPath != null) { + throw new IllegalArgumentException("with the expression " + expr + ", the ancestor node can not have a jaxxContextEntryPath definition"); + } + // substitute the last ..[/] and delegate to ancestor + String newExpr = expr.substring(0, lastIndex - 1) + expr.substring(lastIndex + (expr.charAt(lastIndex + 3) == '/' ? 3 : 2)); + return ancestor.computeJXPath(newExpr, parentNode); + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNodeRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNodeRenderer.java new file mode 100644 index 0000000..1c8a2eb --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNodeRenderer.java @@ -0,0 +1,44 @@ +package jaxx.runtime.swing.tree; + +import javax.swing.tree.TreeCellRenderer; + +/** + * Text Renderer of a {@link NavigationTreeNode}. + * <p/> + * This object will be placed as the {@link NavigationTreeNode#userObject} of + * nodes. + * <p/> + * + * In that way, we can use the {@link #toString()} value to render the node + * without writing any {@link TreeCellRenderer}. + * <p/> + * To rebuild the renderer text of a node use the method {@link #reload(Object)} + * with the {@code bean} provides by the model for the node. + * + * @author chemit + * @since 1.7.2, replace {@code NavigationUtil#NodeRenderer} which disappear soon... + */ +public interface NavigationTreeNodeRenderer extends java.io.Serializable { + + /** + * + * @return the render value of the node + */ + @Override + String toString(); + + /** + * + * Can override the the node internal class for display purpose. + * + * @return the type of data to be displayed. + */ + Class<?> getInternalClass(); + + /** + * Reload the render value from the {@code bean} of node. + * + * @param bean the bean associated to the node to render + */ + void reload(Object bean); +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNodeRendererDecoratorImpl.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNodeRendererDecoratorImpl.java new file mode 100644 index 0000000..bb3cd20 --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNodeRendererDecoratorImpl.java @@ -0,0 +1,53 @@ +package jaxx.runtime.swing.tree; + +import jaxx.runtime.decorator.Decorator; + +/** + * Decorator Renderer of a {@link NavigationTreeNode}. + * + * Apply a {@link Decorator} to the {@code bean} associated to the node. + * + * @author chemit + * @since 1.7.2, replace {@code NavigationUtil#NodeRenderer} which disappear soon... + */ +public class NavigationTreeNodeRendererDecoratorImpl implements NavigationTreeNodeRenderer { + + private static final long serialVersionUID = -1L; + /** + * Decorator + */ + protected final Decorator<?> decorator; + /** + * internal class of representing data + */ + protected final Class<?> internalClass; + /** + * last renderered value + */ + protected String text; + + public NavigationTreeNodeRendererDecoratorImpl(Decorator<?> decorator) { + this.internalClass = decorator.getInternalClass(); + this.decorator = decorator; + } + + @Override + public String toString() { + return text; + } + + @Override + public void reload(Object bean) { + try { + text = decorator.toString(bean); + + } catch (Exception e) { + text = ""; + } + } + + @Override + public Class<?> getInternalClass() { + return internalClass; + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNodeRendererI18nImpl.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNodeRendererI18nImpl.java new file mode 100644 index 0000000..f9dc94b --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNodeRendererI18nImpl.java @@ -0,0 +1,48 @@ +package jaxx.runtime.swing.tree; + +import static org.nuiton.i18n.I18n._; + +/** + * I18n label Renderer of a {@link NavigationTreeNode}. + * + * Just apply a i18n translation on the given {@link #libelle}. + * + * @author chemit + * @since 1.7.2, replace {@code NavigationUtil#NodeRenderer} which disappear soon... + */ +public class NavigationTreeNodeRendererI18nImpl implements NavigationTreeNodeRenderer { + + private static final long serialVersionUID = -1L; + /** + * Static i18n label to render + */ + protected final String libelle; + /** + * internal class of representing data + */ + protected final Class<?> internalClass; + /** + * last renderered value + */ + protected String text; + + public NavigationTreeNodeRendererI18nImpl(String libelle) { + this.libelle = libelle; + this.internalClass = String.class; + } + + @Override + public String toString() { + return text; + } + + @Override + public void reload(Object data) { + text = _(libelle); + } + + @Override + public Class<?> getInternalClass() { + return internalClass; + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/package.html b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/package.html new file mode 100644 index 0000000..bc68ee1 --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/package.html @@ -0,0 +1,12 @@ +<html> + <body> + <h1>JAXX - tree utilities</h1> + + This package contains all the classes of the navigation tree framework. + + <p> + Replace the previous framework from package + <code>jaxx.runtime.swing.navigation</code> + </p> + </body> +</html> \ No newline at end of file diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/decorator/Data.java b/jaxx-runtime/src/test/java/jaxx/runtime/decorator/Data.java new file mode 100644 index 0000000..3c87037 --- /dev/null +++ b/jaxx-runtime/src/test/java/jaxx/runtime/decorator/Data.java @@ -0,0 +1,37 @@ +package jaxx.runtime.decorator; + +import java.util.ArrayList; +import java.util.List; + +public class Data { + + int pos; + String name; + + protected static List<Data> generate(int nb) { + List<Data> datas = new ArrayList<Data>(nb); + for (int i = 0; i < nb; i++) { + datas.add(new Data(i, "name_" + (nb - i))); + } + return datas; + } + + Data(int pos, String name) { + super(); + this.pos = pos; + this.name = name; + } + + public int getPos() { + return pos; + } + + public String getName() { + return name; + } + + @Override + public String toString() { + return "Data{pos=" + pos + ", name=\'" + name + '\'' + '}'; + } +} diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/decorator/JXPathDecoratorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/decorator/JXPathDecoratorTest.java new file mode 100644 index 0000000..370868c --- /dev/null +++ b/jaxx-runtime/src/test/java/jaxx/runtime/decorator/JXPathDecoratorTest.java @@ -0,0 +1,136 @@ +package jaxx.runtime.decorator; + +import jaxx.runtime.decorator.JXPathDecorator.Context; +import org.junit.After; +import static org.junit.Assert.assertEquals; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +/** + * @author chemit + * @since 1.7.2 (was previously {@code jaxx.runtime.JXPathDecoratorTest}). + */ +public class JXPathDecoratorTest { + + + protected JXPathDecorator<?> decorator; + protected String expected; + protected String result; + + @After + public void after() { + decorator = null; + } + + @Test(expected = NullPointerException.class) + public void testNullInternalClass() throws Exception { + decorator = DecoratorUtils.newJXPathDecorator(null, "hello"); + } + + @Test(expected = IllegalArgumentException.class) + public void testMissingRightBrace() throws Exception { + decorator = DecoratorUtils.newJXPathDecorator(Object.class, "${haha"); + } + + @Test(expected = IllegalArgumentException.class) + public void testMissingRightBrace2() throws Exception { + decorator = DecoratorUtils.newJXPathDecorator(Object.class, "${haha${hum}"); + } + + @Test + public void testNullBean() throws Exception { + decorator = DecoratorUtils.newJXPathDecorator(Object.class, "hello"); + expected = "hello"; + assertEquals(expected, decorator.getExpression()); + assertEquals(0, decorator.nbToken); + assertEquals(0, decorator.getTokens().length); + + result = decorator.toString(null); + assertEquals(null, result); + } + + @Test + public void testNoJXPath() throws Exception { + decorator = DecoratorUtils.newJXPathDecorator(Object.class, "hello"); + expected = "hello"; + assertEquals(expected, decorator.getExpression()); + assertEquals(0, decorator.nbToken); + assertEquals(0, decorator.getTokens().length); + + result = decorator.toString(this); + assertEquals(expected, result); + } + + @Test + public void testDecorator() throws Exception { + + decorator = DecoratorUtils.newJXPathDecorator(JXPathDecorator.class, "${expression}$s - ${nbToken}$d"); + assertEquals("%1$s - %2$d", decorator.getExpression()); + assertDecoratorInternal(); + + decorator = DecoratorUtils.newJXPathDecorator(JXPathDecorator.class, "${expression}${nbToken}"); + assertEquals("%1%2", decorator.getExpression()); + assertDecoratorInternal(); + + decorator = DecoratorUtils.newJXPathDecorator(JXPathDecorator.class, "before ${expression}$s - ${nbToken}$d after"); + assertEquals("before %1$s - %2$d after", decorator.getExpression()); + assertDecoratorInternal(); + + decorator = DecoratorUtils.newJXPathDecorator(JXPathDecorator.class, "before${expression}$s-${nbToken}$dafter"); + assertEquals("before%1$s-%2$dafter", decorator.getExpression()); + assertDecoratorInternal(); + } + + @Test + public void testSort() throws Exception { + + List<Data> datas = Data.generate(10); + + JXPathDecorator<Data> d = DecoratorUtils.newJXPathDecorator(Data.class, "${pos}$d ${name}$s"); + + List<Data> sortData = new ArrayList<Data>(datas); + DecoratorUtils.sort(d, sortData, 0); + for (int i = 0; i < datas.size(); i++) { + Data data = datas.get(i); + Data sData = sortData.get(i); + assertEquals(data, sData); + } + Collections.sort(datas, new Comparator<Data>() { + @Override + public int compare(Data o1, Data o2) { + return o1.name.compareTo(o2.name); + } + }); + Context<Data> context = d.context; + context.setComparator(null); + DecoratorUtils.sort(d, sortData, 1); + for (int i = 0; i < datas.size(); i++) { + Data data = datas.get(i); + Data sData = sortData.get(i); + assertEquals(data, sData); + } + } + + + public void assertDecoratorInternal(String... tokens) { + assertTokens(tokens); + expected = String.format(decorator.getExpression(), decorator.getExpression(), decorator.getNbToken()); + result = decorator.toString(decorator); + assertEquals(expected, result); + } + + private void assertTokens(String... tokens) { + if (tokens.length == 0) { + tokens = new String[]{"expression", "nbToken"}; + } + assertEquals(2, decorator.nbToken); + assertEquals(2, decorator.getTokens().length); + assertEquals(tokens[0], decorator.getTokens()[0]); + assertEquals(tokens[1], decorator.getTokens()[1]); + } + +} diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/decorator/MultiJXPathDecoratorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/decorator/MultiJXPathDecoratorTest.java new file mode 100644 index 0000000..4185b41 --- /dev/null +++ b/jaxx-runtime/src/test/java/jaxx/runtime/decorator/MultiJXPathDecoratorTest.java @@ -0,0 +1,185 @@ +package jaxx.runtime.decorator; + +import org.junit.After; +import static org.junit.Assert.assertEquals; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +/** + * @author chemit + * @since 1.7.2 (was previously {@code jaxx.runtime.MultiJXPathDecoratorTest}). + */ +public class MultiJXPathDecoratorTest { + + protected MultiJXPathDecorator<?> decorator; + protected String expected; + protected String result; + + @After + public void after() { + decorator = null; + } + + @Test(expected = NullPointerException.class) + public void testNullInternalClass() throws Exception { + decorator = DecoratorUtils.newMultiJXPathDecorator(null, "hello", "#"); + } + + @Test(expected = IllegalArgumentException.class) + public void testMissingRightBrace() throws Exception { + decorator = DecoratorUtils.newMultiJXPathDecorator(Object.class, "${haha", "#"); + } + + @Test(expected = IllegalArgumentException.class) + public void testMissingRightBrace2() throws Exception { + decorator = DecoratorUtils.newMultiJXPathDecorator(Object.class, "${haha${hum}", "#"); + } + + @Test + public void testNullBean() throws Exception { + decorator = DecoratorUtils.newMultiJXPathDecorator(Object.class, "hello", ""); + expected = "hello"; + assertEquals(expected, decorator.getExpression()); + assertEquals(0, decorator.nbToken); + assertEquals(0, decorator.getTokens().length); + + result = decorator.toString(null); + assertEquals(null, result); + } + + @Test + public void testMultiDecorator() throws Exception { + + decorator = DecoratorUtils.newMultiJXPathDecorator(JXPathDecorator.class, "${expression}$s#${nbToken}$d", "#", " - "); + assertEquals("%1$s - %2$d", decorator.getExpression()); + assertDecoratorInternal(); + assertEquals(2, decorator.contexts.length); + decorator.setContextIndex(1); + assertEquals("%1$d - %2$s", decorator.getExpression()); + assertTokens("nbToken", "expression"); + expected = String.format(decorator.getExpression(), decorator.getNbToken(), decorator.getExpression()); + result = decorator.toString(decorator); + assertEquals(expected, result); + + decorator = DecoratorUtils.newMultiJXPathDecorator(JXPathDecorator.class, "${expression}$s ## ${nbToken}$d", " ## ", " - "); + assertEquals("%1$s - %2$d", decorator.getExpression()); + assertDecoratorInternal(); + assertEquals(2, decorator.contexts.length); + decorator.setContextIndex(1); + assertEquals("%1$d - %2$s", decorator.getExpression()); + assertTokens("nbToken", "expression"); + expected = String.format(decorator.getExpression(), decorator.getNbToken(), decorator.getExpression()); + result = decorator.toString(decorator); + assertEquals(expected, result); + } + + @Test + public void testMultiDecorator2() throws Exception { + + decorator = DecoratorUtils.newMultiJXPathDecorator(JXPathDecorator.class, "${expression}$s#${nbToken}$d#${separator}$s", "#", " - "); + + assertEquals("%1$s - %2$d - %3$s", decorator.getExpression()); + assertTokens("expression", "nbToken", "separator"); + assertEquals(3, decorator.contexts.length); + + expected = String.format(decorator.getExpression(), decorator.getExpression(), decorator.getNbToken(), decorator.getSeparator()); + result = decorator.toString(decorator); + assertEquals(expected, result); + + decorator.setContextIndex(1); + assertEquals("%1$d - %2$s - %3$s", decorator.getExpression()); + assertTokens("nbToken", "separator", "expression"); + expected = String.format(decorator.getExpression(), decorator.getNbToken(), decorator.getSeparator(), decorator.getExpression()); + result = decorator.toString(decorator); + assertEquals(expected, result); + + decorator.setContextIndex(2); + assertEquals("%1$s - %2$s - %3$d", decorator.getExpression()); + assertTokens("separator", "expression", "nbToken"); + + expected = String.format(decorator.getExpression(), decorator.getSeparator(), decorator.getExpression(), decorator.getNbToken()); + result = decorator.toString(decorator); + assertEquals(expected, result); + } + + @Test + public void testMultiDecoratorWithMultiRef() throws Exception { + + decorator = DecoratorUtils.newMultiJXPathDecorator(JXPathDecorator.class, "${expression}$s#${nbToken}$d#${separator}$s %3$s", "#", " - "); + + assertEquals("%1$s - %2$d - %3$s %3$s", decorator.getExpression()); + assertTokens("expression", "nbToken", "separator"); + assertEquals(3, decorator.contexts.length); + + expected = String.format(decorator.getExpression(), decorator.getExpression(), decorator.getNbToken(), decorator.getSeparator()); + result = decorator.toString(decorator); + assertEquals(expected, result); + + decorator.setContextIndex(1); + assertEquals("%1$d - %2$s %3$s - %3$s", decorator.getExpression()); + assertTokens("nbToken", "separator", "expression"); + expected = String.format(decorator.getExpression(), decorator.getNbToken(), decorator.getSeparator(), decorator.getExpression()); + result = decorator.toString(decorator); + assertEquals(expected, result); + + decorator.setContextIndex(2); + assertEquals("%1$s %3$s - %2$s - %3$d", decorator.getExpression()); + assertTokens("separator", "expression", "nbToken"); + + expected = String.format(decorator.getExpression(), decorator.getSeparator(), decorator.getExpression(), decorator.getNbToken()); + result = decorator.toString(decorator); + assertEquals(expected, result); + } + + @Test + public void testSort() throws Exception { + + List<Data> datas = Data.generate(10); + + MultiJXPathDecorator<Data> d = DecoratorUtils.newMultiJXPathDecorator(Data.class, "${pos}$d-${name}$s", "-"); + + List<Data> sortData = new ArrayList<Data>(datas); + DecoratorUtils.sort(d, sortData, 0); + for (int i = 0; i < datas.size(); i++) { + Data data = datas.get(i); + Data sData = sortData.get(i); + assertEquals(data, sData); + } + Collections.sort(datas, new Comparator<Data>() { + + @Override + public int compare(Data o1, Data o2) { + return o1.name.compareTo(o2.name); + } + }); + d.setContextIndex(1); + DecoratorUtils.sort(d, sortData, 1); + for (int i = 0; i < datas.size(); i++) { + Data data = datas.get(i); + Data sData = sortData.get(i); + assertEquals(data, sData); + } + } + + public void assertDecoratorInternal(String... tokens) { + assertTokens(tokens); + expected = String.format(decorator.getExpression(), decorator.getExpression(), decorator.getNbToken()); + result = decorator.toString(decorator); + assertEquals(expected, result); + } + + private void assertTokens(String... tokens) { + if (tokens.length == 0) { + tokens = new String[]{"expression", "nbToken"}; + } + assertEquals(tokens.length, decorator.nbToken); + assertEquals(tokens.length, decorator.getTokens().length); + for (int i = 0; i < tokens.length; i++) { + assertEquals(tokens[i], decorator.getTokens()[i]); + } + } +} diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/swing/tree/NavigationTreeModelTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/swing/tree/NavigationTreeModelTest.java new file mode 100644 index 0000000..6398c2e --- /dev/null +++ b/jaxx-runtime/src/test/java/jaxx/runtime/swing/tree/NavigationTreeModelTest.java @@ -0,0 +1,377 @@ +package jaxx.runtime.swing.tree; + +import jaxx.runtime.DefaultJAXXContext; +import jaxx.runtime.JAXXContext; +import jaxx.runtime.JAXXContextEntryDef; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +/** + * Test du model de navigation. + * + * @author chemit + */ +public class NavigationTreeModelTest { + + private static final String ROOT_CONTEXT = "$root"; + private static final String FAKE = "-fake"; + private static final String separator = "/"; + + @Test + public void testFindNode() throws Exception { + + NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder(separator, new DefaultJAXXContext(), null, null); + + NavigationTreeNode rootNode = builder.build(null, (String) null, (String) null, ROOT_CONTEXT, null, null); + + for (int i = 0; i < 4; i++) { + NavigationTreeNode sonNode = builder.build(rootNode, (String) null, (String) null, getNodeContext(i), null, null); + for (int j = 0; j < 4; j++) { + NavigationTreeNode sonSonNode = builder.build(sonNode, (String) null, (String) null, getNodeContext(i, j), null, null); + for (int k = 0; k < 4; k++) { + builder.build(sonSonNode, (String) null, (String) null, getNodeContext(i, j, k), null, null); + } + } + } + + NavigationTreeModel model = builder.getModel(); + + NavigationTreeNode node; + String contextPath; + String currentNode; + + contextPath = ROOT_CONTEXT; + node = model.findNode(contextPath); + assertNodeEquals(contextPath, ROOT_CONTEXT, 0, node, true); + + node = model.findNode(ROOT_CONTEXT + FAKE); + Assert.assertNull(node); + + for (int i = 0; i < 4; i++) { + currentNode = getNodeContext(i); + contextPath = ROOT_CONTEXT + separator + currentNode; + node = model.findNode(contextPath); + assertNodeEquals(contextPath, currentNode, 1, node, false); + + for (int j = 0; j < 4; j++) { + currentNode = getNodeContext(i, j); + contextPath = ROOT_CONTEXT + separator + getNodeContext(i) + separator + currentNode; + node = model.findNode(contextPath); + assertNodeEquals(contextPath, currentNode, 2, node, false); + + for (int k = 0; k < 4; k++) { + currentNode = getNodeContext(i, j, k); + contextPath = ROOT_CONTEXT + separator + getNodeContext(i) + separator + getNodeContext(i, j) + separator + currentNode; + node = model.findNode(contextPath); + assertNodeEquals(contextPath, currentNode, 3, node, false); + } + + node = model.findNode(ROOT_CONTEXT + separator + getNodeContext(i) + separator + getNodeContext(i, j) + separator + currentNode + FAKE); + Assert.assertNull(node); + } + + node = model.findNode(ROOT_CONTEXT + separator + getNodeContext(i) + separator + currentNode + FAKE); + Assert.assertNull(node); + + } + + } + + /** + * Test the {@link NavigationTreeModel#getJAXXContextValue(jaxx.runtime.JAXXContext, String)} with an entry point + * as a bean. + * <p/> + * Tree is like this + * <pre> + * $root + + * - name <-- attached to context entry : java.lang.String.class,"name" + * - name2 <-- attached to context entry : java.lang.String.class,"name2" + * - model + <-- attached to context entry : Model.class,null + * - name + * -integerValue + * - sons + + * - 0 + + * - name + * - integerValue + * - sons + * - 1 + + * - name + * - integerValue + * - sons + * - 2 + + * - name + * - integerValue + * - sons + * </pre> + * <p/> + * With this tree, we will have to results : + * <pre> + * $root.name => context.get(String.class,"name") + * $root.name2 => context.get(String.class,"name2") + * $root.model => context.get(Model.class) + * $root.model.name => context.get(Model.class).getName() + * $root.model.integerValue => context.get(Model.class).getIntegerValue() + * $root.model.sons => context.get(Model.class).getSons() + * $root.model.sons.0 => context.get(Model.class).getSons().get(0) + * </pre> + * + * @throws Exception if any pb + */ + @Test + public void testGetJAXXContextValue() throws Exception { + + JAXXContext context = new DefaultJAXXContext(); + context.setContextValue("the name", "name"); + context.setContextValue("the name2", "name2"); + + + context.setContextValue( + new Model("modelName", 10, + Arrays.asList( + new Model("one", 1, Collections.<Model>emptyList()), + new Model("two", 2, Collections.<Model>emptyList()), + new Model("three", 3, Collections.<Model>emptyList())))); + + NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder(separator, context, null, null); + + NavigationTreeNode rootNode = builder.build(null, (String) null, (String) null, ROOT_CONTEXT, null, null); + + NavigationTreeNode sonNode; + NavigationTreeNode sonSonNode; + NavigationTreeNode sonSonSonNode; + + builder.build(rootNode, (String) null, JAXXContextEntryDef.newDef("name", String.class), "name", null, null); + builder.build(rootNode, (String) null, JAXXContextEntryDef.newDef("name2", String.class), "name2", null, null); + + sonNode = builder.build(rootNode, (String) null, JAXXContextEntryDef.newDef(Model.class), "model", null, null); + + builder.build(sonNode, (String) null, "../name", "name", null, null); + builder.build(sonNode, (String) null, "../integerValue", "integerValue", null, null); + + sonSonNode = builder.build(sonNode, (String) null, "../sons", "sons", null, null); + + sonSonSonNode = builder.build(sonSonNode, (String) null, "..[1]", 0 + "", null, null); + + builder.build(sonSonSonNode, (String) null, "../name", "name", null, null); + builder.build(sonSonSonNode, (String) null, "../integerValue", "integerValue", null, null); + builder.build(sonSonSonNode, (String) null, "../sons", "sons", null, null); + + sonSonSonNode = builder.build(sonSonNode, (String) null, "..[2]", 1 + "", null, null); + + builder.build(sonSonSonNode, (String) null, "../name", "name", null, null); + builder.build(sonSonSonNode, (String) null, "../integerValue", "integerValue", null, null); + builder.build(sonSonSonNode, (String) null, "../sons", "sons", null, null); + + sonSonSonNode = builder.build(sonSonNode, (String) null, (String) null, 2 + "", null, null); + //sonSonSonNode = model.new NavigationTreeNode(null, "..[3]", 2 + "", null, null); + sonSonNode.insert(sonSonSonNode, 2); + builder.build(sonSonSonNode, (String) null, "../..[3]/name", "name", null, null); + builder.build(sonSonSonNode, (String) null, "../..[3]/integerValue", "integerValue", null, null); + builder.build(sonSonSonNode, (String) null, "../..[3]/sons", "sons", null, null); + + NavigationTreeModel model = builder.getModel(); + + Assert.assertNull(model.getBean("$root.name" + FAKE)); + + testBinding(model, context, "$root/name", context.getContextValue(String.class, "name")); + testBinding(model, context, "$root/name2", context.getContextValue(String.class, "name2")); + + Model bean = context.getContextValue(Model.class); + + testBinding(model, context, "$root/model", bean); + testBinding(model, context, "$root/model/name", bean.getName()); + testBinding(model, context, "$root/model/integerValue", bean.getIntegerValue()); + testBinding(model, context, "$root/model/sons", bean.getSons()); + + testBinding(model, context, "$root/model/sons/0/name", bean.getSons().get(0).getName()); + testBinding(model, context, "$root/model/sons/0/integerValue", bean.getSons().get(0).getIntegerValue()); + testBinding(model, context, "$root/model/sons/0/sons", bean.getSons().get(0).getSons()); + + + testBinding(model, context, "$root/model/sons/1/name", bean.getSons().get(1).getName()); + testBinding(model, context, "$root/model/sons/1/integerValue", bean.getSons().get(1).getIntegerValue()); + testBinding(model, context, "$root/model/sons/1/sons", bean.getSons().get(1).getSons()); + + testBinding(model, context, "$root/model/sons/2/name", bean.getSons().get(2).getName()); + testBinding(model, context, "$root/model/sons/2/integerValue", bean.getSons().get(2).getIntegerValue()); + testBinding(model, context, "$root/model/sons/2/sons", bean.getSons().get(2).getSons()); + } + + /** + * Test the {@link NavigationTreeModel#getJAXXContextValue(jaxx.runtime.JAXXContext, String)} with an entry point + * as a list. + * <p/> + * Tree is like this + * <pre> + * $root + + * - models + <-- attached to context entry : java.util.List.class,"models" + * - 0 + + * - name + * -integerValue + * - sons + + * - 0 + + * - name + * - 1 + + * - name + * - integerValue + * - sons + * - 2 + + * - name + * - integerValue + * - sons + * </pre> + * <p/> + * With this tree, we will have to results : + * <pre> + * $root.models => context.get(List.class,"models") + * $root.models.0 => context.get(List.class,"models").get(0) + * $root.models.0.name => context.get(List.class,"models").get(0).getName() + * </pre> + * + * @throws Exception if any pb + */ + @Test + public void testGetBeanFromList() throws Exception { + + List<Model> list = Arrays.asList( + new Model("entryOne", 10, + Arrays.asList( + new Model("one", 1, Collections.<Model>emptyList()), + new Model("two", 2, Collections.<Model>emptyList()), + new Model("three", 3, Collections.<Model>emptyList()))), + new Model("entryTwo", 20, + Arrays.asList( + new Model("2one", 1, Collections.<Model>emptyList()), + new Model("2two", 2, Collections.<Model>emptyList()), + new Model("2three", 3, Collections.<Model>emptyList()))), + new Model("entryThree", 30, + Arrays.asList( + new Model("3one", 1, Collections.<Model>emptyList()), + new Model("3two", 2, Collections.<Model>emptyList()), + new Model("3three", 3, Collections.<Model>emptyList())))); + JAXXContext context = new DefaultJAXXContext(); + context.setContextValue(list, "models"); + + + NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder(separator, context, null, null); + + NavigationTreeNode rootNode = builder.build(null, (String) null, (String) null, ROOT_CONTEXT, null, null); + + NavigationTreeNode sonNode; + NavigationTreeNode sonSonNode; + NavigationTreeNode sonSonSonNode; + + // first son is a list of models + sonNode = builder.build(rootNode, (String) null, JAXXContextEntryDef.newListDef("models"), "models", null, null); + + // first son son is a model + sonSonNode = builder.build(sonNode, (String) null, "..[1]", "0", null, null); + + builder.build(sonSonNode, (String) null, "../name", "name", null, null); + builder.build(sonSonNode, (String) null, "../integerValue", "integerValue", null, null); + sonSonNode = builder.build(sonSonNode, (String) null, "../sons", "sons", null, null); + + sonSonSonNode = builder.build(sonSonNode, (String) null, "..[1]", "0", null, null); + builder.build(sonSonSonNode, (String) null, "../name", "name", null, null); + + // second son son is a model + sonSonNode = builder.build(sonNode, (String) null, "..[2]", "1", null, null); + + builder.build(sonSonNode, (String) null, "../name", "name", null, null); + builder.build(sonSonNode, (String) null, "../integerValue", "integerValue", null, null); + builder.build(sonSonNode, (String) null, "../sons", "sons", null, null); + + // third son son is a model + sonSonNode = builder.build(sonNode, (String) null, "..[3]", "2", null, null); + + builder.build(sonSonNode, (String) null, "../name", "name", null, null); + builder.build(sonSonNode, (String) null, "../integerValue", "integerValue", null, null); + builder.build(sonSonNode, (String) null, "../sons", "sons", null, null); + + NavigationTreeModel model = builder.getModel(); + + Model bean; + + testBinding(model, context, "$root/models", list); + + bean = list.get(0); + testBinding(model, context, "$root/models/0", bean); + testBinding(model, context, "$root/models/0/name", bean.getName()); + testBinding(model, context, "$root/models/0/integerValue", bean.getIntegerValue()); + testBinding(model, context, "$root/models/0/sons", bean.getSons()); + testBinding(model, context, "$root/models/0/sons/0", bean.getSons().get(0)); + testBinding(model, context, "$root/models/0/sons/0/name", bean.getSons().get(0).getName()); + + bean = list.get(1); + testBinding(model, context, "$root/models/1", bean); + testBinding(model, context, "$root/models/1/name", bean.getName()); + testBinding(model, context, "$root/models/1/integerValue", bean.getIntegerValue()); + testBinding(model, context, "$root/models/1/sons", bean.getSons()); + + bean = list.get(2); + testBinding(model, context, "$root/models/2", bean); + testBinding(model, context, "$root/models/2/name", bean.getName()); + testBinding(model, context, "$root/models/2/integerValue", bean.getIntegerValue()); + testBinding(model, context, "$root/models/2/sons", bean.getSons()); + + } + + protected void testBinding(NavigationTreeModel model, JAXXContext context, String contextPath, Object expected) throws Exception { + + Object value; + value = model.getBean(contextPath); + Assert.assertNotNull(value); + Assert.assertEquals(expected, value); + } + + protected String getNodeContext(int... context) { + String result = ""; + for (int i : context) { + result += i; + } + return result; + } + + protected void assertNodeEquals(String contextPath, String nodeContext, int level, NavigationTreeNode node, boolean root) { + //System.out.println(contextPath + " : " + (node == null ? null : node.getContextPath())); + Assert.assertNotNull(node); + Assert.assertEquals(root, node.isRoot()); + Assert.assertEquals(level, node.getLevel()); + Assert.assertEquals(nodeContext, node.getNodePath()); + Assert.assertEquals(contextPath, node.getFullPath()); + } + + public static class Model { + + protected String name; + protected int integerValue; + protected List<Model> sons; + + public Model(String name, int integerValue, List<Model> sons) { + this.name = name; + this.integerValue = integerValue; + this.sons = sons; + } + + public String getName() { + return name; + } + + public int getIntegerValue() { + return integerValue; + } + + public List<Model> getSons() { + return sons; + } + + @Override + public String toString() { + return super.toString() + "<name:" + name + ",integerValue:" + integerValue + ",sons: " + sons + ">"; + } + } +} diff --git a/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties b/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties new file mode 100644 index 0000000..1e65fd0 --- /dev/null +++ b/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties @@ -0,0 +1,70 @@ +aboutframe.about= +aboutframe.license= +aboutframe.ok= +aboutframe.thirdparty= +columnselector.action.tip= +config.action.quit= +config.action.quit.tip= +config.action.reset= +config.action.reset.tip= +config.action.save= +config.action.save.tip= +config.category.saved= +config.choice.cancel= +config.choice.continue= +config.choice.doNotSave= +config.choice.ok= +config.choice.save= +config.defaultValue= +config.defaultValue.tip= +config.descrition= +config.error.category.already.exists= +config.error.category.not.found= +config.key= +config.key.tip= +config.message.quit.invalid.category= +config.message.quit.valid.and.modified.category= +config.modified= +config.no.option.selected= +config.option.final= +config.option.label= +config.option.modified= +config.title= +config.title.need.confirm= +config.title.will.reload.application= +config.unmodifiable= +config.unvalid= +config.value= +config.value.tip= +entitycombobox.action.reset.tip= +entitycombobox.action.sort.tip= +entitycombobox.popup.label= +entitycombobox.popup.title= +entitycombobox.sort.off= +entitycombobox.sort.on= +entitycombobox.unknown.type= +errorUI.action.close= +errorUI.message= +errorUI.title= +i18neditor.empty.locales= +i18neditor.popup.title= +i18neditor.selected= +i18neditor.unselected= +memorywidget.memory= +numbereditor..= +numbereditor.0= +numbereditor.1= +numbereditor.2= +numbereditor.3= +numbereditor.4= +numbereditor.5= +numbereditor.6= +numbereditor.7= +numbereditor.8= +numbereditor.9= +numbereditor.action.reset.tip= +numbereditor.action.show.tip= +numbereditor.clearAll= +numbereditor.clearOne= +numbereditor.toggleSign= +timeeditor.H= diff --git a/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties b/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties new file mode 100644 index 0000000..1e65fd0 --- /dev/null +++ b/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties @@ -0,0 +1,70 @@ +aboutframe.about= +aboutframe.license= +aboutframe.ok= +aboutframe.thirdparty= +columnselector.action.tip= +config.action.quit= +config.action.quit.tip= +config.action.reset= +config.action.reset.tip= +config.action.save= +config.action.save.tip= +config.category.saved= +config.choice.cancel= +config.choice.continue= +config.choice.doNotSave= +config.choice.ok= +config.choice.save= +config.defaultValue= +config.defaultValue.tip= +config.descrition= +config.error.category.already.exists= +config.error.category.not.found= +config.key= +config.key.tip= +config.message.quit.invalid.category= +config.message.quit.valid.and.modified.category= +config.modified= +config.no.option.selected= +config.option.final= +config.option.label= +config.option.modified= +config.title= +config.title.need.confirm= +config.title.will.reload.application= +config.unmodifiable= +config.unvalid= +config.value= +config.value.tip= +entitycombobox.action.reset.tip= +entitycombobox.action.sort.tip= +entitycombobox.popup.label= +entitycombobox.popup.title= +entitycombobox.sort.off= +entitycombobox.sort.on= +entitycombobox.unknown.type= +errorUI.action.close= +errorUI.message= +errorUI.title= +i18neditor.empty.locales= +i18neditor.popup.title= +i18neditor.selected= +i18neditor.unselected= +memorywidget.memory= +numbereditor..= +numbereditor.0= +numbereditor.1= +numbereditor.2= +numbereditor.3= +numbereditor.4= +numbereditor.5= +numbereditor.6= +numbereditor.7= +numbereditor.8= +numbereditor.9= +numbereditor.action.reset.tip= +numbereditor.action.show.tip= +numbereditor.clearAll= +numbereditor.clearOne= +numbereditor.toggleSign= +timeeditor.H= diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/ComboBoxTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/ComboBoxTest.java new file mode 100644 index 0000000..342bf9f --- /dev/null +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/ComboBoxTest.java @@ -0,0 +1,84 @@ +package org.nuiton.jaxx.plugin; + +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.JAXXCompilerLaunchor; +import org.apache.maven.plugin.MojoExecutionException; + +import java.lang.reflect.Field; +import java.util.Map; + +import org.apache.maven.plugin.logging.SystemStreamLog; +import org.junit.Test; +import static org.junit.Assert.*; + +public class ComboBoxTest extends JaxxBaseTest { + + @Test + public void ok() throws Exception { + JaxxGeneratorMojo mojo = getMojo(); + mojo.execute(); + checkPattern(mojo, "swingComboBox", true, "org/nuiton/jaxx/plugin/ComboBoxTest/ok/swingcombo.java"); + assertNumberJaxxFiles(2); + } + + @SuppressWarnings({"unchecked"}) + @Test + public void error() throws Exception { + JaxxGeneratorMojo mojo = getMojo(); + // init mojo to get alls files to treate + mojo.init(); + + assertNumberJaxxFiles(1); + + mojo.setLog(new SystemStreamLog() { + + @Override + public boolean isErrorEnabled() { + return false; + } + + @Override + public void error(Throwable error) { + //do nothing + } + + @Override + public void error(CharSequence content) { + //do nothing + } + + @Override + public void error(CharSequence content, Throwable error) { + //do nothing + } + }); + Field fieldCompilers = JAXXCompilerLaunchor.class.getDeclaredField("compilers"); + Field fieldErrorCount = JAXXCompilerLaunchor.class.getDeclaredField("errorCount"); + + fieldCompilers.setAccessible(true); + fieldErrorCount.setAccessible(true); + + + // execute mjo on each jaxx file to produce the error + for (String file : mojo.files) { + log.info("test bad file " + file); + mojo.files = new String[]{file}; + try { + mojo.doAction(); + // should never pass + fail(); + } catch (MojoExecutionException e) { + // ok jaxx compiler failed + assertTrue(true); + + JAXXCompilerLaunchor launchor = JAXXCompilerLaunchor.get(); + Map<String, JAXXCompiler> compilers = (Map<String, JAXXCompiler>) fieldCompilers.get(launchor); + assertEquals(1, compilers.size()); + //JAXXCompiler compiler; + //compiler = compilers.values().iterator().next(); + Integer nberrors = (Integer) fieldErrorCount.get(launchor); + assertTrue(nberrors != null && nberrors > 0); + } + } + } +} diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/error.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/error.xml new file mode 100644 index 0000000..704b8ee --- /dev/null +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/error.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-jaxx-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <force>true</force> + <verbose>true</verbose> + <includes> + <value>**/ComboBoxTest/error/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/error/swingcombo.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/error/swingcombo.jaxx new file mode 100644 index 0000000..099d54d --- /dev/null +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/error/swingcombo.jaxx @@ -0,0 +1,4 @@ + +<JComboBox id='comboBox'> + <item value='{_("OK")}' selected='true'/> +</JComboBox> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/ok.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/ok.xml new file mode 100644 index 0000000..b36498a --- /dev/null +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/ok.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.nuiton.jaxx.test</groupId> + <artifactId>test</artifactId> + <version>0</version> + <build> + <plugins> + <plugin> + <groupId>org.nuiton</groupId> + <artifactId>maven-jaxx-plugin</artifactId> + <configuration> + <src>${basedir}/target/test-classes</src> + <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <force>true</force> + <includes> + <value>**/ComboBoxTest/ok/*.jaxx</value> + </includes> + </configuration> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/ok/jaxxcombo.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/ok/jaxxcombo.jaxx new file mode 100644 index 0000000..caf6e44 --- /dev/null +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/ok/jaxxcombo.jaxx @@ -0,0 +1,4 @@ + +<JAXXComboBox id='comboBox'> + <item value='OK' selected='true'/> +</JAXXComboBox> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/ok/swingcombo.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/ok/swingcombo.jaxx new file mode 100644 index 0000000..3342779 --- /dev/null +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/ok/swingcombo.jaxx @@ -0,0 +1,2 @@ + +<JComboBox id='swingComboBox'/> \ No newline at end of file -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit a3d4ea33ae86725e76b7d4a832e366b0b48fa5bd Author: Tony Chemit <chemit@codelutin.com> Date: Tue Oct 6 04:59:00 2009 +0000 [Evolution #74] : pouvoir generer les classes swing (JComboBox, JList,...) --- .../src/main/java/jaxx/SwingInitializer.java | 31 +++-- .../{JListHandler.java => JAXXListHandler.java} | 128 +++++++++---------- .../{JTreeHandler.java => JAXXTreeHandler.java} | 138 ++++++++++----------- .../java/jaxx/tags/swing/JComboBoxHandler.java | 1 + .../main/java/jaxx/tags/swing/JListHandler.java | 38 ++---- .../main/java/jaxx/tags/swing/JTreeHandler.java | 42 ++----- jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx | 5 +- .../navigation/item/ItemTreeNavigationDemo.jaxx | 4 +- .../java/jaxx/demo/component/swing/JListDemo.jaxx | 116 ++++++++--------- .../{ComboBoxTest.java => Evolution74Test.java} | 22 +++- .../jaxx/plugin/ComboBoxTest/ok/jaxxcombo.jaxx | 4 - .../jaxx/plugin/ComboBoxTest/ok/swingcombo.jaxx | 2 - .../SpecialSubclassing/JListTest1.jaxx | 4 +- .../SpecialSubclassing/JListTest2.jaxx | 4 +- .../SpecialSubclassing/JTreeTest1.jaxx | 4 +- .../SpecialSubclassing/JTreeTest2.jaxx | 4 +- .../{ComboBoxTest => Evolution74Test}/error.xml | 2 +- .../error/swingcombo.jaxx | 0 .../plugin/Evolution74Test/error/swinglist.jaxx | 4 + .../plugin/Evolution74Test/error/swingtree.jaxx | 4 + .../{ComboBoxTest => Evolution74Test}/ok.xml | 2 +- .../jaxx/plugin/Evolution74Test/ok/jaxxcombo.jaxx | 4 + .../jaxx/plugin/Evolution74Test/ok/jaxxlist.jaxx | 4 + .../jaxx/plugin/Evolution74Test/ok/jaxxtree.jaxx | 4 + .../jaxx/plugin/Evolution74Test/ok/swingcombo.jaxx | 2 + .../jaxx/plugin/Evolution74Test/ok/swinglist.jaxx | 1 + .../jaxx/plugin/Evolution74Test/ok/swingtree.jaxx | 2 + 27 files changed, 284 insertions(+), 292 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/SwingInitializer.java b/jaxx-compiler/src/main/java/jaxx/SwingInitializer.java index e849f42..a832eea 100644 --- a/jaxx-compiler/src/main/java/jaxx/SwingInitializer.java +++ b/jaxx-compiler/src/main/java/jaxx/SwingInitializer.java @@ -39,38 +39,47 @@ public class SwingInitializer implements Initializer { // TagManager.registerTag("java.awt.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class))); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(Application.class), ApplicationHandler.class); + + // check boxes TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JCheckBox.class), JCheckBoxHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JCheckBoxMenuItem.class), JCheckBoxHandler.class); - //TC-20091005 : JAXXComboBox and JComboBox are not the same -// TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class), JComboBoxHandler.class); -// TagManager.registerTag("javax.swing.*", "JComboBox", new JComboBoxHandler(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class))); + + // combo boxes TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JComboBox.class), JComboBoxHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(EnumEditor.class), JComboBoxHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(LocaleEditor.class), JComboBoxHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class), JAXXComboBoxHandler.class); + // radio boxes + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JRadioButton.class), JRadioButtonHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JRadioButtonMenuItem.class), JRadioButtonHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JToggleButton.class), JRadioButtonHandler.class); + + // Lists + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JList.class), JListHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXList.class), JAXXListHandler.class); + + // Trees + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JTree.class), JTreeHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXTree.class), JAXXTreeHandler.class); + + // Windows TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JDialog.class), JWindowHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JFrame.class), JWindowHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JWindow.class), JWindowHandler.class); + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JInternalFrame.class), JInternalFrameHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXList.class), JListHandler.class); - TagManager.registerTag("javax.swing.*", "JList", new JListHandler(ClassDescriptorLoader.getClassDescriptor(JAXXList.class))); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JMenu.class), JMenuHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JPasswordField.class), JPasswordFieldHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JPopupMenu.class), JPopupMenuHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JProgressBar.class), JProgressBarHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JRadioButton.class), JRadioButtonHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JRadioButtonMenuItem.class), JRadioButtonHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JScrollPane.class), JScrollPaneHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSlider.class), JSliderHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSpinner.class), JSpinnerHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSplitPane.class), JSplitPaneHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JTabbedPane.class), JTabbedPaneHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JTextComponent.class), JTextComponentHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JToggleButton.class), JRadioButtonHandler.class); TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JToolBar.class), JToolBarHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXTree.class), JTreeHandler.class); - TagManager.registerTag("javax.swing.*", "JTree", new JTreeHandler(ClassDescriptorLoader.getClassDescriptor(JAXXTree.class))); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JWindow.class), JWindowHandler.class); TagManager.registerDefaultNamespace("JEditorPane", "javax.swing.*"); TagManager.registerDefaultNamespace("JFormattedTextField", "javax.swing.*"); diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JListHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXListHandler.java similarity index 93% copy from jaxx-compiler/src/main/java/jaxx/tags/swing/JListHandler.java copy to jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXListHandler.java index 40d436b..194b467 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JListHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXListHandler.java @@ -1,64 +1,64 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.tags.swing; - -import jaxx.CompilerException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.runtime.swing.Item; -import jaxx.runtime.swing.JAXXList; -import jaxx.tags.DefaultComponentHandler; -import jaxx.types.TypeManager; -import org.w3c.dom.Element; - -import javax.swing.event.ListSelectionListener; -import java.io.IOException; -import java.util.List; - -public class JListHandler extends DefaultComponentHandler { - public JListHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JAXXList.class); - } - - @Override - protected void configureProxyEventInfo() { - super.configureProxyEventInfo(); - addProxyEventInfo("getSelectedIndex", ListSelectionListener.class, "selectionModel"); - addProxyEventInfo("getSelectedIndices", ListSelectionListener.class, "selectionModel"); - addProxyEventInfo("getSelectedValue", ListSelectionListener.class, "selectionModel"); - addProxyEventInfo("getSelectedValues", ListSelectionListener.class, "selectionModel"); - } - - @Override - public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { - return new CompiledItemContainer(id, getBeanClass(), compiler); - } - - @Override - public void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - super.compileChildrenSecondPass(tag, compiler); - CompiledItemContainer list = (CompiledItemContainer) compiler.getOpenComponent(); - List<Item> items = list.getItems(); - if (items != null && !items.isEmpty()) { - String listName = list.getId() + "$items"; - //TODO Add the correct generic type - list.appendAdditionCode("java.util.List<jaxx.runtime.swing.Item> " + listName + " = new java.util.ArrayList<jaxx.runtime.swing.Item>();"); - for (Item item : items) { - String id = item.getId(); - CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(Item.class), compiler); - compiledItem.setConstructorParams(TypeManager.getJavaCode(id) + ", " + TypeManager.getJavaCode(item.getLabel()) + ", " + TypeManager.getJavaCode(item.getValue()) + ", " + item.isSelected()); - compiler.registerCompiledObject(compiledItem); - list.appendAdditionCode(listName + ".add(" + id + ");"); - } - list.appendAdditionCode(list.getId() + ".setItems(" + listName + ");"); - } - } -} - - - +/* + * Copyright 2006 Ethan Nicholas. All rights reserved. + * Use is subject to license terms. + */ +package jaxx.tags.swing; + +import jaxx.CompilerException; +import jaxx.compiler.CompiledObject; +import jaxx.compiler.JAXXCompiler; +import jaxx.reflect.ClassDescriptor; +import jaxx.reflect.ClassDescriptorLoader; +import jaxx.runtime.swing.Item; +import jaxx.runtime.swing.JAXXList; +import jaxx.tags.DefaultComponentHandler; +import jaxx.types.TypeManager; +import org.w3c.dom.Element; + +import javax.swing.event.ListSelectionListener; +import java.io.IOException; +import java.util.List; + +public class JAXXListHandler extends DefaultComponentHandler { + public JAXXListHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JAXXList.class); + } + + @Override + protected void configureProxyEventInfo() { + super.configureProxyEventInfo(); + addProxyEventInfo("getSelectedIndex", ListSelectionListener.class, "selectionModel"); + addProxyEventInfo("getSelectedIndices", ListSelectionListener.class, "selectionModel"); + addProxyEventInfo("getSelectedValue", ListSelectionListener.class, "selectionModel"); + addProxyEventInfo("getSelectedValues", ListSelectionListener.class, "selectionModel"); + } + + @Override + public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { + return new CompiledItemContainer(id, getBeanClass(), compiler); + } + + @Override + public void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + super.compileChildrenSecondPass(tag, compiler); + CompiledItemContainer list = (CompiledItemContainer) compiler.getOpenComponent(); + List<Item> items = list.getItems(); + if (items != null && !items.isEmpty()) { + String listName = list.getId() + "$items"; + //TODO Add the correct generic type + list.appendAdditionCode("java.util.List<jaxx.runtime.swing.Item> " + listName + " = new java.util.ArrayList<jaxx.runtime.swing.Item>();"); + for (Item item : items) { + String id = item.getId(); + CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(Item.class), compiler); + compiledItem.setConstructorParams(TypeManager.getJavaCode(id) + ", " + TypeManager.getJavaCode(item.getLabel()) + ", " + TypeManager.getJavaCode(item.getValue()) + ", " + item.isSelected()); + compiler.registerCompiledObject(compiledItem); + list.appendAdditionCode(listName + ".add(" + id + ");"); + } + list.appendAdditionCode(list.getId() + ".setItems(" + listName + ");"); + } + } +} + + + diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JTreeHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXTreeHandler.java similarity index 94% copy from jaxx-compiler/src/main/java/jaxx/tags/swing/JTreeHandler.java copy to jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXTreeHandler.java index 0181aa2..24221ed 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JTreeHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXTreeHandler.java @@ -1,69 +1,69 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.tags.swing; - -import jaxx.CompilerException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.runtime.swing.Item; -import jaxx.runtime.swing.JAXXTree; -import jaxx.tags.DefaultComponentHandler; -import jaxx.types.TypeManager; -import org.w3c.dom.Element; - -import javax.swing.event.TreeSelectionListener; -import java.io.IOException; -import java.util.List; - -public class JTreeHandler extends DefaultComponentHandler { - public JTreeHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JAXXTree.class); - } - - @Override - protected void configureProxyEventInfo() { - super.configureProxyEventInfo(); - addProxyEventInfo("getSelectionCount", TreeSelectionListener.class, "selectionModel"); - addProxyEventInfo("getSelectionPath", TreeSelectionListener.class, "selectionModel"); - addProxyEventInfo("getSelectionPaths", TreeSelectionListener.class, "selectionModel"); - addProxyEventInfo("getSelectionRows", TreeSelectionListener.class, "selectionModel"); - addProxyEventInfo("getSelectionValue", TreeSelectionListener.class, "selectionModel"); - } - - @Override - public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { - return new CompiledItemContainer(id, getBeanClass(), compiler); - } - - private void createItems(CompiledObject tree, List<Item> items, String addMethod, JAXXCompiler compiler) throws CompilerException { - for (Item item : items) { - String id = item.getId(); - CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(Item.class), compiler); - compiledItem.setConstructorParams(TypeManager.getJavaCode(id) + ", " + TypeManager.getJavaCode(item.getLabel()) + ", " + TypeManager.getJavaCode(item.getValue()) + ", " + item.isSelected()); - compiler.registerCompiledObject(compiledItem); - tree.appendAdditionCode(addMethod + "(" + id + ");"); - createItems(tree, item.getChildren(), id + ".addChild", compiler); - } - } - - @Override - public void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - super.compileChildrenSecondPass(tag, compiler); - CompiledItemContainer tree = (CompiledItemContainer) compiler.getOpenComponent(); - List<Item> items = tree.getItems(); - if (items != null && !items.isEmpty()) { - String listName = tree.getId() + "$items"; - tree.appendAdditionCode("java.util.List<jaxx.runtime.swing.Item> " + listName + " = new java.util.ArrayList<jaxx.runtime.swing.Item>();"); - createItems(tree, items, listName + ".add", compiler); - tree.appendAdditionCode(tree.getId() + ".setItems(" + listName + ");"); - } - } -} - - - +/* + * Copyright 2006 Ethan Nicholas. All rights reserved. + * Use is subject to license terms. + */ +package jaxx.tags.swing; + +import jaxx.CompilerException; +import jaxx.compiler.CompiledObject; +import jaxx.compiler.JAXXCompiler; +import jaxx.reflect.ClassDescriptor; +import jaxx.reflect.ClassDescriptorLoader; +import jaxx.runtime.swing.Item; +import jaxx.runtime.swing.JAXXTree; +import jaxx.tags.DefaultComponentHandler; +import jaxx.types.TypeManager; +import org.w3c.dom.Element; + +import javax.swing.event.TreeSelectionListener; +import java.io.IOException; +import java.util.List; + +public class JAXXTreeHandler extends DefaultComponentHandler { + public JAXXTreeHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JAXXTree.class); + } + + @Override + protected void configureProxyEventInfo() { + super.configureProxyEventInfo(); + addProxyEventInfo("getSelectionCount", TreeSelectionListener.class, "selectionModel"); + addProxyEventInfo("getSelectionPath", TreeSelectionListener.class, "selectionModel"); + addProxyEventInfo("getSelectionPaths", TreeSelectionListener.class, "selectionModel"); + addProxyEventInfo("getSelectionRows", TreeSelectionListener.class, "selectionModel"); + addProxyEventInfo("getSelectionValue", TreeSelectionListener.class, "selectionModel"); + } + + @Override + public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { + return new CompiledItemContainer(id, getBeanClass(), compiler); + } + + private void createItems(CompiledObject tree, List<Item> items, String addMethod, JAXXCompiler compiler) throws CompilerException { + for (Item item : items) { + String id = item.getId(); + CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(Item.class), compiler); + compiledItem.setConstructorParams(TypeManager.getJavaCode(id) + ", " + TypeManager.getJavaCode(item.getLabel()) + ", " + TypeManager.getJavaCode(item.getValue()) + ", " + item.isSelected()); + compiler.registerCompiledObject(compiledItem); + tree.appendAdditionCode(addMethod + "(" + id + ");"); + createItems(tree, item.getChildren(), id + ".addChild", compiler); + } + } + + @Override + public void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + super.compileChildrenSecondPass(tag, compiler); + CompiledItemContainer tree = (CompiledItemContainer) compiler.getOpenComponent(); + List<Item> items = tree.getItems(); + if (items != null && !items.isEmpty()) { + String listName = tree.getId() + "$items"; + tree.appendAdditionCode("java.util.List<jaxx.runtime.swing.Item> " + listName + " = new java.util.ArrayList<jaxx.runtime.swing.Item>();"); + createItems(tree, items, listName + ".add", compiler); + tree.appendAdditionCode(tree.getId() + ".setItems(" + listName + ");"); + } + } +} + + + diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JComboBoxHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/JComboBoxHandler.java index 456ef98..a984400 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JComboBoxHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/swing/JComboBoxHandler.java @@ -35,6 +35,7 @@ public class JComboBoxHandler extends DefaultComponentHandler { NodeList children = tag.getChildNodes(); if (children.getLength() > 0) { compiler.reportError("JComboBox does not accept childs"); + throw new CompilerException("JComboBox does not accept childs"); } } } diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JListHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/JListHandler.java index 40d436b..f0a8f4a 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JListHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/swing/JListHandler.java @@ -1,28 +1,22 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ package jaxx.tags.swing; import jaxx.CompilerException; -import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; import jaxx.reflect.ClassDescriptor; import jaxx.reflect.ClassDescriptorLoader; -import jaxx.runtime.swing.Item; -import jaxx.runtime.swing.JAXXList; import jaxx.tags.DefaultComponentHandler; -import jaxx.types.TypeManager; import org.w3c.dom.Element; import javax.swing.event.ListSelectionListener; import java.io.IOException; -import java.util.List; +import javax.swing.JList; +import org.w3c.dom.NodeList; public class JListHandler extends DefaultComponentHandler { + public JListHandler(ClassDescriptor beanClass) { super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JAXXList.class); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JList.class); } @Override @@ -35,27 +29,11 @@ public class JListHandler extends DefaultComponentHandler { } @Override - public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { - return new CompiledItemContainer(id, getBeanClass(), compiler); - } - - @Override public void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - super.compileChildrenSecondPass(tag, compiler); - CompiledItemContainer list = (CompiledItemContainer) compiler.getOpenComponent(); - List<Item> items = list.getItems(); - if (items != null && !items.isEmpty()) { - String listName = list.getId() + "$items"; - //TODO Add the correct generic type - list.appendAdditionCode("java.util.List<jaxx.runtime.swing.Item> " + listName + " = new java.util.ArrayList<jaxx.runtime.swing.Item>();"); - for (Item item : items) { - String id = item.getId(); - CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(Item.class), compiler); - compiledItem.setConstructorParams(TypeManager.getJavaCode(id) + ", " + TypeManager.getJavaCode(item.getLabel()) + ", " + TypeManager.getJavaCode(item.getValue()) + ", " + item.isSelected()); - compiler.registerCompiledObject(compiledItem); - list.appendAdditionCode(listName + ".add(" + id + ");"); - } - list.appendAdditionCode(list.getId() + ".setItems(" + listName + ");"); + NodeList children = tag.getChildNodes(); + if (children.getLength() > 0) { + compiler.reportError("JList does not accept childs"); + throw new CompilerException("JList does not accept childs"); } } } diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JTreeHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/JTreeHandler.java index 0181aa2..77fd645 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JTreeHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/tags/swing/JTreeHandler.java @@ -1,28 +1,22 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ package jaxx.tags.swing; import jaxx.CompilerException; -import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; import jaxx.reflect.ClassDescriptor; import jaxx.reflect.ClassDescriptorLoader; -import jaxx.runtime.swing.Item; -import jaxx.runtime.swing.JAXXTree; import jaxx.tags.DefaultComponentHandler; -import jaxx.types.TypeManager; import org.w3c.dom.Element; import javax.swing.event.TreeSelectionListener; import java.io.IOException; -import java.util.List; +import javax.swing.JTree; +import org.w3c.dom.NodeList; public class JTreeHandler extends DefaultComponentHandler { + public JTreeHandler(ClassDescriptor beanClass) { super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JAXXTree.class); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JTree.class); } @Override @@ -36,31 +30,11 @@ public class JTreeHandler extends DefaultComponentHandler { } @Override - public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { - return new CompiledItemContainer(id, getBeanClass(), compiler); - } - - private void createItems(CompiledObject tree, List<Item> items, String addMethod, JAXXCompiler compiler) throws CompilerException { - for (Item item : items) { - String id = item.getId(); - CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(Item.class), compiler); - compiledItem.setConstructorParams(TypeManager.getJavaCode(id) + ", " + TypeManager.getJavaCode(item.getLabel()) + ", " + TypeManager.getJavaCode(item.getValue()) + ", " + item.isSelected()); - compiler.registerCompiledObject(compiledItem); - tree.appendAdditionCode(addMethod + "(" + id + ");"); - createItems(tree, item.getChildren(), id + ".addChild", compiler); - } - } - - @Override public void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - super.compileChildrenSecondPass(tag, compiler); - CompiledItemContainer tree = (CompiledItemContainer) compiler.getOpenComponent(); - List<Item> items = tree.getItems(); - if (items != null && !items.isEmpty()) { - String listName = tree.getId() + "$items"; - tree.appendAdditionCode("java.util.List<jaxx.runtime.swing.Item> " + listName + " = new java.util.ArrayList<jaxx.runtime.swing.Item>();"); - createItems(tree, items, listName + ".add", compiler); - tree.appendAdditionCode(tree.getId() + ".setItems(" + listName + ");"); + NodeList children = tag.getChildNodes(); + if (children.getLength() > 0) { + compiler.reportError("JTree does not accept childs"); + throw new CompilerException("JTree does not accept childs"); } } } diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx index 38ef966..b2a6111 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx @@ -97,10 +97,7 @@ private void $afterCompleteSetup() { <JScrollPane id='navigationPane'> <JTree id='navigation' model='{getTreeHelper().createTreeModel(this)}' - selectionModel="{getTreeHelper().createTreeHandler(this)}"> - <!--cellRenderer='{new NavigationTreeCellRenderer(this)}'>--> - <!--cellRenderer='{new NavigationTreeCellRenderer(this,185)}'>--> - </JTree> + selectionModel="{getTreeHelper().createTreeHandler(this)}"/> </JScrollPane> <JPanel id='content'/> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ItemTreeNavigationDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ItemTreeNavigationDemo.jaxx index de0ac8b..695890c 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ItemTreeNavigationDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ItemTreeNavigationDemo.jaxx @@ -40,7 +40,7 @@ void $afterCompleteSetup() { <JPanel id='demoPanel' layout='{new BorderLayout()}'> <JSplitPane constraints='BorderLayout.CENTER'> <JScrollPane> - <JTree id='nav' rootVisible='{false}'> + <JAXXTree id='nav' rootVisible='{false}'> <!-- Allow to diplay associated pane without value --> <item id='stringItemParent' label='String' value='{String.class}'> <item id='string1Item' label='String1' value='{new String("Ceci est un String")}' selected='true'/> @@ -49,7 +49,7 @@ void $afterCompleteSetup() { <item id='dateItemParent' label='Date' value='{Date.class}'> <item id='dateItem' label='CurrentDate' value='{new Date()}'/> </item> - </JTree> + </JAXXTree> </JScrollPane> <!-- Card panel, only ItemNavigationPanel children is allowed --> <ItemNavigationCardPanel id="content"> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JListDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JListDemo.jaxx index 093f15d..56e773f 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JListDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JListDemo.jaxx @@ -18,62 +18,62 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<jaxx.demo.DemoPanel> - <Table id='demoPanel'> - <row> - <cell> - <JLabel text='Supported Swing components:'/> - </cell> - </row> - - <row> - <cell> - <JScrollPane> - <JList> - <item value='JApplet'/> - <item value='JButton'/> - <item value='JCheckBox'/> - <item value='JCheckBoxMenuItem'/> - <item value='JColorChooser'/> - <item value='JComboBox'/> - <item value='JDesktopPane'/> - <item value='JDialog'/> - <item value='JEditorPane'/> - <item value='JFileChooser'/> - <item value='JFormattedTextField'/> - <item value='JFrame'/> - <item value='JInternalFrame'/> - <item value='JLabel'/> - <item value='JLayeredPane'/> - <item value='JList'/> - <item value='JMenu'/> - <item value='JMenuBar'/> - <item value='JMenuItem'/> - <item value='JOptionPane'/> - <item value='JPanel'/> - <item value='JPasswordField'/> - <item value='JPopupMenu'/> - <item value='JProgressBar'/> - <item value='JRadioButton'/> - <item value='JRadioButtonMenuItem'/> - <item value='JScrollBar'/> - <item value='JScrollPane'/> - <item value='JSeparator'/> - <item value='JSlider'/> - <item value='JSpinner'/> - <item value='JSplitPane'/> - <item value='JTabbedPane'/> - <item value='JTable'/> - <item value='JTextArea'/> - <item value='JTextField'/> - <item value='JTextPane'/> - <item value='JToggleButton'/> - <item value='JToolBar'/> - <item value='JTree'/> - <item value='JWindow'/> - </JList> - </JScrollPane> - </cell> - </row> - </Table> +<jaxx.demo.DemoPanel> + <Table id='demoPanel'> + <row> + <cell> + <JLabel text='Supported Swing components:'/> + </cell> + </row> + + <row> + <cell> + <JScrollPane> + <JAXXList> + <item value='JApplet'/> + <item value='JButton'/> + <item value='JCheckBox'/> + <item value='JCheckBoxMenuItem'/> + <item value='JColorChooser'/> + <item value='JComboBox'/> + <item value='JDesktopPane'/> + <item value='JDialog'/> + <item value='JEditorPane'/> + <item value='JFileChooser'/> + <item value='JFormattedTextField'/> + <item value='JFrame'/> + <item value='JInternalFrame'/> + <item value='JLabel'/> + <item value='JLayeredPane'/> + <item value='JList'/> + <item value='JMenu'/> + <item value='JMenuBar'/> + <item value='JMenuItem'/> + <item value='JOptionPane'/> + <item value='JPanel'/> + <item value='JPasswordField'/> + <item value='JPopupMenu'/> + <item value='JProgressBar'/> + <item value='JRadioButton'/> + <item value='JRadioButtonMenuItem'/> + <item value='JScrollBar'/> + <item value='JScrollPane'/> + <item value='JSeparator'/> + <item value='JSlider'/> + <item value='JSpinner'/> + <item value='JSplitPane'/> + <item value='JTabbedPane'/> + <item value='JTable'/> + <item value='JTextArea'/> + <item value='JTextField'/> + <item value='JTextPane'/> + <item value='JToggleButton'/> + <item value='JToolBar'/> + <item value='JTree'/> + <item value='JWindow'/> + </JAXXList> + </JScrollPane> + </cell> + </row> + </Table> </jaxx.demo.DemoPanel> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/ComboBoxTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java similarity index 63% rename from maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/ComboBoxTest.java rename to maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java index 342bf9f..64f09ff 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/ComboBoxTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java @@ -11,14 +11,28 @@ import org.apache.maven.plugin.logging.SystemStreamLog; import org.junit.Test; import static org.junit.Assert.*; -public class ComboBoxTest extends JaxxBaseTest { +public class Evolution74Test extends JaxxBaseTest { @Test public void ok() throws Exception { JaxxGeneratorMojo mojo = getMojo(); mojo.execute(); - checkPattern(mojo, "swingComboBox", true, "org/nuiton/jaxx/plugin/ComboBoxTest/ok/swingcombo.java"); - assertNumberJaxxFiles(2); + assertNumberJaxxFiles(6); + + checkPattern(mojo, "JComboBox", true, "org/nuiton/jaxx/plugin/Evolution74Test/ok/swingcombo.java"); + checkPattern(mojo, "JComboBox", false, "org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxcombo.java"); + checkPattern(mojo, "JAXXComboBox", false, "org/nuiton/jaxx/plugin/Evolution74Test/ok/swingcombo.java"); + checkPattern(mojo, "JAXXComboBox", true, "org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxcombo.java"); + + checkPattern(mojo, "JList", true, "org/nuiton/jaxx/plugin/Evolution74Test/ok/swinglist.java"); + checkPattern(mojo, "JList", false, "org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxlist.java"); + checkPattern(mojo, "JAXXList", false, "org/nuiton/jaxx/plugin/Evolution74Test/ok/swinglist.java"); + checkPattern(mojo, "JAXXList", true, "org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxlist.java"); + + checkPattern(mojo, "JTree", true, "org/nuiton/jaxx/plugin/Evolution74Test/ok/swingtree.java"); + checkPattern(mojo, "JTree", false, "org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxtree.java"); + checkPattern(mojo, "JAXXTree", false, "org/nuiton/jaxx/plugin/Evolution74Test/ok/swingtree.java"); + checkPattern(mojo, "JAXXTree", true, "org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxtree.java"); } @SuppressWarnings({"unchecked"}) @@ -28,7 +42,7 @@ public class ComboBoxTest extends JaxxBaseTest { // init mojo to get alls files to treate mojo.init(); - assertNumberJaxxFiles(1); + assertNumberJaxxFiles(3); mojo.setLog(new SystemStreamLog() { diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/ok/jaxxcombo.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/ok/jaxxcombo.jaxx deleted file mode 100644 index caf6e44..0000000 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/ok/jaxxcombo.jaxx +++ /dev/null @@ -1,4 +0,0 @@ - -<JAXXComboBox id='comboBox'> - <item value='OK' selected='true'/> -</JAXXComboBox> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/ok/swingcombo.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/ok/swingcombo.jaxx deleted file mode 100644 index 3342779..0000000 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/ok/swingcombo.jaxx +++ /dev/null @@ -1,2 +0,0 @@ - -<JComboBox id='swingComboBox'/> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JListTest1.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JListTest1.jaxx index f49ad85..66eefaf 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JListTest1.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JListTest1.jaxx @@ -1,3 +1,3 @@ -<JList> +<JAXXList> <item value='Working' selected='true'/> -</JList> \ No newline at end of file +</JAXXList> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JListTest2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JListTest2.jaxx index 10a6c79..3eb3554 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JListTest2.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JListTest2.jaxx @@ -1,3 +1,3 @@ -<JList> +<JAXXList> <item value='Failed!'/> -</JList> \ No newline at end of file +</JAXXList> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JTreeTest1.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JTreeTest1.jaxx index 1dcc3a1..a27d667 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JTreeTest1.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JTreeTest1.jaxx @@ -1,3 +1,3 @@ -<JTree> +<JAXXTree> <item value='Working' selected='true'/> -</JTree> \ No newline at end of file +</JAXXTree> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JTreeTest2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JTreeTest2.jaxx index a9e3f3a..74ae96d 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JTreeTest2.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JTreeTest2.jaxx @@ -1,3 +1,3 @@ -<JTree> +<JAXXTree> <item value='Failed!'/> -</JTree> \ No newline at end of file +</JAXXTree> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/error.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml similarity index 92% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/error.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml index 704b8ee..c13137e 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/error.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml @@ -18,7 +18,7 @@ <force>true</force> <verbose>true</verbose> <includes> - <value>**/ComboBoxTest/error/*.jaxx</value> + <value>**/Evolution74Test/error/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/error/swingcombo.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error/swingcombo.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/error/swingcombo.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error/swingcombo.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error/swinglist.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error/swinglist.jaxx new file mode 100644 index 0000000..bc3c16b --- /dev/null +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error/swinglist.jaxx @@ -0,0 +1,4 @@ + +<JList> + <item value='OK'/> +</JList> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error/swingtree.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error/swingtree.jaxx new file mode 100644 index 0000000..4b0c56a --- /dev/null +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error/swingtree.jaxx @@ -0,0 +1,4 @@ + +<JTree> + <item value='OK'/> +</JTree> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/ok.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok.xml similarity index 92% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/ok.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok.xml index b36498a..c905588 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/ComboBoxTest/ok.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok.xml @@ -17,7 +17,7 @@ <outResource>${basedir}/target/it-generated-sources/resources</outResource> <force>true</force> <includes> - <value>**/ComboBoxTest/ok/*.jaxx</value> + <value>**/Evolution74Test/ok/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxcombo.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxcombo.jaxx new file mode 100644 index 0000000..64c0be5 --- /dev/null +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxcombo.jaxx @@ -0,0 +1,4 @@ + +<JAXXComboBox> + <item value='OK'/> +</JAXXComboBox> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxlist.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxlist.jaxx new file mode 100644 index 0000000..bab2cc5 --- /dev/null +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxlist.jaxx @@ -0,0 +1,4 @@ + +<JAXXList> + <item value='OK'/> +</JAXXList> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxtree.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxtree.jaxx new file mode 100644 index 0000000..488787f --- /dev/null +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxtree.jaxx @@ -0,0 +1,4 @@ + +<JAXXTree> + <item value='OK'/> +</JAXXTree> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/swingcombo.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/swingcombo.jaxx new file mode 100644 index 0000000..bef5b35 --- /dev/null +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/swingcombo.jaxx @@ -0,0 +1,2 @@ + +<JComboBox/> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/swinglist.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/swinglist.jaxx new file mode 100644 index 0000000..f81e652 --- /dev/null +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/swinglist.jaxx @@ -0,0 +1 @@ +<JList/> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/swingtree.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/swingtree.jaxx new file mode 100644 index 0000000..331ed6c --- /dev/null +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/swingtree.jaxx @@ -0,0 +1,2 @@ + +<JTree/> \ No newline at end of file -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 8f386d69ffeeb5c6b247c4134cc4376c8f9922e0 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 7 14:22:07 2009 +0000 refactor jaxx 2.x --- .../src/main/java/jaxx/DefaultInitializer.java | 52 -- .../src/main/java/jaxx/ScriptException.java | 45 -- .../src/main/java/jaxx/SwingInitializer.java | 107 ---- .../compiler/BoxedCompiledObjectDecorator.java | 27 - .../main/java/jaxx/{ => compiler}/ClassMap.java | 18 +- .../main/java/jaxx/compiler/CompiledObject.java | 26 +- .../jaxx/compiler/CompiledObjectDecorator.java | 76 --- .../jaxx/{ => compiler}/CompilerException.java | 10 +- .../main/java/jaxx/compiler/CompilerOptions.java | 406 -------------- .../src/main/java/jaxx/compiler/DataBinding.java | 13 +- .../src/main/java/jaxx/compiler/DataSource.java | 73 ++- .../compiler/DefaultCompiledObjectDecorator.java | 128 ----- .../compiler/DefaultCompilerConfiguration.java | 247 +++++++++ .../src/main/java/jaxx/compiler/EventHandler.java | 15 +- .../compiler/HelpRootCompiledObjectDecorator.java | 93 ---- .../src/main/java/jaxx/compiler/I18nHelper.java | 9 +- .../src/main/java/jaxx/compiler/JAXXCompiler.java | 469 ++++++++-------- .../java/jaxx/compiler/JAXXCompilerLaunchor.java | 68 +-- .../java/jaxx/compiler/JAXXObjectGenerator.java | 598 --------------------- .../src/main/java/jaxx/compiler/JavaArgument.java | 9 +- .../src/main/java/jaxx/compiler/JavaField.java | 11 +- .../src/main/java/jaxx/compiler/JavaFile.java | 33 +- .../src/main/java/jaxx/compiler/JavaMethod.java | 122 ++--- .../main/java/jaxx/compiler/ScriptInitializer.java | 7 +- .../src/main/java/jaxx/compiler/ScriptManager.java | 67 +-- .../jaxx/{css => compiler}/StylesheetHelper.java | 286 +++++----- .../src/main/java/jaxx/compiler/SwingCompiler.java | 73 --- .../main/java/jaxx/compiler/SwingGenerator.java | 26 - .../src/main/java/jaxx/compiler/SymbolTable.java | 14 +- .../UnsupportedAttributeException.java | 8 +- .../{ => compiler}/UnsupportedTagException.java | 2 +- .../java/jaxx/compiler/ValidatorGenerator.java | 89 --- .../beans}/BeanInfoUtil.java | 2 +- .../beans}/JAXXBeanDescriptor.java | 7 +- .../beans}/JAXXBeanInfo.java | 13 +- .../beans}/JAXXEventSetDescriptor.java | 15 +- .../beans}/JAXXFeatureDescriptor.java | 23 +- .../beans}/JAXXIntrospector.java | 65 +-- .../beans}/JAXXPropertyDescriptor.java | 37 +- .../jaxx/compiler/{ => generators}/Generator.java | 7 +- .../java/jaxx/{ => compiler/parser}/css/CSS.jj | 0 .../java/jaxx/{ => compiler/parser}/css/CSS.jjt | 0 .../jaxx/{ => compiler/parser}/css/CSSParser.java | 2 +- .../parser}/css/CSSParserConstants.java | 2 +- .../parser}/css/CSSParserTokenManager.java | 2 +- .../parser}/css/CSSParserTreeConstants.java | 2 +- .../parser}/css/JJTCSSParserState.java | 2 +- .../java/jaxx/{ => compiler/parser}/css/Node.java | 2 +- .../{ => compiler/parser}/css/ParseException.java | 4 +- .../parser}/css/SimpleCharStream.java | 2 +- .../jaxx/{ => compiler/parser}/css/SimpleNode.java | 2 +- .../java/jaxx/{ => compiler/parser}/css/Token.java | 2 +- .../{ => compiler/parser}/css/TokenMgrError.java | 2 +- .../parser/java}/JJTJavaParserState.java | 2 +- .../{parser => compiler/parser/java}/Java1.5.jj | 0 .../{parser => compiler/parser/java}/Java1.5.jjt | 0 .../parser/java}/JavaCharStream.java | 2 +- .../parser/java}/JavaParser.java | 2 +- .../parser/java}/JavaParserConstants.java | 2 +- .../parser/java}/JavaParserTokenManager.java | 2 +- .../parser/java}/JavaParserTreeConstants.java | 2 +- .../{parser => compiler/parser/java}/Node.java | 2 +- .../parser/java}/ParseException.java | 4 +- .../parser/java}/SimpleNode.java | 4 +- .../{parser => compiler/parser/java}/Token.java | 2 +- .../parser/java}/TokenMgrError.java | 2 +- .../{ => compiler}/reflect/ClassDescriptor.java | 48 +- .../reflect/ClassDescriptorLoader.java | 155 +++--- .../{ => compiler}/reflect/FieldDescriptor.java | 10 +- .../{ => compiler}/reflect/JavaFileParser.java | 51 +- .../{ => compiler}/reflect/MemberDescriptor.java | 9 +- .../{ => compiler}/reflect/MethodDescriptor.java | 16 +- .../java/jaxx/compiler/spi/DefaultInitializer.java | 271 ++++++++++ .../java/jaxx/{ => compiler}/spi/Initializer.java | 16 +- .../tags/DefaultComponentHandler.java | 16 +- .../{ => compiler}/tags/DefaultObjectHandler.java | 37 +- .../jaxx/{ => compiler}/tags/ScriptHandler.java | 17 +- .../jaxx/{ => compiler}/tags/StyleHandler.java | 50 +- .../java/jaxx/{ => compiler}/tags/TagHandler.java | 8 +- .../java/jaxx/{ => compiler}/tags/TagManager.java | 74 +-- .../tags/swing/ApplicationHandler.java | 14 +- .../{ => compiler}/tags/swing/CellHandler.java | 22 +- .../tags/swing/CompiledItemContainer.java | 13 +- .../{ => compiler}/tags/swing/ItemHandler.java | 46 +- .../tags/swing/JAXXComboBoxHandler.java | 14 +- .../{ => compiler}/tags/swing/JAXXListHandler.java | 15 +- .../jaxx/compiler/tags/swing/JAXXTabHandler.java | 11 + .../{ => compiler}/tags/swing/JAXXTreeHandler.java | 13 +- .../tags/swing/JCheckBoxHandler.java | 11 +- .../tags/swing/JComboBoxHandler.java | 16 +- .../tags/swing/JInternalFrameHandler.java | 14 +- .../{ => compiler}/tags/swing/JListHandler.java | 14 +- .../{ => compiler}/tags/swing/JMenuHandler.java | 10 +- .../tags/swing/JPasswordFieldHandler.java | 6 +- .../tags/swing/JPopupMenuHandler.java | 11 +- .../tags/swing/JProgressBarHandler.java | 10 +- .../tags/swing/JRadioButtonHandler.java | 18 +- .../tags/swing/JScrollPaneHandler.java | 13 +- .../{ => compiler}/tags/swing/JSliderHandler.java | 10 +- .../{ => compiler}/tags/swing/JSpinnerHandler.java | 14 +- .../tags/swing/JSplitPaneHandler.java | 14 +- .../tags/swing/JTabbedPaneHandler.java | 17 +- .../tags/swing/JTextComponentHandler.java | 20 +- .../{ => compiler}/tags/swing/JToolBarHandler.java | 11 +- .../{ => compiler}/tags/swing/JTreeHandler.java | 10 +- .../{ => compiler}/tags/swing/JWindowHandler.java | 15 +- .../jaxx/{ => compiler}/tags/swing/RowHandler.java | 8 +- .../jaxx/{ => compiler}/tags/swing/TabHandler.java | 19 +- .../{ => compiler}/tags/swing/TableHandler.java | 22 +- .../tags/validator/BeanValidatorHandler.java | 36 +- .../validator/ExcludeFieldValidatorHandler.java | 18 +- .../tags/validator/FieldValidatorHandler.java | 18 +- .../jaxx/{ => compiler/tools}/PrintTagInfo.java | 13 +- .../tools/jaxxcapture/AbstractContextNode.java | 4 +- .../tools/jaxxcapture/CapturedObject.java | 4 +- .../tools/jaxxcapture/ContextNode.java | 5 +- .../tools/jaxxcapture/JAXXCapture.java | 86 ++- .../tools/jaxxcapture/LiteralNode.java | 2 +- .../tools/jaxxcapture/MethodNode.java | 2 +- .../tools/jaxxcapture/PropertyNode.java | 2 +- .../tools/jaxxcapture/ValueNode.java | 2 +- .../jaxxcapture/handlers/JTabbedPaneHandler.java | 11 +- .../tools/jaxxcapture/handlers/ObjectHandler.java | 18 +- .../tools/jaxxcapture/handlers/TableHandler.java | 10 +- .../jaxx/{ => compiler}/types/ColorConverter.java | 14 +- .../types/GridBagConstraintsConverter.java | 11 +- .../jaxx/{ => compiler}/types/InsetsConverter.java | 11 +- .../{ => compiler}/types/KeyStrokeConverter.java | 11 +- .../{ => compiler}/types/PrimitiveConverter.java | 10 +- .../jaxx/{ => compiler}/types/TypeConverter.java | 9 +- .../jaxx/{ => compiler}/types/TypeManager.java | 17 +- .../main/java/jaxx/tags/swing/JAXXTabHandler.java | 28 - .../jaxx/tags/validator/ValidatorInitializer.java | 22 - .../META-INF/services/jaxx.compiler.Generator | 3 - .../services/jaxx.compiler.generators.Generator | 3 + .../services/jaxx.compiler.spi.Initializer | 1 + .../META-INF/services/jaxx.spi.Initializer | 3 - jaxx-compiler/src/site/rst/JAXXContext.rst | 6 +- .../{junit => compiler}/JavaFileParserTest.java | 8 +- .../jaxx/{junit => compiler}/JavaMethodTest.java | 2 +- .../beans}/BeanIntoUtilTest.java | 4 +- .../reflect}/ClassDescriptorTest.java | 12 +- .../{junit => compiler/tags}/TagManagerTest.java | 21 +- .../types}/ColorConverterTest.java | 4 +- .../types}/InsetsConverterTest.java | 4 +- .../types}/PrimitiveConverterTest.java | 4 +- .../src/main/java/jaxx/demo/DemoTreeHelper.java | 29 +- jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx | 2 +- .../src/main/java/jaxx/demo/DemoUIHandler.java | 10 +- jaxx-demo/src/main/java/jaxx/demo/RunDemo.java | 2 +- .../demo/component/jaxx/editor/I18nEditorDemo.jaxx | 110 ++-- .../component/jaxx/editor/NumberEditorDemo.jaxx | 294 +++++----- .../jaxx/editor/NumberEditorDemoModel.java | 96 ++-- .../jaxx/{tree => navigation}/BaseContent.jaxx | 0 .../FullNavigationTreeDemo.jaxx | 0 .../FullNavigationTreeHelper.java | 38 +- .../component/jaxx/{tree => navigation}/Movie.java | 2 +- .../jaxx/{tree => navigation}/People.java | 2 +- .../main/resources/i18n/jaxx-demo-en_GB.properties | 18 + .../main/resources/i18n/jaxx-demo-fr_FR.properties | 18 + jaxx-demo/src/main/resources/log4j.properties | 7 +- .../main/java/jaxx/{ => runtime}/Base64Coder.java | 2 +- .../java/jaxx/runtime/DataBindingListener.java | 1 + .../jaxx/runtime/DataBindingUpdateListener.java | 1 + .../src/main/java/jaxx/runtime/JAXXAction.java | 5 +- .../src/main/java/jaxx/runtime/JAXXObject.java | 40 +- .../java/jaxx/runtime/JAXXObjectDescriptor.java | 2 +- .../src/main/java/jaxx/runtime/SwingUtil.java | 3 +- jaxx-runtime/src/main/java/jaxx/runtime/Util.java | 18 +- .../jaxx/runtime/{ => context}/DataContext.java | 3 +- .../{ => context}/DefaultApplicationContext.java | 3 +- .../runtime/{ => context}/DefaultJAXXContext.java | 5 +- .../jaxx/runtime/{ => context}/JAXXContext.java | 4 +- .../runtime/{ => context}/JAXXContextEntryDef.java | 2 +- .../runtime/{ => context}/JAXXInitialContext.java | 4 +- .../main/java/jaxx/runtime/css/DataBinding.java | 3 +- .../main/java/jaxx/runtime/css/Pseudoclasses.java | 21 +- .../src/main/java/jaxx/{ => runtime}/css/Rule.java | 8 +- .../main/java/jaxx/{ => runtime}/css/Selector.java | 13 +- .../java/jaxx/{ => runtime}/css/Stylesheet.java | 6 +- .../{beaninfos => runtime/swing}/HBoxBeanInfo.java | 30 +- .../java/jaxx/runtime/swing/JaxxHelpBroker.java | 2 +- .../jaxx/runtime/swing/LocaleListCellRenderer.java | 24 +- .../{beaninfos => runtime/swing}/VBoxBeanInfo.java | 30 +- .../NavigationTreeContextHelper.java | 6 +- .../NavigationTreeHandler.java | 6 +- .../NavigationTreeHandlerWithCardLayout.java | 4 +- .../{tree => navigation}/NavigationTreeHelper.java | 4 +- .../{tree => navigation}/NavigationTreeModel.java | 4 +- .../NavigationTreeModelBuilder.java | 6 +- .../{tree => navigation}/NavigationTreeNode.java | 6 +- .../NavigationTreeNodeRenderer.java | 2 +- .../NavigationTreeNodeRendererDecoratorImpl.java | 2 +- .../NavigationTreeNodeRendererI18nImpl.java | 2 +- .../swing/{tree => navigation}/package.html | 0 .../swing/wizard/WizardOperationAction.java | 2 +- .../swing/wizard/WizardOperationActionThread.java | 2 +- .../jaxx/runtime/swing/wizard/WizardUILancher.java | 4 +- .../DefaultApplicationContextTest.java | 12 +- .../{ => context}/DefaultJAXXContextTest.java | 3 +- .../NavigationTreeModelTest.java | 17 +- .../java/jaxx/runtime/swing/editor/I18nEditor.jaxx | 58 +- .../swing/editor/config/ConfigUIBuilder.java | 6 +- .../jaxx-runtime-swing-widget-en_GB.properties | 70 --- .../jaxx-runtime-swing-widget-fr_FR.properties | 71 --- .../resources/i18n/jaxx-widgets-en_GB.properties | 140 ++--- .../resources/i18n/jaxx-widgets-fr_FR.properties | 141 ++--- .../org/nuiton/jaxx/plugin/AbstractJaxxMojo.java | 4 +- .../org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java | 435 ++++++++------- .../nuiton/jaxx/plugin/JaxxHelpGeneratorMojo.java | 15 - .../java/org/nuiton/jaxx/plugin/Bug1750Test.java | 2 +- .../java/org/nuiton/jaxx/plugin/CompilerTest.java | 31 +- .../java/org/nuiton/jaxx/plugin/JaxxBaseTest.java | 17 +- .../nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml | 2 +- .../nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml | 2 +- .../nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml | 2 +- .../nuiton/jaxx/plugin/CompilerTest/CSSTests.xml | 2 +- .../jaxx/plugin/CompilerTest/ClassReferences.xml | 2 +- .../jaxx/plugin/CompilerTest/ClientProperty.xml | 2 +- .../ErrorJaxxContextImplementorClass.xml | 4 +- .../org/nuiton/jaxx/plugin/CompilerTest/Errors.xml | 2 +- .../org/nuiton/jaxx/plugin/CompilerTest/Force.xml | 2 +- .../org/nuiton/jaxx/plugin/CompilerTest/Icon.xml | 2 +- .../jaxx/plugin/CompilerTest/Initializers.xml | 2 +- .../jaxx/plugin/CompilerTest/InnerClasses.xml | 2 +- .../org/nuiton/jaxx/plugin/CompilerTest/NoLog.xml | 2 +- .../plugin/CompilerTest/OverridingDataBindings.xml | 2 +- .../org/nuiton/jaxx/plugin/CompilerTest/Script.xml | 2 +- .../plugin/CompilerTest/SpecialSubclassing.xml | 2 +- .../nuiton/jaxx/plugin/CompilerTest/WithLog.xml | 2 +- .../CompilerTest/errors/ItemDuplicateValues.jaxx | 4 +- .../plugin/CompilerTest/errors/ItemNoValue.jaxx | 4 +- .../CompilerValidatorTest/ValidatorErrors.xml | 2 +- .../plugin/CompilerValidatorTest/ValidatorOk.xml | 2 +- .../nuiton/jaxx/plugin/DecoratorTest/Decorator.xml | 2 +- .../nuiton/jaxx/plugin/Evolution74Test/error.xml | 2 +- .../org/nuiton/jaxx/plugin/Evolution74Test/ok.xml | 2 +- .../org/nuiton/jaxx/plugin/I18nTest/I18nText.xml | 2 +- .../org/nuiton/jaxx/plugin/I18nTest/I18nTitle.xml | 2 +- .../jaxx/plugin/I18nTest/I18nToolTipText.xml | 2 +- src/site/rst/JAXXContext.rst | 6 +- 241 files changed, 2859 insertions(+), 4231 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/DefaultInitializer.java b/jaxx-compiler/src/main/java/jaxx/DefaultInitializer.java deleted file mode 100644 index 762f5af..0000000 --- a/jaxx-compiler/src/main/java/jaxx/DefaultInitializer.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx; - -import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; -import jaxx.tags.DefaultObjectHandler; -import jaxx.tags.ScriptHandler; -import jaxx.tags.StyleHandler; -import jaxx.tags.TagManager; -import jaxx.types.PrimitiveConverter; -import jaxx.types.TypeManager; - -import java.awt.Component; -import jaxx.compiler.CompiledObjectDecorator; -import jaxx.compiler.DefaultCompiledObjectDecorator; - -/** Initializes support for java. */ -public class DefaultInitializer implements jaxx.spi.Initializer { - - @Override - public void initialize() { - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(Object.class), DefaultObjectHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(Component.class), DefaultComponentHandler.class); - TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "script", new ScriptHandler()); - TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "style", new StyleHandler()); - - PrimitiveConverter primitiveConverter = new PrimitiveConverter(); - TypeManager.registerTypeConverter(boolean.class, primitiveConverter); - TypeManager.registerTypeConverter(Boolean.class, primitiveConverter); - TypeManager.registerTypeConverter(byte.class, primitiveConverter); - TypeManager.registerTypeConverter(Byte.class, primitiveConverter); - TypeManager.registerTypeConverter(short.class, primitiveConverter); - TypeManager.registerTypeConverter(Short.class, primitiveConverter); - TypeManager.registerTypeConverter(int.class, primitiveConverter); - TypeManager.registerTypeConverter(Integer.class, primitiveConverter); - TypeManager.registerTypeConverter(long.class, primitiveConverter); - TypeManager.registerTypeConverter(Long.class, primitiveConverter); - TypeManager.registerTypeConverter(float.class, primitiveConverter); - TypeManager.registerTypeConverter(Float.class, primitiveConverter); - TypeManager.registerTypeConverter(double.class, primitiveConverter); - TypeManager.registerTypeConverter(Double.class, primitiveConverter); - TypeManager.registerTypeConverter(char.class, primitiveConverter); - TypeManager.registerTypeConverter(Character.class, primitiveConverter); - TypeManager.registerTypeConverter(String.class, primitiveConverter); - - CompiledObjectDecorator.registerDecorator("default", DefaultCompiledObjectDecorator.class); - } -} \ No newline at end of file diff --git a/jaxx-compiler/src/main/java/jaxx/ScriptException.java b/jaxx-compiler/src/main/java/jaxx/ScriptException.java deleted file mode 100644 index 1a4ea3d..0000000 --- a/jaxx-compiler/src/main/java/jaxx/ScriptException.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx; - -/** Thrown by the runtime engine when a script error occurs. */ -public class ScriptException extends RuntimeException { - private static final long serialVersionUID = 5687529939397610336L; - - /** Creates a new <code>ScriptException</code>. */ - public ScriptException() { - } - - - /** - * Creates a new <code>ScriptException</code> with the specified detail message. - * - * @param msg the exception's detail message - */ - public ScriptException(String msg) { - super(msg); - } - - - /** - * Creates a new <code>ScriptException</code> with the specified cause. - * - * @param initCause the exception's initCause - */ - public ScriptException(Throwable initCause) { - super(initCause); - } - - - /** - * Creates a new <code>ScriptException</code> with the specified detail message and cause. - * - * @param msg the exception's detail message - * @param initCause the exception's initCause - */ - public ScriptException(String msg, Throwable initCause) { - super(msg, initCause); - } -} \ No newline at end of file diff --git a/jaxx-compiler/src/main/java/jaxx/SwingInitializer.java b/jaxx-compiler/src/main/java/jaxx/SwingInitializer.java deleted file mode 100644 index a832eea..0000000 --- a/jaxx-compiler/src/main/java/jaxx/SwingInitializer.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx; - -import jaxx.beaninfos.BeanInfoUtil; - -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.BoxedCompiledObjectDecorator; -import jaxx.compiler.CompiledObjectDecorator; -import jaxx.compiler.HelpRootCompiledObjectDecorator; - -import jaxx.reflect.ClassDescriptorLoader; - -import jaxx.runtime.swing.editor.EnumEditor; -import jaxx.runtime.swing.editor.LocaleEditor; - -import jaxx.spi.Initializer; - -import jaxx.runtime.swing.*; -import jaxx.tags.*; -import jaxx.tags.swing.*; -import jaxx.types.*; - -import java.awt.*; -import javax.swing.text.JTextComponent; -import javax.swing.*; - -public class SwingInitializer implements Initializer { - - @Override - public void initialize() { - - BeanInfoUtil.addJaxxBeanInfoPath("jaxx.beaninfos"); - - //TC-20091005 why the namespace was on awt ? ButtonGroup is from javax.swing - TagManager.registerTag("javax.swing.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class))); -// TagManager.registerTag("java.awt.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class))); - - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(Application.class), ApplicationHandler.class); - - // check boxes - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JCheckBox.class), JCheckBoxHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JCheckBoxMenuItem.class), JCheckBoxHandler.class); - - // combo boxes - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JComboBox.class), JComboBoxHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(EnumEditor.class), JComboBoxHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(LocaleEditor.class), JComboBoxHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXComboBox.class), JAXXComboBoxHandler.class); - - // radio boxes - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JRadioButton.class), JRadioButtonHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JRadioButtonMenuItem.class), JRadioButtonHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JToggleButton.class), JRadioButtonHandler.class); - - // Lists - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JList.class), JListHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXList.class), JAXXListHandler.class); - - // Trees - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JTree.class), JTreeHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXTree.class), JAXXTreeHandler.class); - - // Windows - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JDialog.class), JWindowHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JFrame.class), JWindowHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JWindow.class), JWindowHandler.class); - - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JInternalFrame.class), JInternalFrameHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JMenu.class), JMenuHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JPasswordField.class), JPasswordFieldHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JPopupMenu.class), JPopupMenuHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JProgressBar.class), JProgressBarHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JScrollPane.class), JScrollPaneHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSlider.class), JSliderHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSpinner.class), JSpinnerHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JSplitPane.class), JSplitPaneHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JTabbedPane.class), JTabbedPaneHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JTextComponent.class), JTextComponentHandler.class); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JToolBar.class), JToolBarHandler.class); - - TagManager.registerDefaultNamespace("JEditorPane", "javax.swing.*"); - TagManager.registerDefaultNamespace("JFormattedTextField", "javax.swing.*"); - TagManager.registerDefaultNamespace("JPasswordField", "javax.swing.*"); - TagManager.registerDefaultNamespace("JTextArea", "javax.swing.*"); - TagManager.registerDefaultNamespace("JTextField", "javax.swing.*"); - TagManager.registerDefaultNamespace("JTextPane", "javax.swing.*"); - - TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "tab", new TabHandler()); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(Table.class), TableHandler.class); - TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "row", new RowHandler()); - TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "cell", new CellHandler()); - TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "item", new ItemHandler()); - - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(JAXXTab.class), JAXXTabHandler.class); - - TypeManager.registerTypeConverter(Color.class, new ColorConverter()); - TypeManager.registerTypeConverter(GridBagConstraints.class, new GridBagConstraintsConverter()); - TypeManager.registerTypeConverter(Insets.class, new InsetsConverter()); - TypeManager.registerTypeConverter(KeyStroke.class, new KeyStrokeConverter()); - - CompiledObjectDecorator.registerDecorator("boxed", BoxedCompiledObjectDecorator.class); - CompiledObjectDecorator.registerDecorator("help", HelpRootCompiledObjectDecorator.class); - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/BoxedCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/BoxedCompiledObjectDecorator.java deleted file mode 100644 index 2c7861e..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/BoxedCompiledObjectDecorator.java +++ /dev/null @@ -1,27 +0,0 @@ -package jaxx.compiler; - -import jaxx.compiler.CompiledObject.ChildRef; -import jaxx.runtime.SwingUtil; - -/** - * A decorator to surround a compiled object (should be a component at least) - * with a JXLayer. - * - * @author tony - * @since 1.2 - */ -public class BoxedCompiledObjectDecorator extends DefaultCompiledObjectDecorator { - - @Override - public void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName) { - CompiledObject parent = object.getParent(); - for (ChildRef child : parent.getChilds()) { - if (child.getChild() == object) { - String javaCode = child.getChildJavaCode(); - child.setChildJavaCode(SwingUtil.class.getName()+".boxComponentWithJxLayer(" + javaCode + ")"); - break; - } - } - super.finalizeCompiler(compiler, root, object, javaFile, packageName, className, fullClassName); - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/ClassMap.java b/jaxx-compiler/src/main/java/jaxx/compiler/ClassMap.java similarity index 93% rename from jaxx-compiler/src/main/java/jaxx/ClassMap.java rename to jaxx-compiler/src/main/java/jaxx/compiler/ClassMap.java index df3f358..fc0e49a 100644 --- a/jaxx-compiler/src/main/java/jaxx/ClassMap.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/ClassMap.java @@ -2,10 +2,10 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx; +package jaxx.compiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -24,9 +24,12 @@ import java.util.List; * @param <T> type of the class */ public class ClassMap<T> extends HashMap<ClassDescriptor, T> { - /** log */ - protected static final Log log = LogFactory.getLog(ClassMap.class); + private static final long serialVersionUID = 5149779660675529037L; + /** + * Logger + */ + protected static final Log log = LogFactory.getLog(ClassMap.class); /** * Keeps track of automatically-added Classes so we can distinguish them from user-added * Classes. Unknown Classes are automatically added to the map during <code>get</code> @@ -34,8 +37,6 @@ public class ClassMap<T> extends HashMap<ClassDescriptor, T> { * for their superclasses are modified. */ private List<ClassDescriptor> autoKeys = new ArrayList<ClassDescriptor>(); - private static final long serialVersionUID = 5149779660675529037L; - /** * Returns the value associated with the key <code>Class</code>. If the class itself does not have @@ -68,7 +69,6 @@ public class ClassMap<T> extends HashMap<ClassDescriptor, T> { return result; } - /** * Associates a value with a class and all of its descendents. * @@ -93,4 +93,4 @@ public class ClassMap<T> extends HashMap<ClassDescriptor, T> { } return super.put(key, value); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java index 0473f5a..ec1ff95 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java @@ -4,14 +4,14 @@ */ package jaxx.compiler; -import jaxx.CompilerException; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.reflect.MethodDescriptor; -import jaxx.tags.DefaultComponentHandler; -import jaxx.tags.TagHandler; -import jaxx.tags.TagManager; -import jaxx.types.TypeManager; +import jaxx.compiler.decorators.CompiledObjectDecorator; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.MethodDescriptor; +import jaxx.compiler.tags.DefaultComponentHandler; +import jaxx.compiler.tags.TagHandler; +import jaxx.compiler.tags.TagManager; +import jaxx.compiler.types.TypeManager; import java.awt.Container; import java.lang.reflect.Method; @@ -69,13 +69,13 @@ public class CompiledObject { /** the type of the override object (can be null if no oveeride) */ private ClassDescriptor overrideType; /** - * the decorator (if null will use {@link DefaultCompiledObjectDecorator}). + * the decorator */ private CompiledObjectDecorator decorator; /** * client properties */ - private Map<String,String> clientProperties; + private Map<String, String> clientProperties; public class ChildRef { @@ -459,14 +459,13 @@ public class CompiledObject { return clientProperties; } - /** * Returns all properties which have been set for this object. * * @return a <code>Map</code> containing all properties defined for this object * @see #addProperty */ - public Map/*<String, String>*/ getProperties() { + public Map<?, ?>/*<String, String>*/ getProperties() { return properties; } @@ -558,6 +557,7 @@ public class CompiledObject { public void registerDataBinding(String src, String property, String assignment, JAXXCompiler compiler) throws CompilerException { compiler.registerDataBinding(src, getId() + "." + property, assignment); } + public String getGenericTypes() { if (getGenericTypesLength() == 0) { // not using it @@ -635,4 +635,4 @@ public class CompiledObject { public int getGenericTypesLength() { return genericTypes == null ? 0 : genericTypes.length; } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObjectDecorator.java deleted file mode 100644 index d9d7dd9..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObjectDecorator.java +++ /dev/null @@ -1,76 +0,0 @@ -package jaxx.compiler; - -import java.util.Map; -import java.util.TreeMap; -import jaxx.CompilerException; - -/** - * - * A class to decorate a compiled object at generation time. - * - * Contains also a cache of decorator in a dictonnary indexed by fqn of decorator. - * - * Use the {@link #getDecorator(java.lang.String)} to obtain the cached decorator. - * - * Note : The implementation of this class must be stateless. - * - * @author tony - * @since 1.2 - */ -public abstract class CompiledObjectDecorator { - - protected static Map<String, CompiledObjectDecorator> cache; - - public static void registerDecorator(String key, Class<? extends CompiledObjectDecorator> klass) { - synchronized (getCache()) { - if (getCache().containsKey(key)) { - throw new IllegalArgumentException("the decorator with key [" + key + "] is already registred! use another key name"); - } - try { - getCache().put(key, klass.newInstance()); - } catch (InstantiationException ex) { - throw new IllegalArgumentException("could not create decorator " + klass + " for reason " + ex.getMessage(), ex); - } catch (IllegalAccessException ex) { - throw new IllegalArgumentException("could not create decorator " + klass + " for reason " + ex.getMessage(), ex); - } - } - } - - public static CompiledObjectDecorator getDecorator(String name) { - CompiledObjectDecorator decorator = getCache().get(name); - if (decorator == null) { - throw new IllegalArgumentException("could not find decorator with key " + name + " (known decorators : " + getCache().keySet()); - } - return decorator; - } - - public static CompiledObjectDecorator getDecorator(Class<?> type) { - for (CompiledObjectDecorator decorator : getCache().values()) { - if (type == decorator.getClass()) { - return decorator; - } - } - return null; - } - - protected static synchronized Map<String, CompiledObjectDecorator> getCache() { - if (cache == null) { - cache = new TreeMap<String, CompiledObjectDecorator>(); - } - return cache; - } - - public static void reset() { - if (cache != null) { - cache.clear(); - } - } - - public abstract void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName); - - public abstract String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException; - - public abstract boolean createInitializer(JAXXCompiler compiler, CompiledObject root, CompiledObject object, StringBuffer code, boolean lastWasMethodCall); - - public abstract String createCompleteSetupMethod(JAXXCompiler compiler, CompiledObject object, JavaFile javaFile, StringBuffer initDataBindings); -} diff --git a/jaxx-compiler/src/main/java/jaxx/CompilerException.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerException.java similarity index 93% rename from jaxx-compiler/src/main/java/jaxx/CompilerException.java rename to jaxx-compiler/src/main/java/jaxx/compiler/CompilerException.java index 27a6c72..2da7fa9 100644 --- a/jaxx-compiler/src/main/java/jaxx/CompilerException.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerException.java @@ -2,17 +2,17 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx; +package jaxx.compiler; /** Thrown by the compiler when an error occurs. */ public class CompilerException extends RuntimeException { + private static final long serialVersionUID = -9099889519671482440L; /** Creates a new <code>ParseException</code>. */ public CompilerException() { } - /** * Creates a new <code>ParseException</code> with the specified detail message. * @@ -22,7 +22,6 @@ public class CompilerException extends RuntimeException { super(msg); } - /** * Creates a new <code>ParseException</code> with the specified cause. * @@ -32,7 +31,6 @@ public class CompilerException extends RuntimeException { super(initCause); } - /** * Creates a new <code>ParseException</code> with the specified detail message and cause. * @@ -43,10 +41,10 @@ public class CompilerException extends RuntimeException { super(msg, initCause); } - + @Override public void printStackTrace() { super.printStackTrace(); System.err.println("CompilerException printed from:"); Thread.dumpStack(); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/CompilerOptions.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerOptions.java deleted file mode 100644 index 9f73694..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/CompilerOptions.java +++ /dev/null @@ -1,406 +0,0 @@ -package jaxx.compiler; - -import org.apache.commons.lang.builder.ToStringBuilder; - -import java.io.File; - -/** - * Stores options which affect the jaxxc tool's operation. These options are generally specified by the - * user on the command line. - */ -public class CompilerOptions { - private File targetDirectory; - private File javacTargetDirectory; - private String classPath; - private String javacOpts; - private boolean keepJavaFiles; - private boolean optimize; - private boolean verbose; - private boolean profile; - /** a flag to enable or disable i18n generation */ - private boolean i18nable; - - /** a flag to add or not logger on generated jaxx files */ - private boolean addLogger; - - /** a flag to not reset compiler after a compile */ - private boolean resetAfterCompile; - - /** the name of implementation of {@link jaxx.runtime.JAXXContext} to be used on {@link jaxx.runtime.JAXXObject}. */ - protected String jaxxContextImplementorClass; - - /** list of fqn of class toimport for all generated jaxx files */ - protected String[] extraImports; - - /** default error ui */ - private Class<?> defaultErrorUI; - - private ClassLoader classLoader; - - private Class<? extends JAXXCompiler> compilerClass; - - /** - * @deprecated prefer use {@link #validatorClass} - */ - @Deprecated - private String validatorFQN; - /** - * the validator class to use. - * - * @since 1.6.0 - */ - private Class<?> validatorClass; - - /** a flag to use {@link javax.swing.UIManager} to retreave icons. */ - private boolean useUIManagerForIcon; - - /** a flag to generate javax help for any */ - private boolean generateHelp; - - private String helpBrokerFQN; - /** - * The prefix to add to i18n key for any help i18n key. - * - * @since 1.3 - */ - protected String helpsetI18nPrefix; - /** - * The suffix to add to i18n key for an help Id. - * - * @since 1.3 - */ - protected String helpsetTitleI18nSuffix; - /** - * The suffix to add to i18n key for an toc Id. - * - * @since 1.3 - */ - protected String helpsetTocI18nSuffix; - /** - * The suffix to add to i18n key for an toc Id. - * - * @since 1.3 - */ - protected String helpsetIndexI18nSuffix; - /** - * The helpset name - * - * @since 1.3 - */ - protected String helpSetName; - /** the default compiled object decorator to use if none specifed via decorator attribute */ - private Class<? extends CompiledObjectDecorator> defaultDecoratorClass; - - /** - * Returns the target directory, generally specified with the "-d" option on the command line. - * - * @return the target directory - * @see #setTargetDirectory - */ - public File getJavacTargetDirectory() { - if (javacTargetDirectory == null) { - // to use the old way : if javacTargetDirectory not specified, - // use same directory as targetDirectory (says where the java sources - // are generated) - return targetDirectory; - } - return javacTargetDirectory; - } - - /** - * Returns the target directory, generally specified with the "-d" option on the command line. - * - * @return the target directory - * @see #setTargetDirectory - */ - public File getTargetDirectory() { - return targetDirectory; - } - - - /** - * Sets the target directory into which compiled classes will be placed. - * - * @param targetDirectory the target directory - * @see #getTargetDirectory - */ - public void setTargetDirectory(File targetDirectory) { - this.targetDirectory = targetDirectory; - } - - public void setJavacTargetDirectory(File javacTargetDirectory) { - this.javacTargetDirectory = javacTargetDirectory; - } - - /** - * Returns the class path to be used during compilation. - * - * @return the class path to be used during compilation - * @see #setClassPath - */ - public String getClassPath() { - return classPath; - } - - /** - * Sets the class path to be used during compilation. - * - * @param classPath the compilation class path - * @see #getClassPath - */ - public void setClassPath(String classPath) { - this.classPath = classPath; - } - - - /** - * Returns the options to be passed into <code>javac</code>. - * - * @return options to be passed into <code>javac</code> - * @see #setJavacOpts - */ - public String getJavacOpts() { - return javacOpts; - } - - - /** - * Sets options to be passed into <code>javac</code>. - * - * @param javacOpts options to be passed into <code>javac</code> - * @see #getJavacOpts - */ - public void setJavacOpts(String javacOpts) { - this.javacOpts = javacOpts; - } - - - /** - * Returns whether or not generated Java files should be preserved after compilation. - * - * @return <code>true</code> if generated Java files should be preserved, <code>false</code> to delete - * @see #setKeepJavaFiles - */ - public boolean getKeepJavaFiles() { - return keepJavaFiles; - } - - - /** - * Sets whether or not generated Java files should be preserved after compilation. - * - * @param keepJavaFiles <code>true</code> if generated Java files should be preserved, <code>false</code> to delete - * @see #getKeepJavaFiles - */ - public void setKeepJavaFiles(boolean keepJavaFiles) { - this.keepJavaFiles = keepJavaFiles; - } - - - /** - * Returns whether or not optimization should be performed. - * - * @return whether or not optimizations should be performed - */ - public boolean getOptimize() { - return optimize; - } - - - /** - * Sets whether or not optimizations should be performed. - * - * @param optimize <code>true</code> to perform optimizations during compilation - * @see #getOptimize - */ - public void setOptimize(boolean optimize) { - this.optimize = optimize; - } - - public boolean isVerbose() { - return verbose; - } - - public void setVerbose(boolean verbose) { - this.verbose = verbose; - } - - public boolean isI18nable() { - return i18nable; - } - - public boolean isUseUIManagerForIcon() { - return useUIManagerForIcon; - } - - public void setI18nable(boolean i18nable) { - this.i18nable = i18nable; - } - - public boolean isAddLogger() { - return addLogger; - } - - public void setAddLogger(boolean addLogger) { - this.addLogger = addLogger; - } - - public String getJaxxContextImplementorClass() { - return jaxxContextImplementorClass; - } - - public void setJaxxContextImplementorClass(String jaxxContextImplementorClass) { - this.jaxxContextImplementorClass = jaxxContextImplementorClass; - } - - public String[] getExtraImports() { - return extraImports; - } - - public void setExtraImports(String[] extraImports) { - this.extraImports = extraImports; - } - - public boolean isResetAfterCompile() { - return resetAfterCompile; - } - - public void setResetAfterCompile(boolean resetAfterCompile) { - this.resetAfterCompile = resetAfterCompile; - } - - public void setUseUIManagerForIcon(boolean useUIManagerForIcon) { - this.useUIManagerForIcon = useUIManagerForIcon; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - - - public void setDefaultErrorUI(Class<?> defaultErrorUI) { - this.defaultErrorUI = defaultErrorUI; - } - - public boolean isKeepJavaFiles() { - return keepJavaFiles; - } - - public boolean isOptimize() { - return optimize; - } - - public Class<?> getDefaultErrorUI() { - return defaultErrorUI; - } - - public ClassLoader getClassLoader() { - return classLoader; - } - - public void setClassLoader(ClassLoader classLoader) { - this.classLoader = classLoader; - } - - public Class<? extends JAXXCompiler> getCompilerClass() { - return compilerClass; - } - - public void setCompilerClass(Class<? extends JAXXCompiler> compilerClass) { - this.compilerClass = compilerClass; - } - - @Deprecated - public String getValidatorFQN() { - return validatorClass.getName(); - } - - @Deprecated - public void setValidatorFQN(String validatorFQN) { - this.validatorFQN = validatorFQN; - } - - public Class<? extends CompiledObjectDecorator> getDefaultDecoratorClass() { - return defaultDecoratorClass; - } - - public void setDefaultDecoratorClass(Class<? extends CompiledObjectDecorator> defaultDecoratorClass) { - this.defaultDecoratorClass = defaultDecoratorClass; - } - - public boolean isProfile() { - return profile; - } - - public void setProfile(boolean profile) { - this.profile = profile; - } - - public boolean isGenerateHelp() { - return generateHelp; - } - - public void setGenerateHelp(boolean generateHelp) { - this.generateHelp = generateHelp; - } - - public String getHelpBrokerFQN() { - return helpBrokerFQN; - } - - public void setHelpBrokerFQN(String helpBrokerFQN) { - this.helpBrokerFQN = helpBrokerFQN; - } - - public String getHelpsetIndexI18nSuffix() { - return helpsetIndexI18nSuffix; - } - - public void setHelpsetIndexI18nSuffix(String helpsetIndexI18nSuffix) { - this.helpsetIndexI18nSuffix = helpsetIndexI18nSuffix; - } - - public String getHelpsetTitleI18nSuffix() { - return helpsetTitleI18nSuffix; - } - - public void setHelpsetTitleI18nSuffix(String helpsetTitleI18nSuffix) { - this.helpsetTitleI18nSuffix = helpsetTitleI18nSuffix; - } - - public String getHelpsetTocI18nSuffix() { - return helpsetTocI18nSuffix; - } - - public void setHelpsetTocI18nSuffix(String helpsetTocI18nSuffix) { - this.helpsetTocI18nSuffix = helpsetTocI18nSuffix; - } - - public String getHelpSetName() { - return helpSetName; - } - - public void setHelpSetName(String helpSetName) { - this.helpSetName = helpSetName; - } - - public String getHelpsetI18nPrefix() { - return helpsetI18nPrefix; - } - - public void setHelpsetI18nPrefix(String helpsetI18nPrefix) { - this.helpsetI18nPrefix = helpsetI18nPrefix; - } - - public Class<?> getValidatorClass() { - return validatorClass; - } - - public void setValidatorClass(Class<?> validatorClass) { - this.validatorClass = validatorClass; - } - - - -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java b/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java index 5aceb84..99518c0 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java @@ -4,32 +4,27 @@ */ package jaxx.compiler; -import jaxx.CompilerException; -import jaxx.types.TypeManager; +import jaxx.compiler.types.TypeManager; /** * Represents a data binding in a JAXX file. <code>DataBinding</code> uses {@link DataSource} to * track changes to a source expression and update the destination. */ public class DataBinding { - private String id; + private String id; /** The DatSource which tracks source expression changes. */ private DataSource dataSource; - /** The data binding destination in the form <code><id>.<propertyName></code>. */ private String dest; - /** * A Java snippet which will cause the destination property to be updated with the current value of * the binding. */ private String assignment; - /** The current <code>JAXXCompiler</code>. */ private JAXXCompiler compiler; - /** * Creates a new data binding. * @@ -46,12 +41,10 @@ public class DataBinding { this.compiler = compiler; } - public String getId() { return id; } - /** * Compiles the data binding expression. This method calls methods in <code>JAXXCompiler</code> * to add the Java code that performs the data binding setup. @@ -89,4 +82,4 @@ public class DataBinding { compiler.appendProcessDataBinding(JAXXCompiler.getLineSeparator() + " }"); return true; } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java b/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java index 0f88ea2..6fb37d8 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java @@ -4,19 +4,17 @@ */ package jaxx.compiler; -import jaxx.CompilerException; -import jaxx.UnsupportedAttributeException; -import jaxx.parser.JavaParser; -import jaxx.parser.JavaParserConstants; -import jaxx.parser.JavaParserTreeConstants; -import jaxx.parser.SimpleNode; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.reflect.FieldDescriptor; -import jaxx.reflect.MethodDescriptor; -import jaxx.tags.DefaultObjectHandler; -import jaxx.tags.TagManager; -import jaxx.types.TypeManager; +import jaxx.compiler.parser.java.JavaParser; +import jaxx.compiler.parser.java.JavaParserConstants; +import jaxx.compiler.parser.java.JavaParserTreeConstants; +import jaxx.compiler.parser.java.SimpleNode; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.FieldDescriptor; +import jaxx.compiler.reflect.MethodDescriptor; +import jaxx.compiler.tags.DefaultObjectHandler; +import jaxx.compiler.tags.TagManager; +import jaxx.compiler.types.TypeManager; import java.beans.Introspector; import java.beans.PropertyChangeListener; @@ -34,24 +32,19 @@ import java.util.List; * changed but no event was fired). */ public class DataSource { + private class NULL { } // type attached to "null" constants in parsed expressions - private String id; - /** The Java source code for the expression. */ private String source; - /** The current <code>JAXXCompiler</code>. */ private JAXXCompiler compiler; - /** List of symbols which this data source expression depends on. */ private List<String> dependencySymbols = new ArrayList<String>(); - private StringBuffer addListenerCode = new StringBuffer(); private StringBuffer removeListenerCode = new StringBuffer(); private boolean compiled; - /** the delegate of property to be required */ private String objectCode; @@ -69,7 +62,6 @@ public class DataSource { this.compiler = compiler; } - public String getId() { return id; } @@ -97,17 +89,17 @@ public class DataSource { if (compiled) { throw new IllegalStateException(this + " has already been compiled"); } - String id = compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(getClass())); + String autoId = compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(getClass())); JavaParser p = new JavaParser(new StringReader(source + ";")); while (!p.Line()) { SimpleNode node = p.popNode(); - scanNode(node, id); + scanNode(node, autoId); } if (dependencySymbols.size() > 0) { //TC 20081108 prefer add a real JavaField instead of raw code //compiler.appendBodyCode("private PropertyChangeListener " + id + " = " + propertyChangeListenerCode + ";\n"); - compiler.addSimpleField(new JavaField(Modifier.PRIVATE, PropertyChangeListener.class.getName(), id, propertyChangeListenerCode)); + compiler.addSimpleField(new JavaField(Modifier.PRIVATE, PropertyChangeListener.class.getName(), autoId, propertyChangeListenerCode)); } compileListeners(); @@ -126,7 +118,7 @@ public class DataSource { * * @param node node to scan * @param listenerId id of listener - * @throws jaxx.CompilerException ? + * @throws CompilerException ? */ private void scanNode(SimpleNode node, String listenerId) throws CompilerException { switch (node.getId()) { @@ -147,17 +139,17 @@ public class DataSource { private ClassDescriptor determineLiteralType(SimpleNode node) { assert node.getId() == JavaParserTreeConstants.JJTLITERAL; if (node.jjtGetNumChildren() == 1) { - int id = node.getChild(0).getId(); - if (id == JavaParserTreeConstants.JJTBOOLEANLITERAL) { + int childId = node.getChild(0).getId(); + if (childId == JavaParserTreeConstants.JJTBOOLEANLITERAL) { return ClassDescriptorLoader.getClassDescriptor(boolean.class); } - if (id == JavaParserTreeConstants.JJTNULLLITERAL) { + if (childId == JavaParserTreeConstants.JJTNULLLITERAL) { return ClassDescriptorLoader.getClassDescriptor(NULL.class); } - throw new RuntimeException("Expected BooleanLiteral or NullLiteral, found " + JavaParserTreeConstants.jjtNodeName[id]); + throw new RuntimeException("Expected BooleanLiteral or NullLiteral, found " + JavaParserTreeConstants.jjtNodeName[childId]); } - int id = node.firstToken.kind; - switch (id) { + int nodeId = node.firstToken.kind; + switch (nodeId) { case JavaParserConstants.INTEGER_LITERAL: if (node.firstToken.image.toLowerCase().endsWith("l")) { return ClassDescriptorLoader.getClassDescriptor(long.class); @@ -173,7 +165,7 @@ public class DataSource { case JavaParserConstants.STRING_LITERAL: return ClassDescriptorLoader.getClassDescriptor(String.class); default: - throw new RuntimeException("Expected literal token, found " + JavaParserConstants.tokenImage[id]); + throw new RuntimeException("Expected literal token, found " + JavaParserConstants.tokenImage[nodeId]); } } @@ -221,8 +213,7 @@ public class DataSource { currentSymbol.setLength(0); accepted = true; recognizeClassNames = false; - } - catch (NoSuchFieldException e) { + } catch (NoSuchFieldException e) { if (j == 0 || j == 1 && tokens[0].equals(compiler.getRootObject().getId())) { // still in root context FieldDescriptor[] newFields = compiler.getScriptFields(); for (FieldDescriptor newField : newFields) { @@ -301,20 +292,19 @@ public class DataSource { return null; } int dotPos = lastNode.lastIndexOf("."); - String objectCode = dotPos == -1 ? "" : lastNode.substring(0, dotPos); + String code = dotPos == -1 ? "" : lastNode.substring(0, dotPos); for (int j = i - 2; j >= 0; j--) { - objectCode = expression.getChild(j).getText() + objectCode; + code = expression.getChild(j).getText() + code; } - if (objectCode.length() == 0) { - objectCode = compiler.getRootObject().getJavaCode(); + if (code.length() == 0) { + code = compiler.getRootObject().getJavaCode(); } String methodName = lastNode.substring(dotPos + 1).trim(); try { MethodDescriptor method = contextClass.getMethodDescriptor(methodName); - trackMemberIfPossible(objectCode, contextClass, method.getName(), true, listenerId); + trackMemberIfPossible(code, contextClass, method.getName(), true, listenerId); return method.getReturnType(); - } - catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { // happens for methods defined in the current JAXX file via scripts String propertyName = null; if (methodName.startsWith("is")) { @@ -361,8 +351,7 @@ public class DataSource { handler.getAddMemberListenerCode(objectCode, id, memberName, listenerId, compiler), handler.getRemoveMemberListenerCode(objectCode, id, memberName, listenerId, compiler)); } - } - catch (UnsupportedAttributeException e) { + } catch (UnsupportedAttributeException e) { // ignore -- this is thrown for methods like toString(), for which there is no tracking and // no setting support } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompiledObjectDecorator.java deleted file mode 100644 index 5e0144a..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompiledObjectDecorator.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package jaxx.compiler; - -import java.lang.reflect.Modifier; -import java.util.Map.Entry; -import jaxx.CompilerException; -import jaxx.types.TypeManager; - -/** - * The default compiledObjectDecorator. - * - * @author tony - * @since 1.2 - */ -public class DefaultCompiledObjectDecorator extends CompiledObjectDecorator { - - @Override - public void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName) { - - if (!object.isOverride() && !(object instanceof ScriptInitializer)) { - String id = object.getId(); - int access = id.startsWith("$") ? Modifier.PRIVATE : Modifier.PROTECTED; - if (object == root) { - javaFile.addField(new JavaField(access, fullClassName, id, "this")); - } else { - //TC -20081017 can have generic on compiled Object - javaFile.addField(JavaField.newField(access, JAXXCompiler.getCanonicalName(object), id), object.isJavaBean()); - } - } - - if (!compiler.inlineCreation(object) && object != root) { - javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getCreationMethodName(), getCreationCode(compiler, object))); - } - } - - @Override - public String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException { - if (object instanceof ScriptInitializer) { - return object.getInitializationCode(compiler); - } - StringBuffer result = new StringBuffer(); - if (object.isOverride() && object.getOverrideType()==object.getObjectClass()) { - //TC-20090309 on utilise le super code quand l'objet est de meme type - result.append("super.").append(object.getCreationMethodName()).append("();"); - } else { - result.append(object.getId()); - result.append(" = "); - if (object.isJavaBean() && object.getJavaBeanInitCode() != null) { - result.append(object.getJavaBeanInitCode()).append(";"); - } else { - String constructorParams = object.getConstructorParams(); - if (constructorParams != null) { - //TC - 20081017 compiledObject can have generics - result.append(" new ").append(JAXXCompiler.getCanonicalName(object)).append("(").append(constructorParams).append(");"); - //result.append("(").append(getCanonicalName(object.getObjectClass())).append(") new ").append(getCanonicalName(object.getObjectClass())).append("(").append(constructorParams).append(");"); - } else { - //TC - 20081017 compiledObject can have generics - result.append("new ").append(JAXXCompiler.getCanonicalName(object)).append("();"); - } - } - result.append(JAXXCompiler.getLineSeparator()); - result.append("$objectMap.put(").append(TypeManager.getJavaCode(object.getId())).append(", ").append(object.getId()).append(");"); - } - result.append(JAXXCompiler.getLineSeparator()); - String initCode = object.getInitializationCode(compiler); - if (initCode != null && initCode.length() > 0) { - result.append(initCode); - } - - return result.toString(); - } - - @Override - public String createCompleteSetupMethod(JAXXCompiler compiler, CompiledObject object, JavaFile javaFile, StringBuffer initDataBindings) { - StringBuffer code = new StringBuffer(); - //TC-20090327 generate client properties - if (object.hasClientProperties()) { - // generate putClientProperty invocations - for (Entry<String,String> entry : object.getClientProperties().entrySet()) { - object.appendAdditionCode(object.getJavaCode() + ".putClientProperty(\"" + entry.getKey() + "\", " + entry.getValue() + ");"); - } - - } - //TC - 20081017 only generate the method if not empty ? - if (object.getId().startsWith("$")) { - code.append(object.getAdditionCode()).append(JAXXCompiler.getLineSeparator()); - } else { - String additionCode = object.getAdditionCode(); - if (additionCode.length() > 0) { - code.append(object.getAdditionMethodName()).append("();").append(JAXXCompiler.getLineSeparator()); - additionCode = "if (!allComponentsCreated) {" + JAXXCompiler.getLineSeparator() + " return;" + JAXXCompiler.getLineSeparator() + "}" + JAXXCompiler.getLineSeparator() + additionCode; - javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getAdditionMethodName(), additionCode)); - } - } - //code.append(getLineSeparator()); - return code.toString(); - } - - @Override - public boolean createInitializer(JAXXCompiler compiler, CompiledObject root, CompiledObject object, StringBuffer code, boolean lastWasMethodCall) { - if (object == root) { - String rootCode = root.getInitializationCode(compiler); - if (rootCode != null && rootCode.length() > 0) { - code.append(rootCode); - code.append(JAXXCompiler.getLineSeparator()); - } - } else { - if (!object.isOverride()) { - if (compiler.inlineCreation(object)) { - if (lastWasMethodCall) { - lastWasMethodCall = false; - code.append(JAXXCompiler.getLineSeparator()); - } - code.append(getCreationCode(compiler, object)); - code.append(JAXXCompiler.getLineSeparator()); - } else { - code.append(object.getCreationMethodName()).append("();"); - code.append(JAXXCompiler.getLineSeparator()); - lastWasMethodCall = true; - } - } - } - return lastWasMethodCall; - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java b/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java new file mode 100644 index 0000000..543cbd1 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java @@ -0,0 +1,247 @@ +package jaxx.compiler; + +import jaxx.compiler.decorators.CompiledObjectDecorator; +import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; + +import java.io.File; +import jaxx.runtime.context.JAXXContext; + +/** + * Options of the {@link JAXXCompiler} and {@link JAXXCompilerLaunchor}. + * + */ +public class DefaultCompilerConfiguration implements CompilerConfiguration { + +// private File javacTargetDirectory; +// private String classPath; +// private String javacOpts; +// private boolean keepJavaFiles; + /** + * + */ + private File targetDirectory; + /** + * + */ + private boolean optimize; + /** + * + */ + private boolean verbose; + /** + * + */ + private boolean profile; + /** + * a flag to enable or disable i18n generation + */ + private boolean i18nable; + /** + * a flag to add or not logger on generated jaxx files + */ + private boolean addLogger; + /** + * a flag to not reset compiler after a compile + */ + private boolean resetAfterCompile; + /** + * the name of implementation of {@link jaxx.runtime.context.JAXXContext} + * to be used on {@link jaxx.runtime.JAXXObject}. + */ + protected Class<? extends JAXXContext> jaxxContextClass; + /** + * list of fqn of class to import for all generated jaxx files + */ + protected String[] extraImports; + /** + * default error ui + */ + private Class<?> defaultErrorUI; + /** + * + */ + private ClassLoader classLoader; + /** + * + */ + private Class<? extends JAXXCompiler> compilerClass; + /** + * the validator class to use. + * + * @since 1.6.0 + */ + private Class<?> validatorClass; + /** + * the default compiled object decorator to use if none specifed via + * decorator attribute + */ + private Class<? extends CompiledObjectDecorator> defaultDecoratorClass; + /** + * a flag to use {@link javax.swing.UIManager} to retreave icons. + */ + private boolean useUIManagerForIcon; + /** + * a flag to generate javax help for any + */ + private boolean generateHelp; + /** + * Fully qualified name of help broker, can not use a class here + * since this class should be in sources (so not yet compiled) + */ + private String helpBrokerFQN; + /** + * The prefix to add to i18n key for any help i18n key. + * + * @since 1.3 + */ + protected String helpsetI18nPrefix; + /** + * The suffix to add to i18n key for an help Id. + * + * @since 1.3 + */ + protected String helpsetTitleI18nSuffix; + /** + * The suffix to add to i18n key for an toc Id. + * + * @since 1.3 + */ + protected String helpsetTocI18nSuffix; + /** + * The suffix to add to i18n key for an toc Id. + * + * @since 1.3 + */ + protected String helpsetIndexI18nSuffix; + /** + * The helpset name + * + * @since 1.3 + */ + protected String helpSetName; + + @Override + public File getTargetDirectory() { + return targetDirectory; + } + + @Override + public boolean getOptimize() { + return optimize; + } + + @Override + public boolean isVerbose() { + return verbose; + } + + public void setVerbose(boolean verbose) { + this.verbose = verbose; + } + + @Override + public boolean isI18nable() { + return i18nable; + } + + @Override + public boolean isUseUIManagerForIcon() { + return useUIManagerForIcon; + } + + @Override + public boolean isAddLogger() { + return addLogger; + } + + @Override + public Class<? extends JAXXContext> getJaxxContextClass() { + return jaxxContextClass; + } + + @Override + public String[] getExtraImports() { + return extraImports; + } + + @Override + public boolean isResetAfterCompile() { + return resetAfterCompile; + } + + @Override + public boolean isOptimize() { + return optimize; + } + + @Override + public Class<?> getDefaultErrorUI() { + return defaultErrorUI; + } + + @Override + public ClassLoader getClassLoader() { + return classLoader; + } + + @Override + public Class<? extends JAXXCompiler> getCompilerClass() { + return compilerClass; + } + + @Override + public Class<? extends CompiledObjectDecorator> getDefaultDecoratorClass() { + return defaultDecoratorClass; + } + + @Override + public boolean isProfile() { + return profile; + } + + @Override + public boolean isGenerateHelp() { + return generateHelp; + } + + @Override + public String getHelpBrokerFQN() { + return helpBrokerFQN; + } + + @Override + public String getHelpsetIndexI18nSuffix() { + return helpsetIndexI18nSuffix; + } + + @Override + public String getHelpsetTitleI18nSuffix() { + return helpsetTitleI18nSuffix; + } + + @Override + public String getHelpsetTocI18nSuffix() { + return helpsetTocI18nSuffix; + } + + @Override + public String getHelpSetName() { + return helpSetName; + } + + @Override + public String getHelpsetI18nPrefix() { + return helpsetI18nPrefix; + } + + @Override + public Class<?> getValidatorClass() { + return validatorClass; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/EventHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/EventHandler.java index 01a54a8..506f269 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/EventHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/EventHandler.java @@ -4,10 +4,11 @@ */ package jaxx.compiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.MethodDescriptor; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.MethodDescriptor; public class EventHandler { + private String eventId; private String objectCode; private ClassDescriptor listenerClass; @@ -24,38 +25,32 @@ public class EventHandler { this.javaCode = javaCode; } - public String getEventId() { return eventId; } - public String getObjectCode() { return objectCode; } - public MethodDescriptor getAddMethod() { return addMethod; } - public ClassDescriptor getListenerClass() { return listenerClass; } - public MethodDescriptor getListenerMethod() { return listenerMethod; } - public String getJavaCode() { return javaCode; } - + @Override public String toString() { return "EventHandler[" + eventId + ", " + listenerClass.getName() + ", " + objectCode + ", " + javaCode + "]"; } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/HelpRootCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/HelpRootCompiledObjectDecorator.java deleted file mode 100644 index 14cd185..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/HelpRootCompiledObjectDecorator.java +++ /dev/null @@ -1,93 +0,0 @@ -package jaxx.compiler; - -import java.lang.reflect.Modifier; -import java.util.Iterator; -import java.util.Set; - -/** - * A decorator to place on a root compiled object to process javaHelp on the file. - * - * @author tony - * @since 1.2 - */ -public class HelpRootCompiledObjectDecorator extends DefaultCompiledObjectDecorator { - - /** - * the list of discovered helpId - */ - protected static Set<String> helpIds = new java.util.HashSet<String>(); - - protected String getBrokerFQN(JAXXCompiler compiler) { - String helpBrokerFQN = compiler.getOptions().getHelpBrokerFQN(); - return helpBrokerFQN; - } - - protected String getHelpId(CompiledObject o) { - String helpID = null; - if (o.hasClientProperties()) { - helpID = o.getClientProperty("help"); - } - return helpID; - } - - @Override - public void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName) { - super.finalizeCompiler(compiler, root, object, javaFile, packageName, className, fullClassName); - CompilerOptions options = compiler.getOptions(); - - if (options.isGenerateHelp()) { - - // add JaxxHelpUI interface - Class<?> validatorInterface = jaxx.runtime.JaxxHelpUI.class; - String helpBrokerFQN = getBrokerFQN(compiler); - javaFile.addInterface(JAXXCompiler.getCanonicalName(validatorInterface) + "<" + helpBrokerFQN + ">"); - - javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", "registerHelpId", - "broker.installUI(component, helpId);", - new JavaArgument(helpBrokerFQN, "broker"), - new JavaArgument("Component", "component"), - new JavaArgument("String", "helpId"))); - - javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", "showHelp", - "getBroker().showHelp(this, helpId);", - new JavaArgument("String", "helpId"))); - - StringBuilder buffer = new StringBuilder(); - - String lineSeparator = JAXXCompiler.getLineSeparator(); - - if (options.isGenerateHelp()) { - - // add code to init javax help system - Iterator<CompiledObject> itr = compiler.getObjectCreationOrder(); - - for (; itr.hasNext();) { - CompiledObject o = itr.next(); - String helpID = getHelpId(o); - if (helpID != null) { - buffer.append(lineSeparator); - // detects a helpId to register - buffer.append("registerHelpId(_broker, " + o.getJavaCode() + ", " + helpID + ");"); - //keep the helpID for helpSet generation - helpIds.add(helpID); - } - } - } - if (buffer.length() > 0) { - - StringBuilder extraCode = new StringBuilder(helpBrokerFQN).append(" _broker = getBroker();"); - - buffer.append(lineSeparator).append("_broker.prepareUI(this);"); - buffer.append(lineSeparator); - - // add the calls - compiler.appendLateInitializer(extraCode.toString()); - compiler.appendLateInitializer(buffer.toString()); - } - } - } - - public static Set<String> getHelpIds() { - return helpIds; - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/I18nHelper.java b/jaxx-compiler/src/main/java/jaxx/compiler/I18nHelper.java index c928cbd..f38a840 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/I18nHelper.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/I18nHelper.java @@ -1,6 +1,5 @@ package jaxx.compiler; -import jaxx.tags.DefaultComponentHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -16,8 +15,7 @@ import java.util.List; */ public class I18nHelper { - protected static final Log log = LogFactory.getLog(DefaultComponentHandler.class); - + protected static final Log log = LogFactory.getLog(I18nHelper.class); public static final List<String> I18N_ATTRIBUTES = Arrays.asList("text", "title", "toolTipText"); /** @@ -28,7 +26,7 @@ public class I18nHelper { * @return <code>true</code> if wa have an active i18n attribute, <code>false</code> otherwise. */ public static boolean isI18nableAttribute(String attributeName, JAXXCompiler compiler) { - return compiler.getOptions().isI18nable() && isI18nAttribute(attributeName); + return compiler.getConfiguration().isI18nable() && isI18nAttribute(attributeName); } /** @@ -40,6 +38,7 @@ public class I18nHelper { public static boolean isI18nAttribute(String attributeName) { return I18N_ATTRIBUTES.contains(attributeName); } + /** * Add the i18n on a attribute. * <p/> @@ -60,7 +59,7 @@ public class I18nHelper { log.debug(" try i18n support for [" + widgetId + ":" + attributeName + "] : " + attributeValueCode); } if (attributeValueCode.contains("_(") && attributeValueCode.contains(")")) { - compiler.reportWarning("\n\tjaxx supports i18n, no need to add explicit call to I18n._ for attribute '" + attributeName + "' in component '" + widgetId + "' : ["+attributeValueCode+"]"); + compiler.reportWarning("\n\tjaxx supports i18n, no need to add explicit call to I18n._ for attribute '" + attributeName + "' in component '" + widgetId + "' : [" + attributeValueCode + "]"); } else { attributeValueCode = "_(" + attributeValueCode + ")"; } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java index b34cd3a..3beaa21 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java @@ -4,22 +4,21 @@ */ package jaxx.compiler; -import jaxx.CompilerException; -import jaxx.UnsupportedAttributeException; -import jaxx.UnsupportedTagException; -import jaxx.css.Rule; -import jaxx.css.Stylesheet; -import jaxx.css.StylesheetHelper; -import jaxx.parser.ParseException; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.reflect.FieldDescriptor; -import jaxx.reflect.MethodDescriptor; +import jaxx.compiler.decorators.CompiledObjectDecorator; +import jaxx.compiler.decorators.CompiledObjectDecoratorManager; +import jaxx.compiler.generators.Generator; +import jaxx.compiler.parser.java.ParseException; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.FieldDescriptor; +import jaxx.compiler.reflect.MethodDescriptor; +import jaxx.compiler.tags.DefaultObjectHandler; +import jaxx.compiler.tags.TagHandler; +import jaxx.compiler.tags.TagManager; import jaxx.runtime.ComponentDescriptor; import jaxx.runtime.JAXXObjectDescriptor; -import jaxx.tags.DefaultObjectHandler; -import jaxx.tags.TagHandler; -import jaxx.tags.TagManager; +import jaxx.runtime.css.Rule; +import jaxx.runtime.css.Stylesheet; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; @@ -50,9 +49,7 @@ import java.io.InputStream; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.lang.reflect.Modifier; -import java.net.MalformedURLException; import java.net.URL; -import java.net.URLClassLoader; import java.net.URLDecoder; import java.util.ArrayList; import java.util.Arrays; @@ -76,7 +73,6 @@ public class JAXXCompiler { /** log */ protected static final Log log = LogFactory.getLog(JAXXCompiler.class); - /** * True to throw exceptions when we encounter unresolvable classes, false to ignore. * This is currently set to false until JAXX has full support for inner classes @@ -84,158 +80,225 @@ public class JAXXCompiler { * generally compile without error anyway). */ public static final boolean STRICT_CHECKS = false; + /** + * + */ public static final String JAXX_NAMESPACE = "http://www.jaxxframework.org/"; + /** + * + */ public static final String JAXX_INTERNAL_NAMESPACE = "http://www.jaxxframework.org/internal"; - - /** Maximum length of an inlinable creation method. */ + /** + * Maximum length of an inlinable creation method. + */ public static final int INLINE_THRESHOLD = 300; - + /** + * + */ protected final DefaultObjectHandler firstPassClassTagHandler; - + /** + * + */ protected List<String> staticImports = new ArrayList<String>(); /*---------------------------------------------------------------------------------*/ /*-- compiler fields --------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/ - - /** flag to detec if an error occurs while compiling jaxx file */ + /** + * flag to detec if an error occurs while compiling jaxx file + */ protected boolean failed; - - /** Object corresponding to the root tag in the document. */ + /** + * Object corresponding to the root tag in the document. + */ protected CompiledObject root; - - /** Contains strings of the form "javax.swing." */ + /** + * Contains strings of the form "javax.swing." + */ protected Set<String> importedPackages = new HashSet<String>(); - - /** Contains strings of the form "javax.swing.Timer" */ + /** + * Contains strings of the form "javax.swing.Timer" + */ protected Set<String> importedClasses = new HashSet<String>(); - - /** Keeps track of open components (components still having children added). */ + /** + * Keeps track of open components (components still having children added). + */ protected Stack<CompiledObject> openComponents = new Stack<CompiledObject>(); - - /** Sequence number used to create automatic variable names. */ + /** + * Sequence number used to create automatic variable names. + */ protected int autogenID = 0; - + /** + * + */ protected List<DataBinding> dataBindings = new ArrayList<DataBinding>(); - + /** + * + */ protected SymbolTable symbolTable = new SymbolTable(); - - /** Base directory used for path resolution (normally the directory in which the .jaxx file resides). */ + /** + * Base directory used for path resolution (normally the directory in + * which the .jaxx file resides). + */ protected File baseDir; - - /** .jaxx file being compiled. */ + /** + * .jaxx file being compiled. + */ protected File src; - - /** Parsed XML of src file. */ + /** + * Parsed XML of src file. + */ protected Document document; - - /** Name of class being compiled. */ + /** + * Name of class being compiled. + */ protected String outputClassName; - + /** + * + */ protected ScriptManager scriptManager = new ScriptManager(this); - - /** Combination of all stylesheets registered using {@link #registerStylesheet}. */ + /** + * Combination of all stylesheets registered using + * {@link #registerStylesheet}. + */ protected Stylesheet stylesheet; - - /** Contains all attributes defined inline on class tags. */ + /** + * Contains all attributes defined inline on class tags. + */ protected List<Rule> inlineStyles = new ArrayList<Rule>(); - /** * Maps objects (expressed in Java code) to event listener classes (e.g. MouseListener) to Lists of EventHandlers. The final list * contains all event handlers of a particular type attached to a particular object (again, as represented by a Java expression). */ protected Map<String, Map<ClassDescriptor, List<EventHandler>>> eventHandlers = new HashMap<String, Map<ClassDescriptor, List<EventHandler>>>(); - - /** Maps of uniqued id for objects used in compiler */ + /** + * Maps of uniqued id for objects used in compiler + */ protected Map<Object, String> uniqueIds = new HashMap<Object, String>(); - - /** Map of event handler method names used in compiler */ + /** + * Map of event handler method names used in compiler + */ protected Map<EventHandler, String> eventHandlerMethodNames = new HashMap<EventHandler, String>(); - - /** ClassLoader which searches the user-specified class path in addition to the normal class path */ + /** + * ClassLoader which searches the user-specified class path in addition to the normal class path + */ protected ClassLoader classLoader; - /** * A list of Runnables which will be run after the first compilation pass. This is primarily used * to trigger the creation of CompiledObjects, which cannot be created during the first pass and must be * created in document order. */ protected List<Runnable> initializers = new ArrayList<Runnable>(); - - /** left brace matcher */ + /** + * left brace matcher + */ protected Matcher leftBraceMatcher = Pattern.compile("^(\\{)|[^\\\\](\\{)").matcher(""); - - /** right brace matcher */ + /** + * right brace matcher + */ protected Matcher rightBraceMatcher = Pattern.compile("^(\\})|[^\\\\](\\})").matcher(""); - - /** extra interfaces which can by passed to root object via the 'implements' attribute */ + /** + * extra interfaces which can by passed to root object via the 'implements' attribute + */ private String[] extraInterfaces; - - /** a flag to generate a abstract class */ + /** + * a flag to generate a abstract class + */ private boolean abstractClass; - - /** the possible generic type of the class */ + /** + * the possible generic type of the class + */ private String genericType; - - /** thepossible generic type of the super class */ + /** + * the possible generic type of the super class + */ private String superGenericType; - - /** Extra code to be added to the instance initializer. */ + /** + * Extra code to be added to the instance initializer. + */ protected StringBuffer initializer = new StringBuffer(); - - /** Extra code to be added at the end of the instance initializer. */ + /** + * Extra code to be added at the end of the instance initializer. + */ protected StringBuffer lateInitializer = new StringBuffer(); - - /** Extra code to be added to the class body. */ + /** + * Extra code to be added to the class body. + */ protected StringBuffer bodyCode = new StringBuffer(); - - /** Code to initialize data bindings. */ + /** + * Code to initialize data bindings. + */ protected StringBuffer initDataBindings = new StringBuffer(); - - /** Body of the applyDataBinding method. */ + /** + * Body of the applyDataBinding method. + */ protected StringBuffer applyDataBinding = new StringBuffer(); - - /** Body of the removeDataBinding method. */ + /** + * Body of the removeDataBinding method. + */ protected StringBuffer removeDataBinding = new StringBuffer(); - - /** Body of the processDataBinding method. */ + /** + * Body of the processDataBinding method. + */ protected StringBuffer processDataBinding = new StringBuffer(); - - /** true if a main() method has been declared in a script */ + /** + * true if a main() method has been declared in a script + */ protected boolean mainDeclared; - - /** the file to be generated */ + /** + * the file to be generated + */ protected JavaFile javaFile; - - - protected CompilerOptions options; - - /** Used for error reporting purposes, so we can report the right line number. */ + /** + * + */ + protected CompilerConfiguration configuration; + /** + * Used for error reporting purposes, so we can report the right line number. + */ protected Stack<Element> tagsBeingCompiled = new Stack<Element>(); - - /** Used for error reporting purposes, so we can report the right source file. */ + /** + * Used for error reporting purposes, so we can report the right source file. + */ protected Stack<File> sourceFiles = new Stack<File>(); - - /** Maps object ID strings to the objects themselves. These are created during the second compilation pass. */ + /** + * Maps object ID strings to the objects themselves. These are created during the second compilation pass. + */ protected Map<String, CompiledObject> objects = new LinkedHashMap<String, CompiledObject>(); - - /** Maps objects to their ID strings. These are created during the second compilation pass. */ + /** + * Maps objects to their ID strings. These are created during the second compilation pass. + */ protected Map<CompiledObject, String> ids = new LinkedHashMap<CompiledObject, String>(); - + /** + * + */ protected CompiledObjectDecorator defaultDecorator; - + /*---------------------------------------------------------------------------------*/ /*-- Constructor methods ----------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/ + protected JAXXCompiler(ClassLoader classLoader) { - protected JAXXCompiler(ClassLoader classLoader, DefaultObjectHandler firstPassClassTagHandler, String... staticImports) { - this.firstPassClassTagHandler = firstPassClassTagHandler; - this.options = new CompilerOptions(); + this.firstPassClassTagHandler = new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(Object.class)); + this.configuration = new DefaultCompilerConfiguration(); this.classLoader = classLoader; - if (staticImports == null || staticImports.length == 0) { - staticImports = new String[0]; - } - this.staticImports = Arrays.asList(staticImports); +// this.staticImports = Arrays.asList(new String[]{ +// "java.awt.*", +// "java.awt.event.*", +// "java.beans.*", +// "java.io.*", +// "java.lang.*", +// "java.util.*", +// "javax.swing.*", +// "javax.swing.border.*", +// "javax.swing.event.*", +// "jaxx.runtime.swing.JAXXButtonGroup", +// "jaxx.runtime.swing.HBox", +// "jaxx.runtime.swing.VBox", +// "jaxx.runtime.swing.Table", +// "static org.nuiton.i18n.I18n._", +// "static jaxx.runtime.Util.createImageIcon" +// }); addImport("java.lang.*"); } @@ -245,42 +308,52 @@ public class JAXXCompiler { * @param baseDir classpath location * @param src location of file to compile * @param outputClassName the out file name - * @param options options to pass to javac - * @param firstPassClassTagHandler handler to use for first pass - * @param staticImports statics imports + * @param configuration configuration to pass to javac */ - protected JAXXCompiler(File baseDir, File src, String outputClassName, CompilerOptions options, DefaultObjectHandler firstPassClassTagHandler, String... staticImports) { + public JAXXCompiler(File baseDir, File src, String outputClassName, CompilerConfiguration configuration) { this.baseDir = baseDir; this.src = src; - this.firstPassClassTagHandler = firstPassClassTagHandler; - this.staticImports = Arrays.asList(staticImports); + this.firstPassClassTagHandler = new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(Object.class)); + this.staticImports = Arrays.asList(new String[]{ + "java.awt.*", + "java.awt.event.*", + "java.beans.*", + "java.io.*", + "java.lang.*", + "java.util.*", + "javax.swing.*", + "javax.swing.border.*", + "javax.swing.event.*", + "jaxx.runtime.swing.JAXXButtonGroup", + "jaxx.runtime.swing.HBox", + "jaxx.runtime.swing.VBox", + "jaxx.runtime.swing.Table", + "static org.nuiton.i18n.I18n._", + "static jaxx.runtime.Util.createImageIcon" + }); sourceFiles.push(src); this.outputClassName = outputClassName; - this.options = options; + this.configuration = configuration; addImport(outputClassName.substring(0, outputClassName.lastIndexOf(".") + 1) + "*"); - if (staticImports == null || staticImports.length == 0) { - staticImports = new String[]{"java.lang.*"}; - } for (Object staticImport : staticImports) { addImport((String) staticImport); } - // add extra imports from options - if (options.getExtraImports() != null) { - for (String extraImport : options.getExtraImports()) { + // add extra imports from configuration + if (configuration.getExtraImports() != null) { + for (String extraImport : configuration.getExtraImports()) { addImport(extraImport); } } - defaultDecorator = CompiledObjectDecorator.getDecorator(options.getDefaultDecoratorClass()); + defaultDecorator = CompiledObjectDecoratorManager.getDecorator(configuration.getDefaultDecoratorClass()); if (defaultDecorator == null) { - log.error("could not find default decorator : "+options.getDefaultDecoratorClass()); - throw new IllegalArgumentException("could not find default decorator : " + options.getDefaultDecoratorClass()); + log.error("could not find default decorator : " + configuration.getDefaultDecoratorClass()); + throw new IllegalArgumentException("could not find default decorator : " + configuration.getDefaultDecoratorClass()); } } /*---------------------------------------------------------------------------------*/ /*-- Initializer methods -----------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/ - public void runInitializers() { for (Runnable runnable : initializers) { if (log.isDebugEnabled()) { @@ -297,7 +370,6 @@ public class JAXXCompiler { initializers.clear(); } - /** * Registers a <code>Runnable</code> which will be executed after the first * compilation pass is complete. @@ -311,7 +383,6 @@ public class JAXXCompiler { /*---------------------------------------------------------------------------------*/ /*-- Compile methods --------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/ - public void compileFirstPass(final Element tag) throws IOException { tagsBeingCompiled.push(tag); @@ -322,13 +393,14 @@ public class JAXXCompiler { // resolve class tags into fully-qualified class name if (namespace != null && namespace.endsWith("*")) { String packageName = namespace.substring(0, namespace.length() - 1); - if (localName.startsWith(packageName)) // class name is fully-qualified already - { + if (localName.startsWith(packageName)) { + // class name is fully-qualified already fullClassName = TagManager.resolveClassName(localName, this); - } else { // namespace not included in class name, probably need the namespace to resolve + } else { + // namespace not included in class name, probably need the namespace to resolve fullClassName = TagManager.resolveClassName(packageName + localName, this); - if (fullClassName == null && !namespacePrefix) // it was just a default namespace, try again without using the namespace - { + if (fullClassName == null && !namespacePrefix) { + // it was just a default namespace, try again without using the namespace fullClassName = TagManager.resolveClassName(localName, this); } } @@ -336,7 +408,8 @@ public class JAXXCompiler { fullClassName = TagManager.resolveClassName(localName, this); } - if (fullClassName != null) { // we are definitely dealing with a class tag + if (fullClassName != null) { + // we are definitely dealing with a class tag addDependencyClass(fullClassName); namespace = fullClassName.substring(0, fullClassName.lastIndexOf(".") + 1) + "*"; if (symbolTable.getSuperclassName() == null) { @@ -369,7 +442,8 @@ public class JAXXCompiler { } if (handler == firstPassClassTagHandler) { final String finalClassName = fullClassName; - registerInitializer(new Runnable() { // register an initializer which will create the CompiledObject after pass 1 + registerInitializer(new Runnable() { + // register an initializer which will create the CompiledObject after pass 1 @Override public void run() { @@ -384,8 +458,7 @@ public class JAXXCompiler { if (handler != null) { try { handler.compileFirstPass(tag, this); - } - catch (CompilerException e) { + } catch (CompilerException e) { reportError(e); } } else { @@ -399,7 +472,6 @@ public class JAXXCompiler { } } - public void compileSecondPass(Element tag) throws IOException { tagsBeingCompiled.push(tag); @@ -425,11 +497,9 @@ public class JAXXCompiler { document = parseDocument(in); in.close(); compileFirstPass(document.getDocumentElement()); - } - catch (SAXParseException e) { + } catch (SAXParseException e) { reportError(e.getLineNumber(), "Invalid XML: " + e.getMessage()); - } - catch (SAXException e) { + } catch (SAXException e) { reportError(null, "Error parsing XML document: " + e); } } @@ -444,7 +514,6 @@ public class JAXXCompiler { /*---------------------------------------------------------------------------------*/ /*-- CompiledObject methods -------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/ - public void openComponent(CompiledObject component) throws CompilerException { openComponent(component, null); } @@ -504,7 +573,6 @@ public class JAXXCompiler { return objects.get(id); } - public boolean inlineCreation(CompiledObject object) { return object.getId().startsWith("$") && object.getInitializationCode(this).length() < INLINE_THRESHOLD; } @@ -526,8 +594,7 @@ public class JAXXCompiler { object.setOverride(true); object.setOverrideType(f.getType()); break; - } - catch (NoSuchFieldException e) { + } catch (NoSuchFieldException e) { ancestor = ancestor.getSuperclass(); } } @@ -536,7 +603,6 @@ public class JAXXCompiler { /*---------------------------------------------------------------------------------*/ /*-- DataBinding methods ----------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/ - /** * Examine an attribute value for data binding expressions. Returns a 'cooked' expression which * can be used to determine the resulting value. It is expected that this expression will be used @@ -546,7 +612,7 @@ public class JAXXCompiler { * @param stringValue the string value of the property from the XML * @param type the type of the property, from the <code>JAXXPropertyDescriptor</code> * @return a processed version of the expression - * @throws jaxx.CompilerException ? + * @throws CompilerException ? */ public String processDataBindings(String stringValue, ClassDescriptor type) throws CompilerException { int pos = getNextLeftBrace(stringValue, 0); @@ -596,13 +662,11 @@ public class JAXXCompiler { return null; } - public void registerDataBinding(String src, String dest, String assignment) { try { src = checkJavaCode(src); dataBindings.add(new DataBinding(src, dest, assignment, this)); - } - catch (CompilerException e) { + } catch (CompilerException e) { reportError("While parsing data binding for '" + dest.substring(dest.lastIndexOf(".") + 1) + "': " + e.getMessage()); } } @@ -626,13 +690,13 @@ public class JAXXCompiler { public String getEventHandlerMethodName(EventHandler handler) { String result = eventHandlerMethodNames.get(handler); if (result == null) { - if (getOptions().isOptimize()) { + if (getConfiguration().isOptimize()) { result = "$ev" + eventHandlerMethodNames.size(); } else { //TC-20090309 must get the goal property from the event id // to make possible inheritance - String id = handler.getEventId().substring(0,handler.getEventId().indexOf(".")); - + String id = handler.getEventId().substring(0, handler.getEventId().indexOf(".")); + result = "do" + org.apache.commons.lang.StringUtils.capitalize(handler.getListenerMethod().getName()) + "__on__" + id; //result = "do" + org.apache.commons.lang.StringUtils.capitalize(handler.getListenerMethod().getName()) + "__on__" + handler.getObjectCode(); } @@ -644,7 +708,6 @@ public class JAXXCompiler { /*---------------------------------------------------------------------------------*/ /*-- Script methods ---------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/ - public void addScriptField(FieldDescriptor field) { symbolTable.getScriptFields().add(field); } @@ -685,7 +748,6 @@ public class JAXXCompiler { /*---------------------------------------------------------------------------------*/ /*-- StyleSheet methods -----------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/ - public void applyStylesheets() { for (Object o : new ArrayList<CompiledObject>(objects.values())) { CompiledObject object = (CompiledObject) o; @@ -708,7 +770,6 @@ public class JAXXCompiler { /*---------------------------------------------------------------------------------*/ /*-- Report methods ---------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/ - public void reportWarning(String warning) { Element currentTag = null; if (!tagsBeingCompiled.isEmpty()) { @@ -717,7 +778,6 @@ public class JAXXCompiler { reportWarning(currentTag, warning, 0); } - public void reportWarning(Element tag, String warning, int lineOffset) { String lineNumber = null; if (tag != null) { @@ -729,8 +789,7 @@ public class JAXXCompiler { File srcFile = sourceFiles.peek(); try { srcFile = srcFile.getCanonicalFile(); - } - catch (IOException e) { + } catch (IOException e) { // ignore ? } @@ -742,7 +801,6 @@ public class JAXXCompiler { JAXXCompilerLaunchor.get().warningCount++; } - public void reportError(String error) { Element currentTag = null; if (!tagsBeingCompiled.isEmpty()) { @@ -795,8 +853,7 @@ public class JAXXCompiler { if (errorFile != null) { errorFile = errorFile.getCanonicalFile(); } - } - catch (IOException e) { + } catch (IOException e) { // ignore ? } @@ -812,7 +869,6 @@ public class JAXXCompiler { /*---------------------------------------------------------------------------------*/ /*-- Getter methods ---------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/ - public Map<String, CompiledObject> getObjects() { return objects; } @@ -822,15 +878,14 @@ public class JAXXCompiler { } /*public List<CompiledBeanValidator> getValidators() { - return validators; + return validators; }*/ - public Map<String, Map<ClassDescriptor, List<EventHandler>>> getEventHandlers() { return eventHandlers; } - public CompilerOptions getOptions() { - return options; + public CompilerConfiguration getConfiguration() { + return configuration; } public String getOutputClassName() { @@ -889,10 +944,10 @@ public class JAXXCompiler { } public MethodDescriptor getScriptMethod(String methodName) { - for (MethodDescriptor m :symbolTable.getScriptMethods()) { - if (methodName.equals(m.getName())) { - return m; - } + for (MethodDescriptor m : symbolTable.getScriptMethods()) { + if (methodName.equals(m.getName())) { + return m; + } } return null; } @@ -909,24 +964,24 @@ public class JAXXCompiler { */ public ClassLoader getClassLoader() { if (classLoader == null) { - if (options.getClassLoader() != null) { - classLoader = options.getClassLoader(); + if (configuration.getClassLoader() != null) { + classLoader = configuration.getClassLoader(); } else { - String classPath = options.getClassPath(); - if (classPath == null) { - classPath = "."; - } - String[] paths = classPath.split(File.pathSeparator); - URL[] urls = new URL[paths.length]; - for (int i = 0; i < paths.length; i++) { - try { - urls[i] = new File(paths[i]).toURI().toURL(); - } - catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } - classLoader = new URLClassLoader(urls, getClass().getClassLoader()); + throw new NullPointerException("compiler configuration requires a classLoader! :\n" + configuration); +// String classPath = configuration.getClassPath(); +// if (classPath == null) { +// classPath = "."; +// } +// String[] paths = classPath.split(File.pathSeparator); +// URL[] urls = new URL[paths.length]; +// for (int i = 0; i < paths.length; i++) { +// try { +// urls[i] = new File(paths[i]).toURI().toURL(); +// } catch (MalformedURLException e) { +// throw new RuntimeException(e); +// } +// } +// classLoader = new URLClassLoader(urls, getClass().getClassLoader()); } } @@ -945,7 +1000,8 @@ public class JAXXCompiler { CompiledObject parent = components[i].getParent(); while (parent != null) { boolean found = false; - for (int j = i + 1; j < components.length; j++) { // found parent after component, swap them + for (int j = i + 1; j < components.length; j++) { + // found parent after component, swap them if (components[j] == parent) { components[j] = components[i]; components[i] = parent; @@ -967,7 +1023,8 @@ public class JAXXCompiler { } } } - descriptors[i] = new ComponentDescriptor(components[i].getId(), components[i] == root ? outputClassName : components[i].getObjectClass().getName(), + descriptors[i] = new ComponentDescriptor( + components[i].getId(), components[i] == root ? outputClassName : components[i].getObjectClass().getName(), components[i].getStyleClass(), parentIndex != -1 ? descriptors[parentIndex] : null); } @@ -982,7 +1039,6 @@ public class JAXXCompiler { /*---------------------------------------------------------------------------------*/ /*-- Setter methods ---------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/ - public void setFailed(boolean failed) { this.failed = failed; } @@ -990,7 +1046,6 @@ public class JAXXCompiler { /*---------------------------------------------------------------------------------*/ /*-- Buffer ------------------------------------*/ /*---------------------------------------------------------------------------------*/ - public StringBuffer getInitializer() { return initializer; } @@ -1084,7 +1139,6 @@ public class JAXXCompiler { /*---------------------------------------------------------------------------------*/ /*-- Other methods ----------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/ - public void addImport(String text) { if (text.endsWith("*")) { importedPackages.add(text.substring(0, text.length() - 1)); @@ -1098,6 +1152,7 @@ public class JAXXCompiler { } public void addDependencyClass(String className) { + if (!JAXXCompilerLaunchor.get().jaxxFileClassNames.contains(className)) { URL jaxxURL = getClassLoader().getResource(className.replace('.', '/') + ".jaxx"); URL classURL = getClassLoader().getResource(className.replace('.', '/') + ".class"); @@ -1108,8 +1163,7 @@ public class JAXXCompiler { if (classFile.lastModified() > jaxxFile.lastModified()) { return; // class file is newer, no need to recompile } - } - catch (Exception e) { + } catch (Exception e) { // do nothing } } @@ -1118,8 +1172,7 @@ public class JAXXCompiler { File jaxxFile = URLtoFile(jaxxURL); try { jaxxFile = jaxxFile.getCanonicalFile(); - } - catch (IOException ex) { + } catch (IOException ex) { // ignore ? } assert jaxxFile.getName().equalsIgnoreCase(className.substring(className.lastIndexOf(".") + 1) + ".jaxx") : @@ -1141,7 +1194,7 @@ public class JAXXCompiler { * * @param javaCode the Java code snippet to test * @return a "cooked" version of the string which has enclosing curly braces removed. - * @throws jaxx.CompilerException if the code cannot be parsed + * @throws CompilerException if the code cannot be parsed */ public String checkJavaCode(String javaCode) { javaCode = scriptManager.trimScript(javaCode); @@ -1265,7 +1318,7 @@ public class JAXXCompiler { } public String getAutoId(ClassDescriptor objectClass) { - if (options.getOptimize()) { + if (configuration.getOptimize()) { return "$" + Integer.toString(autogenID++, 36); } else { String name = objectClass.getName(); @@ -1328,8 +1381,8 @@ public class JAXXCompiler { public void generateCode(Iterable<Generator> generatorIterator) throws IOException { File dest; - if (getOptions().getTargetDirectory() != null) { - dest = new File(getOptions().getTargetDirectory(), getOutputClassName().replace('.', File.separatorChar) + ".java"); + if (getConfiguration().getTargetDirectory() != null) { + dest = new File(getConfiguration().getTargetDirectory(), getOutputClassName().replace('.', File.separatorChar) + ".java"); } else { dest = new File(getBaseDir(), getOutputClassName().substring(getOutputClassName().lastIndexOf(".") + 1) + ".java"); } @@ -1369,7 +1422,6 @@ public class JAXXCompiler { throw new CompilerException(e); } } - /** line separator cached value */ protected static String lineSeparator = System.getProperty("line.separator", "\n"); @@ -1471,8 +1523,7 @@ public class JAXXCompiler { } try { return new File(URLDecoder.decode(urlString.replace('/', File.separatorChar), "utf-8")); - } - catch (UnsupportedEncodingException e) { + } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } @@ -1484,11 +1535,9 @@ public class JAXXCompiler { SAXParser parser; parser = factory.newSAXParser(); return parser; - } - catch (SAXException e) { + } catch (SAXException e) { throw new RuntimeException(e); - } - catch (ParserConfigurationException e) { + } catch (ParserConfigurationException e) { throw new RuntimeException(e); } } @@ -1498,6 +1547,7 @@ public class JAXXCompiler { TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); transformer.setErrorListener(new ErrorListener() { + @Override public void warning(TransformerException ex) throws TransformerException { throw ex; @@ -1516,6 +1566,7 @@ public class JAXXCompiler { DOMResult result = new DOMResult(); transformer.transform(new SAXSource(new XMLFilterImpl(getSAXParser().getXMLReader()) { + Locator locator; @Override @@ -1531,11 +1582,9 @@ public class JAXXCompiler { } }, new InputSource(in)), result); return (Document) result.getNode(); - } - catch (TransformerConfigurationException e) { + } catch (TransformerConfigurationException e) { throw new RuntimeException(e); - } - catch (TransformerException e) { + } catch (TransformerException e) { Throwable ex = e; while (ex.getCause() != null) { ex = ex.getCause(); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerLaunchor.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerLaunchor.java index cacc54a..7d548c7 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerLaunchor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerLaunchor.java @@ -1,9 +1,7 @@ package jaxx.compiler; -import jaxx.CompilerException; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.spi.Initializer; -import jaxx.tags.DefaultObjectHandler; +import jaxx.compiler.generators.Generator; +import jaxx.compiler.spi.Initializer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -16,6 +14,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.ServiceLoader; +import jaxx.compiler.generators.GeneratorManager; /** @author chemit */ public class JAXXCompilerLaunchor { @@ -53,10 +52,10 @@ public class JAXXCompilerLaunchor { * * @param base the directory against which to resolve relative paths * @param relativePaths a list of relative paths to .jaxx files being compiled - * @param options the compiler options to use + * @param configuration the compiler configuration to use * @return the new instanciated launchor */ - public static synchronized JAXXCompilerLaunchor newLaunchor(File base, String[] relativePaths, CompilerOptions options) { + public static synchronized JAXXCompilerLaunchor newLaunchor(File base, String[] relativePaths, CompilerConfiguration configuration) { File[] files = new File[relativePaths.length]; String[] classNames = new String[relativePaths.length]; for (int i = 0; i < files.length; i++) { @@ -67,7 +66,7 @@ public class JAXXCompilerLaunchor { classNames[i] = classNames[i].replace('\\', '.'); classNames[i] = classNames[i].replace(':', '.'); } - return newLaunchor(files, classNames, options); + return newLaunchor(files, classNames, configuration); } /** @@ -78,14 +77,14 @@ public class JAXXCompilerLaunchor { * * @param files the .jaxx files to compile * @param classNames the names of the classes being compiled - * @param options the compiler options to use + * @param configuration the compiler configuration to use * @return the new instanciated launchor */ - public static synchronized JAXXCompilerLaunchor newLaunchor(File[] files, String[] classNames, CompilerOptions options) { + public static synchronized JAXXCompilerLaunchor newLaunchor(File[] files, String[] classNames, CompilerConfiguration configuration) { if (singleton != null) { singleton.reset(); } - singleton = new JAXXCompilerLaunchor(files, classNames, options); + singleton = new JAXXCompilerLaunchor(files, classNames, configuration); return singleton; } @@ -124,8 +123,8 @@ public class JAXXCompilerLaunchor { initializer.initialize(); } } - /** options of the launchor and underlines compilers */ - protected CompilerOptions options; + /** configuration of the launchor and underlines compilers */ + protected CompilerConfiguration configuration; /** original list of files to compile */ protected final File[] files; /** original list of classes to compile */ @@ -144,14 +143,14 @@ public class JAXXCompilerLaunchor { protected int compilerCount; protected JAXXProfile profiler; - protected JAXXCompilerLaunchor(File[] files, String[] classNames, CompilerOptions options) { - this.options = options == null ? new CompilerOptions() : options; + protected JAXXCompilerLaunchor(File[] files, String[] classNames, CompilerConfiguration options) { + this.configuration = options == null ? new DefaultCompilerConfiguration() : options; this.files = files; this.classNames = classNames; - if (this.options.isVerbose()) { + if (this.configuration.isVerbose()) { log.info("files : " + Arrays.toString(files)); } - if (this.options.isProfile()) { + if (this.configuration.isProfile()) { profiler = new JAXXProfile(); } } @@ -173,7 +172,7 @@ public class JAXXCompilerLaunchor { } public String getVersion() { - return "1.0.4"; + return "2.0.0"; } /** @@ -192,7 +191,7 @@ public class JAXXCompilerLaunchor { * @return the compiler */ public static JAXXCompiler createDummyCompiler(ClassLoader classLoader) { - return new JAXXCompiler(classLoader, new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(Object.class))) { + return new JAXXCompiler(classLoader) { }; } @@ -262,7 +261,7 @@ public class JAXXCompilerLaunchor { throw new CompilerException("Internal error: " + className + " is already being compiled, attempting to compile it again"); } - File destDir = options.getTargetDirectory(); + File destDir = configuration.getTargetDirectory(); if (destDir != null) { int dotPos = className.lastIndexOf("."); if (dotPos != -1) { @@ -342,10 +341,7 @@ public class JAXXCompilerLaunchor { return false; } assert jaxxFiles.size() == jaxxFileClassNames.size(); - List<Generator> generators = new ArrayList<Generator>(); - for (Generator generator : ServiceLoader.load(Generator.class)) { - generators.add(generator); - } + List<Generator> generators = GeneratorManager.getGenerators(); for (String className : jaxxFileClassNames) { JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during code generation"); addProfileTime(compiler, currentPass.name() + "_start"); @@ -357,7 +353,7 @@ public class JAXXCompilerLaunchor { } } - if (options.isProfile()) { + if (configuration.isProfile()) { // profile pass (only if succes compile) if (!nextStep(LifeCycle.profile_pass, success)) { return false; @@ -379,7 +375,7 @@ public class JAXXCompilerLaunchor { } finally { compilerCount = compilers.size(); //TC - 20081018 only reset when no error was detected - if (options.isResetAfterCompile() && errorCount == 0) { + if (configuration.isResetAfterCompile() && errorCount == 0) { reset(); } } @@ -420,8 +416,8 @@ public class JAXXCompilerLaunchor { } protected JAXXCompiler newCompiler(File parentFile, File file, String className) throws InvocationTargetException, IllegalAccessException, InstantiationException, NoSuchMethodException { - Constructor<? extends JAXXCompiler> cons = options.getCompilerClass().getConstructor(File.class, File.class, String.class, CompilerOptions.class); - return cons.newInstance(parentFile, file, className, options); + Constructor<? extends JAXXCompiler> cons = configuration.getCompilerClass().getConstructor(File.class, File.class, String.class, CompilerConfiguration.class); + return cons.newInstance(parentFile, file, className, configuration); } public static void addProfileTime(JAXXCompiler compiler, String key) { @@ -430,22 +426,4 @@ public class JAXXCompilerLaunchor { p.addTime(compiler, key); } } - - protected static void showUsage() { - System.out.println("Usage: jaxxc <options> <source files>"); - System.out.println(); - System.out.println("Source files must end in extension .jaxx"); - System.out.println("Use JAXX_OPTS environment variable to pass arguments to Java runtime"); - System.out.println(); - System.out.println("Supported options include:"); - System.out.println(" -classpath <paths> paths to search for user classes"); - System.out.println(" -cp <paths> same as -classpath"); - System.out.println(" -d <directory> target directory for generated class files"); - System.out.println(" -java or -j produce .java files, but do not compile them"); - System.out.println(" -keep or -k preserve generated .java files after compilation"); - System.out.println(" -optimize or -o optimize during compilation"); - System.out.println(" -version display version information"); - System.out.println(); - System.out.println("See http://www.jaxxframework.org/ for full documentation."); - } } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXObjectGenerator.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXObjectGenerator.java deleted file mode 100644 index 5d3e8b0..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXObjectGenerator.java +++ /dev/null @@ -1,598 +0,0 @@ -package jaxx.compiler; - -import jaxx.Base64Coder; -import jaxx.CompilerException; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.reflect.FieldDescriptor; -import jaxx.reflect.MethodDescriptor; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.JAXXObjectDescriptor; -import jaxx.types.TypeManager; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.io.IOException; -import java.lang.reflect.Modifier; -import static java.lang.reflect.Modifier.FINAL; -import static java.lang.reflect.Modifier.PROTECTED; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -/** - * This class is a refactoring of the {@link jaxx.compiler.JAXXCompiler}. - * <p/> - * We delegate now the generation of a {@link jaxx.runtime.JAXXObject} to this class, the - * {@link jaxx.compiler.JAXXCompiler} now only deals with the compilation of files. - * - * @author chemit - */ -public class JAXXObjectGenerator implements Generator { - - /** log */ - protected static final Log log = LogFactory.getLog(JAXXObjectGenerator.class); - protected static final JavaField ACTIVE_BINDINGS_FIELD = JavaField.newField(PROTECTED, - "java.util.List<Object>", "$activeBindings", "new ArrayList<Object>()"); - protected static final JavaField BINDING_SOURCES_FIELD = JavaField.newField(PROTECTED, - "java.util.Map<String,Object>", "$bindingSources", "new HashMap<String,Object>()"); - protected static final JavaField OBJECT_MAP_FIELD = JavaField.newField(PROTECTED, - "Map<String,Object>", "$objectMap", "new HashMap<String,Object>()"); - protected static final JavaField ALL_COMPONENTS_CREATED_FIELD = JavaField.newField(java.lang.reflect.Modifier.PRIVATE, - "boolean", "allComponentsCreated"); - protected static final JavaField CONTEXT_INITIALIZED = JavaField.newField(java.lang.reflect.Modifier.PRIVATE, - "boolean", "contextInitialized", "true"); - protected static final JavaField PREVIOUS_VALUES_FIELD = JavaField.newField(0, - "java.util.Map", "$previousValues", "new java.util.HashMap()"); - protected static final JavaField DELEGATE_CONTEXT_FIELD = JavaField.newField(PROTECTED, - "jaxx.runtime.JAXXContext", "delegateContext"); - protected static final JavaField PROPERTY_CHANGE_SUPPORT_FIELD = JavaField.newField(0, - "java.beans.PropertyChangeSupport", "$propertyChangeSupport"); - protected static final JavaMethod GET_CONTEXT_VALUE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> T", "getContextValue", - "return delegateContext.getContextValue(clazz, null);", - new JavaArgument("Class<T>", "clazz")); - protected static final JavaMethod GET_CONTEXT_VALUE_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> T", "getContextValue", - "return delegateContext.getContextValue(clazz, name);", - new JavaArgument("Class<T>", "clazz"), new JavaArgument("String", "name")); - protected static final JavaMethod SET_CONTEXT_VALUE_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> void", "setContextValue", - "delegateContext.setContextValue(o, name);", - new JavaArgument("T", "o"), new JavaArgument("String", "name")); - protected static final JavaMethod SET_CONTEXT_VALUE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> void", "setContextValue", - "delegateContext.setContextValue(o, null);", - new JavaArgument("T", "o")); - protected static final JavaMethod REMOVE_CONTEXT_VALUE_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> void", "removeContextValue", - "delegateContext.removeContextValue(clazz, name);", - new JavaArgument("Class<T>", "clazz"), new JavaArgument("String", "name")); - protected static final JavaMethod REMOVE_CONTEXT_VALUE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> void", "removeContextValue", - "delegateContext.removeContextValue(clazz, null);", - new JavaArgument("Class<T>", "clazz")); - protected static final JavaMethod GET_PARENT_CONTAINER_MORE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<O extends Container> O", "getParentContainer", - "return delegateContext.getParentContainer(source, clazz);", - new JavaArgument("Object", "source"), new JavaArgument("Class<O>", "clazz")); - protected static final JavaMethod GET_PARENT_CONTAINER_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<O extends Container> O", "getParentContainer", - "return delegateContext.getParentContainer(clazz);", - new JavaArgument("Class<O>", "clazz")); - protected static final JavaMethod GET_OBJECT_BY_ID_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "java.lang.Object", "getObjectById", - "return $objectMap.get(id);", - new JavaArgument("String", "id")); - protected static final JavaMethod GET_JAXX_OBJECT_DESCRIPTOR_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC | java.lang.reflect.Modifier.STATIC, "jaxx.runtime.JAXXObjectDescriptor", "$getJAXXObjectDescriptor", - "return jaxx.runtime.Util.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);"); - protected static final JavaMethod PROCESS_DATA_BINDING_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "processDataBinding", - "processDataBinding(dest, false);", - new JavaArgument("String", "dest")); - protected static final JavaMethod FIRE_PROPERTY_CHANGE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "firePropertyChange", - "super.firePropertyChange(propertyName, oldValue, newValue);", - new JavaArgument("String", "propertyName"), new JavaArgument("Object", "oldValue"), new JavaArgument("Object", "newValue")); - protected static final JavaMethod FIRE_PROPERTY_CHANGE_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "firePropertyChange", - "$getPropertyChangeSupport().firePropertyChange(propertyName, oldValue, newValue);", - new JavaArgument("String", "propertyName"), new JavaArgument("Object", "oldValue"), new JavaArgument("Object", "newValue")); - protected static final JavaMethod GET_PROPERTY_CHANGE_SUPPORT_METHOD = JavaMethod.newMethod(0, "java.beans.PropertyChangeSupport", "$getPropertyChangeSupport", - "if ($propertyChangeSupport == null)\n" + - " $propertyChangeSupport = new PropertyChangeSupport(this);\n" + - "return $propertyChangeSupport;"); - protected static final JavaMethod ADD_PROPERTY_CHANGE_SUPPORT_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "addPropertyChangeListener", - "$getPropertyChangeSupport().addPropertyChangeListener(listener);", - new JavaArgument("java.beans.PropertyChangeListener", "listener")); - protected static final JavaMethod ADD_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "addPropertyChangeListener", - "$getPropertyChangeSupport().addPropertyChangeListener(property, listener);", - new JavaArgument("String", "property"), new JavaArgument("java.beans.PropertyChangeListener", "listener")); - protected static final JavaMethod REMOVE_PROPERTY_CHANGE_SUPPORT_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "removePropertyChangeListener", - "$getPropertyChangeSupport().removePropertyChangeListener(listener);", - new JavaArgument("java.beans.PropertyChangeListener", "listener")); - protected static final JavaMethod REMOVE_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "removePropertyChangeListener", - "$getPropertyChangeSupport().removePropertyChangeListener(property, listener);", - new JavaArgument("String", "property"), new JavaArgument("java.beans.PropertyChangeListener", "listener")); - - @Override - public void finalizeCompiler(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) { - - String fullClassName = packageName != null ? packageName + "." + className : className; - if (root == null) { - throw new CompilerException("root tag must be a class tag"); - } - //Map<String, CompiledObject> objects = compiler.getObjects(); - ClassDescriptor superclass = root.getObjectClass(); - boolean superclassIsJAXXObject = ClassDescriptorLoader.getClassDescriptor(JAXXObject.class).isAssignableFrom(superclass); - javaFile.setModifiers(Modifier.PUBLIC); - javaFile.setClassName(fullClassName); - javaFile.setSuperClass(JAXXCompiler.getCanonicalName(superclass)); - javaFile.setSuperclassIsJAXXObject(superclassIsJAXXObject); - - javaFile.addInterfaces(compiler.getExtraInterfaces()); - javaFile.setAbstractClass(compiler.isAbstractClass()); - javaFile.setGenericType(compiler.getGenericType()); - javaFile.setSuperGenericType(compiler.getSuperGenericType()); - - for (CompiledObject object : compiler.getObjects().values()) { - CompiledObjectDecorator decorator = object.getDecorator(); - decorator.finalizeCompiler(compiler, root, object, javaFile, packageName, className, fullClassName); - - /*if (!object.isOverride() && !(object instanceof ScriptInitializer)) { - String id = object.getId(); - int access = id.startsWith("$") ? Modifier.PRIVATE : Modifier.PROTECTED; - if (object == root) { - javaFile.addField(new JavaField(access, fullClassName, id, "this")); - } else { - //TC -20081017 can have generic on compiled Object - javaFile.addField(JavaField.newField(access, JAXXCompiler.getCanonicalName(object), id), object.isJavaBean()); - } - } - - if (!compiler.inlineCreation(object) && object != root) { - javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getCreationMethodName(), getCreationCode(compiler, object))); - }*/ - } - - // DataBinding - for (DataBinding dataBinding : compiler.getDataBindings()) { - if (dataBinding.compile(true)) { - compiler.getInitDataBindings().append("applyDataBinding(").append(TypeManager.getJavaCode(dataBinding.getId())).append(");").append(JAXXCompiler.getLineSeparator()); - } - } - - if (superclassIsJAXXObject) { - boolean hasBind = compiler.getApplyDataBinding().length() > 0; - if (hasBind) { - compiler.appendApplyDataBinding(" else {"); - compiler.appendApplyDataBinding(JAXXCompiler.getLineSeparator()); - compiler.appendApplyDataBinding(" "); - } - compiler.appendApplyDataBinding("super.applyDataBinding($binding);"); - compiler.appendApplyDataBinding(JAXXCompiler.getLineSeparator()); - - if (hasBind) { - compiler.appendApplyDataBinding(" return;"); - compiler.appendApplyDataBinding(JAXXCompiler.getLineSeparator()); - compiler.appendApplyDataBinding("}"); - } - - - hasBind = compiler.getRemoveDataBinding().length() > 0; - if (hasBind) { - compiler.appendRemoveDataBinding(" else {"); - compiler.appendRemoveDataBinding(JAXXCompiler.getLineSeparator()); - compiler.appendRemoveDataBinding(" "); - } - compiler.appendRemoveDataBinding("super.removeDataBinding($binding);"); - compiler.appendRemoveDataBinding(JAXXCompiler.getLineSeparator()); - - if (hasBind) { - compiler.appendRemoveDataBinding("}"); - } - } else { - javaFile.addInterface(JAXXCompiler.getCanonicalName(JAXXObject.class)); - } - } - - @Override - public void prepareJavaFile(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws ClassNotFoundException { - - String fullClassName = javaFile.getClassName(); - - String jaxxContextImplementorClass = compiler.getOptions().getJaxxContextImplementorClass(); - boolean superclassIsJAXXObject = javaFile.isSuperclassIsJAXXObject(); - if (!superclassIsJAXXObject) { - // add logger - if (compiler.getOptions().isAddLogger()) { - javaFile.addImport(Log.class); - javaFile.addImport(LogFactory.class); - javaFile.addField(JavaField.newField(Modifier.PUBLIC + Modifier.STATIC + FINAL, "Log", "log", "LogFactory.getLog(" + fullClassName + ".class)")); - } - - // JAXXObject - javaFile.addField(OBJECT_MAP_FIELD); - javaFile.addMethod(GET_OBJECT_BY_ID_METHOD); - javaFile.addField(BINDING_SOURCES_FIELD); - javaFile.addField(ACTIVE_BINDINGS_FIELD); - - // JAXXContext - javaFile.addField(JavaField.newField(PROTECTED | FINAL, JAXXContext.class.getName(), "delegateContext", "new " + jaxxContextImplementorClass + "(this);")); - javaFile.addMethod(SET_CONTEXT_VALUE_METHOD); - javaFile.addMethod(SET_CONTEXT_VALUE_NAMED_METHOD); - javaFile.addMethod(GET_CONTEXT_VALUE_METHOD); - javaFile.addMethod(GET_CONTEXT_VALUE_NAMED_METHOD); - javaFile.addMethod(REMOVE_CONTEXT_VALUE_METHOD); - javaFile.addMethod(REMOVE_CONTEXT_VALUE_NAMED_METHOD); - javaFile.addMethod(GET_PARENT_CONTAINER_METHOD); - javaFile.addMethod(GET_PARENT_CONTAINER_MORE_METHOD); - - // PropertyChangeSupport - addPropertyChangeSupport(root, javaFile); - - // DataBinding - javaFile.addMethod(PROCESS_DATA_BINDING_METHOD); - } - - javaFile.addField(ALL_COMPONENTS_CREATED_FIELD); - boolean overrideContextInitialized = false; - FieldDescriptor[] scriptFields = compiler.getScriptFields(); - for (FieldDescriptor f : scriptFields) { - if ("contextInitialized".equals(f.getName())) { - overrideContextInitialized = true; - break; - } - } - if (!overrideContextInitialized) { - javaFile.addField(CONTEXT_INITIALIZED); - } - javaFile.addField(createJAXXObjectDescriptorField(compiler, javaFile)); - - if (compiler.getStylesheet() != null) { - javaFile.addField(PREVIOUS_VALUES_FIELD); - } - /*for (CompiledObject object : compiler.getObjects().values()) { - List<CompiledObject.ChildRef> refList = object.getChilds(); - if (refList==null || refList.isEmpty()) { - continue; - } - for (ChildRef childRef : refList) { - childRef.addToAdditionCode(buffer); - } - }*/ - //TC 20090228 - only generate constructors if not done in scripts - boolean constructorDetected = false; - MethodDescriptor[] methods = compiler.getScriptMethods(); - for (MethodDescriptor m : methods) { - try { - m.getReturnType(); - if (className.equals(m.getName())) { - constructorDetected = true; - break; - } - } catch (Exception e) { - log.warn("could not find return type " + m); - } - } - if (!constructorDetected) { - javaFile.addMethod(createConstructor(compiler, className, superclassIsJAXXObject)); - javaFile.addMethod(createConstructorWithInitialContext(compiler, className, superclassIsJAXXObject)); - } - - javaFile.addMethod(createInitializer(compiler)); - javaFile.addMethod(GET_JAXX_OBJECT_DESCRIPTOR_METHOD); - - javaFile.addBodyCode(compiler.getBodyCode().toString()); - - javaFile.addMethod(createCompleteSetupMethod(compiler, javaFile, compiler.getInitDataBindings())); - - - javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", "applyDataBinding", - compiler.getApplyDataBinding().toString() + JAXXCompiler.getLineSeparator() + "processDataBinding($binding);", - new JavaArgument("String", "$binding"))); - - javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", "removeDataBinding", - compiler.getRemoveDataBinding().toString(), new JavaArgument("String", "$binding"))); - - javaFile.addMethod(createProcessDataBindingMethod(compiler, superclassIsJAXXObject)); - - addEventHandlers(compiler, javaFile); - - } - - - /*---------------------------------------------------------------------------------*/ - /*-- Create fields ----------------------------------------------------------------*/ - /*---------------------------------------------------------------------------------*/ - protected JavaField createJAXXObjectDescriptorField(JAXXCompiler compiler, JavaFile javaFile) { - try { - JAXXObjectDescriptor descriptor = compiler.getJAXXObjectDescriptor(); - String data = Base64Coder.serialize(descriptor, true); - /*ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(new GZIPOutputStream(buffer)); - out.writeObject(descriptor); - out.close(); - // the use of the weird deprecated constructor is deliberate -- we need to store the data as a String - // in the compiled class file, since byte array initialization is horribly inefficient compared to - // String initialization. So we store the bytes in the String, and we quite explicitly want a 1:1 - // mapping between bytes and chars, with the high byte of the char set to zero. We can then safely - // reconstitute the original byte[] at a later date. This is unquestionably an abuse of the String - // type, but if we could efficiently store a byte[] we wouldn't have to do this. - String data = new String(buffer.toByteArray(), 0);*/ - - int sizeLimit = 65000; // constant strings are limited to 64K, and I'm not brave enough to push right up to the limit - if (data.length() < sizeLimit) { - return JavaField.newField(Modifier.PRIVATE | Modifier.STATIC, "java.lang.String", "$jaxxObjectDescriptor", TypeManager.getJavaCode(data)); - } else { - StringBuffer initializer = new StringBuffer(); - for (int i = 0; i < data.length(); i += sizeLimit) { - String name = "$jaxxObjectDescriptor" + i; - javaFile.addField(new JavaField(Modifier.PRIVATE | Modifier.STATIC, "java.lang.String", name, - TypeManager.getJavaCode(data.substring(i, Math.min(i + sizeLimit, data.length()))))); - if (initializer.length() > 0) { - initializer.append(" + "); - } - initializer.append("String.valueOf(").append(name).append(")"); - } - return JavaField.newField(Modifier.PRIVATE | Modifier.STATIC, "java.lang.String", "$jaxxObjectDescriptor", initializer.toString()); - } - } catch (IOException e) { - throw new RuntimeException("Internal error: can't-happen error", e); - } - } - - /*---------------------------------------------------------------------------------*/ - /*-- Create methods ---------------------------------------------------------------*/ - /*---------------------------------------------------------------------------------*/ - protected void addPropertyChangeSupport(CompiledObject root, JavaFile javaFile) { - ClassDescriptor currentClass = root.getObjectClass(); - MethodDescriptor firePropertyChange = null; - while (firePropertyChange == null && currentClass != null) { - try { - firePropertyChange = currentClass.getDeclaredMethodDescriptor("firePropertyChange", ClassDescriptorLoader.getClassDescriptor(String.class), - ClassDescriptorLoader.getClassDescriptor(Object.class), - ClassDescriptorLoader.getClassDescriptor(Object.class)); - - } catch (NoSuchMethodException e) { - currentClass = currentClass.getSuperclass(); - } - } - - int modifiers = firePropertyChange != null ? firePropertyChange.getModifiers() : 0; - if (Modifier.isPublic(modifiers)) { - // we have all the support we need - } - if (Modifier.isProtected(modifiers)) { - // there is property change support but the firePropertyChange method is protected - javaFile.addMethod(FIRE_PROPERTY_CHANGE_METHOD); - } else { - // either no support at all or firePropertyChange isn't accessible - javaFile.addField(PROPERTY_CHANGE_SUPPORT_FIELD); - javaFile.addMethod(GET_PROPERTY_CHANGE_SUPPORT_METHOD); - javaFile.addMethod(ADD_PROPERTY_CHANGE_SUPPORT_METHOD); - javaFile.addMethod(ADD_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD); - javaFile.addMethod(REMOVE_PROPERTY_CHANGE_SUPPORT_METHOD); - javaFile.addMethod(REMOVE_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD); - javaFile.addMethod(FIRE_PROPERTY_CHANGE_NAMED_METHOD); - } - } - - protected void addEventHandlers(JAXXCompiler compiler, JavaFile javaFile) { - for (Map.Entry<String, Map<ClassDescriptor, List<EventHandler>>> e1 : compiler.getEventHandlers().entrySet()) { - // outer loop is iterating over different objects (well, technically, different Java expressions) - for (Map.Entry<ClassDescriptor, List<EventHandler>> e2 : e1.getValue().entrySet()) { - // iterate over different types of listeners for this particular object (MouseListener, ComponentListener, etc.) - for (EventHandler handler : e2.getValue()) { - // iterate over individual event handlers of a single type - String methodName = compiler.getEventHandlerMethodName(handler); - MethodDescriptor listenerMethod = handler.getListenerMethod(); - if (listenerMethod.getParameterTypes().length != 1) { - throw new CompilerException("Expected event handler " + listenerMethod.getName() + " of class " + handler.getListenerClass() + " to have exactly one argument"); - } - javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", methodName, handler.getJavaCode(), - new JavaArgument(JAXXCompiler.getCanonicalName(listenerMethod.getParameterTypes()[0]), "event"))); - } - } - } - } - - protected JavaMethod createConstructor(JAXXCompiler compiler, String className, boolean superclassIsJAXXObject) throws CompilerException { - StringBuffer code = new StringBuffer(); - String constructorParams = compiler.getRootObject().getConstructorParams(); - if (constructorParams != null) { - code.append(" super(").append(constructorParams).append(");").append(JAXXCompiler.getLineSeparator()); - } else { - if (superclassIsJAXXObject) { - code.append(" super();").append(JAXXCompiler.getLineSeparator()); - } - } - code.append("$initialize();"); - code.append(JAXXCompiler.getLineSeparator()); - return JavaMethod.newMethod(Modifier.PUBLIC, null, className, code.toString()); - } - - protected JavaMethod createConstructorWithInitialContext(JAXXCompiler compiler, String className, boolean superclassIsJAXXObject) throws CompilerException { - StringBuffer code = new StringBuffer(); - String constructorParams = compiler.getRootObject().getConstructorParams(); - if (constructorParams != null) { - code.append(" super(").append(constructorParams).append(");").append(JAXXCompiler.getLineSeparator()); - } else { - if (superclassIsJAXXObject) { - code.append(" super(parentContext);").append(JAXXCompiler.getLineSeparator()); - } - } - if (!superclassIsJAXXObject) { - code.append("if (parentContext instanceof jaxx.runtime.JAXXInitialContext) {"); - code.append(JAXXCompiler.getLineSeparator()); - code.append(" ((jaxx.runtime.JAXXInitialContext)parentContext).to(this);"); - code.append(JAXXCompiler.getLineSeparator()); - code.append("} else {"); - code.append(JAXXCompiler.getLineSeparator()); - code.append(" setContextValue(parentContext);"); - code.append(JAXXCompiler.getLineSeparator()); - code.append("}"); - code.append(JAXXCompiler.getLineSeparator()); - } - code.append("$initialize();"); - code.append(JAXXCompiler.getLineSeparator()); - return JavaMethod.newMethod(Modifier.PUBLIC, null, className, code.toString(), new JavaArgument("jaxx.runtime.JAXXContext", "parentContext")); - } - - public JavaMethod createInitializer(JAXXCompiler compiler) throws CompilerException { - StringBuffer code = new StringBuffer(); - CompiledObject root = compiler.getRootObject(); - code.append("if (allComponentsCreated || !contextInitialized) {"); - code.append(JAXXCompiler.getLineSeparator()); - code.append(" return;"); - code.append(JAXXCompiler.getLineSeparator()); - code.append("}"); - code.append(JAXXCompiler.getLineSeparator()); - code.append("$objectMap.put(").append(TypeManager.getJavaCode(root.getId())).append(", this);"); - code.append(JAXXCompiler.getLineSeparator()); - - Iterator<CompiledObject> i = compiler.getObjectCreationOrder(); - boolean lastWasMethodCall = false; - while (i.hasNext()) { - CompiledObject object = i.next(); - if (object == root) { - continue; - } - CompiledObjectDecorator decorator = object.getDecorator(); - lastWasMethodCall = decorator.createInitializer(compiler, root, object, code, lastWasMethodCall); - /*if (object != root && !object.isOverride()) { - if (compiler.inlineCreation(object)) { - if (lastWasMethodCall) { - lastWasMethodCall = false; - code.append(JAXXCompiler.getLineSeparator()); - } - code.append(getCreationCode(compiler, object)); - code.append(JAXXCompiler.getLineSeparator()); - } else { - code.append(object.getCreationMethodName()).append("();"); - code.append(JAXXCompiler.getLineSeparator()); - lastWasMethodCall = true; - } - }*/ - } - root.getDecorator().createInitializer(compiler, root, root, code, lastWasMethodCall); - /*String rootCode = root.getInitializationCode(compiler); - if (rootCode != null && rootCode.length() > 0) { - code.append(rootCode); - code.append(JAXXCompiler.getLineSeparator()); - }*/ - code.append(JAXXCompiler.getLineSeparator()); - if (compiler.getInitializer().length() > 0) { - code.append(compiler.getInitializer()); - code.append(JAXXCompiler.getLineSeparator()); - } - code.append("$completeSetup();"); - code.append(JAXXCompiler.getLineSeparator()); - return JavaMethod.newMethod(Modifier.PRIVATE, "void", "$initialize", code.toString()); - } - - protected JavaMethod createCompleteSetupMethod(JAXXCompiler compiler, JavaFile javaFile, StringBuffer initDataBindings) { - StringBuffer code = new StringBuffer(); - code.append("allComponentsCreated = true;"); - code.append(JAXXCompiler.getLineSeparator()); - for (CompiledObject object : compiler.getObjects().values()) { - CompiledObjectDecorator decorator = object.getDecorator(); - code.append(decorator.createCompleteSetupMethod(compiler, object, javaFile, initDataBindings)); - - /*//TC - 20081017 only generate the method if not empty ? - if (object.getId().startsWith("$")) { - code.append(object.getAdditionCode()).append(JAXXCompiler.getLineSeparator()); - } else { - String additionCode = object.getAdditionCode(); - if (additionCode.length() > 0) { - code.append(object.getAdditionMethodName()).append("();").append(JAXXCompiler.getLineSeparator()); - additionCode = "if (!allComponentsCreated) {" + JAXXCompiler.getLineSeparator() + " return;" + JAXXCompiler.getLineSeparator() + "}" + JAXXCompiler.getLineSeparator() + additionCode; - javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getAdditionMethodName(), additionCode)); - } - }*/ - //code.append(getLineSeparator()); - } - - code.append(initDataBindings); - - if (compiler.getLateInitializer().length() > 0) { - code.append(compiler.getLateInitializer()); - code.append(JAXXCompiler.getLineSeparator()); - } - //TC-20090313 add an extra method after complete setup - MethodDescriptor method = compiler.getScriptMethod("$afterCompleteSetup"); - if (method != null) { - code.append("$afterCompleteSetup();").append(JAXXCompiler.getLineSeparator()); - } - return JavaMethod.newMethod(Modifier.PRIVATE, "void", "$completeSetup", code.toString()); - } - - protected JavaMethod createProcessDataBindingMethod(JAXXCompiler compiler, boolean superclassIsJAXXObject) { - StringBuffer code = new StringBuffer(); - //boolean superclassIsJAXXObject = ClassDescriptorLoader.getClassDescriptor(JAXXObject.class).isAssignableFrom(compiler.getRootObject().getObjectClass()); - // the force parameter forces the update to happen even if it is already in activeBindings. This - // is used on superclass invocations b/c by the time the call gets to the superclass, it is already - // marked active and would otherwise be skipped - if (compiler.getProcessDataBinding().length() > 0) { - code.append(" if (!$force && $activeBindings.contains($dest)) { "); - code.append(JAXXCompiler.getLineSeparator()); - code.append(" return;"); - code.append(JAXXCompiler.getLineSeparator()); - code.append("}"); - code.append(JAXXCompiler.getLineSeparator()); - code.append("$activeBindings.add($dest);"); - code.append(JAXXCompiler.getLineSeparator()); - code.append("try {"); - code.append(JAXXCompiler.getLineSeparator()); - if (compiler.getProcessDataBinding().length() > 0) { - code.append(compiler.getProcessDataBinding().toString()); - //code.append(JAXXCompiler.getLineSeparator()); - } - if (superclassIsJAXXObject) { - code.append(" else {"); - code.append(JAXXCompiler.getLineSeparator()); - code.append(" super.processDataBinding($dest, true);"); - code.append(JAXXCompiler.getLineSeparator()); - code.append(" }"); - code.append(JAXXCompiler.getLineSeparator()); - } - code.append("} finally {"); - code.append(JAXXCompiler.getLineSeparator()); - code.append(" $activeBindings.remove($dest);"); - code.append(JAXXCompiler.getLineSeparator()); - code.append("}"); - code.append(JAXXCompiler.getLineSeparator()); - } else if (superclassIsJAXXObject) { - code.append("super.processDataBinding($dest, true);"); - code.append(JAXXCompiler.getLineSeparator()); - } - return JavaMethod.newMethod(Modifier.PUBLIC, "void", "processDataBinding", code.toString(), - new JavaArgument("String", "$dest"), new JavaArgument("boolean", "$force")); - } - - /*---------------------------------------------------------------------------------*/ - /*-- Create methods code ----------------------------------------------------------*/ - /*---------------------------------------------------------------------------------*/ - - /* protected String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException { - if (object instanceof ScriptInitializer) { - return object.getInitializationCode(compiler); - } - CompiledObjectDecorator decorator = object.getDecorator(); - String result = decorator.getCreationCode(compiler, object); - return result;*/ - /*StringBuffer result = new StringBuffer(); - result.append(object.getId()); - result.append(" = "); - if (object.isJavaBean() && object.getJavaBeanInitCode() != null) { - result.append(object.getJavaBeanInitCode()).append(";"); - } else { - String constructorParams = object.getConstructorParams(); - if (constructorParams != null) { - //TC - 20081017 compiledObject can have generics - result.append(" new ").append(JAXXCompiler.getCanonicalName(object)).append("(").append(constructorParams).append(");"); - //result.append("(").append(getCanonicalName(object.getObjectClass())).append(") new ").append(getCanonicalName(object.getObjectClass())).append("(").append(constructorParams).append(");"); - } else { - //TC - 20081017 compiledObject can have generics - result.append("new ").append(JAXXCompiler.getCanonicalName(object)).append("();"); - } - } - result.append(JAXXCompiler.getLineSeparator()); - String initCode = object.getInitializationCode(compiler); - if (initCode != null && initCode.length() > 0) { - result.append(initCode); - } - result.append("$objectMap.put(").append(TypeManager.getJavaCode(object.getId())).append(", ").append(object.getId()).append(");"); - - return result.toString();*/ -// } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JavaArgument.java b/jaxx-compiler/src/main/java/jaxx/compiler/JavaArgument.java index 638e872..139d70d 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JavaArgument.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JavaArgument.java @@ -10,11 +10,11 @@ package jaxx.compiler; * @see JavaMethod */ public class JavaArgument { + private String name; private String type; private boolean isFinal; - /** * Creates a new <code>JavaArgument</code> with the specified name and type. For example, the method <code>main()</code> * might have a <code>JavaArgument</code> with a name of <code>"arg"</code> and a type of <code>"java.lang.String[]"</code>. @@ -26,7 +26,6 @@ public class JavaArgument { this(type, name, false); } - /** * Creates a new <code>JavaArgument</code> with the specified name, type, and finality. For example, the method <code>main()</code> * might have a <code>JavaArgument</code> with a name of <code>"arg"</code> and a type of <code>"java.lang.String[]"</code>. The @@ -42,7 +41,6 @@ public class JavaArgument { this.isFinal = isFinal; } - /** * Returns the argument's name. * @@ -52,7 +50,6 @@ public class JavaArgument { return name; } - /** * Returns the argument's type as it would be represented in Java source code. * @@ -62,7 +59,6 @@ public class JavaArgument { return type; } - /** * Returns <code>true</code> if the <code>final</code> keyword should appear before the argument. * @@ -72,7 +68,6 @@ public class JavaArgument { return isFinal; } - /** * Returns the Java source code for this argument. * @@ -83,4 +78,4 @@ public class JavaArgument { String result = type + ' ' + name; return isFinal ? "final " + result : result; } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JavaField.java b/jaxx-compiler/src/main/java/jaxx/compiler/JavaField.java index 4dcd369..f597b09 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JavaField.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JavaField.java @@ -18,7 +18,6 @@ public class JavaField implements Comparable<JavaField> { private String name; private String initializer; - /** * Constructs a new <code>JavaField</code>. The <code>modifiers</code> parameter is a bit mask of the * constants from {@link java.lang.reflect.Modifier}, and the <code>type</code> of the field should be @@ -32,7 +31,6 @@ public class JavaField implements Comparable<JavaField> { this(modifiers, type, name, null); } - /** * Constructs a new <code>JavaField</code>. The <code>modifiers</code> parameter is a bit mask of the * constants from <code>java.lang.reflect.Modifier</code>, and the <code>type</code> of the field should be @@ -52,7 +50,6 @@ public class JavaField implements Comparable<JavaField> { this.initializer = initializer; } - /** * Returns a bit mask describing the modifier keywords which should appear as part of this field's * declaration. See <code>java.lang.reflect.Modifier</code> for more information on decoding this @@ -64,7 +61,6 @@ public class JavaField implements Comparable<JavaField> { return modifiers; } - /** * Returns the field's name. * @@ -74,7 +70,6 @@ public class JavaField implements Comparable<JavaField> { return name; } - /** * Returns the field's type, as it would be represented in Java source code. * @@ -84,7 +79,6 @@ public class JavaField implements Comparable<JavaField> { return type; } - /** * Returns the Java source code for this field. * @@ -102,12 +96,13 @@ public class JavaField implements Comparable<JavaField> { return result.toString(); } + @Override public int compareTo(JavaField o) { return COMPARATOR.compare(this, o); } - public static final Comparator<JavaField> COMPARATOR = new Comparator<JavaField>() { + @Override public int compare(JavaField o1, JavaField o2) { int result; @@ -184,4 +179,4 @@ public class JavaField implements Comparable<JavaField> { public static JavaField newField(int modifiers, String returnType, String name, String initializer) { return new JavaField(modifiers, returnType, name, initializer); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JavaFile.java b/jaxx-compiler/src/main/java/jaxx/compiler/JavaFile.java index 5dbaaf4..d072593 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JavaFile.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JavaFile.java @@ -20,11 +20,8 @@ import java.util.Map.Entry; public class JavaFile { protected static final String GETTER_PATTERN = "return %1$s;"; - protected static final String BOOLEAN_GETTER_PATTERN = "return %1$s !=null && %1$s;"; - protected static final String SETTER_PATTERN = "%1$s oldValue = this.%2$s;\nthis.%2$s = newValue;\nfirePropertyChange(\"%2$s\", oldValue, newValue);"; - private int modifiers; private String className; private List<String> imports = new ArrayList<String>(); @@ -39,16 +36,13 @@ public class JavaFile { private String genericType; private String superGenericType; - public JavaFile() { } - public JavaFile(int modifiers, String className, String superClass) { this(modifiers, className, superClass, null); } - public JavaFile(int modifiers, String className, String superClass, List<String> interfaces) { this.modifiers = modifiers; this.className = className; @@ -56,51 +50,42 @@ public class JavaFile { this.interfaces = interfaces; } - public void addImport(String importString) { imports.add(importString); } - public void addImport(Class importString) { + public void addImport(Class<?> importString) { imports.add(importString.getName()); } - public String[] getImports() { return imports.toArray(new String[imports.size()]); } - public int getModifiers() { return modifiers; } - public void setModifiers(int modifiers) { this.modifiers = modifiers; } - public String getClassName() { return className; } - public void setClassName(String className) { this.className = className; } - public String getSuperClass() { return superClass; } - public void setSuperClass(String superClass) { this.superClass = superClass; } - public List<String> getInterfaces() { if (interfaces == null) { interfaces = new ArrayList<String>(); @@ -108,7 +93,6 @@ public class JavaFile { return interfaces; } - public void setInterfaces(List<String> interfaces) { this.interfaces = interfaces; } @@ -121,7 +105,6 @@ public class JavaFile { methods.add(method); } - public JavaMethod[] getMethods() { return methods.toArray(new JavaMethod[methods.size()]); } @@ -156,22 +139,18 @@ public class JavaFile { fields.add(field); } - public JavaField[] getFields() { return fields.toArray(new JavaField[fields.size()]); } - public static String addIndentation(String source, int indentation, String lineSeparator) { return indent(source, indentation, false, lineSeparator); } - public static String setIndentation(String source, int indentation, String lineSeparator) { return indent(source, indentation, true, lineSeparator); } - public static String indent(String source, int indentation, boolean trim, String lineSeparator) { if (trim) { source = source.trim(); @@ -190,12 +169,10 @@ public class JavaFile { return result.toString(); } - public void addBodyCode(String bodyCode) { rawBodyCode.append(bodyCode); } - public String getClassBody(String lineSeparator) { StringBuffer result = new StringBuffer(); if (fields.size() > 0) { @@ -237,7 +214,6 @@ public class JavaFile { return result.toString(); } - public String getClassDefinition(String lineSeparator) { StringBuffer result = new StringBuffer(); result.append(getModifiersText(modifiers)); @@ -258,7 +234,7 @@ public class JavaFile { result.append(" implements ").append(interfaces.get(0)); for (int i = 1; i < interfaces.size(); i++) { /*if (i > 0) { - result.append(", "); + result.append(", "); }*/ result.append(", ").append(interfaces.get(i)); } @@ -270,7 +246,6 @@ public class JavaFile { return result.toString(); } - public static String getModifiersText(int modifiers) { if (modifiers == 0) { return ""; @@ -279,7 +254,6 @@ public class JavaFile { } } - /** * Returns the Java source code for this class. * @@ -337,8 +311,7 @@ public class JavaFile { this.abstractClass = abstractClass; } - public void setSuperGenericType(String superGenericType) { this.superGenericType = superGenericType; } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JavaMethod.java b/jaxx-compiler/src/main/java/jaxx/compiler/JavaMethod.java index e8a2e5e..0d8098e 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JavaMethod.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JavaMethod.java @@ -20,6 +20,7 @@ import java.util.List; * classes and have a return type of <code>null</code>. */ public class JavaMethod implements Comparable<JavaMethod> { + private int modifiers; private String returnType; private String name; @@ -27,7 +28,6 @@ public class JavaMethod implements Comparable<JavaMethod> { private String[] exceptions; private StringBuffer bodyCode; - /** * Constructs a new no-argument <code>JavaMethod</code> which throws no checked exceptions. The * <code>modifiers</code> parameter is a bit mask of the constants from {@link java.lang.reflect.Modifier}, @@ -42,8 +42,6 @@ public class JavaMethod implements Comparable<JavaMethod> { //public JavaMethod(int modifiers, String returnType, String name) { // this(modifiers, returnType, name, null); //} - - /** * Constructs a new <code>JavaMethod</code> which throws no checked exceptions. The <code>modifiers</code> * parameter is a bit mask of the constants from {@link java.lang.reflect.Modifier}, and the @@ -59,8 +57,6 @@ public class JavaMethod implements Comparable<JavaMethod> { //public JavaMethod(int modifiers, String returnType, String name, JavaArgument[] arguments) { // this(modifiers, returnType, name, arguments, null); //} - - /** * Constructs a new <code>JavaMethod</code>. The <code>modifiers</code> parameter is a bit mask of the * constants from {@link java.lang.reflect.Modifier}, and the <code>returnType</code> and <code>exceptions</code> @@ -77,8 +73,6 @@ public class JavaMethod implements Comparable<JavaMethod> { //public JavaMethod(int modifiers, String returnType, String name, JavaArgument[] arguments, String[] exceptions) { // this(modifiers, returnType, name, arguments, exceptions, null); //} - - /** * Constructs a new <code>JavaMethod</code> containing the specified body code. The <code>modifiers</code> parameter * is a bit mask of the constants from {@link java.lang.reflect.Modifier}, and the <code>returnType</code> and @@ -101,7 +95,6 @@ public class JavaMethod implements Comparable<JavaMethod> { this.bodyCode = new StringBuffer(bodyCode != null ? bodyCode : ""); } - /** * Returns a bit mask describing the modifier keywords which should appear as part of this method's * declaration. See <code>java.lang.reflect.Modifier</code> for more information on decoding this @@ -113,7 +106,6 @@ public class JavaMethod implements Comparable<JavaMethod> { return modifiers; } - /** * Returns the method's return type, as it would be represented in Java source code. * @@ -123,7 +115,6 @@ public class JavaMethod implements Comparable<JavaMethod> { return returnType; } - /** * Returns the method's name. * @@ -133,7 +124,6 @@ public class JavaMethod implements Comparable<JavaMethod> { return name; } - /** * Returns a list of the method's arguments. * @@ -143,7 +133,6 @@ public class JavaMethod implements Comparable<JavaMethod> { return arguments; } - /** * Returns a list of exceptions the method can throw. * @@ -153,7 +142,6 @@ public class JavaMethod implements Comparable<JavaMethod> { return exceptions; } - /** * Returns the Java source code for the method's body. * @@ -163,7 +151,6 @@ public class JavaMethod implements Comparable<JavaMethod> { return bodyCode.toString(); } - /** * Appends additional code to the method's body. * @@ -180,7 +167,6 @@ public class JavaMethod implements Comparable<JavaMethod> { bodyCode.append(extraCode); } - /** * Returns the Java source code for this method. * @@ -217,6 +203,7 @@ public class JavaMethod implements Comparable<JavaMethod> { return result.toString(); } + @Override public int compareTo(JavaMethod o) { return COMPARATOR.compare(this, o); } @@ -232,118 +219,125 @@ public class JavaMethod implements Comparable<JavaMethod> { public enum MethodOrder { statics(Modifier.STATIC, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- Statics methods --------------------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { + "/*-- Statics methods --------------------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { }, - constructors(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- Constructors -----------------------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { + "/*-- Constructors -----------------------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + + @Override public boolean accept(JavaMethod method) { return method.returnType == null; } }, - JAXXObject(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- JAXXObject implementation ----------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { + "/*-- JAXXObject implementation ----------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + private List<String> methods = Arrays.asList("applyDataBinding", "firePropertyChange", "getObjectById", "get$objectMap", "processDataBinding", "removeDataBinding"); + @Override public boolean accept(JavaMethod method) { return methods.contains(method.name); } }, - JAXXContext(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- JAXXContext implementation ---------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { + "/*-- JAXXContext implementation ---------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + private List<String> methods = Arrays.asList("getContextValue", "getDelegateContext", "getParentContainer", "removeContextValue", "setContextValue"); + + @Override public boolean accept(JavaMethod method) { return methods.contains(method.name); } }, - JAXXValidation(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- JAXXValidation implementation ------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { + "/*-- JAXXValidation implementation ------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + private List<String> methods = Arrays.asList("getValidator", "getValidatorIds"); + @Override public boolean accept(JavaMethod method) { return methods.contains(method.name); } }, - events(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- Event methods ----------------------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { + "/*-- Event methods ----------------------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + + @Override public boolean accept(JavaMethod method) { return (method.name.startsWith("do") && method.name.indexOf("__") > -1); } }, - publicGetters(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- public acessor methods -------------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { + "/*-- public acessor methods -------------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + + @Override public boolean accept(JavaMethod method) { return (method.name.startsWith("get") || method.name.startsWith("is")); } }, - publicSetters(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- public mutator methods -------------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { + "/*-- public mutator methods -------------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + + @Override public boolean accept(JavaMethod method) { return (method.name.startsWith("set")); } }, - otherPublic(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- public mutator methods -------------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { + "/*-- public mutator methods -------------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + @Override public boolean accept(int mod) { return super.accept(mod) && !Modifier.isStatic(mod); } }, - protectedGetters(Modifier.PROTECTED, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- protected acessors methods ---------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { + "/*-- protected acessors methods ---------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + + @Override public boolean accept(JavaMethod method) { return (method.name.startsWith("get") || method.name.startsWith("is")); } }, - createMethod(Modifier.PROTECTED | Modifier.PRIVATE, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- ui creation methods ----------------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { + "/*-- ui creation methods ----------------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + + @Override public boolean accept(JavaMethod method) { return method.name.startsWith("create") || method.name.startsWith("add") || method.name.equals("$completeSetup") || method.name.equals("$initialize"); } }, - protecteds(Modifier.PROTECTED, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- Other protected methods ------------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { + "/*-- Other protected methods ------------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { }, - packageLocal(0, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- Package methods --------------------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { + "/*-- Package methods --------------------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + @Override public boolean accept(int mod) { return !Modifier.isStatic(mod) && !Modifier.isPublic(mod) && !Modifier.isProtected(mod); - }}, - + } + }, privates(Modifier.PRIVATE, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- Private methods --------------------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { + "/*-- Private methods --------------------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { }; - private final String header; - private int modifier; MethodOrder(int modifier, String header) { @@ -436,20 +430,20 @@ public class JavaMethod implements Comparable<JavaMethod> { } return constants; } - public static final Comparator<JavaMethod> COMPARATOR = new Comparator<JavaMethod>() { + @Override public int compare(JavaMethod o1, JavaMethod o2) { /*int result; if ((result = compareStatic(o1, o2)) != 0) { - return result; + return result; } if ((result = compareConstructor(o1, o2)) != 0) { - return result; + return result; } if ((result = compareVisibility(o1, o2)) != 0) { - return result; + return result; }*/ return o1.name.compareTo(o2.name); } @@ -496,4 +490,4 @@ public class JavaMethod implements Comparable<JavaMethod> { return 0; } }; -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/ScriptInitializer.java b/jaxx-compiler/src/main/java/jaxx/compiler/ScriptInitializer.java index e9d1caf..7fd6d5b 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/ScriptInitializer.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/ScriptInitializer.java @@ -4,7 +4,7 @@ */ package jaxx.compiler; -import jaxx.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.ClassDescriptorLoader; /** * A dummy CompiledObject which serves to initialize scripted field. This is handled by @@ -12,9 +12,10 @@ import jaxx.reflect.ClassDescriptorLoader; * ensure that the field is initialized in document order. */ public class ScriptInitializer extends CompiledObject { - public ScriptInitializer(String initializer, JAXXCompiler compiler) { + + public ScriptInitializer(String initializer, JAXXCompiler compiler) { super(compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(ScriptInitializer.class)), ClassDescriptorLoader.getClassDescriptor(ScriptInitializer.class), compiler, false); appendInitializationCode(initializer); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/ScriptManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/ScriptManager.java index fd6a878..85fc1cd 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/ScriptManager.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/ScriptManager.java @@ -1,12 +1,11 @@ package jaxx.compiler; -import jaxx.CompilerException; -import jaxx.parser.JavaParser; -import jaxx.parser.JavaParserTreeConstants; -import jaxx.parser.SimpleNode; -import jaxx.reflect.FieldDescriptor; -import jaxx.reflect.MethodDescriptor; -import jaxx.tags.TagManager; +import jaxx.compiler.parser.java.JavaParser; +import jaxx.compiler.parser.java.JavaParserTreeConstants; +import jaxx.compiler.parser.java.SimpleNode; +import jaxx.compiler.reflect.FieldDescriptor; +import jaxx.compiler.reflect.MethodDescriptor; +import jaxx.compiler.tags.TagManager; import java.io.StringReader; import java.lang.reflect.Modifier; @@ -15,14 +14,13 @@ import java.util.Arrays; import java.util.List; public class ScriptManager { - private JAXXCompiler compiler; + private JAXXCompiler compiler; ScriptManager(JAXXCompiler compiler) { this.compiler = compiler; } - /** * Strips unnecessary curly braces from around the script, generating a warning if they are found. * @@ -38,7 +36,6 @@ public class ScriptManager { return script; } - public void checkParse(String script) throws CompilerException { script = trimScript(script); JavaParser p = new JavaParser(new StringReader(script)); @@ -47,7 +44,6 @@ public class ScriptManager { } } - public String preprocessScript(String script) throws CompilerException { script = trimScript(script); StringBuffer result = new StringBuffer(); @@ -63,7 +59,6 @@ public class ScriptManager { return result.toString(); } - /** * Scans through a compound symbol (foo.bar.baz) to identify and compile the JAXX class it refers to, if any. * @@ -73,8 +68,9 @@ public class ScriptManager { String[] tokens = symbol.split("\\."); StringBuffer currentSymbol = new StringBuffer(); for (String token : tokens) { - if (currentSymbol.length() > 0) + if (currentSymbol.length() > 0) { currentSymbol.append('.'); + } currentSymbol.append(token.trim()); String contextClass = TagManager.resolveClassName(currentSymbol.toString(), compiler); @@ -84,17 +80,17 @@ public class ScriptManager { } } - private void preprocessScriptNode(SimpleNode node, boolean staticContext) throws CompilerException { // identify static methods and initializers -- we can't fire events statically if (node.getId() == JavaParserTreeConstants.JJTMETHODDECLARATION) { if (node.getParent().getChild(0).getText().indexOf("static") != -1) { staticContext = true; } - } else if (node.getId() == JavaParserTreeConstants.JJTINITIALIZER) + } else if (node.getId() == JavaParserTreeConstants.JJTINITIALIZER) { if (node.getText().trim().startsWith("static")) { staticContext = true; } + } int count = node.jjtGetNumChildren(); for (int i = 0; i < count; i++) { @@ -109,9 +105,7 @@ public class ScriptManager { String lhs = null; if (id == JavaParserTreeConstants.JJTASSIGNMENTEXPRESSION || (id == JavaParserTreeConstants.JJTPOSTFIXEXPRESSION && node.jjtGetNumChildren() == 2)) { lhs = ((SimpleNode) node.jjtGetChild(0)).getText().trim(); - } - else - if (id == JavaParserTreeConstants.JJTPREINCREMENTEXPRESSION || id == JavaParserTreeConstants.JJTPREDECREMENTEXPRESSION) { + } else if (id == JavaParserTreeConstants.JJTPREINCREMENTEXPRESSION || id == JavaParserTreeConstants.JJTPREDECREMENTEXPRESSION) { lhs = ((SimpleNode) node.jjtGetChild(0)).getText().trim(); } if (lhs != null) { @@ -128,7 +122,6 @@ public class ScriptManager { } } - /** * Examines a Line to determine its real type. As all tokens returned by the parser are Lines, and * they are just a tiny wrapper around the real node, this method strips off the wrapper layers to identify @@ -144,8 +137,7 @@ public class ScriptManager { if (node.jjtGetNumChildren() == 1) { return node.getChild(0).getId(); } - } else - if (node.getId() == JavaParserTreeConstants.JJTCLASSORINTERFACEBODYDECLARATION) { + } else if (node.getId() == JavaParserTreeConstants.JJTCLASSORINTERFACEBODYDECLARATION) { int id = node.getChild(0).getId(); if (id == JavaParserTreeConstants.JJTMODIFIERS) { return node.getChild(1).getId(); @@ -159,7 +151,6 @@ public class ScriptManager { return JavaParserTreeConstants.JJTLINE; // generic value implying that it's okay to put into the initializer block } - private SimpleNode findExplicitConstructorInvocation(SimpleNode parent) { if (parent.getId() == JavaParserTreeConstants.JJTEXPLICITCONSTRUCTORINVOCATION) { return parent; @@ -175,32 +166,28 @@ public class ScriptManager { return null; } - private void processConstructor(String modifiers, SimpleNode node) { assert node.getId() == JavaParserTreeConstants.JJTCONSTRUCTORDECLARATION : "expected node to be ConstructorDeclaration, found " + JavaParserTreeConstants.jjtNodeName[node.getId()] + " instead"; assert node.getChild(0).getId() == JavaParserTreeConstants.JJTFORMALPARAMETERS : "expected node 0 to be FormalParameters, found " + JavaParserTreeConstants.jjtNodeName[node.getChild(1).getId()] + " instead"; String code = ""; if (node.getChild(0).jjtGetNumChildren() == 0) { compiler.reportError("The default no-argument constructor may not be redefined"); - } - else { + } else { SimpleNode explicitConstructorInvocation = findExplicitConstructorInvocation(node); if (explicitConstructorInvocation == null || explicitConstructorInvocation.getText().trim().startsWith("super(")) { code = "$initialize();" + JAXXCompiler.getLineSeparator(); if (explicitConstructorInvocation == null) { node.getChild(1).firstToken.image = node.getChild(1).firstToken.image; - } - else { + } else { explicitConstructorInvocation.lastToken.image += code; } } } - compiler.appendBodyCode(modifiers + " "+ node.getText().substring(0,node.getText().length()-1) + code + "}"); + compiler.appendBodyCode(modifiers + " " + node.getText().substring(0, node.getText().length() - 1) + code + "}"); //compiler.bodyCode.append(";\n"); } - private void scanScriptNode(SimpleNode node) throws CompilerException { int nodeType = getLineType(node); if (nodeType == JavaParserTreeConstants.JJTIMPORTDECLARATION) { // have to handle imports early so the preprocessing takes them into account @@ -234,13 +221,11 @@ public class ScriptManager { // FIXME: this check fails for inner classes defined in this file //if (returnType == null) // throw new CompilerException("could not find class '" + rawReturnType + "'"); - } else - if (type == JavaParserTreeConstants.JJTMETHODDECLARATOR) { + } else if (type == JavaParserTreeConstants.JJTMETHODDECLARATOR) { name = child.firstToken.image.trim(); SimpleNode formalParameters = child.getChild(0); assert formalParameters.getId() == JavaParserTreeConstants.JJTFORMALPARAMETERS; - for (int j = 0; j < formalParameters.jjtGetNumChildren(); j++) - { + for (int j = 0; j < formalParameters.jjtGetNumChildren(); j++) { SimpleNode parameter = formalParameters.getChild(j); String rawParameterType = parameter.getChild(1).getText().trim().replaceAll("\\.\\.\\.", "[]"); String parameterType = TagManager.resolveClassName(rawParameterType, compiler); @@ -255,26 +240,23 @@ public class ScriptManager { compiler.appendBodyCode(node.getText()); //compiler.bodyCode.append(";\n"); compiler.addScriptMethod(new MethodDescriptor(name, Modifier.PUBLIC, returnType, parameterTypes.toArray(new String[parameterTypes.size()]), compiler.getClassLoader())); - } else - if (nodeType == JavaParserTreeConstants.JJTCLASSORINTERFACEDECLARATION || + } else if (nodeType == JavaParserTreeConstants.JJTCLASSORINTERFACEDECLARATION || nodeType == JavaParserTreeConstants.JJTINITIALIZER) { String str = node.getText().trim(); if (str.endsWith(";")) { - str+=";"; + str += ";"; } compiler.appendBodyCode(str); //compiler.bodyCode.append(";\n"); - } else - if (nodeType == JavaParserTreeConstants.JJTCONSTRUCTORDECLARATION) { + } else if (nodeType == JavaParserTreeConstants.JJTCONSTRUCTORDECLARATION) { processConstructor(node.getChild(0).getChild(0).getText(), node.getChild(0).getChild(1)); - } else - if (nodeType == JavaParserTreeConstants.JJTLOCALVARIABLEDECLARATION || nodeType == JavaParserTreeConstants.JJTFIELDDECLARATION) { + } else if (nodeType == JavaParserTreeConstants.JJTLOCALVARIABLEDECLARATION || nodeType == JavaParserTreeConstants.JJTFIELDDECLARATION) { // the "local" variable declarations in this expression aren't actually local -- they are flagged local // just because there isn't an enclosing class scope visible to the parser. "Real" local variable // declarations won't show up here, because they will be buried inside of methods. String text = node.getText().trim(); if (!text.endsWith(";")) { - text+=";"; + text += ";"; } String declaration = text; int equals = text.indexOf("="); @@ -301,6 +283,8 @@ public class ScriptManager { } final String finalInitializer = name + " = " + initializer; compiler.registerInitializer(new Runnable() { + + @Override public void run() { compiler.registerCompiledObject(new ScriptInitializer(finalInitializer, compiler)); } @@ -322,7 +306,6 @@ public class ScriptManager { } } - public void registerScript(String script) throws CompilerException { JavaParser p = new JavaParser(new StringReader(script)); //JavaParser p = new JavaParser(new StringReader(script + ";")); diff --git a/jaxx-compiler/src/main/java/jaxx/css/StylesheetHelper.java b/jaxx-compiler/src/main/java/jaxx/compiler/StylesheetHelper.java similarity index 67% rename from jaxx-compiler/src/main/java/jaxx/css/StylesheetHelper.java rename to jaxx-compiler/src/main/java/jaxx/compiler/StylesheetHelper.java index ea6dbd8..96de766 100644 --- a/jaxx-compiler/src/main/java/jaxx/css/StylesheetHelper.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/StylesheetHelper.java @@ -1,19 +1,17 @@ -package jaxx.css; - -import jaxx.CompilerException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.DataBinding; -import jaxx.compiler.DataSource; -import jaxx.compiler.JAXXCompiler; -import jaxx.parser.JavaParser; -import jaxx.parser.JavaParserTreeConstants; -import jaxx.parser.SimpleNode; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.reflect.MethodDescriptor; -import jaxx.tags.DefaultObjectHandler; -import jaxx.tags.TagManager; -import jaxx.types.TypeManager; +package jaxx.compiler; + +import jaxx.runtime.css.Selector; +import jaxx.runtime.css.Rule; +import jaxx.runtime.css.Stylesheet; +import jaxx.compiler.parser.java.JavaParser; +import jaxx.compiler.parser.java.JavaParserTreeConstants; +import jaxx.compiler.parser.java.SimpleNode; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.MethodDescriptor; +import jaxx.compiler.tags.DefaultObjectHandler; +import jaxx.compiler.tags.TagManager; +import jaxx.compiler.types.TypeManager; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; @@ -91,12 +89,12 @@ public class StylesheetHelper { * @param code ? * @param id ? * @return ? - * @throws jaxx.CompilerException ? + * @throws CompilerException ? */ public static String replaceObjectReferences(String code, String id) throws CompilerException { JavaParser p = new JavaParser(new StringReader(code + ";")); p.Expression(); - jaxx.parser.SimpleNode node = p.popNode(); + jaxx.compiler.parser.java.SimpleNode node = p.popNode(); scanNode(node, id); return node.getText(); } @@ -162,68 +160,68 @@ public class StylesheetHelper { } /*if (pseudoClass.equals("mouseover")) { - try { - MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); - object.addEventHandler("style." + pseudoClass + ".add", addMouseListener, - ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseEntered", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), - propertyCode, compiler); - } - catch (NoSuchMethodException e) { - compiler.reportError("mouseover pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); - } + try { + MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", + new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); + object.addEventHandler("style." + pseudoClass + ".add", addMouseListener, + ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseEntered", + new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), + propertyCode, compiler); + } + catch (NoSuchMethodException e) { + compiler.reportError("mouseover pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); + } } else if (pseudoClass.equals("mouseout")) { - try { - MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); - object.addEventHandler("style." + pseudoClass + ".add", addMouseListener, - ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseExited", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), - propertyCode, compiler); - compiler.appendInitDataBindings("{" + propertyCode + "}"); - } - catch (NoSuchMethodException e) { - compiler.reportError("mouseout pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); - } + try { + MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", + new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); + object.addEventHandler("style." + pseudoClass + ".add", addMouseListener, + ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseExited", + new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), + propertyCode, compiler); + compiler.appendInitDataBindings("{" + propertyCode + "}"); + } + catch (NoSuchMethodException e) { + compiler.reportError("mouseout pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); + } } else if (pseudoClass.equals("mousedown")) { - try { - MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); - object.addEventHandler("style." + pseudoClass + ".add", addMouseListener, - ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mousePressed", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), - propertyCode, compiler); - } - catch (NoSuchMethodException e) { - compiler.reportError("mousedown pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); - } + try { + MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", + new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); + object.addEventHandler("style." + pseudoClass + ".add", addMouseListener, + ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mousePressed", + new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), + propertyCode, compiler); + } + catch (NoSuchMethodException e) { + compiler.reportError("mousedown pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); + } } else if (pseudoClass.equals("mouseup")) { - try { - MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); - object.addEventHandler("style." + pseudoClass + ".add", addMouseListener, - ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseReleased", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), - propertyCode, compiler); - compiler.appendInitDataBindings("{" + propertyCode + "}"); - } - catch (NoSuchMethodException e) { - compiler.reportError("mouseup pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); - } + try { + MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", + new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); + object.addEventHandler("style." + pseudoClass + ".add", addMouseListener, + ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseReleased", + new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), + propertyCode, compiler); + compiler.appendInitDataBindings("{" + propertyCode + "}"); + } + catch (NoSuchMethodException e) { + compiler.reportError("mouseup pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); + } } else if (pseudoClass.startsWith("{")) { - pseudoClass = pseudoClass.substring(1, pseudoClass.length() - 1).trim(); - pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode()); - String dest = object.getId() + ".style." + pseudoClass + ".add"; - String destCode = TypeManager.getJavaCode(dest); - if (compiler.haveProcessDataBinding()) { - compiler.appendProcessDataBinding("else "); - } - compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + pseudoClass + ") { "+ propertyCode + "} }"); - new DataSource(dest, pseudoClass, compiler).compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + destCode + ")"); - compiler.appendInitDataBindings("applyDataBinding("+ destCode + ");"); + pseudoClass = pseudoClass.substring(1, pseudoClass.length() - 1).trim(); + pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode()); + String dest = object.getId() + ".style." + pseudoClass + ".add"; + String destCode = TypeManager.getJavaCode(dest); + if (compiler.haveProcessDataBinding()) { + compiler.appendProcessDataBinding("else "); + } + compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + pseudoClass + ") { "+ propertyCode + "} }"); + new DataSource(dest, pseudoClass, compiler).compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + destCode + ")"); + compiler.appendInitDataBindings("applyDataBinding("+ destCode + ");"); } else - throw new IllegalArgumentException("unrecognized pseudoclass: " + pseudoClass);*/ + throw new IllegalArgumentException("unrecognized pseudoclass: " + pseudoClass);*/ } public static void compilePseudoClassRemove(String pseudoClass, CompiledObject object, String propertyCode, JAXXCompiler compiler) throws CompilerException { @@ -272,66 +270,66 @@ public class StylesheetHelper { } /*if (pseudoClass.equals("mouseover")) { - try { - MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); - object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener, - ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseExited", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), - propertyCode, compiler); - } - catch (NoSuchMethodException e) { - compiler.reportError("mouseover pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); - } + try { + MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", + new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); + object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener, + ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseExited", + new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), + propertyCode, compiler); + } + catch (NoSuchMethodException e) { + compiler.reportError("mouseover pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); + } } else if (pseudoClass.equals("mouseout")) { - try { - MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); - object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener, - ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseEntered", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), - propertyCode, compiler); - } - catch (NoSuchMethodException e) { - compiler.reportError("mouseout pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); - } + try { + MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", + new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); + object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener, + ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseEntered", + new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), + propertyCode, compiler); + } + catch (NoSuchMethodException e) { + compiler.reportError("mouseout pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); + } } else if (pseudoClass.equals("mousedown")) { - try { - MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); - object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener, - ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseReleased", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), - propertyCode, compiler); - } - catch (NoSuchMethodException e) { - compiler.reportError("mousedown pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); - } + try { + MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", + new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); + object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener, + ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseReleased", + new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), + propertyCode, compiler); + } + catch (NoSuchMethodException e) { + compiler.reportError("mousedown pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); + } } else if (pseudoClass.equals("mouseup")) { - try { - MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); - object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener, - ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mousePressed", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), - propertyCode, compiler); - } - catch (NoSuchMethodException e) { - compiler.reportError("mouseup pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); - } + try { + MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", + new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); + object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener, + ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mousePressed", + new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), + propertyCode, compiler); + } + catch (NoSuchMethodException e) { + compiler.reportError("mouseup pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); + } } else if (pseudoClass.startsWith("{")) { - pseudoClass = pseudoClass.substring(1, pseudoClass.length() - 1).trim(); - pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode()); - String dest = object.getId() + ".style." + pseudoClass + ".remove"; - String destCode = TypeManager.getJavaCode(dest); - if (compiler.haveProcessDataBinding()) { - compiler.appendProcessDataBinding("else "); - } - compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + invert(pseudoClass) + ") { " + propertyCode + "} }"); - new DataSource(dest, pseudoClass, compiler).compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + destCode + ")"); - compiler.appendInitDataBindings("applyDataBinding(" + destCode + ");"); + pseudoClass = pseudoClass.substring(1, pseudoClass.length() - 1).trim(); + pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode()); + String dest = object.getId() + ".style." + pseudoClass + ".remove"; + String destCode = TypeManager.getJavaCode(dest); + if (compiler.haveProcessDataBinding()) { + compiler.appendProcessDataBinding("else "); + } + compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + invert(pseudoClass) + ") { " + propertyCode + "} }"); + new DataSource(dest, pseudoClass, compiler).compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + destCode + ")"); + compiler.appendInitDataBindings("applyDataBinding(" + destCode + ");"); } else { - throw new IllegalArgumentException("unrecognized pseudoclass: " + pseudoClass); + throw new IllegalArgumentException("unrecognized pseudoclass: " + pseudoClass); }*/ } @@ -363,18 +361,18 @@ public class StylesheetHelper { } public static void applyPseudoClass(String pseudoClass, Map<String, String> properties, - CompiledObject object, JAXXCompiler compiler, int priority) throws CompilerException { + CompiledObject object, JAXXCompiler compiler, int priority) throws CompilerException { if (pseudoClass.indexOf("[") != -1) { pseudoClass = pseudoClass.substring(0, pseudoClass.indexOf("[")); } final StringBuffer buffer = new StringBuffer(); /*CompiledObject bufferObject = new CompiledObject(object.getId(), object.getJavaCode(), object.getObjectClass(), compiler, true) { - public void appendInitializationCode(String code) { - buffer.append(code); - } - public void registerDataBinding(String src, String property, String assignment, JAXXCompiler compiler) throws CompilerException { - buffer.append(assignment); - } + public void appendInitializationCode(String code) { + buffer.append(code); + } + public void registerDataBinding(String src, String property, String assignment, JAXXCompiler compiler) throws CompilerException { + buffer.append(assignment); + } };*/ DefaultObjectHandler handler = TagManager.getTagHandler(object.getObjectClass()); @@ -390,10 +388,9 @@ public class StylesheetHelper { property, "(" + JAXXCompiler.getCanonicalName(type) + ") " + dataBinding, compiler), compiler).compile(false); } else { try { - Class typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null; + Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null; valueCode = TypeManager.getJavaCode(TypeManager.convertFromString(e.getValue(), typeClass)); - } - catch (ClassNotFoundException ex) { + } catch (ClassNotFoundException ex) { compiler.reportError("could not find class " + type.getName()); return; } @@ -439,10 +436,9 @@ public class StylesheetHelper { property, "(" + JAXXCompiler.getCanonicalName(type) + ") " + dataBinding, compiler), compiler).compile(false); } else { try { - Class typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null; + Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null; valueCode = TypeManager.getJavaCode(TypeManager.convertFromString(e.getValue(), typeClass)); - } - catch (ClassNotFoundException ex) { + } catch (ClassNotFoundException ex) { compiler.reportError("could not find class " + type.getName()); return; } @@ -530,8 +526,7 @@ public class StylesheetHelper { break; } javaClass = javaClass.getSuperclass(); - } - while (javaClass != null); + } while (javaClass != null); } boolean styleClassMatch = (styleClass == null || styleClass.equals(parent.getStyleClass())); @@ -555,6 +550,7 @@ public class StylesheetHelper { } public enum MouseEventEnum { + mouseover, mouseout, mousedown, diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/SwingCompiler.java b/jaxx-compiler/src/main/java/jaxx/compiler/SwingCompiler.java deleted file mode 100644 index 05e495c..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/SwingCompiler.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler; - -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultObjectHandler; - -import java.io.File; - -/** - * Swing JAXX compiler. - * <p/> - * todo finish javadoc - */ -public class SwingCompiler extends JAXXCompiler { - - /*---------------------------------------------------------------------------------*/ - /*-- Constructor methods ----------------------------------------------------------*/ - /*---------------------------------------------------------------------------------*/ - - public SwingCompiler(ClassLoader classLoader) { - super(classLoader, - new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(Object.class)), - "java.awt.*", - "java.awt.event.*", - "java.beans.*", - "java.io.*", - "java.lang.*", - "java.util.*", - "javax.swing.*", - "javax.swing.border.*", - "javax.swing.event.*", - "jaxx.runtime.swing.JAXXButtonGroup", - "jaxx.runtime.swing.HBox", - "jaxx.runtime.swing.VBox", - "jaxx.runtime.swing.Table", - "static org.nuiton.i18n.I18n._", - "static jaxx.runtime.Util.createImageIcon"); - - - } - - /** - * Creates a new SwingCompiler. - * - * @param baseDir classpath location - * @param options options to pass to javac - * @param src location of file to compile - * @param outputClassName the out file name - */ - public SwingCompiler(File baseDir, File src, String outputClassName, CompilerOptions options) { - super(baseDir, src, outputClassName, options, - new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(Object.class)), - "java.awt.*", - "java.awt.event.*", - "java.beans.*", - "java.io.*", - "java.lang.*", - "java.util.*", - "javax.swing.*", - "javax.swing.border.*", - "javax.swing.event.*", - "jaxx.runtime.swing.JAXXButtonGroup", - "jaxx.runtime.swing.HBox", - "jaxx.runtime.swing.VBox", - "jaxx.runtime.swing.Table", - "static org.nuiton.i18n.I18n._", - "static jaxx.runtime.Util.createImageIcon"); - } - -} \ No newline at end of file diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/SwingGenerator.java b/jaxx-compiler/src/main/java/jaxx/compiler/SwingGenerator.java deleted file mode 100644 index a1235f1..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/SwingGenerator.java +++ /dev/null @@ -1,26 +0,0 @@ -package jaxx.compiler; - -import jaxx.reflect.ClassDescriptorLoader; - -import java.lang.reflect.Modifier; - -/** @author chemit */ -public class SwingGenerator implements Generator { - @Override - public void finalizeCompiler(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) { - - } - - @Override - public void prepareJavaFile(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws ClassNotFoundException { - - //TODO : move this to jaxx-compiler-swing generator - if (ClassDescriptorLoader.getClassDescriptor("jaxx.runtime.swing.Application").isAssignableFrom(root.getObjectClass()) && !compiler.isMainDeclared()) { - // TODO: check for existing main method first - javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC | Modifier.STATIC, "void", "main", - "SwingUtilities.invokeLater(new Runnable() { public void run() { new " + className + "().setVisible(true); } });", - new JavaArgument("String[]", "arg")) - ); - } - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/SymbolTable.java b/jaxx-compiler/src/main/java/jaxx/compiler/SymbolTable.java index 352322c..2fc575f 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/SymbolTable.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/SymbolTable.java @@ -1,7 +1,7 @@ package jaxx.compiler; -import jaxx.reflect.FieldDescriptor; -import jaxx.reflect.MethodDescriptor; +import jaxx.compiler.reflect.FieldDescriptor; +import jaxx.compiler.reflect.MethodDescriptor; import java.util.ArrayList; import java.util.HashMap; @@ -12,27 +12,21 @@ import java.util.Map; public class SymbolTable { private String superclass; - // maps ID strings to class names -- we can't map directly to CompiledObjects, because we // can't create those until after the first pass private Map<String, String> ids = new HashMap<String, String>(); - private List<FieldDescriptor> scriptFields = new ArrayList<FieldDescriptor>(); - private List<MethodDescriptor> scriptMethods = new ArrayList<MethodDescriptor>(); - /** @return the fully-qualified name of the superclass of the class described by this symbol table. */ public String getSuperclassName() { return superclass; } - public void setSuperclassName(String superclass) { this.superclass = superclass; } - /** * @return a map of IDs to class names. Each entry in the map corresponds to a class tag with an * <code>id</code> attribute. The <code>id</code> is the key, and the fully-qualified class name @@ -42,15 +36,13 @@ public class SymbolTable { return ids; } - /** @return a list of <code>FieldDescriptors</code> for fields defined in <script> tags. */ public List<FieldDescriptor> getScriptFields() { return scriptFields; } - /** @return a list of <code>MethodDescriptors</code> for methods defined in <script> tags. */ public List<MethodDescriptor> getScriptMethods() { return scriptMethods; } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/UnsupportedAttributeException.java b/jaxx-compiler/src/main/java/jaxx/compiler/UnsupportedAttributeException.java similarity index 94% rename from jaxx-compiler/src/main/java/jaxx/UnsupportedAttributeException.java rename to jaxx-compiler/src/main/java/jaxx/compiler/UnsupportedAttributeException.java index 95890a8..404fb5e 100644 --- a/jaxx-compiler/src/main/java/jaxx/UnsupportedAttributeException.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/UnsupportedAttributeException.java @@ -2,7 +2,7 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx; +package jaxx.compiler; /** * Thrown by <code>TagHandler</code> when an unsupported attribute is encountered. @@ -10,13 +10,13 @@ package jaxx; * @see jaxx.tags.TagHandler */ public class UnsupportedAttributeException extends CompilerException { + private static final long serialVersionUID = -6919583037172920343L; /** Creates a new <code>UnsupportedAttributeException</code>. */ public UnsupportedAttributeException() { } - /** * Creates a new <code>UnsupportedAttributeException</code> with the specified detail message. * @@ -26,7 +26,6 @@ public class UnsupportedAttributeException extends CompilerException { super(msg); } - /** * Creates a new <code>UnsupportedAttributeException</code> with the specified cause. * @@ -36,7 +35,6 @@ public class UnsupportedAttributeException extends CompilerException { super(initCause); } - /** * Creates a new <code>UnsupportedAttributeException</code> with the specified detail message and cause. * @@ -46,4 +44,4 @@ public class UnsupportedAttributeException extends CompilerException { public UnsupportedAttributeException(String msg, Throwable initCause) { super(msg, initCause); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/UnsupportedTagException.java b/jaxx-compiler/src/main/java/jaxx/compiler/UnsupportedTagException.java similarity index 94% rename from jaxx-compiler/src/main/java/jaxx/UnsupportedTagException.java rename to jaxx-compiler/src/main/java/jaxx/compiler/UnsupportedTagException.java index c0db4f2..1c38eaf 100644 --- a/jaxx-compiler/src/main/java/jaxx/UnsupportedTagException.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/UnsupportedTagException.java @@ -2,7 +2,7 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx; +package jaxx.compiler; /** Thrown by the compiler when an unregistered tag is encountered. */ public class UnsupportedTagException extends CompilerException { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/ValidatorGenerator.java b/jaxx-compiler/src/main/java/jaxx/compiler/ValidatorGenerator.java deleted file mode 100644 index e317805..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/ValidatorGenerator.java +++ /dev/null @@ -1,89 +0,0 @@ -package jaxx.compiler; - -import jaxx.compiler.CompiledObject.ChildRef; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.validator.BeanValidatorHandler; -import jaxx.tags.validator.BeanValidatorHandler.CompiledBeanValidator; -import jaxx.types.TypeManager; - -import java.util.List; - -/** @author chemit */ -public class ValidatorGenerator implements Generator { - - protected static final JavaField VALIDATOR_IDS_FIELD = JavaField.newField(java.lang.reflect.Modifier.PROTECTED, - "java.util.List<String>", "validatorIds", "new ArrayList<String>()" - ); - - @Override - public void finalizeCompiler(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) { - - if (!BeanValidatorHandler.hasValidator(compiler)) { - return; - } - - for (CompiledObject object : compiler.getObjects().values()) { - List<ChildRef> childs = object.getChilds(); - if (childs == null || childs.isEmpty()) { - continue; - } - for (ChildRef child : childs) { - String javaCode = child.getChildJavaCode(); - // some validators are defined on this object - boolean found = BeanValidatorHandler.isComponentUsedByValidator(compiler, child.getChild().getId()); - if (found) { - // box the child component in a JxLayer - child.setChildJavaCode(jaxx.runtime.SwingUtil.class.getName()+".boxComponentWithJxLayer(" + javaCode + ")"); - } - } - } - // register validator - for (CompiledBeanValidator validator : BeanValidatorHandler.getValidators(compiler)) { - String id = TypeManager.getJavaCode(validator.getId()); - compiler.appendLateInitializer("validatorIds.add(" + id + ");"); - compiler.appendLateInitializer(JAXXCompiler.getLineSeparator()); - compiler.appendLateInitializer("getValidator(" + id + ").installUIs();"); - compiler.appendLateInitializer(JAXXCompiler.getLineSeparator()); - compiler.appendLateInitializer("getValidator(" + id + ").reloadBean();"); - //compiler.appendLateInitializer("getValidator(" + id + ").validate();"); - compiler.appendLateInitializer(JAXXCompiler.getLineSeparator()); - } - compiler.appendLateInitializer("validatorIds = java.util.Collections.unmodifiableList(validatorIds);"); - compiler.appendLateInitializer(JAXXCompiler.getLineSeparator()); - } - - @Override - public void prepareJavaFile(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws ClassNotFoundException { - if (!BeanValidatorHandler.hasValidator(compiler)) { - return; - } - Class<?> validatorClass = compiler.getOptions().getValidatorClass(); - String validatorFQN = validatorClass.getName(); - javaFile.addImport(validatorFQN); - - //TODO use the specific JAXXValidator interface (swing, gwt,...) - Class<?> validatorInterface = jaxx.runtime.JAXXValidator.class; - - if (javaFile.isSuperclassIsJAXXObject()) { - ClassDescriptor superClass = ClassDescriptorLoader.getClassDescriptor(javaFile.getSuperClass()); - boolean parentIsValidator = ClassDescriptorLoader.getClassDescriptor(validatorInterface).isAssignableFrom(superClass); - - if (parentIsValidator) { - // nothing to generate (use the parent directly) - return; - } - } - - // add JAXXValidator interface - javaFile.addInterface(JAXXCompiler.getCanonicalName(validatorInterface)); - - // implements JAXXValidator - javaFile.addField(VALIDATOR_IDS_FIELD); - javaFile.addMethod(JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, validatorFQN + "<?>", "getValidator", - "return (" + validatorFQN + ") (validatorIds.contains(validatorId) ? getObjectById(validatorId) : null);", - new JavaArgument("String", "validatorId") - )); - } - -} diff --git a/jaxx-compiler/src/main/java/jaxx/beaninfos/BeanInfoUtil.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/BeanInfoUtil.java similarity index 97% rename from jaxx-compiler/src/main/java/jaxx/beaninfos/BeanInfoUtil.java rename to jaxx-compiler/src/main/java/jaxx/compiler/beans/BeanInfoUtil.java index c99297a..b998b14 100644 --- a/jaxx-compiler/src/main/java/jaxx/beaninfos/BeanInfoUtil.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/BeanInfoUtil.java @@ -1,4 +1,4 @@ -package jaxx.beaninfos; +package jaxx.compiler.beans; import java.beans.Introspector; import java.util.ArrayList; diff --git a/jaxx-compiler/src/main/java/jaxx/introspection/JAXXBeanDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanDescriptor.java similarity index 82% rename from jaxx-compiler/src/main/java/jaxx/introspection/JAXXBeanDescriptor.java rename to jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanDescriptor.java index 8cc1bbe..512f735 100644 --- a/jaxx-compiler/src/main/java/jaxx/introspection/JAXXBeanDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanDescriptor.java @@ -1,6 +1,6 @@ -package jaxx.introspection; +package jaxx.compiler.beans; -import jaxx.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptor; /** * Mirrors the class <code>java.beans.BeanDescriptor</code>. JAXX uses its own introspector rather than the built-in @@ -8,7 +8,8 @@ import jaxx.reflect.ClassDescriptor; * not just <code>java.lang.Class</code>. */ public class JAXXBeanDescriptor extends JAXXFeatureDescriptor { + public JAXXBeanDescriptor(ClassDescriptor beanClass) { super(beanClass, beanClass.getName()); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/introspection/JAXXBeanInfo.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanInfo.java similarity index 82% rename from jaxx-compiler/src/main/java/jaxx/introspection/JAXXBeanInfo.java rename to jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanInfo.java index a355bb0..bb0bfbb 100644 --- a/jaxx-compiler/src/main/java/jaxx/introspection/JAXXBeanInfo.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanInfo.java @@ -1,4 +1,4 @@ -package jaxx.introspection; +package jaxx.compiler.beans; /** * Mirrors the class <code>java.beans.BeanInfo</code>. JAXX uses its own introspector rather than the built-in @@ -6,31 +6,28 @@ package jaxx.introspection; * not just <code>java.lang.Class</code>. */ public class JAXXBeanInfo { + private JAXXBeanDescriptor beanDescriptor; private JAXXPropertyDescriptor[] propertyDescriptors; private JAXXEventSetDescriptor[] eventSetDescriptors; - public JAXXBeanInfo(JAXXBeanDescriptor beanDescriptor, - JAXXPropertyDescriptor[] propertyDescriptors, - JAXXEventSetDescriptor[] eventSetDescriptors) { + JAXXPropertyDescriptor[] propertyDescriptors, + JAXXEventSetDescriptor[] eventSetDescriptors) { this.beanDescriptor = beanDescriptor; this.propertyDescriptors = propertyDescriptors; this.eventSetDescriptors = eventSetDescriptors; } - public JAXXBeanDescriptor getJAXXBeanDescriptor() { return beanDescriptor; } - public JAXXPropertyDescriptor[] getJAXXPropertyDescriptors() { return propertyDescriptors; } - public JAXXEventSetDescriptor[] getJAXXEventSetDescriptors() { return eventSetDescriptors; } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/introspection/JAXXEventSetDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXEventSetDescriptor.java similarity index 81% rename from jaxx-compiler/src/main/java/jaxx/introspection/JAXXEventSetDescriptor.java rename to jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXEventSetDescriptor.java index 92af3db..37b8cca 100644 --- a/jaxx-compiler/src/main/java/jaxx/introspection/JAXXEventSetDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXEventSetDescriptor.java @@ -1,7 +1,7 @@ -package jaxx.introspection; +package jaxx.compiler.beans; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.MethodDescriptor; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.MethodDescriptor; /** * Mirrors the class <code>java.beans.EventSetDescriptor</code>. JAXX uses its own introspector rather than the built-in @@ -9,31 +9,28 @@ import jaxx.reflect.MethodDescriptor; * not just <code>java.lang.Class</code>. */ public class JAXXEventSetDescriptor extends JAXXFeatureDescriptor { + private MethodDescriptor addListenerMethod; private MethodDescriptor removeListenerMethod; private MethodDescriptor[] listenerMethods; - public JAXXEventSetDescriptor(ClassDescriptor classDescriptor, String name, MethodDescriptor addListenerMethod, - MethodDescriptor removeListenerMethod, MethodDescriptor[] listenerMethods) { + MethodDescriptor removeListenerMethod, MethodDescriptor[] listenerMethods) { super(classDescriptor, name); this.addListenerMethod = addListenerMethod; this.removeListenerMethod = removeListenerMethod; this.listenerMethods = listenerMethods; } - public MethodDescriptor getAddListenerMethod() { return addListenerMethod; } - public MethodDescriptor getRemoveListenerMethod() { return removeListenerMethod; } - public MethodDescriptor[] getListenerMethods() { return listenerMethods; } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/introspection/JAXXFeatureDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXFeatureDescriptor.java similarity index 76% rename from jaxx-compiler/src/main/java/jaxx/introspection/JAXXFeatureDescriptor.java rename to jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXFeatureDescriptor.java index 49ba384..a036c88 100644 --- a/jaxx-compiler/src/main/java/jaxx/introspection/JAXXFeatureDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXFeatureDescriptor.java @@ -1,6 +1,6 @@ -package jaxx.introspection; +package jaxx.compiler.beans; -import jaxx.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptor; import java.util.HashMap; import java.util.Map; @@ -11,45 +11,42 @@ import java.util.Map; * not just <code>java.lang.Class</code>. */ public class JAXXFeatureDescriptor { + private String name; private Map<String, Object> values; private ClassDescriptor classDescriptor; - JAXXFeatureDescriptor(ClassDescriptor classDescriptor, String name) { - if (name == null || classDescriptor == null) + if (name == null || classDescriptor == null) { throw new NullPointerException(); + } this.name = name; this.classDescriptor = classDescriptor; } - public String getName() { return name; } - public ClassDescriptor getClassDescriptor() { return classDescriptor; } - public Object getValue(String key) { return values != null ? values.get(key) : null; } - public void setValue(String key, Object value) { - if (values == null) + if (values == null) { values = new HashMap<String, Object>(); + } values.put(key, value); } - public static String capitalize(String name) { - if (name.length() == 0) + if (name.length() == 0) { return name; - else - return Character.toUpperCase(name.charAt(0)) + name.substring(1); + } + return Character.toUpperCase(name.charAt(0)) + name.substring(1); } } diff --git a/jaxx-compiler/src/main/java/jaxx/introspection/JAXXIntrospector.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java similarity index 86% rename from jaxx-compiler/src/main/java/jaxx/introspection/JAXXIntrospector.java rename to jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java index 92d43f8..06b3b3c 100644 --- a/jaxx-compiler/src/main/java/jaxx/introspection/JAXXIntrospector.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java @@ -1,8 +1,8 @@ -package jaxx.introspection; +package jaxx.compiler.beans; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.reflect.MethodDescriptor; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.MethodDescriptor; import java.beans.BeanDescriptor; import java.beans.BeanInfo; @@ -28,6 +28,7 @@ import java.util.Map; * not just <code>java.lang.Class</code>. */ public class JAXXIntrospector { + private ClassDescriptor classDescriptor; private Map<String, JAXXPropertyDescriptor> propertyDescriptors = new HashMap<String, JAXXPropertyDescriptor>(); private Map<String, JAXXEventSetDescriptor> eventSetDescriptors = new HashMap<String, JAXXEventSetDescriptor>(); @@ -36,7 +37,6 @@ public class JAXXIntrospector { this.classDescriptor = classDescriptor; } - /** * Returns the <code>JAXXBeanInfo</code> for a given class. * @@ -49,14 +49,14 @@ public class JAXXIntrospector { return introspector.createBeanInfo(); } - private JAXXBeanInfo createBeanInfo() { ClassDescriptor explicitInfoClass = classDescriptor; BeanInfo explicitBeanInfo = null; while (explicitInfoClass != null) { explicitBeanInfo = getExplicitBeanInfo(explicitInfoClass); - if (explicitBeanInfo != null) + if (explicitBeanInfo != null) { break; + } explicitInfoClass = explicitInfoClass.getSuperclass(); } @@ -78,11 +78,9 @@ public class JAXXIntrospector { propertyDescriptor.setValue(name, explicitProperty.getValue(name)); } propertyDescriptors.put(propertyDescriptor.getName(), propertyDescriptor); - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { throw new RuntimeException("Internal error: Could not find ClassDescriptor corresponding to Java " + type, e); - } - catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { throw new RuntimeException("Internal error: Could not find expected MethodDescriptor in " + classDescriptor, e); } } @@ -94,8 +92,7 @@ public class JAXXIntrospector { try { classDescriptor.getMethodDescriptor("addPropertyChangeListener", ClassDescriptorLoader.getClassDescriptor(PropertyChangeListener.class)); propertyChangeSource = true; - } - catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { propertyChangeSource = false; } @@ -104,29 +101,29 @@ public class JAXXIntrospector { String name = method.getName(); if (name.startsWith("get") && name.length() > 3 && Character.isUpperCase(name.charAt(3)) && method.getParameterTypes().length == 0) { String propertyName = Introspector.decapitalize(name.substring(3)); - if (!propertyDescriptors.containsKey(propertyName)) + if (!propertyDescriptors.containsKey(propertyName)) { propertyDescriptors.put(propertyName, new JAXXPropertyDescriptor(classDescriptor, propertyName, method, null, propertyChangeSource)); - } else - if (name.startsWith("is") && name.length() > 2 && Character.isUpperCase(name.charAt(2)) && method.getParameterTypes().length == 0) { + } + } else if (name.startsWith("is") && name.length() > 2 && Character.isUpperCase(name.charAt(2)) && method.getParameterTypes().length == 0) { String propertyName = Introspector.decapitalize(name.substring(2)); - if (!propertyDescriptors.containsKey(propertyName)) + if (!propertyDescriptors.containsKey(propertyName)) { propertyDescriptors.put(propertyName, new JAXXPropertyDescriptor(classDescriptor, propertyName, method, null, propertyChangeSource)); - } else - if (name.startsWith("set") && name.length() > 3 && Character.isUpperCase(name.charAt(3)) && method.getParameterTypes().length == 1) { + } + } else if (name.startsWith("set") && name.length() > 3 && Character.isUpperCase(name.charAt(3)) && method.getParameterTypes().length == 1) { String propertyName = Introspector.decapitalize(name.substring(3)); - if (!propertyDescriptors.containsKey(propertyName)) + if (!propertyDescriptors.containsKey(propertyName)) { propertyDescriptors.put(propertyName, new JAXXPropertyDescriptor(classDescriptor, propertyName, null, method, propertyChangeSource)); - } else - if (name.startsWith("add") && name.length() > 3 && Character.isUpperCase(name.charAt(3))) { + } + } else if (name.startsWith("add") && name.length() > 3 && Character.isUpperCase(name.charAt(3))) { ClassDescriptor[] parameters = method.getParameterTypes(); - if (parameters.length != 1 || !ClassDescriptorLoader.getClassDescriptor(EventListener.class).isAssignableFrom(parameters[0])) + if (parameters.length != 1 || !ClassDescriptorLoader.getClassDescriptor(EventListener.class).isAssignableFrom(parameters[0])) { continue; // not an event listener method + } try { String eventSetName = method.getName().substring(3); MethodDescriptor remove = classDescriptor.getMethodDescriptor("remove" + eventSetName, parameters); eventSetDescriptors.put(eventSetName, new JAXXEventSetDescriptor(classDescriptor, eventSetName, method, remove, parameters[0].getMethodDescriptors())); - } - catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { // no matching remove method, not a valid event } } @@ -149,28 +146,22 @@ public class JAXXIntrospector { eventSetDescriptors.values().toArray(new JAXXEventSetDescriptor[eventSetDescriptors.size()])); } - private static BeanInfo getExplicitBeanInfo(ClassDescriptor classDescriptor) { try { Class beanClass = Class.forName(classDescriptor.getName(), true, classDescriptor.getClassLoader()); // see if there is a class by that name in this package Method findExplicitBeanInfo = Introspector.class.getDeclaredMethod("findExplicitBeanInfo", new Class[]{Class.class}); findExplicitBeanInfo.setAccessible(true); return (BeanInfo) findExplicitBeanInfo.invoke(null, beanClass); - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { return null; // happens for uncompiled classes - } - catch (NoClassDefFoundError e) { + } catch (NoClassDefFoundError e) { return null; // wrong case, etc. - } - catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { throw new RuntimeException("Error: could not find method 'findExplicitBeanInfo' in java.beans.Introspector. You are most likely running a version of Java against which JAXX has not been tested."); - } - catch (InvocationTargetException e) { + } catch (InvocationTargetException e) { throw new RuntimeException(e); - } - catch (IllegalAccessException e) { + } catch (IllegalAccessException e) { throw new RuntimeException(e); } } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/introspection/JAXXPropertyDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXPropertyDescriptor.java similarity index 78% rename from jaxx-compiler/src/main/java/jaxx/introspection/JAXXPropertyDescriptor.java rename to jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXPropertyDescriptor.java index 61b504c..ead6025 100644 --- a/jaxx-compiler/src/main/java/jaxx/introspection/JAXXPropertyDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXPropertyDescriptor.java @@ -1,8 +1,8 @@ -package jaxx.introspection; +package jaxx.compiler.beans; -import jaxx.CompilerException; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.MethodDescriptor; +import jaxx.compiler.CompilerException; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.MethodDescriptor; /** * Mirrors the class <code>java.beans.PropertyDescriptor</code>. JAXX uses its own introspector rather than the built-in @@ -10,6 +10,7 @@ import jaxx.reflect.MethodDescriptor; * not just <code>java.lang.Class</code>. */ public class JAXXPropertyDescriptor extends JAXXFeatureDescriptor { + private ClassDescriptor propertyType; private MethodDescriptor readMethod; private MethodDescriptor writeMethod; @@ -19,40 +20,34 @@ public class JAXXPropertyDescriptor extends JAXXFeatureDescriptor { this(classDescriptor, propertyName, null, null); } - public JAXXPropertyDescriptor(ClassDescriptor classDescriptor, String propertyName, - MethodDescriptor readMethod, MethodDescriptor writeMethod) { + MethodDescriptor readMethod, MethodDescriptor writeMethod) { this(classDescriptor, propertyName, readMethod, writeMethod, false); } - public JAXXPropertyDescriptor(ClassDescriptor classDescriptor, String propertyName, - MethodDescriptor readMethod, MethodDescriptor writeMethod, - boolean bound) { + MethodDescriptor readMethod, MethodDescriptor writeMethod, + boolean bound) { super(classDescriptor, propertyName); this.readMethod = readMethod; this.writeMethod = writeMethod; this.bound = bound; } - public MethodDescriptor getReadMethodDescriptor() { if (readMethod == null) { try { readMethod = getClassDescriptor().getMethodDescriptor("get" + capitalize(getName())); - } - catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { try { readMethod = getClassDescriptor().getMethodDescriptor("is" + capitalize(getName())); - } - catch (NoSuchMethodException e2) { + } catch (NoSuchMethodException e2) { } } } return readMethod; } - public MethodDescriptor getWriteMethodDescriptor() { if (writeMethod == null) { try { @@ -63,20 +58,18 @@ public class JAXXPropertyDescriptor extends JAXXFeatureDescriptor { } else { throw new CompilerException("Internal error: requesting 'set' method for property of unknown type: '" + getName() + "' (in " + getClassDescriptor() + ")"); } - } - catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { } } return writeMethod; } - public ClassDescriptor getPropertyType() { if (propertyType == null) { MethodDescriptor read = getReadMethodDescriptor(); - if (read != null) + if (read != null) { propertyType = read.getReturnType(); - else { + } else { MethodDescriptor write = getWriteMethodDescriptor(); propertyType = write.getParameterTypes()[0]; } @@ -84,13 +77,11 @@ public class JAXXPropertyDescriptor extends JAXXFeatureDescriptor { return propertyType; } - public boolean isBound() { return bound; } - public void setBound(boolean bound) { this.bound = bound; } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/Generator.java b/jaxx-compiler/src/main/java/jaxx/compiler/generators/Generator.java similarity index 72% rename from jaxx-compiler/src/main/java/jaxx/compiler/Generator.java rename to jaxx-compiler/src/main/java/jaxx/compiler/generators/Generator.java index a3c4fe7..5677672 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/Generator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/generators/Generator.java @@ -1,4 +1,8 @@ -package jaxx.compiler; +package jaxx.compiler.generators; + +import jaxx.compiler.CompiledObject; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.JavaFile; /** * TODO javadoc! @@ -10,5 +14,4 @@ public interface Generator { void finalizeCompiler(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className); void prepareJavaFile(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws ClassNotFoundException; - } diff --git a/jaxx-compiler/src/main/java/jaxx/css/CSS.jj b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSS.jj similarity index 100% rename from jaxx-compiler/src/main/java/jaxx/css/CSS.jj rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSS.jj diff --git a/jaxx-compiler/src/main/java/jaxx/css/CSS.jjt b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSS.jjt similarity index 100% rename from jaxx-compiler/src/main/java/jaxx/css/CSS.jjt rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSS.jjt diff --git a/jaxx-compiler/src/main/java/jaxx/css/CSSParser.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParser.java similarity index 96% rename from jaxx-compiler/src/main/java/jaxx/css/CSSParser.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParser.java index ca71bfa..4f3ec61 100644 --- a/jaxx-compiler/src/main/java/jaxx/css/CSSParser.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParser.java @@ -1,5 +1,5 @@ /* Generated By:JJTree&JavaCC: Do not edit this line. CSSParser.java */ -package jaxx.css; +package jaxx.compiler.parser.css; public class CSSParser/*@bgen(jjtree)*/ implements CSSParserTreeConstants, CSSParserConstants {/*@bgen(jjtree)*/ protected JJTCSSParserState jjtree = new JJTCSSParserState(); diff --git a/jaxx-compiler/src/main/java/jaxx/css/CSSParserConstants.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParserConstants.java similarity index 94% rename from jaxx-compiler/src/main/java/jaxx/css/CSSParserConstants.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParserConstants.java index bade092..fba80d5 100644 --- a/jaxx-compiler/src/main/java/jaxx/css/CSSParserConstants.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParserConstants.java @@ -1,5 +1,5 @@ /* Generated By:JJTree&JavaCC: Do not edit this line. CSSParserConstants.java */ -package jaxx.css; +package jaxx.compiler.parser.css; public interface CSSParserConstants { diff --git a/jaxx-compiler/src/main/java/jaxx/css/CSSParserTokenManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParserTokenManager.java similarity index 97% rename from jaxx-compiler/src/main/java/jaxx/css/CSSParserTokenManager.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParserTokenManager.java index 3d4a0d7..cd67bae 100644 --- a/jaxx-compiler/src/main/java/jaxx/css/CSSParserTokenManager.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParserTokenManager.java @@ -1,5 +1,5 @@ /* Generated By:JJTree&JavaCC: Do not edit this line. CSSParserTokenManager.java */ -package jaxx.css; +package jaxx.compiler.parser.css; public class CSSParserTokenManager implements CSSParserConstants { public java.io.PrintStream debugStream = System.out; diff --git a/jaxx-compiler/src/main/java/jaxx/css/CSSParserTreeConstants.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParserTreeConstants.java similarity index 93% rename from jaxx-compiler/src/main/java/jaxx/css/CSSParserTreeConstants.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParserTreeConstants.java index c3a624e..ae5e812 100644 --- a/jaxx-compiler/src/main/java/jaxx/css/CSSParserTreeConstants.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParserTreeConstants.java @@ -1,6 +1,6 @@ /* Generated By:JJTree: Do not edit this line. .\CSSParserTreeConstants.java */ -package jaxx.css; +package jaxx.compiler.parser.css; public interface CSSParserTreeConstants { public int JJTSTYLESHEET = 0; diff --git a/jaxx-compiler/src/main/java/jaxx/css/JJTCSSParserState.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/JJTCSSParserState.java similarity index 95% rename from jaxx-compiler/src/main/java/jaxx/css/JJTCSSParserState.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/css/JJTCSSParserState.java index 21545f5..1388962 100644 --- a/jaxx-compiler/src/main/java/jaxx/css/JJTCSSParserState.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/JJTCSSParserState.java @@ -1,6 +1,6 @@ /* Generated By:JJTree: Do not edit this line. .\JJTCSSParserState.java */ -package jaxx.css; +package jaxx.compiler.parser.css; class JJTCSSParserState { private java.util.Stack<Node> nodes; diff --git a/jaxx-compiler/src/main/java/jaxx/css/Node.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/Node.java similarity index 93% rename from jaxx-compiler/src/main/java/jaxx/css/Node.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/css/Node.java index e1d887a..e625f18 100644 --- a/jaxx-compiler/src/main/java/jaxx/css/Node.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/Node.java @@ -1,6 +1,6 @@ /* Generated By:JJTree: Do not edit this line. Node.java */ -package jaxx.css; +package jaxx.compiler.parser.css; /* All AST nodes must implement this interface. It provides basic machinery for constructing the parent and child relationships diff --git a/jaxx-compiler/src/main/java/jaxx/css/ParseException.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/ParseException.java similarity index 74% rename from jaxx-compiler/src/main/java/jaxx/css/ParseException.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/css/ParseException.java index df4b451..ef13517 100644 --- a/jaxx-compiler/src/main/java/jaxx/css/ParseException.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/ParseException.java @@ -1,7 +1,7 @@ /* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */ -package jaxx.css; +package jaxx.compiler.parser.css; -public class ParseException extends jaxx.parser.ParseException { +public class ParseException extends jaxx.compiler.parser.java.ParseException { private static final long serialVersionUID = 229575674880359031L; public ParseException() { diff --git a/jaxx-compiler/src/main/java/jaxx/css/SimpleCharStream.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/SimpleCharStream.java similarity index 96% rename from jaxx-compiler/src/main/java/jaxx/css/SimpleCharStream.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/css/SimpleCharStream.java index dcbbe0d..7375608 100644 --- a/jaxx-compiler/src/main/java/jaxx/css/SimpleCharStream.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/SimpleCharStream.java @@ -1,5 +1,5 @@ /* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 4.0 */ -package jaxx.css; +package jaxx.compiler.parser.css; /** * An implementation of interface CharStream, where the stream is assumed to diff --git a/jaxx-compiler/src/main/java/jaxx/css/SimpleNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/SimpleNode.java similarity index 94% rename from jaxx-compiler/src/main/java/jaxx/css/SimpleNode.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/css/SimpleNode.java index cad997a..7248314 100644 --- a/jaxx-compiler/src/main/java/jaxx/css/SimpleNode.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/SimpleNode.java @@ -1,6 +1,6 @@ /* Generated By:JJTree: Do not edit this line. SimpleNode.java */ -package jaxx.css; +package jaxx.compiler.parser.css; public class SimpleNode implements Node { protected Node parent; diff --git a/jaxx-compiler/src/main/java/jaxx/css/Token.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/Token.java similarity index 96% rename from jaxx-compiler/src/main/java/jaxx/css/Token.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/css/Token.java index bf785d8..2faa436 100644 --- a/jaxx-compiler/src/main/java/jaxx/css/Token.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/Token.java @@ -1,5 +1,5 @@ /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */ -package jaxx.css; +package jaxx.compiler.parser.css; /** Describes the input token stream. */ diff --git a/jaxx-compiler/src/main/java/jaxx/css/TokenMgrError.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/TokenMgrError.java similarity index 96% rename from jaxx-compiler/src/main/java/jaxx/css/TokenMgrError.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/css/TokenMgrError.java index 9c9b1bc..f2d7370 100644 --- a/jaxx-compiler/src/main/java/jaxx/css/TokenMgrError.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/TokenMgrError.java @@ -1,5 +1,5 @@ /* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */ -package jaxx.css; +package jaxx.compiler.parser.css; public class TokenMgrError extends Error { /* diff --git a/jaxx-compiler/src/main/java/jaxx/parser/JJTJavaParserState.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JJTJavaParserState.java similarity index 95% rename from jaxx-compiler/src/main/java/jaxx/parser/JJTJavaParserState.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JJTJavaParserState.java index b726fbb..dbe4436 100644 --- a/jaxx-compiler/src/main/java/jaxx/parser/JJTJavaParserState.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JJTJavaParserState.java @@ -1,6 +1,6 @@ /* Generated By:JJTree: Do not edit this line. .\JJTJavaParserState.java */ -package jaxx.parser; +package jaxx.compiler.parser.java; class JJTJavaParserState { private java.util.Stack<Node> nodes; diff --git a/jaxx-compiler/src/main/java/jaxx/parser/Java1.5.jj b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Java1.5.jj similarity index 100% rename from jaxx-compiler/src/main/java/jaxx/parser/Java1.5.jj rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Java1.5.jj diff --git a/jaxx-compiler/src/main/java/jaxx/parser/Java1.5.jjt b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Java1.5.jjt similarity index 100% rename from jaxx-compiler/src/main/java/jaxx/parser/Java1.5.jjt rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Java1.5.jjt diff --git a/jaxx-compiler/src/main/java/jaxx/parser/JavaCharStream.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaCharStream.java similarity index 96% rename from jaxx-compiler/src/main/java/jaxx/parser/JavaCharStream.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaCharStream.java index f60fb69..3681bce 100644 --- a/jaxx-compiler/src/main/java/jaxx/parser/JavaCharStream.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaCharStream.java @@ -1,5 +1,5 @@ /* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 4.0 */ -package jaxx.parser; +package jaxx.compiler.parser.java; /** * An implementation of interface CharStream, where the stream is assumed to diff --git a/jaxx-compiler/src/main/java/jaxx/parser/JavaParser.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParser.java similarity index 99% rename from jaxx-compiler/src/main/java/jaxx/parser/JavaParser.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParser.java index 21f786c..a678cec 100644 --- a/jaxx-compiler/src/main/java/jaxx/parser/JavaParser.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParser.java @@ -1,5 +1,5 @@ /* Generated By:JJTree&JavaCC: Do not edit this line. JavaParser.java */ -package jaxx.parser; +package jaxx.compiler.parser.java; import java.io.File; import java.io.FileInputStream; diff --git a/jaxx-compiler/src/main/java/jaxx/parser/JavaParserConstants.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParserConstants.java similarity index 99% rename from jaxx-compiler/src/main/java/jaxx/parser/JavaParserConstants.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParserConstants.java index c0c1075..250800e 100644 --- a/jaxx-compiler/src/main/java/jaxx/parser/JavaParserConstants.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParserConstants.java @@ -1,5 +1,5 @@ /* Generated By:JJTree&JavaCC: Do not edit this line. JavaParserConstants.java */ -package jaxx.parser; +package jaxx.compiler.parser.java; public interface JavaParserConstants { diff --git a/jaxx-compiler/src/main/java/jaxx/parser/JavaParserTokenManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParserTokenManager.java similarity index 99% rename from jaxx-compiler/src/main/java/jaxx/parser/JavaParserTokenManager.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParserTokenManager.java index 73e4d1a..091b13e 100644 --- a/jaxx-compiler/src/main/java/jaxx/parser/JavaParserTokenManager.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParserTokenManager.java @@ -1,5 +1,5 @@ /* Generated By:JJTree&JavaCC: Do not edit this line. JavaParserTokenManager.java */ -package jaxx.parser; +package jaxx.compiler.parser.java; public class JavaParserTokenManager implements JavaParserConstants { public java.io.PrintStream debugStream = System.out; diff --git a/jaxx-compiler/src/main/java/jaxx/parser/JavaParserTreeConstants.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParserTreeConstants.java similarity index 99% rename from jaxx-compiler/src/main/java/jaxx/parser/JavaParserTreeConstants.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParserTreeConstants.java index 52aaead..662a6bd 100644 --- a/jaxx-compiler/src/main/java/jaxx/parser/JavaParserTreeConstants.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParserTreeConstants.java @@ -1,6 +1,6 @@ /* Generated By:JJTree: Do not edit this line. ./JavaParserTreeConstants.java */ -package jaxx.parser; +package jaxx.compiler.parser.java; public interface JavaParserTreeConstants { public int JJTLINE = 0; diff --git a/jaxx-compiler/src/main/java/jaxx/parser/Node.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Node.java similarity index 93% rename from jaxx-compiler/src/main/java/jaxx/parser/Node.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Node.java index 0d26aa0..38fa56e 100644 --- a/jaxx-compiler/src/main/java/jaxx/parser/Node.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Node.java @@ -1,6 +1,6 @@ /* Generated By:JJTree: Do not edit this line. Node.java */ -package jaxx.parser; +package jaxx.compiler.parser.java; /* All AST nodes must implement this interface. It provides basic machinery for constructing the parent and child relationships diff --git a/jaxx-compiler/src/main/java/jaxx/parser/ParseException.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/ParseException.java similarity index 95% rename from jaxx-compiler/src/main/java/jaxx/parser/ParseException.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/java/ParseException.java index c74226b..3ea02a4 100644 --- a/jaxx-compiler/src/main/java/jaxx/parser/ParseException.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/ParseException.java @@ -1,5 +1,5 @@ /* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */ -package jaxx.parser; +package jaxx.compiler.parser.java; /** * This exception is thrown when parse errors are encountered. @@ -10,7 +10,7 @@ package jaxx.parser; * You can modify this class to customize your error reporting * mechanisms so long as you retain the public fields. */ -public class ParseException extends jaxx.CompilerException { +public class ParseException extends jaxx.compiler.CompilerException { int line; int column; private static final long serialVersionUID = 6179854408401024700L; diff --git a/jaxx-compiler/src/main/java/jaxx/parser/SimpleNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/SimpleNode.java similarity index 93% rename from jaxx-compiler/src/main/java/jaxx/parser/SimpleNode.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/java/SimpleNode.java index 07b14f4..3b4ce20 100644 --- a/jaxx-compiler/src/main/java/jaxx/parser/SimpleNode.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/SimpleNode.java @@ -1,8 +1,8 @@ /* Generated By:JJTree: Do not edit this line. SimpleNode.java */ -package jaxx.parser; +package jaxx.compiler.parser.java; -import jaxx.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptor; public class SimpleNode implements Node { protected Node parent; diff --git a/jaxx-compiler/src/main/java/jaxx/parser/Token.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Token.java similarity index 98% rename from jaxx-compiler/src/main/java/jaxx/parser/Token.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Token.java index 03c11a0..00b9fdf 100644 --- a/jaxx-compiler/src/main/java/jaxx/parser/Token.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Token.java @@ -1,5 +1,5 @@ /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */ -package jaxx.parser; +package jaxx.compiler.parser.java; /** Describes the input token stream. */ diff --git a/jaxx-compiler/src/main/java/jaxx/parser/TokenMgrError.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/TokenMgrError.java similarity index 96% rename from jaxx-compiler/src/main/java/jaxx/parser/TokenMgrError.java rename to jaxx-compiler/src/main/java/jaxx/compiler/parser/java/TokenMgrError.java index 654ccd7..6bec3d0 100644 --- a/jaxx-compiler/src/main/java/jaxx/parser/TokenMgrError.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/TokenMgrError.java @@ -1,5 +1,5 @@ /* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */ -package jaxx.parser; +package jaxx.compiler.parser.java; public class TokenMgrError extends Error { /* diff --git a/jaxx-compiler/src/main/java/jaxx/reflect/ClassDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptor.java similarity index 82% rename from jaxx-compiler/src/main/java/jaxx/reflect/ClassDescriptor.java rename to jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptor.java index 4665f5c..32b6d1f 100644 --- a/jaxx-compiler/src/main/java/jaxx/reflect/ClassDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptor.java @@ -1,4 +1,4 @@ -package jaxx.reflect; +package jaxx.compiler.reflect; import jaxx.runtime.JAXXObjectDescriptor; @@ -11,6 +11,7 @@ import java.util.Arrays; * circular dependencies). */ public abstract class ClassDescriptor { + private String name; private String packageName; private String superclass; @@ -23,10 +24,13 @@ public abstract class ClassDescriptor { private MethodDescriptor[] methodDescriptors; private FieldDescriptor[] fieldDescriptors; + public abstract MethodDescriptor getDeclaredMethodDescriptor(String name, ClassDescriptor... parameterTypes) throws NoSuchMethodException; + + public abstract FieldDescriptor getDeclaredFieldDescriptor(String name) throws NoSuchFieldException; ClassDescriptor(String name, String packageName, String superclass, String[] interfaces, boolean isInterface, - boolean isArray, String componentType, JAXXObjectDescriptor jaxxObjectDescriptor, - ClassLoader classLoader, MethodDescriptor[] methodDescriptors, FieldDescriptor[] fieldDescriptors) { + boolean isArray, String componentType, JAXXObjectDescriptor jaxxObjectDescriptor, + ClassLoader classLoader, MethodDescriptor[] methodDescriptors, FieldDescriptor[] fieldDescriptors) { this.name = name; this.packageName = packageName; this.superclass = superclass; @@ -40,27 +44,22 @@ public abstract class ClassDescriptor { this.fieldDescriptors = fieldDescriptors; } - public String getName() { return name; } - public String getPackageName() { return packageName; } - public ClassDescriptor getSuperclass() { try { return superclass != null ? ClassDescriptorLoader.getClassDescriptor(superclass, getClassLoader()) : null; - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } - public ClassDescriptor[] getInterfaces() { try { ClassDescriptor[] result = new ClassDescriptor[interfaces.length]; @@ -68,63 +67,48 @@ public abstract class ClassDescriptor { result[i] = ClassDescriptorLoader.getClassDescriptor(interfaces[i], getClassLoader()); } return result; - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } - public boolean isInterface() { return isInterface; } - public boolean isArray() { return isArray; } - public ClassDescriptor getComponentType() { try { return componentType != null ? ClassDescriptorLoader.getClassDescriptor(componentType, getClassLoader()) : null; - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } - public ClassLoader getClassLoader() { return classLoader; } - public MethodDescriptor[] getMethodDescriptors() { return methodDescriptors; } - public MethodDescriptor getMethodDescriptor(String name, ClassDescriptor... parameterTypes) throws NoSuchMethodException { for (MethodDescriptor methodDescriptor : methodDescriptors) { - if (methodDescriptor.getName().equals(name) - && methodDescriptor.getParameterTypes().length == parameterTypes.length - && Arrays.equals(methodDescriptor.getParameterTypes(), parameterTypes)) { + if (methodDescriptor.getName().equals(name) && methodDescriptor.getParameterTypes().length == parameterTypes.length && Arrays.equals(methodDescriptor.getParameterTypes(), parameterTypes)) { return methodDescriptor; } } throw new NoSuchMethodException("Could not find method " + name + "(" + Arrays.asList(parameterTypes) + ") in " + getName()); } - - public abstract MethodDescriptor getDeclaredMethodDescriptor(String name, ClassDescriptor... parameterTypes) throws NoSuchMethodException; - - public FieldDescriptor[] getFieldDescriptors() { return fieldDescriptors; } - public FieldDescriptor getFieldDescriptor(String name) throws NoSuchFieldException { for (FieldDescriptor fieldDescriptor : fieldDescriptors) { if (fieldDescriptor.getName().equals(name)) { @@ -134,22 +118,16 @@ public abstract class ClassDescriptor { throw new NoSuchFieldException("Could not find field " + name + " in " + getName()); } - - public abstract FieldDescriptor getDeclaredFieldDescriptor(String name) throws NoSuchFieldException; - - public JAXXObjectDescriptor getJAXXObjectDescriptor() { return jaxxObjectDescriptor; } - public boolean isAssignableFrom(ClassDescriptor descriptor) { while (descriptor != null) { if (descriptor == this) { return true; } - ClassDescriptor[] interfaces = descriptor.getInterfaces(); - for (ClassDescriptor anInterface : interfaces) { + for (ClassDescriptor anInterface : descriptor.getInterfaces()) { if (anInterface == this) { return true; } @@ -163,4 +141,4 @@ public abstract class ClassDescriptor { public String toString() { return "ClassDescriptor[" + getName() + "]"; } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/reflect/ClassDescriptorLoader.java b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorLoader.java similarity index 77% rename from jaxx-compiler/src/main/java/jaxx/reflect/ClassDescriptorLoader.java rename to jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorLoader.java index 845fdee..2abf7f6 100644 --- a/jaxx-compiler/src/main/java/jaxx/reflect/ClassDescriptorLoader.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorLoader.java @@ -1,6 +1,6 @@ -package jaxx.reflect; +package jaxx.compiler.reflect; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.JAXXCompiler; import jaxx.compiler.JAXXCompilerLaunchor; import jaxx.compiler.SymbolTable; @@ -38,7 +38,6 @@ public class ClassDescriptorLoader { private ClassDescriptorLoader() { } - public static synchronized ClassDescriptor getClassDescriptor(String className) throws ClassNotFoundException { return getClassDescriptor(className, Thread.currentThread().getContextClassLoader()); //return getClassDescriptor(className, ClassDescriptorLoader.class.getClassLoader()); @@ -46,77 +45,79 @@ public class ClassDescriptorLoader { public static synchronized ClassDescriptor getClassDescriptor(String className, ClassLoader classLoader) throws ClassNotFoundException { ClassDescriptor result = descriptors.get(className); - if (result == null) { - if (JAXXCompilerLaunchor.isRegistred() && JAXXCompilerLaunchor.get().getSymbolTable(className) != null) { - result = createClassDescriptorFromSymbolTable(className, classLoader); - } else { - if (classLoader == null) { - classLoader = ClassDescriptorLoader.class.getClassLoader(); - } + if (result != null) { + return result; + } - String relativePath = className.replaceAll("\\.", "/"); - String relativePathPattern = ".*";// + className + ".*"; // used to ensure that the located resource has the right character cases +// if (result == null) { + if (JAXXCompilerLaunchor.isRegistred() && JAXXCompilerLaunchor.get().getSymbolTable(className) != null) { + result = createClassDescriptorFromSymbolTable(className, classLoader); + } else { + if (classLoader == null) { + classLoader = ClassDescriptorLoader.class.getClassLoader(); + } - // find the most recently updated source for the class -- Java source, JAXX source, or compiled class file - long javaLastModified = -1; - URL javaFile = classLoader.getResource(relativePath + ".java"); - if (javaFile != null && javaFile.toString().startsWith("file:") && javaFile.toString().matches(relativePathPattern)) { - javaLastModified = JAXXCompiler.URLtoFile(javaFile).lastModified(); - } + String relativePath = className.replaceAll("\\.", "/"); + String relativePathPattern = ".*";// + className + ".*"; // used to ensure that the located resource has the right character cases - long classLastModified = -1; - URL classFile = classLoader.getResource(relativePath + ".class"); - if (classFile != null && classFile.toString().startsWith("file:") && classFile.toString().matches(relativePathPattern)) { - classLastModified = JAXXCompiler.URLtoFile(classFile).lastModified(); - } + // find the most recently updated source for the class -- Java source, JAXX source, or compiled class file + long javaLastModified = -1; + URL javaFile = classLoader.getResource(relativePath + ".java"); + if (javaFile != null && javaFile.toString().startsWith("file:") && javaFile.toString().matches(relativePathPattern)) { + javaLastModified = JAXXCompiler.URLtoFile(javaFile).lastModified(); + } - long jaxxLastModified = -1; - URL jaxxFile = classLoader.getResource(relativePath + ".jaxx"); - if (jaxxFile != null && jaxxFile.toString().startsWith("file:") && jaxxFile.toString().matches(relativePathPattern)) { - File jaxxFilePath = JAXXCompiler.URLtoFile(jaxxFile); - jaxxLastModified = jaxxFilePath.lastModified(); - String simplePath = jaxxFilePath.getPath(); - simplePath = simplePath.substring(0, simplePath.length() - ".jaxx".length()); - File cssFilePath = new File(simplePath + ".css"); - if (cssFilePath.exists()) { - jaxxLastModified = Math.max(jaxxLastModified, cssFilePath.lastModified()); - } - File scriptFilePath = new File(simplePath + ".script"); - if (scriptFilePath.exists()) { - jaxxLastModified = Math.max(jaxxLastModified, scriptFilePath.lastModified()); - } - } + long classLastModified = -1; + URL classFile = classLoader.getResource(relativePath + ".class"); + if (classFile != null && classFile.toString().startsWith("file:") && classFile.toString().matches(relativePathPattern)) { + classLastModified = JAXXCompiler.URLtoFile(classFile).lastModified(); + } - if (jaxxLastModified != -1 && JAXXCompilerLaunchor.isRegistred() && JAXXCompilerLaunchor.get().getSymbolTable(className) == null) { - jaxxLastModified = -1; // file has been modified, but wasn't included in this + long jaxxLastModified = -1; + URL jaxxFile = classLoader.getResource(relativePath + ".jaxx"); + if (jaxxFile != null && jaxxFile.toString().startsWith("file:") && jaxxFile.toString().matches(relativePathPattern)) { + File jaxxFilePath = JAXXCompiler.URLtoFile(jaxxFile); + jaxxLastModified = jaxxFilePath.lastModified(); + String simplePath = jaxxFilePath.getPath(); + simplePath = simplePath.substring(0, simplePath.length() - ".jaxx".length()); + File cssFilePath = new File(simplePath + ".css"); + if (cssFilePath.exists()) { + jaxxLastModified = Math.max(jaxxLastModified, cssFilePath.lastModified()); + } + File scriptFilePath = new File(simplePath + ".script"); + if (scriptFilePath.exists()) { + jaxxLastModified = Math.max(jaxxLastModified, scriptFilePath.lastModified()); } - // compilation set so we don't have a symbol table + } - if (javaLastModified != -1 || classLastModified != -1 || jaxxLastModified != -1) { - if (jaxxLastModified > classLastModified && jaxxLastModified > javaLastModified) { - result = createClassDescriptorFromSymbolTable(className, classLoader); - } else if (javaLastModified > classLastModified && javaLastModified > jaxxLastModified) { - result = createClassDescriptorFromJavaSource(javaFile, classLoader); - } + if (jaxxLastModified != -1 && JAXXCompilerLaunchor.isRegistred() && JAXXCompilerLaunchor.get().getSymbolTable(className) == null) { + jaxxLastModified = -1; // file has been modified, but wasn't included in this } - // else work off of the class file. This also handles the case where the class is available, but wasn't in a location where - // we could check its last modified date (in a JAR, over the network, etc.) - if (result == null) { - Class<?> javaClass = getClass(className, classLoader); - result = createClassDescriptorFromClass(javaClass); + // compilation set so we don't have a symbol table + + if (javaLastModified != -1 || classLastModified != -1 || jaxxLastModified != -1) { + if (jaxxLastModified > classLastModified && jaxxLastModified > javaLastModified) { + result = createClassDescriptorFromSymbolTable(className, classLoader); + } else if (javaLastModified > classLastModified && javaLastModified > jaxxLastModified) { + result = createClassDescriptorFromJavaSource(javaFile, classLoader); } } - descriptors.put(className, result); + // else work off of the class file. This also handles the case where the class is available, but wasn't in a location where + // we could check its last modified date (in a JAR, over the network, etc.) + if (result == null) { + Class<?> javaClass = getClass(className, classLoader); + result = createClassDescriptorFromClass(javaClass); + } } + descriptors.put(className, result); +// } return result; } - public static ClassDescriptor getClassDescriptor(Class<?> javaClass) { try { return getClassDescriptor(javaClass.getName(), javaClass.getClassLoader()); - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } @@ -151,7 +152,7 @@ public class ClassDescriptorLoader { } return null; } - + public static Class<?> getPrimitiveClass(String className) throws ClassNotFoundException { if (className.equals("boolean")) { return boolean.class; @@ -186,19 +187,19 @@ public class ClassDescriptorLoader { arrayCount++; className = className.substring(0, className.length() - 2); } - Class<?> klass=null; + Class<?> klass = null; if (arrayCount > 0) { klass = getPrimitiveClass(className); - if (klass==null) { + if (klass == null) { // none primitive array return null; } // must take the boxed class, other it does not works // to make a Class.forName("[Lchar;"); but works // with Class.forName("[LCharacter;"); ... - klass =getPrimitiveBoxedClass(className); - className=klass.getName(); - + klass = getPrimitiveBoxedClass(className); + className = klass.getName(); + className = "L" + className + ";"; while (arrayCount > 0) { className = "[" + className; @@ -209,10 +210,10 @@ public class ClassDescriptorLoader { } return null; } - + public static Class<?> getClass(String className, ClassLoader classLoader) throws ClassNotFoundException { Class<?> klass = getPrimitiveClass(className); - if (klass!=null) { + if (klass != null) { return klass; } // try an array of none primitive classes @@ -248,8 +249,7 @@ public class ClassDescriptorLoader { } } throw e; - } - catch (NoClassDefFoundError e) { + } catch (NoClassDefFoundError e) { throw new ClassNotFoundException(e.toString()); } @@ -267,7 +267,6 @@ public class ClassDescriptorLoader { return new MethodDescriptor(methodName, modifiers, returnType, parameters, classLoader); } - private static FieldDescriptor createFieldDescriptor(Field javaField, ClassLoader classLoader) { String fieldName = javaField.getName(); int modifiers = javaField.getModifiers(); @@ -282,14 +281,11 @@ public class ClassDescriptorLoader { try { Method getJAXXObjectDescriptor = jaxxClass.getMethod("$getJAXXObjectDescriptor", new Class<?>[0]); return (JAXXObjectDescriptor) getJAXXObjectDescriptor.invoke(null); - } - catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { throw new CompilerException("Expected JAXXObject " + jaxxClass.getName() + " to have a static method named $getJAXXObjectDescriptor"); - } - catch (IllegalAccessException e) { + } catch (IllegalAccessException e) { throw new CompilerException("Expected JAXXObject " + jaxxClass.getName() + "'s $getJAXXObjectDescriptor method to be public"); - } - catch (InvocationTargetException e) { + } catch (InvocationTargetException e) { throw new RuntimeException(e); } } @@ -301,8 +297,7 @@ public class ClassDescriptorLoader { ClassDescriptor result = JavaFileParser.parseJavaFile(javaSource.toString(), reader, classLoader); reader.close(); return result; - } - catch (IOException e) { + } catch (IOException e) { throw new ClassNotFoundException(e.toString()); } } @@ -346,6 +341,7 @@ public class ClassDescriptorLoader { interfaces.toArray(new String[interfaces.size()]), false, false, null, null, classLoader, publicMethods.toArray(new MethodDescriptor[publicMethods.size()]), publicFields.toArray(new FieldDescriptor[publicFields.size()])) { + @Override public FieldDescriptor getDeclaredFieldDescriptor(String name) throws NoSuchFieldException { String type = symbolTable.getClassTagIds().get(name); @@ -367,7 +363,6 @@ public class ClassDescriptorLoader { }; } - private static ClassDescriptor createClassDescriptorFromClass(final Class<?> javaClass) { String name = javaClass.getName(); Package p = javaClass.getPackage(); @@ -395,6 +390,7 @@ public class ClassDescriptorLoader { fields[i] = createFieldDescriptor(javaFields[i], javaClass.getClassLoader()); } return new ClassDescriptor(name, packageName, superclassName, interfaceNames, isInterface, isArray, componentTypeName, jaxxObjectDescriptor, classLoader, methods, fields) { + @Override public FieldDescriptor getDeclaredFieldDescriptor(String name) throws NoSuchFieldException { return createFieldDescriptor(javaClass.getDeclaredField(name), javaClass.getClassLoader()); @@ -408,8 +404,7 @@ public class ClassDescriptorLoader { parameterTypeClasses[i] = Class.forName(parameterTypes[i].getName()); } return createMethodDescriptor(javaClass.getDeclaredMethod(name, parameterTypeClasses), javaClass.getClassLoader()); - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } @@ -428,4 +423,4 @@ public class ClassDescriptorLoader { public static void reset() { descriptors.clear(); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/reflect/FieldDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/FieldDescriptor.java similarity index 89% rename from jaxx-compiler/src/main/java/jaxx/reflect/FieldDescriptor.java rename to jaxx-compiler/src/main/java/jaxx/compiler/reflect/FieldDescriptor.java index 9b207fb..7091cbe 100644 --- a/jaxx-compiler/src/main/java/jaxx/reflect/FieldDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/FieldDescriptor.java @@ -1,4 +1,4 @@ -package jaxx.reflect; +package jaxx.compiler.reflect; /** * Mirrors the class <code>java.lang.ref.Field</code>. JAXX uses <code>ClassDescriptor</code> instead of <code>Class</code> @@ -7,21 +7,19 @@ package jaxx.reflect; * circular dependencies). */ public class FieldDescriptor extends MemberDescriptor { - private String type; + private String type; public FieldDescriptor(String name, int modifiers, String type, ClassLoader classLoader) { super(name, modifiers, classLoader); this.type = type; } - public ClassDescriptor getType() { try { return ClassDescriptorLoader.getClassDescriptor(type, getClassLoader()); - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/reflect/JavaFileParser.java b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java similarity index 90% rename from jaxx-compiler/src/main/java/jaxx/reflect/JavaFileParser.java rename to jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java index edad5a7..a91b3e4 100644 --- a/jaxx-compiler/src/main/java/jaxx/reflect/JavaFileParser.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java @@ -1,13 +1,13 @@ -package jaxx.reflect; +package jaxx.compiler.reflect; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.JAXXCompiler; import jaxx.compiler.JAXXCompilerLaunchor; -import jaxx.parser.JavaParser; -import jaxx.parser.JavaParserTreeConstants; -import jaxx.parser.ParseException; -import jaxx.parser.SimpleNode; -import jaxx.tags.TagManager; +import jaxx.compiler.parser.java.JavaParser; +import jaxx.compiler.parser.java.JavaParserTreeConstants; +import jaxx.compiler.parser.java.ParseException; +import jaxx.compiler.parser.java.SimpleNode; +import jaxx.compiler.tags.TagManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -23,8 +23,6 @@ public class JavaFileParser { /** to use log facility, just put in your code: log.info(\"...\"); */ static private final Log log = LogFactory.getLog(JavaFileParser.class); - - private JAXXCompiler compiler; private String className; private String packageName = null; @@ -32,7 +30,6 @@ public class JavaFileParser { private List<MethodDescriptor> methods = new ArrayList<MethodDescriptor>(); private List<FieldDescriptor> fields = new ArrayList<FieldDescriptor>(); - private JavaFileParser(ClassLoader classLoader) { compiler = JAXXCompilerLaunchor.createDummyCompiler(classLoader); } @@ -81,6 +78,7 @@ public class JavaFileParser { return new ClassDescriptor(parser.className, parser.packageName, parser.superclass, new String[0], false, false, null, null, classLoader, publicMethods.toArray(new MethodDescriptor[publicMethods.size()]), publicFields.toArray(new FieldDescriptor[publicFields.size()])) { + @Override public FieldDescriptor getDeclaredFieldDescriptor(String name) throws NoSuchFieldException { throw new NoSuchFieldException(name); @@ -93,7 +91,6 @@ public class JavaFileParser { }; } - private void doParse(String displayName, Reader src) { try { JavaParser p = new JavaParser(src); @@ -104,13 +101,11 @@ public class JavaFileParser { return; } throw new CompilerException("Internal error: null node parsing Java file from " + src); - } - catch (ParseException e) { + } catch (ParseException e) { throw new CompilerException("Error parsing Java source code " + displayName + ": " + e.getMessage()); } } - private void scanCompilationUnit(SimpleNode node) { for (int i = 0; i < node.jjtGetNumChildren(); i++) { SimpleNode child = node.getChild(i); @@ -118,8 +113,7 @@ public class JavaFileParser { if (nodeType == JavaParserTreeConstants.JJTPACKAGEDECLARATION) { packageName = child.getChild(1).getText().trim(); compiler.addImport(packageName + ".*"); - } else - if (nodeType == JavaParserTreeConstants.JJTIMPORTDECLARATION) { + } else if (nodeType == JavaParserTreeConstants.JJTIMPORTDECLARATION) { String text = child.getText().trim(); if (text.startsWith("import")) { text = text.substring("import".length()).trim(); @@ -130,14 +124,12 @@ public class JavaFileParser { compiler.addImport(text); } else if (nodeType == JavaParserTreeConstants.JJTTYPEDECLARATION) { scanCompilationUnit(child); - } else - if (nodeType == JavaParserTreeConstants.JJTCLASSORINTERFACEDECLARATION) { + } else if (nodeType == JavaParserTreeConstants.JJTCLASSORINTERFACEDECLARATION) { scanClass(child); } } } - // scans the main ClassOrInterfaceDeclaration private void scanClass(SimpleNode node) { boolean isInterface = node.firstToken.image.equals("interface"); @@ -157,14 +149,12 @@ public class JavaFileParser { throw new CompilerException("Could not find class: " + rawName); } } - } else - if (nodeType == JavaParserTreeConstants.JJTCLASSORINTERFACEBODY) { + } else if (nodeType == JavaParserTreeConstants.JJTCLASSORINTERFACEBODY) { scanClassNode(child); } } } - // scans class body nodes private void scanClassNode(SimpleNode node) { int nodeType = node.getId(); @@ -176,14 +166,13 @@ public class JavaFileParser { for (int i = 0; i < node.jjtGetNumChildren(); i++) { SimpleNode child = node.getChild(i); int type = child.getId(); - if (type == JavaParserTreeConstants.JJTRESULTTYPE) + if (type == JavaParserTreeConstants.JJTRESULTTYPE) { returnType = TagManager.resolveClassName(child.getText().trim(), compiler); - else if (type == JavaParserTreeConstants.JJTMETHODDECLARATOR) { + } else if (type == JavaParserTreeConstants.JJTMETHODDECLARATOR) { name = child.firstToken.image.trim(); SimpleNode formalParameters = child.getChild(0); assert formalParameters.getId() == JavaParserTreeConstants.JJTFORMALPARAMETERS; - for (int j = 0; j < formalParameters.jjtGetNumChildren(); j++) - { + for (int j = 0; j < formalParameters.jjtGetNumChildren(); j++) { SimpleNode parameter = formalParameters.getChild(j); String rawParameterType = parameter.getChild(1).getText().trim().replaceAll("\\.\\.\\.", "[]"); String parameterType = TagManager.resolveClassName(rawParameterType, compiler); @@ -196,11 +185,9 @@ public class JavaFileParser { } } methods.add(new MethodDescriptor(name, Modifier.PUBLIC, returnType, parameterTypes.toArray(new String[parameterTypes.size()]), compiler.getClassLoader())); // TODO: determine the actual modifiers - } else - if (nodeType == JavaParserTreeConstants.JJTCLASSORINTERFACEDECLARATION) { + } else if (nodeType == JavaParserTreeConstants.JJTCLASSORINTERFACEDECLARATION) { // TODO: handle inner classes - } else - if (nodeType == JavaParserTreeConstants.JJTCONSTRUCTORDECLARATION) { + } else if (nodeType == JavaParserTreeConstants.JJTCONSTRUCTORDECLARATION) { // TODO: handle constructors } else if (nodeType == JavaParserTreeConstants.JJTFIELDDECLARATION) { String text = node.getText(); @@ -217,8 +204,8 @@ public class JavaFileParser { if (name.endsWith(";")) { name = name.substring(0, name.length() - 1).trim(); } - String className = declarationTokens[declarationTokens.length - 2]; - String type = TagManager.resolveClassName(className, compiler); + String cName = declarationTokens[declarationTokens.length - 2]; + String type = TagManager.resolveClassName(cName, compiler); fields.add(new FieldDescriptor(name, Modifier.PUBLIC, type, compiler.getClassLoader())); // TODO: determine the actual modifiers } else { for (int i = 0; i < node.jjtGetNumChildren(); i++) { diff --git a/jaxx-compiler/src/main/java/jaxx/reflect/MemberDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/MemberDescriptor.java similarity index 93% rename from jaxx-compiler/src/main/java/jaxx/reflect/MemberDescriptor.java rename to jaxx-compiler/src/main/java/jaxx/compiler/reflect/MemberDescriptor.java index 0ced5d7..010e2f3 100644 --- a/jaxx-compiler/src/main/java/jaxx/reflect/MemberDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/MemberDescriptor.java @@ -1,4 +1,4 @@ -package jaxx.reflect; +package jaxx.compiler.reflect; /** * Mirrors the class <code>java.lang.ref.Member</code>. JAXX uses <code>ClassDescriptor</code> instead of <code>Class</code> @@ -7,28 +7,25 @@ package jaxx.reflect; * circular dependencies). */ public abstract class MemberDescriptor { + private String name; private int modifiers; private ClassLoader classLoader; - MemberDescriptor(String name, int modifiers, ClassLoader classLoader) { this.name = name; this.modifiers = modifiers; this.classLoader = classLoader; } - public String getName() { return name; } - public int getModifiers() { return modifiers; } - protected ClassLoader getClassLoader() { return classLoader; } @@ -37,4 +34,4 @@ public abstract class MemberDescriptor { public String toString() { return getClass().getName() + "[" + getName() + "]"; } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/reflect/MethodDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/MethodDescriptor.java similarity index 92% rename from jaxx-compiler/src/main/java/jaxx/reflect/MethodDescriptor.java rename to jaxx-compiler/src/main/java/jaxx/compiler/reflect/MethodDescriptor.java index 2b0a9c2..5eb717f 100644 --- a/jaxx-compiler/src/main/java/jaxx/reflect/MethodDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/MethodDescriptor.java @@ -1,4 +1,4 @@ -package jaxx.reflect; +package jaxx.compiler.reflect; import jaxx.compiler.JAXXCompiler; @@ -9,10 +9,10 @@ import jaxx.compiler.JAXXCompiler; * circular dependencies). */ public class MethodDescriptor extends MemberDescriptor { + private String returnType; private String[] parameterTypes; - public MethodDescriptor(String name, int modifiers, String returnType, String[] parameterTypes, ClassLoader classLoader) { super(name, modifiers, classLoader); this.returnType = returnType; @@ -22,21 +22,18 @@ public class MethodDescriptor extends MemberDescriptor { } } - public ClassDescriptor getReturnType() { - try { + try { //TC 20090228 : fix bug when no return type defined (constructor method) if (returnType == null) { return null; } return ClassDescriptorLoader.getClassDescriptor(returnType); - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { throw new RuntimeException("could not find return type " + returnType, e); } } - public ClassDescriptor[] getParameterTypes() { ClassDescriptor[] result = new ClassDescriptor[parameterTypes.length]; try { @@ -46,9 +43,8 @@ public class MethodDescriptor extends MemberDescriptor { } } return result; - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { throw new RuntimeException("could not find the parameter types " + java.util.Arrays.toString(parameterTypes), e); } } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java b/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java new file mode 100644 index 0000000..f9b0231 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java @@ -0,0 +1,271 @@ +/* + * Copyright 2006 Ethan Nicholas. All rights reserved. + * Use is subject to license terms. + */ +package jaxx.compiler.spi; + +import java.awt.Color; +import java.awt.Component; +import java.awt.GridBagConstraints; +import java.awt.Insets; +import javax.swing.JCheckBox; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JComboBox; +import javax.swing.JDialog; +import javax.swing.JEditorPane; +import javax.swing.JFormattedTextField; +import javax.swing.JFrame; +import javax.swing.JInternalFrame; +import javax.swing.JList; +import javax.swing.JMenu; +import javax.swing.JPasswordField; +import javax.swing.JPopupMenu; +import javax.swing.JProgressBar; +import javax.swing.JRadioButton; +import javax.swing.JRadioButtonMenuItem; +import javax.swing.JScrollPane; +import javax.swing.JSlider; +import javax.swing.JSpinner; +import javax.swing.JSplitPane; +import javax.swing.JTabbedPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.JTextPane; +import javax.swing.JToggleButton; +import javax.swing.JToolBar; +import javax.swing.JTree; +import javax.swing.JWindow; +import javax.swing.KeyStroke; +import javax.swing.text.JTextComponent; + +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.beans.BeanInfoUtil; + +import jaxx.compiler.decorators.BoxedCompiledObjectDecorator; +import jaxx.compiler.decorators.CompiledObjectDecorator; +import jaxx.compiler.decorators.CompiledObjectDecoratorManager; +import jaxx.compiler.decorators.DefaultCompiledObjectDecorator; +import jaxx.compiler.decorators.HelpRootCompiledObjectDecorator; + +import jaxx.compiler.reflect.ClassDescriptorLoader; + +import jaxx.compiler.tags.DefaultComponentHandler; +import jaxx.compiler.tags.DefaultObjectHandler; +import jaxx.compiler.tags.ScriptHandler; +import jaxx.compiler.tags.StyleHandler; +import jaxx.compiler.tags.TagHandler; +import jaxx.compiler.tags.TagManager; +import jaxx.compiler.tags.swing.ApplicationHandler; +import jaxx.compiler.tags.swing.CellHandler; +import jaxx.compiler.tags.swing.ItemHandler; +import jaxx.compiler.tags.swing.JAXXComboBoxHandler; +import jaxx.compiler.tags.swing.JAXXListHandler; +import jaxx.compiler.tags.swing.JAXXTabHandler; +import jaxx.compiler.tags.swing.JAXXTreeHandler; +import jaxx.compiler.tags.swing.JCheckBoxHandler; +import jaxx.compiler.tags.swing.JComboBoxHandler; +import jaxx.compiler.tags.swing.JInternalFrameHandler; +import jaxx.compiler.tags.swing.JListHandler; +import jaxx.compiler.tags.swing.JMenuHandler; +import jaxx.compiler.tags.swing.JPasswordFieldHandler; +import jaxx.compiler.tags.swing.JPopupMenuHandler; +import jaxx.compiler.tags.swing.JProgressBarHandler; +import jaxx.compiler.tags.swing.JRadioButtonHandler; +import jaxx.compiler.tags.swing.JScrollPaneHandler; +import jaxx.compiler.tags.swing.JSliderHandler; +import jaxx.compiler.tags.swing.JSpinnerHandler; +import jaxx.compiler.tags.swing.JSplitPaneHandler; +import jaxx.compiler.tags.swing.JTabbedPaneHandler; +import jaxx.compiler.tags.swing.JTextComponentHandler; +import jaxx.compiler.tags.swing.JToolBarHandler; +import jaxx.compiler.tags.swing.JTreeHandler; +import jaxx.compiler.tags.swing.JWindowHandler; +import jaxx.compiler.tags.swing.RowHandler; +import jaxx.compiler.tags.swing.TabHandler; +import jaxx.compiler.tags.swing.TableHandler; +import jaxx.compiler.tags.validator.BeanValidatorHandler; +import jaxx.compiler.tags.validator.ExcludeFieldValidatorHandler; +import jaxx.compiler.tags.validator.FieldValidatorHandler; + +import jaxx.compiler.types.ColorConverter; +import jaxx.compiler.types.GridBagConstraintsConverter; +import jaxx.compiler.types.InsetsConverter; +import jaxx.compiler.types.KeyStrokeConverter; +import jaxx.compiler.types.PrimitiveConverter; + +import jaxx.compiler.types.TypeConverter; +import jaxx.compiler.types.TypeManager; +import jaxx.runtime.swing.Application; +import jaxx.runtime.swing.JAXXButtonGroup; +import jaxx.runtime.swing.JAXXComboBox; +import jaxx.runtime.swing.JAXXList; +import jaxx.runtime.swing.JAXXTab; +import jaxx.runtime.swing.JAXXTree; +import jaxx.runtime.swing.Table; +import jaxx.runtime.swing.editor.EnumEditor; +import jaxx.runtime.swing.editor.LocaleEditor; +import jaxx.runtime.validator.swing.SwingValidator; + +/** + * Initializes support provided from JAXX (java, swing and validation). + * + */ +public class DefaultInitializer implements Initializer { + + @Override + public void initialize() { + + BeanInfoUtil.addJaxxBeanInfoPath("jaxx.runtime.swing"); + + registerDefaultNamespace("javax.swing.*", + JEditorPane.class, + JFormattedTextField.class, + JPasswordField.class, + JTextArea.class, + JTextField.class, + JTextPane.class); + + + // + // Register decorators + // + + registerDecorator("default", DefaultCompiledObjectDecorator.class); + registerDecorator("boxed", BoxedCompiledObjectDecorator.class); + registerDecorator("help", HelpRootCompiledObjectDecorator.class); + + // + // Register tags + // + + registerTag(JAXXCompiler.JAXX_NAMESPACE, "script", new ScriptHandler()); + registerTag(JAXXCompiler.JAXX_NAMESPACE, "style", new StyleHandler()); + + //TC-20091005 why the namespace was on awt ? ButtonGroup is from javax.swing + registerTag("javax.swing.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class))); +// TagManager.registerTag("java.awt.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class))); + + registerTag(JAXXCompiler.JAXX_NAMESPACE, "tab", new TabHandler()); + registerTag(JAXXCompiler.JAXX_NAMESPACE, "row", new RowHandler()); + registerTag(JAXXCompiler.JAXX_NAMESPACE, "cell", new CellHandler()); + registerTag(JAXXCompiler.JAXX_NAMESPACE, "item", new ItemHandler()); + + + registerTag(JAXXCompiler.JAXX_NAMESPACE, BeanValidatorHandler.TAG, new BeanValidatorHandler(ClassDescriptorLoader.getClassDescriptor(SwingValidator.class))); + registerTag(JAXXCompiler.JAXX_NAMESPACE, FieldValidatorHandler.TAG, new FieldValidatorHandler()); + registerTag(JAXXCompiler.JAXX_NAMESPACE, ExcludeFieldValidatorHandler.TAG, new FieldValidatorHandler()); + + + // + // Register beans + // + + registerBean(Object.class, DefaultObjectHandler.class); + registerBean(Component.class, DefaultComponentHandler.class); + + // check boxes + registerBean(JCheckBox.class, JCheckBoxHandler.class); + registerBean(JCheckBoxMenuItem.class, JCheckBoxHandler.class); + + // combo boxes + registerBean(JComboBox.class, JComboBoxHandler.class); + registerBean(EnumEditor.class, JComboBoxHandler.class); + registerBean(LocaleEditor.class, JComboBoxHandler.class); + registerBean(JAXXComboBox.class, JAXXComboBoxHandler.class); + + // radio boxes + registerBean(JRadioButton.class, JRadioButtonHandler.class); + registerBean(JRadioButtonMenuItem.class, JRadioButtonHandler.class); + registerBean(JToggleButton.class, JRadioButtonHandler.class); + + // Lists + registerBean(JList.class, JListHandler.class); + registerBean(JAXXList.class, JAXXListHandler.class); + + // Trees + registerBean(JTree.class, JTreeHandler.class); + registerBean(JAXXTree.class, JAXXTreeHandler.class); + + // Windows + registerBean(JDialog.class, JWindowHandler.class); + registerBean(JFrame.class, JWindowHandler.class); + registerBean(JWindow.class, JWindowHandler.class); + + registerBean(Application.class, ApplicationHandler.class); + + registerBean(JInternalFrame.class, JInternalFrameHandler.class); + registerBean(JMenu.class, JMenuHandler.class); + registerBean(JPasswordField.class, JPasswordFieldHandler.class); + registerBean(JPopupMenu.class, JPopupMenuHandler.class); + registerBean(JProgressBar.class, JProgressBarHandler.class); + registerBean(JScrollPane.class, JScrollPaneHandler.class); + registerBean(JSlider.class, JSliderHandler.class); + registerBean(JSpinner.class, JSpinnerHandler.class); + registerBean(JSplitPane.class, JSplitPaneHandler.class); + registerBean(JTabbedPane.class, JTabbedPaneHandler.class); + registerBean(JTextComponent.class, JTextComponentHandler.class); + registerBean(JToolBar.class, JToolBarHandler.class); + + registerBean(Table.class, TableHandler.class); + registerBean(JAXXTab.class, JAXXTabHandler.class); + + + registerBean(SwingValidator.class, BeanValidatorHandler.class); + + + + // + // Register converters + // + + PrimitiveConverter primitiveConverter = new PrimitiveConverter(); + registerTypeConverter(boolean.class, primitiveConverter); + registerTypeConverter(Boolean.class, primitiveConverter); + registerTypeConverter(byte.class, primitiveConverter); + registerTypeConverter(Byte.class, primitiveConverter); + registerTypeConverter(short.class, primitiveConverter); + registerTypeConverter(Short.class, primitiveConverter); + registerTypeConverter(int.class, primitiveConverter); + registerTypeConverter(Integer.class, primitiveConverter); + registerTypeConverter(long.class, primitiveConverter); + registerTypeConverter(Long.class, primitiveConverter); + registerTypeConverter(float.class, primitiveConverter); + registerTypeConverter(Float.class, primitiveConverter); + registerTypeConverter(double.class, primitiveConverter); + registerTypeConverter(Double.class, primitiveConverter); + registerTypeConverter(char.class, primitiveConverter); + registerTypeConverter(Character.class, primitiveConverter); + registerTypeConverter(String.class, primitiveConverter); + + registerTypeConverter(Color.class, new ColorConverter()); + registerTypeConverter(GridBagConstraints.class, new GridBagConstraintsConverter()); + registerTypeConverter(Insets.class, new InsetsConverter()); + registerTypeConverter(KeyStroke.class, new KeyStrokeConverter()); + + } + + protected void registerBean(Class<?> beanClass, Class<? extends TagHandler> handlerClass) { + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(beanClass), handlerClass); + } + + protected void registerTag(String namespace, String tagName, TagHandler handler) { + TagManager.registerTag(namespace, tagName, handler); + } + + protected void registerDecorator(String name, Class<? extends CompiledObjectDecorator> decoratorClass) { + + CompiledObjectDecoratorManager.registerDecorator(name, decoratorClass); + } + + protected void registerTypeConverter(Class<?> converterType, TypeConverter converter) { + + TypeManager.registerTypeConverter(converterType, converter); + } + + protected void registerDefaultNamespace(String namespace, Class<?>... beanClass) { + + for (Class<?> c : beanClass) { + TagManager.registerDefaultNamespace(c.getSimpleName(), namespace); + } + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/spi/Initializer.java b/jaxx-compiler/src/main/java/jaxx/compiler/spi/Initializer.java similarity index 52% rename from jaxx-compiler/src/main/java/jaxx/spi/Initializer.java rename to jaxx-compiler/src/main/java/jaxx/compiler/spi/Initializer.java index af4f2b4..4bf9695 100644 --- a/jaxx-compiler/src/main/java/jaxx/spi/Initializer.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/spi/Initializer.java @@ -1,15 +1,17 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.spi; +package jaxx.compiler.spi; /** * Performs SPI initialization, typically to register new tags, beans and converter. * <p/> * <b>Note:</b> To load such Initializer, we use the {@link java.util.ServiceLoader} mecanism. + * + * @see DefaultInitializer */ public interface Initializer { - /** Performs SPI initialization, typically to register new tags, beans and converter */ + + /** + * Performs SPI initialization, typically to register new + * tags, beans and converter. + */ void initialize(); -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/DefaultComponentHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java similarity index 95% rename from jaxx-compiler/src/main/java/jaxx/tags/DefaultComponentHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java index 4a63e97..2f02f59 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/DefaultComponentHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java @@ -2,15 +2,15 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags; +package jaxx.compiler.tags; -import jaxx.CompilerException; -import jaxx.UnsupportedAttributeException; +import jaxx.compiler.CompilerException; +import jaxx.compiler.UnsupportedAttributeException; import jaxx.compiler.CompiledObject; import jaxx.compiler.I18nHelper; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Element; @@ -212,7 +212,7 @@ public class DefaultComponentHandler extends DefaultObjectHandler { if ("icon".equals(propertyName)) { if (!(stringValue.startsWith("{") || stringValue.endsWith("}"))) { // this is a customized icon, add the icon creation code - if (compiler.getOptions().isUseUIManagerForIcon()) { + if (compiler.getConfiguration().isUseUIManagerForIcon()) { stringValue = "{" + jaxx.runtime.Util.class.getName() + ".getUIManagerIcon(\"" + stringValue + "\")}"; } else { stringValue = "{" + jaxx.runtime.Util.class.getName() + ".createImageIcon(\"" + stringValue + "\")}"; @@ -226,7 +226,7 @@ public class DefaultComponentHandler extends DefaultObjectHandler { return; } propertyName = "icon"; - if (compiler.getOptions().isUseUIManagerForIcon()) { + if (compiler.getConfiguration().isUseUIManagerForIcon()) { stringValue = "{" + jaxx.runtime.Util.class.getName() + ".getUIManagerActionIcon(\"" + stringValue + "\")}"; } else { stringValue = "{" + jaxx.runtime.Util.class.getName() + ".createActionIcon(\"" + stringValue + "\")}"; @@ -319,4 +319,4 @@ public class DefaultComponentHandler extends DefaultObjectHandler { } } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/DefaultObjectHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java similarity index 98% rename from jaxx-compiler/src/main/java/jaxx/tags/DefaultObjectHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java index 538a8dc..250e062 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/DefaultObjectHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java @@ -2,28 +2,30 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags; +package jaxx.compiler.tags; -import jaxx.CompilerException; -import jaxx.UnsupportedAttributeException; +import jaxx.compiler.CompilerException; +import jaxx.compiler.UnsupportedAttributeException; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; import jaxx.compiler.JavaArgument; import jaxx.compiler.JavaMethod; -import jaxx.css.Stylesheet; -import jaxx.css.StylesheetHelper; -import jaxx.introspection.JAXXBeanInfo; -import jaxx.introspection.JAXXEventSetDescriptor; -import jaxx.introspection.JAXXIntrospector; -import jaxx.introspection.JAXXPropertyDescriptor; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.reflect.FieldDescriptor; -import jaxx.reflect.MethodDescriptor; +import jaxx.compiler.StylesheetHelper; +import jaxx.compiler.beans.JAXXBeanInfo; +import jaxx.compiler.beans.JAXXEventSetDescriptor; +import jaxx.compiler.beans.JAXXIntrospector; +import jaxx.compiler.beans.JAXXPropertyDescriptor; +import jaxx.compiler.decorators.CompiledObjectDecorator; +import jaxx.compiler.decorators.CompiledObjectDecoratorManager; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.FieldDescriptor; +import jaxx.compiler.reflect.MethodDescriptor; +import jaxx.compiler.types.TypeManager; import jaxx.runtime.ComponentDescriptor; import jaxx.runtime.JAXXObject; import jaxx.runtime.JAXXObjectDescriptor; -import jaxx.types.TypeManager; +import jaxx.runtime.css.Stylesheet; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; @@ -43,7 +45,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.WeakHashMap; -import jaxx.compiler.CompiledObjectDecorator; /** * Default handler for class tags. Class tags are tags which represent instances of Java classes, @@ -203,7 +204,7 @@ public class DefaultObjectHandler implements TagHandler { * methods (represented by the simple name of the method, <b>not</b> the simplified JavaBeans-style name). * Methods which are not actually bound in their native class, but for which proxy events have been * configured (such as <code>JTextField.getText</code>, return <code>true</code>. - * @throws jaxx.UnsupportedAttributeException + * @throws UnsupportedAttributeException * ? */ public boolean isMemberBound(String name) throws UnsupportedAttributeException { @@ -562,7 +563,7 @@ public class DefaultObjectHandler implements TagHandler { * @param property property name to test * @return <code>true</code> if the specified property should be inherited by child components when specified * via CSS. - * @throws jaxx.UnsupportedAttributeException + * @throws UnsupportedAttributeException * ? */ public boolean isPropertyInherited(String property) throws UnsupportedAttributeException { @@ -689,7 +690,7 @@ public class DefaultObjectHandler implements TagHandler { if (name.equals("decorator")) { if (!value.isEmpty()) { - CompiledObjectDecorator decorator = CompiledObjectDecorator.getDecorator(value); + CompiledObjectDecorator decorator = CompiledObjectDecoratorManager.getDecorator(value); object.setDecorator(decorator); } continue; diff --git a/jaxx-compiler/src/main/java/jaxx/tags/ScriptHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/ScriptHandler.java similarity index 86% rename from jaxx-compiler/src/main/java/jaxx/tags/ScriptHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/ScriptHandler.java index 94fabe1..0b57ebc 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/ScriptHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/ScriptHandler.java @@ -2,10 +2,10 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags; +package jaxx.compiler.tags; -import jaxx.CompilerException; -import jaxx.UnsupportedAttributeException; +import jaxx.compiler.CompilerException; +import jaxx.compiler.UnsupportedAttributeException; import jaxx.compiler.JAXXCompiler; import org.w3c.dom.Attr; import org.w3c.dom.Element; @@ -26,6 +26,8 @@ import java.io.StringWriter; * @author Ethan Nicholas */ public class ScriptHandler implements TagHandler { + + @Override public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { File scriptFile = null; NamedNodeMap attributes = tag.getAttributes(); @@ -43,14 +45,13 @@ public class ScriptHandler implements TagHandler { while ((c = in.read(readBuffer)) > 0) { scriptBuffer.write(readBuffer, 0, c); } - } - catch (FileNotFoundException e) { + } catch (FileNotFoundException e) { compiler.reportError("script file not found: " + scriptFile); } compiler.registerScript(scriptBuffer.toString(), scriptFile); - } else - if (!name.startsWith("xmlns") && !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) + } else if (!name.startsWith("xmlns") && !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { throw new UnsupportedAttributeException(name); + } } StringBuffer script = new StringBuffer(); @@ -75,7 +76,7 @@ public class ScriptHandler implements TagHandler { } } - + @Override public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { } } diff --git a/jaxx-compiler/src/main/java/jaxx/tags/StyleHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java similarity index 83% rename from jaxx-compiler/src/main/java/jaxx/tags/StyleHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java index 9ad929c..db8cebc 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/StyleHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java @@ -2,18 +2,18 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags; +package jaxx.compiler.tags; -import jaxx.CompilerException; -import jaxx.UnsupportedAttributeException; +import jaxx.compiler.CompilerException; +import jaxx.compiler.UnsupportedAttributeException; import jaxx.compiler.JAXXCompiler; -import jaxx.css.CSSParser; -import jaxx.css.CSSParserConstants; -import jaxx.css.CSSParserTreeConstants; -import jaxx.css.Rule; -import jaxx.css.Selector; -import jaxx.css.SimpleNode; -import jaxx.css.Stylesheet; +import jaxx.compiler.parser.css.CSSParser; +import jaxx.compiler.parser.css.CSSParserConstants; +import jaxx.compiler.parser.css.CSSParserTreeConstants; +import jaxx.runtime.css.Rule; +import jaxx.runtime.css.Selector; +import jaxx.compiler.parser.css.SimpleNode; +import jaxx.runtime.css.Stylesheet; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; @@ -38,7 +38,9 @@ import java.util.Map; * @author Ethan Nicholas */ public class StyleHandler implements TagHandler { - public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + + @Override + public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { boolean source = false; NamedNodeMap attributes = tag.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { @@ -53,18 +55,18 @@ public class StyleHandler implements TagHandler { FileReader in = new FileReader(styleFile); char[] readBuffer = new char[2048]; int c; - while ((c = in.read(readBuffer)) > 0) + while ((c = in.read(readBuffer)) > 0) { styleBuffer.write(readBuffer, 0, c); - } - catch (FileNotFoundException e) { + } + } catch (FileNotFoundException e) { compiler.reportError("stylesheet file not found: " + styleFile); } compiler.getSourceFiles().push(styleFile); compiler.registerStylesheet(processStylesheet(styleBuffer.toString())); compiler.getSourceFiles().pop(); - } else - if (!name.startsWith("xmlns") && !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) + } else if (!name.startsWith("xmlns") && !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { throw new UnsupportedAttributeException(name); + } } StringBuffer style = new StringBuffer(); @@ -82,20 +84,21 @@ public class StyleHandler implements TagHandler { String styleString = style.toString().trim(); if (styleString.length() > 0) { - if (source) + if (source) { compiler.reportError("<style> tag has both a source attribute and an inline stylesheet"); + } compiler.registerStylesheet(processStylesheet(style.toString())); } } - - public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + @Override + public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { } - protected Selector processSelector(SimpleNode selector) { - if (selector.getId() != CSSParserTreeConstants.JJTSELECTOR) + if (selector.getId() != CSSParserTreeConstants.JJTSELECTOR) { throw new IllegalArgumentException("argument node is not a Selector"); + } String javaClassName = null; String styleClass = null; String pseudoClass = null; @@ -105,8 +108,9 @@ public class StyleHandler implements TagHandler { SimpleNode child = selector.getChild(i); switch (child.getId()) { case CSSParserTreeConstants.JJTJAVACLASS: - if (!child.getText().trim().equals("*")) + if (!child.getText().trim().equals("*")) { javaClassName = child.getText(); + } break; case CSSParserTreeConstants.JJTCLASS: styleClass = child.getText().substring(1); @@ -126,7 +130,6 @@ public class StyleHandler implements TagHandler { return new Selector(javaClassName, styleClass, pseudoClass, id); } - protected Rule processRule(SimpleNode ruleNode) { if (ruleNode.getId() != CSSParserTreeConstants.JJTRULE) { throw new IllegalArgumentException("argument node is not a Rule"); @@ -158,7 +161,6 @@ public class StyleHandler implements TagHandler { return rule; } - protected Stylesheet processStylesheet(String stylesheetText) throws CompilerException { CSSParser p = new CSSParser(new StringReader(stylesheetText)); SimpleNode node; diff --git a/jaxx-compiler/src/main/java/jaxx/tags/TagHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagHandler.java similarity index 93% rename from jaxx-compiler/src/main/java/jaxx/tags/TagHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/TagHandler.java index 93c5bd4..8867da2 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/TagHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagHandler.java @@ -2,9 +2,9 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags; +package jaxx.compiler.tags; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.JAXXCompiler; import org.w3c.dom.Element; @@ -19,6 +19,7 @@ import java.io.IOException; * @author Ethan Nicholas */ public interface TagHandler { + /** * Performs the first pass of compilation on an XML tag from a JAXX source file. * <code>TagHandler</code> implementations affect the generated <code>.java</code> @@ -31,7 +32,6 @@ public interface TagHandler { */ void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException; - /** * Performs the second pass of compilation on an XML tag from a JAXX source file. * <code>TagHandler</code> implementations affect the generated <code>.java</code> @@ -43,4 +43,4 @@ public interface TagHandler { * @throws IOException if an I/O error occurs */ void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException; -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/TagManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java similarity index 95% rename from jaxx-compiler/src/main/java/jaxx/tags/TagManager.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java index d4ae0f0..85bdfa7 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/TagManager.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java @@ -2,13 +2,12 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags; +package jaxx.compiler.tags; -import jaxx.ClassMap; -import jaxx.CompilerException; import jaxx.compiler.*; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; +import jaxx.compiler.decorators.CompiledObjectDecoratorManager; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -22,24 +21,20 @@ import java.util.Set; /** Manages TagHandlers, including automatically compiling .jaxx files corresponding to class tags. */ public class TagManager { + /** log */ protected static final Log log = LogFactory.getLog(TagManager.class); - /** * Namespace for JAXX's non-class tags, such as <script;>. The namespace normally does not * need to be specified but can be used to resolve ambiguities. */ public static final String JAXX_NAMESPACE = "http://www.jaxxframework.org/"; - /** Maps simple tag names to their default namespaces (package names). */ private static Map<String, String> defaultNamespaces = new HashMap<String, String>(); - /** Maps qualified tag names to the TagHandlers responsible for processing them. */ private static Map<QName, TagHandler> registeredTags = new HashMap<QName, TagHandler>(); - /** Keeps track of whether or not named classes exist. */ private static Map<String, Boolean> classExistenceCache = new HashMap<String, Boolean>(); - /** * Maps bean classes to their TagHandler classes. The mapping is to TagHandler classes, rather than to * TagHandler instances, because subclasses of the bean class should be handled by the same TagHandler @@ -49,6 +44,7 @@ public class TagManager { // still targeting 1.4, so I can't use javax.xml.namespace.QName private static class QName { + private String namespaceURI; private String localPart; @@ -60,12 +56,10 @@ public class TagManager { this.localPart = localPart; } - public String getNamespaceURI() { return namespaceURI; } - public String getLocalPart() { return localPart; } @@ -85,19 +79,16 @@ public class TagManager { } } - private TagManager() { /* not instantiable */ } - public static void reset(boolean verbose) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException { registeredBeans.clear(); registeredTags.clear(); defaultNamespaces.clear(); - CompiledObjectDecorator.reset(); + CompiledObjectDecoratorManager.reset(); JAXXCompilerLaunchor.loadLibraries(verbose); } - /** * Maps a class tag to a specific <code>TagHandler</code>. When a tag representing the bean class is * encountered (either the class' simple name, if it is unambiguous, or its fully-qualified name), the specified @@ -123,7 +114,6 @@ public class TagManager { registerDefaultNamespace(name, namespace); } - /** * Sets the default namespace for a tag. When the tag is encountered with no namespace specified, * the specified namespace will be assumed. Mapping the same tag to two or more default namespaces @@ -146,7 +136,6 @@ public class TagManager { } } - /** * Registers a <code>TagHandler</code> for a tag. When a tag with the given name and namespace * is encountered, the <code>TagHandler's compileFirstPass</code> and <code>compileSecondPass</code> @@ -172,7 +161,6 @@ public class TagManager { registerDefaultNamespace(tag, namespace); } - /** * Returns the <code>TagHandler</code> that should be used to process the specified tag. * If the tag represents the class name of an uncompiled <code>.jaxx</code> file, the @@ -182,20 +170,18 @@ public class TagManager { * @param tag the tag's simple name * @param compiler the current <code>JAXXCompiler</code> * @return the <code>TagHandler</code> for the tag - * @throws jaxx.CompilerException ? + * @throws CompilerException ? */ - public static TagHandler getTagHandler(String namespace, String tag, JAXXCompiler compiler) throws CompilerException { + public static TagHandler getTagHandler(String namespace, String tag, JAXXCompiler compiler) throws CompilerException { return getTagHandler(namespace, tag, false, compiler); } - private static String getNamespace(ClassDescriptor beanClass) { String packageName = beanClass.getPackageName(); return packageName != null ? packageName + ".*" : "*"; } - private static String getSimpleName(ClassDescriptor beanClass) { String packageName = beanClass.getPackageName(); if (packageName != null) { @@ -205,13 +191,12 @@ public class TagManager { return beanClass.getName(); } - /** * @param beanClass the tag class * @return the <code>TagHandler</code> that should be used to process the specified class. * Only <code>TagHandlers</code> previously registered with <code>registerBean</code> * are considered. - * @throws jaxx.CompilerException ? + * @throws CompilerException ? */ public static DefaultObjectHandler getTagHandler(ClassDescriptor beanClass) throws CompilerException { try { @@ -231,22 +216,17 @@ public class TagManager { registerTag(namespace, tag, handler); } return handler; - } - catch (InstantiationException e) { + } catch (InstantiationException e) { throw new RuntimeException(e); - } - catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { throw new RuntimeException(e); - } - catch (IllegalAccessException e) { + } catch (IllegalAccessException e) { throw new RuntimeException(e); - } - catch (InvocationTargetException e) { + } catch (InvocationTargetException e) { throw new RuntimeException(e); } } - private static boolean classExists(String className, JAXXCompiler compiler) { if (classExistenceCache.containsKey(className)) { return classExistenceCache.get(className); @@ -256,11 +236,9 @@ public class TagManager { try { Class.forName(className, true, compiler.getClassLoader()); found = true; - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { // ignore ? - } - catch (NoClassDefFoundError e) { // we get this instead of ClassNotFoundException on case-insensitive file systems when + } catch (NoClassDefFoundError e) { // we get this instead of ClassNotFoundException on case-insensitive file systems when // looking up a class with the wrong case } @@ -279,7 +257,6 @@ public class TagManager { return found; } - private static String determinePackage(String simpleClassName, String defaultPackage, JAXXCompiler compiler) { String namespace = null; Set<String> classes = compiler.getImportedClasses(); @@ -313,7 +290,6 @@ public class TagManager { return namespace; } - /** * Returns the <code>TagHandler</code> that should be used to process the specified tag. * <p/> @@ -328,9 +304,9 @@ public class TagManager { * @param namespacePrefix <code>true</code> if the namespace was specified by means of a namespace prefix (as opposed to a default namespace) * @param compiler the current <code>JAXXCompiler</code> * @return the <code>TagHandler</code> for the tag - * @throws jaxx.CompilerException ? + * @throws CompilerException ? */ - public static TagHandler getTagHandler(String namespace, String tag, boolean namespacePrefix, JAXXCompiler compiler) throws CompilerException { + public static TagHandler getTagHandler(String namespace, String tag, boolean namespacePrefix, JAXXCompiler compiler) throws CompilerException { if (tag == null) { throw new NullPointerException(); } @@ -365,8 +341,7 @@ public class TagManager { if (handler == null) { try { handler = getTagHandler(ClassDescriptorLoader.getClassDescriptor(className, compiler.getClassLoader())); - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { e.printStackTrace(); } } @@ -376,7 +351,6 @@ public class TagManager { return handler; } - /** * Resolves a simple class name (like <code>Object</code> or <code>String</code>) to its fully-qualified name. Inner * classes should be represented as they would appear in Java source code (e.g. JPopupMenu.Separator). Fully-qualified names, @@ -433,7 +407,7 @@ public class TagManager { // com.mycompany.* : Outer$Inner$Innerer$Innerest // And at this point we have a match with the class Outer$Inner$Innerer$Innerest in package com.mycompany. int dotPos = originalName.lastIndexOf('.'); - for (; ;) { + for (;;) { String namespace = dotPos != -1 ? originalName.substring(0, dotPos) + ".*" : "*"; name = originalName.substring(dotPos + 1).replace('.', '$'); String packageName = determinePackage(name, namespace, compiler); @@ -473,17 +447,15 @@ public class TagManager { return result; } - - public static ClassDescriptor resolveClass(String className, JAXXCompiler compiler) { + public static ClassDescriptor resolveClass(String className, JAXXCompiler compiler) { try { className = resolveClassName(className, compiler); if (className == null) { return null; } return ClassDescriptorLoader.getClassDescriptor(className, compiler.getClassLoader()); - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { return null; } } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/ApplicationHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ApplicationHandler.java similarity index 84% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/ApplicationHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ApplicationHandler.java index f35c5dc..ba7a215 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/ApplicationHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ApplicationHandler.java @@ -2,15 +2,15 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.runtime.swing.Application; -import jaxx.types.TypeManager; +import jaxx.compiler.types.TypeManager; import org.w3c.dom.Element; import javax.swing.WindowConstants; @@ -22,7 +22,6 @@ public class ApplicationHandler extends JWindowHandler { ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, Application.class); } - @Override public void setAttribute(CompiledObject object, String propertyName, String stringValue, boolean inline, JAXXCompiler compiler) throws CompilerException { if (propertyName.equals("lookAndFeel") && stringValue != null && !stringValue.trim().startsWith("{")) { @@ -32,10 +31,9 @@ public class ApplicationHandler extends JWindowHandler { } } - @Override protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { super.setDefaults(object, tag, compiler); setAttribute(object, "defaultCloseOperation", String.valueOf(WindowConstants.EXIT_ON_CLOSE), false, compiler); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/CellHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CellHandler.java similarity index 94% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/CellHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CellHandler.java index ffa6aa0..ef1c5b4 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/CellHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CellHandler.java @@ -2,13 +2,13 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; -import jaxx.UnsupportedAttributeException; +import jaxx.compiler.CompilerException; +import jaxx.compiler.UnsupportedAttributeException; import jaxx.compiler.JAXXCompiler; -import jaxx.tags.TagHandler; -import jaxx.types.TypeManager; +import jaxx.compiler.tags.TagHandler; +import jaxx.compiler.types.TypeManager; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; @@ -21,11 +21,13 @@ import java.awt.Insets; import java.io.IOException; public class CellHandler implements TagHandler { + + @Override public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { compileChildrenFirstPass(tag, compiler); } - + @Override public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { Node parent = tag.getParentNode(); if (parent.getNodeType() != Node.ELEMENT_NODE || !parent.getLocalName().equals("row")) { @@ -40,7 +42,6 @@ public class CellHandler implements TagHandler { compileChildrenSecondPass(tag, compiler); } - public static void setAttribute(GridBagConstraints c, String name, String value) throws CompilerException { value = value.trim(); if (name.equals("insets")) { @@ -93,7 +94,6 @@ public class CellHandler implements TagHandler { } } - public static void setAttributes(GridBagConstraints c, Element tag) throws CompilerException { NamedNodeMap children = tag.getAttributes(); for (int i = 0; i < children.getLength(); i++) { @@ -106,7 +106,6 @@ public class CellHandler implements TagHandler { } } - protected void compileChildrenFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { NodeList children = tag.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { @@ -124,7 +123,6 @@ public class CellHandler implements TagHandler { } } - protected void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { NodeList children = tag.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { @@ -142,13 +140,11 @@ public class CellHandler implements TagHandler { } } - protected void compileChildTagFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { compiler.compileFirstPass(tag); } - protected void compileChildTagSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { compiler.compileSecondPass(tag); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/CompiledItemContainer.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CompiledItemContainer.java similarity index 88% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/CompiledItemContainer.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CompiledItemContainer.java index 88da6b8..ea3ee60c 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/CompiledItemContainer.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CompiledItemContainer.java @@ -2,12 +2,12 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptor; import jaxx.runtime.swing.Item; import java.util.ArrayList; @@ -16,6 +16,7 @@ import java.util.Stack; /** Compiled representation of a class that contains Items arranged in a list or tree structure (JComboBox, JList, JTree). */ class CompiledItemContainer extends CompiledObject { + private List<Item> items = new ArrayList<Item>(); private Stack<Item> openNodes = new Stack<Item>(); @@ -23,7 +24,6 @@ class CompiledItemContainer extends CompiledObject { super(id, objectClass, compiler); } - public void openItem(Item item) { if (openNodes.isEmpty()) { items.add(item); @@ -34,20 +34,17 @@ class CompiledItemContainer extends CompiledObject { openNodes.add(item); } - public void closeItem(Item item) { if (openNodes.pop() != item) { throw new IllegalArgumentException(item + " was not at the top of the item stack"); } } - public List<Item> getItems() { return items; } - public void setItems(List<Item> items) { this.items = items; } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/ItemHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ItemHandler.java similarity index 83% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/ItemHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ItemHandler.java index fa491a3..f31d808 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/ItemHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ItemHandler.java @@ -2,15 +2,15 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; -import jaxx.UnsupportedAttributeException; +import jaxx.compiler.CompilerException; +import jaxx.compiler.UnsupportedAttributeException; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.TagHandler; +import jaxx.compiler.types.TypeManager; import jaxx.runtime.swing.Item; -import jaxx.tags.TagHandler; -import jaxx.types.TypeManager; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; @@ -22,15 +22,16 @@ import java.io.IOException; import java.util.List; public class ItemHandler implements TagHandler { + private String DATA_BINDING = "<data binding has not been processed yet>"; @Override - public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { compileChildrenFirstPass(tag, compiler); } @Override - public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { String id = tag.getAttribute("id"); if (id == null || id.length() == 0) { id = compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(Item.class)); @@ -52,8 +53,7 @@ public class ItemHandler implements TagHandler { String labelBinding = compiler.processDataBindings(attrValue, ClassDescriptorLoader.getClassDescriptor(String.class)); if (labelBinding != null) { compiler.registerDataBinding(labelBinding, id + ".label", id + ".setLabel(" + labelBinding + ");"); - } - else { + } else { label = attrValue; } continue; @@ -72,8 +72,7 @@ public class ItemHandler implements TagHandler { String selectedBinding = compiler.processDataBindings(attrValue, ClassDescriptorLoader.getClassDescriptor(Boolean.class)); if (selectedBinding != null) { compiler.registerDataBinding(selectedBinding, id + ".selected", id + ".setSelected(" + selectedBinding + ");"); - } - else { + } else { selected = (Boolean) TypeManager.convertFromString(attrValue, Boolean.class); } continue; @@ -88,8 +87,7 @@ public class ItemHandler implements TagHandler { CompiledItemContainer list = (CompiledItemContainer) compiler.getOpenComponent(); if (value == null) { compiler.reportError("<item> tag is missing required 'value' attribute"); - } - else { + } else { if (!value.equals(DATA_BINDING)) { List<Item> items = list.getItems(); for (Item item1 : items) { @@ -105,8 +103,7 @@ public class ItemHandler implements TagHandler { } } - - protected void compileChildrenFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + protected void compileChildrenFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { NodeList children = tag.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node node = children.item(i); @@ -114,8 +111,7 @@ public class ItemHandler implements TagHandler { if (nodeType == Node.ELEMENT_NODE) { Element child = (Element) node; compileChildTagFirstPass(child, compiler); - } else - if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { + } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { String text = ((Text) node).getData().trim(); if (text.length() > 0) { compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); @@ -124,8 +120,7 @@ public class ItemHandler implements TagHandler { } } - - protected void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + protected void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { NodeList children = tag.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node node = children.item(i); @@ -133,8 +128,7 @@ public class ItemHandler implements TagHandler { if (nodeType == Node.ELEMENT_NODE) { Element child = (Element) node; compileChildTagSecondPass(child, compiler); - } else - if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { + } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { String text = ((Text) node).getData().trim(); if (text.length() > 0) { compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); @@ -143,13 +137,11 @@ public class ItemHandler implements TagHandler { } } - - protected void compileChildTagFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + protected void compileChildTagFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { compiler.compileFirstPass(tag); } - - protected void compileChildTagSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + protected void compileChildTagSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { compiler.compileSecondPass(tag); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXComboBoxHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXComboBoxHandler.java similarity index 89% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXComboBoxHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXComboBoxHandler.java index ebe6aa5..29766a8 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXComboBoxHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXComboBoxHandler.java @@ -2,17 +2,17 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.runtime.swing.Item; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; +import jaxx.compiler.types.TypeManager; import jaxx.runtime.swing.JAXXComboBox; -import jaxx.tags.DefaultComponentHandler; -import jaxx.types.TypeManager; +import jaxx.runtime.swing.Item; import org.w3c.dom.Element; import java.awt.event.ItemListener; diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXListHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXListHandler.java similarity index 90% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXListHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXListHandler.java index 194b467..afe7e47 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXListHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXListHandler.java @@ -2,17 +2,17 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.runtime.swing.Item; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; +import jaxx.compiler.types.TypeManager; import jaxx.runtime.swing.JAXXList; -import jaxx.tags.DefaultComponentHandler; -import jaxx.types.TypeManager; +import jaxx.runtime.swing.Item; import org.w3c.dom.Element; import javax.swing.event.ListSelectionListener; @@ -20,6 +20,7 @@ import java.io.IOException; import java.util.List; public class JAXXListHandler extends DefaultComponentHandler { + public JAXXListHandler(ClassDescriptor beanClass) { super(beanClass); ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JAXXList.class); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTabHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTabHandler.java new file mode 100644 index 0000000..e3de954 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTabHandler.java @@ -0,0 +1,11 @@ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.reflect.ClassDescriptor; + +/** @author chemit */ +public class JAXXTabHandler extends TableHandler { + + public JAXXTabHandler(ClassDescriptor beanClass) { + super(beanClass); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXTreeHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTreeHandler.java similarity index 91% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXTreeHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTreeHandler.java index 24221ed..2059a0f 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXTreeHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTreeHandler.java @@ -2,17 +2,17 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; +import jaxx.compiler.types.TypeManager; import jaxx.runtime.swing.Item; import jaxx.runtime.swing.JAXXTree; -import jaxx.tags.DefaultComponentHandler; -import jaxx.types.TypeManager; import org.w3c.dom.Element; import javax.swing.event.TreeSelectionListener; @@ -20,6 +20,7 @@ import java.io.IOException; import java.util.List; public class JAXXTreeHandler extends DefaultComponentHandler { + public JAXXTreeHandler(ClassDescriptor beanClass) { super(beanClass); ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JAXXTree.class); diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JCheckBoxHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JCheckBoxHandler.java similarity index 74% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JCheckBoxHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JCheckBoxHandler.java index be9be7d..aafc0f3 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JCheckBoxHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JCheckBoxHandler.java @@ -2,16 +2,17 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; import javax.swing.AbstractButton; import javax.swing.event.ChangeListener; public class JCheckBoxHandler extends DefaultComponentHandler { + public JCheckBoxHandler(ClassDescriptor beanClass) { super(beanClass); ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, AbstractButton.class); @@ -22,4 +23,4 @@ public class JCheckBoxHandler extends DefaultComponentHandler { super.configureProxyEventInfo(); addProxyEventInfo("isSelected", ChangeListener.class, "model"); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JComboBoxHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JComboBoxHandler.java similarity index 81% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JComboBoxHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JComboBoxHandler.java index a984400..7ffb583 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JComboBoxHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JComboBoxHandler.java @@ -2,19 +2,19 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import java.io.IOException; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import java.io.IOException; import java.awt.event.ItemListener; import javax.swing.JComboBox; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; public class JComboBoxHandler extends DefaultComponentHandler { diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JInternalFrameHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JInternalFrameHandler.java similarity index 87% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JInternalFrameHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JInternalFrameHandler.java index e59259a..1111fea 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JInternalFrameHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JInternalFrameHandler.java @@ -2,14 +2,14 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; import org.w3c.dom.Element; import javax.swing.JInternalFrame; @@ -26,6 +26,7 @@ public class JInternalFrameHandler extends DefaultComponentHandler { @Override public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { return new CompiledObject(id, getBeanClass(), compiler) { + @Override public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException { if (ClassDescriptorLoader.getClassDescriptor(JMenuBar.class).isAssignableFrom(child.getObjectClass())) { @@ -45,10 +46,9 @@ public class JInternalFrameHandler extends DefaultComponentHandler { setAttribute(object, "defaultCloseOperation", String.valueOf(WindowConstants.DISPOSE_ON_CLOSE), false, compiler); } - @Override public void setAttributes(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { super.setAttributes(object, tag, compiler); compiler.appendInitializerCode(object.getId() + ".pack();\n"); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JListHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JListHandler.java similarity index 83% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JListHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JListHandler.java index f0a8f4a..6abf30a 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JListHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JListHandler.java @@ -1,16 +1,16 @@ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; import org.w3c.dom.Element; +import org.w3c.dom.NodeList; -import javax.swing.event.ListSelectionListener; import java.io.IOException; +import javax.swing.event.ListSelectionListener; import javax.swing.JList; -import org.w3c.dom.NodeList; public class JListHandler extends DefaultComponentHandler { diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JMenuHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JMenuHandler.java similarity index 72% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JMenuHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JMenuHandler.java index 1bb103f..4e4529f 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JMenuHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JMenuHandler.java @@ -2,11 +2,11 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; import javax.swing.JMenu; import javax.swing.event.MenuListener; @@ -23,4 +23,4 @@ public class JMenuHandler extends DefaultComponentHandler { super.configureProxyEventInfo(); addProxyEventInfo("isSelected", MenuListener.class); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JPasswordFieldHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPasswordFieldHandler.java similarity index 79% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JPasswordFieldHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPasswordFieldHandler.java index c15dadd..6fef48b 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JPasswordFieldHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPasswordFieldHandler.java @@ -2,10 +2,10 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; import javax.swing.JPasswordField; import javax.swing.event.DocumentListener; diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JPopupMenuHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPopupMenuHandler.java similarity index 76% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JPopupMenuHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPopupMenuHandler.java index 47bc082..346a95a 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JPopupMenuHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPopupMenuHandler.java @@ -2,18 +2,19 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; import org.w3c.dom.Element; import javax.swing.JPopupMenu; public class JPopupMenuHandler extends DefaultComponentHandler { + public JPopupMenuHandler(ClassDescriptor beanClass) { super(beanClass); ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JPopupMenu.class); @@ -28,4 +29,4 @@ public class JPopupMenuHandler extends DefaultComponentHandler { protected void openComponent(CompiledObject object, Element tag, JAXXCompiler compiler) { compiler.openInvisibleComponent(object); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JProgressBarHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JProgressBarHandler.java similarity index 74% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JProgressBarHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JProgressBarHandler.java index 5e087c8..9de5b52 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JProgressBarHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JProgressBarHandler.java @@ -2,11 +2,11 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; import javax.swing.JProgressBar; import javax.swing.event.ChangeListener; @@ -23,4 +23,4 @@ public class JProgressBarHandler extends DefaultComponentHandler { super.configureProxyEventInfo(); addProxyEventInfo("getValue", ChangeListener.class, "change"); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JRadioButtonHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JRadioButtonHandler.java similarity index 90% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JRadioButtonHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JRadioButtonHandler.java index b5a0b8b..1f4f65b 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JRadioButtonHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JRadioButtonHandler.java @@ -2,22 +2,23 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; -import jaxx.UnsupportedAttributeException; +import jaxx.compiler.CompilerException; +import jaxx.compiler.UnsupportedAttributeException; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; +import jaxx.compiler.types.TypeManager; import jaxx.runtime.swing.JAXXButtonGroup; -import jaxx.tags.DefaultComponentHandler; -import jaxx.types.TypeManager; import javax.swing.AbstractButton; import javax.swing.event.ChangeListener; public class JRadioButtonHandler extends DefaultComponentHandler { + private static final String VALUE_PROPERTY = JAXXButtonGroup.VALUE_CLIENT_PROPERTY.substring(1); private static final String BUTTON_GROUP_PROPERTY = JAXXButtonGroup.BUTTON8GROUP_CLIENT_PROPERTY.substring(1); @@ -77,5 +78,4 @@ public class JRadioButtonHandler extends DefaultComponentHandler { return super.getSetPropertyCode(id, name, valueCode, compiler); } } - -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JScrollPaneHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JScrollPaneHandler.java similarity index 82% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JScrollPaneHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JScrollPaneHandler.java index aa6d15e..d8439a3 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JScrollPaneHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JScrollPaneHandler.java @@ -2,14 +2,14 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; import javax.swing.JScrollPane; @@ -23,6 +23,7 @@ public class JScrollPaneHandler extends DefaultComponentHandler { @Override public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { return new CompiledObject(id, getBeanClass(), compiler) { + boolean hasChild; @Override @@ -38,4 +39,4 @@ public class JScrollPaneHandler extends DefaultComponentHandler { } }; } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JSliderHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSliderHandler.java similarity index 83% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JSliderHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSliderHandler.java index a09a73d..320b8f8 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JSliderHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSliderHandler.java @@ -2,14 +2,14 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; import org.w3c.dom.Attr; import org.w3c.dom.Element; diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JSpinnerHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSpinnerHandler.java similarity index 91% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JSpinnerHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSpinnerHandler.java index c839b0e..a14c75b 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JSpinnerHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSpinnerHandler.java @@ -2,20 +2,21 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; import org.w3c.dom.Element; import javax.swing.JSpinner; import javax.swing.event.ChangeListener; public class JSpinnerHandler extends DefaultComponentHandler { + public static String MINIMUM_PROPERTY = "minimum"; public static String MAXIMUM_PROPERTY = "maximum"; public static String VALUE_PROPERTY = "value"; @@ -26,6 +27,7 @@ public class JSpinnerHandler extends DefaultComponentHandler { } public static class CompiledSpinner extends CompiledObject { + Integer minimum = null; Integer maximum = null; Integer value = null; @@ -89,4 +91,4 @@ public class JSpinnerHandler extends DefaultComponentHandler { super.closeComponent(object, tag, compiler); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JSplitPaneHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSplitPaneHandler.java similarity index 89% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JSplitPaneHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSplitPaneHandler.java index b9ef79b..3459b67 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JSplitPaneHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSplitPaneHandler.java @@ -2,20 +2,21 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; import org.w3c.dom.Element; import javax.swing.JSplitPane; import java.awt.Component; public class JSplitPaneHandler extends DefaultComponentHandler { + public JSplitPaneHandler(ClassDescriptor beanClass) { super(beanClass); ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JSplitPane.class); @@ -48,6 +49,7 @@ public class JSplitPaneHandler extends DefaultComponentHandler { @Override public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { return new CompiledObject(id, getBeanClass(), compiler) { + private int count; @Override @@ -66,4 +68,4 @@ public class JSplitPaneHandler extends DefaultComponentHandler { } }; } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JTabbedPaneHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTabbedPaneHandler.java similarity index 93% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JTabbedPaneHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTabbedPaneHandler.java index 7ca446e..7fb3c96 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JTabbedPaneHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTabbedPaneHandler.java @@ -2,17 +2,17 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.CompiledObject; import jaxx.compiler.I18nHelper; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; +import jaxx.compiler.types.TypeManager; import jaxx.runtime.swing.TabInfo; -import jaxx.tags.DefaultComponentHandler; -import jaxx.types.TypeManager; import javax.swing.Icon; import javax.swing.JTabbedPane; @@ -21,14 +21,15 @@ import java.awt.Color; import java.awt.event.ContainerListener; public class JTabbedPaneHandler extends DefaultComponentHandler { + public JTabbedPaneHandler(ClassDescriptor beanClass) { super(beanClass); ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JTabbedPane.class); } public static class CompiledTabbedPane extends CompiledObject { - private static final TabInfo USED = new TabInfo("ALREADY USED"); + private static final TabInfo USED = new TabInfo("ALREADY USED"); int tabCount; TabInfo tabInfo; @@ -132,4 +133,4 @@ public class JTabbedPaneHandler extends DefaultComponentHandler { addProxyEventInfo("getSelectedComponent", ChangeListener.class); addProxyEventInfo("getTabCount", ContainerListener.class); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JTextComponentHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTextComponentHandler.java similarity index 84% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JTextComponentHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTextComponentHandler.java index 1c91b2e..7ded1c6 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JTextComponentHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTextComponentHandler.java @@ -2,23 +2,24 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; +import jaxx.runtime.SwingUtil; import org.w3c.dom.Attr; import org.w3c.dom.Element; import javax.swing.JTextArea; import javax.swing.event.DocumentListener; import javax.swing.text.JTextComponent; -import jaxx.runtime.SwingUtil; public class JTextComponentHandler extends DefaultComponentHandler { + private static final int DEFAULT_COLUMNS = 15; public JTextComponentHandler(ClassDescriptor beanClass) { @@ -32,8 +33,7 @@ public class JTextComponentHandler extends DefaultComponentHandler { try { object.getObjectClass().getMethodDescriptor("setColumns", ClassDescriptorLoader.getClassDescriptor(int.class)); setAttribute(object, "columns", String.valueOf(DEFAULT_COLUMNS), false, compiler); - } - catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { // ignore ? } @@ -46,7 +46,7 @@ public class JTextComponentHandler extends DefaultComponentHandler { @Override public String getSetPropertyCode(String id, String name, String valueCode, JAXXCompiler compiler) throws CompilerException { if (name.equals("text")) { - return SwingUtil.class.getName()+".setText(" + id + ", " + valueCode + ");\n"; + return SwingUtil.class.getName() + ".setText(" + id + ", " + valueCode + ");\n"; //return "jaxx.runtime.swing.Utils.setText(" + id + ", " + valueCode + ");\n"; } return super.getSetPropertyCode(id, name, valueCode, compiler); @@ -67,4 +67,4 @@ public class JTextComponentHandler extends DefaultComponentHandler { super.configureProxyEventInfo(); addProxyEventInfo("getText", DocumentListener.class, "document"); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JToolBarHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JToolBarHandler.java similarity index 84% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JToolBarHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JToolBarHandler.java index 8135bc2..3c67a91 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JToolBarHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JToolBarHandler.java @@ -2,15 +2,16 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; import javax.swing.JToolBar; public class JToolBarHandler extends DefaultComponentHandler { + public JToolBarHandler(ClassDescriptor beanClass) { super(beanClass); ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JToolBar.class); @@ -35,4 +36,4 @@ public class JToolBarHandler extends DefaultComponentHandler { } return super.constantValue(key, value); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JTreeHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTreeHandler.java similarity index 83% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JTreeHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTreeHandler.java index 77fd645..02b3b42 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JTreeHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTreeHandler.java @@ -1,10 +1,10 @@ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; import org.w3c.dom.Element; import javax.swing.event.TreeSelectionListener; diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JWindowHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JWindowHandler.java similarity index 85% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/JWindowHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JWindowHandler.java index 22a4c91..ef936cf 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JWindowHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JWindowHandler.java @@ -2,14 +2,14 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; import org.w3c.dom.Element; import javax.swing.JDialog; @@ -29,6 +29,7 @@ public class JWindowHandler extends DefaultComponentHandler { @Override public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { return new CompiledObject(id, getBeanClass(), compiler) { + @Override public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException { if (ClassDescriptorLoader.getClassDescriptor(JMenuBar.class).isAssignableFrom(child.getObjectClass())) { @@ -53,9 +54,9 @@ public class JWindowHandler extends DefaultComponentHandler { public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { super.compileSecondPass(tag, compiler); CompiledObject object = objectMap.get(tag); - Map<?,?> properties = object.getProperties(); + Map<?, ?> properties = object.getProperties(); if (!properties.containsKey("width") && !properties.containsKey("height")) { compiler.appendLateInitializer(object.getId() + ".pack();\n"); } } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/RowHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/RowHandler.java similarity index 93% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/RowHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/RowHandler.java index a5db9a9..d35d696 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/RowHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/RowHandler.java @@ -2,13 +2,13 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.TagHandler; import jaxx.runtime.swing.Table; -import jaxx.tags.TagHandler; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/TabHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java similarity index 95% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/TabHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java index a8b3b0f..fd463fa 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/TabHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java @@ -2,16 +2,16 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.CompiledObject; import jaxx.compiler.I18nHelper; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.TagHandler; +import jaxx.compiler.types.TypeManager; import jaxx.runtime.swing.TabInfo; -import jaxx.tags.TagHandler; -import jaxx.types.TypeManager; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; @@ -31,7 +31,6 @@ public class TabHandler implements TagHandler { compileChildrenFirstPass(tag, compiler); } - @Override public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { if (!ClassDescriptorLoader.getClassDescriptor(JTabbedPane.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) { @@ -55,7 +54,6 @@ public class TabHandler implements TagHandler { tabs.tabInfo = null; } - public static void setAttribute(CompiledObject compiledTabInfo, JTabbedPaneHandler.CompiledTabbedPane tabs, String name, String value, JAXXCompiler compiler) throws CompilerException { value = value.trim(); TabInfo tabInfo = tabs.tabInfo; @@ -116,7 +114,6 @@ public class TabHandler implements TagHandler { } } - public void setAttributes(CompiledObject compiledTabInfo, JTabbedPaneHandler.CompiledTabbedPane tabs, Element tag, JAXXCompiler compiler) throws CompilerException { NamedNodeMap children = tag.getAttributes(); for (int i = 0; i < children.getLength(); i++) { @@ -129,7 +126,6 @@ public class TabHandler implements TagHandler { } } - protected void compileChildrenFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { NodeList children = tag.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { @@ -147,12 +143,10 @@ public class TabHandler implements TagHandler { } } - protected void compileChildTagFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { compiler.compileFirstPass(tag); } - protected void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { NodeList children = tag.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { @@ -170,8 +164,7 @@ public class TabHandler implements TagHandler { } } - protected void compileChildTagSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { compiler.compileSecondPass(tag); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/TableHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TableHandler.java similarity index 89% rename from jaxx-compiler/src/main/java/jaxx/tags/swing/TableHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TableHandler.java index d97c12a..cccbaf5 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/TableHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TableHandler.java @@ -2,17 +2,17 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.swing; +package jaxx.compiler.tags.swing; -import jaxx.CompilerException; -import jaxx.UnsupportedAttributeException; +import jaxx.compiler.CompilerException; +import jaxx.compiler.UnsupportedAttributeException; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; +import jaxx.compiler.types.TypeManager; import jaxx.runtime.swing.Table; -import jaxx.tags.DefaultComponentHandler; -import jaxx.types.TypeManager; import java.awt.GridBagConstraints; import java.awt.Insets; @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.List; public class TableHandler extends DefaultComponentHandler { + public static final Insets DEFAULT_INSETS = new Insets(3, 3, 3, 3); public TableHandler(ClassDescriptor beanClass) { @@ -35,15 +36,14 @@ public class TableHandler extends DefaultComponentHandler { } else { super.setAttribute(object, propertyName, stringValue, inline, compiler); } - } - catch (UnsupportedAttributeException e) { + } catch (UnsupportedAttributeException e) { super.setAttribute(object, propertyName, stringValue, inline, compiler); } } class CompiledTable extends CompiledObject { - private List<Integer> rowSpans = new ArrayList<Integer>(); + private List<Integer> rowSpans = new ArrayList<Integer>(); private GridBagConstraints tableConstraints; private GridBagConstraints rowConstraints = null; private GridBagConstraints cellConstraints = null; @@ -121,4 +121,4 @@ public class TableHandler extends DefaultComponentHandler { public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { return new CompiledTable(id, getBeanClass(), compiler); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/validator/BeanValidatorHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java similarity index 94% rename from jaxx-compiler/src/main/java/jaxx/tags/validator/BeanValidatorHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java index c4bd76d..f2ceeac 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/validator/BeanValidatorHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java @@ -2,20 +2,20 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.validator; +package jaxx.compiler.tags.validator; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; -import jaxx.introspection.JAXXBeanInfo; -import jaxx.introspection.JAXXPropertyDescriptor; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; +import jaxx.compiler.beans.JAXXBeanInfo; +import jaxx.compiler.beans.JAXXPropertyDescriptor; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultObjectHandler; +import jaxx.compiler.types.TypeManager; import jaxx.runtime.validator.swing.SwingValidatorUtil; import jaxx.runtime.validator.swing.SwingValidator; import jaxx.runtime.validator.swing.ui.AbstractBeanValidatorUI; -import jaxx.tags.DefaultObjectHandler; -import jaxx.types.TypeManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Element; @@ -66,7 +66,7 @@ public class BeanValidatorHandler extends DefaultObjectHandler { @Override protected void compileChildTagFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - if (compiler.getOptions().isVerbose()) { + if (compiler.getConfiguration().isVerbose()) { log.info(tag); } if (!tag.getLocalName().equals(FieldValidatorHandler.TAG)) { @@ -133,7 +133,7 @@ public class BeanValidatorHandler extends DefaultObjectHandler { @Override public void setAttribute(CompiledObject object, String propertyName, String stringValue, boolean inline, JAXXCompiler compiler) { - if (compiler.getOptions().isVerbose()) { + if (compiler.getConfiguration().isVerbose()) { log.info(propertyName + " : " + stringValue + " for " + object); } // delegate to the compiled object with is statefull (but not the tag handler) @@ -169,14 +169,14 @@ public class BeanValidatorHandler extends DefaultObjectHandler { super(id, getDescriptor(objectClass, compiler), compiler); fields = new TreeMap<String, String>(); excludeFields = new TreeMap<String, String>(); - if (compiler.getOptions().isVerbose()) { + if (compiler.getConfiguration().isVerbose()) { log.info("validator objectClass " + super.getObjectClass()); } } protected static ClassDescriptor getDescriptor(ClassDescriptor objectClass, JAXXCompiler compiler) { ClassDescriptor result = objectClass; - Class<?> validatorClass = compiler.getOptions().getValidatorClass(); + Class<?> validatorClass = compiler.getConfiguration().getValidatorClass(); result = ClassDescriptorLoader.getClassDescriptor(validatorClass); return result; } @@ -351,8 +351,8 @@ public class BeanValidatorHandler extends DefaultObjectHandler { protected boolean addUiClass(BeanValidatorHandler handler, JAXXCompiler compiler) { boolean withError = false; - if (uiClass == null && compiler.getOptions().getDefaultErrorUI() != null) { - uiClass = compiler.getOptions().getDefaultErrorUI().getName(); + if (uiClass == null && compiler.getConfiguration().getDefaultErrorUI() != null) { + uiClass = compiler.getConfiguration().getDefaultErrorUI().getName(); } if (uiClass != null) { try { @@ -617,7 +617,7 @@ public class BeanValidatorHandler extends DefaultObjectHandler { protected void registerAutoFieldBean(Element tag, JAXXCompiler compiler, JAXXBeanInfo beanInfo) { for (JAXXPropertyDescriptor beanProperty : beanInfo.getJAXXPropertyDescriptors()) { String descriptionName = beanProperty.getName(); - if (compiler.getOptions().isVerbose()) { + if (compiler.getConfiguration().isVerbose()) { log.info("try to bind on bean " + beanInfo.getJAXXBeanDescriptor().getName() + " property " + descriptionName); } if (beanProperty.getWriteMethodDescriptor() == null) { @@ -653,7 +653,7 @@ public class BeanValidatorHandler extends DefaultObjectHandler { if (fields.containsKey(id)) { compiler.reportError("duplicate field '" + id + "' for validator " + this); } else { - if (compiler.getOptions().isVerbose()) { + if (compiler.getConfiguration().isVerbose()) { log.info("add field <" + id + ":" + component + ">"); } fields.put(id, component); @@ -664,7 +664,7 @@ public class BeanValidatorHandler extends DefaultObjectHandler { if (excludeFields.containsKey(id)) { compiler.reportError("duplicate field '" + id + "' for validator " + this); } else { - if (compiler.getOptions().isVerbose()) { + if (compiler.getConfiguration().isVerbose()) { log.info("add excludeField <" + id + ":" + component + ">"); } excludeFields.put(id, component); @@ -731,4 +731,4 @@ public class BeanValidatorHandler extends DefaultObjectHandler { public static List<CompiledBeanValidator> getValidators(JAXXCompiler compiler) { return validators.get(compiler); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/validator/ExcludeFieldValidatorHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/ExcludeFieldValidatorHandler.java similarity index 88% rename from jaxx-compiler/src/main/java/jaxx/tags/validator/ExcludeFieldValidatorHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/ExcludeFieldValidatorHandler.java index fbb6141..b5dd409 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/validator/ExcludeFieldValidatorHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/ExcludeFieldValidatorHandler.java @@ -2,14 +2,14 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.validator; +package jaxx.compiler.tags.validator; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.TagHandler; +import jaxx.compiler.tags.validator.BeanValidatorHandler.CompiledBeanValidator; import jaxx.runtime.validator.swing.SwingValidator; -import jaxx.tags.TagHandler; -import jaxx.tags.validator.BeanValidatorHandler.CompiledBeanValidator; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Element; @@ -21,13 +21,12 @@ public class ExcludeFieldValidatorHandler implements TagHandler { public static final String TAG = "excludeField"; public static final String NAME_ATTRIBUTE = "name"; public static final String COMPONENT_ATTRIBUTE = "component"; - /** to use log facility, just put in your code: log.info(\"...\"); */ static private Log log = LogFactory.getLog(ExcludeFieldValidatorHandler.class); @Override public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - if (compiler.getOptions().isVerbose()) { + if (compiler.getConfiguration().isVerbose()) { log.info(tag); } //todo check there is no child @@ -35,7 +34,7 @@ public class ExcludeFieldValidatorHandler implements TagHandler { @Override public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - if (compiler.getOptions().isVerbose()) { + if (compiler.getConfiguration().isVerbose()) { log.debug(tag); } @@ -83,5 +82,4 @@ public class ExcludeFieldValidatorHandler implements TagHandler { } - -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/validator/FieldValidatorHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java similarity index 86% rename from jaxx-compiler/src/main/java/jaxx/tags/validator/FieldValidatorHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java index d5864ff..3a4bf9c 100644 --- a/jaxx-compiler/src/main/java/jaxx/tags/validator/FieldValidatorHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java @@ -2,14 +2,14 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.tags.validator; +package jaxx.compiler.tags.validator; -import jaxx.CompilerException; +import jaxx.compiler.CompilerException; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.TagHandler; +import jaxx.compiler.tags.validator.BeanValidatorHandler.CompiledBeanValidator; import jaxx.runtime.validator.swing.SwingValidator; -import jaxx.tags.TagHandler; -import jaxx.tags.validator.BeanValidatorHandler.CompiledBeanValidator; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Element; @@ -21,13 +21,12 @@ public class FieldValidatorHandler implements TagHandler { public static final String TAG = "field"; public static final String NAME_ATTRIBUTE = "name"; public static final String COMPONENT_ATTRIBUTE = "component"; - /** to use log facility, just put in your code: log.info(\"...\"); */ static private Log log = LogFactory.getLog(FieldValidatorHandler.class); @Override public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - if (compiler.getOptions().isVerbose()) { + if (compiler.getConfiguration().isVerbose()) { log.info(tag); } //todo check there is no child @@ -35,7 +34,7 @@ public class FieldValidatorHandler implements TagHandler { @Override public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - if (compiler.getOptions().isVerbose()) { + if (compiler.getConfiguration().isVerbose()) { log.info(tag); } @@ -76,5 +75,4 @@ public class FieldValidatorHandler implements TagHandler { } - -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/PrintTagInfo.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/PrintTagInfo.java similarity index 91% rename from jaxx-compiler/src/main/java/jaxx/PrintTagInfo.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tools/PrintTagInfo.java index b02003c..3df8286 100644 --- a/jaxx-compiler/src/main/java/jaxx/PrintTagInfo.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/PrintTagInfo.java @@ -1,13 +1,12 @@ -package jaxx; +package jaxx.compiler.tools; +import jaxx.compiler.tags.*; import jaxx.compiler.JAXXCompiler; import jaxx.compiler.JAXXCompilerLaunchor; -import jaxx.introspection.JAXXPropertyDescriptor; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.reflect.MethodDescriptor; -import jaxx.tags.DefaultObjectHandler; -import jaxx.tags.TagManager; +import jaxx.compiler.beans.JAXXPropertyDescriptor; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.MethodDescriptor; import java.io.BufferedWriter; import java.io.FileWriter; diff --git a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/AbstractContextNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/AbstractContextNode.java similarity index 81% rename from jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/AbstractContextNode.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/AbstractContextNode.java index 67dd772..6840434 100644 --- a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/AbstractContextNode.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/AbstractContextNode.java @@ -1,4 +1,4 @@ -package jaxx.tools.jaxxcapture; +package jaxx.compiler.tools.jaxxcapture; import java.util.ArrayList; import java.util.List; @@ -7,10 +7,12 @@ public abstract class AbstractContextNode implements ContextNode { private List<ContextNode> arguments = new ArrayList<ContextNode>(); + @Override public void addArgument(ContextNode node) { arguments.add(node); } + @Override public ContextNode[] getArguments() { return arguments.toArray(new ContextNode[arguments.size()]); } diff --git a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/CapturedObject.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/CapturedObject.java similarity index 93% rename from jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/CapturedObject.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/CapturedObject.java index 7fcdebb..ccdda36 100644 --- a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/CapturedObject.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/CapturedObject.java @@ -1,7 +1,7 @@ -package jaxx.tools.jaxxcapture; +package jaxx.compiler.tools.jaxxcapture; import jaxx.compiler.JAXXCompiler; -import jaxx.tools.jaxxcapture.handlers.ObjectHandler; +import jaxx.compiler.tools.jaxxcapture.handlers.ObjectHandler; import java.awt.Component; import java.util.HashMap; diff --git a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/ContextNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/ContextNode.java similarity index 67% rename from jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/ContextNode.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/ContextNode.java index 0f38e12..5e34599 100644 --- a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/ContextNode.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/ContextNode.java @@ -1,7 +1,8 @@ -package jaxx.tools.jaxxcapture; +package jaxx.compiler.tools.jaxxcapture; public interface ContextNode { + void addArgument(ContextNode node); ContextNode[] getArguments(); -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/JAXXCapture.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/JAXXCapture.java similarity index 88% rename from jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/JAXXCapture.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/JAXXCapture.java index 9ef39de..cbc7d26 100644 --- a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/JAXXCapture.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/JAXXCapture.java @@ -1,14 +1,14 @@ -package jaxx.tools.jaxxcapture; +package jaxx.compiler.tools.jaxxcapture; -import jaxx.ClassMap; +import jaxx.compiler.ClassMap; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tools.jaxxcapture.handlers.JTabbedPaneHandler; -import jaxx.tools.jaxxcapture.handlers.ObjectHandler; -import jaxx.tools.jaxxcapture.handlers.TableHandler; -import jaxx.types.TypeManager; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tools.jaxxcapture.handlers.JTabbedPaneHandler; +import jaxx.compiler.tools.jaxxcapture.handlers.ObjectHandler; +import jaxx.compiler.tools.jaxxcapture.handlers.TableHandler; +import jaxx.compiler.types.TypeManager; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -47,6 +47,7 @@ import java.util.jar.JarFile; import java.util.jar.Manifest; public class JAXXCapture { + private static ClassMap<Object> objectHandlers = new ClassMap<Object>(); static { @@ -59,16 +60,14 @@ public class JAXXCapture { System.err.println(e); } } - private Map<String, Object> sourceObjects = new HashMap<String, Object>(); private Map<String, CapturedObject> capturedObjects = new HashMap<String, CapturedObject>(); private ClassLoader classLoader; private int count; - private static class CaptureEventQueue extends EventQueue { - private ClassLoader classLoader; + private ClassLoader classLoader; private CaptureEventQueue(ClassLoader classLoader) { this.classLoader = classLoader; @@ -100,8 +99,7 @@ public class JAXXCapture { try { System.err.println(new String(buffer.toByteArray())); System.out.println(capture.convertToJAXX(new ByteArrayInputStream(buffer.toByteArray()))); - } - catch (IOException e) { + } catch (IOException e) { throw new RuntimeException(e); } } @@ -110,29 +108,24 @@ public class JAXXCapture { } } - private JAXXCapture(ClassLoader classLoader) { this.classLoader = classLoader; } - public ClassLoader getClassLoader() { return classLoader; } - public Map<String, CapturedObject> getCapturedObjects() { return capturedObjects; } - private void applyNames(Component target) { String name = target.getName(); if (name == null || sourceObjects.containsKey(name) || !CompiledObject.isValidID(name)) { do { name = "Object" + ++count; - } - while (sourceObjects.containsKey(name)); + } while (sourceObjects.containsKey(name)); } target.setName(name); assert !sourceObjects.containsKey(name) : "ID " + name + " is already registered"; @@ -146,12 +139,10 @@ public class JAXXCapture { } } - public static String getText(Element tag) { // NOT a safe general-purpose implementation! return ((Text) tag.getChildNodes().item(0)).getData(); } - private String getArgumentsCode(ContextNode[] arguments) { StringBuffer result = new StringBuffer(); result.append('('); @@ -165,7 +156,6 @@ public class JAXXCapture { return result.toString(); } - public String getJavaCode(ContextNode node) { StringBuffer result = new StringBuffer(); if (node instanceof PropertyNode) { @@ -197,44 +187,39 @@ public class JAXXCapture { return result.toString(); } - // returns the best matching method for the specified argument types - private static Method getMethod(Class target, String methodName, Class[] arguments) { + private static Method getMethod(Class<?> target, String methodName, Class<?>[] arguments) { try { // use the package-private class java.beans.ReflectionUtils to resolve the method. This isn't 100% safe, but it's better than // having to rewrite the resolution myself. Class<?> reflectionUtils = Class.forName("java.beans.ReflectionUtils"); - Method getMethod = reflectionUtils.getDeclaredMethod("getMethod", new Class[]{Class.class, String.class, Class[].class}); + Method getMethod = reflectionUtils.getDeclaredMethod("getMethod", new Class<?>[]{Class.class, String.class, Class[].class}); getMethod.setAccessible(true); return (Method) getMethod.invoke(null, target, methodName, arguments); - } - catch (Exception e) { + } catch (Exception e) { throw new RuntimeException(e); } } - // returns the best matching constructor for the specified argument types - private static Constructor getConstructor(Class target, Class[] arguments) { + private static Constructor<?> getConstructor(Class<?> target, Class<?>[] arguments) { try { // use the package-private class java.beans.ReflectionUtils to resolve the constructor. This isn't 100% safe, but it's better than // having to rewrite the resolution myself. Class<?> reflectionUtils = Class.forName("java.beans.ReflectionUtils"); - Method getConstructor = reflectionUtils.getDeclaredMethod("getConstructor", new Class[]{Class.class, Class[].class}); + Method getConstructor = reflectionUtils.getDeclaredMethod("getConstructor", new Class<?>[]{Class.class, Class[].class}); getConstructor.setAccessible(true); - return (Constructor) getConstructor.invoke(null, target, arguments); - } - catch (Exception e) { + return (Constructor<?>) getConstructor.invoke(null, target, arguments); + } catch (Exception e) { throw new RuntimeException(e); } } - private Object createInstance(CapturedObject object) { try { ContextNode[] argumentNodes = object.getArguments(); Object[] arguments = new Object[argumentNodes.length]; - Class[] argumentTypes = new Class[argumentNodes.length]; + Class<?>[] argumentTypes = new Class<?>[argumentNodes.length]; for (int j = 0; j < argumentNodes.length; j++) { if (argumentNodes[j] instanceof ValueNode) { arguments[j] = ((ValueNode) argumentNodes[j]).getValue(); @@ -244,15 +229,13 @@ public class JAXXCapture { argumentTypes[j] = arguments[j] != null ? arguments[j].getClass() : null; } } - Constructor constructor = getConstructor(Class.forName(object.getClassName(), true, classLoader), argumentTypes); + Constructor<?> constructor = getConstructor(Class.forName(object.getClassName(), true, classLoader), argumentTypes); return constructor.newInstance(arguments); - } - catch (Exception e) { + } catch (Exception e) { throw new RuntimeException(e); } } - public String getJavaCode(Stack/*<ContextNode>*/ context) { CapturedObject contextCapturedObject = (CapturedObject) context.get(0); StringBuffer result = new StringBuffer(); @@ -280,7 +263,7 @@ public class JAXXCapture { methodName = (argumentNodes.length == 0 ? "get" : "set") + org.apache.commons.lang.StringUtils.capitalize(((PropertyNode) node).getProperty()); } Object[] arguments = new Object[argumentNodes.length]; - Class[] argumentTypes = new Class[argumentNodes.length]; + Class<?>[] argumentTypes = new Class<?>[argumentNodes.length]; for (int j = 0; j < argumentNodes.length; j++) { if (argumentNodes[j] instanceof ValueNode) { arguments[j] = ((ValueNode) argumentNodes[j]).getValue(); @@ -308,8 +291,7 @@ public class JAXXCapture { } contextObject = method.invoke(contextObject, arguments); contextClass = method.getReturnType(); - } - catch (Exception e) { + } catch (Exception e) { throw new RuntimeException(e); } } @@ -323,12 +305,10 @@ public class JAXXCapture { return result + ";"; } - - private String getOutputName(Class c) { + private String getOutputName(Class<?> c) { return c.getName(); } - public CapturedObject processObject(Element objectTag, Stack<ContextNode> context) { String className = objectTag.getAttribute("class"); ObjectHandler handler; @@ -336,8 +316,7 @@ public class JAXXCapture { try { ClassDescriptor descriptor = ClassDescriptorLoader.getClassDescriptor(className, classLoader); handler = (ObjectHandler) objectHandlers.get(descriptor); - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } else { @@ -347,7 +326,6 @@ public class JAXXCapture { return handler.processObject(objectTag, context, this); } - private synchronized String convertToJAXX(InputStream beansXML) throws IOException { try { Document document = JAXXCompiler.parseDocument(beansXML); @@ -371,23 +349,19 @@ public class JAXXCapture { } } return null; - } - catch (SAXException e) { + } catch (SAXException e) { throw new RuntimeException(e); - } - finally { + } finally { reset(); } } - private void reset() { sourceObjects.clear(); capturedObjects.clear(); count = 0; } - public static void main(String[] arg) throws Exception { File file = new File(arg[0]); JarFile jarFile = new JarFile(file); @@ -398,7 +372,7 @@ public class JAXXCapture { Manifest mf = jarFile.getManifest(); String mainClassName = mf.getMainAttributes().getValue(Attributes.Name.MAIN_CLASS); Class<?> mainClass = Class.forName(mainClassName, true, classLoader); - Method main = mainClass.getMethod("main", new Class[]{String[].class}); + Method main = mainClass.getMethod("main", String[].class); main.invoke(null, new Object[]{new String[0]}); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/LiteralNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/LiteralNode.java similarity index 85% rename from jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/LiteralNode.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/LiteralNode.java index 0683c00..6db634d 100644 --- a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/LiteralNode.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/LiteralNode.java @@ -1,4 +1,4 @@ -package jaxx.tools.jaxxcapture; +package jaxx.compiler.tools.jaxxcapture; public class LiteralNode extends AbstractContextNode { private String javaCode; diff --git a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/MethodNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/MethodNode.java similarity index 86% rename from jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/MethodNode.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/MethodNode.java index d1fff14..4eb8f6b 100644 --- a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/MethodNode.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/MethodNode.java @@ -1,4 +1,4 @@ -package jaxx.tools.jaxxcapture; +package jaxx.compiler.tools.jaxxcapture; public class MethodNode extends AbstractContextNode { private String methodName; diff --git a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/PropertyNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/PropertyNode.java similarity index 86% rename from jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/PropertyNode.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/PropertyNode.java index 51e5d7c..fa9472b 100644 --- a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/PropertyNode.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/PropertyNode.java @@ -1,4 +1,4 @@ -package jaxx.tools.jaxxcapture; +package jaxx.compiler.tools.jaxxcapture; public class PropertyNode extends AbstractContextNode { private String property; diff --git a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/ValueNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/ValueNode.java similarity index 79% rename from jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/ValueNode.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/ValueNode.java index ef4ecb3..45eda1e 100644 --- a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/ValueNode.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/ValueNode.java @@ -1,4 +1,4 @@ -package jaxx.tools.jaxxcapture; +package jaxx.compiler.tools.jaxxcapture; public class ValueNode extends AbstractContextNode { private Object value; diff --git a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/handlers/JTabbedPaneHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/JTabbedPaneHandler.java similarity index 74% rename from jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/handlers/JTabbedPaneHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/JTabbedPaneHandler.java index ac7058d..9b5596a 100644 --- a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/handlers/JTabbedPaneHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/JTabbedPaneHandler.java @@ -1,14 +1,15 @@ -package jaxx.tools.jaxxcapture.handlers; +package jaxx.compiler.tools.jaxxcapture.handlers; -import jaxx.tools.jaxxcapture.ContextNode; -import jaxx.tools.jaxxcapture.JAXXCapture; -import jaxx.tools.jaxxcapture.MethodNode; +import jaxx.compiler.tools.jaxxcapture.ContextNode; +import jaxx.compiler.tools.jaxxcapture.JAXXCapture; +import jaxx.compiler.tools.jaxxcapture.MethodNode; import org.w3c.dom.Element; import java.util.Arrays; import java.util.Stack; public class JTabbedPaneHandler extends ObjectHandler { + @Override protected void evaluateMethod(Element tag, Stack<ContextNode> context, JAXXCapture capture) { String methodName = tag.getAttribute("method"); @@ -22,4 +23,4 @@ public class JTabbedPaneHandler extends ObjectHandler { super.evaluateMethod(tag, context, capture); } } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/handlers/ObjectHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/ObjectHandler.java similarity index 93% rename from jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/handlers/ObjectHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/ObjectHandler.java index 846c8fb..69e5710 100644 --- a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/handlers/ObjectHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/ObjectHandler.java @@ -1,14 +1,14 @@ -package jaxx.tools.jaxxcapture.handlers; +package jaxx.compiler.tools.jaxxcapture.handlers; import jaxx.compiler.JavaFile; import jaxx.compiler.JAXXCompiler; -import jaxx.tools.jaxxcapture.CapturedObject; -import jaxx.tools.jaxxcapture.ContextNode; -import jaxx.tools.jaxxcapture.JAXXCapture; -import jaxx.tools.jaxxcapture.LiteralNode; -import jaxx.tools.jaxxcapture.MethodNode; -import jaxx.tools.jaxxcapture.PropertyNode; -import jaxx.tools.jaxxcapture.ValueNode; +import jaxx.compiler.tools.jaxxcapture.CapturedObject; +import jaxx.compiler.tools.jaxxcapture.ContextNode; +import jaxx.compiler.tools.jaxxcapture.JAXXCapture; +import jaxx.compiler.tools.jaxxcapture.LiteralNode; +import jaxx.compiler.tools.jaxxcapture.MethodNode; +import jaxx.compiler.tools.jaxxcapture.PropertyNode; +import jaxx.compiler.tools.jaxxcapture.ValueNode; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -110,7 +110,7 @@ public class ObjectHandler { ContextNode[] arguments = newContext.getArguments(); if (methodName.equals("add") && arguments.length >= 1 && arguments[0] instanceof CapturedObject) { - Class contextClass = Class.forName(contextObject.getClassName(), true, capture.getClassLoader()); + Class<?> contextClass = Class.forName(contextObject.getClassName(), true, capture.getClassLoader()); if (Container.class.isAssignableFrom(contextClass)) { add = true; evaluateAdd(contextObject, (CapturedObject) arguments[0], null); diff --git a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/handlers/TableHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/TableHandler.java similarity index 63% rename from jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/handlers/TableHandler.java rename to jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/TableHandler.java index ebdfe72..852a738 100644 --- a/jaxx-compiler/src/main/java/jaxx/tools/jaxxcapture/handlers/TableHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/TableHandler.java @@ -1,12 +1,14 @@ -package jaxx.tools.jaxxcapture.handlers; +package jaxx.compiler.tools.jaxxcapture.handlers; -import jaxx.tools.jaxxcapture.CapturedObject; -import jaxx.tools.jaxxcapture.JAXXCapture; +import jaxx.compiler.tools.jaxxcapture.CapturedObject; +import jaxx.compiler.tools.jaxxcapture.JAXXCapture; public class TableHandler extends ObjectHandler { + + @Override protected CapturedObject createCapturedObject(String className, JAXXCapture capture) { CapturedObject result = new CapturedObject(this, "javax.swing.JPanel", capture); result.setProperty("layout", "{new GridBagLayout()}"); return result; } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/types/ColorConverter.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/ColorConverter.java similarity index 84% rename from jaxx-compiler/src/main/java/jaxx/types/ColorConverter.java rename to jaxx-compiler/src/main/java/jaxx/compiler/types/ColorConverter.java index b7f3cc5..daf2181 100644 --- a/jaxx-compiler/src/main/java/jaxx/types/ColorConverter.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/ColorConverter.java @@ -2,20 +2,21 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.types; +package jaxx.compiler.types; -import jaxx.types.*; import java.awt.Color; import java.lang.reflect.Field; public class ColorConverter implements TypeConverter { + + @Override public String getJavaCode(Object object) { Color color = (Color) object; return "new Color(" + color.getRed() + ", " + color.getGreen() + ", " + color.getBlue() + ")"; } - - public Object convertFromString(String string, Class type) { + @Override + public Object convertFromString(String string, Class<?> type) { if (type != Color.class) { throw new IllegalArgumentException("unsupported type: " + type); } @@ -25,11 +26,10 @@ public class ColorConverter implements TypeConverter { try { Field color = Color.class.getField(string); return color.get(null); - } - catch (NoSuchFieldException e) { + } catch (NoSuchFieldException e) { throw new IllegalArgumentException("colors must be of the form #xxxxxx ('#' followed by six hexadecimal digits), or the name of a constant field in java.awt.Color (found: '" + string + "')"); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/types/GridBagConstraintsConverter.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/GridBagConstraintsConverter.java similarity index 82% rename from jaxx-compiler/src/main/java/jaxx/types/GridBagConstraintsConverter.java rename to jaxx-compiler/src/main/java/jaxx/compiler/types/GridBagConstraintsConverter.java index 5081282..3158c3b 100644 --- a/jaxx-compiler/src/main/java/jaxx/types/GridBagConstraintsConverter.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/GridBagConstraintsConverter.java @@ -2,12 +2,13 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.types; +package jaxx.compiler.types; -import jaxx.types.*; import java.awt.GridBagConstraints; public class GridBagConstraintsConverter implements TypeConverter { + + @Override public String getJavaCode(Object object) { GridBagConstraints g = (GridBagConstraints) object; return "new GridBagConstraints(" + g.gridx + ", " + g.gridy + ", " + g.gridwidth + ", " + g.gridheight + ", " + @@ -15,8 +16,8 @@ public class GridBagConstraintsConverter implements TypeConverter { TypeManager.getJavaCode(g.insets) + ", " + g.ipadx + ", " + g.ipady + ")"; } - - public Object convertFromString(String string, Class type) { + @Override + public Object convertFromString(String string, Class<?> type) { throw new UnsupportedOperationException("GridBagConstraints must be represented using Java code"); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/types/InsetsConverter.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/InsetsConverter.java similarity index 88% rename from jaxx-compiler/src/main/java/jaxx/types/InsetsConverter.java rename to jaxx-compiler/src/main/java/jaxx/compiler/types/InsetsConverter.java index 279e310..8326288 100644 --- a/jaxx-compiler/src/main/java/jaxx/types/InsetsConverter.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/InsetsConverter.java @@ -2,20 +2,21 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.types; +package jaxx.compiler.types; -import jaxx.types.*; import java.awt.Insets; import java.util.StringTokenizer; public class InsetsConverter implements TypeConverter { + + @Override public String getJavaCode(Object object) { Insets insets = (Insets) object; return "new Insets(" + insets.top + ", " + insets.left + ", " + insets.bottom + ", " + insets.right + ")"; } - - public Object convertFromString(String string, Class type) { + @Override + public Object convertFromString(String string, Class<?> type) { if (type != Insets.class) { throw new IllegalArgumentException("unsupported type: " + type); } @@ -34,4 +35,4 @@ public class InsetsConverter implements TypeConverter { } throw new IllegalArgumentException("unable to convert string '" + string + "' to Insets"); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/types/KeyStrokeConverter.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/KeyStrokeConverter.java similarity index 76% rename from jaxx-compiler/src/main/java/jaxx/types/KeyStrokeConverter.java rename to jaxx-compiler/src/main/java/jaxx/compiler/types/KeyStrokeConverter.java index 68080e4..30e5e01 100644 --- a/jaxx-compiler/src/main/java/jaxx/types/KeyStrokeConverter.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/KeyStrokeConverter.java @@ -2,21 +2,22 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.types; +package jaxx.compiler.types; -import jaxx.types.*; import javax.swing.KeyStroke; public class KeyStrokeConverter implements TypeConverter { + + @Override public String getJavaCode(Object object) { return "KeyStroke.getKeyStroke(\"" + object.toString() + "\")"; } - - public Object convertFromString(String string, Class type) { + @Override + public Object convertFromString(String string, Class<?> type) { if (type != KeyStroke.class) { throw new IllegalArgumentException("unsupported type: " + type); } return KeyStroke.getKeyStroke(string); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/types/PrimitiveConverter.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/PrimitiveConverter.java similarity index 93% rename from jaxx-compiler/src/main/java/jaxx/types/PrimitiveConverter.java rename to jaxx-compiler/src/main/java/jaxx/compiler/types/PrimitiveConverter.java index 8fb7f30..177b241 100644 --- a/jaxx-compiler/src/main/java/jaxx/types/PrimitiveConverter.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/PrimitiveConverter.java @@ -2,11 +2,13 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.types; +package jaxx.compiler.types; import jaxx.compiler.JAXXCompiler; public class PrimitiveConverter implements TypeConverter { + + @Override public String getJavaCode(Object object) { if (object instanceof Boolean) { return String.valueOf(((Boolean) object).booleanValue()); @@ -35,8 +37,8 @@ public class PrimitiveConverter implements TypeConverter { throw new IllegalArgumentException("unsupported object: " + object); } - - public Object convertFromString(String string, Class type) { + @Override + public Object convertFromString(String string, Class<?> type) { if (type == String.class || type == Object.class || type == null) { return string; } @@ -75,4 +77,4 @@ public class PrimitiveConverter implements TypeConverter { } throw new IllegalArgumentException("unsupported type: " + type); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/types/TypeConverter.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/TypeConverter.java similarity index 50% rename from jaxx-compiler/src/main/java/jaxx/types/TypeConverter.java rename to jaxx-compiler/src/main/java/jaxx/compiler/types/TypeConverter.java index 2f15272..822773e 100644 --- a/jaxx-compiler/src/main/java/jaxx/types/TypeConverter.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/TypeConverter.java @@ -2,10 +2,11 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.types; +package jaxx.compiler.types; + +public interface TypeConverter { -public interface TypeConverter { String getJavaCode(Object object); - Object convertFromString(String string, Class type); -} \ No newline at end of file + Object convertFromString(String string, Class<?> type); +} diff --git a/jaxx-compiler/src/main/java/jaxx/types/TypeManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/TypeManager.java similarity index 70% rename from jaxx-compiler/src/main/java/jaxx/types/TypeManager.java rename to jaxx-compiler/src/main/java/jaxx/compiler/types/TypeManager.java index ad01268..e000e8b 100644 --- a/jaxx-compiler/src/main/java/jaxx/types/TypeManager.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/TypeManager.java @@ -2,27 +2,25 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.types; +package jaxx.compiler.types; import java.util.HashMap; import java.util.Map; public class TypeManager { - private static Map<Class, TypeConverter> converters = new HashMap<Class, TypeConverter>(); - private TypeManager() { /* not instantiable */ } + private static Map<Class<?>, TypeConverter> converters = new HashMap<Class<?>, TypeConverter>(); + private TypeManager() { /* not instantiable */ } - public static void registerTypeConverter(Class type, TypeConverter converter) { + public static void registerTypeConverter(Class<?> type, TypeConverter converter) { converters.put(type, converter); } - - public static TypeConverter getTypeConverter(Class type) { + public static TypeConverter getTypeConverter(Class<?> type) { return converters.get(type); } - public static String getJavaCode(Object object) { if (object == null) { return "null"; @@ -34,12 +32,11 @@ public class TypeManager { return converter.getJavaCode(object); } - - public static Object convertFromString(String string, Class type) { + public static Object convertFromString(String string, Class<?> type) { TypeConverter converter = getTypeConverter(type); if (converter == null) { throw new IllegalArgumentException("unsupported type: " + type); } return converter.convertFromString(string, type); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXTabHandler.java b/jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXTabHandler.java deleted file mode 100644 index acf8f93..0000000 --- a/jaxx-compiler/src/main/java/jaxx/tags/swing/JAXXTabHandler.java +++ /dev/null @@ -1,28 +0,0 @@ -/* -* \#\#% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, -* Tony Chemit, Gabriel Landais -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -* \#\#% */ -package jaxx.tags.swing; - -import jaxx.reflect.ClassDescriptor; - -/** @author chemit */ -public class JAXXTabHandler extends TableHandler { - public JAXXTabHandler(ClassDescriptor beanClass) { - super(beanClass); - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/tags/validator/ValidatorInitializer.java b/jaxx-compiler/src/main/java/jaxx/tags/validator/ValidatorInitializer.java deleted file mode 100644 index 8bb9619..0000000 --- a/jaxx-compiler/src/main/java/jaxx/tags/validator/ValidatorInitializer.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.tags.validator; - -import jaxx.compiler.JAXXCompiler; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.runtime.validator.swing.SwingValidator; -import jaxx.tags.TagManager; - -public class ValidatorInitializer implements jaxx.spi.Initializer { - - @Override - public void initialize() { - - TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, BeanValidatorHandler.TAG, new BeanValidatorHandler(ClassDescriptorLoader.getClassDescriptor(SwingValidator.class))); - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(SwingValidator.class), BeanValidatorHandler.class); - TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, FieldValidatorHandler.TAG, new FieldValidatorHandler()); - TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, ExcludeFieldValidatorHandler.TAG, new FieldValidatorHandler()); - } -} \ No newline at end of file diff --git a/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.Generator b/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.Generator deleted file mode 100644 index 49cf642..0000000 --- a/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.Generator +++ /dev/null @@ -1,3 +0,0 @@ -jaxx.compiler.JAXXObjectGenerator -jaxx.compiler.SwingGenerator -jaxx.compiler.ValidatorGenerator diff --git a/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.generators.Generator b/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.generators.Generator new file mode 100644 index 0000000..761f3bd --- /dev/null +++ b/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.generators.Generator @@ -0,0 +1,3 @@ +jaxx.compiler.generators.JAXXObjectGenerator +jaxx.compiler.generators.SwingGenerator +jaxx.compiler.generators.ValidatorGenerator diff --git a/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.spi.Initializer b/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.spi.Initializer new file mode 100644 index 0000000..763ca46 --- /dev/null +++ b/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.spi.Initializer @@ -0,0 +1 @@ +jaxx.compiler.spi.DefaultInitializer \ No newline at end of file diff --git a/jaxx-compiler/src/main/resources/META-INF/services/jaxx.spi.Initializer b/jaxx-compiler/src/main/resources/META-INF/services/jaxx.spi.Initializer deleted file mode 100644 index f766cdb..0000000 --- a/jaxx-compiler/src/main/resources/META-INF/services/jaxx.spi.Initializer +++ /dev/null @@ -1,3 +0,0 @@ -jaxx.DefaultInitializer -jaxx.SwingInitializer -jaxx.tags.validator.ValidatorInitializer diff --git a/jaxx-compiler/src/site/rst/JAXXContext.rst b/jaxx-compiler/src/site/rst/JAXXContext.rst index 465f8fd..5175ffc 100644 --- a/jaxx-compiler/src/site/rst/JAXXContext.rst +++ b/jaxx-compiler/src/site/rst/JAXXContext.rst @@ -13,7 +13,7 @@ Ajout d'un context applicatif dans JAXX. Le besoin initial de ce développement est de pouvoir facilement intégrer un context applicatif dans JAXX et de pouvoir l'utiliser dans les fichiers JAXX pour injecter par exemple des données dans les widgets. -jaxx.runtime.JAXXContext +jaxx.runtime.context.JAXXContext ======================== Il s'agit du contrat de base du context applicatif. @@ -32,7 +32,7 @@ Le type de l'objet correspondant en fait à la classe de la donnée. Le nom qui est facultatif permet de pouvoir distinguer plusieurs données d'un même type dans le context. Si le nom n'est pas utilisé pour caractériser une données on fixera alors sa valeur à *null*. -Afin de pouvoir caractériser les entrées dans le context, une classe a été définie *jaxx.runtime.JAXXContextEntryDef*. +Afin de pouvoir caractériser les entrées dans le context, une classe a été définie *jaxx.runtime.context.JAXXContextEntryDef*. Les méthodes de lecture *********************** @@ -87,7 +87,7 @@ de type *JAXXContext* *non nommé* qui le context courant qui sera détecté com Cette entrée spéciale ne sera pas stockée avec les autres entrées afin d'optimiser les algorithmes d'injection et de restitution. -jaxx.runtime.JAXXInitialContext +jaxx.runtime.context.JAXXInitialContext ******************************* On a implanté un second type de context qui lui peut servir à l'initialisation des JAXXObject. diff --git a/jaxx-compiler/src/test/java/jaxx/junit/JavaFileParserTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/JavaFileParserTest.java similarity index 88% rename from jaxx-compiler/src/test/java/jaxx/junit/JavaFileParserTest.java rename to jaxx-compiler/src/test/java/jaxx/compiler/JavaFileParserTest.java index d151cd9..9d188d0 100644 --- a/jaxx-compiler/src/test/java/jaxx/junit/JavaFileParserTest.java +++ b/jaxx-compiler/src/test/java/jaxx/compiler/JavaFileParserTest.java @@ -1,8 +1,8 @@ -package jaxx.junit; +package jaxx.compiler; -import jaxx.CompilerException; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.JavaFileParser; +import jaxx.compiler.CompilerException; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.JavaFileParser; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Assert; diff --git a/jaxx-compiler/src/test/java/jaxx/junit/JavaMethodTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/JavaMethodTest.java similarity index 98% rename from jaxx-compiler/src/test/java/jaxx/junit/JavaMethodTest.java rename to jaxx-compiler/src/test/java/jaxx/compiler/JavaMethodTest.java index 59b66ba..94311a6 100644 --- a/jaxx-compiler/src/test/java/jaxx/junit/JavaMethodTest.java +++ b/jaxx-compiler/src/test/java/jaxx/compiler/JavaMethodTest.java @@ -1,4 +1,4 @@ -package jaxx.junit; +package jaxx.compiler; import jaxx.compiler.JavaMethod; import jaxx.compiler.JavaMethod.MethodOrder; diff --git a/jaxx-compiler/src/test/java/jaxx/beaninfos/BeanIntoUtilTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/beans/BeanIntoUtilTest.java similarity index 91% rename from jaxx-compiler/src/test/java/jaxx/beaninfos/BeanIntoUtilTest.java rename to jaxx-compiler/src/test/java/jaxx/compiler/beans/BeanIntoUtilTest.java index 057f278..d52a48e 100644 --- a/jaxx-compiler/src/test/java/jaxx/beaninfos/BeanIntoUtilTest.java +++ b/jaxx-compiler/src/test/java/jaxx/compiler/beans/BeanIntoUtilTest.java @@ -1,4 +1,4 @@ -package jaxx.beaninfos; +package jaxx.compiler.beans; import org.junit.Assert; import org.junit.Test; @@ -13,7 +13,7 @@ public class BeanIntoUtilTest { BeanInfoUtil.reset(); String[] searchPath0 = Introspector.getBeanInfoSearchPath(); - BeanInfoUtil.addJaxxBeanInfoPath("jaxx.beaninfos"); + BeanInfoUtil.addJaxxBeanInfoPath("jaxx.runtime.swing"); String[] searchPath = Introspector.getBeanInfoSearchPath(); Assert.assertEquals(searchPath0.length + 1, searchPath.length); diff --git a/jaxx-compiler/src/test/java/jaxx/junit/ClassDescriptorTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/reflect/ClassDescriptorTest.java similarity index 85% rename from jaxx-compiler/src/test/java/jaxx/junit/ClassDescriptorTest.java rename to jaxx-compiler/src/test/java/jaxx/compiler/reflect/ClassDescriptorTest.java index e3b3b92..02bc606 100644 --- a/jaxx-compiler/src/test/java/jaxx/junit/ClassDescriptorTest.java +++ b/jaxx-compiler/src/test/java/jaxx/compiler/reflect/ClassDescriptorTest.java @@ -1,8 +1,5 @@ -package jaxx.junit; +package jaxx.compiler.reflect; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.reflect.MethodDescriptor; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.junit.Test; @@ -11,9 +8,8 @@ public class ClassDescriptorTest { /*@Test public void testGetClassDescriptor() throws Exception { - ClassDescriptorLoader.getClassDescriptor("jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode"); + ClassDescriptorLoader.getClassDescriptor("jaxx.runtime.swing.navigation.NavigationTreeModel.NavigationTreeNode"); }*/ - @Test public void testBuiltInClassName() throws ClassNotFoundException, NoSuchMethodException { ClassDescriptor object = ClassDescriptorLoader.getClassDescriptor("java.lang.Object"); @@ -36,7 +32,7 @@ public class ClassDescriptorTest { @Test public void testUserClassName() throws ClassNotFoundException, NoSuchMethodException { - ClassDescriptor me = ClassDescriptorLoader.getClassDescriptor("jaxx.junit.ClassDescriptorTest", getClass().getClassLoader()); + ClassDescriptor me = ClassDescriptorLoader.getClassDescriptor(ClassDescriptorTest.class.getName(), getClass().getClassLoader()); MethodDescriptor testUserClassName = me.getMethodDescriptor("testUserClassName"); assertEquals(testUserClassName.getName(), "testUserClassName"); assertEquals(testUserClassName.getParameterTypes().length, 0); @@ -60,4 +56,4 @@ public class ClassDescriptorTest { ClassDescriptor objectArray = ClassDescriptorLoader.getClassDescriptor(Object[].class); assertNotNull(objectArray); } -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/test/java/jaxx/junit/TagManagerTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/tags/TagManagerTest.java similarity index 88% rename from jaxx-compiler/src/test/java/jaxx/junit/TagManagerTest.java rename to jaxx-compiler/src/test/java/jaxx/compiler/tags/TagManagerTest.java index 0055cb6..f5b3818 100644 --- a/jaxx-compiler/src/test/java/jaxx/junit/TagManagerTest.java +++ b/jaxx-compiler/src/test/java/jaxx/compiler/tags/TagManagerTest.java @@ -1,14 +1,9 @@ -package jaxx.junit; +package jaxx.compiler.tags; import jaxx.compiler.JAXXCompiler; import jaxx.compiler.JAXXCompilerLaunchor; -import jaxx.compiler.SwingCompiler; -import jaxx.reflect.ClassDescriptor; -import jaxx.reflect.ClassDescriptorLoader; -import jaxx.tags.DefaultComponentHandler; -import jaxx.tags.DefaultObjectHandler; -import jaxx.tags.TagHandler; -import jaxx.tags.TagManager; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; @@ -26,6 +21,7 @@ public class TagManagerTest { protected JAXXCompiler compiler; public static class TestHandler extends DefaultObjectHandler { + public TestHandler(ClassDescriptor beanClass) { super(beanClass); } @@ -41,7 +37,8 @@ public class TagManagerTest { @Before public void setUp() { JAXXCompilerLaunchor.newLaunchor(); - compiler = new SwingCompiler(SwingCompiler.class.getClassLoader()); + compiler = JAXXCompilerLaunchor.createDummyCompiler(JAXXCompiler.class.getClassLoader()); +// compiler = new JAXXCompiler(JAXXCompiler.class.getClassLoader()); compiler.addImport("javax.swing.*"); } @@ -137,9 +134,5 @@ public class TagManagerTest { public void testAliasing() { Assert.assertEquals("ButtonGroup is not aliased to jaxx.runtime.swing.JAXXButtonGroup", "jaxx.runtime.swing.JAXXButtonGroup", TagManager.resolveClassName("ButtonGroup", compiler)); Assert.assertEquals("javax.swing.ButtonGroup is not aliased to jaxx.runtime.swing.JAXXButtonGroup", "jaxx.runtime.swing.JAXXButtonGroup", TagManager.resolveClassName("javax.swing.ButtonGroup", compiler)); -// Assert.assertEquals("JComboBox is not aliased to jaxx.runtime.swing.JAXXComboBox", "jaxx.runtime.swing.JAXXComboBox", TagManager.resolveClassName("JComboBox", compiler)); -// Assert.assertEquals("javax.swing.JComboBox is not aliased to jaxx.runtime.swing.JAXXComboBox", "jaxx.runtime.swing.JAXXComboBox", TagManager.resolveClassName("javax.swing.JComboBox", compiler)); } - - -} \ No newline at end of file +} diff --git a/jaxx-compiler/src/test/java/jaxx/junit/ColorConverterTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/types/ColorConverterTest.java similarity index 91% rename from jaxx-compiler/src/test/java/jaxx/junit/ColorConverterTest.java rename to jaxx-compiler/src/test/java/jaxx/compiler/types/ColorConverterTest.java index 0c1010e..d879c76 100644 --- a/jaxx-compiler/src/test/java/jaxx/junit/ColorConverterTest.java +++ b/jaxx-compiler/src/test/java/jaxx/compiler/types/ColorConverterTest.java @@ -1,6 +1,6 @@ -package jaxx.junit; +package jaxx.compiler.types; -import jaxx.types.ColorConverter; +import jaxx.compiler.types.ColorConverter; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/jaxx-compiler/src/test/java/jaxx/junit/InsetsConverterTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/types/InsetsConverterTest.java similarity index 91% rename from jaxx-compiler/src/test/java/jaxx/junit/InsetsConverterTest.java rename to jaxx-compiler/src/test/java/jaxx/compiler/types/InsetsConverterTest.java index 3ea4c5d..9df9691 100644 --- a/jaxx-compiler/src/test/java/jaxx/junit/InsetsConverterTest.java +++ b/jaxx-compiler/src/test/java/jaxx/compiler/types/InsetsConverterTest.java @@ -1,6 +1,6 @@ -package jaxx.junit; +package jaxx.compiler.types; -import jaxx.types.InsetsConverter; +import jaxx.compiler.types.InsetsConverter; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/jaxx-compiler/src/test/java/jaxx/junit/PrimitiveConverterTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/types/PrimitiveConverterTest.java similarity index 94% rename from jaxx-compiler/src/test/java/jaxx/junit/PrimitiveConverterTest.java rename to jaxx-compiler/src/test/java/jaxx/compiler/types/PrimitiveConverterTest.java index 843e03a..3b343a8 100644 --- a/jaxx-compiler/src/test/java/jaxx/junit/PrimitiveConverterTest.java +++ b/jaxx-compiler/src/test/java/jaxx/compiler/types/PrimitiveConverterTest.java @@ -1,6 +1,6 @@ -package jaxx.junit; +package jaxx.compiler.types; -import jaxx.types.PrimitiveConverter; +import jaxx.compiler.types.PrimitiveConverter; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java b/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java index 2450bce..0d0e527 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java @@ -20,29 +20,36 @@ */ package jaxx.demo; -import java.util.Stack; -import javax.swing.JPanel; +import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.context.JAXXContextEntryDef; +import jaxx.runtime.JAXXObject; +import jaxx.runtime.swing.CardLayout2; +import jaxx.runtime.swing.ErrorDialogUI; + +import jaxx.runtime.swing.navigation.NavigationTreeHelper; +import jaxx.runtime.swing.navigation.NavigationTreeHandlerWithCardLayout; +import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder; +import jaxx.runtime.swing.navigation.NavigationTreeModel; +import jaxx.runtime.swing.navigation.NavigationTreeNode; +import jaxx.runtime.swing.navigation.NavigationTreeHandler; +import jaxx.runtime.swing.navigation.NavigationTreeHandler.Strategy; + import jaxx.demo.component.swing.*; import jaxx.demo.component.jaxx.*; import jaxx.demo.component.jaxx.editor.*; import jaxx.demo.component.jaxx.navigation.item.ItemTreeNavigationDemo; -import jaxx.demo.component.jaxx.tree.FullNavigationTreeDemo; +import jaxx.demo.component.jaxx.navigation.FullNavigationTreeDemo; import jaxx.demo.feature.databinding.BeanDataBindingDemo; import jaxx.demo.feature.validation.*; import jaxx.demo.fun.*; import static org.nuiton.i18n.I18n.n_; - -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXContextEntryDef; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.swing.CardLayout2; -import jaxx.runtime.swing.ErrorDialogUI; -import jaxx.runtime.swing.tree.*; -import jaxx.runtime.swing.tree.NavigationTreeHandler.Strategy; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import java.util.Stack; +import javax.swing.JPanel; + /** * * @author chemit diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx index b2a6111..ef5fd8a 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx @@ -29,7 +29,7 @@ <script><![CDATA[ import jaxx.runtime.SwingUtil; -import jaxx.runtime.swing.tree.*; +import jaxx.runtime.swing.navigation.*; import java.util.Locale; public DemoConfig getConfig() { diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java b/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java index d57e290..3f695ac 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java @@ -21,9 +21,9 @@ package jaxx.demo; import jaxx.runtime.swing.ErrorDialogUI; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXInitialContext; -import jaxx.runtime.swing.tree.NavigationTreeNode; +import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.context.JAXXInitialContext; +import jaxx.runtime.swing.navigation.NavigationTreeNode; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import static org.nuiton.i18n.I18n._; @@ -33,8 +33,8 @@ import java.awt.Desktop; import java.net.URL; import java.util.Locale; import javax.swing.SwingUtilities; -import jaxx.runtime.DefaultApplicationContext; -import jaxx.runtime.JAXXContextEntryDef; +import jaxx.runtime.context.DefaultApplicationContext; +import jaxx.runtime.context.JAXXContextEntryDef; import jaxx.runtime.swing.AboutPanel; import jaxx.runtime.swing.editor.config.ConfigUI; import jaxx.runtime.swing.editor.config.ConfigUIBuilder; diff --git a/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java b/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java index 5ed6ea1..3a969f7 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java +++ b/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java @@ -20,7 +20,7 @@ */ package jaxx.demo; -import jaxx.runtime.DefaultApplicationContext; +import jaxx.runtime.context.DefaultApplicationContext; import jaxx.runtime.swing.ErrorDialogUI; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx index a3b706e..42ab1d1 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx @@ -18,49 +18,69 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> - -<jaxx.demo.DemoPanel> - <script><![CDATA[ -//localeEditor.loadI18nBundles(); -]]> - </script> - <Table id='demoPanel' fill='both'> - <row> - <cell> - <JLabel text='Empty I18n editor:' labelFor='{localeEmptyEditor}'/> - </cell> - <cell> - <jaxx.runtime.swing.editor.I18nEditor id='localeEmptyEditor' /> - </cell> - </row> - <row> - <cell> - <JLabel text='I18n editor:' labelFor='{localeEditor}'/> - </cell> - <cell> - <jaxx.runtime.swing.editor.I18nEditor id='localeEditor' - locales='{java.util.Arrays.asList(org.nuiton.i18n.I18n.getLoader().getLocales())}'/> - </cell> - </row> - <row> - <cell> - <JLabel text='I18n editor with no text :' labelFor='{localeWithNoTextEditor}'/> - </cell> - <cell> - <jaxx.runtime.swing.editor.I18nEditor id='localeWithNoTextEditor' - locales='{java.util.Arrays.asList(org.nuiton.i18n.I18n.getLoader().getLocales())}' - showText='false'/> - </cell> - </row> - <row> - <cell> - <JLabel text='I18n editor with no icon :' labelFor='{localeWithNoIconEditor}'/> - </cell> - <cell> - <jaxx.runtime.swing.editor.I18nEditor id='localeWithNoIconEditor' - locales='{java.util.Arrays.asList(org.nuiton.i18n.I18n.getLoader().getLocales())}' - showIcon='false'/> - </cell> - </row> - </Table> + +<jaxx.demo.DemoPanel> + <script><![CDATA[ +import jaxx.runtime.swing.editor.I18nEditor; +import org.nuiton.i18n.I18n; +import java.util.Arrays; + +protected Border getPopupBorder(String text) { + if (text==null || text.trim().isEmpty()) { + return null; + } + return new TitledBorder(_(text)); +} +]]> + </script> + <Table id='demoPanel' fill='both'> + <row> + <cell> + <JPanel border='{new TitledBorder(_("jaxxdemo.i18neditor.configuration"))}' + layout='{new GridLayout(0,1)}'> + + <JCheckBox id='showText' + text='jaxxdemo.i18neditor.showText' + selected='true'/> + + <JCheckBox id='showIcon' + text='jaxxdemo.i18neditor.showIcon' + selected='true'/> + + <JCheckBox id='showPopupText' + text='jaxxdemo.i18neditor.showPopupText' + selected='true'/> + + <JCheckBox id='showPopupIcon' + text='jaxxdemo.i18neditor.showPopupIcon' + selected='true'/> + + <JPanel> + <JLabel text='jaxxdemo.i18neditor.popupBorderText' + labelFor='{popupBorderText}'/> + <JTextField id='popupBorderText' + text='{_("i18neditor.popup.title")}'/> + </JPanel> + + </JPanel> + </cell> + </row> + <row> + <cell> + <I18nEditor id='editor' + showText='{showText.isSelected()}' + showIcon='{showIcon.isSelected()}' + showPopupText='{showPopupText.isSelected()}' + showPopupIcon='{showPopupIcon.isSelected()}' + popupBorder='{getPopupBorder(popupBorderText.getText())}' + locales='{Arrays.asList(I18n.getLoader().getLocales())}'/> + </cell> + </row> + <row> + <cell> + <JLabel border='{new TitledBorder(_("jaxxdemo.i18neditor.selected.locale"))}' + text='{editor.getSelectedLocale()}'/> + </cell> + </row> + </Table> </jaxx.demo.DemoPanel> \ No newline at end of file diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemo.jaxx index 3357a6c..1c52244 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemo.jaxx @@ -18,135 +18,165 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> - -<jaxx.demo.DemoPanel> - <script><![CDATA[ -import jaxx.runtime.swing.editor.NumberEditor; - -void $afterCompleteSetup() { - positifIntegerEditor.init(); - positifIntegerEditor2.init(); - normalIntegerEditor.init(); - normalIntegerEditor2.init(); - positifFloatEditor.init(); - positifFloatEditor2.init(); - normalFloatEditor.init(); - normalFloatEditor2.init(); -} -]]> - </script> - - <!-- model --> - <NumberEditorDemoModel id='demoModel'/> - - <Table id='demoPanel' insets='0' fill='both'> - <row> - <cell weightx='0.5'> - <JLabel horizontalAlignment='center' text='numbereditor.type'/> - </cell> - <cell weightx='0.25'> - <JLabel horizontalAlignment='center' text='numbereditor.without.auto.popup'/> - </cell> - <cell weightx='0.25'> - <JLabel horizontalAlignment='center' text='numbereditor.with.auto.popup'/> - </cell> - </row> - <row> - <cell> - <JLabel text='{_("numbereditor.positive.int", demoModel.getPositifInteger())}'/> - </cell> - <cell> - <NumberEditor id='positifIntegerEditor' - property='positifInteger' - constructorParams='this' - bean='{demoModel}' - autoPopup='false' - showPopupButton='true' - showReset='true'/> - </cell> - <cell> - <NumberEditor id='positifIntegerEditor2' - property='positifInteger' - constructorParams='this' - bean='{demoModel}' - autoPopup='true' - showPopupButton='true' - showReset='true'/> - </cell> - </row> - <row> - <cell> - <JLabel text='{_("numbereditor.normal.int", demoModel.getNormalInteger())}'/> - </cell> - <cell> - <NumberEditor id='normalIntegerEditor' - property='normalInteger' - constructorParams='this' - bean='{demoModel}' - autoPopup='false' - showPopupButton='true' - showReset='true' - useSign='true'/> - </cell> - <cell> - <NumberEditor id='normalIntegerEditor2' - property='normalInteger' - constructorParams='this' - bean='{demoModel}' - autoPopup='true' - showPopupButton='true' - showReset='true' - useSign='true'/> - </cell> - </row> - <row> - <cell> - <JLabel text='{_("numbereditor.positive.float", demoModel.getPositifFloat())}'/> - </cell> - <cell> - <NumberEditor id='positifFloatEditor' - property='positifFloat' - constructorParams='this' - bean='{demoModel}' - autoPopup='false' - showPopupButton='true' - showReset='true'/> - </cell> - <cell> - <NumberEditor id='positifFloatEditor2' - property='positifFloat' - constructorParams='this' - bean='{demoModel}' - autoPopup='true' - showPopupButton='true' - showReset='true'/> - </cell> - </row> - <row> - <cell> - <JLabel text='{_("numbereditor.normal.float", demoModel.getNormalFloat())}'/> - </cell> - <cell> - <NumberEditor id='normalFloatEditor' - property='normalFloat' - constructorParams='this' - bean='{demoModel}' - autoPopup='false' - showPopupButton='true' - showReset='true' - useSign='true'/> - </cell> - <cell> - <NumberEditor id='normalFloatEditor2' - property='normalFloat' - constructorParams='this' - bean='{demoModel}' - autoPopup='true' - showPopupButton='true' - showReset='true' - useSign='true'/> - </cell> - </row> - </Table> - -</jaxx.demo.DemoPanel> + +<jaxx.demo.DemoPanel> + <script><![CDATA[ +import jaxx.runtime.swing.editor.NumberEditor; + +void $afterCompleteSetup() { + editor.init(); +} +]]> + </script> + + <!-- model --> + <NumberEditorDemoModel id='demoModel'/> + + <Table id='demoPanel' insets='0' fill='both'> + <row> + <cell> + <JPanel border='{new TitledBorder(_("jaxxdemo.numbereditor.configuration"))}' + layout='{new GridLayout(0,1)}'> + + <JCheckBox id='useFloat' + text='jaxxdemo.numbereditor.useFloat' + selected='true'/> + + <JCheckBox id='useSign' + text='jaxxdemo.numbereditor.useSign' + selected='true'/> + + <JCheckBox id='showPopupButton' + text='jaxxdemo.numbereditor.showPopupButton' + selected='true'/> + + <JCheckBox id='showResetButton' + text='jaxxdemo.numbereditor.showReset' + selected='true'/> + + <JCheckBox id='autoPopup' + text='jaxxdemo.numbereditor.autoPopup' + selected='false'/> + + </JPanel> + </cell> + </row> + <row> + <cell> + <NumberEditor id='editor' + constructorParams='this' + bean='{demoModel}' + property='{useFloat.isSelected() ? "floatProperty" : "integerProperty"}' + useFloat='{useFloat.isSelected()}' + useSign='{useSign.isSelected()}' + autoPopup='{autoPopup.isSelected()}' + showPopupButton='{showPopupButton.isSelected()}' + showReset='{showResetButton.isSelected()}' /> + </cell> + </row> + <row> + <cell> + <JPanel border='{new TitledBorder(_("jaxxdemo.numbereditor.model"))}' + layout='{new GridLayout(0,1)}'> + <JLabel text='{_("jaxxdemo.numbereditor.model.int", demoModel.getIntegerProperty())}'/> + <JLabel text='{_("jaxxdemo.numbereditor.model.float", demoModel.getFloatProperty())}'/> + + </JPanel> + </cell> + </row> + </Table> +</jaxx.demo.DemoPanel> + <!--row> + <cell> + <NumberEditor id='positifIntegerEditor' + property='positifInteger' + constructorParams='this' + bean='{demoModel}' + autoPopup='false' + showPopupButton='true' + showReset='true'/> + </cell> + <cell> + <NumberEditor id='positifIntegerEditor2' + property='positifInteger' + constructorParams='this' + bean='{demoModel}' + autoPopup='true' + showPopupButton='true' + showReset='true'/> + </cell> + </row> + <row> + <cell> + <JLabel text='{_("numbereditor.normal.int", demoModel.getNormalInteger())}'/> + </cell> + <cell> + <NumberEditor id='normalIntegerEditor' + property='normalInteger' + constructorParams='this' + bean='{demoModel}' + autoPopup='false' + showPopupButton='true' + showReset='true' + useSign='true'/> + </cell> + <cell> + <NumberEditor id='normalIntegerEditor2' + property='normalInteger' + constructorParams='this' + bean='{demoModel}' + autoPopup='true' + showPopupButton='true' + showReset='true' + useSign='true'/> + </cell> + </row> + <row> + <cell> + <JLabel text='{_("numbereditor.positive.float", demoModel.getPositifFloat())}'/> + </cell> + <cell> + <NumberEditor id='positifFloatEditor' + property='positifFloat' + constructorParams='this' + bean='{demoModel}' + autoPopup='false' + showPopupButton='true' + showReset='true'/> + </cell> + <cell> + <NumberEditor id='positifFloatEditor2' + property='positifFloat' + constructorParams='this' + bean='{demoModel}' + autoPopup='true' + showPopupButton='true' + showReset='true'/> + </cell> + </row> + <row> + <cell> + <JLabel text='{_("numbereditor.normal.float", demoModel.getNormalFloat())}'/> + </cell> + <cell> + <NumberEditor id='normalFloatEditor' + property='normalFloat' + constructorParams='this' + bean='{demoModel}' + autoPopup='false' + showPopupButton='true' + showReset='true' + useSign='true'/> + </cell> + <cell> + <NumberEditor id='normalFloatEditor2' + property='normalFloat' + constructorParams='this' + bean='{demoModel}' + autoPopup='true' + showPopupButton='true' + showReset='true' + useSign='true'/> + </cell> + </row--> + diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemoModel.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemoModel.java index efd22f3..85fb9ea 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemoModel.java +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemoModel.java @@ -30,56 +30,80 @@ import java.beans.PropertyChangeSupport; */ public class NumberEditorDemoModel { + public static final String INTEGER_PROPERTY = "integerProperty"; + public static final String FLOAT_PROPERTY = "floatProperty"; protected PropertyChangeSupport p; - protected int positifInteger; - protected int normalInteger; - protected float positifFloat; - protected float normalFloat; + protected int integerProperty; + protected float floatProperty; +// protected int positifInteger; +// protected int normalInteger; +// protected float positifFloat; +// protected float normalFloat; public NumberEditorDemoModel() { p = new PropertyChangeSupport(this); } - public float getNormalFloat() { - return normalFloat; + public float getFloatProperty() { + return floatProperty; } - public int getNormalInteger() { - return normalInteger; + public int getIntegerProperty() { + return integerProperty; } - public float getPositifFloat() { - return positifFloat; + public void setFloatProperty(float floatProperty) { + float old = this.floatProperty; + this.floatProperty = floatProperty; + p.firePropertyChange(FLOAT_PROPERTY, old, floatProperty); } - public int getPositifInteger() { - return positifInteger; - } - - public void setNormalFloat(float normalFloat) { - float old = this.normalFloat; - this.normalFloat = normalFloat; - p.firePropertyChange("normalFloat", old, normalFloat); - } - - public void setNormalInteger(int normalInteger) { - int old = this.normalInteger; - this.normalInteger = normalInteger; - p.firePropertyChange("normalInteger", old, normalInteger); - } - - public void setPositifFloat(float positifFloat) { - float old = this.positifFloat; - this.positifFloat = positifFloat; - p.firePropertyChange("positifFloat", old, positifFloat); - } - - public void setPositifInteger(int positifInteger) { - int old = this.positifInteger; - this.positifInteger = positifInteger; - p.firePropertyChange("positifInteger", old, positifInteger); + public void setIntegerProperty(int integerProperty) { + int old = this.integerProperty; + this.integerProperty = integerProperty; + p.firePropertyChange(INTEGER_PROPERTY, old, integerProperty); } +// +// public float getNormalFloat() { +// return normalFloat; +// } +// +// public int getNormalInteger() { +// return normalInteger; +// } +// +// public float getPositifFloat() { +// return positifFloat; +// } +// +// public int getPositifInteger() { +// return positifInteger; +// } +// +// public void setNormalFloat(float normalFloat) { +// float old = this.normalFloat; +// this.normalFloat = normalFloat; +// p.firePropertyChange("normalFloat", old, normalFloat); +// } +// +// public void setNormalInteger(int normalInteger) { +// int old = this.normalInteger; +// this.normalInteger = normalInteger; +// p.firePropertyChange("normalInteger", old, normalInteger); +// } +// +// public void setPositifFloat(float positifFloat) { +// float old = this.positifFloat; +// this.positifFloat = positifFloat; +// p.firePropertyChange("positifFloat", old, positifFloat); +// } +// +// public void setPositifInteger(int positifInteger) { +// int old = this.positifInteger; +// this.positifInteger = positifInteger; +// p.firePropertyChange("positifInteger", old, positifInteger); +// } public void addPropertyChangeListener(PropertyChangeListener listener) { p.addPropertyChangeListener(listener); } diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/BaseContent.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/BaseContent.jaxx similarity index 100% rename from jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/BaseContent.jaxx rename to jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/BaseContent.jaxx diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/FullNavigationTreeDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx similarity index 100% rename from jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/FullNavigationTreeDemo.jaxx rename to jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/FullNavigationTreeHelper.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java similarity index 92% rename from jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/FullNavigationTreeHelper.java rename to jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java index 7bb9bf1..e917cc5 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/FullNavigationTreeHelper.java +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java @@ -18,34 +18,32 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -package jaxx.demo.component.jaxx.tree; +package jaxx.demo.component.jaxx.navigation; -import java.util.Arrays; - -import static jaxx.runtime.JAXXContextEntryDef.newListDef; -import static org.nuiton.i18n.I18n._; - -import java.util.List; -import jaxx.runtime.decorator.Decorator; -import jaxx.runtime.JAXXContext; - - -import javax.swing.JPanel; -import jaxx.runtime.JAXXContextEntryDef; import jaxx.runtime.JAXXObject; +import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.context.JAXXContextEntryDef; +import static jaxx.runtime.context.JAXXContextEntryDef.newListDef; +import jaxx.runtime.decorator.Decorator; import jaxx.runtime.decorator.DecoratorUtils; import jaxx.runtime.swing.CardLayout2; import jaxx.runtime.swing.ErrorDialogUI; -import jaxx.runtime.swing.tree.NavigationTreeHandler; -import jaxx.runtime.swing.tree.NavigationTreeHandler.Strategy; -import jaxx.runtime.swing.tree.NavigationTreeHandlerWithCardLayout; -import jaxx.runtime.swing.tree.NavigationTreeHelper; -import jaxx.runtime.swing.tree.NavigationTreeModelBuilder; -import jaxx.runtime.swing.tree.NavigationTreeNode; -import jaxx.runtime.swing.tree.NavigationTreeModel; +import jaxx.runtime.swing.navigation.NavigationTreeHandler; +import jaxx.runtime.swing.navigation.NavigationTreeHandler.Strategy; +import jaxx.runtime.swing.navigation.NavigationTreeHandlerWithCardLayout; +import jaxx.runtime.swing.navigation.NavigationTreeHelper; +import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder; +import jaxx.runtime.swing.navigation.NavigationTreeNode; +import jaxx.runtime.swing.navigation.NavigationTreeModel; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import static org.nuiton.i18n.I18n._; + +import java.util.Arrays; +import java.util.List; +import javax.swing.JPanel; + /** * * @author chemit diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/Movie.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/Movie.java similarity index 98% rename from jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/Movie.java rename to jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/Movie.java index 406ed63..22e335a 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/Movie.java +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/Movie.java @@ -18,7 +18,7 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -package jaxx.demo.component.jaxx.tree; +package jaxx.demo.component.jaxx.navigation; import java.util.ArrayList; import java.util.List; diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/People.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/People.java similarity index 98% rename from jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/People.java rename to jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/People.java index b92ad9f..c98f297 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/tree/People.java +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/People.java @@ -18,7 +18,7 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -package jaxx.demo.component.jaxx.tree; +package jaxx.demo.component.jaxx.navigation; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; diff --git a/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties b/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties index 8d66355..2aa6120 100644 --- a/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties +++ b/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties @@ -106,12 +106,14 @@ close3=Disable 3 edit=Edit edit2=Edit 2 edit3=Edit 3 +editor.getSelectedLocale()= form.ratio=Ratio form.text=Text form.text2=Text 2 form2.ratio=Form 2 Ratio form2.text=Form 2 Text form2.text2=Form 2 Text 2 +i18neditor.popup.title= jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>For more informations, viste the <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-demo">website of the project</a>. jaxxdemo.action.about=About... jaxxdemo.action.about.tip=About JAXXDemo... @@ -138,6 +140,13 @@ jaxxdemo.config.category.other.description=Others preferences jaxxdemo.config.configFileName.description=Configuration file name jaxxdemo.config.ui.fullscreen=To change the screen mode (true for full screen) jaxxdemo.config.ui.locale=Locale of the application +jaxxdemo.i18neditor.configuration=Configuration +jaxxdemo.i18neditor.popupBorderText=Popup title +jaxxdemo.i18neditor.selected.locale=Selected Language +jaxxdemo.i18neditor.showIcon=Show icons +jaxxdemo.i18neditor.showPopupIcon=Show icons in popup +jaxxdemo.i18neditor.showPopupText=Show texts in popup +jaxxdemo.i18neditor.showText=Show text jaxxdemo.init.closed=JAXXDemo was closed at %1$s jaxxdemo.init.context.done=Context initialized in %1$s jaxxdemo.init.ui.done=UI initialized. @@ -146,6 +155,15 @@ jaxxdemo.menu.file.locale=Languages jaxxdemo.menu.help= jaxxdemo.message.config.loaded=Configuration of JAXXDemo v. %1$s loaded. jaxxdemo.message.goto.site=Go to JAXXDemo Web site +jaxxdemo.numbereditor.autoPopup= +jaxxdemo.numbereditor.configuration= +jaxxdemo.numbereditor.model= +jaxxdemo.numbereditor.model.float= +jaxxdemo.numbereditor.model.int= +jaxxdemo.numbereditor.showPopupButton= +jaxxdemo.numbereditor.showReset= +jaxxdemo.numbereditor.useFloat= +jaxxdemo.numbereditor.useSign= jaxxdemo.title.about=About JAXXDemo... jaxxdemo.tree.component.jaxx=JAXX Components jaxxdemo.tree.component.jaxx.editor=Editors diff --git a/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties b/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties index 033f0fe..ffe9202 100644 --- a/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties +++ b/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties @@ -106,12 +106,14 @@ close3=Fermer 3 edit=Editer edit2=Editer 2 edit3=Editer 3 +editor.getSelectedLocale()= form.ratio=Form \: ratio form.text=Form \: text form.text2=Form \: text2 form2.ratio=Form2 \: ratio form2.text=Form2 \: text form2.text2=Form2 \: text2 +i18neditor.popup.title= jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>Pour plus d'informations, vous pouvez visiter le <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-demo">site du projet</a>. jaxxdemo.action.about=A propos jaxxdemo.action.about.tip=A propos de JAXX Demo... @@ -138,6 +140,13 @@ jaxxdemo.config.category.other.description=Autres options jaxxdemo.config.configFileName.description=Le nom du fichier de configuration jaxxdemo.config.ui.fullscreen=Pour afficher l'aplication en mode pleine \u00E9cran jaxxdemo.config.ui.locale=Langue utilis\u00E9e par l'application (fr_FR, en_GB ou es_ES) +jaxxdemo.i18neditor.configuration=Configuration +jaxxdemo.i18neditor.popupBorderText=Titre de la popup +jaxxdemo.i18neditor.selected.locale=Langue s\u00E9lectionn\u00E9e +jaxxdemo.i18neditor.showIcon=Afficher les icones +jaxxdemo.i18neditor.showPopupIcon=Afficher les icones dans la popup +jaxxdemo.i18neditor.showPopupText=Afficher les textes dans la popup +jaxxdemo.i18neditor.showText=Afficher le text jaxxdemo.init.closed=JAXX Demo a \u00E9t\u00E9 ferm\u00E9 \u00E0 %1$s jaxxdemo.init.context.done=Initialisation du contexte termin\u00E9e en %1$s. jaxxdemo.init.ui.done=Initialisation de l'interface graphique termin\u00E9e. @@ -146,6 +155,15 @@ jaxxdemo.menu.file.locale=Langues jaxxdemo.menu.help=Aide jaxxdemo.message.config.loaded=Configuration de JAXX Demo v. %1$s charg\u00E9e. jaxxdemo.message.goto.site=Acc\u00E9der au site de JAXX Demo (%1$s) +jaxxdemo.numbereditor.autoPopup=Affichage automatique popup +jaxxdemo.numbereditor.configuration=Configuration +jaxxdemo.numbereditor.model=R\u00E9sultat +jaxxdemo.numbereditor.model.float=Valeur d\u00E9cimale \: %1$s +jaxxdemo.numbereditor.model.int=Valeur enti\u00E8re \: %1$s +jaxxdemo.numbereditor.showPopupButton=Afficher le boutton de popup +jaxxdemo.numbereditor.showReset=Afficher le boutton de reset +jaxxdemo.numbereditor.useFloat=Utiliser les d\u00E9cimales +jaxxdemo.numbereditor.useSign=Utiliser le signe jaxxdemo.title.about=A propos de JAXX Demo... jaxxdemo.tree.component.jaxx=Composants JAXX jaxxdemo.tree.component.jaxx.editor=Editeurs diff --git a/jaxx-demo/src/main/resources/log4j.properties b/jaxx-demo/src/main/resources/log4j.properties index d0a87ec..1044d5c 100644 --- a/jaxx-demo/src/main/resources/log4j.properties +++ b/jaxx-demo/src/main/resources/log4j.properties @@ -6,7 +6,8 @@ log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n log4j.logger.jaxx.demo=INFO -#log4j.logger.jaxx.runtime.swing.tree.NavigationTreeCellRenderer=DEBUG -#log4j.logger.jaxx.runtime.swing.tree.NavigationTreeNodeRenderer=DEBUG -#log4j.logger.jaxx.runtime.swing.tree.NavigationTreeModel=DEBUG +log4j.logger.jaxx.runtime.swing.editor.I18nEditor=INFO +#log4j.logger.jaxx.runtime.swing.navigation.NavigationTreeCellRenderer=DEBUG +#log4j.logger.jaxx.runtime.swing.navigation.NavigationTreeNodeRenderer=DEBUG +#log4j.logger.jaxx.runtime.swing.navigation.NavigationTreeModel=DEBUG log4j.logger.org.nuiton=WARN diff --git a/jaxx-runtime/src/main/java/jaxx/Base64Coder.java b/jaxx-runtime/src/main/java/jaxx/runtime/Base64Coder.java similarity index 99% rename from jaxx-runtime/src/main/java/jaxx/Base64Coder.java rename to jaxx-runtime/src/main/java/jaxx/runtime/Base64Coder.java index 1d9d0f8..654826b 100644 --- a/jaxx-runtime/src/main/java/jaxx/Base64Coder.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/Base64Coder.java @@ -1,4 +1,4 @@ -package jaxx; +package jaxx.runtime; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/DataBindingListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/DataBindingListener.java index d5694ae..da4c600 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/DataBindingListener.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/DataBindingListener.java @@ -34,6 +34,7 @@ public class DataBindingListener implements PropertyChangeListener { * * @param e the event which triggered the binding */ + @Override public void propertyChange(PropertyChangeEvent e) { object.processDataBinding(dest); diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/DataBindingUpdateListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/DataBindingUpdateListener.java index f220ecc..030dd4c 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/DataBindingUpdateListener.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/DataBindingUpdateListener.java @@ -39,6 +39,7 @@ public class DataBindingUpdateListener implements PropertyChangeListener { * * @param e the event which triggered the binding */ + @Override public void propertyChange(PropertyChangeEvent e) { object.removeDataBinding(dest); object.applyDataBinding(dest); diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXAction.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXAction.java index 647e41f..deadbbe 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXAction.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXAction.java @@ -1,5 +1,8 @@ package jaxx.runtime; +import jaxx.runtime.context.JAXXInitialContext; +import jaxx.runtime.context.JAXXContext; + /** * This is the contract to be realized by any class to be used as Action class for an ui. * @@ -12,7 +15,7 @@ public interface JAXXAction { * * @param parentContent the context of the parent of the ui (can be null if no parent is required) * @param datas other datas to inject in initial context - * @return the {@link jaxx.runtime.JAXXInitialContext} to be injected in the ui via the constructor of the {@link jaxx.runtime.JAXXObject} + * @return the {@link jaxx.runtime.context.JAXXInitialContext} to be injected in the ui via the constructor of the {@link jaxx.runtime.JAXXObject} */ JAXXInitialContext init(JAXXContext parentContent, Object... datas); diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java index 1e40966..5ca926f 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java @@ -4,29 +4,41 @@ */ package jaxx.runtime; -/** The <code>JAXXObject</code> interface is implemented by all classes produced by the JAXX compiler. */ +import java.util.Map; +import jaxx.runtime.context.JAXXContext; + +/** + * The <code>JAXXObject</code> interface is implemented by all classes + * produced by the JAXX compiler. + */ public interface JAXXObject extends JAXXContext { + /** * Retrieves an object defined in an XML tag by its ID. * * @param id the id of the component to retrieve * @return the object */ - public Object getObjectById(String id); + Object getObjectById(String id); /** * Pretrieves the dictonary of knwon objects indexed by their ids. * * @return the dictonary of objects. */ - public java.util.Map<String, Object> get$objectMap(); - - public void applyDataBinding(String id); + Map<String, Object> get$objectMap(); + /** + * + * @return the {@link JAXXContext} attached to the object + */ + JAXXContext getDelegateContext(); - public void removeDataBinding(String id); - - public jaxx.runtime.JAXXContext getDelegateContext(); + /** + * Apply the data bind by name and then process it. + * @param id the id of the databinding + */ + void applyDataBinding(String id); /** * Processes a data binding by name. Data binding names are comprised of an object ID and a property name: @@ -36,8 +48,14 @@ public interface JAXXObject extends JAXXContext { * * @param dest the name of the data binding to run */ - public void processDataBinding(String dest); + void processDataBinding(String dest); + /** + * Remove a databinding by name. + * + * @param id the name of databinding to remove + */ + void removeDataBinding(String id); /** * All <code>JAXXObject</code> implements are capable of broadcasting <code>PropertyChangeEvent</code>, and @@ -48,5 +66,5 @@ public interface JAXXObject extends JAXXContext { * @param oldValue the old value of the property * @param newValue the new value of the property */ - public void firePropertyChange(String name, Object oldValue, Object newValue); -} \ No newline at end of file + void firePropertyChange(String name, Object oldValue, Object newValue); +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java index 31d513f..9315365 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java @@ -4,7 +4,7 @@ */ package jaxx.runtime; -import jaxx.css.Stylesheet; +import jaxx.runtime.css.Stylesheet; import java.io.Serializable; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java b/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java index 13ab770..327c517 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java @@ -1,6 +1,5 @@ package jaxx.runtime; -import jaxx.runtime.*; import java.awt.Color; import java.awt.Component; import java.awt.Container; @@ -169,6 +168,8 @@ public class SwingUtil extends Util { } /** + * TODO move this to JAXXComboBox. + * * Fill a combo box model with some datas, and select after all the given object * * @param combo the combo to fill diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/Util.java b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java index 7f39843..9b3f505 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/Util.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java @@ -1,6 +1,7 @@ package jaxx.runtime; -import jaxx.Base64Coder; +import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.context.JAXXContextEntryDef; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -84,6 +85,21 @@ public class Util { } } + /** + * Method to initialize the context of a ui. + * + * @param ui the ui + * @param parentContext the context to set in ui + */ + public static void initContext(JAXXObject ui, JAXXContext parentContext) { + + if (parentContext instanceof jaxx.runtime.context.JAXXInitialContext) { + ((jaxx.runtime.context.JAXXInitialContext) parentContext).to(ui); + } else { + ui.setContextValue(parentContext); + } + } + public static Object getEventListener(Class<? extends EventListener> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) { WeakReference<List<EventListenerDescriptor>> ref = eventListeners.get(methodContainer); List<EventListenerDescriptor> descriptors = ref != null ? ref.get() : null; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/DataContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java similarity index 99% rename from jaxx-runtime/src/main/java/jaxx/runtime/DataContext.java rename to jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java index 9fbfeb1..483927c 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/DataContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java @@ -1,5 +1,6 @@ -package jaxx.runtime; +package jaxx.runtime.context; +import jaxx.runtime.*; import java.awt.Container; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/DefaultApplicationContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultApplicationContext.java similarity index 99% rename from jaxx-runtime/src/main/java/jaxx/runtime/DefaultApplicationContext.java rename to jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultApplicationContext.java index 036be21..d4c2d18 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/DefaultApplicationContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultApplicationContext.java @@ -1,5 +1,6 @@ -package jaxx.runtime; +package jaxx.runtime.context; +import jaxx.runtime.*; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.lang.annotation.*; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/DefaultJAXXContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java similarity index 98% rename from jaxx-runtime/src/main/java/jaxx/runtime/DefaultJAXXContext.java rename to jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java index bf7112d..bcc1a73 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/DefaultJAXXContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java @@ -1,6 +1,7 @@ -package jaxx.runtime; +package jaxx.runtime.context; -import static jaxx.runtime.JAXXContextEntryDef.newDef; +import jaxx.runtime.*; +import static jaxx.runtime.context.JAXXContextEntryDef.newDef; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContext.java similarity index 96% rename from jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java rename to jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContext.java index 85db035..e8fdfb8 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContext.java @@ -1,9 +1,9 @@ -package jaxx.runtime; +package jaxx.runtime.context; import java.awt.Container; /** - * The {@link jaxx.runtime.JAXXContext} contract defines a generic context. + * The {@link jaxx.runtime.context.JAXXContext} contract defines a generic context. * <p/> * A context contains two king of entries : * <p/> diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContextEntryDef.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContextEntryDef.java similarity index 99% rename from jaxx-runtime/src/main/java/jaxx/runtime/JAXXContextEntryDef.java rename to jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContextEntryDef.java index cf7c897..0e9db03 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContextEntryDef.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContextEntryDef.java @@ -1,4 +1,4 @@ -package jaxx.runtime; +package jaxx.runtime.context; import java.util.Collections; import java.util.List; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXInitialContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXInitialContext.java similarity index 97% rename from jaxx-runtime/src/main/java/jaxx/runtime/JAXXInitialContext.java rename to jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXInitialContext.java index d68b052..a932a2f 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXInitialContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXInitialContext.java @@ -1,4 +1,4 @@ -package jaxx.runtime; +package jaxx.runtime.context; import java.awt.Container; import java.util.Map.Entry; @@ -47,7 +47,7 @@ public class JAXXInitialContext extends DefaultJAXXContext { } /** - * Register a named value in the context. + * Register a named (or not) value in the context. * * @param <O> type of data to add * @param def definition of entry diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/css/DataBinding.java b/jaxx-runtime/src/main/java/jaxx/runtime/css/DataBinding.java index 2d5ed61..0bd5fa1 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/css/DataBinding.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/css/DataBinding.java @@ -9,6 +9,7 @@ package jaxx.runtime.css; * track of which data bindings are in effect. */ public class DataBinding { + private String id; public DataBinding(String id) { @@ -28,4 +29,4 @@ public class DataBinding { public int hashCode() { return id.hashCode(); } -} \ No newline at end of file +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/css/Pseudoclasses.java b/jaxx-runtime/src/main/java/jaxx/runtime/css/Pseudoclasses.java index cab9819..f87316c 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/css/Pseudoclasses.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/css/Pseudoclasses.java @@ -10,12 +10,12 @@ import java.util.Map; import java.util.WeakHashMap; public class Pseudoclasses { - public static final String NO_PSEUDOCLASS = "no pseudoclass"; + public static final String NO_PSEUDOCLASS = "no pseudoclass"; private static Map<Object, Map<String, List<PropertyValue>>> properties = new WeakHashMap<Object, Map<String, List<PropertyValue>>>(); - private static class PropertyValue implements Comparable<PropertyValue> { + private Object value; private int id; @@ -32,6 +32,7 @@ public class Pseudoclasses { return id; } + @Override public int compareTo(PropertyValue o) { return getId() - o.getId(); } @@ -41,14 +42,14 @@ public class Pseudoclasses { if (!(o instanceof PropertyValue)) { return false; } - PropertyValue value = (PropertyValue) o; - if (value.getId() != getId()) { + PropertyValue that = (PropertyValue) o; + if (that.getId() != getId()) { return false; } - if (value.getValue() == null) { + if (that.getValue() == null) { return getValue() == null; } - return value.getValue().equals(getValue()); + return that.getValue().equals(getValue()); } @Override @@ -118,8 +119,9 @@ public class Pseudoclasses { parent.applyDataBinding(((DataBinding) value).getId()); } return value; - } else + } else { return currentValue; + } } public static Object removeProperty(JAXXObject parent, Object object, String property, Object oldValue, Object currentValue, int id) { @@ -134,8 +136,9 @@ public class Pseudoclasses { propertyRemoved(object, property, wrap(oldValue), id); value = getCurrentValue(object, property); return value; - } else + } else { return currentValue; + } } public static Object wrap(boolean value) { @@ -173,4 +176,4 @@ public class Pseudoclasses { public static Object wrap(Object value) { return value; } -} \ No newline at end of file +} diff --git a/jaxx-runtime/src/main/java/jaxx/css/Rule.java b/jaxx-runtime/src/main/java/jaxx/runtime/css/Rule.java similarity index 95% rename from jaxx-runtime/src/main/java/jaxx/css/Rule.java rename to jaxx-runtime/src/main/java/jaxx/runtime/css/Rule.java index 230b93a..138f5bd 100644 --- a/jaxx-runtime/src/main/java/jaxx/css/Rule.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/css/Rule.java @@ -2,26 +2,24 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.css; +package jaxx.runtime.css; import java.util.Map; public class Rule implements java.io.Serializable, Comparable<Rule> { + public static final String INLINE_ATTRIBUTE = "<inline attribute>"; public static final String DATA_BINDING = "<data binding>"; - private Selector[] selectors; private Map<String, String> properties; private static final long serialVersionUID = 1L; - public Rule(Selector[] selectors, Map<String, String> properties) { this.selectors = selectors; java.util.Arrays.sort(selectors); this.properties = properties; } - public Rule(Selector[] selectors, String[] keys, String[] values) { this.selectors = selectors; java.util.Arrays.sort(selectors); @@ -51,4 +49,4 @@ public class Rule implements java.io.Serializable, Comparable<Rule> { public String toString() { return "Rule[" + java.util.Arrays.asList(selectors) + ", " + properties + "]"; } -} \ No newline at end of file +} diff --git a/jaxx-runtime/src/main/java/jaxx/css/Selector.java b/jaxx-runtime/src/main/java/jaxx/runtime/css/Selector.java similarity index 95% rename from jaxx-runtime/src/main/java/jaxx/css/Selector.java rename to jaxx-runtime/src/main/java/jaxx/runtime/css/Selector.java index b00235b..ccf82ff 100644 --- a/jaxx-runtime/src/main/java/jaxx/css/Selector.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/css/Selector.java @@ -2,15 +2,15 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.css; +package jaxx.runtime.css; public class Selector implements java.io.Serializable, Comparable<Selector> { + public static final int NEVER_APPLIES = 0; public static final int PSEUDOCLASS_APPLIES_INHERIT_ONLY = 1; public static final int PSEUDOCLASS_APPLIES = 2; public static final int ALWAYS_APPLIES_INHERIT_ONLY = 3; public static final int ALWAYS_APPLIES = 4; - private String javaClassName; private String styleClass; private String pseudoClass; @@ -18,12 +18,10 @@ public class Selector implements java.io.Serializable, Comparable<Selector> { private boolean inline; private static final long serialVersionUID = 1L; - public Selector(String javaClassName, String styleClass, String pseudoClass, String id) { this(javaClassName, styleClass, pseudoClass, id, false); } - public Selector(String javaClassName, String styleClass, String pseudoClass, String id, boolean inline) { this.javaClassName = javaClassName; this.styleClass = styleClass; @@ -32,27 +30,22 @@ public class Selector implements java.io.Serializable, Comparable<Selector> { this.inline = inline; } - public String getJavaClassName() { return javaClassName; } - public String getStyleClass() { return styleClass; } - public String getPseudoClass() { return pseudoClass; } - public String getId() { return id; } - public boolean isInline() { return inline; } @@ -96,4 +89,4 @@ public class Selector implements java.io.Serializable, Comparable<Selector> { public String toString() { return "Selector[" + javaClassName + ", " + styleClass + ", " + pseudoClass + ", " + id + "]"; } -} \ No newline at end of file +} diff --git a/jaxx-runtime/src/main/java/jaxx/css/Stylesheet.java b/jaxx-runtime/src/main/java/jaxx/runtime/css/Stylesheet.java similarity index 94% rename from jaxx-runtime/src/main/java/jaxx/css/Stylesheet.java rename to jaxx-runtime/src/main/java/jaxx/runtime/css/Stylesheet.java index 8d8f930..ae68c0a 100644 --- a/jaxx-runtime/src/main/java/jaxx/css/Stylesheet.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/css/Stylesheet.java @@ -2,13 +2,13 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.css; +package jaxx.runtime.css; public class Stylesheet implements java.io.Serializable { + private Rule[] rules; private static final long serialVersionUID = 1L; - public Stylesheet() { rules = new Rule[0]; } @@ -42,4 +42,4 @@ public class Stylesheet implements java.io.Serializable { public String toString() { return "Stylesheet" + java.util.Arrays.asList(rules); } -} \ No newline at end of file +} diff --git a/jaxx-runtime/src/main/java/jaxx/beaninfos/HBoxBeanInfo.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/HBoxBeanInfo.java similarity index 67% rename from jaxx-runtime/src/main/java/jaxx/beaninfos/HBoxBeanInfo.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/HBoxBeanInfo.java index c114688..8423d7d 100644 --- a/jaxx-runtime/src/main/java/jaxx/beaninfos/HBoxBeanInfo.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/HBoxBeanInfo.java @@ -2,9 +2,7 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.beaninfos; - -import jaxx.runtime.swing.HBox; +package jaxx.runtime.swing; import javax.swing.JPanel; import javax.swing.SwingConstants; @@ -15,16 +13,17 @@ import java.beans.PropertyDescriptor; import java.beans.SimpleBeanInfo; public class HBoxBeanInfo extends SimpleBeanInfo { + + @Override public BeanInfo[] getAdditionalBeanInfo() { try { return new BeanInfo[]{Introspector.getBeanInfo(JPanel.class)}; - } - catch (IntrospectionException e) { + } catch (IntrospectionException e) { throw new RuntimeException(e); } } - + @Override public PropertyDescriptor[] getPropertyDescriptors() { try { PropertyDescriptor spacing = new PropertyDescriptor("spacing", HBox.class); @@ -36,22 +35,21 @@ public class HBoxBeanInfo extends SimpleBeanInfo { PropertyDescriptor horizontalAlignment = new PropertyDescriptor("horizontalAlignment", HBox.class); horizontalAlignment.setBound(true); horizontalAlignment.setValue("enumerationValues", new Object[]{ - "left", SwingConstants.LEFT, "SwingConstants.LEFT", - "center", SwingConstants.CENTER, "SwingConstants.CENTER", - "right", SwingConstants.RIGHT, "SwingConstants.RIGHT" - }); + "left", SwingConstants.LEFT, "SwingConstants.LEFT", + "center", SwingConstants.CENTER, "SwingConstants.CENTER", + "right", SwingConstants.RIGHT, "SwingConstants.RIGHT" + }); PropertyDescriptor verticalAlignment = new PropertyDescriptor("verticalAlignment", HBox.class); verticalAlignment.setBound(true); verticalAlignment.setValue("enumerationValues", new Object[]{ - "top", SwingConstants.TOP, "SwingConstants.TOP", - "middle", SwingConstants.CENTER, "SwingConstants.CENTER", - "bottom", SwingConstants.BOTTOM, "SwingConstants.BOTTOM" - }); + "top", SwingConstants.TOP, "SwingConstants.TOP", + "middle", SwingConstants.CENTER, "SwingConstants.CENTER", + "bottom", SwingConstants.BOTTOM, "SwingConstants.BOTTOM" + }); return new PropertyDescriptor[]{spacing, margin, horizontalAlignment, verticalAlignment}; - } - catch (IntrospectionException e) { + } catch (IntrospectionException e) { throw new RuntimeException(e); } } diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java index 59635f7..efab228 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java @@ -19,7 +19,7 @@ import javax.help.HelpSet; import javax.swing.AbstractButton; import javax.swing.SwingUtilities; import javax.swing.UIManager; -import jaxx.runtime.JAXXContext; +import jaxx.runtime.context.JAXXContext; import jaxx.runtime.JAXXObject; import jaxx.runtime.SwingUtil; import org.apache.commons.logging.Log; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/LocaleListCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/LocaleListCellRenderer.java index 5365420..18537f9 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/LocaleListCellRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/LocaleListCellRenderer.java @@ -20,7 +20,7 @@ public class LocaleListCellRenderer extends DefaultListCellRenderer { public static final Log log = LogFactory.getLog(LocaleListCellRenderer.class); private static final long serialVersionUID = 1L; - protected Map<Locale, Icon> cache = new HashMap<Locale, Icon>(); + protected final Map<Locale, Icon> cache = new HashMap<Locale, Icon>(); protected boolean showIcon; protected boolean showText; @@ -51,11 +51,21 @@ public class LocaleListCellRenderer extends DefaultListCellRenderer { public String getText(Locale locale) { String text = null; if (showText) { - text = locale.getDisplayName(Locale.getDefault()); + text = getSafeText(locale); } return text; } + public Icon getIcon(Locale locale) { + if (!showIcon) { + return null; + } + synchronized (cache) { + Icon icon = getSafeIcon(locale); + return icon; + } + } + public String getToolTipText(Locale locale) { String tip = locale.getDisplayName(Locale.getDefault()); return tip; @@ -81,10 +91,12 @@ public class LocaleListCellRenderer extends DefaultListCellRenderer { firePropertyChange("showText", old, showText); } - public synchronized Icon getIcon(Locale locale) { - if (!showIcon) { - return null; - } + public String getSafeText(Locale locale) { + String text = locale.getDisplayName(Locale.getDefault()); + return text; + } + + public synchronized Icon getSafeIcon(Locale locale) { Icon icon = cache.get(locale); if (icon != null) { return icon; diff --git a/jaxx-runtime/src/main/java/jaxx/beaninfos/VBoxBeanInfo.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/VBoxBeanInfo.java similarity index 67% rename from jaxx-runtime/src/main/java/jaxx/beaninfos/VBoxBeanInfo.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/VBoxBeanInfo.java index 419e063..3534309 100644 --- a/jaxx-runtime/src/main/java/jaxx/beaninfos/VBoxBeanInfo.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/VBoxBeanInfo.java @@ -2,9 +2,7 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.beaninfos; - -import jaxx.runtime.swing.VBox; +package jaxx.runtime.swing; import javax.swing.JPanel; import javax.swing.SwingConstants; @@ -15,16 +13,17 @@ import java.beans.PropertyDescriptor; import java.beans.SimpleBeanInfo; public class VBoxBeanInfo extends SimpleBeanInfo { + + @Override public BeanInfo[] getAdditionalBeanInfo() { try { return new BeanInfo[]{Introspector.getBeanInfo(JPanel.class)}; - } - catch (IntrospectionException e) { + } catch (IntrospectionException e) { throw new RuntimeException(e); } } - + @Override public PropertyDescriptor[] getPropertyDescriptors() { try { PropertyDescriptor spacing = new PropertyDescriptor("spacing", VBox.class); @@ -36,22 +35,21 @@ public class VBoxBeanInfo extends SimpleBeanInfo { PropertyDescriptor horizontalAlignment = new PropertyDescriptor("horizontalAlignment", VBox.class); horizontalAlignment.setBound(true); horizontalAlignment.setValue("enumerationValues", new Object[]{ - "left", SwingConstants.LEFT, "SwingConstants.LEFT", - "center", SwingConstants.CENTER, "SwingConstants.CENTER", - "right", SwingConstants.RIGHT, "SwingConstants.RIGHT" - }); + "left", SwingConstants.LEFT, "SwingConstants.LEFT", + "center", SwingConstants.CENTER, "SwingConstants.CENTER", + "right", SwingConstants.RIGHT, "SwingConstants.RIGHT" + }); PropertyDescriptor verticalAlignment = new PropertyDescriptor("verticalAlignment", VBox.class); verticalAlignment.setBound(true); verticalAlignment.setValue("enumerationValues", new Object[]{ - "top", SwingConstants.TOP, "SwingConstants.TOP", - "middle", SwingConstants.CENTER, "SwingConstants.CENTER", - "bottom", SwingConstants.BOTTOM, "SwingConstants.BOTTOM" - }); + "top", SwingConstants.TOP, "SwingConstants.TOP", + "middle", SwingConstants.CENTER, "SwingConstants.CENTER", + "bottom", SwingConstants.BOTTOM, "SwingConstants.BOTTOM" + }); return new PropertyDescriptor[]{spacing, margin, horizontalAlignment, verticalAlignment}; - } - catch (IntrospectionException e) { + } catch (IntrospectionException e) { throw new RuntimeException(e); } } diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeContextHelper.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java similarity index 97% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeContextHelper.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java index 4ab55b1..f87b58d 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeContextHelper.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java @@ -1,8 +1,8 @@ -package jaxx.runtime.swing.tree; +package jaxx.runtime.swing.navigation; import javax.swing.JTree; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXContextEntryDef; +import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.context.JAXXContextEntryDef; /** * To help getting and setting navigation tree objects from a {@link JAXXContext}. diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeHandler.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java similarity index 98% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeHandler.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java index 5d7e099..1b12ebe 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeHandler.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java @@ -1,4 +1,4 @@ -package jaxx.runtime.swing.tree; +package jaxx.runtime.swing.navigation; import java.awt.Component; import javax.swing.event.TreeSelectionEvent; @@ -6,8 +6,8 @@ import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultTreeSelectionModel; import javax.swing.tree.TreePath; import jaxx.runtime.JAXXAction; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXInitialContext; +import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.context.JAXXInitialContext; import jaxx.runtime.JAXXObject; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeHandlerWithCardLayout.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java similarity index 97% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeHandlerWithCardLayout.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java index 60f01c0..ae94155 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeHandlerWithCardLayout.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java @@ -1,6 +1,6 @@ -package jaxx.runtime.swing.tree; +package jaxx.runtime.swing.navigation; -import jaxx.runtime.JAXXContext; +import jaxx.runtime.context.JAXXContext; import jaxx.runtime.JAXXObject; import jaxx.runtime.swing.CardLayout2; import org.apache.commons.logging.Log; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeHelper.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java similarity index 98% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeHelper.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java index aa30fac..6e73d79 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeHelper.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java @@ -1,10 +1,10 @@ -package jaxx.runtime.swing.tree; +package jaxx.runtime.swing.navigation; import java.lang.reflect.InvocationTargetException; import java.util.regex.Pattern; import javax.swing.JTree; import javax.swing.tree.TreePath; -import jaxx.runtime.JAXXContext; +import jaxx.runtime.context.JAXXContext; import jaxx.runtime.JAXXObject; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java similarity index 99% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeModel.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java index 3094bec..182a1c8 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeModel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java @@ -1,6 +1,6 @@ -package jaxx.runtime.swing.tree; +package jaxx.runtime.swing.navigation; -import jaxx.runtime.JAXXContext; +import jaxx.runtime.context.JAXXContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeModelBuilder.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java similarity index 98% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeModelBuilder.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java index 1a79faa..7b5c1bd 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeModelBuilder.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java @@ -1,9 +1,9 @@ -package jaxx.runtime.swing.tree; +package jaxx.runtime.swing.navigation; import java.util.Enumeration; import jaxx.runtime.JAXXAction; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXContextEntryDef; +import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.context.JAXXContextEntryDef; import jaxx.runtime.JAXXObject; import jaxx.runtime.decorator.Decorator; import org.apache.commons.logging.Log; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNode.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNode.java similarity index 99% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNode.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNode.java index bc440fb..b2d7c97 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNode.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNode.java @@ -1,11 +1,11 @@ -package jaxx.runtime.swing.tree; +package jaxx.runtime.swing.navigation; import java.util.Enumeration; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreeNode; import jaxx.runtime.JAXXAction; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXContextEntryDef; +import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.context.JAXXContextEntryDef; import jaxx.runtime.JAXXObject; import org.apache.commons.jxpath.JXPathContext; import org.apache.commons.logging.Log; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNodeRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRenderer.java similarity index 96% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNodeRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRenderer.java index 1c8a2eb..310db18 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNodeRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRenderer.java @@ -1,4 +1,4 @@ -package jaxx.runtime.swing.tree; +package jaxx.runtime.swing.navigation; import javax.swing.tree.TreeCellRenderer; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNodeRendererDecoratorImpl.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRendererDecoratorImpl.java similarity index 96% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNodeRendererDecoratorImpl.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRendererDecoratorImpl.java index bb3cd20..11904d3 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNodeRendererDecoratorImpl.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRendererDecoratorImpl.java @@ -1,4 +1,4 @@ -package jaxx.runtime.swing.tree; +package jaxx.runtime.swing.navigation; import jaxx.runtime.decorator.Decorator; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNodeRendererI18nImpl.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRendererI18nImpl.java similarity index 96% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNodeRendererI18nImpl.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRendererI18nImpl.java index f9dc94b..8c39baf 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/NavigationTreeNodeRendererI18nImpl.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRendererI18nImpl.java @@ -1,4 +1,4 @@ -package jaxx.runtime.swing.tree; +package jaxx.runtime.swing.navigation; import static org.nuiton.i18n.I18n._; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/package.html b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/package.html similarity index 100% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/tree/package.html rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/package.html diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java index 52d26e7..c7c3c3b 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java @@ -1,7 +1,7 @@ package jaxx.runtime.swing.wizard; import javax.swing.SwingWorker; -import jaxx.runtime.JAXXContext; +import jaxx.runtime.context.JAXXContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java index eada87e..92e7e26 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java @@ -4,7 +4,7 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.Date; import javax.swing.SwingWorker.StateValue; -import jaxx.runtime.JAXXContext; +import jaxx.runtime.context.JAXXContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java index aaba288..a140d1f 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java @@ -2,8 +2,8 @@ package jaxx.runtime.swing.wizard; import java.awt.Window; import javax.swing.ImageIcon; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXInitialContext; +import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.context.JAXXInitialContext; import jaxx.runtime.JAXXObject; import org.apache.commons.beanutils.ConstructorUtils; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/DefaultApplicationContextTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultApplicationContextTest.java similarity index 92% rename from jaxx-runtime/src/test/java/jaxx/runtime/DefaultApplicationContextTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultApplicationContextTest.java index f5deedc..d3908f2 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/DefaultApplicationContextTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultApplicationContextTest.java @@ -1,11 +1,7 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package jaxx.runtime; +package jaxx.runtime.context; -import jaxx.runtime.DefaultApplicationContext.AutoLoad; -import jaxx.runtime.DefaultApplicationContext.MethodAccess; +import jaxx.runtime.context.DefaultApplicationContext.AutoLoad; +import jaxx.runtime.context.DefaultApplicationContext.MethodAccess; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; @@ -114,4 +110,4 @@ public class DefaultApplicationContextTest { context.getContextValue(Hello.class); assertEquals(2, helloCount); } -} \ No newline at end of file +} diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/DefaultJAXXContextTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultJAXXContextTest.java similarity index 99% rename from jaxx-runtime/src/test/java/jaxx/runtime/DefaultJAXXContextTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultJAXXContextTest.java index 96fc62f..70dae65 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/DefaultJAXXContextTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultJAXXContextTest.java @@ -1,5 +1,6 @@ -package jaxx.runtime; +package jaxx.runtime.context; +import jaxx.runtime.*; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/swing/tree/NavigationTreeModelTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java similarity index 97% rename from jaxx-runtime/src/test/java/jaxx/runtime/swing/tree/NavigationTreeModelTest.java rename to jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java index 6398c2e..9699cf2 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/swing/tree/NavigationTreeModelTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java @@ -1,8 +1,11 @@ -package jaxx.runtime.swing.tree; - -import jaxx.runtime.DefaultJAXXContext; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXContextEntryDef; +package jaxx.runtime.swing.navigation; + +import jaxx.runtime.swing.navigation.NavigationTreeNode; +import jaxx.runtime.swing.navigation.NavigationTreeModel; +import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder; +import jaxx.runtime.context.DefaultJAXXContext; +import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.context.JAXXContextEntryDef; import org.junit.Assert; import org.junit.Test; @@ -82,7 +85,7 @@ public class NavigationTreeModelTest { } /** - * Test the {@link NavigationTreeModel#getJAXXContextValue(jaxx.runtime.JAXXContext, String)} with an entry point + * Test the {@link NavigationTreeModel#getJAXXContextValue(jaxx.runtime.context.JAXXContext, String)} with an entry point * as a bean. * <p/> * Tree is like this @@ -202,7 +205,7 @@ public class NavigationTreeModelTest { } /** - * Test the {@link NavigationTreeModel#getJAXXContextValue(jaxx.runtime.JAXXContext, String)} with an entry point + * Test the {@link NavigationTreeModel#getJAXXContextValue(jaxx.runtime.context.JAXXContext, String)} with an entry point * as a list. * <p/> * Tree is like this diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx index ceccd33..78d4d4d 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx @@ -30,19 +30,26 @@ <String id='selectedToolTipText' javaBean='null'/> <String id='notSelectedToolTipText' javaBean='null'/> + <Border id='popupBorder' javaBean='new TitledBorder(_("i18neditor.popup.title"))'/> + <Boolean id='showText' javaBean='Boolean.TRUE'/> <Boolean id='showIcon' javaBean='Boolean.TRUE'/> + <Boolean id='showPopupText' javaBean='Boolean.TRUE'/> + <Boolean id='showPopupIcon' javaBean='Boolean.TRUE'/> <Boolean id='popupVisible' javaBean='Boolean.FALSE'/> <java.util.List id='locales' javaBean='null' genericType='Locale'/> <Locale id='selectedLocale' javaBean='Locale.getDefault()'/> - <jaxx.runtime.swing.LocaleListCellRenderer id='renderer' javaBean='new LocaleListCellRenderer(showIcon , showText)' showIcon='{isShowIcon()}' showText='{isShowText()}'/> + <jaxx.runtime.swing.LocaleListCellRenderer id='renderer' + showIcon='{isShowIcon()}' + showText='{isShowText()}' + javaBean='new LocaleListCellRenderer(showIcon , showText)'/> <!-- popup to change sorted property--> <JPopupMenu id='popup' - border='{new TitledBorder(_("i18neditor.popup.title"))}' + border='{getPopupBorder()}' onPopupMenuWillBecomeInvisible='button.setSelected(false)' onPopupMenuCanceled='button.setSelected(false)'> <JLabel id='popupLabel' enabled='false' text='i18neditor.empty.locales'/> @@ -74,6 +81,9 @@ public static final String LOCALES_PROPERTY = "locales"; public static final String SELECTED_LOCALE_PROPERTY = "selectedLocale"; public static final String SHOW_ICON_PROPERTY = "showIcon"; public static final String SHOW_TEXT_PROPERTY = "showText"; +public static final String SHOW_POPUP_ICON_PROPERTY = "showPopupIcon"; +public static final String SHOW_POPUP_TEXT_PROPERTY = "showPopupText"; +public static final String POPUP_BORDER_PROPERTY = "popupBorder"; public static final String POPUP_VISIBLE_PROPERTY = "popupVisible"; @Override @@ -82,9 +92,8 @@ public void propertyChange(PropertyChangeEvent evt) { if (log.isDebugEnabled()) { log.debug(name+" <old:"+evt.getOldValue()+" - new:"+evt.getNewValue()+">"); } - log.info(name+" <old:"+evt.getOldValue()+" - new:"+evt.getNewValue()+">"); + log.info(name + " <old:"+evt.getOldValue()+" - new:"+evt.getNewValue()+">"); if (LOCALES_PROPERTY.equals(name)) { - Locale oldLocale = getSelectedLocale(); java.util.Collection<?> newLocales = (java.util.Collection<?>) evt.getNewValue(); // mise a jour de la popup boolean oldShowText = renderer.isShowText(); @@ -94,8 +103,8 @@ public void propertyChange(PropertyChangeEvent evt) { for (Object o : newLocales) { Locale l = (Locale) o; boolean selected = l.equals(selectedLocale); - String text = renderer.getText(l); - Icon icon = renderer.getIcon(l); + String text = isShowPopupText() ? renderer.getText(l) : null; + Icon icon = isShowPopupIcon() ? renderer.getIcon(l) : null; JRadioButtonMenuItem b = new JRadioButtonMenuItem(text, icon, selected); popup.add(b); b.addActionListener(this); @@ -120,6 +129,18 @@ public void propertyChange(PropertyChangeEvent evt) { processDataBinding("button.text"); return; } + if (SHOW_POPUP_ICON_PROPERTY.equals(name)) { + rebuildPopup(); + return; + } + if (SHOW_POPUP_TEXT_PROPERTY.equals(name)) { + rebuildPopup(); + return; + } + if (POPUP_BORDER_PROPERTY.equals(name)) { + popup.setBorder((Border)evt.getNewValue()); + return; + } if (POPUP_VISIBLE_PROPERTY.equals(name)) { Boolean newValue = (Boolean) evt.getNewValue(); if (newValue == null || !newValue) { @@ -165,6 +186,26 @@ public void loadI18nBundles() { setLocales(java.util.Arrays.asList(org.nuiton.i18n.I18n.getLoader().getLocales())); } +protected void rebuildPopup() { + log.debug("start rebuild"); + try { + for (Component c : popup.getComponents()) { + if (c instanceof JRadioButtonMenuItem) { + JRadioButtonMenuItem b = (JRadioButtonMenuItem) c; + Locale l = (Locale) b.getClientProperty("locale"); + String text = isShowPopupText() ? renderer.getSafeText(l) : null; + Icon icon = isShowPopupIcon() ? renderer.getSafeIcon(l) : null; + b.setIcon(icon); + b.setText(text); + log.debug("text=" + text); + log.debug("icon=" + icon); + } + } + } finally { + popup.invalidate(); + } +} + protected String getTip(Locale l) { boolean selected = l.equals(selectedLocale); String tip = selected ? getSelectedTip(l):getNotSelectedTip(l); @@ -197,9 +238,10 @@ protected Runnable showPopupRunnable = new Runnable() { @Override public void run() { getPopup().pack(); - Dimension dim = getPopup().getPreferredSize(); JToggleButton invoker = getButton(); - getPopup().show(invoker, (int) (invoker.getPreferredSize().getWidth() - dim.getWidth()), invoker.getHeight()); + Dimension dim = getPopup().getPreferredSize(); + Dimension invokerDim = invoker.getSize(); + getPopup().show(invoker, (int) (invokerDim.getWidth() - dim.getWidth()), invoker.getHeight()); // getPopup().setVisible(true); } }; diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java index 043356b..a5a84e7 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java @@ -32,8 +32,8 @@ import javax.swing.JDialog; import javax.swing.JOptionPane; import javax.swing.JRootPane; import javax.swing.KeyStroke; -import jaxx.runtime.JAXXContext; -import jaxx.runtime.JAXXInitialContext; +import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.context.JAXXInitialContext; import jaxx.runtime.SwingUtil; import jaxx.runtime.swing.editor.config.model.CategoryModel; @@ -59,7 +59,7 @@ public class ConfigUIBuilder { * @param defaultCategory la categorie a selectionner * @return l'ui instanciate */ - public static ConfigUI newConfigUI(jaxx.runtime.JAXXContext parentContext, final ConfigUIModel model, String defaultCategory) { + public static ConfigUI newConfigUI(jaxx.runtime.context.JAXXContext parentContext, final ConfigUIModel model, String defaultCategory) { JAXXContext tx = new JAXXInitialContext().add(parentContext).add(model); final ConfigUI ui = new ConfigUI(tx); diff --git a/jaxx-widgets/src/main/resources/i18n/jaxx-runtime-swing-widget-en_GB.properties b/jaxx-widgets/src/main/resources/i18n/jaxx-runtime-swing-widget-en_GB.properties deleted file mode 100644 index 5430ac8..0000000 --- a/jaxx-widgets/src/main/resources/i18n/jaxx-runtime-swing-widget-en_GB.properties +++ /dev/null @@ -1,70 +0,0 @@ -aboutframe.about=About -aboutframe.license=License -aboutframe.ok=OK -aboutframe.thirdparty=Third party -columnselector.action.tip=Select the columns -config.action.quit=Quit -config.action.quit.tip=Quit the configuration editor -config.action.reset=Cancel -config.action.reset.tip=Cancel the modifications for the category -config.action.save=Save -config.action.save.tip=Save the modifications for the category -config.category.saved=The category '%1$s' was modified \: -config.choice.cancel=Cancel -config.choice.continue=Continue -config.choice.doNotSave=Do not save -config.choice.ok=Ok -config.choice.save=Save -config.defaultValue=Default value -config.defaultValue.tip=Default value of the option -config.descrition=Description -config.error.category.already.exists=category with name '%1$s' does already exist\! -config.error.category.not.found=category with name '%1$s' does not exist\! -config.key=Key -config.key.tip=Key of the option -config.message.quit.invalid.category=The category '%1$s' is not valid\! -config.message.quit.valid.and.modified.category=The category '%1$s' has some modified options \: -config.modified=Option was modified (previous value \: %1$s) -config.no.option.selected=< No selected option > -config.option.final=This option can not be modified -config.option.label=Option '%1$s' (%2$s) -config.option.modified=Value is modified < original value \: '%1$s' - new value \: '%2$s' > -config.title=Preferences -config.title.need.confirm=A confirmation is required -config.title.will.reload.application=The application need to be restarted -config.unmodifiable=Can not be modified -config.unvalid=Option is not valid \! (previous value \: %1$s, required type \: %2$s) -config.value=Value -config.value.tip=Value of the option -entitycombobox.action.reset.tip=Reset the selected value -entitycombobox.action.sort.tip=Change the sorted property -entitycombobox.popup.label=Object '%1$s' -entitycombobox.popup.title=Change the sorted property -entitycombobox.sort.off=Click to activate the sort on this property -entitycombobox.sort.on=This is the property actually used -entitycombobox.unknown.type=Object of unkown type -errorUI.action.close=Close -errorUI.message=An error wad detected... -errorUI.title=Error... -i18neditor.empty.locales=< No locale to select > -i18neditor.popup.title=Change language -i18neditor.selected=Selected language \: %1$s -i18neditor.unselected=Select this langage \: %1$s -memorywidget.memory=%d/%dMb -numbereditor..=. -numbereditor.0=0 -numbereditor.1=1 -numbereditor.2=2 -numbereditor.3=3 -numbereditor.4=4 -numbereditor.5=5 -numbereditor.6=6 -numbereditor.7=7 -numbereditor.8=8 -numbereditor.9=9 -numbereditor.action.reset.tip=Reset -numbereditor.action.show.tip=Show numeric panel -numbereditor.clearAll=C -numbereditor.clearOne=CE -numbereditor.toggleSign=+/- -timeeditor.H=H diff --git a/jaxx-widgets/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties b/jaxx-widgets/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties deleted file mode 100644 index 4cc23a4..0000000 --- a/jaxx-widgets/src/main/resources/i18n/jaxx-runtime-swing-widget-fr_FR.properties +++ /dev/null @@ -1,71 +0,0 @@ -aboutframe.about=\u00C0 propos -aboutframe.license=Licence -aboutframe.ok=OK -aboutframe.thirdparty=Tierce partie -columnselector.action.tip=S\u00E9lectionner les colonnes -config.action.quit=Quitter -config.action.quit.tip=Quitter l'\u00E9diteur de configuration -config.action.reset=Annuler -config.action.reset.tip=Annuler les modifications de cette cat\u00E9gorie -config.action.save=Enregistrer -config.action.save.tip=Sauver les modifications de cette cat\u00E9gorie -config.category.saved=La cat\u00E9gorie '%1$s' a \u00E9t\u00E9 modifi\u00E9e \: -config.choice.cancel=Annuler -config.choice.continue=Continuer -config.choice.doNotSave=Ne pas enregistrer -config.choice.ok=Ok -config.choice.save=Enregistrer -config.defaultValue=Valeur par d\u00E9faut -config.defaultValue.tip=Valeur par d\u00E9faut de l'option -config.descrition=Description -config.error.category.already.exists=La cat\u00E9gorie de nom '%1$s' existe d\u00E9j\u00E0\! -config.error.category.not.found=La cat\u00E9gorie de nom '%1$s' n'existe pas\! -config.key=Clef -config.key.tip=Clef de l'option -config.message.quit.invalid.category=La cat\u00E9gorie '%1$s' n'est pas valide\! -config.message.quit.valid.and.modified.category=La cat\u00E9gorie '%1$s' poss\u00E8dent des options modifi\u00E9es \: -config.modified=Option modifi\u00E9e (valeur originale \: %1$s) -config.no.option.selected=< Pas d'option s\u00E9lectionn\u00E9e > -config.option.final=Option non modifiable -config.option.label=Option '%1$s' (%2$s) -config.option.modified=Valeur modifi\u00E9e < nouvelle valeur \: '%1$s' - ancienne valeur \: '%2$s' > -config.option.valid=Valeur non valide -config.title=Pr\u00E9f\u00E9rences -config.title.need.confirm=Une confirmation de votre part est requise... -config.title.will.reload.application=L'application doit \u00EAtre red\u00E9marrer... -config.unmodifiable=Ne peut pas \u00EAtre modifi\u00E9 -config.unvalid=Option non valide (valeur originale \: %1$s, type requis \: %2$s) -config.value=Valeur -config.value.tip=Valeur de l'option -entitycombobox.action.reset.tip=R\u00E9initialiser la valeur de la liste d\u00E9roulante -entitycombobox.action.sort.tip=Modifier le tri de la liste d\u00E9roulante -entitycombobox.popup.label=Objet '%1$s' -entitycombobox.popup.title=Modifier le tri -entitycombobox.sort.off=Cliquer pour activer le tri sur la propri\u00E9t\u00E9 '%1$s' -entitycombobox.sort.on=Le tri est effectu\u00E9 sur la propri\u00E9t\u00E9 '%1$s' -entitycombobox.unknown.type=Objet de type inconnu -errorUI.action.close=Fermer -errorUI.message=Une erreur est survenue \! -errorUI.title=Erreur... -i18neditor.empty.locales=< Aucune locale \u00E0 s\u00E9lectionner > -i18neditor.popup.title=Changer de langue -i18neditor.selected=Langue actuellement utilis\u00E9e \: %1$s -i18neditor.unselected=Pour utiliser cette langue \: %1$s -memorywidget.memory=%d/%dMo -numbereditor..=. -numbereditor.0=0 -numbereditor.1=1 -numbereditor.2=2 -numbereditor.3=3 -numbereditor.4=4 -numbereditor.5=5 -numbereditor.6=6 -numbereditor.7=7 -numbereditor.8=8 -numbereditor.9=9 -numbereditor.action.reset.tip=R\u00E9initialiser -numbereditor.action.show.tip=Afficher le pav\u00E9 num\u00E9rique -numbereditor.clearAll=C -numbereditor.clearOne=CE -numbereditor.toggleSign=+/- -timeeditor.H=H diff --git a/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties b/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties index 1e65fd0..5430ac8 100644 --- a/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties +++ b/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties @@ -1,70 +1,70 @@ -aboutframe.about= -aboutframe.license= -aboutframe.ok= -aboutframe.thirdparty= -columnselector.action.tip= -config.action.quit= -config.action.quit.tip= -config.action.reset= -config.action.reset.tip= -config.action.save= -config.action.save.tip= -config.category.saved= -config.choice.cancel= -config.choice.continue= -config.choice.doNotSave= -config.choice.ok= -config.choice.save= -config.defaultValue= -config.defaultValue.tip= -config.descrition= -config.error.category.already.exists= -config.error.category.not.found= -config.key= -config.key.tip= -config.message.quit.invalid.category= -config.message.quit.valid.and.modified.category= -config.modified= -config.no.option.selected= -config.option.final= -config.option.label= -config.option.modified= -config.title= -config.title.need.confirm= -config.title.will.reload.application= -config.unmodifiable= -config.unvalid= -config.value= -config.value.tip= -entitycombobox.action.reset.tip= -entitycombobox.action.sort.tip= -entitycombobox.popup.label= -entitycombobox.popup.title= -entitycombobox.sort.off= -entitycombobox.sort.on= -entitycombobox.unknown.type= -errorUI.action.close= -errorUI.message= -errorUI.title= -i18neditor.empty.locales= -i18neditor.popup.title= -i18neditor.selected= -i18neditor.unselected= -memorywidget.memory= -numbereditor..= -numbereditor.0= -numbereditor.1= -numbereditor.2= -numbereditor.3= -numbereditor.4= -numbereditor.5= -numbereditor.6= -numbereditor.7= -numbereditor.8= -numbereditor.9= -numbereditor.action.reset.tip= -numbereditor.action.show.tip= -numbereditor.clearAll= -numbereditor.clearOne= -numbereditor.toggleSign= -timeeditor.H= +aboutframe.about=About +aboutframe.license=License +aboutframe.ok=OK +aboutframe.thirdparty=Third party +columnselector.action.tip=Select the columns +config.action.quit=Quit +config.action.quit.tip=Quit the configuration editor +config.action.reset=Cancel +config.action.reset.tip=Cancel the modifications for the category +config.action.save=Save +config.action.save.tip=Save the modifications for the category +config.category.saved=The category '%1$s' was modified \: +config.choice.cancel=Cancel +config.choice.continue=Continue +config.choice.doNotSave=Do not save +config.choice.ok=Ok +config.choice.save=Save +config.defaultValue=Default value +config.defaultValue.tip=Default value of the option +config.descrition=Description +config.error.category.already.exists=category with name '%1$s' does already exist\! +config.error.category.not.found=category with name '%1$s' does not exist\! +config.key=Key +config.key.tip=Key of the option +config.message.quit.invalid.category=The category '%1$s' is not valid\! +config.message.quit.valid.and.modified.category=The category '%1$s' has some modified options \: +config.modified=Option was modified (previous value \: %1$s) +config.no.option.selected=< No selected option > +config.option.final=This option can not be modified +config.option.label=Option '%1$s' (%2$s) +config.option.modified=Value is modified < original value \: '%1$s' - new value \: '%2$s' > +config.title=Preferences +config.title.need.confirm=A confirmation is required +config.title.will.reload.application=The application need to be restarted +config.unmodifiable=Can not be modified +config.unvalid=Option is not valid \! (previous value \: %1$s, required type \: %2$s) +config.value=Value +config.value.tip=Value of the option +entitycombobox.action.reset.tip=Reset the selected value +entitycombobox.action.sort.tip=Change the sorted property +entitycombobox.popup.label=Object '%1$s' +entitycombobox.popup.title=Change the sorted property +entitycombobox.sort.off=Click to activate the sort on this property +entitycombobox.sort.on=This is the property actually used +entitycombobox.unknown.type=Object of unkown type +errorUI.action.close=Close +errorUI.message=An error wad detected... +errorUI.title=Error... +i18neditor.empty.locales=< No locale to select > +i18neditor.popup.title=Change language +i18neditor.selected=Selected language \: %1$s +i18neditor.unselected=Select this langage \: %1$s +memorywidget.memory=%d/%dMb +numbereditor..=. +numbereditor.0=0 +numbereditor.1=1 +numbereditor.2=2 +numbereditor.3=3 +numbereditor.4=4 +numbereditor.5=5 +numbereditor.6=6 +numbereditor.7=7 +numbereditor.8=8 +numbereditor.9=9 +numbereditor.action.reset.tip=Reset +numbereditor.action.show.tip=Show numeric panel +numbereditor.clearAll=C +numbereditor.clearOne=CE +numbereditor.toggleSign=+/- +timeeditor.H=H diff --git a/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties b/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties index 1e65fd0..4cc23a4 100644 --- a/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties +++ b/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties @@ -1,70 +1,71 @@ -aboutframe.about= -aboutframe.license= -aboutframe.ok= -aboutframe.thirdparty= -columnselector.action.tip= -config.action.quit= -config.action.quit.tip= -config.action.reset= -config.action.reset.tip= -config.action.save= -config.action.save.tip= -config.category.saved= -config.choice.cancel= -config.choice.continue= -config.choice.doNotSave= -config.choice.ok= -config.choice.save= -config.defaultValue= -config.defaultValue.tip= -config.descrition= -config.error.category.already.exists= -config.error.category.not.found= -config.key= -config.key.tip= -config.message.quit.invalid.category= -config.message.quit.valid.and.modified.category= -config.modified= -config.no.option.selected= -config.option.final= -config.option.label= -config.option.modified= -config.title= -config.title.need.confirm= -config.title.will.reload.application= -config.unmodifiable= -config.unvalid= -config.value= -config.value.tip= -entitycombobox.action.reset.tip= -entitycombobox.action.sort.tip= -entitycombobox.popup.label= -entitycombobox.popup.title= -entitycombobox.sort.off= -entitycombobox.sort.on= -entitycombobox.unknown.type= -errorUI.action.close= -errorUI.message= -errorUI.title= -i18neditor.empty.locales= -i18neditor.popup.title= -i18neditor.selected= -i18neditor.unselected= -memorywidget.memory= -numbereditor..= -numbereditor.0= -numbereditor.1= -numbereditor.2= -numbereditor.3= -numbereditor.4= -numbereditor.5= -numbereditor.6= -numbereditor.7= -numbereditor.8= -numbereditor.9= -numbereditor.action.reset.tip= -numbereditor.action.show.tip= -numbereditor.clearAll= -numbereditor.clearOne= -numbereditor.toggleSign= -timeeditor.H= +aboutframe.about=\u00C0 propos +aboutframe.license=Licence +aboutframe.ok=OK +aboutframe.thirdparty=Tierce partie +columnselector.action.tip=S\u00E9lectionner les colonnes +config.action.quit=Quitter +config.action.quit.tip=Quitter l'\u00E9diteur de configuration +config.action.reset=Annuler +config.action.reset.tip=Annuler les modifications de cette cat\u00E9gorie +config.action.save=Enregistrer +config.action.save.tip=Sauver les modifications de cette cat\u00E9gorie +config.category.saved=La cat\u00E9gorie '%1$s' a \u00E9t\u00E9 modifi\u00E9e \: +config.choice.cancel=Annuler +config.choice.continue=Continuer +config.choice.doNotSave=Ne pas enregistrer +config.choice.ok=Ok +config.choice.save=Enregistrer +config.defaultValue=Valeur par d\u00E9faut +config.defaultValue.tip=Valeur par d\u00E9faut de l'option +config.descrition=Description +config.error.category.already.exists=La cat\u00E9gorie de nom '%1$s' existe d\u00E9j\u00E0\! +config.error.category.not.found=La cat\u00E9gorie de nom '%1$s' n'existe pas\! +config.key=Clef +config.key.tip=Clef de l'option +config.message.quit.invalid.category=La cat\u00E9gorie '%1$s' n'est pas valide\! +config.message.quit.valid.and.modified.category=La cat\u00E9gorie '%1$s' poss\u00E8dent des options modifi\u00E9es \: +config.modified=Option modifi\u00E9e (valeur originale \: %1$s) +config.no.option.selected=< Pas d'option s\u00E9lectionn\u00E9e > +config.option.final=Option non modifiable +config.option.label=Option '%1$s' (%2$s) +config.option.modified=Valeur modifi\u00E9e < nouvelle valeur \: '%1$s' - ancienne valeur \: '%2$s' > +config.option.valid=Valeur non valide +config.title=Pr\u00E9f\u00E9rences +config.title.need.confirm=Une confirmation de votre part est requise... +config.title.will.reload.application=L'application doit \u00EAtre red\u00E9marrer... +config.unmodifiable=Ne peut pas \u00EAtre modifi\u00E9 +config.unvalid=Option non valide (valeur originale \: %1$s, type requis \: %2$s) +config.value=Valeur +config.value.tip=Valeur de l'option +entitycombobox.action.reset.tip=R\u00E9initialiser la valeur de la liste d\u00E9roulante +entitycombobox.action.sort.tip=Modifier le tri de la liste d\u00E9roulante +entitycombobox.popup.label=Objet '%1$s' +entitycombobox.popup.title=Modifier le tri +entitycombobox.sort.off=Cliquer pour activer le tri sur la propri\u00E9t\u00E9 '%1$s' +entitycombobox.sort.on=Le tri est effectu\u00E9 sur la propri\u00E9t\u00E9 '%1$s' +entitycombobox.unknown.type=Objet de type inconnu +errorUI.action.close=Fermer +errorUI.message=Une erreur est survenue \! +errorUI.title=Erreur... +i18neditor.empty.locales=< Aucune locale \u00E0 s\u00E9lectionner > +i18neditor.popup.title=Changer de langue +i18neditor.selected=Langue actuellement utilis\u00E9e \: %1$s +i18neditor.unselected=Pour utiliser cette langue \: %1$s +memorywidget.memory=%d/%dMo +numbereditor..=. +numbereditor.0=0 +numbereditor.1=1 +numbereditor.2=2 +numbereditor.3=3 +numbereditor.4=4 +numbereditor.5=5 +numbereditor.6=6 +numbereditor.7=7 +numbereditor.8=8 +numbereditor.9=9 +numbereditor.action.reset.tip=R\u00E9initialiser +numbereditor.action.show.tip=Afficher le pav\u00E9 num\u00E9rique +numbereditor.clearAll=C +numbereditor.clearOne=CE +numbereditor.toggleSign=+/- +timeeditor.H=H diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java index 9669d8b..a53fed0 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java @@ -117,7 +117,9 @@ public abstract class AbstractJaxxMojo extends AbstractPlugin { * @since 1.3 */ protected String helpsetIndexI18nSuffix; - protected boolean skip; + /** + * + */ protected ClassLoader cl; @Override diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java index 7bfd8aa..2b2578f 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java @@ -18,35 +18,39 @@ *##%*/ package org.nuiton.jaxx.plugin; -import jaxx.beaninfos.BeanInfoUtil; -import jaxx.compiler.CompilerOptions; +import jaxx.compiler.CompilerConfiguration; import jaxx.compiler.JAXXCompiler; import jaxx.compiler.JAXXCompilerLaunchor; -import jaxx.runtime.JAXXContext; -import jaxx.tags.TagManager; +import jaxx.compiler.beans.BeanInfoUtil; +import jaxx.compiler.decorators.CompiledObjectDecorator; +import jaxx.compiler.decorators.HelpRootCompiledObjectDecorator; +import jaxx.compiler.tags.TagManager; +import jaxx.runtime.context.JAXXContext; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.model.Resource; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; -import org.codehaus.plexus.util.DirectoryScanner; +import org.apache.maven.project.MavenProject; + +import org.nuiton.io.FileUpdaterHelper; +import org.nuiton.io.MirroredFileUpdater; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; -import java.lang.reflect.Modifier; import java.net.MalformedURLException; +import java.util.Map; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Properties; import java.util.Set; -import jaxx.compiler.CompiledObjectDecorator; -import jaxx.compiler.HelpRootCompiledObjectDecorator; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.model.Resource; -import org.apache.maven.project.MavenProject; -import org.nuiton.io.FileUpdaterHelper; -import org.nuiton.io.MirroredFileUpdater; +import org.apache.commons.lang.builder.ToStringBuilder; +import org.apache.commons.lang.builder.ToStringStyle; /** * Classe permettant de transformer des sources jaxx vers du source java. @@ -57,62 +61,72 @@ import org.nuiton.io.MirroredFileUpdater; * @requiresDependencyResolution compile * @requiresProject */ -public class JaxxGeneratorMojo extends AbstractJaxxMojo { +public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfiguration { /** - * Le compilateur à utiliser (par défaut celui de Swing) - * - * @parameter expression="${jaxx.compilerFQN}" default-value="jaxx.compiler.SwingCompiler" + * Default includes to use, if none provided */ - protected String compilerFQN; + private static final String[] INCLUDES = {"**\\/*.jaxx"}; /** - * Le compilateur à utiliser (par défaut celui de Swing) + * Repertoire sources des fichiers jaxx a generer. * - * @parameter expression="${jaxx.validatorFQN}" default-value="jaxx.runtime.validator.swing.SwingValidator" + * @parameter expression="${jaxx.src}" default-value="${maven.src.dir}/main/java" */ - protected String validatorFQN; + protected File src; /** - * chemin du repertoire de generation des resources. + * pour filter les fichiers a traiter * - * @parameter expression="${jaxx.outResource}" default-value="${basedir}/target/generated-sources/resources" + * @parameter expression="${jaxx.includes}" */ - protected File outResource; + protected String[] includes; /** - * chemin du repertoire de compilation des resources. + * pour filter les fichiers a ne pas traiter * - * @parameter expression="${jaxx.outClass}" default-value="${basedir}/target/classes" + * @parameter expression="${jaxx.excludes}" */ - protected File outClass; + protected String[] excludes; /** - * Repertoire sources des fichiers jaxx a generer. + * Le compilateur à utiliser (par défaut celui de Swing) * - * @parameter expression="${jaxx.src}" default-value="${maven.src.dir}/main/java" + * @parameter expression="${jaxx.compilerFQN}" default-value="jaxx.compiler.JAXXCompiler" */ - protected File src; + protected String compilerFQN; /** - * pour optimizer le code compile ou genere ? + * Le compilateur à utiliser (par défaut celui de Swing) * - * @parameter expression="${jaxx.optimize}" default-value="false" + * @parameter expression="${jaxx.validatorFQN}" default-value="jaxx.runtime.validator.swing.SwingValidator" */ - protected boolean optimize; + protected String validatorFQN; /** - * les options de la compilation + * the name of implementation of {@link jaxx.runtime.context.JAXXContext} + * to be used on {@link jaxx.runtime.JAXXObject}. + * <p/> + * Must not be abstract. * - * @parameter expression="${jaxx.javaOpts}" + * @parameter expression="${jaxx.jaxxContextFQN}" default-value="jaxx.runtime.context.DefaultJAXXContext" + * @required */ - protected String javaOpts = null; + protected String jaxxContextFQN; /** - * pour filter les fichiers a traiter + * the FQN of the ui to use for error notification. + * <p/> + * If not given, will use the one defined in validator * - * @parameter expression="${jaxx.includes}" + * @parameter expression="${jaxx.defaultErrorUIFQN}" + * + * @see jaxx.runtime.validator.swing.SwingValidator */ - protected String[] includes; + protected String defaultErrorUIFQN; /** - * pour filter les fichiers a ne pas traiter + * the FQN of the ui to use for error notification. + * <p/> + * If not given, will use the one defined in validator * - * @parameter expression="${jaxx.excludes}" + * @parameter expression="${jaxx.defaultDecoratorFQN}" default-value="jaxx.compiler.decorators.DefaultCompiledObjectDecorator" + * + * @see jaxx.compiler.CompiledObjectDecorator */ - protected String[] excludes; + protected String defaultDecoratorFQN; /** * flag to include in compiler classpath the java sources directories (src and outJava). * <p/> @@ -156,6 +170,19 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { */ protected boolean force; /** + * A flag to mark themojo to be used in a test phase. This will permits to add generated sources in test compile roots. + * + * @parameter expression="${jaxx.testPhase}" default-value="false" + * @since 1.6.0 + */ + protected boolean testPhase; + /** + * pour optimizer le code compile ou genere ? + * + * @parameter expression="${jaxx.optimize}" default-value="false" + */ + protected boolean optimize; + /** * flag to add logger to each generated jaxx file. * <p/> * By default, always add it. @@ -172,16 +199,6 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { */ protected boolean resetAfterCompile; /** - * the name of implementation of {@link jaxx.runtime.JAXXContext} - * to be used on {@link jaxx.runtime.JAXXObject}. - * <p/> - * Must not be abstract. - * - * @parameter expression="${jaxx.jaxxContextImplementorClass}" default-value="jaxx.runtime.DefaultJAXXContext" - * @required - */ - protected String jaxxContextImplementorClass; - /** * extra path to be added in {@link java.beans.Introspector#setBeanInfoSearchPath(java.lang.String[])}. * <p/> * add beanInfoSearchPath to be registred by {@link BeanInfoUtil#addJaxxBeanInfoPath(java.lang.String[])} @@ -197,39 +214,10 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { /** * list of fqn of class toimport for all generated jaxx files * - * @parameter expression="${jaxx.extraImports}" - * - * @deprecated Prefer use of extraImportList as a string, so - * could be use in properties section. - */ - protected String[] extraImports; - /** - * list of fqn of class toimport for all generated jaxx files - * * @parameter expression="${jaxx.extraImportList}" */ protected String extraImportList; /** - * the FQN of the ui to use for error notification. - * <p/> - * If not given, will use the one defined in validator - * - * @parameter expression="${jaxx.defaultErrorUIFQN}" - * - * @see jaxx.runtime.validator.swing.SwingValidator - */ - protected String defaultErrorUIFQN; - /** - * the FQN of the ui to use for error notification. - * <p/> - * If not given, will use the one defined in validator - * - * @parameter expression="${jaxx.defaultDecorator}" default-value="jaxx.compiler.DefaultCompiledObjectDecorator" - * - * @see jaxx.compiler.CompiledObjectDecorator - */ - protected String defaultDecoratorFQN; - /** * a flag to use UIManager to retreave icons. * * @parameter expression="${jaxx.useUIManagerForIcon}" default-value="false" @@ -264,27 +252,41 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { */ protected String helpBrokerFQN; /** - * A flag to mark themojo to be used in a test phase. This will permits to add generated sources in test compile roots. * - * @parameter expression="${jaxx.testPhase}" default-value="false" - * @since 1.6.0 */ - protected boolean testPhase; protected String[] files; - private static final String[] INCLUDES = {"**\\/*.jaxx"}; - protected CompilerOptions options; + /** + * + */ protected MirroredFileUpdater updater; + /** + * + */ private Class<?> defaultErrorUIClass; + /** + * + */ private Class<?> validatorClass; + /** + * + */ private Class<? extends CompiledObjectDecorator> defaultDecoratorClass; + /** + * + */ + private Class<? extends JAXXContext> jaxxContextClass; + /** + * + */ private Class<? extends JAXXCompiler> compilerClass; + /** + * + */ + private String[] extraImports; @SuppressWarnings("unchecked") @Override public boolean init() throws Exception { - if (skip) { - return true; - } if (generateHelp) { // check there is some bundle @@ -292,23 +294,6 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { throw new MojoFailureException("you must set the helpIdStore property."); } } - skip = false; - - checkJaxxContextImplementorClass(); - - if (beanInfoSearchPath != null && beanInfoSearchPath.length > 0) { - // register extra path - BeanInfoUtil.addJaxxBeanInfoPath(beanInfoSearchPath); - } - if (!outResource.exists()) { - outResource.mkdirs(); - } - - if (!outJava.exists()) { - outJava.mkdirs(); - } - - fixCompileSourceRoots(); if (addSourcesToClassPath || addProjectClassPath) { cl = initClassLoader(project, getLog()); @@ -318,55 +303,44 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { //cl = Thread.currentThread().getContextClassLoader(); } - compilerClass = (Class<? extends JAXXCompiler>) Class.forName(compilerFQN, false, cl); defaultDecoratorClass = (Class<? extends CompiledObjectDecorator>) Class.forName(defaultDecoratorFQN, false, cl); - - // check the validator class is correct + jaxxContextClass = (Class<? extends JAXXContext>) Class.forName(jaxxContextFQN, false, cl); + if (!JAXXContext.class.isAssignableFrom(jaxxContextClass)) { + throw new MojoExecutionException("jaxxContextFQN must be an implementation of " + JAXXContext.class + " but was : " + jaxxContextClass); + } validatorClass = Class.forName(validatorFQN, false, cl); if (defaultErrorUIFQN != null && !defaultErrorUIFQN.trim().isEmpty()) { defaultErrorUIClass = Class.forName(defaultErrorUIFQN, false, cl); } - DirectoryScanner ds; - ds = new DirectoryScanner(); - ds.setBasedir(src); - boolean noIncludes = includes == null || includes.length == 0; - ds.setIncludes(noIncludes ? INCLUDES : includes); - - if (excludes != null && excludes.length > 0) { - ds.setExcludes(excludes); + if (beanInfoSearchPath != null && beanInfoSearchPath.length > 0) { + // register extra path + BeanInfoUtil.addJaxxBeanInfoPath(beanInfoSearchPath); } - ds.scan(); - String[] filesFind = ds.getIncludedFiles(); - if (verbose) { - getLog().info("jaxx - discover " + filesFind.length + " jaxx file(s). "); + if (!outJava.exists()) { + outJava.mkdirs(); } + fixCompileSourceRoots(); + + boolean noIncludes = includes == null || includes.length == 0; + + if (noIncludes) { + includes = INCLUDES; + } updater = FileUpdaterHelper.newJaxxFileUpdater(src, outJava); - if (force) { - // we will regenerate all files - this.files = filesFind; - } else { - // filter files - List<String> listFiles = new ArrayList<String>(); + Map<File, String[]> result = new HashMap<File, String[]>(); + getFilesToTreateForRoots(includes, excludes, Arrays.asList(src.getAbsolutePath()), result, force ? null : updater); - for (String file : filesFind) { - if (updater.isFileUpToDate(new File(src, file))) { - if (verbose) { - getLog().info("jaxx - skip file [" + file + "]."); - } - } else { - if (verbose) { - getLog().info("jaxx - detect modify file [" + file + "]."); - } - listFiles.add(file); - } - } - this.files = listFiles.toArray(new String[listFiles.size()]); + this.files = result.get(src); + + if (files == null || files.length == 0) { + getLog().warn("No files to treate."); + return false; } if (extraImportList != null && !extraImportList.isEmpty()) { @@ -379,9 +353,7 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { getLog().info("extra imports " + java.util.Arrays.toString(imports)); } extraImports = imports; - } - options = toCompilerOptions(); if (verbose) { printInit(); @@ -391,12 +363,7 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { @Override public void doAction() throws MojoExecutionException { - if (skip) { - if (verbose) { - getLog().info("jaxx - skip!"); - } - return; - } + getLog().info("jaxx - detects " + this.files.length + " modify jaxx file(s). "); try { @@ -404,7 +371,7 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { // force compiler init from here, not in a static block TagManager.reset(verbose); - JAXXCompilerLaunchor launchor = JAXXCompilerLaunchor.newLaunchor(src, files, options); + JAXXCompilerLaunchor launchor = JAXXCompilerLaunchor.newLaunchor(src, files, this); boolean success = launchor.compile(); getLog().info("jaxx - generate " + launchor.getCompilerCount() + " file(s). "); @@ -432,41 +399,119 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { } } - public CompilerOptions toCompilerOptions() { - CompilerOptions result = new CompilerOptions(); - result.setClassPath(src.getPath()); - if (javaOpts != null && !"".equals(javaOpts)) { - result.setJavacOpts(javaOpts); - } - result.setCompilerClass(compilerClass); - result.setValidatorFQN(validatorFQN); - result.setValidatorClass(validatorClass); - result.setKeepJavaFiles(true); - result.setOptimize(optimize); - result.setJavacTargetDirectory(outClass); - result.setTargetDirectory(outJava); - result.setVerbose(verbose); - result.setI18nable(i18nable); - result.setAddLogger(addLogger); - result.setProfile(profile); - result.setResetAfterCompile(resetAfterCompile); - result.setJaxxContextImplementorClass(jaxxContextImplementorClass); - result.setExtraImports(extraImports); - result.setDefaultErrorUI(defaultErrorUIClass); - result.setUseUIManagerForIcon(useUIManagerForIcon); - result.setDefaultDecoratorClass(defaultDecoratorClass); - result.setGenerateHelp(generateHelp); - result.setHelpBrokerFQN(helpBrokerFQN); - result.setHelpsetTitleI18nSuffix(helpsetTitleI18nSuffix); - result.setHelpsetIndexI18nSuffix(helpsetIndexI18nSuffix); - result.setHelpsetTocI18nSuffix(helpsetTocI18nSuffix); - result.setHelpSetName(helpSetName); - result.setHelpsetI18nPrefix(helpsetI18nPrefix); - - if (cl != null) { - result.setClassLoader(cl); - } - return result; + @Override + public File getTargetDirectory() { + return outJava; + } + + @Override + public boolean getOptimize() { + return optimize; + } + + @Override + public boolean isI18nable() { + return i18nable; + } + + @Override + public boolean isUseUIManagerForIcon() { + return useUIManagerForIcon; + } + + @Override + public boolean isAddLogger() { + return addLogger; + } + + @Override + public Class<? extends JAXXContext> getJaxxContextClass() { + return jaxxContextClass; + } + + @Override + public String[] getExtraImports() { + return extraImports; + } + + @Override + public boolean isResetAfterCompile() { + return resetAfterCompile; + } + + @Override + public boolean isOptimize() { + return optimize; + } + + @Override + public Class<?> getDefaultErrorUI() { + return defaultErrorUIClass; + } + + @Override + public ClassLoader getClassLoader() { + return cl; + } + + @Override + public Class<? extends JAXXCompiler> getCompilerClass() { + return compilerClass; + } + + @Override + public Class<? extends CompiledObjectDecorator> getDefaultDecoratorClass() { + return defaultDecoratorClass; + } + + @Override + public boolean isProfile() { + return profile; + } + + @Override + public boolean isGenerateHelp() { + return generateHelp; + } + + @Override + public String getHelpBrokerFQN() { + return helpBrokerFQN; + } + + @Override + public String getHelpsetIndexI18nSuffix() { + return helpsetIndexI18nSuffix; + } + + @Override + public String getHelpsetTitleI18nSuffix() { + return helpsetTitleI18nSuffix; + } + + @Override + public String getHelpsetTocI18nSuffix() { + return helpsetTocI18nSuffix; + } + + @Override + public String getHelpSetName() { + return helpSetName; + } + + @Override + public String getHelpsetI18nPrefix() { + return helpsetI18nPrefix; + } + + @Override + public Class<?> getValidatorClass() { + return validatorClass; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); } protected void fixCompileSourceRoots() { @@ -491,7 +536,7 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { } protected void printInit() { - getLog().info(options.toString()); + getLog().info(toString()); getLog().info("includes : " + Arrays.toString(includes)); for (String file : files) { getLog().info("will generate " + file); @@ -514,24 +559,6 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo { } } - protected void checkJaxxContextImplementorClass() { - if (jaxxContextImplementorClass == null) { - throw new IllegalArgumentException("jaxxContextImplementor can not be null"); - } - try { - Class<?> jaxxContextImplementor = Class.forName(jaxxContextImplementorClass); - if (!JAXXContext.class.isAssignableFrom(jaxxContextImplementor)) { - throw new IllegalArgumentException("jaxxContextImplementor '" + jaxxContextImplementor + "' does not implements " + JAXXContext.class); - } - if (Modifier.isAbstract(jaxxContextImplementor.getModifiers())) { - throw new IllegalArgumentException("jaxxContextImplementor '" + jaxxContextImplementor + "' can not be abstract."); - - } - } catch (ClassNotFoundException e) { - throw new IllegalArgumentException("could not find jaxxContextImplementor class : " + jaxxContextImplementorClass); - } - } - protected void generateHelp() throws IOException { Set<String> helpIds = HelpRootCompiledObjectDecorator.getHelpIds(); if (helpIds.isEmpty()) { diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxHelpGeneratorMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxHelpGeneratorMojo.java index f4311e3..1625471 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxHelpGeneratorMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxHelpGeneratorMojo.java @@ -209,12 +209,7 @@ public class JaxxHelpGeneratorMojo extends AbstractJaxxMojo { @Override public boolean init() throws Exception { - if (skip) { - return true; - } - if (!helpIdStore.exists()) { - skip = true; getLog().info("no helpIdStore to react at " + helpIdStore); return false; } @@ -239,7 +234,6 @@ public class JaxxHelpGeneratorMojo extends AbstractJaxxMojo { target.mkdirs(); } - helpIds = new SortedProperties(); InputStream stream = new FileInputStream(helpIdStore); @@ -252,24 +246,15 @@ public class JaxxHelpGeneratorMojo extends AbstractJaxxMojo { // no ids detected getLog().warn("no helpIds detected, will skip."); - skip = true; return false; } - skip = false; return true; } @Override public void doAction() throws Exception { - if (skip) { - if (verbose) { - getLog().info("jaxx - skip!"); - } - return; - } - if (i18nable) { List<URL> lUrls = new java.util.ArrayList<URL>(); diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java index ae8779d..3395019 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java @@ -1,6 +1,6 @@ package org.nuiton.jaxx.plugin; -import jaxx.Base64Coder; +import jaxx.runtime.Base64Coder; import jaxx.compiler.JAXXCompiler; import jaxx.compiler.JAXXCompilerLaunchor; import jaxx.runtime.JAXXObjectDescriptor; diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java index edfb254..6012c74 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java @@ -2,8 +2,7 @@ package org.nuiton.jaxx.plugin; import jaxx.compiler.JAXXCompiler; import jaxx.compiler.JAXXCompilerLaunchor; -import jaxx.runtime.DefaultJAXXContext; -import jaxx.runtime.JAXXContext; +import jaxx.runtime.context.DefaultJAXXContext; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.SystemStreamLog; @@ -162,31 +161,31 @@ public class CompilerTest extends JaxxBaseTest { @Test public void ErrorJaxxContextImplementorClass() throws Exception { JaxxGeneratorMojo mojo = getMojo(); - mojo.jaxxContextImplementorClass = null; + mojo.jaxxContextFQN = null; try { mojo.init(); fail(); - } catch (IllegalArgumentException e) { + } catch (NullPointerException e) { assertTrue(true); } - mojo.jaxxContextImplementorClass = String.class.getName(); + mojo.jaxxContextFQN = String.class.getName(); try { mojo.init(); fail(); - } catch (IllegalArgumentException e) { + } catch (MojoExecutionException e) { assertTrue(true); } - - mojo.jaxxContextImplementorClass = JAXXContext.class.getName(); - try { - mojo.init(); - fail(); - } catch (IllegalArgumentException e) { - assertTrue(true); - } - - mojo.jaxxContextImplementorClass = DefaultJAXXContext.class.getName(); +// +// mojo.jaxxContextFQN = JAXXContext.class.getName(); +// try { +// mojo.init(); +// fail(); +// } catch (IllegalArgumentException e) { +// assertTrue(true); +// } + + mojo.jaxxContextFQN = DefaultJAXXContext.class.getName(); mojo.init(); assertTrue(true); diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java index 1640d97..abaa634 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java @@ -1,6 +1,6 @@ package org.nuiton.jaxx.plugin; -import jaxx.runtime.DefaultJAXXContext; +import jaxx.runtime.context.DefaultJAXXContext; import org.nuiton.util.FileUtil; import java.io.File; @@ -8,7 +8,8 @@ import java.io.IOException; import org.nuiton.plugin.AbstractMojoTest; import static org.junit.Assert.*; -/** Base test case for a jaxx:generate goal. +/** + * Base test case for a jaxx:generate goal. * * Use {@link AbstractMojoTest} from {@code maven-helper-plugin}. * @@ -26,10 +27,10 @@ public abstract class JaxxBaseTest extends AbstractMojoTest<JaxxGeneratorMojo> { @Override protected void setUpMojo(JaxxGeneratorMojo mojo, File pomFile) throws Exception { super.setUpMojo(mojo, pomFile); - mojo.jaxxContextImplementorClass = DefaultJAXXContext.class.getName(); - mojo.compilerFQN = jaxx.compiler.SwingCompiler.class.getName(); + mojo.jaxxContextFQN = DefaultJAXXContext.class.getName(); + mojo.compilerFQN = jaxx.compiler.JAXXCompiler.class.getName(); mojo.validatorFQN = jaxx.runtime.validator.swing.SwingValidator.class.getName(); - mojo.defaultDecoratorFQN = jaxx.compiler.DefaultCompiledObjectDecorator.class.getName(); + mojo.defaultDecoratorFQN = jaxx.compiler.decorators.DefaultCompiledObjectDecorator.class.getName(); } protected void checkPattern(JaxxGeneratorMojo mojo, String pattern, boolean required, String... files) throws IOException { @@ -52,6 +53,10 @@ public abstract class JaxxBaseTest extends AbstractMojoTest<JaxxGeneratorMojo> { } protected void assertNumberJaxxFiles(int expectedNbFiles) { - assertEquals(expectedNbFiles, getMojo().files.length); + if (expectedNbFiles == 0) { + assertTrue(getMojo().files == null || getMojo().files.length == 0); + } else { + assertEquals(expectedNbFiles, getMojo().files.length); + } } } diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml index a6e881c..9f234ac 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <verbose>true</verbose> <includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml index 4c6a3cc..a170eab 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <verbose>true</verbose> <resetAfterCompile>false</resetAfterCompile> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml index 7034200..ceae3e8 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <i18nable>true</i18nable> <force>true</force> <verbose>true</verbose> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests.xml index f621ee1..067c35c 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <i18nable>false</i18nable> <includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences.xml index 934b46d..54e16e9 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> <value>**/CompilerTest/ClassReferences/*.jaxx</value> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClientProperty.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClientProperty.xml index fa27c64..922bd7b 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClientProperty.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClientProperty.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <addLogger>false</addLogger> <includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ErrorJaxxContextImplementorClass.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ErrorJaxxContextImplementorClass.xml index d4d67bc..5d1cc74 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ErrorJaxxContextImplementorClass.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ErrorJaxxContextImplementorClass.xml @@ -14,8 +14,8 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> - <jaxxContextImplementorClass>java.lang.String</jaxxContextImplementorClass> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <jaxxContextFQN>java.lang.String</jaxxContextFQN> <force>true</force> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Errors.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Errors.xml index 16038e4..6651676 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Errors.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Errors.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> <value>**/CompilerTest/errors/*.jaxx</value> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Force.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Force.xml index d027475..2918a07 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Force.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Force.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> <value>**/CompilerTest/force/*.jaxx</value> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml index 0b162aa..3da403e 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <i18nable>false</i18nable> <force>true</force> <verbose>true</verbose> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Initializers.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Initializers.xml index de41d53..7e5fc72 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Initializers.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Initializers.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> <value>**/CompilerTest/Initializers/*.jaxx</value> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/InnerClasses.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/InnerClasses.xml index 2ce176d..b86cac8 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/InnerClasses.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/InnerClasses.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> <value>**/CompilerTest/InnerClasses/*.jaxx</value> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/NoLog.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/NoLog.xml index 3fb906c..ed14568 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/NoLog.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/NoLog.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <addLogger>false</addLogger> <includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings.xml index 58f2002..4860b09 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> <value>**/CompilerTest/OverridingDataBindings/*.jaxx</value> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Script.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Script.xml index 863228d..6f52cdf 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Script.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Script.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> <value>**/CompilerTest/Script/*.jaxx</value> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing.xml index 24f4b75..aff3c0a 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> <value>**/CompilerTest/SpecialSubclassing/*.jaxx</value> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/WithLog.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/WithLog.xml index b35e147..e2af511 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/WithLog.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/WithLog.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <addLogger>true</addLogger> <includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ItemDuplicateValues.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ItemDuplicateValues.jaxx index 27e0397..e3fdbe2 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ItemDuplicateValues.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ItemDuplicateValues.jaxx @@ -1,8 +1,8 @@ -<JList> +<JAXXList> <item value='1'/> <item value='2'/> <item value='2'/> <item value='3'/> <item value='3'/> <item value='3'/> -</JList> \ No newline at end of file +</JAXXList> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ItemNoValue.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ItemNoValue.jaxx index ca70ebd..5718ac7 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ItemNoValue.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ItemNoValue.jaxx @@ -1,4 +1,4 @@ -<JList> +<JAXXList> <item label='This item doesn&t have a value'/> <item label='Neither does this one'/> -</JList> \ No newline at end of file +</JAXXList> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml index 2548c4a..57866b5 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml @@ -15,7 +15,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <verbose>true</verbose> <includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml index d90f3da..53dcdde 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <verbose>true</verbose> <includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/Decorator.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/Decorator.xml index b808534..52fdd43 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/Decorator.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/Decorator.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <addLogger>false</addLogger> <includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml index c13137e..2c78380 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <verbose>true</verbose> <includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok.xml index c905588..48d70c1 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> <value>**/Evolution74Test/ok/*.jaxx</value> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nText.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nText.xml index 7a68ec0..2c5c9cf 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nText.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nText.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <i18nable>true</i18nable> <includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nTitle.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nTitle.xml index 68c7ed0..dd8358b 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nTitle.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nTitle.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <i18nable>true</i18nable> <includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nToolTipText.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nToolTipText.xml index 2492b17..56b03e8 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nToolTipText.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nToolTipText.xml @@ -14,7 +14,7 @@ <configuration> <src>${basedir}/target/test-classes</src> <outJava>${basedir}/target/it-generated-sources/java</outJava> - <outResource>${basedir}/target/it-generated-sources/resources</outResource> + <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <i18nable>true</i18nable> <includes> diff --git a/src/site/rst/JAXXContext.rst b/src/site/rst/JAXXContext.rst index 465f8fd..5175ffc 100644 --- a/src/site/rst/JAXXContext.rst +++ b/src/site/rst/JAXXContext.rst @@ -13,7 +13,7 @@ Ajout d'un context applicatif dans JAXX. Le besoin initial de ce développement est de pouvoir facilement intégrer un context applicatif dans JAXX et de pouvoir l'utiliser dans les fichiers JAXX pour injecter par exemple des données dans les widgets. -jaxx.runtime.JAXXContext +jaxx.runtime.context.JAXXContext ======================== Il s'agit du contrat de base du context applicatif. @@ -32,7 +32,7 @@ Le type de l'objet correspondant en fait à la classe de la donnée. Le nom qui est facultatif permet de pouvoir distinguer plusieurs données d'un même type dans le context. Si le nom n'est pas utilisé pour caractériser une données on fixera alors sa valeur à *null*. -Afin de pouvoir caractériser les entrées dans le context, une classe a été définie *jaxx.runtime.JAXXContextEntryDef*. +Afin de pouvoir caractériser les entrées dans le context, une classe a été définie *jaxx.runtime.context.JAXXContextEntryDef*. Les méthodes de lecture *********************** @@ -87,7 +87,7 @@ de type *JAXXContext* *non nommé* qui le context courant qui sera détecté com Cette entrée spéciale ne sera pas stockée avec les autres entrées afin d'optimiser les algorithmes d'injection et de restitution. -jaxx.runtime.JAXXInitialContext +jaxx.runtime.context.JAXXInitialContext ******************************* On a implanté un second type de context qui lui peut servir à l'initialisation des JAXXObject. -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 6f521a81dce0d63a33c34c01b87c1cdc3912e4c5 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 7 14:23:35 2009 +0000 refactor jaxx 2.x --- .../java/jaxx/compiler/CompilerConfiguration.java | 155 ++++++ .../decorators/BoxedCompiledObjectDecorator.java | 30 + .../decorators/CompiledObjectDecorator.java | 26 + .../decorators/CompiledObjectDecoratorManager.java | 59 ++ .../decorators/DefaultCompiledObjectDecorator.java | 131 +++++ .../HelpRootCompiledObjectDecorator.java | 100 ++++ .../jaxx/compiler/generators/GeneratorManager.java | 42 ++ .../compiler/generators/JAXXObjectGenerator.java | 604 +++++++++++++++++++++ .../jaxx/compiler/generators/SwingGenerator.java | 27 + .../compiler/generators/ValidatorGenerator.java | 88 +++ 10 files changed, 1262 insertions(+) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java new file mode 100644 index 0000000..5181c5b --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java @@ -0,0 +1,155 @@ +package jaxx.compiler; + +import java.io.File; +import jaxx.compiler.decorators.CompiledObjectDecorator; +import jaxx.runtime.context.JAXXContext; + +/** + * TODO javadoc. + * + * @author chemit + * @since 2.0.0 + */ +public interface CompilerConfiguration { + + /** + * + * @return + */ + ClassLoader getClassLoader(); + + /** + * + * @return + */ + Class<? extends JAXXCompiler> getCompilerClass(); + + /** + * + * @return + */ + Class<? extends CompiledObjectDecorator> getDefaultDecoratorClass(); + + /** + * + * @return + */ + Class<?> getDefaultErrorUI(); + + /** + * + * @return + */ + String[] getExtraImports(); + + /** + * + * @return + */ + String getHelpBrokerFQN(); + + /** + * + * @return + */ + String getHelpSetName(); + + /** + * + * @return + */ + String getHelpsetI18nPrefix(); + + /** + * + * @return + */ + String getHelpsetIndexI18nSuffix(); + + /** + * + * @return + */ + String getHelpsetTitleI18nSuffix(); + + /** + * + * @return + */ + String getHelpsetTocI18nSuffix(); + + /** + * + * @return + */ + Class<? extends JAXXContext> getJaxxContextClass(); + + /** + * Returns whether or not optimization should be performed. + * + * @return whether or not optimizations should be performed + */ + boolean getOptimize(); + + /** + * Returns the target directory, generally specified with the "-d" option on the command line. + * + * @return the target directory + * @see #setTargetDirectory + */ + File getTargetDirectory(); + + /** + * + * @return + */ + Class<?> getValidatorClass(); + + /** + * + * @return + */ + boolean isAddLogger(); + + /** + * + * @return + */ + boolean isGenerateHelp(); + + /** + * + * @return + */ + boolean isI18nable(); + + /** + * + * @return + */ + boolean isOptimize(); + + /** + * + * @return + */ + boolean isProfile(); + + /** + * + * @return + */ + boolean isResetAfterCompile(); + + /** + * + * @return + */ + boolean isUseUIManagerForIcon(); + + /** + * + * @return + */ + boolean isVerbose(); +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java new file mode 100644 index 0000000..abd81f0 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java @@ -0,0 +1,30 @@ +package jaxx.compiler.decorators; + +import jaxx.compiler.CompiledObject; +import jaxx.compiler.CompiledObject.ChildRef; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.JavaFile; +import jaxx.runtime.SwingUtil; + +/** + * A decorator to surround a compiled object (should be a component at least) + * with a JXLayer. + * + * @author tony + * @since 1.2 + */ +public class BoxedCompiledObjectDecorator extends DefaultCompiledObjectDecorator { + + @Override + public void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName) { + CompiledObject parent = object.getParent(); + for (ChildRef child : parent.getChilds()) { + if (child.getChild() == object) { + String javaCode = child.getChildJavaCode(); + child.setChildJavaCode(SwingUtil.class.getName() + ".boxComponentWithJxLayer(" + javaCode + ")"); + break; + } + } + super.finalizeCompiler(compiler, root, object, javaFile, packageName, className, fullClassName); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecorator.java new file mode 100644 index 0000000..f698e94 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecorator.java @@ -0,0 +1,26 @@ +package jaxx.compiler.decorators; + +import jaxx.compiler.CompiledObject; +import jaxx.compiler.CompilerException; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.JavaFile; + +/** + * + * Contract of compiled object decorator at generation time. + * + * Note : The implementation of this class must be stateless. + * + * @author tony + * @since 1.2 + */ +public interface CompiledObjectDecorator { + + String createCompleteSetupMethod(JAXXCompiler compiler, CompiledObject object, JavaFile javaFile, StringBuffer initDataBindings); + + boolean createInitializer(JAXXCompiler compiler, CompiledObject root, CompiledObject object, StringBuffer code, boolean lastWasMethodCall); + + void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName); + + String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException; +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecoratorManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecoratorManager.java new file mode 100644 index 0000000..1fcfe4d --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecoratorManager.java @@ -0,0 +1,59 @@ +package jaxx.compiler.decorators; + +import java.util.Map; +import java.util.TreeMap; + +/** + * + * @author chemit + * @since 2.0.0 + */ +public class CompiledObjectDecoratorManager { + + protected static Map<String, CompiledObjectDecorator> cache; + + public static void registerDecorator(String key, Class<? extends CompiledObjectDecorator> klass) { + synchronized (getCache()) { + if (getCache().containsKey(key)) { + throw new IllegalArgumentException("the decorator with key [" + key + "] is already registred! use another key name"); + } + try { + getCache().put(key, klass.newInstance()); + } catch (InstantiationException ex) { + throw new IllegalArgumentException("could not create decorator " + klass + " for reason " + ex.getMessage(), ex); + } catch (IllegalAccessException ex) { + throw new IllegalArgumentException("could not create decorator " + klass + " for reason " + ex.getMessage(), ex); + } + } + } + + public static CompiledObjectDecorator getDecorator(String name) { + CompiledObjectDecorator decorator = getCache().get(name); + if (decorator == null) { + throw new IllegalArgumentException("could not find decorator with key " + name + " (known decorators : " + getCache().keySet()); + } + return decorator; + } + + public static CompiledObjectDecorator getDecorator(Class<?> type) { + for (CompiledObjectDecorator decorator : getCache().values()) { + if (type == decorator.getClass()) { + return decorator; + } + } + return null; + } + + protected static synchronized Map<String, CompiledObjectDecorator> getCache() { + if (cache == null) { + cache = new TreeMap<String, CompiledObjectDecorator>(); + } + return cache; + } + + public static void reset() { + if (cache != null) { + cache.clear(); + } + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java new file mode 100644 index 0000000..57ff26f --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java @@ -0,0 +1,131 @@ +package jaxx.compiler.decorators; + +import jaxx.compiler.CompiledObject; +import jaxx.compiler.CompilerException; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.JavaField; +import jaxx.compiler.JavaFile; +import jaxx.compiler.JavaMethod; +import jaxx.compiler.ScriptInitializer; +import jaxx.compiler.types.TypeManager; + +import java.lang.reflect.Modifier; +import java.util.Map.Entry; + +/** + * The default compiledObjectDecorator. + * + * @author tony + * @since 1.2 + */ +public class DefaultCompiledObjectDecorator implements CompiledObjectDecorator { + + @Override + public void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName) { + + if (!object.isOverride() && !(object instanceof ScriptInitializer)) { + String id = object.getId(); + int access = id.startsWith("$") ? Modifier.PRIVATE : Modifier.PROTECTED; + if (object == root) { + javaFile.addField(new JavaField(access, fullClassName, id, "this")); + } else { + //TC -20081017 can have generic on compiled Object + javaFile.addField(JavaField.newField(access, JAXXCompiler.getCanonicalName(object), id), object.isJavaBean()); + } + } + + if (!compiler.inlineCreation(object) && object != root) { + javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getCreationMethodName(), getCreationCode(compiler, object))); + } + } + + @Override + public String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException { + if (object instanceof ScriptInitializer) { + return object.getInitializationCode(compiler); + } + StringBuffer result = new StringBuffer(); + if (object.isOverride() && object.getOverrideType() == object.getObjectClass()) { + //TC-20090309 on utilise le super code quand l'objet est de meme type + result.append("super.").append(object.getCreationMethodName()).append("();"); + } else { + result.append(object.getId()); + result.append(" = "); + if (object.isJavaBean() && object.getJavaBeanInitCode() != null) { + result.append(object.getJavaBeanInitCode()).append(";"); + } else { + String constructorParams = object.getConstructorParams(); + if (constructorParams != null) { + //TC - 20081017 compiledObject can have generics + result.append(" new ").append(JAXXCompiler.getCanonicalName(object)).append("(").append(constructorParams).append(");"); + //result.append("(").append(getCanonicalName(object.getObjectClass())).append(") new ").append(getCanonicalName(object.getObjectClass())).append("(").append(constructorParams).append(");"); + } else { + //TC - 20081017 compiledObject can have generics + result.append("new ").append(JAXXCompiler.getCanonicalName(object)).append("();"); + } + } + result.append(JAXXCompiler.getLineSeparator()); + result.append("$objectMap.put(").append(TypeManager.getJavaCode(object.getId())).append(", ").append(object.getId()).append(");"); + } + result.append(JAXXCompiler.getLineSeparator()); + String initCode = object.getInitializationCode(compiler); + if (initCode != null && initCode.length() > 0) { + result.append(initCode); + } + + return result.toString(); + } + + @Override + public String createCompleteSetupMethod(JAXXCompiler compiler, CompiledObject object, JavaFile javaFile, StringBuffer initDataBindings) { + StringBuffer code = new StringBuffer(); + //TC-20090327 generate client properties + if (object.hasClientProperties()) { + // generate putClientProperty invocations + for (Entry<String, String> entry : object.getClientProperties().entrySet()) { + object.appendAdditionCode(object.getJavaCode() + ".putClientProperty(\"" + entry.getKey() + "\", " + entry.getValue() + ");"); + } + + } + //TC - 20081017 only generate the method if not empty ? + if (object.getId().startsWith("$")) { + code.append(object.getAdditionCode()).append(JAXXCompiler.getLineSeparator()); + } else { + String additionCode = object.getAdditionCode(); + if (additionCode.length() > 0) { + code.append(object.getAdditionMethodName()).append("();").append(JAXXCompiler.getLineSeparator()); + additionCode = "if (!allComponentsCreated) {" + JAXXCompiler.getLineSeparator() + " return;" + JAXXCompiler.getLineSeparator() + "}" + JAXXCompiler.getLineSeparator() + additionCode; + javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getAdditionMethodName(), additionCode)); + } + } + //code.append(getLineSeparator()); + return code.toString(); + } + + @Override + public boolean createInitializer(JAXXCompiler compiler, CompiledObject root, CompiledObject object, StringBuffer code, boolean lastWasMethodCall) { + if (object == root) { + String rootCode = root.getInitializationCode(compiler); + if (rootCode != null && rootCode.length() > 0) { + code.append(rootCode); + code.append(JAXXCompiler.getLineSeparator()); + } + } else { + if (!object.isOverride()) { + if (compiler.inlineCreation(object)) { + if (lastWasMethodCall) { + lastWasMethodCall = false; + code.append(JAXXCompiler.getLineSeparator()); + } + code.append(getCreationCode(compiler, object)); + code.append(JAXXCompiler.getLineSeparator()); + } else { + code.append(object.getCreationMethodName()).append("();"); + code.append(JAXXCompiler.getLineSeparator()); + lastWasMethodCall = true; + } + } + } + return lastWasMethodCall; + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java new file mode 100644 index 0000000..eb11a1a --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java @@ -0,0 +1,100 @@ +package jaxx.compiler.decorators; + +import jaxx.compiler.CompiledObject; +import jaxx.compiler.CompilerConfiguration; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.JavaArgument; +import jaxx.compiler.JavaFile; +import jaxx.compiler.JavaMethod; + +import java.lang.reflect.Modifier; +import java.util.Iterator; +import java.util.Set; + +/** + * A decorator to place on a root compiled object to process javaHelp on the file. + * + * @author tony + * @since 1.2 + */ +public class HelpRootCompiledObjectDecorator extends DefaultCompiledObjectDecorator { + + /** + * the list of discovered helpId + */ + protected static Set<String> helpIds = new java.util.HashSet<String>(); + + protected String getBrokerFQN(JAXXCompiler compiler) { + String helpBrokerFQN = compiler.getConfiguration().getHelpBrokerFQN(); + return helpBrokerFQN; + } + + protected String getHelpId(CompiledObject o) { + String helpID = null; + if (o.hasClientProperties()) { + helpID = o.getClientProperty("help"); + } + return helpID; + } + + @Override + public void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName) { + super.finalizeCompiler(compiler, root, object, javaFile, packageName, className, fullClassName); + CompilerConfiguration options = compiler.getConfiguration(); + + if (options.isGenerateHelp()) { + + // add JaxxHelpUI interface + Class<?> validatorInterface = jaxx.runtime.JaxxHelpUI.class; + String helpBrokerFQN = getBrokerFQN(compiler); + javaFile.addInterface(JAXXCompiler.getCanonicalName(validatorInterface) + "<" + helpBrokerFQN + ">"); + + javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", "registerHelpId", + "broker.installUI(component, helpId);", + new JavaArgument(helpBrokerFQN, "broker"), + new JavaArgument("Component", "component"), + new JavaArgument("String", "helpId"))); + + javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", "showHelp", + "getBroker().showHelp(this, helpId);", + new JavaArgument("String", "helpId"))); + + StringBuilder buffer = new StringBuilder(); + + String lineSeparator = JAXXCompiler.getLineSeparator(); + + if (options.isGenerateHelp()) { + + // add code to init javax help system + Iterator<CompiledObject> itr = compiler.getObjectCreationOrder(); + + for (; itr.hasNext();) { + CompiledObject o = itr.next(); + String helpID = getHelpId(o); + if (helpID != null) { + buffer.append(lineSeparator); + // detects a helpId to register + buffer.append("registerHelpId(_broker, " + o.getJavaCode() + ", " + helpID + ");"); + //keep the helpID for helpSet generation + helpIds.add(helpID); + } + } + } + if (buffer.length() > 0) { + + StringBuilder extraCode = new StringBuilder(helpBrokerFQN).append(" _broker = getBroker();"); + + buffer.append(lineSeparator).append("_broker.prepareUI(this);"); + buffer.append(lineSeparator); + + // add the calls + compiler.appendLateInitializer(extraCode.toString()); + compiler.appendLateInitializer(buffer.toString()); + } + } + } + + public static Set<String> getHelpIds() { + return helpIds; + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/generators/GeneratorManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/generators/GeneratorManager.java new file mode 100644 index 0000000..1a79d46 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/generators/GeneratorManager.java @@ -0,0 +1,42 @@ +package jaxx.compiler.generators; + +import java.util.ArrayList; +import java.util.List; +import java.util.ServiceLoader; + +/** + * + * @author chemit + * @since 2.0.0 + */ +public class GeneratorManager { + + protected static List<Generator> generators; + + public static List<Generator> getGenerators() { + if (generators == null) { + loadGenerators(); + } + return generators; + } + + public static void addGenerator(Generator g) { + getGenerators().add(g); + } + + public static void clear() { + if (generators != null) { + generators.clear(); + generators = null; + } + } + + protected static void loadGenerators() { + if (generators == null) { + generators = new ArrayList<Generator>(); + for (Generator generator : ServiceLoader.load(Generator.class)) { + generators.add(generator); + } + } + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/generators/JAXXObjectGenerator.java b/jaxx-compiler/src/main/java/jaxx/compiler/generators/JAXXObjectGenerator.java new file mode 100644 index 0000000..6f7f5f6 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/generators/JAXXObjectGenerator.java @@ -0,0 +1,604 @@ +package jaxx.compiler.generators; + +import jaxx.compiler.*; +import jaxx.runtime.Base64Coder; +import jaxx.compiler.CompilerException; +import jaxx.compiler.decorators.CompiledObjectDecorator; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.FieldDescriptor; +import jaxx.compiler.reflect.MethodDescriptor; +import jaxx.compiler.types.TypeManager; +import jaxx.runtime.JAXXObject; +import jaxx.runtime.JAXXObjectDescriptor; +import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.Util; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.io.IOException; +import java.lang.reflect.Modifier; +import static java.lang.reflect.Modifier.FINAL; +import static java.lang.reflect.Modifier.PROTECTED; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +/** + * This class is a refactoring of the {@link jaxx.compiler.JAXXCompiler}. + * <p/> + * We delegate now the generation of a {@link jaxx.runtime.JAXXObject} to this class, the + * {@link jaxx.compiler.JAXXCompiler} now only deals with the compilation of files. + * + * @author chemit + */ +public class JAXXObjectGenerator implements Generator { + + /** log */ + protected static final Log log = LogFactory.getLog(JAXXObjectGenerator.class); + protected static final JavaField ACTIVE_BINDINGS_FIELD = JavaField.newField(PROTECTED, + "java.util.List<Object>", "$activeBindings", "new ArrayList<Object>()"); + protected static final JavaField BINDING_SOURCES_FIELD = JavaField.newField(PROTECTED, + "java.util.Map<String,Object>", "$bindingSources", "new HashMap<String,Object>()"); + protected static final JavaField OBJECT_MAP_FIELD = JavaField.newField(PROTECTED, + "Map<String,Object>", "$objectMap", "new HashMap<String,Object>()"); + protected static final JavaField ALL_COMPONENTS_CREATED_FIELD = JavaField.newField(java.lang.reflect.Modifier.PRIVATE, + "boolean", "allComponentsCreated"); + protected static final JavaField CONTEXT_INITIALIZED = JavaField.newField(java.lang.reflect.Modifier.PRIVATE, + "boolean", "contextInitialized", "true"); + protected static final JavaField PREVIOUS_VALUES_FIELD = JavaField.newField(0, + "java.util.Map", "$previousValues", "new java.util.HashMap()"); + protected static final JavaField DELEGATE_CONTEXT_FIELD = JavaField.newField(PROTECTED, + "jaxx.runtime.context.JAXXContext", "delegateContext"); + protected static final JavaField PROPERTY_CHANGE_SUPPORT_FIELD = JavaField.newField(0, + "java.beans.PropertyChangeSupport", "$propertyChangeSupport"); + protected static final JavaMethod GET_CONTEXT_VALUE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> T", "getContextValue", + "return delegateContext.getContextValue(clazz, null);", + new JavaArgument("Class<T>", "clazz")); + protected static final JavaMethod GET_CONTEXT_VALUE_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> T", "getContextValue", + "return delegateContext.getContextValue(clazz, name);", + new JavaArgument("Class<T>", "clazz"), new JavaArgument("String", "name")); + protected static final JavaMethod SET_CONTEXT_VALUE_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> void", "setContextValue", + "delegateContext.setContextValue(o, name);", + new JavaArgument("T", "o"), new JavaArgument("String", "name")); + protected static final JavaMethod SET_CONTEXT_VALUE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> void", "setContextValue", + "delegateContext.setContextValue(o, null);", + new JavaArgument("T", "o")); + protected static final JavaMethod REMOVE_CONTEXT_VALUE_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> void", "removeContextValue", + "delegateContext.removeContextValue(clazz, name);", + new JavaArgument("Class<T>", "clazz"), new JavaArgument("String", "name")); + protected static final JavaMethod REMOVE_CONTEXT_VALUE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> void", "removeContextValue", + "delegateContext.removeContextValue(clazz, null);", + new JavaArgument("Class<T>", "clazz")); + protected static final JavaMethod GET_PARENT_CONTAINER_MORE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<O extends Container> O", "getParentContainer", + "return delegateContext.getParentContainer(source, clazz);", + new JavaArgument("Object", "source"), new JavaArgument("Class<O>", "clazz")); + protected static final JavaMethod GET_PARENT_CONTAINER_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<O extends Container> O", "getParentContainer", + "return delegateContext.getParentContainer(clazz);", + new JavaArgument("Class<O>", "clazz")); + protected static final JavaMethod GET_OBJECT_BY_ID_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "java.lang.Object", "getObjectById", + "return $objectMap.get(id);", + new JavaArgument("String", "id")); + protected static final JavaMethod GET_JAXX_OBJECT_DESCRIPTOR_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC | java.lang.reflect.Modifier.STATIC, "jaxx.runtime.JAXXObjectDescriptor", "$getJAXXObjectDescriptor", + "return jaxx.runtime.Util.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);"); + protected static final JavaMethod PROCESS_DATA_BINDING_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "processDataBinding", + "processDataBinding(dest, false);", + new JavaArgument("String", "dest")); + protected static final JavaMethod FIRE_PROPERTY_CHANGE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "firePropertyChange", + "super.firePropertyChange(propertyName, oldValue, newValue);", + new JavaArgument("String", "propertyName"), new JavaArgument("Object", "oldValue"), new JavaArgument("Object", "newValue")); + protected static final JavaMethod FIRE_PROPERTY_CHANGE_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "firePropertyChange", + "$getPropertyChangeSupport().firePropertyChange(propertyName, oldValue, newValue);", + new JavaArgument("String", "propertyName"), new JavaArgument("Object", "oldValue"), new JavaArgument("Object", "newValue")); + protected static final JavaMethod GET_PROPERTY_CHANGE_SUPPORT_METHOD = JavaMethod.newMethod(0, "java.beans.PropertyChangeSupport", "$getPropertyChangeSupport", + "if ($propertyChangeSupport == null)\n" + + " $propertyChangeSupport = new PropertyChangeSupport(this);\n" + + "return $propertyChangeSupport;"); + protected static final JavaMethod ADD_PROPERTY_CHANGE_SUPPORT_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "addPropertyChangeListener", + "$getPropertyChangeSupport().addPropertyChangeListener(listener);", + new JavaArgument("java.beans.PropertyChangeListener", "listener")); + protected static final JavaMethod ADD_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "addPropertyChangeListener", + "$getPropertyChangeSupport().addPropertyChangeListener(property, listener);", + new JavaArgument("String", "property"), new JavaArgument("java.beans.PropertyChangeListener", "listener")); + protected static final JavaMethod REMOVE_PROPERTY_CHANGE_SUPPORT_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "removePropertyChangeListener", + "$getPropertyChangeSupport().removePropertyChangeListener(listener);", + new JavaArgument("java.beans.PropertyChangeListener", "listener")); + protected static final JavaMethod REMOVE_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "removePropertyChangeListener", + "$getPropertyChangeSupport().removePropertyChangeListener(property, listener);", + new JavaArgument("String", "property"), new JavaArgument("java.beans.PropertyChangeListener", "listener")); + + @Override + public void finalizeCompiler(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) { + + String fullClassName = packageName != null ? packageName + "." + className : className; + if (root == null) { + throw new CompilerException("root tag must be a class tag"); + } + //Map<String, CompiledObject> objects = compiler.getObjects(); + ClassDescriptor superclass = root.getObjectClass(); + boolean superclassIsJAXXObject = ClassDescriptorLoader.getClassDescriptor(JAXXObject.class).isAssignableFrom(superclass); + javaFile.setModifiers(Modifier.PUBLIC); + javaFile.setClassName(fullClassName); + javaFile.setSuperClass(JAXXCompiler.getCanonicalName(superclass)); + javaFile.setSuperclassIsJAXXObject(superclassIsJAXXObject); + + javaFile.addInterfaces(compiler.getExtraInterfaces()); + javaFile.setAbstractClass(compiler.isAbstractClass()); + javaFile.setGenericType(compiler.getGenericType()); + javaFile.setSuperGenericType(compiler.getSuperGenericType()); + + for (CompiledObject object : compiler.getObjects().values()) { + CompiledObjectDecorator decorator = object.getDecorator(); + decorator.finalizeCompiler(compiler, root, object, javaFile, packageName, className, fullClassName); + + /*if (!object.isOverride() && !(object instanceof ScriptInitializer)) { + String id = object.getId(); + int access = id.startsWith("$") ? Modifier.PRIVATE : Modifier.PROTECTED; + if (object == root) { + javaFile.addField(new JavaField(access, fullClassName, id, "this")); + } else { + //TC -20081017 can have generic on compiled Object + javaFile.addField(JavaField.newField(access, JAXXCompiler.getCanonicalName(object), id), object.isJavaBean()); + } + } + + if (!compiler.inlineCreation(object) && object != root) { + javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getCreationMethodName(), getCreationCode(compiler, object))); + }*/ + } + + // DataBinding + for (DataBinding dataBinding : compiler.getDataBindings()) { + if (dataBinding.compile(true)) { + compiler.getInitDataBindings().append("applyDataBinding(").append(TypeManager.getJavaCode(dataBinding.getId())).append(");").append(JAXXCompiler.getLineSeparator()); + } + } + + if (superclassIsJAXXObject) { + boolean hasBind = compiler.getApplyDataBinding().length() > 0; + if (hasBind) { + compiler.appendApplyDataBinding(" else {"); + compiler.appendApplyDataBinding(JAXXCompiler.getLineSeparator()); + compiler.appendApplyDataBinding(" "); + } + compiler.appendApplyDataBinding("super.applyDataBinding($binding);"); + compiler.appendApplyDataBinding(JAXXCompiler.getLineSeparator()); + + if (hasBind) { + compiler.appendApplyDataBinding(" return;"); + compiler.appendApplyDataBinding(JAXXCompiler.getLineSeparator()); + compiler.appendApplyDataBinding("}"); + } + + + hasBind = compiler.getRemoveDataBinding().length() > 0; + if (hasBind) { + compiler.appendRemoveDataBinding(" else {"); + compiler.appendRemoveDataBinding(JAXXCompiler.getLineSeparator()); + compiler.appendRemoveDataBinding(" "); + } + compiler.appendRemoveDataBinding("super.removeDataBinding($binding);"); + compiler.appendRemoveDataBinding(JAXXCompiler.getLineSeparator()); + + if (hasBind) { + compiler.appendRemoveDataBinding("}"); + } + } else { + javaFile.addInterface(JAXXCompiler.getCanonicalName(JAXXObject.class)); + } + } + + @Override + public void prepareJavaFile(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws ClassNotFoundException { + + String fullClassName = javaFile.getClassName(); + + String jaxxContextImplementorClass = compiler.getConfiguration().getJaxxContextClass().getName(); + boolean superclassIsJAXXObject = javaFile.isSuperclassIsJAXXObject(); + if (!superclassIsJAXXObject) { + // add logger + if (compiler.getConfiguration().isAddLogger()) { + javaFile.addImport(Log.class); + javaFile.addImport(LogFactory.class); + javaFile.addField(JavaField.newField(Modifier.PUBLIC + Modifier.STATIC + FINAL, "Log", "log", "LogFactory.getLog(" + fullClassName + ".class)")); + } + + // JAXXObject + javaFile.addField(OBJECT_MAP_FIELD); + javaFile.addMethod(GET_OBJECT_BY_ID_METHOD); + javaFile.addField(BINDING_SOURCES_FIELD); + javaFile.addField(ACTIVE_BINDINGS_FIELD); + + // JAXXContext + javaFile.addField(JavaField.newField(PROTECTED | FINAL, JAXXContext.class.getName(), "delegateContext", "new " + jaxxContextImplementorClass + "(this);")); + javaFile.addMethod(SET_CONTEXT_VALUE_METHOD); + javaFile.addMethod(SET_CONTEXT_VALUE_NAMED_METHOD); + javaFile.addMethod(GET_CONTEXT_VALUE_METHOD); + javaFile.addMethod(GET_CONTEXT_VALUE_NAMED_METHOD); + javaFile.addMethod(REMOVE_CONTEXT_VALUE_METHOD); + javaFile.addMethod(REMOVE_CONTEXT_VALUE_NAMED_METHOD); + javaFile.addMethod(GET_PARENT_CONTAINER_METHOD); + javaFile.addMethod(GET_PARENT_CONTAINER_MORE_METHOD); + + // PropertyChangeSupport + addPropertyChangeSupport(root, javaFile); + + // DataBinding + javaFile.addMethod(PROCESS_DATA_BINDING_METHOD); + } + + javaFile.addField(ALL_COMPONENTS_CREATED_FIELD); + boolean overrideContextInitialized = false; + FieldDescriptor[] scriptFields = compiler.getScriptFields(); + for (FieldDescriptor f : scriptFields) { + if ("contextInitialized".equals(f.getName())) { + overrideContextInitialized = true; + break; + } + } + if (!overrideContextInitialized) { + javaFile.addField(CONTEXT_INITIALIZED); + } + javaFile.addField(createJAXXObjectDescriptorField(compiler, javaFile)); + + if (compiler.getStylesheet() != null) { + javaFile.addField(PREVIOUS_VALUES_FIELD); + } + /*for (CompiledObject object : compiler.getObjects().values()) { + List<CompiledObject.ChildRef> refList = object.getChilds(); + if (refList==null || refList.isEmpty()) { + continue; + } + for (ChildRef childRef : refList) { + childRef.addToAdditionCode(buffer); + } + }*/ + //TC 20090228 - only generate constructors if not done in scripts + boolean constructorDetected = false; + MethodDescriptor[] methods = compiler.getScriptMethods(); + for (MethodDescriptor m : methods) { + try { + m.getReturnType(); + if (className.equals(m.getName())) { + constructorDetected = true; + break; + } + } catch (Exception e) { + log.warn("could not find return type " + m); + } + } + if (!constructorDetected) { + javaFile.addMethod(createConstructor(compiler, className, superclassIsJAXXObject)); + javaFile.addMethod(createConstructorWithInitialContext(compiler, className, superclassIsJAXXObject)); + } + + javaFile.addMethod(createInitializer(compiler)); + javaFile.addMethod(GET_JAXX_OBJECT_DESCRIPTOR_METHOD); + + javaFile.addBodyCode(compiler.getBodyCode().toString()); + + javaFile.addMethod(createCompleteSetupMethod(compiler, javaFile, compiler.getInitDataBindings())); + + + javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", "applyDataBinding", + compiler.getApplyDataBinding().toString() + JAXXCompiler.getLineSeparator() + "processDataBinding($binding);", + new JavaArgument("String", "$binding"))); + + javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", "removeDataBinding", + compiler.getRemoveDataBinding().toString(), new JavaArgument("String", "$binding"))); + + javaFile.addMethod(createProcessDataBindingMethod(compiler, superclassIsJAXXObject)); + + addEventHandlers(compiler, javaFile); + + } + + + /*---------------------------------------------------------------------------------*/ + /*-- Create fields ----------------------------------------------------------------*/ + /*---------------------------------------------------------------------------------*/ + protected JavaField createJAXXObjectDescriptorField(JAXXCompiler compiler, JavaFile javaFile) { + try { + JAXXObjectDescriptor descriptor = compiler.getJAXXObjectDescriptor(); + String data = Base64Coder.serialize(descriptor, true); + /*ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + ObjectOutputStream out = new ObjectOutputStream(new GZIPOutputStream(buffer)); + out.writeObject(descriptor); + out.close(); + // the use of the weird deprecated constructor is deliberate -- we need to store the data as a String + // in the compiled class file, since byte array initialization is horribly inefficient compared to + // String initialization. So we store the bytes in the String, and we quite explicitly want a 1:1 + // mapping between bytes and chars, with the high byte of the char set to zero. We can then safely + // reconstitute the original byte[] at a later date. This is unquestionably an abuse of the String + // type, but if we could efficiently store a byte[] we wouldn't have to do this. + String data = new String(buffer.toByteArray(), 0);*/ + + int sizeLimit = 65000; // constant strings are limited to 64K, and I'm not brave enough to push right up to the limit + if (data.length() < sizeLimit) { + return JavaField.newField(Modifier.PRIVATE | Modifier.STATIC, "java.lang.String", "$jaxxObjectDescriptor", TypeManager.getJavaCode(data)); + } else { + StringBuffer initializer = new StringBuffer(); + for (int i = 0; i < data.length(); i += sizeLimit) { + String name = "$jaxxObjectDescriptor" + i; + javaFile.addField(new JavaField(Modifier.PRIVATE | Modifier.STATIC, "java.lang.String", name, + TypeManager.getJavaCode(data.substring(i, Math.min(i + sizeLimit, data.length()))))); + if (initializer.length() > 0) { + initializer.append(" + "); + } + initializer.append("String.valueOf(").append(name).append(")"); + } + return JavaField.newField(Modifier.PRIVATE | Modifier.STATIC, "java.lang.String", "$jaxxObjectDescriptor", initializer.toString()); + } + } catch (IOException e) { + throw new RuntimeException("Internal error: can't-happen error", e); + } + } + + /*---------------------------------------------------------------------------------*/ + /*-- Create methods ---------------------------------------------------------------*/ + /*---------------------------------------------------------------------------------*/ + protected void addPropertyChangeSupport(CompiledObject root, JavaFile javaFile) { + ClassDescriptor currentClass = root.getObjectClass(); + MethodDescriptor firePropertyChange = null; + while (firePropertyChange == null && currentClass != null) { + try { + firePropertyChange = currentClass.getDeclaredMethodDescriptor("firePropertyChange", ClassDescriptorLoader.getClassDescriptor(String.class), + ClassDescriptorLoader.getClassDescriptor(Object.class), + ClassDescriptorLoader.getClassDescriptor(Object.class)); + + } catch (NoSuchMethodException e) { + currentClass = currentClass.getSuperclass(); + } + } + + int modifiers = firePropertyChange != null ? firePropertyChange.getModifiers() : 0; + if (Modifier.isPublic(modifiers)) { + // we have all the support we need + } + if (Modifier.isProtected(modifiers)) { + // there is property change support but the firePropertyChange method is protected + javaFile.addMethod(FIRE_PROPERTY_CHANGE_METHOD); + } else { + // either no support at all or firePropertyChange isn't accessible + javaFile.addField(PROPERTY_CHANGE_SUPPORT_FIELD); + javaFile.addMethod(GET_PROPERTY_CHANGE_SUPPORT_METHOD); + javaFile.addMethod(ADD_PROPERTY_CHANGE_SUPPORT_METHOD); + javaFile.addMethod(ADD_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD); + javaFile.addMethod(REMOVE_PROPERTY_CHANGE_SUPPORT_METHOD); + javaFile.addMethod(REMOVE_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD); + javaFile.addMethod(FIRE_PROPERTY_CHANGE_NAMED_METHOD); + } + } + + protected void addEventHandlers(JAXXCompiler compiler, JavaFile javaFile) { + for (Map.Entry<String, Map<ClassDescriptor, List<EventHandler>>> e1 : compiler.getEventHandlers().entrySet()) { + // outer loop is iterating over different objects (well, technically, different Java expressions) + for (Map.Entry<ClassDescriptor, List<EventHandler>> e2 : e1.getValue().entrySet()) { + // iterate over different types of listeners for this particular object (MouseListener, ComponentListener, etc.) + for (EventHandler handler : e2.getValue()) { + // iterate over individual event handlers of a single type + String methodName = compiler.getEventHandlerMethodName(handler); + MethodDescriptor listenerMethod = handler.getListenerMethod(); + if (listenerMethod.getParameterTypes().length != 1) { + throw new CompilerException("Expected event handler " + listenerMethod.getName() + " of class " + handler.getListenerClass() + " to have exactly one argument"); + } + javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", methodName, handler.getJavaCode(), + new JavaArgument(JAXXCompiler.getCanonicalName(listenerMethod.getParameterTypes()[0]), "event"))); + } + } + } + } + + protected JavaMethod createConstructor(JAXXCompiler compiler, String className, boolean superclassIsJAXXObject) throws CompilerException { + StringBuffer code = new StringBuffer(); + String constructorParams = compiler.getRootObject().getConstructorParams(); + if (constructorParams != null) { + code.append(" super(").append(constructorParams).append(");").append(JAXXCompiler.getLineSeparator()); + } else { + if (superclassIsJAXXObject) { + code.append(" super();").append(JAXXCompiler.getLineSeparator()); + } + } + code.append("$initialize();"); + code.append(JAXXCompiler.getLineSeparator()); + return JavaMethod.newMethod(Modifier.PUBLIC, null, className, code.toString()); + } + + protected JavaMethod createConstructorWithInitialContext(JAXXCompiler compiler, String className, boolean superclassIsJAXXObject) throws CompilerException { + StringBuffer code = new StringBuffer(); + String constructorParams = compiler.getRootObject().getConstructorParams(); + if (constructorParams != null) { + code.append(" super(").append(constructorParams).append(");").append(JAXXCompiler.getLineSeparator()); + } else { + if (superclassIsJAXXObject) { + code.append(" super(parentContext);").append(JAXXCompiler.getLineSeparator()); + } + } + if (!superclassIsJAXXObject) { + code.append(Util.class.getName() + ".initContext(this, parentContext);"); + code.append(JAXXCompiler.getLineSeparator()); + +// code.append("if (parentContext instanceof jaxx.runtime.context.JAXXInitialContext) {"); +// code.append(JAXXCompiler.getLineSeparator()); +// code.append(" ((jaxx.runtime.context.JAXXInitialContext)parentContext).to(this);"); +// code.append(JAXXCompiler.getLineSeparator()); +// code.append("} else {"); +// code.append(JAXXCompiler.getLineSeparator()); +// code.append(" setContextValue(parentContext);"); +// code.append(JAXXCompiler.getLineSeparator()); +// code.append("}"); +// code.append(JAXXCompiler.getLineSeparator()); + } + code.append("$initialize();"); + code.append(JAXXCompiler.getLineSeparator()); + return JavaMethod.newMethod(Modifier.PUBLIC, null, className, code.toString(), new JavaArgument("jaxx.runtime.context.JAXXContext", "parentContext")); + } + + public JavaMethod createInitializer(JAXXCompiler compiler) throws CompilerException { + StringBuffer code = new StringBuffer(); + CompiledObject root = compiler.getRootObject(); + code.append("if (allComponentsCreated || !contextInitialized) {"); + code.append(JAXXCompiler.getLineSeparator()); + code.append(" return;"); + code.append(JAXXCompiler.getLineSeparator()); + code.append("}"); + code.append(JAXXCompiler.getLineSeparator()); + code.append("$objectMap.put(").append(TypeManager.getJavaCode(root.getId())).append(", this);"); + code.append(JAXXCompiler.getLineSeparator()); + + Iterator<CompiledObject> i = compiler.getObjectCreationOrder(); + boolean lastWasMethodCall = false; + while (i.hasNext()) { + CompiledObject object = i.next(); + if (object == root) { + continue; + } + CompiledObjectDecorator decorator = object.getDecorator(); + lastWasMethodCall = decorator.createInitializer(compiler, root, object, code, lastWasMethodCall); + /*if (object != root && !object.isOverride()) { + if (compiler.inlineCreation(object)) { + if (lastWasMethodCall) { + lastWasMethodCall = false; + code.append(JAXXCompiler.getLineSeparator()); + } + code.append(getCreationCode(compiler, object)); + code.append(JAXXCompiler.getLineSeparator()); + } else { + code.append(object.getCreationMethodName()).append("();"); + code.append(JAXXCompiler.getLineSeparator()); + lastWasMethodCall = true; + } + }*/ + } + root.getDecorator().createInitializer(compiler, root, root, code, lastWasMethodCall); + /*String rootCode = root.getInitializationCode(compiler); + if (rootCode != null && rootCode.length() > 0) { + code.append(rootCode); + code.append(JAXXCompiler.getLineSeparator()); + }*/ + code.append(JAXXCompiler.getLineSeparator()); + if (compiler.getInitializer().length() > 0) { + code.append(compiler.getInitializer()); + code.append(JAXXCompiler.getLineSeparator()); + } + code.append("$completeSetup();"); + code.append(JAXXCompiler.getLineSeparator()); + return JavaMethod.newMethod(Modifier.PRIVATE, "void", "$initialize", code.toString()); + } + + protected JavaMethod createCompleteSetupMethod(JAXXCompiler compiler, JavaFile javaFile, StringBuffer initDataBindings) { + StringBuffer code = new StringBuffer(); + code.append("allComponentsCreated = true;"); + code.append(JAXXCompiler.getLineSeparator()); + for (CompiledObject object : compiler.getObjects().values()) { + CompiledObjectDecorator decorator = object.getDecorator(); + code.append(decorator.createCompleteSetupMethod(compiler, object, javaFile, initDataBindings)); + + /*//TC - 20081017 only generate the method if not empty ? + if (object.getId().startsWith("$")) { + code.append(object.getAdditionCode()).append(JAXXCompiler.getLineSeparator()); + } else { + String additionCode = object.getAdditionCode(); + if (additionCode.length() > 0) { + code.append(object.getAdditionMethodName()).append("();").append(JAXXCompiler.getLineSeparator()); + additionCode = "if (!allComponentsCreated) {" + JAXXCompiler.getLineSeparator() + " return;" + JAXXCompiler.getLineSeparator() + "}" + JAXXCompiler.getLineSeparator() + additionCode; + javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getAdditionMethodName(), additionCode)); + } + }*/ + //code.append(getLineSeparator()); + } + + code.append(initDataBindings); + + if (compiler.getLateInitializer().length() > 0) { + code.append(compiler.getLateInitializer()); + code.append(JAXXCompiler.getLineSeparator()); + } + //TC-20090313 add an extra method after complete setup + MethodDescriptor method = compiler.getScriptMethod("$afterCompleteSetup"); + if (method != null) { + code.append("$afterCompleteSetup();").append(JAXXCompiler.getLineSeparator()); + } + return JavaMethod.newMethod(Modifier.PRIVATE, "void", "$completeSetup", code.toString()); + } + + protected JavaMethod createProcessDataBindingMethod(JAXXCompiler compiler, boolean superclassIsJAXXObject) { + StringBuffer code = new StringBuffer(); + //boolean superclassIsJAXXObject = ClassDescriptorLoader.getClassDescriptor(JAXXObject.class).isAssignableFrom(compiler.getRootObject().getObjectClass()); + // the force parameter forces the update to happen even if it is already in activeBindings. This + // is used on superclass invocations b/c by the time the call gets to the superclass, it is already + // marked active and would otherwise be skipped + if (compiler.getProcessDataBinding().length() > 0) { + code.append(" if (!$force && $activeBindings.contains($dest)) { "); + code.append(JAXXCompiler.getLineSeparator()); + code.append(" return;"); + code.append(JAXXCompiler.getLineSeparator()); + code.append("}"); + code.append(JAXXCompiler.getLineSeparator()); + code.append("$activeBindings.add($dest);"); + code.append(JAXXCompiler.getLineSeparator()); + code.append("try {"); + code.append(JAXXCompiler.getLineSeparator()); + if (compiler.getProcessDataBinding().length() > 0) { + code.append(compiler.getProcessDataBinding().toString()); + //code.append(JAXXCompiler.getLineSeparator()); + } + if (superclassIsJAXXObject) { + code.append(" else {"); + code.append(JAXXCompiler.getLineSeparator()); + code.append(" super.processDataBinding($dest, true);"); + code.append(JAXXCompiler.getLineSeparator()); + code.append(" }"); + code.append(JAXXCompiler.getLineSeparator()); + } + code.append("} finally {"); + code.append(JAXXCompiler.getLineSeparator()); + code.append(" $activeBindings.remove($dest);"); + code.append(JAXXCompiler.getLineSeparator()); + code.append("}"); + code.append(JAXXCompiler.getLineSeparator()); + } else if (superclassIsJAXXObject) { + code.append("super.processDataBinding($dest, true);"); + code.append(JAXXCompiler.getLineSeparator()); + } + return JavaMethod.newMethod(Modifier.PUBLIC, "void", "processDataBinding", code.toString(), + new JavaArgument("String", "$dest"), new JavaArgument("boolean", "$force")); + } + + /*---------------------------------------------------------------------------------*/ + /*-- Create methods code ----------------------------------------------------------*/ + /*---------------------------------------------------------------------------------*/ + + /* protected String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException { + if (object instanceof ScriptInitializer) { + return object.getInitializationCode(compiler); + } + CompiledObjectDecorator decorator = object.getDecorator(); + String result = decorator.getCreationCode(compiler, object); + return result;*/ + /*StringBuffer result = new StringBuffer(); + result.append(object.getId()); + result.append(" = "); + if (object.isJavaBean() && object.getJavaBeanInitCode() != null) { + result.append(object.getJavaBeanInitCode()).append(";"); + } else { + String constructorParams = object.getConstructorParams(); + if (constructorParams != null) { + //TC - 20081017 compiledObject can have generics + result.append(" new ").append(JAXXCompiler.getCanonicalName(object)).append("(").append(constructorParams).append(");"); + //result.append("(").append(getCanonicalName(object.getObjectClass())).append(") new ").append(getCanonicalName(object.getObjectClass())).append("(").append(constructorParams).append(");"); + } else { + //TC - 20081017 compiledObject can have generics + result.append("new ").append(JAXXCompiler.getCanonicalName(object)).append("();"); + } + } + result.append(JAXXCompiler.getLineSeparator()); + String initCode = object.getInitializationCode(compiler); + if (initCode != null && initCode.length() > 0) { + result.append(initCode); + } + result.append("$objectMap.put(").append(TypeManager.getJavaCode(object.getId())).append(", ").append(object.getId()).append(");"); + + return result.toString();*/ +// } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/generators/SwingGenerator.java b/jaxx-compiler/src/main/java/jaxx/compiler/generators/SwingGenerator.java new file mode 100644 index 0000000..bf2a206 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/generators/SwingGenerator.java @@ -0,0 +1,27 @@ +package jaxx.compiler.generators; + +import jaxx.compiler.*; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.runtime.swing.Application; + +import java.lang.reflect.Modifier; + +/** @author chemit */ +public class SwingGenerator implements Generator { + + @Override + public void finalizeCompiler(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) { + } + + @Override + public void prepareJavaFile(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws ClassNotFoundException { + + //TODO : move this to jaxx-compiler-swing generator + if (ClassDescriptorLoader.getClassDescriptor(Application.class.getName()).isAssignableFrom(root.getObjectClass()) && !compiler.isMainDeclared()) { + // TODO: check for existing main method first + javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC | Modifier.STATIC, "void", "main", + "SwingUtilities.invokeLater(new Runnable() { public void run() { new " + className + "().setVisible(true); } });", + new JavaArgument("String[]", "arg"))); + } + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/generators/ValidatorGenerator.java b/jaxx-compiler/src/main/java/jaxx/compiler/generators/ValidatorGenerator.java new file mode 100644 index 0000000..0f8e3ec --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/generators/ValidatorGenerator.java @@ -0,0 +1,88 @@ +package jaxx.compiler.generators; + +import jaxx.compiler.*; +import jaxx.compiler.CompiledObject.ChildRef; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.validator.BeanValidatorHandler; +import jaxx.compiler.tags.validator.BeanValidatorHandler.CompiledBeanValidator; +import jaxx.compiler.types.TypeManager; + +import java.util.List; +import jaxx.runtime.SwingUtil; + +/** @author chemit */ +public class ValidatorGenerator implements Generator { + + protected static final JavaField VALIDATOR_IDS_FIELD = JavaField.newField(java.lang.reflect.Modifier.PROTECTED, + "java.util.List<String>", "validatorIds", "new ArrayList<String>()"); + + @Override + public void finalizeCompiler(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) { + + if (!BeanValidatorHandler.hasValidator(compiler)) { + return; + } + + for (CompiledObject object : compiler.getObjects().values()) { + List<ChildRef> childs = object.getChilds(); + if (childs == null || childs.isEmpty()) { + continue; + } + for (ChildRef child : childs) { + String javaCode = child.getChildJavaCode(); + // some validators are defined on this object + boolean found = BeanValidatorHandler.isComponentUsedByValidator(compiler, child.getChild().getId()); + if (found) { + // box the child component in a JxLayer + child.setChildJavaCode(SwingUtil.class.getName() + ".boxComponentWithJxLayer(" + javaCode + ")"); + } + } + } + // register validator + for (CompiledBeanValidator validator : BeanValidatorHandler.getValidators(compiler)) { + String id = TypeManager.getJavaCode(validator.getId()); + compiler.appendLateInitializer("validatorIds.add(" + id + ");"); + compiler.appendLateInitializer(JAXXCompiler.getLineSeparator()); + compiler.appendLateInitializer("getValidator(" + id + ").installUIs();"); + compiler.appendLateInitializer(JAXXCompiler.getLineSeparator()); + compiler.appendLateInitializer("getValidator(" + id + ").reloadBean();"); + //compiler.appendLateInitializer("getValidator(" + id + ").validate();"); + compiler.appendLateInitializer(JAXXCompiler.getLineSeparator()); + } + compiler.appendLateInitializer("validatorIds = java.util.Collections.unmodifiableList(validatorIds);"); + compiler.appendLateInitializer(JAXXCompiler.getLineSeparator()); + } + + @Override + public void prepareJavaFile(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws ClassNotFoundException { + if (!BeanValidatorHandler.hasValidator(compiler)) { + return; + } + Class<?> validatorClass = compiler.getConfiguration().getValidatorClass(); + String validatorFQN = validatorClass.getName(); + javaFile.addImport(validatorFQN); + + //TODO use the specific JAXXValidator interface (swing, gwt,...) + Class<?> validatorInterface = jaxx.runtime.JAXXValidator.class; + + if (javaFile.isSuperclassIsJAXXObject()) { + ClassDescriptor superClass = ClassDescriptorLoader.getClassDescriptor(javaFile.getSuperClass()); + boolean parentIsValidator = ClassDescriptorLoader.getClassDescriptor(validatorInterface).isAssignableFrom(superClass); + + if (parentIsValidator) { + // nothing to generate (use the parent directly) + return; + } + } + + // add JAXXValidator interface + javaFile.addInterface(JAXXCompiler.getCanonicalName(validatorInterface)); + + // implements JAXXValidator + javaFile.addField(VALIDATOR_IDS_FIELD); + javaFile.addMethod(JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, validatorFQN + "<?>", "getValidator", + "return (" + validatorFQN + ") (validatorIds.contains(validatorId) ? getObjectById(validatorId) : null);", + new JavaArgument("String", "validatorId"))); + } +} -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit d4014526f7d0a901a33c55f755f81a326485b179 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 7 17:37:55 2009 +0000 fix javadocs + improve messages in goal --- .../java/jaxx/compiler/CompilerConfiguration.java | 46 +++++------ .../src/main/java/jaxx/compiler/I18nHelper.java | 4 +- .../java/jaxx/compiler/JAXXCompilerLaunchor.java | 2 +- .../compiler/UnsupportedAttributeException.java | 2 +- .../jaxx/compiler/beans/JAXXBeanDescriptor.java | 2 +- .../java/jaxx/compiler/beans/JAXXBeanInfo.java | 4 +- .../compiler/beans/JAXXEventSetDescriptor.java | 2 +- .../jaxx/compiler/beans/JAXXFeatureDescriptor.java | 2 +- .../java/jaxx/compiler/beans/JAXXIntrospector.java | 2 +- .../compiler/beans/JAXXPropertyDescriptor.java | 2 +- jaxx-demo/src/main/java/jaxx/demo/RunDemo.java | 3 +- .../src/main/java/jaxx/runtime/SwingUtil.java | 4 +- .../jaxx/runtime/context/JAXXInitialContext.java | 1 + .../jaxx/runtime/decorator/DecoratorUtils.java | 8 +- .../src/main/java/jaxx/runtime/swing/Item.java | 4 +- .../swing/navigation/NavigationTreeModel.java | 12 +-- .../swing/navigation/NavigationTreeNode.java | 4 +- .../swing/wizard/WizardOperationActionThread.java | 2 +- .../java/jaxx/runtime/validator/BeanValidator.java | 6 +- .../runtime/validator/BeanValidatorListener.java | 2 +- .../runtime/validator/BeanValidatorMessage.java | 4 +- .../org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java | 90 +++++++++++++--------- .../ErrorJaxxContextImplementorClass.xml | 3 + 23 files changed, 117 insertions(+), 94 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java index 5181c5b..bd7a17c 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java @@ -14,73 +14,74 @@ public interface CompilerConfiguration { /** * - * @return + * @return the class loader to use by compilers */ ClassLoader getClassLoader(); /** * - * @return + * @return the type of compiler to use */ Class<? extends JAXXCompiler> getCompilerClass(); /** * - * @return + * @return the type of default decorator to use if none specified */ Class<? extends CompiledObjectDecorator> getDefaultDecoratorClass(); /** * - * @return + * @return the type of the default error UI to use for validation */ Class<?> getDefaultErrorUI(); /** * - * @return + * @return extra imports to add on all generated jaxx object */ String[] getExtraImports(); /** * - * @return + * @return the FQN of the help broker (can not directly a type since + * the help broker should (may?) be inside the sources. */ String getHelpBrokerFQN(); /** * - * @return + * @return the name of the help set to generate */ String getHelpSetName(); /** * - * @return + * @return the prefix of i18n keys to use in help system */ String getHelpsetI18nPrefix(); /** * - * @return + * @return the suffix of i18n keys to use in index of help system */ String getHelpsetIndexI18nSuffix(); /** * - * @return + * @return the suffix of i18n keys to use in title of the help system */ String getHelpsetTitleI18nSuffix(); /** * - * @return + * @return the suffix of i18n keys to use in toc of the help system */ String getHelpsetTocI18nSuffix(); /** * - * @return + * @return the type of context to use in each generated jaxx object */ Class<? extends JAXXContext> getJaxxContextClass(); @@ -92,64 +93,63 @@ public interface CompilerConfiguration { boolean getOptimize(); /** - * Returns the target directory, generally specified with the "-d" option on the command line. + * Returns the target directory. * * @return the target directory - * @see #setTargetDirectory */ File getTargetDirectory(); /** * - * @return + * @return the type of validator to use */ Class<?> getValidatorClass(); /** * - * @return + * @return {@code true} if a logger must add on each generated jaxx object */ boolean isAddLogger(); /** * - * @return + * @return {@code true} if we are generating help */ boolean isGenerateHelp(); /** * - * @return + * @return {@code true} if we use the i18n system */ boolean isI18nable(); /** * - * @return + * @return {@code true} to generate optimized code */ boolean isOptimize(); /** * - * @return + * @return {@code true} if a profile pass must be done */ boolean isProfile(); /** * - * @return + * @return {@code true} if states must be reset after the compilation */ boolean isResetAfterCompile(); /** * - * @return + * @return {@code true} if UIManager is used to retrieve icons */ boolean isUseUIManagerForIcon(); /** * - * @return + * @return {@code true} if compiler is verbose */ boolean isVerbose(); } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/I18nHelper.java b/jaxx-compiler/src/main/java/jaxx/compiler/I18nHelper.java index f38a840..f099142 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/I18nHelper.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/I18nHelper.java @@ -7,9 +7,9 @@ import java.util.Arrays; import java.util.List; /** - * I18n methods to add {@link org.nuiton.i18n.I18n#_(String, Object[])} method on some attributes. + * I18n methods to add {@link org.nuiton.i18n.I18n#_(java.lang.String, java.lang.Object[])} method on some attributes. * <p/> - * Make sure to set an i18nable compiler to have his {@link CompilerOptions#isI18nable()} returning true. + * Make sure to set an i18nable compiler to have his {@link CompilerConfiguration#isI18nable()} returning true. * * @author chemit */ diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerLaunchor.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerLaunchor.java index 7d548c7..a8a9043 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerLaunchor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerLaunchor.java @@ -105,7 +105,7 @@ public class JAXXCompilerLaunchor { } /** - * Load the {@link jaxx.spi.Initializer} services found via the{@link ServiceLoader} mecanism. + * Load the {@link Initializer} services found via the{@link ServiceLoader} mecanism. * * @param verbose <ocde>true</code> to print initializers */ diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/UnsupportedAttributeException.java b/jaxx-compiler/src/main/java/jaxx/compiler/UnsupportedAttributeException.java index 404fb5e..20dc23d 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/UnsupportedAttributeException.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/UnsupportedAttributeException.java @@ -7,7 +7,7 @@ package jaxx.compiler; /** * Thrown by <code>TagHandler</code> when an unsupported attribute is encountered. * - * @see jaxx.tags.TagHandler + * @see jaxx.compiler.tags.TagHandler */ public class UnsupportedAttributeException extends CompilerException { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanDescriptor.java index 512f735..f1138bf 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanDescriptor.java @@ -4,7 +4,7 @@ import jaxx.compiler.reflect.ClassDescriptor; /** * Mirrors the class <code>java.beans.BeanDescriptor</code>. JAXX uses its own introspector rather than the built-in - * <code>java.beans.Introspector</code> so that it can introspect {@link jaxx.reflect.ClassDescriptor}, + * <code>java.beans.Introspector</code> so that it can introspect {@link ClassDescriptor}, * not just <code>java.lang.Class</code>. */ public class JAXXBeanDescriptor extends JAXXFeatureDescriptor { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanInfo.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanInfo.java index bb0bfbb..e1be786 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanInfo.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanInfo.java @@ -1,8 +1,10 @@ package jaxx.compiler.beans; +import jaxx.compiler.reflect.ClassDescriptor; + /** * Mirrors the class <code>java.beans.BeanInfo</code>. JAXX uses its own introspector rather than the built-in - * <code>java.beans.Introspector</code> so that it can introspect {@link jaxx.reflect.ClassDescriptor}, + * <code>java.beans.Introspector</code> so that it can introspect {@link ClassDescriptor}, * not just <code>java.lang.Class</code>. */ public class JAXXBeanInfo { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXEventSetDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXEventSetDescriptor.java index 37b8cca..5790263 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXEventSetDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXEventSetDescriptor.java @@ -5,7 +5,7 @@ import jaxx.compiler.reflect.MethodDescriptor; /** * Mirrors the class <code>java.beans.EventSetDescriptor</code>. JAXX uses its own introspector rather than the built-in - * <code>java.beans.Introspector</code> so that it can introspect {@link jaxx.reflect.ClassDescriptor}, + * <code>java.beans.Introspector</code> so that it can introspect {@link ClassDescriptor}, * not just <code>java.lang.Class</code>. */ public class JAXXEventSetDescriptor extends JAXXFeatureDescriptor { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXFeatureDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXFeatureDescriptor.java index a036c88..c7723bf 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXFeatureDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXFeatureDescriptor.java @@ -7,7 +7,7 @@ import java.util.Map; /** * Mirrors the class <code>java.beans.FeatureDescriptor</code>. JAXX uses its own introspector rather than the built-in - * <code>java.beans.Introspector</code> so that it can introspect {@link jaxx.reflect.ClassDescriptor}, + * <code>java.beans.Introspector</code> so that it can introspect {@link ClassDescriptor}, * not just <code>java.lang.Class</code>. */ public class JAXXFeatureDescriptor { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java index 06b3b3c..05603be 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java @@ -24,7 +24,7 @@ import java.util.Map; * don't believe it results in any meaningful incompatibilities. * <p/> * JAXX uses its own introspector rather than the built-in - * <code>java.beans.Introspector</code> so that it can introspect {@link jaxx.reflect.ClassDescriptor}, + * <code>java.beans.Introspector</code> so that it can introspect {@link ClassDescriptor}, * not just <code>java.lang.Class</code>. */ public class JAXXIntrospector { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXPropertyDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXPropertyDescriptor.java index ead6025..299c523 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXPropertyDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXPropertyDescriptor.java @@ -6,7 +6,7 @@ import jaxx.compiler.reflect.MethodDescriptor; /** * Mirrors the class <code>java.beans.PropertyDescriptor</code>. JAXX uses its own introspector rather than the built-in - * <code>java.beans.Introspector</code> so that it can introspect {@link jaxx.reflect.ClassDescriptor}, + * <code>java.beans.Introspector</code> so that it can introspect {@link ClassDescriptor}, * not just <code>java.lang.Class</code>. */ public class JAXXPropertyDescriptor extends JAXXFeatureDescriptor { diff --git a/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java b/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java index 3a969f7..f1c1ede 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java +++ b/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java @@ -52,7 +52,7 @@ public class RunDemo { public static void main(String[] args) { startingTime = System.nanoTime(); - log.info("Observe start at " + new java.util.Date() + " args: " + java.util.Arrays.toString(args)); + log.info("JAXX Demo start at " + new java.util.Date() + " args: " + java.util.Arrays.toString(args)); try { @@ -177,7 +177,6 @@ public class RunDemo { try { super.run(); - //JAXXContext.get().close(); // force to kill main thread log.info(_("jaxxdemo.init.closed", new java.util.Date())); diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java b/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java index 327c517..9c5df22 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java @@ -454,7 +454,7 @@ public class SwingUtil extends Util { * * Says using method {@link JTabbedPane#getComponent(int)} * @param tabs the - * @return + * @return the iterator * @since 1.4 */ public static TabbedPaneIterator<Component> newTabbedPaneIterator(JTabbedPane tabs) { @@ -572,7 +572,7 @@ public class SwingUtil extends Util { * @param parent * @param x * @param y - * @return + * @return the deppest component */ public static Component getDeepestObjectAt(Component parent, int x, int y) { diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXInitialContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXInitialContext.java index a932a2f..a3c1bd2 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXInitialContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXInitialContext.java @@ -2,6 +2,7 @@ package jaxx.runtime.context; import java.awt.Container; import java.util.Map.Entry; +import jaxx.runtime.JAXXObject; /** * An initial context to be inject in a {@link JAXXObject}. diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java index 74971cf..779e0a5 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java @@ -24,11 +24,11 @@ import jaxx.runtime.decorator.JXPathDecorator.Context; * To register a new decorator, use the method {@link #register(String, Decorator)}. * <p/> * To obtain a registred decorator, use the method {@link #get(String)} - * (get the decorator based on his registred name). or the method {@link #get(Class, tring)} + * (get the decorator based on his registred name). or the method {@link #get(Class, String)} * (get the decorator based on the type of decorator and the registred name). * <p/> * To sort a list of data, using a {@link JXPathDecorator}, use the method - * {@link #sort(JXPathDecorator, java.util.List, int)}. + * {@link #sort(JXPathDecorator, List, int)}. * <p/> * * @author tony @@ -43,7 +43,7 @@ public class DecoratorUtils { /** * Factory method to instanciate a new {@link PropertyDecorator} for the - * given class {@link O} and a readable property name. + * given class {@code internlaClass} and a readable property name. * * @param internalClass the class of the objects decorated by the new decorator * @param property the property @@ -63,7 +63,7 @@ public class DecoratorUtils { /** * Factory method to instanciate a new {@link JXPathDecorator} for the - * given class {@link O} and expression. + * given class {@code internalClass} and expression. * * @param internalClass the class of the objects decorated by the new decorator * @param expression the expression to use to decorated objects diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/Item.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/Item.java index 2fe2caf..960ac67 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/Item.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/Item.java @@ -148,7 +148,7 @@ public class Item { /** * Remove all childs nodes * - * @param list of items to remove + * @param items list of items to remove */ public void removeChilds(List<Item> items) { if (children != null) { @@ -181,7 +181,7 @@ public class Item { /** * Set the parent of this item * - * @return the item parent (or null) + * @param parent the item parent (or null) */ public void setParent(Item parent) { this.parent = parent; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java index 182a1c8..239b623 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java @@ -27,7 +27,7 @@ public class NavigationTreeModel extends DefaultTreeModel { */ static private final Log log = LogFactory.getLog(NavigationTreeModel.class); /** - * The path separator used to build the {@link #fullPath}. + * The path separator used to build the {@link NavigationTreeNode#fullPath}. * * @see NavigationTreeNode#getNodePath() * @see NavigationTreeNode#getFullPath() @@ -51,7 +51,7 @@ public class NavigationTreeModel extends DefaultTreeModel { /** * Search from the root node a node named by his fully path (concatenation of nodes - * {@link NavigationTreeNode#navigationPath} valued separated by dot. + * {@link NavigationTreeNode#path} valued separated by dot. * <p/> * Example : * <p/> @@ -68,7 +68,7 @@ public class NavigationTreeModel extends DefaultTreeModel { * Apply first the regex pattern to obtain the searched node fi the given <code>regex</code> is not null. * <p/> * Search then from the root node a node named by his fully path (concatenation of nodes - * {@link NavigationTreeNode#navigationPath} valued separated by {@link #pathSeparator}. + * {@link NavigationTreeNode#path} valued separated by {@link #pathSeparator}. * <p/> * <p/> * Example : @@ -87,7 +87,7 @@ public class NavigationTreeModel extends DefaultTreeModel { * Apply first the regex pattern to obtain the searched node. * <p/> * Search then from the root node a node named by his fully path (concatenation of nodes - * {@link NavigationTreeNode#navigationPath} valued separated by {@link #pathSeparator}. + * {@link NavigationTreeNode#path} valued separated by {@link #pathSeparator}. * <p/> * Example : * <p/> @@ -103,7 +103,7 @@ public class NavigationTreeModel extends DefaultTreeModel { /** * Search from a given root node a node named by his fully path (concatenation of nodes - * {@link NavigationTreeNode#navigationPath} valued separated by {@link #pathSeparator}. + * {@link NavigationTreeNode#path} valued separated by {@link #pathSeparator}. * * @param root root node to be used * @param path the fully path of the searched node. @@ -117,7 +117,7 @@ public class NavigationTreeModel extends DefaultTreeModel { * Apply first the regex pattern to obtain the searched node. * <p/> * Search then from a given root node a node named by his fully path (concatenation of nodes) - * {@link NavigationTreeNode#navigationPath} valued separated by {@link #pathSeparator}. + * {@link NavigationTreeNode#path} valued separated by {@link #pathSeparator}. * * @param root root node to be used * @param path the fully path of the searched node. diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNode.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNode.java index b2d7c97..932b0ed 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNode.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNode.java @@ -255,8 +255,8 @@ public class NavigationTreeNode extends DefaultMutableTreeNode { } /** - * @param path the name of the {@link #path} to be matched in the cild of this node. - * @return the child of this node with given {@link # path} value. + * @param path the name of the {@link #path} to be matched in the child of this node. + * @return the child of this node with given {@link #path} value. */ public NavigationTreeNode getChild(String path) { Enumeration<?> childs = children(); diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java index 92e7e26..aefe8cd 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java @@ -12,7 +12,7 @@ import org.apache.commons.logging.LogFactory; * Thread qui réalise les opérations. * * Pour exécuter une nouvelle opération, on utilise la méthode - * {@link #launchOperation(SynchroActionWorker)}. + * {@link #launchOperation(WizardOperationStep)}. * * Note: Pour bloquer (ou débloquer) le thread, on utilise la méthode {@link #setWaiting(boolean)} * diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidator.java index dcb93ca..abd7448 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidator.java @@ -328,9 +328,9 @@ public class BeanValidator<B> { * programmation, ce qui est utile par exemple si le bean ne supporte * pas les {@link PropertyChangeListener} * - * TODO la methode devra repasser en protected et on preperar utiliser la - * methode {@link #doRevalidate()} car {@link #validate()} ne modifie pas - * les etats internes et cela en rends son utilisation delicate (le + * TODO la methode devra repasser en protected et on utilise la + * methode {@link #doValidate()} car {@link #validate()} ne modifie pas + * les etats internes et cela en rend son utilisation delicate (le * validateur entre dans un etat incoherent par rapport aux messages envoyés). */ public void validate() { diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorListener.java index 54437c6..4024427 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorListener.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorListener.java @@ -1,7 +1,7 @@ package jaxx.runtime.validator; /** - * The listener contract to be used on {@link BeanValidator] + * The listener contract to be used on {@link BeanValidator} * * @author chemit * @since 1.3 diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorMessage.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorMessage.java index 34f3373..4577f20 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorMessage.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorMessage.java @@ -3,7 +3,7 @@ package jaxx.runtime.validator; /** * The object to box a validation message. * - * @param <E> type of message (use for override {@link #compareTo(E)} method. + * @param <E> type of message (use for override {@link #compareTo(Object)} method. * * @author chemit * @since 1.3 @@ -15,7 +15,7 @@ public class BeanValidatorMessage<E extends BeanValidatorMessage<?>> implements */ protected BeanValidator<?> validator; /** - * the field thatproduce the message + * the field that produce the message */ protected BeanValidatorField<?> field; /** diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java index 2b2578f..497edaa 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java @@ -53,7 +53,7 @@ import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; /** - * Classe permettant de transformer des sources jaxx vers du source java. + * Generates some java code from jaxx files. * * @author chemit * @goal generate @@ -113,8 +113,6 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi * If not given, will use the one defined in validator * * @parameter expression="${jaxx.defaultErrorUIFQN}" - * - * @see jaxx.runtime.validator.swing.SwingValidator */ protected String defaultErrorUIFQN; /** @@ -124,7 +122,7 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi * * @parameter expression="${jaxx.defaultDecoratorFQN}" default-value="jaxx.compiler.decorators.DefaultCompiledObjectDecorator" * - * @see jaxx.compiler.CompiledObjectDecorator + * @see jaxx.compiler.decorators.CompiledObjectDecorator */ protected String defaultDecoratorFQN; /** @@ -203,7 +201,7 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi * <p/> * add beanInfoSearchPath to be registred by {@link BeanInfoUtil#addJaxxBeanInfoPath(java.lang.String[])} * <p/> - * and then will be use by {@link jaxx.tags.swing.SwingInitializer#initialize()}. + * and then will be use by {@link jaxx.compiler.spi.DefaultInitializer#initialize()}. * <p/> * <p/> * This permit to use real beanInfo of imported graphic libraries. @@ -252,15 +250,17 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi */ protected String helpBrokerFQN; /** - * + * detected jaxx files in {@link #init()} method */ protected String[] files; /** + * file updater used to detect jaxx files. * + * <b>Note:</b> if {@link #verbose} flag is on, will ne be used */ protected MirroredFileUpdater updater; /** - * + * */ private Class<?> defaultErrorUIClass; /** @@ -283,6 +283,10 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi * */ private String[] extraImports; + /** + * + */ + private boolean nofiles; @SuppressWarnings("unchecked") @Override @@ -295,14 +299,39 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi } } - if (addSourcesToClassPath || addProjectClassPath) { - cl = initClassLoader(project, getLog()); - Thread.currentThread().setContextClassLoader(cl); - } else { - cl = getClass().getClassLoader(); - //cl = Thread.currentThread().getContextClassLoader(); + fixCompileSourceRoots(); + + if (includes == null || includes.length == 0) { + // use default includes + includes = INCLUDES; + } + updater = FileUpdaterHelper.newJaxxFileUpdater(src, outJava); + + Map<File, String[]> result = new HashMap<File, String[]>(); + getFilesToTreateForRoots(includes, excludes, Arrays.asList(src.getAbsolutePath()), result, force ? null : updater); + + this.files = result.get(src); + + nofiles = files == null || files.length == 0; + if (nofiles) { + return true; } +// if (addSourcesToClassPath || addProjectClassPath) { + cl = initClassLoader(project, + src, + addSourcesToClassPath, + testPhase, + addResourcesToClassPath, + addCompileClassPath, + addProjectClassPath); + + Thread.currentThread().setContextClassLoader(cl); +// } else { +// cl = getClass().getClassLoader(); + //cl = Thread.currentThread().getContextClassLoader(); +// } + compilerClass = (Class<? extends JAXXCompiler>) Class.forName(compilerFQN, false, cl); defaultDecoratorClass = (Class<? extends CompiledObjectDecorator>) Class.forName(defaultDecoratorFQN, false, cl); jaxxContextClass = (Class<? extends JAXXContext>) Class.forName(jaxxContextFQN, false, cl); @@ -324,25 +353,8 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi outJava.mkdirs(); } - fixCompileSourceRoots(); - - boolean noIncludes = includes == null || includes.length == 0; - - if (noIncludes) { - includes = INCLUDES; - } - updater = FileUpdaterHelper.newJaxxFileUpdater(src, outJava); - - Map<File, String[]> result = new HashMap<File, String[]>(); - getFilesToTreateForRoots(includes, excludes, Arrays.asList(src.getAbsolutePath()), result, force ? null : updater); - - this.files = result.get(src); - - if (files == null || files.length == 0) { - getLog().warn("No files to treate."); - return false; - } - + // compute extra imports (can not use java classes since some of + // imports can not be still compiled) if (extraImportList != null && !extraImportList.isEmpty()) { String[] imports = extraImportList.split(","); int i = 0; @@ -364,16 +376,22 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi @Override public void doAction() throws MojoExecutionException { - getLog().info("jaxx - detects " + this.files.length + " modify jaxx file(s). "); + if (nofiles) { + getLog().info("No files to treate."); + return; + } + + getLog().info("Detects " + files.length + " modify jaxx file(s). "); try { // force compiler init from here, not in a static block TagManager.reset(verbose); - JAXXCompilerLaunchor launchor = JAXXCompilerLaunchor.newLaunchor(src, files, this); + JAXXCompilerLaunchor launchor; + launchor = JAXXCompilerLaunchor.newLaunchor(src, files, this); boolean success = launchor.compile(); - getLog().info("jaxx - generate " + launchor.getCompilerCount() + " file(s). "); + getLog().info("Generated " + launchor.getCompilerCount() + " file(s). "); if (!success) { throw new MojoExecutionException("Aborting due to errors reported by jaxxc"); @@ -596,7 +614,7 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi //TODO use the AbstractPublig method @SuppressWarnings({"unchecked"}) - protected URLClassLoader initClassLoader(MavenProject project, org.apache.maven.plugin.logging.Log log) throws MalformedURLException { + protected URLClassLoader initClasLoader(MavenProject project, org.apache.maven.plugin.logging.Log log) throws MalformedURLException { URLClassLoader loader = null; if (project != null) { diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ErrorJaxxContextImplementorClass.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ErrorJaxxContextImplementorClass.xml index 5d1cc74..bb63409 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ErrorJaxxContextImplementorClass.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ErrorJaxxContextImplementorClass.xml @@ -17,6 +17,9 @@ <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <jaxxContextFQN>java.lang.String</jaxxContextFQN> <force>true</force> + <includes> + <value>**/Evolution74Test/ok/*.jaxx</value> + </includes> </configuration> </plugin> </plugins> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 045c2e4959e5dcb11270fb57bdab111d790f2223 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 7 17:57:38 2009 +0000 debut doc de migration 2.0 --- src/site/rst/index.rst | 18 +++++++++++++++--- src/site/rst/migration.rst | 25 +++++++++++++++++++++++++ src/site/site.xml | 1 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/site/rst/index.rst b/src/site/rst/index.rst index b942a10..83d4654 100644 --- a/src/site/rst/index.rst +++ b/src/site/rst/index.rst @@ -1,5 +1,5 @@ -jaxx-core -========= +JAXX +==== .. contents:: @@ -7,7 +7,10 @@ jaxx-core Présentation ------------ -Le projet Jaxx. +TODO A faire car plus a jour... + +Le projet JAXX ... + Depuis la version 1.0, et en prévision de nouveaux générateurs s'appuyant sur Jaxx,on a revu l'architecture du projet. @@ -22,6 +25,13 @@ TODO A finir la présentation de la nouvelle architecture (dans la version 1.2). **Veuillez consulter la JavaDoc pour de plus ample détails sur les différentes librairies.** +Migration vers JAXX 2.0 +----------------------- + +La version 2.0 de JAXX n'est pas compatible avec les versions antérieures. + +Pour plus de détail consulter la page `Migration`_. + Nouvelles fonctionnalités ------------------------- @@ -35,6 +45,8 @@ Nouvelles fonctionnalités * NavigationTreeModel_ +.. _Migration: migration.html + .. _Core: Core.html .. _I18n: I18n.html diff --git a/src/site/rst/migration.rst b/src/site/rst/migration.rst new file mode 100644 index 0000000..834d189 --- /dev/null +++ b/src/site/rst/migration.rst @@ -0,0 +1,25 @@ +Migration vers JAXX 2.0 +======================= + +.. contents:: + + +Présentation +------------ + +Ce document énumère les choses à migrer pour passer sur la version 2.0 de JAXX. + +Nouvelles fonctionnalités +------------------------- + + * JList, JComboBox et JTree n'acceptent plus de fils Item (utiliser JAXXList, + JAXXComboBox, JAXXTree). + + * changement de paquetage de jaxx.runtime.JAXXContext vers jaxx.runtime.context.JAXXContext + + * changement de paquetage de jaxx.runtime.\*Decorator vers jaxx.runtime.decorator.\*Decorator + + * le framwork NavigationTree n'est plus compatible avec l'ancien... TODO + +TODO finish it + diff --git a/src/site/site.xml b/src/site/site.xml index 1e28d41..3245622 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -24,6 +24,7 @@ <menu name="Utilisateur"> <item name="Accueil" href="index.html"/> + <item name="Migration JAXX 2.0" href="migration.html"/> </menu> <menu name="Développeur"> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 4d9797bc53f07ef53c076af980212b69474073f6 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 7 18:15:26 2009 +0000 changement logs (on veut pas voir nuiton-util en console :)) --- maven-jaxx-plugin/src/main/resources/log4j.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-jaxx-plugin/src/main/resources/log4j.properties b/maven-jaxx-plugin/src/main/resources/log4j.properties index 5e2fe11..315f4fb 100644 --- a/maven-jaxx-plugin/src/main/resources/log4j.properties +++ b/maven-jaxx-plugin/src/main/resources/log4j.properties @@ -1,5 +1,5 @@ # Global logging configuration -log4j.rootLogger=INFO, stdout +log4j.rootLogger=WARN, stdout # Console output... log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 659716f65625a1aaf5794ee345219c366b8f892d Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 7 21:03:42 2009 +0000 ending migration --- .../java/jaxx/compiler/CompilerConfiguration.java | 2 +- .../compiler/DefaultCompilerConfiguration.java | 4 +- .../HelpRootCompiledObjectDecorator.java | 2 +- .../compiler/generators/JAXXObjectGenerator.java | 6 +- jaxx-compiler/src/site/rst/JAXXContext.rst | 2 +- .../src/main/java/jaxx/demo/DemoTreeHelper.java | 2 +- .../src/main/java/jaxx/demo/DemoUIHandler.java | 2 +- .../jaxx/navigation/FullNavigationTreeHelper.java | 2 +- .../src/main/java/jaxx/runtime/JAXXAction.java | 1 - .../jaxx/runtime/{context => }/JAXXContext.java | 5 +- .../src/main/java/jaxx/runtime/JAXXObject.java | 1 - .../src/main/java/jaxx/runtime/SwingUtil.java | 8 +-- jaxx-runtime/src/main/java/jaxx/runtime/Util.java | 1 - .../java/jaxx/runtime/context/DataContext.java | 1 + .../runtime/context/DefaultApplicationContext.java | 2 + .../jaxx/runtime/context/DefaultJAXXContext.java | 1 + .../jaxx/runtime/context/JAXXContextEntryDef.java | 1 + .../jaxx/runtime/context/JAXXInitialContext.java | 1 + .../java/jaxx/runtime/swing/JaxxHelpBroker.java | 82 ++++++++++++++++++---- .../java/jaxx/runtime/{ => swing}/JaxxHelpUI.java | 3 +- .../swing/{ => editor}/MyDefaultCellEditor.java | 7 +- .../navigation/NavigationTreeContextHelper.java | 2 +- .../swing/navigation/NavigationTreeHandler.java | 2 +- .../NavigationTreeHandlerWithCardLayout.java | 2 +- .../swing/navigation/NavigationTreeHelper.java | 2 +- .../swing/navigation/NavigationTreeModel.java | 2 +- .../navigation/NavigationTreeModelBuilder.java | 2 +- .../swing/navigation/NavigationTreeNode.java | 2 +- .../swing/{ => renderer}/BooleanCellRenderer.java | 2 +- .../EmptyNumberTableCellRenderer.java | 2 +- .../{ => renderer}/EnumTableCellRenderer.java | 2 +- .../{ => renderer}/I18nTableCellRenderer.java | 2 +- .../{ => renderer}/LocaleListCellRenderer.java | 2 +- .../swing/wizard/WizardOperationAction.java | 2 +- .../swing/wizard/WizardOperationActionThread.java | 2 +- .../jaxx/runtime/swing/wizard/WizardUILancher.java | 2 +- .../runtime/context/DefaultJAXXContextTest.java | 1 + .../swing/navigation/NavigationTreeModelTest.java | 6 +- .../jaxx/runtime/swing/editor/ColumnSelector.jaxx | 2 +- .../java/jaxx/runtime/swing/editor/I18nEditor.jaxx | 4 +- .../swing/editor/config/ConfigUIBuilder.java | 4 +- maven-jaxx-plugin/pom.xml | 21 +++--- .../org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java | 4 +- pom.xml | 29 +++++++- src/site/rst/JAXXContext.rst | 2 +- src/site/rst/migration.rst | 2 +- 46 files changed, 160 insertions(+), 81 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java index bd7a17c..7349bb8 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java @@ -2,7 +2,7 @@ package jaxx.compiler; import java.io.File; import jaxx.compiler.decorators.CompiledObjectDecorator; -import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.JAXXContext; /** * TODO javadoc. diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java b/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java index 543cbd1..00e61d2 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java @@ -5,7 +5,7 @@ import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; import java.io.File; -import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.JAXXContext; /** * Options of the {@link JAXXCompiler} and {@link JAXXCompilerLaunchor}. @@ -46,7 +46,7 @@ public class DefaultCompilerConfiguration implements CompilerConfiguration { */ private boolean resetAfterCompile; /** - * the name of implementation of {@link jaxx.runtime.context.JAXXContext} + * the name of implementation of {@link jaxx.runtime.JAXXContext} * to be used on {@link jaxx.runtime.JAXXObject}. */ protected Class<? extends JAXXContext> jaxxContextClass; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java index eb11a1a..3ea6337 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java @@ -45,7 +45,7 @@ public class HelpRootCompiledObjectDecorator extends DefaultCompiledObjectDecora if (options.isGenerateHelp()) { // add JaxxHelpUI interface - Class<?> validatorInterface = jaxx.runtime.JaxxHelpUI.class; + Class<?> validatorInterface = jaxx.runtime.swing.JaxxHelpUI.class; String helpBrokerFQN = getBrokerFQN(compiler); javaFile.addInterface(JAXXCompiler.getCanonicalName(validatorInterface) + "<" + helpBrokerFQN + ">"); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/generators/JAXXObjectGenerator.java b/jaxx-compiler/src/main/java/jaxx/compiler/generators/JAXXObjectGenerator.java index 6f7f5f6..ff0eeeb 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/generators/JAXXObjectGenerator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/generators/JAXXObjectGenerator.java @@ -11,7 +11,7 @@ import jaxx.compiler.reflect.MethodDescriptor; import jaxx.compiler.types.TypeManager; import jaxx.runtime.JAXXObject; import jaxx.runtime.JAXXObjectDescriptor; -import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.JAXXContext; import jaxx.runtime.Util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -49,7 +49,7 @@ public class JAXXObjectGenerator implements Generator { protected static final JavaField PREVIOUS_VALUES_FIELD = JavaField.newField(0, "java.util.Map", "$previousValues", "new java.util.HashMap()"); protected static final JavaField DELEGATE_CONTEXT_FIELD = JavaField.newField(PROTECTED, - "jaxx.runtime.context.JAXXContext", "delegateContext"); + JAXXContext.class.getName(), "delegateContext"); protected static final JavaField PROPERTY_CHANGE_SUPPORT_FIELD = JavaField.newField(0, "java.beans.PropertyChangeSupport", "$propertyChangeSupport"); protected static final JavaMethod GET_CONTEXT_VALUE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> T", "getContextValue", @@ -431,7 +431,7 @@ public class JAXXObjectGenerator implements Generator { } code.append("$initialize();"); code.append(JAXXCompiler.getLineSeparator()); - return JavaMethod.newMethod(Modifier.PUBLIC, null, className, code.toString(), new JavaArgument("jaxx.runtime.context.JAXXContext", "parentContext")); + return JavaMethod.newMethod(Modifier.PUBLIC, null, className, code.toString(), new JavaArgument(JAXXContext.class.getName(), "parentContext")); } public JavaMethod createInitializer(JAXXCompiler compiler) throws CompilerException { diff --git a/jaxx-compiler/src/site/rst/JAXXContext.rst b/jaxx-compiler/src/site/rst/JAXXContext.rst index 5175ffc..c606cda 100644 --- a/jaxx-compiler/src/site/rst/JAXXContext.rst +++ b/jaxx-compiler/src/site/rst/JAXXContext.rst @@ -13,7 +13,7 @@ Ajout d'un context applicatif dans JAXX. Le besoin initial de ce développement est de pouvoir facilement intégrer un context applicatif dans JAXX et de pouvoir l'utiliser dans les fichiers JAXX pour injecter par exemple des données dans les widgets. -jaxx.runtime.context.JAXXContext +jaxx.runtime.JAXXContext ======================== Il s'agit du contrat de base du context applicatif. diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java b/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java index 0d0e527..9f65603 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java @@ -20,7 +20,7 @@ */ package jaxx.demo; -import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.JAXXContext; import jaxx.runtime.context.JAXXContextEntryDef; import jaxx.runtime.JAXXObject; import jaxx.runtime.swing.CardLayout2; diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java b/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java index 3f695ac..702c2aa 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java @@ -21,7 +21,7 @@ package jaxx.demo; import jaxx.runtime.swing.ErrorDialogUI; -import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.JAXXContext; import jaxx.runtime.context.JAXXInitialContext; import jaxx.runtime.swing.navigation.NavigationTreeNode; import org.apache.commons.logging.Log; diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java index e917cc5..dce72e6 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java @@ -21,7 +21,7 @@ package jaxx.demo.component.jaxx.navigation; import jaxx.runtime.JAXXObject; -import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.JAXXContext; import jaxx.runtime.context.JAXXContextEntryDef; import static jaxx.runtime.context.JAXXContextEntryDef.newListDef; import jaxx.runtime.decorator.Decorator; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXAction.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXAction.java index deadbbe..0c3df04 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXAction.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXAction.java @@ -1,7 +1,6 @@ package jaxx.runtime; import jaxx.runtime.context.JAXXInitialContext; -import jaxx.runtime.context.JAXXContext; /** * This is the contract to be realized by any class to be used as Action class for an ui. diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java similarity index 96% rename from jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContext.java rename to jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java index e8fdfb8..5fa6725 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java @@ -1,9 +1,9 @@ -package jaxx.runtime.context; +package jaxx.runtime; import java.awt.Container; /** - * The {@link jaxx.runtime.context.JAXXContext} contract defines a generic context. + * The {@link jaxx.runtime.JAXXContext} contract defines a generic context. * <p/> * A context contains two king of entries : * <p/> @@ -60,7 +60,6 @@ public interface JAXXContext { * @param klazz the klazz entry * @param name extra name of the entry */ - public <T> void removeContextValue(Class<T> klazz, String name); /** diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java index 5ca926f..54a03a1 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java @@ -5,7 +5,6 @@ package jaxx.runtime; import java.util.Map; -import jaxx.runtime.context.JAXXContext; /** * The <code>JAXXObject</code> interface is implemented by all classes diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java b/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java index 9c5df22..1b61147 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java @@ -53,10 +53,10 @@ import javax.swing.event.TreeSelectionListener; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; -import jaxx.runtime.swing.BooleanCellRenderer; -import jaxx.runtime.swing.EmptyNumberTableCellRenderer; -import jaxx.runtime.swing.EnumTableCellRenderer; -import jaxx.runtime.swing.I18nTableCellRenderer; +import jaxx.runtime.swing.renderer.BooleanCellRenderer; +import jaxx.runtime.swing.renderer.EmptyNumberTableCellRenderer; +import jaxx.runtime.swing.renderer.EnumTableCellRenderer; +import jaxx.runtime.swing.renderer.I18nTableCellRenderer; import jaxx.runtime.swing.Item; import jaxx.runtime.swing.JAXXComboBox; import org.apache.commons.logging.Log; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/Util.java b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java index 9b3f505..3f551e4 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/Util.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java @@ -1,6 +1,5 @@ package jaxx.runtime; -import jaxx.runtime.context.JAXXContext; import jaxx.runtime.context.JAXXContextEntryDef; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java index 483927c..f272292 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java @@ -1,5 +1,6 @@ package jaxx.runtime.context; +import jaxx.runtime.JAXXContext; import jaxx.runtime.*; import java.awt.Container; import java.beans.PropertyChangeListener; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultApplicationContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultApplicationContext.java index d4c2d18..502da7a 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultApplicationContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultApplicationContext.java @@ -118,6 +118,8 @@ public class DefaultApplicationContext extends DefaultJAXXContext { value = super.getContextValue(realClass, name); } + //TC-20091007 TODO Make possible use of named autoload entries + //(add a parameter on AutoLoad annotation) if (value == null) { AutoLoad anno = clazz.getAnnotation(AutoLoad.class); diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java index bcc1a73..9bde7b2 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java @@ -1,5 +1,6 @@ package jaxx.runtime.context; +import jaxx.runtime.JAXXContext; import jaxx.runtime.*; import static jaxx.runtime.context.JAXXContextEntryDef.newDef; import org.apache.commons.logging.Log; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContextEntryDef.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContextEntryDef.java index 0e9db03..54042b4 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContextEntryDef.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContextEntryDef.java @@ -1,5 +1,6 @@ package jaxx.runtime.context; +import jaxx.runtime.JAXXContext; import java.util.Collections; import java.util.List; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXInitialContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXInitialContext.java index a3c1bd2..bc3c1fe 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXInitialContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXInitialContext.java @@ -1,5 +1,6 @@ package jaxx.runtime.context; +import jaxx.runtime.JAXXContext; import java.awt.Container; import java.util.Map.Entry; import jaxx.runtime.JAXXObject; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java index efab228..781f848 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java @@ -11,6 +11,7 @@ import java.net.URL; import java.util.Enumeration; import java.util.HashMap; import java.util.Hashtable; +import java.util.Locale; import java.util.Map; import java.util.Vector; import javax.help.CSH; @@ -19,7 +20,7 @@ import javax.help.HelpSet; import javax.swing.AbstractButton; import javax.swing.SwingUtilities; import javax.swing.UIManager; -import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.JAXXContext; import jaxx.runtime.JAXXObject; import jaxx.runtime.SwingUtil; import org.apache.commons.logging.Log; @@ -35,34 +36,68 @@ import org.apache.commons.logging.LogFactory; public abstract class JaxxHelpBroker<B extends JaxxHelpBroker<?>> { public static final String JAXX_CONTEXT_ENTRY = "jaxxcontext"; - /** to use log facility, just put in your code: log.info(\"...\"); */ + /** + * Logger + */ static private Log log = LogFactory.getLog(JaxxHelpBroker.class); + /** + * name of helpset + */ protected final String helpsetName; + /** + * default id to use if none given + */ protected final String defaultID; + /** + * help key + */ protected final String helpKey; - // Main HelpSet & Broker - protected final HelpSet helpset; - protected final HelpBroker helpBroker; + /** + * helpset to use + */ + protected HelpSet helpset; + /** + * help broker + */ + protected HelpBroker helpBroker; + /** + * current locale used + */ + protected Locale locale; + /** + * cache of cursors modified when in context-sensitive mode + */ protected Hashtable<Component, Cursor> cursors; + /** + * cursor to use in context-sensitive mode + */ protected Cursor onItemCursor; + /** + * cache of component which cursor have been modified + */ protected final Map<Component, String> cache; protected JaxxHelpBroker(String helpsetName, String helpKey, String defaultID) { + this(null, helpsetName, helpKey, defaultID); + } + + protected JaxxHelpBroker(Locale locale, String helpsetName, String helpKey, String defaultID) { if (helpsetName == null) { throw new NullPointerException("parameter helpsetName can not be null!"); } + this.locale = locale; this.helpsetName = helpsetName; this.helpKey = helpKey; this.defaultID = defaultID; cache = new HashMap<Component, String>(); - try { - ClassLoader cl = getClass().getClassLoader(); - URL url = HelpSet.findHelpSet(cl, helpsetName); - helpset = new HelpSet(cl, url); - helpBroker = helpset.createHelpBroker(); - } catch (Exception ee) { - throw new IllegalStateException("could not find help set " + helpsetName + " for reason " + ee.getMessage(), ee); - } +// try { +// ClassLoader cl = getClass().getClassLoader(); +// URL url = HelpSet.findHelpSet(cl, helpsetName, this.locale); +// helpset = new HelpSet(cl, url); +// helpBroker = helpset.createHelpBroker(); +// } catch (Exception ee) { +// throw new IllegalStateException("could not find help set " + helpsetName + " for reason " + ee.getMessage(), ee); +// } } public void prepareUI(JAXXObject c) { @@ -96,6 +131,9 @@ public abstract class JaxxHelpBroker<B extends JaxxHelpBroker<?>> { } public HelpBroker getHelpBroker() { + if (helpBroker == null) { + helpBroker = getHelpset().createHelpBroker(); + } return helpBroker; } @@ -104,6 +142,15 @@ public abstract class JaxxHelpBroker<B extends JaxxHelpBroker<?>> { } public HelpSet getHelpset() { + if (helpset == null) { + try { + ClassLoader cl = getClass().getClassLoader(); + URL url = HelpSet.findHelpSet(cl, helpsetName, this.locale); + helpset = new HelpSet(cl, url); + } catch (Exception ee) { + throw new IllegalStateException("could not find help set " + helpsetName + " for reason " + ee.getMessage(), ee); + } + } return helpset; } @@ -115,6 +162,15 @@ public abstract class JaxxHelpBroker<B extends JaxxHelpBroker<?>> { return defaultID; } + public void setLocale(Locale locale) { + this.locale = locale; + // need to reload helpset and helpbroker + helpset = null; + helpBroker = null; + getHelpset(); + getHelpBroker(); + } + public void showHelpSet() { if (log.isDebugEnabled()) { log.debug(this); diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/JaxxHelpUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpUI.java similarity index 85% rename from jaxx-runtime/src/main/java/jaxx/runtime/JaxxHelpUI.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpUI.java index a47a663..fde1208 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/JaxxHelpUI.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpUI.java @@ -1,7 +1,6 @@ -package jaxx.runtime; +package jaxx.runtime.swing; import java.awt.Component; -import jaxx.runtime.swing.JaxxHelpBroker; /** * diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/MyDefaultCellEditor.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/MyDefaultCellEditor.java similarity index 95% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/MyDefaultCellEditor.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/MyDefaultCellEditor.java index 0d909cd..a7faef9 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/MyDefaultCellEditor.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/MyDefaultCellEditor.java @@ -1,6 +1,4 @@ -package jaxx.runtime.swing; - -import org.nuiton.util.EnumEditor; +package jaxx.runtime.swing.editor; import javax.swing.DefaultCellEditor; import javax.swing.Icon; @@ -10,6 +8,7 @@ import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.table.TableCellEditor; import java.awt.Component; +import jaxx.runtime.swing.editor.EnumEditor; /** * @author chemit @@ -35,7 +34,7 @@ public class MyDefaultCellEditor extends DefaultCellEditor { return new MyDefaultCellEditor(editor); } - public static TableCellEditor newEnumEditor(EnumEditor editor) { + public static TableCellEditor newEnumEditor(EnumEditor<?> editor) { return new MyDefaultCellEditor(editor) { private static final long serialVersionUID = 1L; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java index f87b58d..fa269fc 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java @@ -1,7 +1,7 @@ package jaxx.runtime.swing.navigation; import javax.swing.JTree; -import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.JAXXContext; import jaxx.runtime.context.JAXXContextEntryDef; /** diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java index 1b12ebe..1a79868 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java @@ -6,7 +6,7 @@ import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultTreeSelectionModel; import javax.swing.tree.TreePath; import jaxx.runtime.JAXXAction; -import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.JAXXContext; import jaxx.runtime.context.JAXXInitialContext; import jaxx.runtime.JAXXObject; import org.apache.commons.logging.Log; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java index ae94155..5e96f5d 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java @@ -1,6 +1,6 @@ package jaxx.runtime.swing.navigation; -import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.JAXXContext; import jaxx.runtime.JAXXObject; import jaxx.runtime.swing.CardLayout2; import org.apache.commons.logging.Log; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java index 6e73d79..11d0317 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java @@ -4,7 +4,7 @@ import java.lang.reflect.InvocationTargetException; import java.util.regex.Pattern; import javax.swing.JTree; import javax.swing.tree.TreePath; -import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.JAXXContext; import jaxx.runtime.JAXXObject; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java index 239b623..f975dd1 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java @@ -1,6 +1,6 @@ package jaxx.runtime.swing.navigation; -import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.JAXXContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java index 7b5c1bd..6937e91 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java @@ -2,7 +2,7 @@ package jaxx.runtime.swing.navigation; import java.util.Enumeration; import jaxx.runtime.JAXXAction; -import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.JAXXContext; import jaxx.runtime.context.JAXXContextEntryDef; import jaxx.runtime.JAXXObject; import jaxx.runtime.decorator.Decorator; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNode.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNode.java index 932b0ed..9e07697 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNode.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNode.java @@ -4,7 +4,7 @@ import java.util.Enumeration; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreeNode; import jaxx.runtime.JAXXAction; -import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.JAXXContext; import jaxx.runtime.context.JAXXContextEntryDef; import jaxx.runtime.JAXXObject; import org.apache.commons.jxpath.JXPathContext; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/BooleanCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/BooleanCellRenderer.java similarity index 98% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/BooleanCellRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/BooleanCellRenderer.java index 85187a3..5760d7a 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/BooleanCellRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/BooleanCellRenderer.java @@ -1,4 +1,4 @@ -package jaxx.runtime.swing; +package jaxx.runtime.swing.renderer; import javax.swing.Icon; import javax.swing.JCheckBox; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/EmptyNumberTableCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/EmptyNumberTableCellRenderer.java similarity index 96% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/EmptyNumberTableCellRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/EmptyNumberTableCellRenderer.java index d7876e7..9cc4a68 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/EmptyNumberTableCellRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/EmptyNumberTableCellRenderer.java @@ -1,4 +1,4 @@ -package jaxx.runtime.swing; +package jaxx.runtime.swing.renderer; import javax.swing.JTable; import javax.swing.table.TableCellRenderer; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/EnumTableCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/EnumTableCellRenderer.java similarity index 97% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/EnumTableCellRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/EnumTableCellRenderer.java index 3e89df9..9c88e56 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/EnumTableCellRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/EnumTableCellRenderer.java @@ -1,4 +1,4 @@ -package jaxx.runtime.swing; +package jaxx.runtime.swing.renderer; import javax.swing.JTable; import javax.swing.table.TableCellRenderer; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/I18nTableCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/I18nTableCellRenderer.java similarity index 98% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/I18nTableCellRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/I18nTableCellRenderer.java index 3f6fa7a..9b8100e 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/I18nTableCellRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/I18nTableCellRenderer.java @@ -1,4 +1,4 @@ -package jaxx.runtime.swing; +package jaxx.runtime.swing.renderer; import static org.nuiton.i18n.I18n._; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/LocaleListCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/LocaleListCellRenderer.java similarity index 99% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/LocaleListCellRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/LocaleListCellRenderer.java index 18537f9..d0bad56 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/LocaleListCellRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/LocaleListCellRenderer.java @@ -1,4 +1,4 @@ -package jaxx.runtime.swing; +package jaxx.runtime.swing.renderer; import java.awt.Component; import java.util.HashMap; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java index c7c3c3b..52d26e7 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java @@ -1,7 +1,7 @@ package jaxx.runtime.swing.wizard; import javax.swing.SwingWorker; -import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.JAXXContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java index aefe8cd..b5e2e0b 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java @@ -4,7 +4,7 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.Date; import javax.swing.SwingWorker.StateValue; -import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.JAXXContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java index a140d1f..0769eac 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java @@ -2,7 +2,7 @@ package jaxx.runtime.swing.wizard; import java.awt.Window; import javax.swing.ImageIcon; -import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.JAXXContext; import jaxx.runtime.context.JAXXInitialContext; import jaxx.runtime.JAXXObject; import org.apache.commons.beanutils.ConstructorUtils; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultJAXXContextTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultJAXXContextTest.java index 70dae65..3c22bb1 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultJAXXContextTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultJAXXContextTest.java @@ -1,5 +1,6 @@ package jaxx.runtime.context; +import jaxx.runtime.JAXXContext; import jaxx.runtime.*; import org.junit.Assert; import org.junit.Before; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java index 9699cf2..a83912d 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java @@ -4,7 +4,7 @@ import jaxx.runtime.swing.navigation.NavigationTreeNode; import jaxx.runtime.swing.navigation.NavigationTreeModel; import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder; import jaxx.runtime.context.DefaultJAXXContext; -import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.JAXXContext; import jaxx.runtime.context.JAXXContextEntryDef; import org.junit.Assert; import org.junit.Test; @@ -85,7 +85,7 @@ public class NavigationTreeModelTest { } /** - * Test the {@link NavigationTreeModel#getJAXXContextValue(jaxx.runtime.context.JAXXContext, String)} with an entry point + * Test the {@link NavigationTreeModel#getJAXXContextValue(jaxx.runtime.JAXXContext, String)} with an entry point * as a bean. * <p/> * Tree is like this @@ -205,7 +205,7 @@ public class NavigationTreeModelTest { } /** - * Test the {@link NavigationTreeModel#getJAXXContextValue(jaxx.runtime.context.JAXXContext, String)} with an entry point + * Test the {@link NavigationTreeModel#getJAXXContextValue(jaxx.runtime.JAXXContext, String)} with an entry point * as a list. * <p/> * Tree is like this diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/ColumnSelector.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/ColumnSelector.jaxx index 26c47b4..894ec2c 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/ColumnSelector.jaxx +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/ColumnSelector.jaxx @@ -44,7 +44,7 @@ <script><![CDATA[ import javax.swing.table.TableColumn; import javax.swing.table.TableCellRenderer; -import jaxx.runtime.swing.I18nTableCellRenderer; +import jaxx.runtime.swing.renderer.I18nTableCellRenderer; public static final String TABLE_PROPERTY = "myTable"; public static final String POPUP_VISIBLE_PROPERTY = "popupVisible"; diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx index 78d4d4d..8ff7a16 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx @@ -42,7 +42,7 @@ <Locale id='selectedLocale' javaBean='Locale.getDefault()'/> - <jaxx.runtime.swing.LocaleListCellRenderer id='renderer' + <jaxx.runtime.swing.renderer.LocaleListCellRenderer id='renderer' showIcon='{isShowIcon()}' showText='{isShowText()}' javaBean='new LocaleListCellRenderer(showIcon , showText)'/> @@ -71,7 +71,7 @@ <script><![CDATA[ import java.util.Locale; import jaxx.runtime.SwingUtil; -import jaxx.runtime.swing.LocaleListCellRenderer; +import jaxx.runtime.swing.renderer.LocaleListCellRenderer; import static org.nuiton.i18n.I18n.n_; public static final String DEFAULT_SELECTED_TOOLTIP = n_("i18neditor.selected"); diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java index a5a84e7..d1cc9f0 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java @@ -32,7 +32,7 @@ import javax.swing.JDialog; import javax.swing.JOptionPane; import javax.swing.JRootPane; import javax.swing.KeyStroke; -import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.JAXXContext; import jaxx.runtime.context.JAXXInitialContext; import jaxx.runtime.SwingUtil; @@ -59,7 +59,7 @@ public class ConfigUIBuilder { * @param defaultCategory la categorie a selectionner * @return l'ui instanciate */ - public static ConfigUI newConfigUI(jaxx.runtime.context.JAXXContext parentContext, final ConfigUIModel model, String defaultCategory) { + public static ConfigUI newConfigUI(jaxx.runtime.JAXXContext parentContext, final ConfigUIModel model, String defaultCategory) { JAXXContext tx = new JAXXInitialContext().add(parentContext).add(model); final ConfigUI ui = new ConfigUI(tx); diff --git a/maven-jaxx-plugin/pom.xml b/maven-jaxx-plugin/pom.xml index 36922fd..ff20a08 100644 --- a/maven-jaxx-plugin/pom.xml +++ b/maven-jaxx-plugin/pom.xml @@ -57,6 +57,11 @@ <artifactId>maven-helper-plugin</artifactId> </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-velocity</artifactId> + </dependency> + <!-- pour acceder aux BeansInfos swing via Introspector --> <dependency> <groupId>com.sun</groupId> @@ -67,26 +72,18 @@ </dependency> <!-- tests dependencies --> -<!-- - <dependency> - <groupId>org.apache.maven.shared</groupId> - <artifactId>maven-plugin-testing-harness</artifactId> - <version>1.1</version> - <scope>test</scope> - </dependency> ---> + <dependency> <groupId>org.apache.maven.shared</groupId> <artifactId>maven-verifier</artifactId> - <version>1.0</version> - <scope>test</scope> </dependency> - <dependency> + <!-- <dependency> <groupId>org.apache.velocity</groupId> <artifactId>velocity</artifactId> <version>1.5</version> - </dependency> + </dependency>--> + <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java index 497edaa..daac7f5 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java @@ -25,7 +25,7 @@ import jaxx.compiler.beans.BeanInfoUtil; import jaxx.compiler.decorators.CompiledObjectDecorator; import jaxx.compiler.decorators.HelpRootCompiledObjectDecorator; import jaxx.compiler.tags.TagManager; -import jaxx.runtime.context.JAXXContext; +import jaxx.runtime.JAXXContext; import org.apache.maven.artifact.Artifact; import org.apache.maven.model.Resource; @@ -98,7 +98,7 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi */ protected String validatorFQN; /** - * the name of implementation of {@link jaxx.runtime.context.JAXXContext} + * the name of implementation of {@link jaxx.runtime.JAXXContext} * to be used on {@link jaxx.runtime.JAXXObject}. * <p/> * Must not be abstract. diff --git a/pom.xml b/pom.xml index e35291c..8e3ebe3 100644 --- a/pom.xml +++ b/pom.xml @@ -26,8 +26,6 @@ <module>jaxx-widgets</module> - <!-- deprecated since 1.7.2, will be removed before 2.0.0 - <module>jaxx-example</module--> <module>jaxx-demo</module> </modules> @@ -257,6 +255,26 @@ <artifactId>log4j</artifactId> <version>1.2.14</version> </dependency> + + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-velocity</artifactId> + <version>1.1.7</version> + <exclusions> + <exclusion> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-container-default</artifactId> + </exclusion> + <exclusion> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-component-api</artifactId> + </exclusion> + <exclusion> + <groupId>velocity</groupId> + <artifactId>velocity</artifactId> + </exclusion> + </exclusions> + </dependency> <dependency> <groupId>junit</groupId> @@ -266,6 +284,13 @@ </dependency> <dependency> + <groupId>org.apache.maven.shared</groupId> + <artifactId>maven-verifier</artifactId> + <version>1.0</version> + <scope>test</scope> + </dependency> + + <dependency> <groupId>org.apache.maven.plugin-testing</groupId> <artifactId>maven-plugin-testing-harness</artifactId> <version>1.2</version> diff --git a/src/site/rst/JAXXContext.rst b/src/site/rst/JAXXContext.rst index 5175ffc..c606cda 100644 --- a/src/site/rst/JAXXContext.rst +++ b/src/site/rst/JAXXContext.rst @@ -13,7 +13,7 @@ Ajout d'un context applicatif dans JAXX. Le besoin initial de ce développement est de pouvoir facilement intégrer un context applicatif dans JAXX et de pouvoir l'utiliser dans les fichiers JAXX pour injecter par exemple des données dans les widgets. -jaxx.runtime.context.JAXXContext +jaxx.runtime.JAXXContext ======================== Il s'agit du contrat de base du context applicatif. diff --git a/src/site/rst/migration.rst b/src/site/rst/migration.rst index 834d189..7898c89 100644 --- a/src/site/rst/migration.rst +++ b/src/site/rst/migration.rst @@ -15,7 +15,7 @@ Nouvelles fonctionnalités * JList, JComboBox et JTree n'acceptent plus de fils Item (utiliser JAXXList, JAXXComboBox, JAXXTree). - * changement de paquetage de jaxx.runtime.JAXXContext vers jaxx.runtime.context.JAXXContext + * changement de paquetage de jaxx.runtime.JAXXContext vers jaxx.runtime.JAXXContext * changement de paquetage de jaxx.runtime.\*Decorator vers jaxx.runtime.decorator.\*Decorator -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 9747dbc86ffa84cb7177af414923bba6e40157c2 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 8 16:48:27 2009 +0000 evolution #78 : rendre le système d'aide multi-langue + JAXXContext is returned to jaxx.runtime package --- .../java/jaxx/compiler/CompilerConfiguration.java | 32 +- .../compiler/DefaultCompilerConfiguration.java | 71 +- .../HelpRootCompiledObjectDecorator.java | 4 +- .../src/main/java/jaxx/runtime/JAXXContext.java | 4 + .../jaxx/runtime/context/DefaultJAXXContext.java | 20 +- .../JAXXHelpBroker.java} | 76 +- .../{JaxxHelpUI.java => help/JAXXHelpUI.java} | 8 +- .../jaxx/runtime/swing/help/JAXXHelpUIHandler.java | 12 + .../org/nuiton/jaxx/plugin/AbstractJaxxMojo.java | 81 +-- .../org/nuiton/jaxx/plugin/GenerateHelpMojo.java | 520 ++++++++++++++ .../{JaxxGeneratorMojo.java => GenerateMojo.java} | 63 +- .../nuiton/jaxx/plugin/JaxxHelpGeneratorMojo.java | 780 --------------------- .../java/org/nuiton/jaxx/plugin/XmlHelper.java | 187 +++++ .../src/main/resources/defaultContent.html.vm | 4 +- .../src/main/resources/defaultHelpSet.hs.vm | 10 +- .../java/org/nuiton/jaxx/plugin/Bug1751Test.java | 2 +- .../java/org/nuiton/jaxx/plugin/CompilerTest.java | 14 +- .../nuiton/jaxx/plugin/CompilerValidatorTest.java | 2 +- .../java/org/nuiton/jaxx/plugin/DecoratorTest.java | 2 +- .../org/nuiton/jaxx/plugin/Evolution74Test.java | 4 +- .../test/java/org/nuiton/jaxx/plugin/I18nTest.java | 6 +- .../java/org/nuiton/jaxx/plugin/JaxxBaseTest.java | 8 +- 22 files changed, 861 insertions(+), 1049 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java index 7349bb8..eee1681 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java @@ -14,7 +14,7 @@ public interface CompilerConfiguration { /** * - * @return the class loader to use by compilers + * @return the class loader used by compilers */ ClassLoader getClassLoader(); @@ -51,36 +51,6 @@ public interface CompilerConfiguration { /** * - * @return the name of the help set to generate - */ - String getHelpSetName(); - - /** - * - * @return the prefix of i18n keys to use in help system - */ - String getHelpsetI18nPrefix(); - - /** - * - * @return the suffix of i18n keys to use in index of help system - */ - String getHelpsetIndexI18nSuffix(); - - /** - * - * @return the suffix of i18n keys to use in title of the help system - */ - String getHelpsetTitleI18nSuffix(); - - /** - * - * @return the suffix of i18n keys to use in toc of the help system - */ - String getHelpsetTocI18nSuffix(); - - /** - * * @return the type of context to use in each generated jaxx object */ Class<? extends JAXXContext> getJaxxContextClass(); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java b/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java index 00e61d2..eb06347 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java @@ -13,24 +13,20 @@ import jaxx.runtime.JAXXContext; */ public class DefaultCompilerConfiguration implements CompilerConfiguration { -// private File javacTargetDirectory; -// private String classPath; -// private String javacOpts; -// private boolean keepJavaFiles; /** - * + * where to generate */ private File targetDirectory; /** - * + * flag to optimize generated code */ private boolean optimize; /** - * + * verbose flag */ private boolean verbose; /** - * + * to do a profile pass after generation */ private boolean profile; /** @@ -59,11 +55,11 @@ public class DefaultCompilerConfiguration implements CompilerConfiguration { */ private Class<?> defaultErrorUI; /** - * + * class loader to use in compiler */ private ClassLoader classLoader; /** - * + * the compiler class to use */ private Class<? extends JAXXCompiler> compilerClass; /** @@ -90,36 +86,6 @@ public class DefaultCompilerConfiguration implements CompilerConfiguration { * since this class should be in sources (so not yet compiled) */ private String helpBrokerFQN; - /** - * The prefix to add to i18n key for any help i18n key. - * - * @since 1.3 - */ - protected String helpsetI18nPrefix; - /** - * The suffix to add to i18n key for an help Id. - * - * @since 1.3 - */ - protected String helpsetTitleI18nSuffix; - /** - * The suffix to add to i18n key for an toc Id. - * - * @since 1.3 - */ - protected String helpsetTocI18nSuffix; - /** - * The suffix to add to i18n key for an toc Id. - * - * @since 1.3 - */ - protected String helpsetIndexI18nSuffix; - /** - * The helpset name - * - * @since 1.3 - */ - protected String helpSetName; @Override public File getTargetDirectory() { @@ -211,31 +177,6 @@ public class DefaultCompilerConfiguration implements CompilerConfiguration { } @Override - public String getHelpsetIndexI18nSuffix() { - return helpsetIndexI18nSuffix; - } - - @Override - public String getHelpsetTitleI18nSuffix() { - return helpsetTitleI18nSuffix; - } - - @Override - public String getHelpsetTocI18nSuffix() { - return helpsetTocI18nSuffix; - } - - @Override - public String getHelpSetName() { - return helpSetName; - } - - @Override - public String getHelpsetI18nPrefix() { - return helpsetI18nPrefix; - } - - @Override public Class<?> getValidatorClass() { return validatorClass; } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java index 3ea6337..44d7c99 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java @@ -44,8 +44,8 @@ public class HelpRootCompiledObjectDecorator extends DefaultCompiledObjectDecora if (options.isGenerateHelp()) { - // add JaxxHelpUI interface - Class<?> validatorInterface = jaxx.runtime.swing.JaxxHelpUI.class; + // add JAXXHelpUI interface + Class<?> validatorInterface = jaxx.runtime.swing.help.JAXXHelpUI.class; String helpBrokerFQN = getBrokerFQN(compiler); javaFile.addInterface(JAXXCompiler.getCanonicalName(validatorInterface) + "<" + helpBrokerFQN + ">"); diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java index 5fa6725..6609d60 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java @@ -91,7 +91,9 @@ public interface JAXXContext { * @param <O> type of container to obtain from context * @param clazz clazz desired * @return parent's container + * @deprecated since 2.0.0 : breaks neutral since Swing */ + @Deprecated public <O extends Container> O getParentContainer(Class<O> clazz); /** @@ -101,6 +103,8 @@ public interface JAXXContext { * @param top the top container * @param clazz desired * @return parent's container + * @deprecated since 2.0.0 : breaks neutral since Swing */ + @Deprecated public <O extends Container> O getParentContainer(Object top, Class<O> clazz); } diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java index 9bde7b2..fc08f0f 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java @@ -1,6 +1,5 @@ package jaxx.runtime.context; -import jaxx.runtime.JAXXContext; import jaxx.runtime.*; import static jaxx.runtime.context.JAXXContextEntryDef.newDef; import org.apache.commons.logging.Log; @@ -25,14 +24,25 @@ import java.util.Map.Entry; */ public class DefaultJAXXContext implements JAXXContext { + /** + * entry of the parent context + */ protected static final JAXXContextEntryDef<JAXXContext> PARENT_CONTEXT_ENTRY = newDef(JAXXContext.class); - /** to use log facility, just put in your code: log.info(\"...\"); */ + /** + * Logger + */ static private final Log log = LogFactory.getLog(DefaultJAXXContext.class); - /** l'ui auquel est rattache le context */ + /** + * l'ui auquel est rattache le context + */ protected JAXXObject ui; - /** le context parent */ + /** + * le context parent + */ protected JAXXContext parentContext; - /** les données contenues dans le context */ + /** + * les données contenues dans le context + */ protected final Map<JAXXContextEntryDef<?>, Object> data; public DefaultJAXXContext() { diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpBroker.java similarity index 92% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpBroker.java index 781f848..b964937 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpBroker.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpBroker.java @@ -1,4 +1,4 @@ -package jaxx.runtime.swing; +package jaxx.runtime.swing.help; import java.applet.Applet; import java.awt.*; @@ -29,17 +29,16 @@ import org.apache.commons.logging.LogFactory; /** * La classe pour encapsuler l'aide de l'application. * - * @param <B> le type de broker * @author tony * @since 1.4 */ -public abstract class JaxxHelpBroker<B extends JaxxHelpBroker<?>> { +public class JAXXHelpBroker { public static final String JAXX_CONTEXT_ENTRY = "jaxxcontext"; /** * Logger */ - static private Log log = LogFactory.getLog(JaxxHelpBroker.class); + static private Log log = LogFactory.getLog(JAXXHelpBroker.class); /** * name of helpset */ @@ -76,28 +75,28 @@ public abstract class JaxxHelpBroker<B extends JaxxHelpBroker<?>> { * cache of component which cursor have been modified */ protected final Map<Component, String> cache; + /** + * help ui handler + */ + protected JAXXHelpUIHandler handler; - protected JaxxHelpBroker(String helpsetName, String helpKey, String defaultID) { - this(null, helpsetName, helpKey, defaultID); + public JAXXHelpBroker(String helpsetName, String helpKey, String defaultID, JAXXHelpUIHandler handler) { + this(null, helpsetName, helpKey, defaultID, handler); } - protected JaxxHelpBroker(Locale locale, String helpsetName, String helpKey, String defaultID) { + public JAXXHelpBroker(Locale locale, String helpsetName, String helpKey, String defaultID, JAXXHelpUIHandler handler) { if (helpsetName == null) { throw new NullPointerException("parameter helpsetName can not be null!"); } + if (handler == null) { + throw new NullPointerException("handler can not be null"); + } this.locale = locale; this.helpsetName = helpsetName; this.helpKey = helpKey; this.defaultID = defaultID; - cache = new HashMap<Component, String>(); -// try { -// ClassLoader cl = getClass().getClassLoader(); -// URL url = HelpSet.findHelpSet(cl, helpsetName, this.locale); -// helpset = new HelpSet(cl, url); -// helpBroker = helpset.createHelpBroker(); -// } catch (Exception ee) { -// throw new IllegalStateException("could not find help set " + helpsetName + " for reason " + ee.getMessage(), ee); -// } + this.handler = handler; + this.cache = new HashMap<Component, String>(); } public void prepareUI(JAXXObject c) { @@ -109,25 +108,37 @@ public abstract class JaxxHelpBroker<B extends JaxxHelpBroker<?>> { AbstractButton help = getShowHelpButton(c); if (help == null) { - if (log.isDebugEnabled()) { - log.debug("no showButton detected for " + c.getClass()); - } - } else { - - // attach context to button - help.putClientProperty(JAXX_CONTEXT_ENTRY, c.getDelegateContext()); + // no showHelp button + return; + } - // add tracking action - ActionListener listener = getShowHelpAction(); - if (log.isDebugEnabled()) { - log.debug("adding tracking action " + listener); - } - help.addActionListener(listener); + // attach context to button + if (log.isDebugEnabled()) { + log.debug("attach context to showhelp button " + c); + } + help.putClientProperty(JAXX_CONTEXT_ENTRY, c); + // add tracking action + ActionListener listener = getShowHelpAction(); + if (log.isDebugEnabled()) { + log.debug("adding tracking action " + listener); } + help.addActionListener(listener); + if (log.isDebugEnabled()) { log.debug("done for " + c); } + + + getHelpBroker().enableHelpKey(((Component) c), getDefaultID(), getHelpset()); + } + + public void showHelp(JAXXContext context, String helpId) { + getHandler().showHelp(context, this, helpId); + } + + public JAXXHelpUIHandler getHandler() { + return handler; } public HelpBroker getHelpBroker() { @@ -145,7 +156,7 @@ public abstract class JaxxHelpBroker<B extends JaxxHelpBroker<?>> { if (helpset == null) { try { ClassLoader cl = getClass().getClassLoader(); - URL url = HelpSet.findHelpSet(cl, helpsetName, this.locale); + URL url = HelpSet.findHelpSet(cl, helpsetName, locale); helpset = new HelpSet(cl, url); } catch (Exception ee) { throw new IllegalStateException("could not find help set " + helpsetName + " for reason " + ee.getMessage(), ee); @@ -175,10 +186,7 @@ public abstract class JaxxHelpBroker<B extends JaxxHelpBroker<?>> { if (log.isDebugEnabled()) { log.debug(this); } - new CSH.DisplayHelpFromSource(helpBroker); - } - - public void showHelp(JAXXContext context, String helpId) { + new CSH.DisplayHelpFromSource(getHelpBroker()); } public void installUI(Component comp, String helpId) { diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUI.java similarity index 57% rename from jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpUI.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUI.java index fde1208..9af8afa 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JaxxHelpUI.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUI.java @@ -1,18 +1,18 @@ -package jaxx.runtime.swing; +package jaxx.runtime.swing.help; import java.awt.Component; /** * - * Contract to be added on JAXXObject wihch wants to use javax help. + * Contract to be added on JAXXObject which wants to use javax help. * * @param <B> type of broker. * * @author tony * @since 1.3 - * @see JaxxHelpBroker + * @see JAXXHelpBroker */ -public interface JaxxHelpUI<B extends JaxxHelpBroker<?>> { +public interface JAXXHelpUI<B extends JAXXHelpBroker> { B getBroker(); diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUIHandler.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUIHandler.java new file mode 100644 index 0000000..d8077c7 --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUIHandler.java @@ -0,0 +1,12 @@ +package jaxx.runtime.swing.help; + +import jaxx.runtime.JAXXContext; + +/** + * + * @author chemit + */ +public interface JAXXHelpUIHandler { + + void showHelp(JAXXContext context, JAXXHelpBroker broker, String helpID); +} diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java index a53fed0..c55360f 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java @@ -41,12 +41,6 @@ public abstract class AbstractJaxxMojo extends AbstractPlugin { */ protected MavenProject project; /** - * Repertoire de destination des fichiers java a generer. - * - * @parameter expression="${jaxx.outJava}" default-value="${basedir}/target/generated-sources/java" - */ - protected File outJava; - /** * verbose flag * * @parameter expression="${jaxx.verbose}" default-value="false" @@ -55,72 +49,15 @@ public abstract class AbstractJaxxMojo extends AbstractPlugin { */ protected boolean verbose; /** - * to make compiler i18nable, says add the {@link org.nuiton.i18n.I18n#_(String, Object[])} method - * invocation on {@link jaxx.compiler.I18nHelper#I18N_ATTRIBUTES} attributes. - * - * @parameter expression="${jaxx.i18nable}" default-value="true" - * @see jaxx.compiler.I18nHelper - */ - protected boolean i18nable; - /** - * The store of helpIds generated by {@link JaxxGeneratorMojo}. - * <p/> - * - * @parameter expression="${jaxx.helpIdStore}" default-value="target/helpIds.properties" - * @required - * - * @since 1.3 - */ - protected File helpIdStore; - /** - * The name of the helpset to generate. - * - * @parameter expression="${jaxx.helpSetName}" default-value="${project.artifactId}" - * @required - * - * @since 1.3 - */ - protected String helpSetName; - /** - * The prefix to add to i18n key for any help i18n key. - * - * @parameter expression="${jaxx.helpsetI18nPrefix}" default-value="${jaxx.helpSetName}.help." - * @required - * - * @since 1.3 - */ - protected String helpsetI18nPrefix; - /** - * The suffix to add to i18n key for an help Id. - * - * @parameter expression="${jaxx.helpsetTitleI18nSuffix}" default-value=".title" - * @required - * - * @since 1.3 - */ - protected String helpsetTitleI18nSuffix; - /** - * The suffix to add to i18n key for an toc Id. - * - * @parameter expression="${jaxx.helpsetTocI18nSuffix}" default-value=".toc" - * @required - * - * @since 1.3 - */ - protected String helpsetTocI18nSuffix; - /** - * The suffix to add to i18n key for an toc Id. - * - * @parameter expression="${jaxx.helpsetIndexI18nSuffix}" default-value=".index" + * The store of helpIds generated by the goal {@link GenerateMojo} and then + * used by the goal {@link GenerateHelpMojo}. + * + * @parameter expression="${jaxx.helpIdsStore}" default-value="target/helpIds.properties" * @required * * @since 1.3 */ - protected String helpsetIndexI18nSuffix; - /** - * - */ - protected ClassLoader cl; + protected File helpIdsStore; @Override protected boolean checkPackaging() { @@ -146,4 +83,12 @@ public abstract class AbstractJaxxMojo extends AbstractPlugin { public void setVerbose(boolean verbose) { this.verbose = verbose; } + + public File getHelpIdsStore() { + return helpIdsStore; + } + + public void setHelpIdsStore(File helpIdsStore) { + this.helpIdsStore = helpIdsStore; + } } diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java new file mode 100644 index 0000000..559c565 --- /dev/null +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java @@ -0,0 +1,520 @@ +/* *##% + * Copyright (C) 2007 + * JaxxPlugin, Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ +package org.nuiton.jaxx.plugin; + +import org.apache.maven.plugin.MojoFailureException; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.net.URL; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import java.util.Locale; +import java.util.Properties; +import org.nuiton.i18n.I18n; +import org.nuiton.util.FileUtil; +import org.nuiton.util.SortedProperties; + +/** + * Mojo to generate javax help stuff for your project. + * + * HelpIds should have been discovered by the JaxxMojo. + * + * @author chemit + * @goal generate-help + * @phase process-sources + * + * @requiresProject + * @requiresDependencyResolution compile + * @since 1.3 + */ +public class GenerateHelpMojo extends AbstractJaxxMojo { + + private static final String AUTOREMOVE_LINE = "REMOVE THS LINE TO DISABLE AUTO-REGENERATE THE FILE"; + /** + * The directory where to generate help files. + * + * @parameter expression="${jaxx.outHelp}" default-value="${project.basedir}/src/main/help" + * @required + * + * @since 1.3 + */ + protected File outHelp; + /** + * The locales to generate for help, seprated by comma. + * + * The first locale given is the default locale. + * + * @parameter expression="${jaxx.locales}" + * @required + * + * @since 2.0.0 + */ + protected String locales; + /** + * The name of the helpset to generate. + * + * @parameter expression="${jaxx.helpsetName}" default-value="${project.artifactId}" + * @required + * + * @since 1.3 + */ + protected String helpsetName; + /** + * The template used to generate helpset file. + * + * Must be an existing file or a ressource in classp-ath + * + * @parameter expression="${jaxx.helpsetTemplate}" default-value="/defaultHelpSet.hs.vm" + * @required + * + * @since 1.3 + */ + protected File helpsetTemplate; + /** + * The template used to generate helpset map file. + * + * Must be an existing file or a ressource in classp-ath + * + * @parameter expression="${jaxx.mapTemplate}" default-value="/defaultMap.jhm.vm" + * @required + * + * @since 1.3 + */ + protected File mapTemplate; + /** + * The template used to generate helpset index file. + * + * Must be an existing file or a ressource in classp-ath + * + * @parameter expression="${jaxx.indexTemplate}" default-value="/defaultIndex.xml.vm" + * @required + * + * @since 1.3 + */ + protected File indexTemplate; + /** + * The template used to generate helpset toc file. + * + * Must be an existing file or a ressource in classp-ath + * + * @parameter expression="${jaxx.tocTemplate}" default-value="/defaultToc.xml.vm" + * @required + * + * @since 1.3 + */ + protected File tocTemplate; + /** + * The template used to generate helpset content file. + * + * Must be an existing file or a ressource in classp-ath + * + * @parameter expression="${jaxx.contentTemplate}" default-value="/defaultContent.html.vm" + * @required + * + * @since 1.3 + */ + protected File contentTemplate; + /** + * The help ids discovered in {@link #helpIdsStore} files. + */ + private Properties helpIds; + /** + * Default locale (the first locale in {@link #localesToTreate}. + */ + private Locale defaultLocale; + /** + * Locales to treate + */ + private Locale[] localesToTreate; + + @Override + public boolean init() throws Exception { + + File idsStore = getHelpIdsStore(); + + if (!idsStore.exists()) { + getLog().info("no helpIdStore to react at " + idsStore); + return false; + } + + if (locales == null || locales.trim().isEmpty()) { + throw new MojoFailureException("You must set the 'locales' property properly (was " + locales + ")."); + } + + // check there is a outHelp + if (outHelp == null) { + throw new MojoFailureException("You must set the 'target' property."); + } + + List<Locale> tmp = new ArrayList<Locale>(); + for (String loc : locales.split(",")) { + Locale l = I18n.newLocale(loc); + tmp.add(l); + } + + if (tmp.isEmpty()) { + throw new MojoFailureException("you must set the 'locales' property."); + } + + localesToTreate = tmp.toArray(new Locale[tmp.size()]); + defaultLocale = localesToTreate[0]; + + // check ressources + checkResource(helpsetTemplate); + checkResource(mapTemplate); + checkResource(indexTemplate); + checkResource(tocTemplate); + checkResource(contentTemplate); + + if (!outHelp.exists()) { + getLog().info("mkdir " + outHelp); + outHelp.mkdirs(); + } + + helpIds = new SortedProperties(); + + InputStream stream = new FileInputStream(idsStore); + + try { + helpIds.load(stream); + } finally { + if (stream != null) { + stream.close(); + } + } + + if (helpIds.isEmpty()) { + + // no ids detected + getLog().warn("No helpIds detected, will skip."); + return false; + } + + return true; + } + + @Override + public void doAction() throws Exception { + + int touchedFiles = 0; + + String mapFileName = helpsetName + "Map.jhm"; + String indexFileName = helpsetName + "Index.xml"; + String tocFileName = helpsetName + "TOC.xml"; + + for (Locale locale : localesToTreate) { + + boolean isDefaultLocale = locale == defaultLocale; + + String language = locale.getLanguage(); + + String localePath = (isDefaultLocale ? "default" : language); + + File localizedTarget = new File(outHelp, localePath); + + if (!localizedTarget.exists()) { + localizedTarget.mkdirs(); + } + getLog().info("Generate help for language " + language); + getLog().info(" Localized target : " + localizedTarget); + + Properties env = new Properties(); + + env.put("helpSetName", helpsetName); + env.put("locale", language); + env.put("localePath", localePath); + env.put("separator", " "); + env.put("autoremoveLine", AUTOREMOVE_LINE); + + String localeSuffix = isDefaultLocale ? "" : "_" + language; + String helpsetFileName = helpsetName + localeSuffix + ".hs"; + + env.put("helpSetFileName", helpsetFileName); + + env.put("mapFileName", mapFileName); + env.put("indexFileName", indexFileName); + env.put("tocFileName", tocFileName); +// env.put("searchData", localePath + "/index"); + + // --------------------------------------------------------------- + // --- main helpset file ----------------------------------------- + // --------------------------------------------------------------- + + File file = new File(outHelp, helpsetFileName); + + boolean doCreate = generateHelpsetFile(file, env); + + if (doCreate) { + touchedFiles++; + } + + // --------------------------------------------------------------- + // --- helpset map file ------------------------------------------ + // --------------------------------------------------------------- + + file = new File(localizedTarget, mapFileName); + + Properties mergedHelpIds = generateMapFile(file, env); + touchedFiles++; + + // --------------------------------------------------------------- + // --- helpset index file ---------------------------------------- + // --------------------------------------------------------------- + + file = new File(localizedTarget, indexFileName); + + NodeItem indexRootItem = generateIndexFile(file, env); + touchedFiles++; + + // --------------------------------------------------------------- + // --- helpset toc file ------------------------------------------ + // --------------------------------------------------------------- + + file = new File(localizedTarget, tocFileName); + + NodeItem tocRootItem = generateTocFile(file, env); + touchedFiles++; + + // --------------------------------------------------------------- + // --- helpset content files ------------------------------------- + // --------------------------------------------------------------- + + touchedFiles += generateContentFiles(localizedTarget, env, localePath); + + } + + getLog().info(touchedFiles + " file(s) treated."); + } + + protected int generateContentFiles(File localizedTarget, Properties env, String localePath) throws Exception { + + int touchedFiles = 0; + TemplateGenerator gen = prepareGenerator(contentTemplate); + Enumeration<?> keys = helpIds.keys(); + while (keys.hasMoreElements()) { + String key = (String) keys.nextElement(); + String url = (String) helpIds.get(key); + url = helpsetName + File.separator + url; + File f = new File(localizedTarget, url); + boolean exist = f.exists(); + if (exist) { + // check if there is a autoremoveLine in content + String content = FileUtil.readAsString(f); + if (!content.contains(AUTOREMOVE_LINE)) { + // no regenerate marker detected, so skip this file + if (verbose) { + getLog().debug("skip existing file " + f); + } + continue; + } + } + f.getParentFile().mkdirs(); + if (verbose) { + if (exist) { + getLog().info("regenerate content file " + f); + } else { + getLog().info("generate content file " + f); + } + } + env.put("helpId", key); + env.put("helpIdUrl", localePath + "/" + url); + gen.generate(env, f); + touchedFiles++; + } + return touchedFiles; + } + + protected boolean generateHelpsetFile(File file, Properties env) throws Exception { + + if (file.exists()) { + // check the autoremove line presence + String content = FileUtil.readAsString(file); + if (!content.contains(AUTOREMOVE_LINE)) { + // no regenerate marker detected, so skip this file + if (verbose) { + getLog().info("skip existing helpset main file " + file); + } + return false; + } + } + + if (verbose) { + if (file.exists()) { + getLog().info("regenerate helpset main file " + file); + } else { + getLog().info("generate helpset main file " + file); + } + } + doGen(helpsetTemplate, file, env); + return true; + } + + protected Properties generateMapFile(File file, Properties env) throws Exception { + + boolean create; + + Properties mergedHelpIds = null; + if (file.exists()) { + + // get back the exisiting data and merge it with incoming ones + + if (verbose) { + getLog().info("loading existing helpset map file " + file); + } + + mergedHelpIds = XmlHelper.getExistingHelpIds(file, verbose, getLog()); + create = false; + + } else { + + mergedHelpIds = new SortedProperties(); + create = true; + } + + // inject new helpIds + + for (Object k : helpIds.keySet()) { + mergedHelpIds.put(k, helpsetName + "/" + helpIds.get(k)); + } + + if (!mergedHelpIds.contains("top")) { + + // on ajoute une entree vers le root du helpset + + String topUrl = helpsetName + ".html"; + helpIds.put("top", topUrl); + mergedHelpIds.put("top", helpsetName + "/" + topUrl); + if (verbose) { + getLog().debug("add top entry with url " + topUrl); + } + } + + if (verbose) { + if (create) { + getLog().info("generate helpset map file " + file); + } else { + getLog().info("udpate helpset map file " + file); + } + } + + env.put("helpIds", mergedHelpIds); + doGen(mapTemplate, file, env); + env.remove("helpIds"); + return mergedHelpIds; + } + + protected NodeItem generateIndexFile(File file, Properties env) throws Exception { + NodeItem rootItem = null; + + boolean create; + + if (file.exists()) { + + create = false; + + rootItem = XmlHelper.getExistingItems("indexitem", file); + } else { + create = true; + } + + if (rootItem == null) { + rootItem = new NodeItem("top", helpsetName); + } + + // inject new index entries + + for (Object k : helpIds.keySet()) { + NodeItem toc = rootItem.findChild(k + ""); + if (verbose) { + getLog().debug("index " + k + " : " + toc); + } + } + + if (verbose) { + if (create) { + getLog().info("generate helpset index file " + file); + } else { + getLog().info("udpate helpset index file " + file); + } + } + + env.put("rootItem", rootItem); + doGen(indexTemplate, file, env); + env.remove("rootItem"); + return rootItem; + } + + protected NodeItem generateTocFile(File file, Properties env) throws Exception { + NodeItem rootItem = null; + + boolean create; + + if (file.exists()) { + + create = false; + + rootItem = XmlHelper.getExistingItems("tocitem", file); + } else { + create = true; + } + + if (rootItem == null) { + rootItem = new NodeItem("top", helpsetName); + } + // inject new toc entries + + for (Object k : helpIds.keySet()) { + NodeItem toc = rootItem.findChild(k + ""); + if (verbose) { + getLog().debug("toc " + k + " : " + toc); + } + } + + if (verbose) { + if (create) { + getLog().info("generate helpset toc file " + file); + } else { + getLog().info("udpate helpset toc file " + file); + } + } + + env.put("rootItem", rootItem); + doGen(tocTemplate, file, env); + env.remove("rootItem"); + return rootItem; + } + + protected void doGen(File template, File f, Properties env) throws Exception { + TemplateGenerator gen = prepareGenerator(template); + gen.generate(env, f); + } + + protected TemplateGenerator prepareGenerator(File template) throws Exception { + URL templateURL = getTemplate(template); + + if (verbose) { + getLog().info("using template " + templateURL); + } + TemplateGenerator gen = new TemplateGenerator(project, templateURL); + return gen; + } +} diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java similarity index 94% rename from maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java rename to maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java index daac7f5..0fcb1e0 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java @@ -49,6 +49,7 @@ import java.util.HashMap; import java.util.List; import java.util.Properties; import java.util.Set; +import jaxx.runtime.swing.help.JAXXHelpBroker; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; @@ -61,7 +62,7 @@ import org.apache.commons.lang.builder.ToStringStyle; * @requiresDependencyResolution compile * @requiresProject */ -public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfiguration { +public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfiguration { /** * Default includes to use, if none provided @@ -74,6 +75,12 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi */ protected File src; /** + * Repertoire de destination des fichiers java a generer. + * + * @parameter expression="${jaxx.outJava}" default-value="${basedir}/target/generated-sources/java" + */ + protected File outJava; + /** * pour filter les fichiers a traiter * * @parameter expression="${jaxx.includes}" @@ -175,6 +182,14 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi */ protected boolean testPhase; /** + * to make compiler i18nable, says add the {@link org.nuiton.i18n.I18n#_(String, Object[])} method + * invocation on {@link jaxx.compiler.I18nHelper#I18N_ATTRIBUTES} attributes. + * + * @parameter expression="${jaxx.i18nable}" default-value="true" + * @see jaxx.compiler.I18nHelper + */ + protected boolean i18nable; + /** * pour optimizer le code compile ou genere ? * * @parameter expression="${jaxx.optimize}" default-value="false" @@ -242,9 +257,9 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi /** * the FQN of help broker * <p/> - * By default, none. + * By default, use the JAXX implementation {@link JAXXHelpBroker}. * - * @parameter expression="${jaxx.helpBrokerFQN}" + * @parameter expression="${jaxx.helpBrokerFQN}" default-value="jaxx.runtime.swing.help.JAXXHelpBroker" * * @since 1.3 */ @@ -287,6 +302,10 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi * */ private boolean nofiles; + /** + * + */ + protected ClassLoader cl; @SuppressWarnings("unchecked") @Override @@ -294,8 +313,8 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi if (generateHelp) { // check there is some bundle - if (helpIdStore == null) { - throw new MojoFailureException("you must set the helpIdStore property."); + if (getHelpIdsStore() == null) { + throw new MojoFailureException("you must set the 'helpIdStore' property."); } } @@ -498,31 +517,6 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi } @Override - public String getHelpsetIndexI18nSuffix() { - return helpsetIndexI18nSuffix; - } - - @Override - public String getHelpsetTitleI18nSuffix() { - return helpsetTitleI18nSuffix; - } - - @Override - public String getHelpsetTocI18nSuffix() { - return helpsetTocI18nSuffix; - } - - @Override - public String getHelpSetName() { - return helpSetName; - } - - @Override - public String getHelpsetI18nPrefix() { - return helpsetI18nPrefix; - } - - @Override public Class<?> getValidatorClass() { return validatorClass; } @@ -586,9 +580,10 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi } return; } + File idsStore = getHelpIdsStore(); - if (!helpIdStore.getParentFile().exists()) { - helpIdStore.getParentFile().mkdirs(); + if (!idsStore.getParentFile().exists()) { + idsStore.getParentFile().mkdirs(); } Properties p = new Properties(); @@ -599,7 +594,7 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi p.put(removeQuote(helpId), path); } - FileOutputStream w = new FileOutputStream(helpIdStore); + FileOutputStream w = new FileOutputStream(idsStore); try { p.store(w, null); @@ -607,7 +602,7 @@ public class JaxxGeneratorMojo extends AbstractJaxxMojo implements CompilerConfi w.close(); } - getLog().info("helpIdStore generated in " + helpIdStore); + getLog().info("helpIdStore generated in " + idsStore); helpIds.clear(); } diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxHelpGeneratorMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxHelpGeneratorMojo.java deleted file mode 100644 index 1625471..0000000 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/JaxxHelpGeneratorMojo.java +++ /dev/null @@ -1,780 +0,0 @@ -/* *##% - * Copyright (C) 2007 - * JaxxPlugin, Code Lutin - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - *##%*/ -package org.nuiton.jaxx.plugin; - -import org.apache.maven.plugin.MojoFailureException; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Enumeration; -import java.util.List; -import java.util.Properties; -import java.util.Set; -import java.util.Stack; -import org.apache.maven.model.Resource; -import org.nuiton.i18n.I18n; -import org.nuiton.util.FileUtil; -import org.nuiton.util.SortedProperties; -import org.xml.sax.Attributes; -import org.xml.sax.ContentHandler; -import org.xml.sax.InputSource; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; -import org.xml.sax.helpers.XMLReaderFactory; -import static org.nuiton.i18n.I18n._; - -/** - * Mojo to generate javax help stuff for your project. - * - * HelpIds should have been discovered by the JaxxMojo. - * - * @author chemit - * @goal generate-help - * @phase process-sources - * - * @requiresProject - * @requiresDependencyResolution compile - * @since 1.3 - */ -public class JaxxHelpGeneratorMojo extends AbstractJaxxMojo { - - /** - * The directory where to generate javaHelp skeleton files. - * <p/> - * Is required if generateHelp is on. - * - * @parameter expression="${jaxx.helpTarget}" alias="target" default-value="${maven.src.dir}/main/help" - * @required - * - * @since 1.3 - */ - protected File target; - /** - * The locale to generate for help. - * - * By default, stay in France. - * - * @parameter expression="${jaxx.locale}" default-value="fr" - * @required - * - * @since 1.3 - */ - protected String locale; - /** - * The package where to generate i18n java file. - * - * @parameter expression="${jaxx.packageName}" default-value="${project.groupId}" - * @required - * - * @since 1.3 - */ - protected String packageName; - /** - * The file name of the helpset to generate. - * - * @parameter expression="${jaxx.helpSetFileName}" default-value="${jaxx.helpSetName}.hs" - * @required - * - * @since 1.3 - */ - protected String helpsetFileName; - /** - * The file name of the helpset map to generate. - * - * @parameter expression="${jaxx.mapFileName}" default-value="${jaxx.helpSetName}Map.jhm" - * @required - * - * @since 1.3 - */ - protected String mapFileName; - /** - * The file name of the helpset index to generate. - * - * @parameter expression="${jaxx.indexFileName}" default-value="${jaxx.helpSetName}Index.xml" - * @required - * - * @since 1.3 - */ - protected String indexFileName; - /** - * The file name of the helpset toc to generate. - * - * @parameter expression="${jaxx.tocFileName}" default-value="${jaxx.helpSetName}TOC.xml" - * @required - * - * @since 1.3 - */ - protected String tocFileName; - /** - * The file name of the i18n java file to generate. - * - * @parameter expression="${jaxx.i8nFileName}" default-value="${jaxx.helpSetName}I18n.java" - * @required - * - * @since 1.3 - */ - protected String i8nFileName; - /** - * The template used to generate helpset file. - * - * Must be an existing file or a ressource in classp-ath - * - * @parameter expression="${jaxx.helpSetTemplate}" default-value="/defaultHelpSet.hs.vm" - * @required - * - * @since 1.3 - */ - protected File helpSetTemplate; - /** - * The template used to generate helpset map file. - * - * Must be an existing file or a ressource in classp-ath - * - * @parameter expression="${jaxx.mapTemplate}" default-value="/defaultMap.jhm.vm" - * @required - * - * @since 1.3 - */ - protected File mapTemplate; - /** - * The template used to generate helpset index file. - * - * Must be an existing file or a ressource in classp-ath - * - * @parameter expression="${jaxx.indexTemplate}" default-value="/defaultIndex.xml.vm" - * @required - * - * @since 1.3 - */ - protected File indexTemplate; - /** - * The template used to generate helpset toc file. - * - * Must be an existing file or a ressource in classp-ath - * - * @parameter expression="${jaxx.tocTemplate}" default-value="/defaultToc.xml.vm" - * @required - * - * @since 1.3 - */ - protected File tocTemplate; - /** - * The template used to generate helpset content file. - * - * Must be an existing file or a ressource in classp-ath - * - * @parameter expression="${jaxx.contentTemplate}" default-value="/defaultContent.html.vm" - * @required - * - * @since 1.3 - */ - protected File contentTemplate; - /** - * The template used to generate helpset content file. - * - * Must be an existing file or a ressource in classp-ath - * - * @parameter expression="${jaxx.i18nTemplate}" default-value="/defaultI18n.java.vm" - * @required - * - * @since 1.3 - */ - protected File i18nTemplate; - /** - * The help ids discovered by Jaxx compilation - */ - protected Properties helpIds; - private static final String AUTOREMOVE_LINE = "REMOVE THS LINE TO DISABLE AUTO-REGENERATE THE FILE"; - - @Override - public boolean init() throws Exception { - - if (!helpIdStore.exists()) { - getLog().info("no helpIdStore to react at " + helpIdStore); - return false; - } - - // check there is some bundle - if (locale == null) { - throw new MojoFailureException("you must set the bundles property."); - } - // check there is some bundle - if (target == null) { - throw new MojoFailureException("you must set the target property."); - } - // check ressources - checkResource(helpSetTemplate); - checkResource(mapTemplate); - checkResource(indexTemplate); - checkResource(tocTemplate); - checkResource(contentTemplate); - - if (!target.exists()) { - getLog().info("mkdir " + target); - target.mkdirs(); - } - - helpIds = new SortedProperties(); - - InputStream stream = new FileInputStream(helpIdStore); - - helpIds.load(stream); - - stream.close(); - - if (helpIds.isEmpty()) { - - // no ids detected - getLog().warn("no helpIds detected, will skip."); - return false; - } - - return true; - } - - @Override - public void doAction() throws Exception { - - if (i18nable) { - - List<URL> lUrls = new java.util.ArrayList<URL>(); - List<?> resources = project.getResources(); - for (Object o : resources) { - Resource resource = (Resource) o; - lUrls.add(new File(resource.getDirectory()).toURI().toURL()); - } - I18n.setExtraURL(lUrls.toArray(new URL[lUrls.size()])); - I18n.init(locale, null); - } - - File file; - - Properties env = new Properties(); - - env.put("helpSetName", helpSetName); - env.put("helpSetFileName", helpsetFileName); - env.put("mapFileName", mapFileName); - env.put("indexFileName", indexFileName); - env.put("tocFileName", tocFileName); - env.put("separator", " "); - env.put("autoremoveLine", AUTOREMOVE_LINE); - - - int touchedFiles = 0; - - // --------------------------------------------------------------- - // --- main helpset file ----------------------------------------- - // --------------------------------------------------------------- - - - file = new File(target, helpsetFileName); - - boolean doCreate = generateHelSetFile(file, env); - - if (doCreate) { - touchedFiles++; - } - - // --------------------------------------------------------------- - // --- helpset map file ------------------------------------------ - // --------------------------------------------------------------- - - file = new File(target, mapFileName); - - Properties mergedHelpIds = generateMapFile(file, env); - touchedFiles++; - - // --------------------------------------------------------------- - // --- helpset index file ---------------------------------------- - // --------------------------------------------------------------- - - file = new File(target, indexFileName); - - NodeItem indexRootItem = generateIndexFile(file, env); - touchedFiles++; - - // --------------------------------------------------------------- - // --- helpset toc file ------------------------------------------ - // --------------------------------------------------------------- - - file = new File(target, tocFileName); - - NodeItem tocRootItem = generateTocFile(file, env); - touchedFiles++; - - // --------------------------------------------------------------- - // --- helpset content files ------------------------------------- - // --------------------------------------------------------------- - - TemplateGenerator gen = prepareGenerator(contentTemplate); - - Enumeration<?> keys = helpIds.keys(); - - while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); - String url = (String) helpIds.get(key); - url = helpSetName + File.separator + url; - - File f = new File(target, url); - - boolean exist = f.exists(); - - if (exist) { - // check if there is a autoremoveLine in content - String content = FileUtil.readAsString(f); - if (!content.contains(AUTOREMOVE_LINE)) { - // no regenerate marker detected, so skip this file - if (verbose) { - getLog().debug("skip existing file " + f); - } - continue; - } - } - - f.getParentFile().mkdirs(); - - if (verbose) { - if (exist) { - getLog().info("regenerate content file " + f); - } else { - getLog().info("generate content file " + f); - } - } - - env.put("helpId", key); - String i18n = helpsetI18nPrefix + key + helpsetTitleI18nSuffix; - env.put("helpIdTitle", _(i18n)); - env.put("helpIdUrl", url); - - gen.generate(env, f); - touchedFiles++; - } - - // --------------------------------------------------------------- - // --- i18n file ------------------------------------------------- - // --------------------------------------------------------------- - - String path = packageName.replaceAll("\\.", File.separator); - path += File.separator + i8nFileName; - file = new File(outJava, path); - generateI18nFile(file, env, mergedHelpIds, indexRootItem, tocRootItem); - touchedFiles++; - - getLog().info(touchedFiles + " file(s) treated."); - } - - protected void generateI18nFile(File file, Properties env, Properties mergedHelpIds, NodeItem indexRootItem, NodeItem tocRootItem) throws Exception { - - boolean create = !file.exists(); - - if (!file.getParentFile().exists()) { - file.getParentFile().mkdirs(); - } - - Set<String> keys = new java.util.HashSet<String>(); - - for (Object k : mergedHelpIds.keySet()) { - String key = helpsetI18nPrefix + k + helpsetTitleI18nSuffix; - keys.add(key); - } - indexRootItem.extractI18n(keys, helpsetI18nPrefix, helpsetIndexI18nSuffix); - tocRootItem.extractI18n(keys, helpsetI18nPrefix, helpsetTocI18nSuffix); - - env.put("keys", keys); - env.put("packageName", packageName); - String className = file.getName(); - int index = className.lastIndexOf("."); - className = className.substring(0, index); - env.put("className", className); - - if (verbose) { - if (create) { - getLog().info("generate i18n java file " + file); - } else { - getLog().info("udpate i18n java file " + file); - } - } - - doGen(i18nTemplate, file, env); - - } - - protected boolean generateHelSetFile(File file, Properties env) throws Exception { - - if (file.exists()) { - // check the auto removeline presence - String content = FileUtil.readAsString(file); - if (!content.contains(AUTOREMOVE_LINE)) { - // no regenerate marker detected, so skip this file - if (verbose) { - getLog().info("skip existing helpset main file " + file); - } - return false; - } - } - - if (verbose) { - if (file.exists()) { - getLog().info("regenerate helpset main file " + file); - } else { - getLog().info("generate helpset main file " + file); - } - } - doGen(helpSetTemplate, file, env); - return true; - } - - protected Properties generateMapFile(File file, Properties env) throws Exception { - - boolean create; - - Properties mergedHelpIds = null; - if (file.exists()) { - - // get back the exisiting data and merge it with incoming ones - - if (verbose) { - getLog().info("loading existing helpset map file " + file); - } - - mergedHelpIds = getExistingHelpIds(file); - create = false; - - } else { - - mergedHelpIds = new SortedProperties(); - create = true; - } - - // inject new helpIds - - for (Object k : helpIds.keySet()) { - mergedHelpIds.put(k, helpSetName + "/" + helpIds.get(k)); - } - - if (!mergedHelpIds.contains("top")) { - // on ajoute une entree vers le root du helpset - - String topUrl = helpSetName + ".html"; - helpIds.put("top", topUrl); - mergedHelpIds.put("top", helpSetName + "/" + topUrl); - if (verbose) { - getLog().debug("add top entry with url " + topUrl); - } - } - - if (verbose) { - if (create) { - getLog().info("generate helpset map file " + file); - } else { - getLog().info("udpate helpset map file " + file); - } - } - - env.put("helpIds", mergedHelpIds); - doGen(mapTemplate, file, env); - env.remove("helpIds"); - return mergedHelpIds; - } - - protected NodeItem generateIndexFile(File file, Properties env) throws Exception { - NodeItem rootItem = null; - - boolean create; - - if (file.exists()) { - - create = false; - - rootItem = getExistingItems("indexitem", file); - } else { - create = true; - } - - if (rootItem == null) { - rootItem = new NodeItem("top", helpSetName); - } - - // inject new index entries - - for (Object k : helpIds.keySet()) { - NodeItem toc = rootItem.findChild(k + ""); - if (verbose) { - getLog().debug("index " + k + " : " + toc); - } - } - - //String prefix = helpsetI18nPrefix; - //String prefix = helpsetI18nPrefix + helpSetName + "."; - rootItem.applyI18n(helpsetI18nPrefix, helpsetIndexI18nSuffix); - - if (verbose) { - if (create) { - getLog().info("generate helpset index file " + file); - } else { - getLog().info("udpate helpset index file " + file); - } - } - - env.put("rootItem", rootItem); - doGen(indexTemplate, file, env); - env.remove("rootItem"); - return rootItem; - } - - protected NodeItem generateTocFile(File file, Properties env) throws Exception { - NodeItem rootItem = null; - - boolean create; - - if (file.exists()) { - - create = false; - - rootItem = getExistingItems("tocitem", file); - } else { - create = true; - } - - if (rootItem == null) { - rootItem = new NodeItem("top", helpSetName); - } - // inject new toc entries - - for (Object k : helpIds.keySet()) { - NodeItem toc = rootItem.findChild(k + ""); - if (verbose) { - getLog().debug("toc " + k + " : " + toc); - } - } - - //String prefix = helpsetI18nPrefix + helpSetName + "."; - rootItem.applyI18n(helpsetI18nPrefix, helpsetTocI18nSuffix); - - if (verbose) { - if (create) { - getLog().info("generate helpset toc file " + file); - } else { - getLog().info("udpate helpset toc file " + file); - } - } - - env.put("rootItem", rootItem); - doGen(tocTemplate, file, env); - env.remove("rootItem"); - return rootItem; - } - - protected void doGen(File template, File f, Properties env) throws Exception { - TemplateGenerator gen = prepareGenerator(template); - gen.generate(env, f); - } - - protected TemplateGenerator prepareGenerator(File template) throws Exception { - URL templateURL = getTemplate(template); - - if (verbose) { - getLog().info("using template " + templateURL); - } - TemplateGenerator gen = new TemplateGenerator(project, templateURL); - return gen; - } - -// protected URL getTemplate(File f) throws IOException { -// URL r = null; -// if (f.exists()) { -// r = f.toURI().toURL(); -// } else { -// r = getClass().getResource(f.toString()); -// } -// return r; -// } -// -// protected void checkResource(File f) throws MojoFailureException { -// if (!f.exists()) { -// // test in classPath -// InputStream r = getClass().getResourceAsStream(f.toString()); -// if (r == null) { -// throw new MojoFailureException("could not find ressource " + f); -// } -// } -// } - protected Properties getExistingHelpIds(File file) throws SAXException, IOException { - - final Properties result = new SortedProperties(); - - XMLReader parser = XMLReaderFactory.createXMLReader(); - - parser.setContentHandler(new ContentHandlerAdapter() { - - String target; - String url; - - @Override - public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { - if ("mapID".equals(localName)) { - target = atts.getValue("target"); - url = atts.getValue("url"); - if (verbose) { - getLog().debug("detect map entry : " + target + " : " + url); - } - result.put(target, url); - } - } - }); - - InputStream s = new FileInputStream(file); - try { - parser.parse(new InputSource(s)); - } finally { - s.close(); - } - return result; - } - - protected NodeItem getExistingItems(String tagName, File file) throws SAXException, IOException { - - XMLReader parser = XMLReaderFactory.createXMLReader(); - NodeItemHandler handler = new NodeItemHandler(tagName); - - parser.setContentHandler(handler); - - NodeItem rootItem = null; - InputStream s = new FileInputStream(file); - try { - parser.parse(new InputSource(s)); - rootItem = handler.rootItem; - } finally { - s.close(); - } - return rootItem; - } - - static class NodeItemHandler extends ContentHandlerAdapter { - - NodeItem rootItem; - NodeItem currentItem; - final Stack<NodeItem> stack; - final String tagName; - - public NodeItemHandler(String tagName) { - this.tagName = tagName; - this.stack = new Stack<NodeItem>(); - } - - @Override - public void startDocument() throws SAXException { - rootItem = new NodeItem("top", null); - } - - @Override - public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { - if (tagName.equals(localName)) { - - String target = atts.getValue("target"); - String text = atts.getValue("text"); - - // debut d'un item - if (currentItem == null) { - // premier item - if (rootItem.getTarget().equals(target)) { - // le premier item est bien top - //rootItem.setText(text); - currentItem = rootItem; - } else { - // le premier noeud n'est pas top - // en l'encapsule - stack.push(rootItem); - currentItem = new NodeItem(target, text); - rootItem.addChild(currentItem); - } - } else { - NodeItem newItem = new NodeItem(target, text); - currentItem.addChild(newItem); - currentItem = newItem; - } - currentItem.adjustTarget(); - stack.push(currentItem); - - } - } - - @Override - public void endElement(String uri, String localName, String qName) throws SAXException { - if (tagName.equals(localName)) { - // fin d'un item - stack.pop(); - if (!stack.isEmpty()) { - currentItem = stack.peek(); - } - } - } - } - - static class ContentHandlerAdapter implements ContentHandler { - - @Override - public void setDocumentLocator(Locator locator) { - } - - @Override - public void startDocument() throws SAXException { - } - - @Override - public void endDocument() throws SAXException { - } - - @Override - public void startPrefixMapping(String prefix, String uri) throws SAXException { - } - - @Override - public void endPrefixMapping(String prefix) throws SAXException { - } - - @Override - public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { - } - - @Override - public void endElement(String uri, String localName, String qName) throws SAXException { - } - - @Override - public void characters(char[] ch, int start, int length) throws SAXException { - } - - @Override - public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { - } - - @Override - public void processingInstruction(String target, String data) throws SAXException { - } - - @Override - public void skippedEntity(String name) throws SAXException { - } - } -} diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java new file mode 100644 index 0000000..d2119df --- /dev/null +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java @@ -0,0 +1,187 @@ +package org.nuiton.jaxx.plugin; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; +import java.util.Stack; +import org.apache.maven.plugin.logging.Log; +import org.nuiton.util.SortedProperties; +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.InputSource; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.XMLReaderFactory; + +/** + * To load {@link NodeItem} from xml. + * + * @author chemit + * @since 2.0.0 + */ +public class XmlHelper { + + public static Properties getExistingHelpIds(File file, final boolean verbose, final Log log) throws SAXException, IOException { + + final Properties result = new SortedProperties(); + + XMLReader parser = XMLReaderFactory.createXMLReader(); + + parser.setContentHandler(new ContentHandlerAdapter() { + + String target; + String url; + + @Override + public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { + if ("mapID".equals(localName)) { + target = atts.getValue("target"); + url = atts.getValue("url"); + if (verbose) { + log.debug("detect map entry : " + target + " : " + url); + } + result.put(target, url); + } + } + }); + + InputStream s = new FileInputStream(file); + try { + parser.parse(new InputSource(s)); + } finally { + if (s != null) { + s.close(); + } + } + return result; + } + + public static NodeItem getExistingItems(String tagName, File file) throws SAXException, IOException { + + XMLReader parser = XMLReaderFactory.createXMLReader(); + NodeItemHandler handler = new NodeItemHandler(tagName); + + parser.setContentHandler(handler); + + NodeItem rootItem = null; + InputStream s = new FileInputStream(file); + try { + parser.parse(new InputSource(s)); + rootItem = handler.rootItem; + } finally { + s.close(); + } + return rootItem; + } + + static class NodeItemHandler extends ContentHandlerAdapter { + + NodeItem rootItem; + NodeItem currentItem; + final Stack<NodeItem> stack; + final String tagName; + + public NodeItemHandler(String tagName) { + this.tagName = tagName; + this.stack = new Stack<NodeItem>(); + } + + @Override + public void startDocument() throws SAXException { + rootItem = new NodeItem("top", null); + } + + @Override + public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { + if (tagName.equals(localName)) { + + String target = atts.getValue("target"); + String text = atts.getValue("text"); + + // debut d'un item + if (currentItem == null) { + // premier item + if (rootItem.getTarget().equals(target)) { + // le premier item est bien top + //rootItem.setText(text); + currentItem = rootItem; + } else { + // le premier noeud n'est pas top + // en l'encapsule + stack.push(rootItem); + currentItem = new NodeItem(target, text); + rootItem.addChild(currentItem); + } + } else { + NodeItem newItem = new NodeItem(target, text); + currentItem.addChild(newItem); + currentItem = newItem; + } + currentItem.adjustTarget(); + stack.push(currentItem); + + } + } + + @Override + public void endElement(String uri, String localName, String qName) throws SAXException { + if (tagName.equals(localName)) { + // fin d'un item + stack.pop(); + if (!stack.isEmpty()) { + currentItem = stack.peek(); + } + } + } + } + + static class ContentHandlerAdapter implements ContentHandler { + + @Override + public void setDocumentLocator(Locator locator) { + } + + @Override + public void startDocument() throws SAXException { + } + + @Override + public void endDocument() throws SAXException { + } + + @Override + public void startPrefixMapping(String prefix, String uri) throws SAXException { + } + + @Override + public void endPrefixMapping(String prefix) throws SAXException { + } + + @Override + public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { + } + + @Override + public void endElement(String uri, String localName, String qName) throws SAXException { + } + + @Override + public void characters(char[] ch, int start, int length) throws SAXException { + } + + @Override + public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { + } + + @Override + public void processingInstruction(String target, String data) throws SAXException { + } + + @Override + public void skippedEntity(String name) throws SAXException { + } + } +} diff --git a/maven-jaxx-plugin/src/main/resources/defaultContent.html.vm b/maven-jaxx-plugin/src/main/resources/defaultContent.html.vm index 584c595..ac806dc 100644 --- a/maven-jaxx-plugin/src/main/resources/defaultContent.html.vm +++ b/maven-jaxx-plugin/src/main/resources/defaultContent.html.vm @@ -2,11 +2,11 @@ <HTML> <HEAD> <TITLE> -$helpIdTitle +$helpId </TITLE> </HEAD> <BODY BGCOLOR="#ffffff"> -<H1>$helpIdTitle</H1> +<H1>$helpId</H1> <!-- $autoremoveLine --> diff --git a/maven-jaxx-plugin/src/main/resources/defaultHelpSet.hs.vm b/maven-jaxx-plugin/src/main/resources/defaultHelpSet.hs.vm index 582797c..baf3e7c 100644 --- a/maven-jaxx-plugin/src/main/resources/defaultHelpSet.hs.vm +++ b/maven-jaxx-plugin/src/main/resources/defaultHelpSet.hs.vm @@ -3,7 +3,7 @@ PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 1.0//EN" "http://java.sun.com/products/javahelp/helpset_1_0.dtd"> -<helpset version="1.0"> +<helpset version="1.0" xml:lang="$locale"> <!-- $autoremoveLine --> @@ -13,7 +13,7 @@ <!-- maps --> <maps> <homeID>top</homeID> - <mapref location="$mapFileName"/> + <mapref location="$localePath/$mapFileName"/> </maps> <!-- views --> @@ -21,17 +21,17 @@ <name>TOC</name> <label>Table Of Contents</label> <type>javax.help.TOCView</type> - <data>$tocFileName</data> + <data>$localePath/$tocFileName</data> </view> <view> <name>Index</name> <label>Index</label> <type>javax.help.IndexView</type> - <data>$indexFileName</data> + <data>$localePath/$indexFileName</data> </view> -#if ( $!searchData != "" ) +#if ( $searchData ) <view> <name>Search</name> <label>Search</label> diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1751Test.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1751Test.java index c4de8ff..1ac11fa 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1751Test.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1751Test.java @@ -7,7 +7,7 @@ public class Bug1751Test extends JaxxBaseTest { @Test public void Bug_1751() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.execute(); assertNumberJaxxFiles(3); diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java index 6012c74..bda7928 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java @@ -23,7 +23,7 @@ public class CompilerTest extends JaxxBaseTest { @Test public void Icon() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.execute(); checkPattern(mojo, ".createImageIcon(\"myIcon.png\")", true); checkPattern(mojo, ".createActionIcon(\"myActionIcon.png\")", true); @@ -40,7 +40,7 @@ public class CompilerTest extends JaxxBaseTest { @Test public void ClientProperty() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.execute(); checkPattern(mojo, ".putClientProperty(\"testOne\", \"oneTest\")", true); checkPattern(mojo, ".putClientProperty(\"testTwo\", \"anotherTest\")", true); @@ -60,7 +60,7 @@ public class CompilerTest extends JaxxBaseTest { @Test public void WithLog() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.execute(); String[] files = mojo.files; assertNumberJaxxFiles(2); @@ -85,7 +85,7 @@ public class CompilerTest extends JaxxBaseTest { @Test public void NoLog() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.execute(); assertNumberJaxxFiles(2); checkPattern(mojo, "Log log = LogFactory.getLog(", false); @@ -96,7 +96,7 @@ public class CompilerTest extends JaxxBaseTest { @SuppressWarnings({"unchecked"}) @Test public void Errors() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); // init mojo to get alls files to treate mojo.init(); @@ -160,7 +160,7 @@ public class CompilerTest extends JaxxBaseTest { @Test public void ErrorJaxxContextImplementorClass() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.jaxxContextFQN = null; try { mojo.init(); @@ -213,7 +213,7 @@ public class CompilerTest extends JaxxBaseTest { public void Force() throws Exception { // first round, with force option so will generate theonly JButton.jaxx file - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.execute(); String[] files = mojo.files; assertNumberJaxxFiles(1); diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java index b595ac6..dd0894a 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java @@ -24,7 +24,7 @@ public class CompilerValidatorTest extends JaxxBaseTest { @SuppressWarnings({"unchecked"}) public void ValidatorErrors() throws Exception { // init mojo to get alls files to treate - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.init(); String[] files = mojo.files; assertNumberJaxxFiles(19); diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java index 4698e7e..e82f772 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java @@ -6,7 +6,7 @@ public class DecoratorTest extends JaxxBaseTest { @Test public void Decorator() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.execute(); assertNumberJaxxFiles(1); checkPattern(mojo, "root.add(jaxx.runtime.SwingUtil.boxComponentWithJxLayer(boxedButton))", true); diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java index 64f09ff..92d239c 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java @@ -15,7 +15,7 @@ public class Evolution74Test extends JaxxBaseTest { @Test public void ok() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.execute(); assertNumberJaxxFiles(6); @@ -38,7 +38,7 @@ public class Evolution74Test extends JaxxBaseTest { @SuppressWarnings({"unchecked"}) @Test public void error() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); // init mojo to get alls files to treate mojo.init(); diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/I18nTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/I18nTest.java index 1228328..4a1e183 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/I18nTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/I18nTest.java @@ -6,7 +6,7 @@ public class I18nTest extends JaxxBaseTest { @Test public void I18nText() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.i18nable = false; mojo.execute(); checkPattern(mojo, "testId.setText(_(\"test.text\"));", false); @@ -19,7 +19,7 @@ public class I18nTest extends JaxxBaseTest { @Test public void I18nTitle() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.i18nable = false; mojo.execute(); checkPattern(mojo, "testId.setTitle(_(\"test.title\"));", false); @@ -32,7 +32,7 @@ public class I18nTest extends JaxxBaseTest { @Test public void I18nToolTipText() throws Exception { - JaxxGeneratorMojo mojo = getMojo(); + GenerateMojo mojo = getMojo(); mojo.i18nable = false; mojo.execute(); checkPattern(mojo, "testId.setToolTipText(_(\"test.toolTipText\"));", false); diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java index abaa634..7d03c51 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java @@ -15,9 +15,9 @@ import static org.junit.Assert.*; * * @author chemit * @see AbstractMojoTest - * @see JaxxGeneratorMojo + * @see GenerateMojo */ -public abstract class JaxxBaseTest extends AbstractMojoTest<JaxxGeneratorMojo> { +public abstract class JaxxBaseTest extends AbstractMojoTest<GenerateMojo> { @Override protected String getGoalName(String methodName) { @@ -25,7 +25,7 @@ public abstract class JaxxBaseTest extends AbstractMojoTest<JaxxGeneratorMojo> { } @Override - protected void setUpMojo(JaxxGeneratorMojo mojo, File pomFile) throws Exception { + protected void setUpMojo(GenerateMojo mojo, File pomFile) throws Exception { super.setUpMojo(mojo, pomFile); mojo.jaxxContextFQN = DefaultJAXXContext.class.getName(); mojo.compilerFQN = jaxx.compiler.JAXXCompiler.class.getName(); @@ -33,7 +33,7 @@ public abstract class JaxxBaseTest extends AbstractMojoTest<JaxxGeneratorMojo> { mojo.defaultDecoratorFQN = jaxx.compiler.decorators.DefaultCompiledObjectDecorator.class.getName(); } - protected void checkPattern(JaxxGeneratorMojo mojo, String pattern, boolean required, String... files) throws IOException { + protected void checkPattern(GenerateMojo mojo, String pattern, boolean required, String... files) throws IOException { if (files.length == 0) { files = mojo.files; } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 52a8238fb5c6e2693c04a31bb3d3fe3daa225edc Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 8 19:10:44 2009 +0000 - add encoding on goals (should be in JAXXCompiler) - simplify helpIdsStore (only store ids, path will be computed if needed) - maven-helper-plugin common code --- .../java/jaxx/compiler/CompilerConfiguration.java | 6 ++ .../compiler/DefaultCompilerConfiguration.java | 9 ++ .../org/nuiton/jaxx/plugin/AbstractJaxxMojo.java | 20 +++- .../org/nuiton/jaxx/plugin/GenerateHelpMojo.java | 40 +++++--- .../java/org/nuiton/jaxx/plugin/GenerateMojo.java | 113 +++------------------ .../main/java/org/nuiton/jaxx/plugin/NodeItem.java | 4 + .../java/org/nuiton/jaxx/plugin/XmlHelper.java | 2 +- 7 files changed, 77 insertions(+), 117 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java index eee1681..e9cb408 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java @@ -122,4 +122,10 @@ public interface CompilerConfiguration { * @return {@code true} if compiler is verbose */ boolean isVerbose(); + + /** + * + * @return the encoding to use to write files + */ + String getEncoding(); } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java b/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java index eb06347..64f9c60 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java @@ -86,6 +86,10 @@ public class DefaultCompilerConfiguration implements CompilerConfiguration { * since this class should be in sources (so not yet compiled) */ private String helpBrokerFQN; + /** + * Encoding to use to write files + */ + private String encoding; @Override public File getTargetDirectory() { @@ -182,6 +186,11 @@ public class DefaultCompilerConfiguration implements CompilerConfiguration { } @Override + public String getEncoding() { + return encoding; + } + + @Override public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); } diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java index c55360f..3d96a38 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java @@ -32,6 +32,9 @@ import org.nuiton.plugin.AbstractPlugin; */ public abstract class AbstractJaxxMojo extends AbstractPlugin { + public abstract File getTargetDirectory(); + + public abstract void setTargetDirectory(File targetDirectory); /** * Dépendance du projet. * @@ -41,6 +44,13 @@ public abstract class AbstractJaxxMojo extends AbstractPlugin { */ protected MavenProject project; /** + * Encoding pour la generation des fichiers + * + * @parameter expression="${jaxx.encoding}" default-value="${project.build.sourceEncoding}" + * @since 2.0.0 + */ + protected String encoding; + /** * verbose flag * * @parameter expression="${jaxx.verbose}" default-value="false" @@ -52,7 +62,7 @@ public abstract class AbstractJaxxMojo extends AbstractPlugin { * The store of helpIds generated by the goal {@link GenerateMojo} and then * used by the goal {@link GenerateHelpMojo}. * - * @parameter expression="${jaxx.helpIdsStore}" default-value="target/helpIds.properties" + * @parameter expression="${jaxx.helpIdsStore}" default-value="target/generated-sources/jaxx/helpIds.properties" * @required * * @since 1.3 @@ -91,4 +101,12 @@ public abstract class AbstractJaxxMojo extends AbstractPlugin { public void setHelpIdsStore(File helpIdsStore) { this.helpIdsStore = helpIdsStore; } + + public String getEncoding() { + return encoding; + } + + public void setEncoding(String encoding) { + this.encoding = encoding; + } } diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java index 559c565..9506dbb 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java @@ -18,11 +18,12 @@ *##%*/ package org.nuiton.jaxx.plugin; +import java.io.BufferedReader; import org.apache.maven.plugin.MojoFailureException; import java.io.File; import java.io.FileInputStream; -import java.io.InputStream; +import java.io.InputStreamReader; import java.net.URL; import java.util.ArrayList; import java.util.Enumeration; @@ -185,21 +186,21 @@ public class GenerateHelpMojo extends AbstractJaxxMojo { checkResource(tocTemplate); checkResource(contentTemplate); - if (!outHelp.exists()) { - getLog().info("mkdir " + outHelp); - outHelp.mkdirs(); + if (!getTargetDirectory().exists()) { + getLog().info("mkdir " + getTargetDirectory()); + getTargetDirectory().mkdirs(); } + // load ids from idsStore file + helpIds = new SortedProperties(); - InputStream stream = new FileInputStream(idsStore); - - try { - helpIds.load(stream); - } finally { - if (stream != null) { - stream.close(); - } + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(idsStore), getEncoding())); + String id = null; + while ((id = reader.readLine()) != null) { + id = id.trim(); + String path = id.replaceAll("\\.", File.separator) + ".html"; + helpIds.put(id, path); } if (helpIds.isEmpty()) { @@ -208,7 +209,6 @@ public class GenerateHelpMojo extends AbstractJaxxMojo { getLog().warn("No helpIds detected, will skip."); return false; } - return true; } @@ -235,7 +235,9 @@ public class GenerateHelpMojo extends AbstractJaxxMojo { localizedTarget.mkdirs(); } getLog().info("Generate help for language " + language); - getLog().info(" Localized target : " + localizedTarget); + if (isVerbose()) { + getLog().info(" Localized target : " + localizedTarget); + } Properties env = new Properties(); @@ -305,6 +307,16 @@ public class GenerateHelpMojo extends AbstractJaxxMojo { getLog().info(touchedFiles + " file(s) treated."); } + @Override + public File getTargetDirectory() { + return outHelp; + } + + @Override + public void setTargetDirectory(File targetDirectory) { + this.outHelp = targetDirectory; + } + protected int generateContentFiles(File localizedTarget, Properties env, String localePath) throws Exception { int touchedFiles = 0; diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java index 0fcb1e0..1a54e17 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java @@ -27,27 +27,18 @@ import jaxx.compiler.decorators.HelpRootCompiledObjectDecorator; import jaxx.compiler.tags.TagManager; import jaxx.runtime.JAXXContext; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.model.Resource; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.project.MavenProject; import org.nuiton.io.FileUpdaterHelper; import org.nuiton.io.MirroredFileUpdater; import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; -import java.net.MalformedURLException; import java.util.Map; import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.List; -import java.util.Properties; import java.util.Set; import jaxx.runtime.swing.help.JAXXHelpBroker; import org.apache.commons.lang.builder.ToStringBuilder; @@ -336,7 +327,6 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat return true; } -// if (addSourcesToClassPath || addProjectClassPath) { cl = initClassLoader(project, src, addSourcesToClassPath, @@ -346,10 +336,6 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat addProjectClassPath); Thread.currentThread().setContextClassLoader(cl); -// } else { -// cl = getClass().getClassLoader(); - //cl = Thread.currentThread().getContextClassLoader(); -// } compilerClass = (Class<? extends JAXXCompiler>) Class.forName(compilerFQN, false, cl); defaultDecoratorClass = (Class<? extends CompiledObjectDecorator>) Class.forName(defaultDecoratorFQN, false, cl); @@ -368,8 +354,8 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat BeanInfoUtil.addJaxxBeanInfoPath(beanInfoSearchPath); } - if (!outJava.exists()) { - outJava.mkdirs(); + if (!getTargetDirectory().exists()) { + getTargetDirectory().mkdirs(); } // compute extra imports (can not use java classes since some of @@ -442,6 +428,11 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat } @Override + public void setTargetDirectory(File targetDirectory) { + this.outJava = targetDirectory; + } + + @Override public boolean getOptimize() { return optimize; } @@ -534,16 +525,9 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat } if (testPhase) { - if (!project.getTestCompileSourceRoots().contains( - outJava.getPath())) { - getLog().info("Add test compile source root : " + outJava); - project.addTestCompileSourceRoot(outJava.getPath()); - } + addTestCompileSourceRoots(getTargetDirectory()); } else { - if (!project.getCompileSourceRoots().contains(outJava.getPath())) { - getLog().info("Add compile source root : " + outJava); - project.addCompileSourceRoot(outJava.getPath()); - } + addCompileSourceRoots(getTargetDirectory()); } } @@ -586,91 +570,18 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat idsStore.getParentFile().mkdirs(); } - Properties p = new Properties(); + StringBuilder buffer = new StringBuilder(); for (String helpId : helpIds) { - String path = helpId.replaceAll("\\.", File.separator); - path = removeQuote(path) + ".html"; - p.put(removeQuote(helpId), path); - } - - FileOutputStream w = new FileOutputStream(idsStore); - - try { - p.store(w, null); - } finally { - w.close(); + buffer.append(removeQuote(helpId)).append('\n'); } + writeFile(idsStore, buffer.toString(), encoding); getLog().info("helpIdStore generated in " + idsStore); helpIds.clear(); } - //TODO use the AbstractPublig method - @SuppressWarnings({"unchecked"}) - protected URLClassLoader initClasLoader(MavenProject project, org.apache.maven.plugin.logging.Log log) throws MalformedURLException { - URLClassLoader loader = null; - if (project != null) { - - URLClassLoader result; - try { - - List<URL> lUrls = new ArrayList<URL>(); - List<String> sources = project.getCompileSourceRoots(); - - if (addSourcesToClassPath) { - for (String source : sources) { - lUrls.add(new File(source).toURI().toURL()); - } - if (testPhase) { - for (Object source : project.getTestCompileSourceRoots()) { - lUrls.add(new File(source.toString()).toURI().toURL()); - } - } - } - if (addResourcesToClassPath) { - for (Object source : project.getResources()) { - Resource r = (Resource) source; - lUrls.add(new File(r.getDirectory()).toURI().toURL()); - } - } - if (testPhase && addCompileClassPath) { - if (project != null) { - lUrls.add(new File(project.getBuild().getOutputDirectory()).toURI().toURL()); - } - } - if (addProjectClassPath) { - getLog().info("use project compile scope class-path"); - // add also all dependencies of the project in compile scope - Set<?> artifacts = project.getArtifacts(); - for (Object o : artifacts) { - Artifact a = (Artifact) o; - lUrls.add(a.getFile().toURI().toURL()); - } - } - - result = new URLClassLoader(lUrls.toArray(new URL[lUrls.size()]), getClass().getClassLoader()); - - } catch (IOException e) { - throw new RuntimeException("Can't create ClassLoader for reason " + e.getMessage(), e); - } - loader = result; - } else { - List<URL> lUrls = new ArrayList<URL>(); - if (addSourcesToClassPath) { - lUrls.add(src.toURI().toURL()); - } - loader = new URLClassLoader(lUrls.toArray(new URL[lUrls.size()]), getClass().getClassLoader()); - } - if (verbose) { - for (URL entry : loader.getURLs()) { - log.info("classpath : " + entry); - } - } - return loader; - } - protected String removeQuote(String txt) { if (txt.startsWith("\"")) { txt = txt.substring(1); diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/NodeItem.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/NodeItem.java index 8408503..3f4a8e6 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/NodeItem.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/NodeItem.java @@ -35,6 +35,10 @@ public class NodeItem { return childs; } + public void setText(String text) { + this.text = text; + } + public NodeItem findChild(String path) { NodeItem result = null; String[] paths = path.split("\\."); diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java index d2119df..631f831 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java @@ -106,7 +106,7 @@ public class XmlHelper { // premier item if (rootItem.getTarget().equals(target)) { // le premier item est bien top - //rootItem.setText(text); + rootItem.setText(text); currentItem = rootItem; } else { // le premier noeud n'est pas top -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit a81de5ba45fb8d709e5fe7f937e1843dc6d92d47 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 8 21:10:15 2009 +0000 generate help search index (still does not works everywhere, a shame the code is from com.sun we do not have the source...) --- .../org/nuiton/jaxx/plugin/GenerateHelpMojo.java | 76 +++++++++++++++++++--- .../java/org/nuiton/jaxx/plugin/GenerateMojo.java | 2 +- .../src/main/resources/defaultHelpSet.hs.vm | 4 +- 3 files changed, 69 insertions(+), 13 deletions(-) diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java index 9506dbb..1bfed9a 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java @@ -18,18 +18,26 @@ *##%*/ package org.nuiton.jaxx.plugin; +import com.sun.java.help.search.Indexer; import java.io.BufferedReader; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; import org.apache.maven.plugin.MojoFailureException; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; +import java.io.PrintStream; +import java.lang.reflect.Method; import java.net.URL; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.Locale; import java.util.Properties; +import org.codehaus.plexus.util.DirectoryScanner; +import org.codehaus.plexus.util.FileUtils; +import org.codehaus.plexus.util.StringUtils; import org.nuiton.i18n.I18n; import org.nuiton.util.FileUtil; import org.nuiton.util.SortedProperties; @@ -82,7 +90,7 @@ public class GenerateHelpMojo extends AbstractJaxxMojo { /** * The template used to generate helpset file. * - * Must be an existing file or a ressource in classp-ath + * Must be an existing file or a ressource in class-path * * @parameter expression="${jaxx.helpsetTemplate}" default-value="/defaultHelpSet.hs.vm" * @required @@ -93,7 +101,7 @@ public class GenerateHelpMojo extends AbstractJaxxMojo { /** * The template used to generate helpset map file. * - * Must be an existing file or a ressource in classp-ath + * Must be an existing file or a ressource in class-path * * @parameter expression="${jaxx.mapTemplate}" default-value="/defaultMap.jhm.vm" * @required @@ -104,7 +112,7 @@ public class GenerateHelpMojo extends AbstractJaxxMojo { /** * The template used to generate helpset index file. * - * Must be an existing file or a ressource in classp-ath + * Must be an existing file or a ressource in class-path * * @parameter expression="${jaxx.indexTemplate}" default-value="/defaultIndex.xml.vm" * @required @@ -115,7 +123,7 @@ public class GenerateHelpMojo extends AbstractJaxxMojo { /** * The template used to generate helpset toc file. * - * Must be an existing file or a ressource in classp-ath + * Must be an existing file or a ressource in class-path * * @parameter expression="${jaxx.tocTemplate}" default-value="/defaultToc.xml.vm" * @required @@ -126,7 +134,7 @@ public class GenerateHelpMojo extends AbstractJaxxMojo { /** * The template used to generate helpset content file. * - * Must be an existing file or a ressource in classp-ath + * Must be an existing file or a ressource in class-path * * @parameter expression="${jaxx.contentTemplate}" default-value="/defaultContent.html.vm" * @required @@ -135,6 +143,15 @@ public class GenerateHelpMojo extends AbstractJaxxMojo { */ protected File contentTemplate; /** + * Flag to generate the search index. + * + * @parameter expression="${jaxx.generateSearch}" default-value="true" + * @required + * + * @since 1.3 + */ + protected boolean generateSearch; + /** * The help ids discovered in {@link #helpIdsStore} files. */ private Properties helpIds; @@ -192,7 +209,7 @@ public class GenerateHelpMojo extends AbstractJaxxMojo { } // load ids from idsStore file - + helpIds = new SortedProperties(); BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(idsStore), getEncoding())); @@ -255,7 +272,7 @@ public class GenerateHelpMojo extends AbstractJaxxMojo { env.put("mapFileName", mapFileName); env.put("indexFileName", indexFileName); env.put("tocFileName", tocFileName); -// env.put("searchData", localePath + "/index"); + env.put("generateSearch", generateSearch); // --------------------------------------------------------------- // --- main helpset file ----------------------------------------- @@ -275,7 +292,7 @@ public class GenerateHelpMojo extends AbstractJaxxMojo { file = new File(localizedTarget, mapFileName); - Properties mergedHelpIds = generateMapFile(file, env); + generateMapFile(file, env); touchedFiles++; // --------------------------------------------------------------- @@ -284,7 +301,7 @@ public class GenerateHelpMojo extends AbstractJaxxMojo { file = new File(localizedTarget, indexFileName); - NodeItem indexRootItem = generateIndexFile(file, env); + generateIndexFile(file, env); touchedFiles++; // --------------------------------------------------------------- @@ -293,7 +310,7 @@ public class GenerateHelpMojo extends AbstractJaxxMojo { file = new File(localizedTarget, tocFileName); - NodeItem tocRootItem = generateTocFile(file, env); + generateTocFile(file, env); touchedFiles++; // --------------------------------------------------------------- @@ -302,6 +319,16 @@ public class GenerateHelpMojo extends AbstractJaxxMojo { touchedFiles += generateContentFiles(localizedTarget, env, localePath); + // --------------------------------------------------------------- + // --- generate search index ------------------------------------- + // --------------------------------------------------------------- + + if (generateSearch) { + + generateSearchIndex(localizedTarget, locale); + } + + } getLog().info(touchedFiles + " file(s) treated."); @@ -475,6 +502,35 @@ public class GenerateHelpMojo extends AbstractJaxxMojo { return rootItem; } + protected void generateSearchIndex(File localizedTarget, Locale locale) throws IllegalArgumentException, IOException, InvocationTargetException, SecurityException, IllegalAccessException, NoSuchMethodException { + + Method m = Indexer.class.getDeclaredMethod("main", String[].class); + File indexDir = new File(localizedTarget, "JavaHelpSearch"); + // remove old index + FileUtils.deleteDirectory(indexDir); + //copy resources to a tmp dir (without any VCS infos) + File tmpDir = new File(project.getBasedir(), "target" + File.separator + "jaxx-tmp" + File.separator + "indexer-" + locale + "-" + System.nanoTime()); + getLog().info("copy files to " + tmpDir + " for indexing them"); + FileUtils.copyDirectory(localizedTarget, tmpDir, "**/*", StringUtils.join(DirectoryScanner.DEFAULTEXCLUDES, ",")); + List<String> params = new ArrayList<String>(); + params.add("-verbose"); + params.add("-db"); + params.add(indexDir.getAbsolutePath()); + params.add("-logfile"); + File logFile = new File(project.getBasedir(), "target" + File.separator + "generated-sources" + File.separator + "jaxx" + File.separator + "indexer-" + locale + ".log"); + params.add(logFile.getAbsolutePath()); + params.add(tmpDir.getAbsolutePath()); + PrintStream out = System.out; + PrintStream err = System.err; + try { + m.invoke(null, (Object) params.toArray(new String[params.size()])); + } finally { + System.setOut(out); + System.setErr(err); + } + getLog().info("Search Index generated"); + } + protected NodeItem generateTocFile(File file, Properties env) throws Exception { NodeItem rootItem = null; diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java index 1a54e17..cc6a133 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java @@ -386,7 +386,7 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat return; } - getLog().info("Detects " + files.length + " modify jaxx file(s). "); + getLog().info("Detects " + files.length + " modified jaxx file(s). "); try { diff --git a/maven-jaxx-plugin/src/main/resources/defaultHelpSet.hs.vm b/maven-jaxx-plugin/src/main/resources/defaultHelpSet.hs.vm index baf3e7c..5b941b4 100644 --- a/maven-jaxx-plugin/src/main/resources/defaultHelpSet.hs.vm +++ b/maven-jaxx-plugin/src/main/resources/defaultHelpSet.hs.vm @@ -31,13 +31,13 @@ <data>$localePath/$indexFileName</data> </view> -#if ( $searchData ) +#if ( $generateSearch ) <view> <name>Search</name> <label>Search</label> <type>javax.help.SearchView</type> <data engine="com.sun.java.help.search.DefaultSearchEngine"> - $searchData + $localePath/JavaHelpSearch </data> </view> #end -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 32d6e7a0ee5a7dbb06daf5c89df842cda5dbbbf4 Author: Tony Chemit <chemit@codelutin.com> Date: Fri Oct 9 07:23:00 2009 +0000 fix javadoc + documentation --- .../src/main/java/jaxx/compiler/JAXXCompiler.java | 10 +++++----- maven-jaxx-plugin/pom.xml | 6 ------ maven-jaxx-plugin/src/site/rst/index.rst | 21 +++++++++++++++++---- maven-jaxx-plugin/src/site/site.xml | 8 +------- 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java index 3beaa21..23bd95e 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java @@ -93,11 +93,11 @@ public class JAXXCompiler { */ public static final int INLINE_THRESHOLD = 300; /** - * + * The unique object handler used in first pass */ protected final DefaultObjectHandler firstPassClassTagHandler; /** - * + * list of static imports */ protected List<String> staticImports = new ArrayList<String>(); @@ -133,7 +133,7 @@ public class JAXXCompiler { */ protected List<DataBinding> dataBindings = new ArrayList<DataBinding>(); /** - * + * table of symbols for this compiler */ protected SymbolTable symbolTable = new SymbolTable(); /** @@ -250,7 +250,7 @@ public class JAXXCompiler { */ protected JavaFile javaFile; /** - * + * configuration of the compiler */ protected CompilerConfiguration configuration; /** @@ -270,7 +270,7 @@ public class JAXXCompiler { */ protected Map<CompiledObject, String> ids = new LinkedHashMap<CompiledObject, String>(); /** - * + * default decodator to use if none specified */ protected CompiledObjectDecorator defaultDecorator; diff --git a/maven-jaxx-plugin/pom.xml b/maven-jaxx-plugin/pom.xml index ff20a08..9a623a1 100644 --- a/maven-jaxx-plugin/pom.xml +++ b/maven-jaxx-plugin/pom.xml @@ -77,12 +77,6 @@ <groupId>org.apache.maven.shared</groupId> <artifactId>maven-verifier</artifactId> </dependency> - - <!-- <dependency> - <groupId>org.apache.velocity</groupId> - <artifactId>velocity</artifactId> - <version>1.5</version> - </dependency>--> <dependency> <groupId>commons-lang</groupId> diff --git a/maven-jaxx-plugin/src/site/rst/index.rst b/maven-jaxx-plugin/src/site/rst/index.rst index a12f742..c0184f1 100644 --- a/maven-jaxx-plugin/src/site/rst/index.rst +++ b/maven-jaxx-plugin/src/site/rst/index.rst @@ -4,10 +4,23 @@ maven-jaxx-plugin .. contents:: -Présentation +Introduction ------------ -Le plugin maven pour lancer le compilateur jaxx dans un projet maven TODO +The plugin permits to generate java files from jaxx files via the `generate`_ goal. -**Veuillez consulter la JavaDoc pour de plus ample détails sur les différentes -librairies.** +You can also generate the java help system via the `generate-help`_ goal. + +Default layout +-------------- + +The plugin defines some directory layout convention, using them is a great +benefit. + + * the jaxx files should be under *src/main/java* + * the generated java files should be under *target/generated-sources/java* + * the java help files should be under *src/main/help* + +.. _generate: generate-mojo.html + +.. _generate-help: generate-help-mojo.html diff --git a/maven-jaxx-plugin/src/site/site.xml b/maven-jaxx-plugin/src/site/site.xml index b50ff43..8019064 100644 --- a/maven-jaxx-plugin/src/site/site.xml +++ b/maven-jaxx-plugin/src/site/site.xml @@ -19,17 +19,11 @@ <item name="Accueil" href="index.html"/> <item name="Détail goals" href="plugin-info.html"> <item name="generate" href="generate-mojo.html"/> + <item name="generate-help" href="generate-help-mojo.html"/> <item name="help" href="help-mojo.html"/> </item> </menu> - <menu name="Téléchargement" inherit="top"> - <item href="${labs.builder.url}/org/codelutin/jaxx/${project.artifactId}/${project.version}" - name="Télécharger la dernière version"/> - <item href="${labs.builder.url}/org/codelutin/jaxx/${project.artifactId}" - name="Voir toutes les versions"/> - </menu> - <menu name="Développeur" inherit="top"> <item name="A faire" href="Todo.html"/> </menu> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 267de1be5f39e97aab41dd5cb9ef10888b6fbb3b Author: Tony Chemit <chemit@codelutin.com> Date: Sat Oct 10 16:48:11 2009 +0000 utilisation de mavenpom 1.1.0, maven-license-plugin --- jaxx-demo/pom.xml | 17 ++++++----------- pom.xml | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/jaxx-demo/pom.xml b/jaxx-demo/pom.xml index 852b698..adf2687 100644 --- a/jaxx-demo/pom.xml +++ b/jaxx-demo/pom.xml @@ -135,19 +135,10 @@ <plugin> <groupId>org.nuiton</groupId> - <artifactId>maven-helper-plugin</artifactId> + <artifactId>maven-license-plugin</artifactId> <configuration> <copyToMETA_INF>true</copyToMETA_INF> </configuration> - <executions> - <execution> - <id>attach-licenses</id> - <goals> - <goal>add-license</goal> - <goal>add-third-party</goal> - </goals> - </execution> - </executions> </plugin> </plugins> @@ -210,10 +201,14 @@ <plugin> <groupId>org.nuiton</groupId> - <artifactId>maven-helper-plugin</artifactId> + <artifactId>maven-license-plugin</artifactId> <executions> <execution> <id>attach-licenses</id> + <goals> + <goal>add-license</goal> + <goal>add-third-party</goal> + </goals> </execution> </executions> </plugin> diff --git a/pom.xml b/pom.xml index 8e3ebe3..95f590c 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>mavenpom</artifactId> - <version>1.0.3-SNAPSHOT</version> + <version>1.1.0-SNAPSHOT</version> </parent> <artifactId>jaxx</artifactId> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 1cce9a1da829847ccea5323dfd1e47e223805b2c Author: Tony Chemit <chemit@codelutin.com> Date: Sun Oct 11 13:10:37 2009 +0000 use VelocityTemplateGenerator from maven-helper-plugin --- .../org/nuiton/jaxx/plugin/GenerateHelpMojo.java | 9 +- .../org/nuiton/jaxx/plugin/TemplateGenerator.java | 142 --------------------- 2 files changed, 5 insertions(+), 146 deletions(-) diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java index 1bfed9a..e6a9f0c 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java @@ -39,6 +39,7 @@ import org.codehaus.plexus.util.DirectoryScanner; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.StringUtils; import org.nuiton.i18n.I18n; +import org.nuiton.plugin.VelocityTemplateGenerator; import org.nuiton.util.FileUtil; import org.nuiton.util.SortedProperties; @@ -347,7 +348,7 @@ public class GenerateHelpMojo extends AbstractJaxxMojo { protected int generateContentFiles(File localizedTarget, Properties env, String localePath) throws Exception { int touchedFiles = 0; - TemplateGenerator gen = prepareGenerator(contentTemplate); + VelocityTemplateGenerator gen = prepareGenerator(contentTemplate); Enumeration<?> keys = helpIds.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); @@ -572,17 +573,17 @@ public class GenerateHelpMojo extends AbstractJaxxMojo { } protected void doGen(File template, File f, Properties env) throws Exception { - TemplateGenerator gen = prepareGenerator(template); + VelocityTemplateGenerator gen = prepareGenerator(template); gen.generate(env, f); } - protected TemplateGenerator prepareGenerator(File template) throws Exception { + protected VelocityTemplateGenerator prepareGenerator(File template) throws Exception { URL templateURL = getTemplate(template); if (verbose) { getLog().info("using template " + templateURL); } - TemplateGenerator gen = new TemplateGenerator(project, templateURL); + VelocityTemplateGenerator gen = new VelocityTemplateGenerator(project, templateURL); return gen; } } diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/TemplateGenerator.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/TemplateGenerator.java deleted file mode 100644 index 7335f34..0000000 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/TemplateGenerator.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright 2001-2005 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License" ); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.nuiton.jaxx.plugin; - -import java.io.File; -import java.io.FileWriter; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.Iterator; -import java.util.Properties; - -import org.apache.maven.project.MavenProject; -import org.apache.velocity.Template; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.app.VelocityEngine; - -/** - * Generator of template base on velocity. - * - * @author chemit - * @since 1.3 - * - */ -public class TemplateGenerator { - - protected VelocityEngine engine; - protected final MavenProject mavenProject; - protected Template velocityTemplate; - - protected TemplateGenerator(MavenProject mavenProject, URL template) throws URISyntaxException { - - if (mavenProject == null) { - throw new IllegalArgumentException("mavenProject must not be null"); - } - - if (template == null) { - throw new IllegalArgumentException("template must not be null"); - } - - this.mavenProject = mavenProject; - - Properties props = new Properties(); - - String templateName; - - if (template.toURI().isOpaque()) { - - // template is in a jar - - props = new Properties(); - props.setProperty("resource.loader", "jar"); - props.setProperty("jar.resource.loader.description", "Jar resource loader for default webstart templates"); - props.setProperty("jar.resource.loader.class", "org.apache.velocity.runtime.resource.loader.JarResourceLoader"); - - // obtain the jar url - - String url = template.toString(); - int i = url.indexOf("!"); - templateName = url.substring(i + 2); - - props.setProperty("jar.resource.loader.path", url.substring(0, i + 2)); - - } else { - - - templateName = new File(template.getFile()).getName(); - - //props.setProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM_CLASS, "org.apache.velocity.runtime.log.NullLogSystem"); - props.setProperty("file.resource.loader.path", template.getFile()); - - } - - try { - engine = new VelocityEngine(); - //engine.setProperty("runtime.log.logsystem", new NullLogSystem()); - engine.init(props); - } catch (Exception e) { - IllegalArgumentException iae = new IllegalArgumentException("Could not initialise Velocity"); - iae.initCause(e); - throw iae; - } - - try { - this.velocityTemplate = engine.getTemplate(templateName); - } catch (Exception e) { - IllegalArgumentException iae = - new IllegalArgumentException("Could not load the template file from '" + template + "'"); - iae.initCause(e); - throw iae; - } - } - - public void generate(Properties context, File outputFile) throws Exception { - - - VelocityContext vcontext = new VelocityContext(); - - // Note: properties that contain dots will not be properly parsed by Velocity. Should we replace dots with underscores ? - addPropertiesToContext(System.getProperties(), vcontext); - - addPropertiesToContext(mavenProject.getProperties(), vcontext); - addPropertiesToContext(context, vcontext); - - vcontext.put("project", mavenProject.getModel()); - - vcontext.put("outputFile", outputFile.getName()); - - FileWriter writer = new FileWriter(outputFile); - - try { - velocityTemplate.merge(vcontext, writer); - writer.flush(); - } catch (Exception e) { - throw new Exception("Could not generate the template " + velocityTemplate.getName() + ": " + e.getMessage(), e); - } finally { - writer.close(); - } - } - - protected void addPropertiesToContext(Properties properties, VelocityContext context) { - - for (Iterator<?> iter = properties.keySet().iterator(); iter.hasNext();) { - String key = (String) iter.next(); - Object value = properties.get(key); - context.put(key, value); - } - - } -} -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit fbdd0b4da7951107fea2b46b33da7374b5744bf9 Author: Tony Chemit <chemit@codelutin.com> Date: Tue Oct 13 09:07:59 2009 +0000 no using maven.src.dir in src default-value (this is not a maven property) --- .../src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java index cc6a133..1b866f8 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java @@ -62,7 +62,7 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat /** * Repertoire sources des fichiers jaxx a generer. * - * @parameter expression="${jaxx.src}" default-value="${maven.src.dir}/main/java" + * @parameter expression="${jaxx.src}" default-value="${basedir}/src/main/java" */ protected File src; /** -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit bd9a48e4f9cc96fbd2c6feab7d4354dc0e00d35e Author: Sylvain Letellier <???> Date: Wed Oct 14 10:04:28 2009 +0000 Syntax highlighting in demo sources --- jaxx-demo/pom.xml | 5 +++++ jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx | 10 +++++++++- pom.xml | 7 +++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/jaxx-demo/pom.xml b/jaxx-demo/pom.xml index adf2687..636143e 100644 --- a/jaxx-demo/pom.xml +++ b/jaxx-demo/pom.xml @@ -46,6 +46,11 @@ <artifactId>junit</artifactId> </dependency> + <dependency> + <groupId>org.fife</groupId> + <artifactId>rsyntaxtextarea</artifactId> + </dependency> + </dependencies> <!-- ************************************************************* --> diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx b/jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx index 73f77ce..215921e 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx @@ -23,6 +23,7 @@ <script><![CDATA[ import org.apache.commons.io.IOUtils; +import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; protected String[] getSources() { if (getClass() == DemoPanel.class) { @@ -77,7 +78,14 @@ private void $afterCompleteSetup() { pane.setBorder(null); //pane.setMinimumSize(jaxx.runtime.SwingUtil.newMinDimension()); // creation du contenu du fichier - JTextArea content = new JTextArea(); + RSyntaxTextArea content = new RSyntaxTextArea(); + if (extra.matches(".*\\.jaxx") || extra.matches(".*\\.xml")){ + content.setSyntaxEditingStyle(RSyntaxTextArea.SYNTAX_STYLE_XML); + } else if (extra.matches(".*\\.java")){ + content.setSyntaxEditingStyle(RSyntaxTextArea.SYNTAX_STYLE_JAVA); + } else if (extra.matches(".*\\.css")){ + content.setSyntaxEditingStyle(RSyntaxTextArea.SYNTAX_STYLE_CSS); + } content.setFont(content.getFont().deriveFont((float) 11)); content.setMinimumSize(jaxx.runtime.SwingUtil.newMinDimension()); content.setEditable(false); diff --git a/pom.xml b/pom.xml index 95f590c..8f76da8 100644 --- a/pom.xml +++ b/pom.xml @@ -230,6 +230,13 @@ </exclusions> </dependency> + <!-- rsyntaxtextarea dependency --> + <dependency> + <groupId>org.fife</groupId> + <artifactId>rsyntaxtextarea</artifactId> + <version>1.3.4</version> + </dependency> + <!-- swinglabs dependencies --> <dependency> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 380205f49e1b0c295975480f75502c354d78212c Author: Tony Chemit <chemit@codelutin.com> Date: Fri Oct 16 12:47:28 2009 +0000 use nuiton thirdparty rsyntaxtextarea... It seems somebody does not listen what I said :) --- jaxx-demo/pom.xml | 2 +- pom.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jaxx-demo/pom.xml b/jaxx-demo/pom.xml index 636143e..dd77116 100644 --- a/jaxx-demo/pom.xml +++ b/jaxx-demo/pom.xml @@ -47,7 +47,7 @@ </dependency> <dependency> - <groupId>org.fife</groupId> + <groupId>org.nuiton.thirdparty</groupId> <artifactId>rsyntaxtextarea</artifactId> </dependency> diff --git a/pom.xml b/pom.xml index 8f76da8..e7794b8 100644 --- a/pom.xml +++ b/pom.xml @@ -232,9 +232,9 @@ <!-- rsyntaxtextarea dependency --> <dependency> - <groupId>org.fife</groupId> + <groupId>org.nuiton.thirdparty</groupId> <artifactId>rsyntaxtextarea</artifactId> - <version>1.3.4</version> + <version>1.3.3</version> </dependency> <!-- swinglabs dependencies --> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 6ade2c28beb3873fb08161b0edd4f82968411744 Author: Tony Chemit <chemit@codelutin.com> Date: Fri Oct 16 14:05:07 2009 +0000 do not expose jaxx files --- jaxx-widgets/pom.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jaxx-widgets/pom.xml b/jaxx-widgets/pom.xml index 2acd569..40e80d9 100644 --- a/jaxx-widgets/pom.xml +++ b/jaxx-widgets/pom.xml @@ -64,12 +64,13 @@ <build> <resources> - <resource> + <!-- TC20091016 do not expose jaxx files --> + <!--resource> <directory>src/main/java</directory> <includes> <include>**/*.jaxx</include> </includes> - </resource> + </resource--> <resource> <directory>src/main/resources</directory> <includes> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit ca721bafbe101b6ffd494ee722f1e787d73e88c7 Author: Sylvain Letellier <???> Date: Tue Oct 20 12:58:57 2009 +0000 Bug categorie item in ItemTreeNavigation fixed --- .../runtime/swing/navigation/ItemNavigationCardPanel.java | 13 ++++++++----- .../runtime/swing/navigation/ItemTreeNavigationAdapter.java | 7 ++++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java index e5de31d..47cb8b8 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java @@ -27,11 +27,14 @@ public class ItemNavigationCardPanel extends JPanel { } public void showItem(Item i) { - if (i != null && i.getValue() != null) { - if (i.getValue() instanceof Class<?>) { - layout.show(this, i.getValue().getClass().getName()); - } else { - layout.show(this, i.getValue().getClass().getName()); + if (i != null) { + Object value = i.getValue(); + if (value != null) { + if (value instanceof Class) { + layout.show(this, ((Class) value).getName()); + } else { + layout.show(this, value.getClass().getName()); + } } } } diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemTreeNavigationAdapter.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemTreeNavigationAdapter.java index e90f8fc..7f14cb3 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemTreeNavigationAdapter.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemTreeNavigationAdapter.java @@ -39,14 +39,19 @@ public abstract class ItemTreeNavigationAdapter implements TreeSelectionListene // Recuperation du path selectionne TreePath path = e.getNewLeadSelectionPath(); + if (path == null){ + path = e.getOldLeadSelectionPath(); + } TreeModel model = tree.getModel(); if (!(model instanceof JAXXTreeModel)){ log.error("Its not an JAXXTreeModel"); return; } + // Find item coresponding - Item itemSelected = ((JAXXTreeModel) model).findItem(path.getLastPathComponent()); + Object lastPathComponent = path.getLastPathComponent(); + Item itemSelected = ((JAXXTreeModel) model).findItem(lastPathComponent); // Show corresponding panel cardPanel.showItem(itemSelected); -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 63569fd6bc3af0e7f11823bb1a6859c7ac166c49 Author: Sylvain Letellier <???> Date: Tue Oct 20 12:59:39 2009 +0000 Adding helper to return typed selected node --- .../runtime/swing/navigation/NavigationTreeContextHelper.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java index fa269fc..c2f660b 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java @@ -88,6 +88,14 @@ public class NavigationTreeContextHelper { return r; } + public <T> T getSelectedBean(JAXXContext context, Class<T> type) { + Object r = getSelectedBeanContextEntry().getContextValue(context); + if (type.equals(r.getClass())){ + return (T)getSelectedBeanContextEntry().getContextValue(context); + } + return null; + } + public void setTreeModel(JAXXContext context, NavigationTreeModel model) { getTreeModelContextEntry().setContextValue(context, model); } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 74a248bad84816b51ecf80b0258f3066fd42feaf Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 21 12:54:56 2009 +0000 fix generics on Class --- .../java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java | 4 ++-- .../java/jaxx/runtime/swing/navigation/ItemNavigationPanel.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java index 47cb8b8..9dfad76 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java @@ -30,8 +30,8 @@ public class ItemNavigationCardPanel extends JPanel { if (i != null) { Object value = i.getValue(); if (value != null) { - if (value instanceof Class) { - layout.show(this, ((Class) value).getName()); + if (value instanceof Class<?>) { + layout.show(this, ((Class<?>) value).getName()); } else { layout.show(this, value.getClass().getName()); } diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationPanel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationPanel.java index 9e01a22..7c5bf42 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationPanel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationPanel.java @@ -15,13 +15,13 @@ public class ItemNavigationPanel extends JPanel{ private static final long serialVersionUID = 1L; - protected Class associatedClass = null; + protected Class<?> associatedClass = null; - public ItemNavigationPanel(Class associatedClass) { + public ItemNavigationPanel(Class<?> associatedClass) { this.associatedClass = associatedClass; } - public Class getAssociatedClass() { + public Class<?> getAssociatedClass() { return associatedClass; } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit d105bce77e02f9d47bee567098a409bd44f24e50 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 21 12:56:13 2009 +0000 fix generics on List --- .../main/java/jaxx/demo/component/jaxx/navigation/BaseContent.jaxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/BaseContent.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/BaseContent.jaxx index 6087dbd..bf9496c 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/BaseContent.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/BaseContent.jaxx @@ -46,8 +46,8 @@ String getContent(Object data) { return "no content"; } StringBuilder buffer = new StringBuilder(); - if (data instanceof java.util.List) { - for (Object o : ((java.util.List)data)) { + if (data instanceof java.util.List<?>) { + for (Object o : ((java.util.List<?>)data)) { buffer.append(o).append("\n"); } } else { -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit a8119eff3328884bd0848d4647c090c02a402a1d Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 21 13:16:51 2009 +0000 do not make equals on class, prefer use method isAssignableFrom --- .../runtime/swing/navigation/NavigationTreeContextHelper.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java index c2f660b..5755757 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java @@ -89,11 +89,11 @@ public class NavigationTreeContextHelper { } public <T> T getSelectedBean(JAXXContext context, Class<T> type) { - Object r = getSelectedBeanContextEntry().getContextValue(context); - if (type.equals(r.getClass())){ - return (T)getSelectedBeanContextEntry().getContextValue(context); + Object r = getSelectedBean(context); + if (r != null && !type.isAssignableFrom(r.getClass())) { + throw new IllegalStateException("required a object of type '" + type + "' but had '" + r.getClass() + "'"); } - return null; + return (T) r; } public void setTreeModel(JAXXContext context, NavigationTreeModel model) { -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 00bf8b1f6bcaa1ee8cfd2db4b5095edd330d8d8b Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 22 10:57:40 2009 +0000 move context entry def static methods to jaxx.runtime.Util --- .../src/main/java/jaxx/demo/DemoTreeHelper.java | 2 +- .../src/main/java/jaxx/demo/DemoUIHandler.java | 2 +- .../jaxx/navigation/FullNavigationTreeHelper.java | 10 ++-- jaxx-runtime/src/main/java/jaxx/runtime/Util.java | 27 +++++++++ .../jaxx/runtime/context/DefaultJAXXContext.java | 6 +- .../jaxx/runtime/context/JAXXContextEntryDef.java | 64 ++++++++++++---------- .../navigation/NavigationTreeContextHelper.java | 21 +++---- .../swing/navigation/NavigationTreeModelTest.java | 15 ++--- 8 files changed, 84 insertions(+), 63 deletions(-) diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java b/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java index 9f65603..be4a442 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java @@ -189,7 +189,7 @@ public class DemoTreeHelper extends NavigationTreeHelper { /** * la definition de l'unqiue object a partage */ - static private final JAXXContextEntryDef<DemoConfig> def = JAXXContextEntryDef.newDef(DemoConfig.class); + static private final JAXXContextEntryDef<DemoConfig> def = jaxx.runtime.Util.newContextEntryDef(DemoConfig.class); /** * la pile des noeuds parent */ diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java b/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java index 702c2aa..85a20ff 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java @@ -51,7 +51,7 @@ public class DemoUIHandler { //implements JAXXHelp { /** to use log facility, just put in your code: log.info(\"...\"); */ static private Log log = LogFactory.getLog(DemoUIHandler.class); - static final JAXXContextEntryDef<DemoUI> MAIN_UI_ENTRY_DEF = JAXXContextEntryDef.newDef("mainui", DemoUI.class); + static final JAXXContextEntryDef<DemoUI> MAIN_UI_ENTRY_DEF = jaxx.runtime.Util.newContextEntryDef("mainui", DemoUI.class); /** * Methode pour initialiser l'ui principale sans l'afficher. diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java index dce72e6..37cc85a 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java @@ -23,7 +23,6 @@ package jaxx.demo.component.jaxx.navigation; import jaxx.runtime.JAXXObject; import jaxx.runtime.JAXXContext; import jaxx.runtime.context.JAXXContextEntryDef; -import static jaxx.runtime.context.JAXXContextEntryDef.newListDef; import jaxx.runtime.decorator.Decorator; import jaxx.runtime.decorator.DecoratorUtils; import jaxx.runtime.swing.CardLayout2; @@ -43,6 +42,7 @@ import static org.nuiton.i18n.I18n._; import java.util.Arrays; import java.util.List; import javax.swing.JPanel; +import jaxx.runtime.Util; /** * @@ -69,11 +69,11 @@ public class FullNavigationTreeHelper extends NavigationTreeHelper { /** * where the movies are hold in context */ - static public final JAXXContextEntryDef<List<Movie>> MOVIES = JAXXContextEntryDef.newListDef("movies"); + static public final JAXXContextEntryDef<List<Movie>> MOVIES = Util.newListContextEntryDef("movies"); /** * where the actors are hold in context */ - static public final JAXXContextEntryDef<List<People>> ACTORS = JAXXContextEntryDef.newListDef("actors"); + static public final JAXXContextEntryDef<List<People>> ACTORS = Util.newListContextEntryDef("actors"); public FullNavigationTreeHelper() { super("full"); @@ -128,7 +128,7 @@ public class FullNavigationTreeHelper extends NavigationTreeHelper { NavigationTreeNode moviesNode = builder.build( rootNode, _("movies"), - newListDef("movies"), + MOVIES, "movies", null, null); @@ -167,7 +167,7 @@ public class FullNavigationTreeHelper extends NavigationTreeHelper { // construction du noeud avec les acteurs NavigationTreeNode actorsNode = builder.build(rootNode, _("actors"), - newListDef("actors"), + ACTORS, "actors", null, null); for (People p : actors) { diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/Util.java b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java index 3f551e4..2d8f217 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/Util.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java @@ -20,6 +20,7 @@ import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.EventListener; import java.util.List; import java.util.Map; @@ -84,6 +85,32 @@ public class Util { } } + public static <O> JAXXContextEntryDef<O> newContextEntryDef(Class<O> klass) { + return newContextEntryDef(null, klass); + } + + public static <O> JAXXContextEntryDef<O> newContextEntryDef(String name, Class<O> klass) { + return new JAXXContextEntryDef<O>(name, klass); + } + + public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef() { + return newListContextEntryDef(null); + } + + //@SuppressWarnings({"unchecked"}) + public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef(String name) { + Class<List<O>> castList = Util.<O>castList(); + JAXXContextEntryDef<List<O>> contextEntryDef = new JAXXContextEntryDef<List<O>>(name,castList); + return contextEntryDef; + } + + + @SuppressWarnings({"unchecked"}) + protected static <O> Class<List<O>> castList() { + return (Class<List<O>>) Collections.emptyList().getClass(); + } + + /** * Method to initialize the context of a ui. * diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java index fc08f0f..170187d 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java @@ -1,7 +1,7 @@ package jaxx.runtime.context; import jaxx.runtime.*; -import static jaxx.runtime.context.JAXXContextEntryDef.newDef; +import jaxx.runtime.Util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -27,7 +27,7 @@ public class DefaultJAXXContext implements JAXXContext { /** * entry of the parent context */ - protected static final JAXXContextEntryDef<JAXXContext> PARENT_CONTEXT_ENTRY = newDef(JAXXContext.class); + protected static final JAXXContextEntryDef<JAXXContext> PARENT_CONTEXT_ENTRY = Util.newContextEntryDef(JAXXContext.class); /** * Logger */ @@ -174,7 +174,7 @@ public class DefaultJAXXContext implements JAXXContext { } protected JAXXContextEntryDef<?> getKey(String name, Class<?> klass) { - return JAXXContextEntryDef.newDef(name, klass); + return Util.newContextEntryDef(name, klass); } @SuppressWarnings({"unchecked"}) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContextEntryDef.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContextEntryDef.java index 54042b4..e08fd03 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContextEntryDef.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContextEntryDef.java @@ -1,13 +1,12 @@ package jaxx.runtime.context; -import jaxx.runtime.JAXXContext; -import java.util.Collections; import java.util.List; +import jaxx.runtime.JAXXContext; /** * To qualify an entry in a {@link JAXXContext}. * <p/> - * Use the factory methods <code>newDef</code> and <code>newListDef</code< to obtain new instances. + * Use the factory methods <code>newContextEntryDef</code> and <code>newListContextEntryDef</code< to obtain new instances. * * @param <O> type of the entry associated to the definition * @author chemit @@ -22,24 +21,25 @@ public class JAXXContextEntryDef<O> implements java.io.Serializable { private static final long serialVersionUID = 1L; - public static <O> JAXXContextEntryDef<O> newDef(Class<O> klass) { - return newDef(null, klass); - } - - public static <O> JAXXContextEntryDef<O> newDef(String name, Class<O> klass) { - return new JAXXContextEntryDef<O>(name, klass); - } - - public static <O> JAXXContextEntryDef<List<O>> newListDef() { - return newListDef(null); - } - - @SuppressWarnings({"unchecked"}) - public static <O> JAXXContextEntryDef<List<O>> newListDef(String name) { - JAXXContextEntryDef contextEntryDef = new JAXXContextEntryDef<List<O>>(name, JAXXContextEntryDef.<O>castList()); - contextEntryDef.klass = List.class; - return contextEntryDef; - } +// public static <O> JAXXContextEntryDef<O> newContextEntryDef(Class<O> klass) { +// return newContextEntryDef(null, klass); +// } +// +// public static <O> JAXXContextEntryDef<O> newContextEntryDef(String name, Class<O> klass) { +// return new JAXXContextEntryDef<O>(name, klass); +// } +// +// public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef() { +// return newListContextEntryDef(null); +// } +// +// @SuppressWarnings({"unchecked"}) +// public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef(String name) { +// Class<List<O>> castList = JAXXContextEntryDef.<O>castList(); +// JAXXContextEntryDef<List<O>> contextEntryDef = new JAXXContextEntryDef<List<O>>(name,castList); +// contextEntryDef.klass = castList; +// return contextEntryDef; +// } public String getName() { @@ -67,32 +67,36 @@ public class JAXXContextEntryDef<O> implements java.io.Serializable { return super.toString() + "<" + klass + ":" + name + ">"; } - protected JAXXContextEntryDef(Class<O> klass) { + public JAXXContextEntryDef(Class<O> klass) { this(null, klass); } - protected JAXXContextEntryDef(String name, Class<O> klass) { + @SuppressWarnings("unchecked") + public JAXXContextEntryDef(String name, Class<O> klass) { if (klass == null) { throw new IllegalArgumentException("class can not be null"); } this.name = name; + if (List.class.isAssignableFrom(klass)) { + klass = (Class<O>) List.class; + } this.klass = klass; } - - @SuppressWarnings({"unchecked"}) - protected static <O> Class<List<O>> castList() { - return (Class<List<O>>) Collections.emptyList().getClass(); - } +// +// @SuppressWarnings({"unchecked"}) +// protected static <O> Class<List<O>> castList() { +// return (Class<List<O>>) Collections.emptyList().getClass(); +// } @Override public boolean equals(Object o) { if (this == o) { return true; } - if (!(o instanceof JAXXContextEntryDef)) { + if (!(o instanceof JAXXContextEntryDef<?>)) { return false; } - JAXXContextEntryDef that = (JAXXContextEntryDef) o; + JAXXContextEntryDef<?> that = (JAXXContextEntryDef<?>) o; return klass.equals(that.klass) && !(name != null ? !name.equals(that.name) : that.name != null); } diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java index 5755757..5da00d9 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java @@ -2,6 +2,7 @@ package jaxx.runtime.swing.navigation; import javax.swing.JTree; import jaxx.runtime.JAXXContext; +import jaxx.runtime.Util; import jaxx.runtime.context.JAXXContextEntryDef; /** @@ -46,12 +47,12 @@ public class NavigationTreeContextHelper { public NavigationTreeContextHelper(String prefix) { this.prefix = prefix; - treeContextEntry = JAXXContextEntryDef.newDef(prefix + "-tree", JTree.class); - treeModelContextEntry = JAXXContextEntryDef.newDef(prefix + "-tree-model", NavigationTreeModel.class); - treeHandlerContextEntry = JAXXContextEntryDef.newDef(prefix + "-tree-handler", NavigationTreeHandler.class); - selectedBeanContextEntry = JAXXContextEntryDef.newDef(prefix + "-selected-bean", Object.class); - selectedNodeContextEntry = JAXXContextEntryDef.newDef(prefix + "-selected-node", NavigationTreeNode.class); - selectedPathContextEntry = JAXXContextEntryDef.newDef(prefix + "-selected-path", String.class); + treeContextEntry = Util.newContextEntryDef(prefix + "-tree", JTree.class); + treeModelContextEntry = Util.newContextEntryDef(prefix + "-tree-model", NavigationTreeModel.class); + treeHandlerContextEntry = Util.newContextEntryDef(prefix + "-tree-handler", NavigationTreeHandler.class); + selectedBeanContextEntry = Util.newContextEntryDef(prefix + "-selected-bean", Object.class); + selectedNodeContextEntry = Util.newContextEntryDef(prefix + "-selected-node", NavigationTreeNode.class); + selectedPathContextEntry = Util.newContextEntryDef(prefix + "-selected-path", String.class); } public String getPrefix() { @@ -88,14 +89,6 @@ public class NavigationTreeContextHelper { return r; } - public <T> T getSelectedBean(JAXXContext context, Class<T> type) { - Object r = getSelectedBean(context); - if (r != null && !type.isAssignableFrom(r.getClass())) { - throw new IllegalStateException("required a object of type '" + type + "' but had '" + r.getClass() + "'"); - } - return (T) r; - } - public void setTreeModel(JAXXContext context, NavigationTreeModel model) { getTreeModelContextEntry().setContextValue(context, model); } diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java index a83912d..0144afd 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java @@ -1,17 +1,14 @@ package jaxx.runtime.swing.navigation; -import jaxx.runtime.swing.navigation.NavigationTreeNode; -import jaxx.runtime.swing.navigation.NavigationTreeModel; -import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder; import jaxx.runtime.context.DefaultJAXXContext; import jaxx.runtime.JAXXContext; -import jaxx.runtime.context.JAXXContextEntryDef; import org.junit.Assert; import org.junit.Test; import java.util.Arrays; import java.util.Collections; import java.util.List; +import jaxx.runtime.Util; /** * Test du model de navigation. @@ -147,10 +144,10 @@ public class NavigationTreeModelTest { NavigationTreeNode sonSonNode; NavigationTreeNode sonSonSonNode; - builder.build(rootNode, (String) null, JAXXContextEntryDef.newDef("name", String.class), "name", null, null); - builder.build(rootNode, (String) null, JAXXContextEntryDef.newDef("name2", String.class), "name2", null, null); + builder.build(rootNode, (String) null, Util.newContextEntryDef("name", String.class), "name", null, null); + builder.build(rootNode, (String) null, Util.newContextEntryDef("name2", String.class), "name2", null, null); - sonNode = builder.build(rootNode, (String) null, JAXXContextEntryDef.newDef(Model.class), "model", null, null); + sonNode = builder.build(rootNode, (String) null, Util.newContextEntryDef(Model.class), "model", null, null); builder.build(sonNode, (String) null, "../name", "name", null, null); builder.build(sonNode, (String) null, "../integerValue", "integerValue", null, null); @@ -269,7 +266,7 @@ public class NavigationTreeModelTest { NavigationTreeNode sonSonSonNode; // first son is a list of models - sonNode = builder.build(rootNode, (String) null, JAXXContextEntryDef.newListDef("models"), "models", null, null); + sonNode = builder.build(rootNode, (String) null, Util.newListContextEntryDef("models"), "models", null, null); // first son son is a model sonSonNode = builder.build(sonNode, (String) null, "..[1]", "0", null, null); @@ -327,7 +324,7 @@ public class NavigationTreeModelTest { Object value; value = model.getBean(contextPath); - Assert.assertNotNull(value); + Assert.assertNotNull("could not find bean for path : " + contextPath, value); Assert.assertEquals(expected, value); } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 06c236729dfbf929cd9ccc53ce1227395c52f5f1 Author: Sylvain Letellier <???> Date: Fri Oct 23 14:30:44 2009 +0000 Adding repaint node mathods --- .../swing/navigation/NavigationTreeHelper.java | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java index 11d0317..1b9fbeb 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java @@ -1,6 +1,7 @@ package jaxx.runtime.swing.navigation; import java.lang.reflect.InvocationTargetException; +import java.util.Enumeration; import java.util.regex.Pattern; import javax.swing.JTree; import javax.swing.tree.TreePath; @@ -123,6 +124,63 @@ public abstract class NavigationTreeHelper extends NavigationTreeContextHelper { tree.scrollPathToVisible(path); } + /** + * Sélection du parent du noeud selectionne dans l'arbre de navigation. + * + * @param context le contexte applicatif + */ + public void gotoParentNode(JAXXContext context) { + + NavigationTreeNode node = getSelectedNode(context); + + if (node == null) { + // pas de noeud selectionne + throw new NullPointerException("no selected node in context"); + } + node = node.getParent(); + + selectNode(context, node); + } + + /** + * Demande une opération de repaint sur un noeud de l'arbre de navigation. + * + * <b>Note:</b> La descendance du noeud n'est pas repainte. + * + * @param context le contexte applicatif + * @param node le noeud à repaindre + */ + public void repaintNode(JAXXContext context, NavigationTreeNode node) { + repaintNode(context, node, false); + } + + /** + * Demande une opération de repaint sur un noeud de l'arbre de navigation. + * + * <b>Note:</b> La descendance du noeud est repainte si le paramètre + * <code>deep</code> est à <code>true</code>. + * + * @param context le contexte applicatif + * @param node le noeud à repaindre + * @param deep un flag pour activer la repainte de la descendance du noeud + */ + public void repaintNode(JAXXContext context, NavigationTreeNode node, boolean deep) { + NavigationTreeModel navigationModel = getSafeTreeModel(context); + if (log.isDebugEnabled()) { + log.debug(node); + } + navigationModel.nodeChanged(node); + if (deep) { + // repaint childs nodes + //todo we should only repaint necessary nodes ? + Enumeration<?> e = node.children(); + while (e.hasMoreElements()) { + NavigationTreeNode child = (NavigationTreeNode) e.nextElement(); + repaintNode(context, child, true); + } + } + } + public NavigationTreeModel getSafeTreeModel(JAXXContext context) throws NullPointerException { NavigationTreeModel treeModel = getTreeModel(context); if (treeModel == null) { -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit c9ccdc2cccb135412543975b7a25aaf59c0ef2cc Author: Tony Chemit <chemit@codelutin.com> Date: Fri Oct 23 16:42:17 2009 +0000 - add a contract NavigationContentUI and use it in NavigationTreeHandler --- .../swing/navigation/NavigationContentUI.java | 29 ++++++++++++++++++++++ .../swing/navigation/NavigationTreeHandler.java | 6 +++++ 2 files changed, 35 insertions(+) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationContentUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationContentUI.java new file mode 100644 index 0000000..a4a02e2 --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationContentUI.java @@ -0,0 +1,29 @@ +package jaxx.runtime.swing.navigation; + +/** + * Basic contract on a content UI. + * + * @author chemit + * @since 2.0.0 + */ +public interface NavigationContentUI { + + /** + * Init the ui just before been opened by the method + * {@link NavigationTreeHandler#openUI(java.awt.Component, jaxx.runtime.swing.navigation.NavigationTreeNode)}. + * + * @param node the selected node associated to the ui + * @throws Exception + * @see NavigationTreeHandler#openUI(java.awt.Component, jaxx.runtime.swing.navigation.NavigationTreeNode) + */ + void openUI(NavigationTreeNode node) throws Exception; + + /** + * Clean the ui after been closed by the method {@link NavigationTreeHandler#closeUI(java.awt.Component)}. + * + * @param node the selected node associated to the ui + * @throws Exception + * @see NavigationTreeHandler#closeUI(java.awt.Component) + */ + void closeUI(NavigationTreeNode node) throws Exception; +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java index 1a79868..89afc9c 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java @@ -170,6 +170,9 @@ public abstract class NavigationTreeHandler extends DefaultTreeSelectionModel { // can not changed current node return; } + if (component instanceof NavigationContentUI) { + ((NavigationContentUI) component).closeUI((NavigationTreeNode) path.getLastPathComponent()); + } } catch (Exception ex) { treateError(ex); return; @@ -217,6 +220,9 @@ public abstract class NavigationTreeHandler extends DefaultTreeSelectionModel { helper.setSelectedNode(ctxt, node); // really open the ui associated with the selected node + if (newUI instanceof NavigationContentUI) { + ((NavigationContentUI) newUI).openUI(node); + } openUI(newUI, node); } catch (Exception e) { -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 56fdd488dbc233b71e28d28f22680f7ff8e8761c Author: Tony Chemit <chemit@codelutin.com> Date: Fri Oct 23 16:44:44 2009 +0000 - add a contract NavigationContentUI and use it in NavigationTreeHandler - improve demo --- jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java | 9 +- .../src/main/java/jaxx/demo/DemoUIHandler.java | 12 ++- jaxx-demo/src/main/java/jaxx/demo/RunDemo.java | 2 +- .../jaxx/navigation/FullNavigationTreeDemo.jaxx | 4 +- .../jaxx/navigation/FullNavigationTreeHelper.java | 87 ++------------- .../navigation/FullNavigationTreeModelBuilder.java | 120 +++++++++++++++++++++ .../ActorContentUI.jaxx} | 20 +++- .../jaxx/navigation/content/ActorsContentUI.jaxx | 88 +++++++++++++++ .../MovieContentUI.jaxx} | 20 +++- .../jaxx/navigation/content/MoviesContentUI.jaxx | 86 +++++++++++++++ .../main/resources/i18n/jaxx-demo-en_GB.properties | 5 + .../main/resources/i18n/jaxx-demo-fr_FR.properties | 5 + 12 files changed, 360 insertions(+), 98 deletions(-) diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java b/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java index 996df37..53efae0 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java @@ -26,6 +26,7 @@ import java.beans.PropertyChangeListener; import java.util.Locale; import java.util.Properties; +import jaxx.demo.component.jaxx.navigation.FullNavigationTreeDemo; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -110,6 +111,11 @@ public class DemoConfig extends org.nuiton.util.ApplicationConfig { return result; } + public String getDemoPath() { + String result = getOption(Option.DEMO_PATH.key); + return result; + } + public void setFullscreen(boolean fullscreen) { Object oldValue = null; setOption(Option.FULL_SCREEN.key, fullscreen + ""); @@ -159,7 +165,8 @@ public class DemoConfig extends org.nuiton.util.ApplicationConfig { CONFIG_FILE(CONFIG_FILE_NAME, _("jaxxdemo.config.configFileName.description"), "jaxxdemo", String.class, true, true), FULL_SCREEN("ui.fullscreen", _("jaxxdemo.config.ui.fullscreen"), "false", Boolean.class, false, false), - LOCALE("ui.locale", _("jaxxdemo.config.ui.locale"), Locale.FRANCE.toString(), Locale.class, false, false); + LOCALE("ui.locale", _("jaxxdemo.config.ui.locale"), Locale.FRANCE.toString(), Locale.class, false, false), + DEMO_PATH("ui.demo.path", _("jaxxdemo.config.ui.demo.path"), "$root/jaxxdemo.tree.component.jaxx/jaxxdemo.tree.component.jaxx.tree.navigation/" + FullNavigationTreeDemo.class.getSimpleName(), String.class, false, false); public final String key; public final String description; public final String defaultValue; diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java b/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java index 85a20ff..7cd25b6 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java @@ -93,7 +93,7 @@ public class DemoUIHandler { //implements JAXXHelp { return ui; } - public void displayUI(final DemoUI ui, final NavigationTreeNode node) { + public void displayUI(final DemoUI ui, final String nodePath) { // expend all nodes of the demo tree jaxx.runtime.SwingUtil.expandTree(ui.getNavigation()); @@ -104,12 +104,12 @@ public class DemoUIHandler { //implements JAXXHelp { public void run() { String path; - if (node == null) { + if (nodePath == null) { // take first node path = "$root/jaxxdemo.tree.component.swing"; } else { // take selected node - path = node.getFullPath(); + path = nodePath; } log.info("node to re select " + path); // select node @@ -146,6 +146,7 @@ public class DemoUIHandler { //implements JAXXHelp { DemoUI ui = getUI(rootContext); NavigationTreeNode node = null; + String nodePath = null; if (ui != null) { @@ -154,7 +155,8 @@ public class DemoUIHandler { //implements JAXXHelp { node = ui.getTreeHelper().getSelectedNode(ui); if (node != null) { - log.info("selected node " + node.getFullPath()); + nodePath = node.getFullPath(); + log.info("selected node " + nodePath); } ErrorDialogUI.init(null); @@ -169,7 +171,7 @@ public class DemoUIHandler { //implements JAXXHelp { ui = initUI(rootContext, fullscreen); - displayUI(ui, node); + displayUI(ui, nodePath); } /** diff --git a/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java b/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java index f1c1ede..43ad5b5 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java +++ b/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java @@ -119,7 +119,7 @@ public class RunDemo { log.info(_("jaxxdemo.init.ui.done")); - handler.displayUI(ui, null); + handler.displayUI(ui, config.getDemoPath()); } catch (Exception e) { ErrorDialogUI.showError(e); diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx index ea83673..3a3f4d3 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx @@ -28,12 +28,12 @@ import jaxx.runtime.SwingUtil; private final FullNavigationTreeHelper helper = new FullNavigationTreeHelper(); - +setContextValue(helper); helper.createModel(this); @Override protected String[] getSources() { - return new String[]{ getDefaultSource(), "BaseContent.jaxx", "FullNavigationTreeHelper.java", "Movie.java", "People.java" }; + return new String[]{ getDefaultSource(), "FullNavigationTreeHelper.java", "Movie.java", "People.java" }; } private void $afterCompleteSetup() { diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java index 37cc85a..9b8d6f3 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java @@ -23,7 +23,6 @@ package jaxx.demo.component.jaxx.navigation; import jaxx.runtime.JAXXObject; import jaxx.runtime.JAXXContext; import jaxx.runtime.context.JAXXContextEntryDef; -import jaxx.runtime.decorator.Decorator; import jaxx.runtime.decorator.DecoratorUtils; import jaxx.runtime.swing.CardLayout2; import jaxx.runtime.swing.ErrorDialogUI; @@ -31,13 +30,10 @@ import jaxx.runtime.swing.navigation.NavigationTreeHandler; import jaxx.runtime.swing.navigation.NavigationTreeHandler.Strategy; import jaxx.runtime.swing.navigation.NavigationTreeHandlerWithCardLayout; import jaxx.runtime.swing.navigation.NavigationTreeHelper; -import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder; -import jaxx.runtime.swing.navigation.NavigationTreeNode; import jaxx.runtime.swing.navigation.NavigationTreeModel; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import static org.nuiton.i18n.I18n._; import java.util.Arrays; import java.util.List; @@ -74,6 +70,7 @@ public class FullNavigationTreeHelper extends NavigationTreeHelper { * where the actors are hold in context */ static public final JAXXContextEntryDef<List<People>> ACTORS = Util.newListContextEntryDef("actors"); + protected FullNavigationTreeModelBuilder builder; public FullNavigationTreeHelper() { super("full"); @@ -85,6 +82,7 @@ public class FullNavigationTreeHelper extends NavigationTreeHelper { * @param context the context where to hold the model */ public void createModel(JAXXContext context) { + log.info("for " + this); People a = new People("0", "Jack", "Black", 0, "/jaxx/demo/images/jack.jpg"); People a2 = new People("1", "Héctor", "Jiménez", 0, "/jaxx/demo/images/hector.jpg"); People a3 = new People("2", "Ana", "de la Reguera", 0, "/jaxx/demo/images/ana.jpg"); @@ -105,87 +103,14 @@ public class FullNavigationTreeHelper extends NavigationTreeHelper { @Override public NavigationTreeModel createTreeModel(JAXXContext context) { - List<Movie> movies = MOVIES.getContextValue(context); - List<People> actors = ACTORS.getContextValue(context); - - if (log.isDebugEnabled()) { - log.debug("for " + movies.size() + " movie(s)"); + if (builder == null) { + builder = new FullNavigationTreeModelBuilder(context); } - NavigationTreeModelBuilder builder = new NavigationTreeModelBuilder("/", context, BaseContent.class, - null); - - Decorator<Movie> mDecorator = DecoratorUtils.get(Movie.class.getSimpleName()); - Decorator<People> pDecorator = DecoratorUtils.get(People.class.getSimpleName()); - - // construction du noeud root - // il ne contient pas de context et ne sera pas visible - NavigationTreeNode rootNode = builder.buildEmptyRoot(null, "$root"); - - // construction du noeud avec les films recupere la liste des films - // dans le context avec la clef movies - // navigation path = $root/movies - NavigationTreeNode moviesNode = builder.build( - rootNode, - _("movies"), - MOVIES, - "movies", - null, - null); - - for (Movie m : movies) { - - // navigation path = $root/movies/m.id - NavigationTreeNode movieNode = builder.build( - moviesNode, - mDecorator, - "..[@id=\"" + m.getId() + "\"]", - m.getId(), - null, - null); - - // navigation path = $root/movies/m.id/actors - NavigationTreeNode actorsNode = builder.build( - movieNode, - _("actors"), - "../actors", - "actors", - null, - null); - - for (People p : m.getActors()) { - // navigation path = $root/movies/m.id/actors/p.id - builder.build( - actorsNode, - pDecorator, - "..[@id=\"" + p.getId() + "\"]", - p.getId(), - null, - null); - } - } + builder.createInitialModel(); - // construction du noeud avec les acteurs - NavigationTreeNode actorsNode = builder.build(rootNode, _("actors"), - ACTORS, - "actors", null, null); - - for (People p : actors) { - // navigation path = $root/actors/p.id - builder.build( - actorsNode, - pDecorator, - "..[@id=\"" + p.getId() + "\"]", - p.getId(), - null, - null); - } NavigationTreeModel model = builder.getModel(); - if (log.isDebugEnabled()) { - builder.printModel(model.getRoot()); - } - // save tree model in context setTreeModel(context, model); return model; @@ -203,7 +128,7 @@ public class FullNavigationTreeHelper extends NavigationTreeHelper { handler = new NavigationTreeHandlerWithCardLayout( getPrefix(), context, - Strategy.PER_NODE) { + Strategy.PER_UI_TYPE) { private static final long serialVersionUID = 1L; diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeModelBuilder.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeModelBuilder.java new file mode 100644 index 0000000..acfeb84 --- /dev/null +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeModelBuilder.java @@ -0,0 +1,120 @@ +package jaxx.demo.component.jaxx.navigation; + +import jaxx.runtime.JAXXContext; +import jaxx.runtime.decorator.Decorator; +import jaxx.runtime.decorator.DecoratorUtils; +import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder; +import jaxx.runtime.swing.navigation.NavigationTreeNode; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import jaxx.demo.component.jaxx.navigation.content.*; +import static org.nuiton.i18n.I18n._; + +import java.util.List; + +/** + * + * @author chemit + * @since 2.0.0 + */ +public class FullNavigationTreeModelBuilder extends NavigationTreeModelBuilder { + + private static final long serialVersionUID = 1l; + /** + * Logger + */ + static private final Log log = LogFactory.getLog(FullNavigationTreeModelBuilder.class); + + protected FullNavigationTreeModelBuilder(JAXXContext context) { + super("/", context, null, null); + } + + public void addMovie(Movie movie) { + //TODO + } + + public void addActor(People people,Movie... movies) { + //TODO + } + + public void createInitialModel() { + + List<Movie> movies = FullNavigationTreeHelper.MOVIES.getContextValue(getModel().getContext()); + List<People> actors = FullNavigationTreeHelper.ACTORS.getContextValue(getModel().getContext()); + + if (log.isDebugEnabled()) { + log.debug("for " + movies.size() + " movie(s)"); + } + + + Decorator<Movie> mDecorator = DecoratorUtils.get(Movie.class.getSimpleName()); + Decorator<People> pDecorator = DecoratorUtils.get(People.class.getSimpleName()); + + // construction du noeud root + // il ne contient pas de context et ne sera pas visible + NavigationTreeNode rootNode = this.buildEmptyRoot(null, "$root"); + + // construction du noeud avec les films recupere la liste des films + // dans le context avec la clef movies + // navigation path = $root/movies + NavigationTreeNode moviesNode = this.build( + rootNode, + _("movies"), + FullNavigationTreeHelper.MOVIES, + "movies", + MoviesContentUI.class, + null); + + for (Movie m : movies) { + + // navigation path = $root/movies/m.id + NavigationTreeNode movieNode = this.build( + moviesNode, + mDecorator, + "..[@id=\"" + m.getId() + "\"]", + m.getId(), + MovieContentUI.class, + null); + + // navigation path = $root/movies/m.id/actors + NavigationTreeNode actorsNode = this.build( + movieNode, + _("actors"), + "../actors", + "actors", + ActorsContentUI.class, + null); + + for (People p : m.getActors()) { + // navigation path = $root/movies/m.id/actors/p.id + this.build( + actorsNode, + pDecorator, + "..[@id=\"" + p.getId() + "\"]", + p.getId(), + ActorContentUI.class, + null); + } + } + + // construction du noeud avec les acteurs + NavigationTreeNode actorsNode = this.build(rootNode, _("actors"), + FullNavigationTreeHelper.ACTORS, + "actors", ActorsContentUI.class, null); + + for (People p : actors) { + // navigation path = $root/actors/p.id + this.build( + actorsNode, + pDecorator, + "..[@id=\"" + p.getId() + "\"]", + p.getId(), + ActorContentUI.class, + null); + } + + if (log.isDebugEnabled()) { + printModel(getModel().getRoot()); + } + } +} diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/BaseContent.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorContentUI.jaxx similarity index 82% copy from jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/BaseContent.jaxx copy to jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorContentUI.jaxx index bf9496c..9e04cf5 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/BaseContent.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorContentUI.jaxx @@ -18,14 +18,24 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<JPanel layout='{new BorderLayout()}'> - - <Object id='data' javaBean='helper.getSelectedBean(this)'/> +<JPanel layout='{new BorderLayout()}' implements='jaxx.runtime.swing.navigation.NavigationContentUI'> <script><![CDATA[ import jaxx.runtime.SwingUtil; +import jaxx.runtime.swing.navigation.NavigationTreeNode; +import jaxx.demo.component.jaxx.navigation.*; -private final FullNavigationTreeHelper helper = new FullNavigationTreeHelper(); +@Override +public void openUI(NavigationTreeNode node) throws Exception { + People p = (People) getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this); + log.info("selected people = "+p); + setData(p); +} + +@Override +public void closeUI(NavigationTreeNode node) throws Exception { +// nothing to do +} String getType(Object data) { if (data == null) { @@ -71,6 +81,8 @@ ImageIcon getImage(Object data) { ]]> </script> + <People id='data' javaBean='(People) getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this)'/> + <JSplitPane id='splitPane' orientation='{JSplitPane.VERTICAL_SPLIT}' resizeWeight='0.5' diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx new file mode 100644 index 0000000..67e20f1 --- /dev/null +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx @@ -0,0 +1,88 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> +<JPanel layout='{new BorderLayout()}' implements='jaxx.runtime.swing.navigation.NavigationContentUI'> + + <script><![CDATA[ +import jaxx.runtime.SwingUtil; +import jaxx.demo.component.jaxx.navigation.*; +import jaxx.runtime.decorator.DecoratorUtils; +import jaxx.runtime.decorator.swing.DecoratorListCellRenderer; +import jaxx.runtime.swing.navigation.NavigationTreeNode; + +@Override +public void openUI(NavigationTreeNode node) throws Exception { + java.util.List<People> ps = (java.util.List<People>)getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this); + log.info("selected peoples = "+ps.size()); + setData(ps); +} + +@Override +public void closeUI(NavigationTreeNode node) throws Exception { +// nothing to do +} + +String getType(Object data) { + if (data == null) { + return "no type"; + } + if (data instanceof java.util.List<?>) { + java.util.List<?> l = (java.util.List<?>) data; + if (l.isEmpty()) { + return "Empty collection"; + } + return "Collection of " + l.size() + " " + l.get(0).getClass().getSimpleName() + "(s)"; + } + return data.getClass().getSimpleName(); +} + +ListModel getModel(java.util.List<People> data) { + + DefaultListModel model = new DefaultListModel(); + for (People m : data) { + model.addElement(m); + } + return model; +} + + ]]> + </script> + + <java.util.List id='data' + genericType='People' + javaBean='(java.util.List<People>)getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this)'/> + + <JScrollPane border='{new TitledBorder("Content Type : " + getType(getData()))}' + constraints='BorderLayout.CENTER' + columnHeaderView='{toolbar}' + horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' + verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> + <JList id='list' model='{getModel(getData())}' cellRenderer='{new DecoratorListCellRenderer(DecoratorUtils.get(People.class.getSimpleName()))}'/> + </JScrollPane> + <JToolBar id='toolbar' constraints='BorderLayout.SOUTH' + floatable='false'> + <JPanel layout='{new GridLayout(1,0)}'> + <JButton text='jaxxdemo.action.show' enabled='{list.getSelectedIndex()!=-1}'/> + <JButton text='jaxxdemo.action.add'/> + <JButton text='jaxxdemo.action.remove' enabled='{list.getSelectedIndex()!=-1}'/> + </JPanel> + </JToolBar> + +</JPanel> \ No newline at end of file diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/BaseContent.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MovieContentUI.jaxx similarity index 82% rename from jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/BaseContent.jaxx rename to jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MovieContentUI.jaxx index bf9496c..fab8195 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/BaseContent.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MovieContentUI.jaxx @@ -18,14 +18,24 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<JPanel layout='{new BorderLayout()}'> - - <Object id='data' javaBean='helper.getSelectedBean(this)'/> +<JPanel layout='{new BorderLayout()}' implements='jaxx.runtime.swing.navigation.NavigationContentUI'> <script><![CDATA[ import jaxx.runtime.SwingUtil; +import jaxx.runtime.swing.navigation.NavigationTreeNode; +import jaxx.demo.component.jaxx.navigation.*; -private final FullNavigationTreeHelper helper = new FullNavigationTreeHelper(); +@Override +public void openUI(NavigationTreeNode node) throws Exception { + Movie m = (Movie) getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this); + log.info("selected movie = "+m); + setData(m); +} + +@Override +public void closeUI(NavigationTreeNode node) throws Exception { +// nothing to do +} String getType(Object data) { if (data == null) { @@ -71,6 +81,8 @@ ImageIcon getImage(Object data) { ]]> </script> + <Movie id='data' javaBean='(Movie) getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this)'/> + <JSplitPane id='splitPane' orientation='{JSplitPane.VERTICAL_SPLIT}' resizeWeight='0.5' diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx new file mode 100644 index 0000000..d6fcded --- /dev/null +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx @@ -0,0 +1,86 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> +<JPanel layout='{new BorderLayout()}' implements='jaxx.runtime.swing.navigation.NavigationContentUI'> + + <script><![CDATA[ +import jaxx.runtime.SwingUtil; +import jaxx.demo.component.jaxx.navigation.*; +import jaxx.runtime.decorator.DecoratorUtils; +import jaxx.runtime.decorator.swing.DecoratorListCellRenderer; +import jaxx.runtime.swing.navigation.NavigationTreeNode; + +@Override +public void openUI(NavigationTreeNode node) throws Exception { + java.util.List<Movie> ms = (java.util.List<Movie>)getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this); + log.info("selected movies = "+ms.size()); + setData(ms); +} + +@Override +public void closeUI(NavigationTreeNode node) throws Exception { +// nothing to do +} +String getType(Object data) { + if (data == null) { + return "no type"; + } + if (data instanceof java.util.List<?>) { + java.util.List<?> l = (java.util.List<?>) data; + if (l.isEmpty()) { + return "Empty collection"; + } + return "Collection of " + l.size() + " " + l.get(0).getClass().getSimpleName() + "(s)"; + } + return data.getClass().getSimpleName(); +} + +ListModel getModel(java.util.List<Movie> data) { + DefaultListModel model = new DefaultListModel(); + for (Movie m : data) { + model.addElement(m); + } + return model; +} + + ]]> + </script> + + <java.util.List id='data' + genericType='Movie' + javaBean='(java.util.List<Movie>)getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this)'/> + + <JScrollPane border='{new TitledBorder("Content Type : " + getType(getData()))}' + constraints='BorderLayout.CENTER' + columnHeaderView='{toolbar}' + horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' + verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> + <JList id='list' model='{getModel(getData())}' cellRenderer='{new DecoratorListCellRenderer(DecoratorUtils.get(Movie.class.getSimpleName()))}'/> + </JScrollPane> + <JToolBar id='toolbar' opaque='false' constraints='BorderLayout.SOUTH' + floatable='false'> + <JPanel layout='{new GridLayout(1,0)}'> + <JButton text='jaxxdemo.action.show' enabled='{list.getSelectedIndex()!=-1}'/> + <JButton text='jaxxdemo.action.add'/> + <JButton text='jaxxdemo.action.remove' enabled='{list.getSelectedIndex()!=-1}'/> + </JPanel> + </JToolBar> + +</JPanel> \ No newline at end of file diff --git a/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties b/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties index 2aa6120..9729737 100644 --- a/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties +++ b/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties @@ -117,6 +117,7 @@ i18neditor.popup.title= jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>For more informations, viste the <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-demo">website of the project</a>. jaxxdemo.action.about=About... jaxxdemo.action.about.tip=About JAXXDemo... +jaxxdemo.action.add= jaxxdemo.action.configuration=Preferences jaxxdemo.action.configuration.tip=Change the preferences of the application jaxxdemo.action.exit=Quit @@ -131,6 +132,8 @@ jaxxdemo.action.locale.uk=English jaxxdemo.action.locale.uk.tip=Change to english language jaxxdemo.action.normalscreen=Normal screen jaxxdemo.action.normalscreen.tip=Change to normal screen mode +jaxxdemo.action.remove= +jaxxdemo.action.show= jaxxdemo.action.site=Web site jaxxdemo.action.site.tip=Go to the web site jaxxdemo.config.category.directories=Files @@ -138,6 +141,7 @@ jaxxdemo.config.category.directories.description=Files used by application jaxxdemo.config.category.other=Others jaxxdemo.config.category.other.description=Others preferences jaxxdemo.config.configFileName.description=Configuration file name +jaxxdemo.config.ui.demo.path= jaxxdemo.config.ui.fullscreen=To change the screen mode (true for full screen) jaxxdemo.config.ui.locale=Locale of the application jaxxdemo.i18neditor.configuration=Configuration @@ -189,5 +193,6 @@ numbereditor.positive.int=Positive integer numbereditor.type=Type numbereditor.with.auto.popup=With auto popup numbereditor.without.auto.popup=Without auto popup +test= valid= x= diff --git a/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties b/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties index ffe9202..418d14c 100644 --- a/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties +++ b/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties @@ -117,6 +117,7 @@ i18neditor.popup.title= jaxxdemo.about.message=<h3>JAXX Demo</h3><hr/>Pour plus d'informations, vous pouvez visiter le <a href\="http\://maven-site.nuiton.org/jaxx/jaxx-demo">site du projet</a>. jaxxdemo.action.about=A propos jaxxdemo.action.about.tip=A propos de JAXX Demo... +jaxxdemo.action.add= jaxxdemo.action.configuration=Configuration jaxxdemo.action.configuration.tip=Modifier la configuration jaxxdemo.action.exit=Quitter @@ -131,6 +132,8 @@ jaxxdemo.action.locale.uk=Anglais jaxxdemo.action.locale.uk.tip=Changer la langue en anglais jaxxdemo.action.normalscreen=Ecran normal jaxxdemo.action.normalscreen.tip=Revenir en mode normal +jaxxdemo.action.remove= +jaxxdemo.action.show= jaxxdemo.action.site=Site internet jaxxdemo.action.site.tip=Acc\u00E9der au site de l'application sur internet jaxxdemo.config.category.directories=R\u00E9pertoires @@ -138,6 +141,7 @@ jaxxdemo.config.category.directories.description=R\u00E9pertoires de l'applicati jaxxdemo.config.category.other=Autre jaxxdemo.config.category.other.description=Autres options jaxxdemo.config.configFileName.description=Le nom du fichier de configuration +jaxxdemo.config.ui.demo.path= jaxxdemo.config.ui.fullscreen=Pour afficher l'aplication en mode pleine \u00E9cran jaxxdemo.config.ui.locale=Langue utilis\u00E9e par l'application (fr_FR, en_GB ou es_ES) jaxxdemo.i18neditor.configuration=Configuration @@ -189,5 +193,6 @@ numbereditor.positive.int=Entier primitif positif \: [%1$s] numbereditor.type=Type d'\u00E9diteur numbereditor.with.auto.popup=Avec popup auto numbereditor.without.auto.popup=Sans popup auto +test= valid=valide x=x -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit bea7197f9fc62c151cf500db64e972ab4a77571a Author: Tony Chemit <chemit@codelutin.com> Date: Fri Oct 23 18:01:04 2009 +0000 add gotoChildNode in NavigationTreeHelper --- .../swing/navigation/NavigationTreeHelper.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java index 1b9fbeb..87072a2 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java @@ -143,6 +143,25 @@ public abstract class NavigationTreeHelper extends NavigationTreeContextHelper { } /** + * Sélection d'un fils du noeud selectionne dans l'arbre de navigation. + * + * @param context le contexte applicatif + * @param childIndex index du fils a selectionner + */ + public void gotoChildNode(JAXXContext context, int childIndex) { + + NavigationTreeNode node = getSelectedNode(context); + + if (node == null) { + // pas de noeud selectionne + throw new NullPointerException("no selected node in context"); + } + node = node.getChildAt(childIndex); + + selectNode(context, node); + } + + /** * Demande une opération de repaint sur un noeud de l'arbre de navigation. * * <b>Note:</b> La descendance du noeud n'est pas repainte. -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 3177389c7e3bc88f388160bde4f5ead8c13a1cf8 Author: Tony Chemit <chemit@codelutin.com> Date: Sat Oct 24 11:30:36 2009 +0000 Evolution #100: amélioration du design du compilateur --- .../java/jaxx/compiler/types/ColorConverter.java | 7 +++++++ .../types/GridBagConstraintsConverter.java | 7 +++++++ .../java/jaxx/compiler/types/InsetsConverter.java | 5 +++++ .../jaxx/compiler/types/KeyStrokeConverter.java | 5 +++++ .../jaxx/compiler/types/PrimitiveConverter.java | 24 ++++++++++++++++++++++ .../java/jaxx/compiler/types/TypeConverter.java | 2 ++ .../main/java/jaxx/compiler/types/TypeManager.java | 24 ++++++++++++++++------ 7 files changed, 68 insertions(+), 6 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/types/ColorConverter.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/ColorConverter.java index daf2181..f902e8d 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/types/ColorConverter.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/ColorConverter.java @@ -10,6 +10,13 @@ import java.lang.reflect.Field; public class ColorConverter implements TypeConverter { @Override + public Class<?>[] getSupportedTypes() { + return new Class<?>[]{ + Color.class + }; + } + + @Override public String getJavaCode(Object object) { Color color = (Color) object; return "new Color(" + color.getRed() + ", " + color.getGreen() + ", " + color.getBlue() + ")"; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/types/GridBagConstraintsConverter.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/GridBagConstraintsConverter.java index 3158c3b..5ddff7a 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/types/GridBagConstraintsConverter.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/GridBagConstraintsConverter.java @@ -9,6 +9,13 @@ import java.awt.GridBagConstraints; public class GridBagConstraintsConverter implements TypeConverter { @Override + public Class<?>[] getSupportedTypes() { + return new Class<?>[] { + GridBagConstraints.class + }; + } + + @Override public String getJavaCode(Object object) { GridBagConstraints g = (GridBagConstraints) object; return "new GridBagConstraints(" + g.gridx + ", " + g.gridy + ", " + g.gridwidth + ", " + g.gridheight + ", " + diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/types/InsetsConverter.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/InsetsConverter.java index 8326288..5d387c4 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/types/InsetsConverter.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/InsetsConverter.java @@ -10,6 +10,11 @@ import java.util.StringTokenizer; public class InsetsConverter implements TypeConverter { @Override + public Class<?>[] getSupportedTypes() { + return new Class<?>[]{Insets.class}; + } + + @Override public String getJavaCode(Object object) { Insets insets = (Insets) object; return "new Insets(" + insets.top + ", " + insets.left + ", " + insets.bottom + ", " + insets.right + ")"; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/types/KeyStrokeConverter.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/KeyStrokeConverter.java index 30e5e01..4dec0a2 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/types/KeyStrokeConverter.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/KeyStrokeConverter.java @@ -9,6 +9,11 @@ import javax.swing.KeyStroke; public class KeyStrokeConverter implements TypeConverter { @Override + public Class<?>[] getSupportedTypes() { + return new Class<?>[]{KeyStroke.class}; + } + + @Override public String getJavaCode(Object object) { return "KeyStroke.getKeyStroke(\"" + object.toString() + "\")"; } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/types/PrimitiveConverter.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/PrimitiveConverter.java index 177b241..2c6c84b 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/types/PrimitiveConverter.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/PrimitiveConverter.java @@ -9,6 +9,30 @@ import jaxx.compiler.JAXXCompiler; public class PrimitiveConverter implements TypeConverter { @Override + public Class<?>[] getSupportedTypes() { + + return new Class<?>[]{ + boolean.class, + Boolean.class, + byte.class, + Byte.class, + short.class, + Short.class, + int.class, + Integer.class, + long.class, + Long.class, + float.class, + Float.class, + double.class, + Double.class, + char.class, + Character.class, + String.class + }; + } + + @Override public String getJavaCode(Object object) { if (object instanceof Boolean) { return String.valueOf(((Boolean) object).booleanValue()); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/types/TypeConverter.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/TypeConverter.java index 822773e..46c6376 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/types/TypeConverter.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/TypeConverter.java @@ -6,6 +6,8 @@ package jaxx.compiler.types; public interface TypeConverter { + Class<?>[] getSupportedTypes(); + String getJavaCode(Object object); Object convertFromString(String string, Class<?> type); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/types/TypeManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/TypeManager.java index e000e8b..6f3d26b 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/types/TypeManager.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/TypeManager.java @@ -6,19 +6,31 @@ package jaxx.compiler.types; import java.util.HashMap; import java.util.Map; +import java.util.ServiceLoader; public class TypeManager { - private static Map<Class<?>, TypeConverter> converters = new HashMap<Class<?>, TypeConverter>(); + private static Map<Class<?>, TypeConverter> converters; + + public static Map<Class<?>, TypeConverter> getConverters() { + if (converters == null) { + converters = new HashMap<Class<?>, TypeConverter>(); + // load converters + ServiceLoader<TypeConverter> loader = ServiceLoader.load(TypeConverter.class); + for (TypeConverter c : loader) { + // for each supported type, register the converter + for (Class<?> type : c.getSupportedTypes()) { + converters.put(type, c); + } + } + } + return converters; + } private TypeManager() { /* not instantiable */ } - public static void registerTypeConverter(Class<?> type, TypeConverter converter) { - converters.put(type, converter); - } - public static TypeConverter getTypeConverter(Class<?> type) { - return converters.get(type); + return getConverters().get(type); } public static String getJavaCode(Object object) { -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 1a7edadc94dddc6f49b61c6e29834545e8454aa5 Author: Tony Chemit <chemit@codelutin.com> Date: Sat Oct 24 11:31:57 2009 +0000 - Evolution #100: amélioration du design du compilateur - Evolution #99: Améliorer le code généré - Evolution #98: les objets JAXX sont serializable --- .../main/java/jaxx/compiler/CompiledObject.java | 5 +- .../src/main/java/jaxx/compiler/DataBinding.java | 6 +- .../src/main/java/jaxx/compiler/DataSource.java | 17 +- .../src/main/java/jaxx/compiler/JAXXCompiler.java | 181 ++++++---- .../{JAXXCompilerLaunchor.java => JAXXEngine.java} | 397 ++++++++++++++------- .../src/main/java/jaxx/compiler/JAXXProfile.java | 2 +- .../src/main/java/jaxx/compiler/JavaField.java | 182 ---------- .../main/java/jaxx/compiler/StylesheetHelper.java | 17 +- .../decorators/BoxedCompiledObjectDecorator.java | 7 +- .../decorators/CompiledObjectDecorator.java | 4 +- .../decorators/CompiledObjectDecoratorManager.java | 59 --- .../decorators/DefaultCompiledObjectDecorator.java | 62 ++-- .../HelpRootCompiledObjectDecorator.java | 23 +- .../java/jaxx/compiler/generators/Generator.java | 2 +- .../jaxx/compiler/generators/GeneratorManager.java | 42 --- .../compiler/generators/JAXXObjectGenerator.java | 363 ++++++++----------- .../jaxx/compiler/generators/SwingGenerator.java | 9 +- .../compiler/generators/ValidatorGenerator.java | 26 +- .../java/jaxx/compiler/{ => io}/JavaArgument.java | 18 +- .../main/java/jaxx/compiler/io/JavaElement.java | 79 ++++ .../src/main/java/jaxx/compiler/io/JavaField.java | 100 ++++++ .../java/jaxx/compiler/io/JavaFieldComparator.java | 72 ++++ .../main/java/jaxx/compiler/{ => io}/JavaFile.java | 194 ++++------ .../java/jaxx/compiler/{ => io}/JavaMethod.java | 238 +++--------- .../jaxx/compiler/io/JavaMethodComparator.java | 72 ++++ .../compiler/reflect/ClassDescriptorLoader.java | 10 +- .../java/jaxx/compiler/reflect/JavaFileParser.java | 4 +- .../java/jaxx/compiler/spi/DefaultInitializer.java | 67 ---- .../jaxx/compiler/tags/DefaultObjectHandler.java | 25 +- .../main/java/jaxx/compiler/tags/TagManager.java | 14 +- .../compiler/tags/swing/ApplicationHandler.java | 2 +- .../compiler/tags/swing/JAXXComboBoxHandler.java | 3 +- .../jaxx/compiler/tags/swing/JAXXListHandler.java | 3 +- .../jaxx/compiler/tags/swing/JAXXTreeHandler.java | 3 +- .../compiler/tags/swing/JRadioButtonHandler.java | 3 +- .../compiler/tags/swing/JTabbedPaneHandler.java | 13 +- .../java/jaxx/compiler/tags/swing/TabHandler.java | 25 +- .../jaxx/compiler/tags/swing/TableHandler.java | 3 +- .../tags/validator/BeanValidatorHandler.java | 24 +- .../java/jaxx/compiler/tools/PrintTagInfo.java | 4 +- .../tools/jaxxcapture/handlers/ObjectHandler.java | 6 +- ...axx.compiler.decorators.CompiledObjectDecorator | 3 + .../services/jaxx.compiler.types.TypeConverter | 5 + .../test/java/jaxx/compiler/JavaMethodTest.java | 4 +- .../java/jaxx/compiler/tags/TagManagerTest.java | 6 +- 45 files changed, 1130 insertions(+), 1274 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java index ec1ff95..04fd2de 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java @@ -11,7 +11,6 @@ import jaxx.compiler.reflect.MethodDescriptor; import jaxx.compiler.tags.DefaultComponentHandler; import jaxx.compiler.tags.TagHandler; import jaxx.compiler.tags.TagManager; -import jaxx.compiler.types.TypeManager; import java.awt.Container; import java.lang.reflect.Method; @@ -389,8 +388,8 @@ public class CompiledObject { ClassDescriptor listenerClass = addMethod.getParameterTypes()[0]; return getJavaCode() + '.' + addMethod.getName() + "((" + JAXXCompiler.getCanonicalName(listenerClass) + ") jaxx.runtime.Util.getEventListener(" + JAXXCompiler.getCanonicalName(listenerClass) + ".class, " + - TypeManager.getJavaCode(handler.getListenerMethod().getName()) + ", " + compiler.getRootObject().getJavaCode() + ", " + - TypeManager.getJavaCode(compiler.getEventHandlerMethodName(handler)) + "));" + JAXXCompiler.getLineSeparator(); + compiler.getJavaCode(handler.getListenerMethod().getName()) + ", " + compiler.getRootObject().getJavaCode() + ", " + + compiler.getJavaCode(compiler.getEventHandlerMethodName(handler)) + "));" + JAXXCompiler.getLineSeparator(); } /** diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java b/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java index 99518c0..4de7fef 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java @@ -4,8 +4,6 @@ */ package jaxx.compiler; -import jaxx.compiler.types.TypeManager; - /** * Represents a data binding in a JAXX file. <code>DataBinding</code> uses {@link DataSource} to * track changes to a source expression and update the destination. @@ -55,7 +53,7 @@ public class DataBinding { */ public boolean compile(boolean quickNoDependencies) throws CompilerException { // DataSource.compile handles all of the listener additions - boolean result = dataSource.compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + TypeManager.getJavaCode(id) + ")"); + boolean result = dataSource.compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + compiler.getJavaCode(id) + ")"); if (!result && quickNoDependencies) { if (!dest.endsWith(".layout")) // layout is specially handled early in the chain @@ -69,7 +67,7 @@ public class DataBinding { } else { compiler.appendProcessDataBinding(" "); } - compiler.appendProcessDataBinding("if (" + TypeManager.getJavaCode(id) + ".equals($dest)) {" + JAXXCompiler.getLineSeparator()); + compiler.appendProcessDataBinding("if (" + compiler.getJavaCode(id) + ".equals($dest)) {" + JAXXCompiler.getLineSeparator()); String objectCode = dataSource.getObjectCode(); if (objectCode != null) { compiler.appendProcessDataBinding(" if (" + objectCode + " != null) {" + JAXXCompiler.getLineSeparator()); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java b/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java index 6fb37d8..fab9b08 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java @@ -4,6 +4,7 @@ */ package jaxx.compiler; +import jaxx.compiler.io.JavaField; import jaxx.compiler.parser.java.JavaParser; import jaxx.compiler.parser.java.JavaParserConstants; import jaxx.compiler.parser.java.JavaParserTreeConstants; @@ -99,7 +100,7 @@ public class DataSource { if (dependencySymbols.size() > 0) { //TC 20081108 prefer add a real JavaField instead of raw code //compiler.appendBodyCode("private PropertyChangeListener " + id + " = " + propertyChangeListenerCode + ";\n"); - compiler.addSimpleField(new JavaField(Modifier.PRIVATE, PropertyChangeListener.class.getName(), autoId, propertyChangeListenerCode)); + compiler.addSimpleField(new JavaField(Modifier.PRIVATE, PropertyChangeListener.class.getName(), autoId,false, propertyChangeListenerCode)); } compileListeners(); @@ -390,8 +391,9 @@ public class DataSource { this.objectCode = objectCode; if (!dependencySymbols.contains(dependencySymbol)) { dependencySymbols.add(dependencySymbol); + String eol = JAXXCompiler.getLineSeparator(); if (objectCode != null) { - addListenerCode.append("if (").append(objectCode).append(" != null) {").append(JAXXCompiler.getLineSeparator()); + addListenerCode.append("if (").append(objectCode).append(" != null) {").append(eol); addListenerCode.append(" "); } addListenerCode.append(" ").append(addCode); @@ -400,7 +402,7 @@ public class DataSource { } if (objectCode != null) { - removeListenerCode.append("if (").append(objectCode).append(" != null) {").append(JAXXCompiler.getLineSeparator()); + removeListenerCode.append("if (").append(objectCode).append(" != null) {").append(eol); removeListenerCode.append(" "); } removeListenerCode.append(" ").append(removeCode); @@ -412,12 +414,13 @@ public class DataSource { private void compileListeners() { String javaCodeId = TypeManager.getJavaCode(id); + String eol = JAXXCompiler.getLineSeparator(); if (addListenerCode.length() > 0) { if (compiler.haveApplyDataBinding()) { compiler.appendApplyDataBinding(" else "); } - compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {" + JAXXCompiler.getLineSeparator()); - compiler.appendApplyDataBinding(" " + addListenerCode + JAXXCompiler.getLineSeparator()); + compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol); + compiler.appendApplyDataBinding(" " + addListenerCode + eol); compiler.appendApplyDataBinding("}"); //if (compiler.applyDataBinding.length() > 0) // compiler.applyDataBinding.append("else "); @@ -430,8 +433,8 @@ public class DataSource { if (compiler.haveRemoveDataBinding()) { compiler.appendRemoveDataBinding(" else "); } - compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {" + JAXXCompiler.getLineSeparator()); - compiler.appendRemoveDataBinding(" " + removeListenerCode + JAXXCompiler.getLineSeparator()); + compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol); + compiler.appendRemoveDataBinding(" " + removeListenerCode + eol); compiler.appendRemoveDataBinding("}"); //if (compiler.removeDataBinding.length() > 0) // compiler.removeDataBinding.append("else "); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java index 23bd95e..d704851 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java @@ -4,8 +4,10 @@ */ package jaxx.compiler; +import jaxx.compiler.io.JavaMethod; +import jaxx.compiler.io.JavaField; +import jaxx.compiler.io.JavaFile; import jaxx.compiler.decorators.CompiledObjectDecorator; -import jaxx.compiler.decorators.CompiledObjectDecoratorManager; import jaxx.compiler.generators.Generator; import jaxx.compiler.parser.java.ParseException; import jaxx.compiler.reflect.ClassDescriptor; @@ -63,6 +65,7 @@ import java.util.Set; import java.util.Stack; import java.util.regex.Matcher; import java.util.regex.Pattern; +import jaxx.compiler.types.TypeManager; /** * Compiles JAXX files into Java classes. @@ -71,7 +74,9 @@ import java.util.regex.Pattern; */ public class JAXXCompiler { - /** log */ + /** + * Logger + */ protected static final Log log = LogFactory.getLog(JAXXCompiler.class); /** * True to throw exceptions when we encounter unresolvable classes, false to ignore. @@ -96,10 +101,10 @@ public class JAXXCompiler { * The unique object handler used in first pass */ protected final DefaultObjectHandler firstPassClassTagHandler; - /** - * list of static imports - */ - protected List<String> staticImports = new ArrayList<String>(); +// /** +// * list of static imports +// */ +// protected List<String> staticImports = new ArrayList<String>(); /*---------------------------------------------------------------------------------*/ /*-- compiler fields --------------------------------------------------------------*/ @@ -273,15 +278,53 @@ public class JAXXCompiler { * default decodator to use if none specified */ protected CompiledObjectDecorator defaultDecorator; + /** + * engine which references this compiler (can be null if compiler is standalone) + */ + protected final JAXXEngine engine; /*---------------------------------------------------------------------------------*/ /*-- Constructor methods ----------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/ - protected JAXXCompiler(ClassLoader classLoader) { - +// protected JAXXCompiler(ClassLoader classLoader) { +// +// this.firstPassClassTagHandler = new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(Object.class)); +// this.configuration = new DefaultCompilerConfiguration(); +// this.classLoader = classLoader; +//// this.staticImports = Arrays.asList(new String[]{ +//// "java.awt.*", +//// "java.awt.event.*", +//// "java.beans.*", +//// "java.io.*", +//// "java.lang.*", +//// "java.util.*", +//// "javax.swing.*", +//// "javax.swing.border.*", +//// "javax.swing.event.*", +//// "jaxx.runtime.swing.JAXXButtonGroup", +//// "jaxx.runtime.swing.HBox", +//// "jaxx.runtime.swing.VBox", +//// "jaxx.runtime.swing.Table", +//// "static org.nuiton.i18n.I18n._", +//// "static jaxx.runtime.Util.createImageIcon" +//// }); +// addImport("java.lang.*"); +// } + /** + * Creates a new JAXXCompiler. + * + * @param engine engine which use the compiler (could be null if not attach to any engine) + * @param baseDir classpath location + * @param src location of file to compile + * @param outputClassName the out file name + * @param configuration configuration to pass to javac + * @param defaultImports list of default imports to add to java files + */ + public JAXXCompiler(JAXXEngine engine, File baseDir, File src, String outputClassName, CompilerConfiguration configuration, List<String> defaultImports) { + this.engine = engine; + this.baseDir = baseDir; + this.src = src; this.firstPassClassTagHandler = new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(Object.class)); - this.configuration = new DefaultCompilerConfiguration(); - this.classLoader = classLoader; // this.staticImports = Arrays.asList(new String[]{ // "java.awt.*", // "java.awt.event.*", @@ -299,55 +342,29 @@ public class JAXXCompiler { // "static org.nuiton.i18n.I18n._", // "static jaxx.runtime.Util.createImageIcon" // }); - addImport("java.lang.*"); - } - - /** - * Creates a new JAXXCompiler. - * - * @param baseDir classpath location - * @param src location of file to compile - * @param outputClassName the out file name - * @param configuration configuration to pass to javac - */ - public JAXXCompiler(File baseDir, File src, String outputClassName, CompilerConfiguration configuration) { - this.baseDir = baseDir; - this.src = src; - this.firstPassClassTagHandler = new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(Object.class)); - this.staticImports = Arrays.asList(new String[]{ - "java.awt.*", - "java.awt.event.*", - "java.beans.*", - "java.io.*", - "java.lang.*", - "java.util.*", - "javax.swing.*", - "javax.swing.border.*", - "javax.swing.event.*", - "jaxx.runtime.swing.JAXXButtonGroup", - "jaxx.runtime.swing.HBox", - "jaxx.runtime.swing.VBox", - "jaxx.runtime.swing.Table", - "static org.nuiton.i18n.I18n._", - "static jaxx.runtime.Util.createImageIcon" - }); sourceFiles.push(src); this.outputClassName = outputClassName; this.configuration = configuration; - addImport(outputClassName.substring(0, outputClassName.lastIndexOf(".") + 1) + "*"); - for (Object staticImport : staticImports) { - addImport((String) staticImport); - } - // add extra imports from configuration - if (configuration.getExtraImports() != null) { - for (String extraImport : configuration.getExtraImports()) { - addImport(extraImport); + if (outputClassName != null) { + addImport(outputClassName.substring(0, outputClassName.lastIndexOf(".") + 1) + "*"); + } + if (defaultImports != null) { + for (Object staticImport : defaultImports) { + addImport((String) staticImport); } } - defaultDecorator = CompiledObjectDecoratorManager.getDecorator(configuration.getDefaultDecoratorClass()); - if (defaultDecorator == null) { - log.error("could not find default decorator : " + configuration.getDefaultDecoratorClass()); - throw new IllegalArgumentException("could not find default decorator : " + configuration.getDefaultDecoratorClass()); + if (configuration != null) { + // add extra imports from configuration + if (configuration.getExtraImports() != null) { + for (String extraImport : configuration.getExtraImports()) { + addImport(extraImport); + } + } + defaultDecorator = engine.getDecorator(configuration.getDefaultDecoratorClass()); + if (defaultDecorator == null) { + log.error("could not find default decorator : " + configuration.getDefaultDecoratorClass()); + throw new IllegalArgumentException("could not find default decorator : " + configuration.getDefaultDecoratorClass()); + } } } @@ -547,7 +564,7 @@ public class JAXXCompiler { } public void registerCompiledObject(CompiledObject object) { - assert JAXXCompilerLaunchor.get().symbolTables.values().contains(symbolTable) : "attempting to register CompiledObject before pass 1 is complete"; + assert engine.symbolTables.values().contains(symbolTable) : "attempting to register CompiledObject before pass 1 is complete"; if (root == null) { root = object; } @@ -569,7 +586,7 @@ public class JAXXCompiler { public CompiledObject getCompiledObject(String id) { runInitializers(); - assert JAXXCompilerLaunchor.get().symbolTables.values().contains(symbolTable) : "attempting to retrieve CompiledObject before pass 1 is complete"; + assert engine.symbolTables.values().contains(symbolTable) : "attempting to retrieve CompiledObject before pass 1 is complete"; return objects.get(id); } @@ -600,6 +617,16 @@ public class JAXXCompiler { } } + public String getJavaCode(Object object) { + String result = TypeManager.getJavaCode(object); + return result; + } + + public Object convertFromString(String string, Class<?> type) { + Object result = TypeManager.convertFromString(string, type); + return result; + } + /*---------------------------------------------------------------------------------*/ /*-- DataBinding methods ----------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/ @@ -798,7 +825,10 @@ public class JAXXCompiler { System.err.print(":" + ((sourceFiles.size() == 1) ? Integer.parseInt(lineNumber) + lineOffset : lineOffset + 1)); } System.err.println(": Warning: " + warning); - JAXXCompilerLaunchor.get().warningCount++; + if (engine != null) { + engine.warningCount++; + } +// JAXXEngine.get().warningCount++; } public void reportError(String error) { @@ -862,7 +892,10 @@ public class JAXXCompiler { System.err.print(":" + lineNumber); } System.err.println(": " + error); - JAXXCompilerLaunchor.get().errorCount++; + if (engine != null) { + engine.errorCount++; + } +// JAXXEngine.get().errorCount++; failed = true; } @@ -968,20 +1001,6 @@ public class JAXXCompiler { classLoader = configuration.getClassLoader(); } else { throw new NullPointerException("compiler configuration requires a classLoader! :\n" + configuration); -// String classPath = configuration.getClassPath(); -// if (classPath == null) { -// classPath = "."; -// } -// String[] paths = classPath.split(File.pathSeparator); -// URL[] urls = new URL[paths.length]; -// for (int i = 0; i < paths.length; i++) { -// try { -// urls[i] = new File(paths[i]).toURI().toURL(); -// } catch (MalformedURLException e) { -// throw new RuntimeException(e); -// } -// } -// classLoader = new URLClassLoader(urls, getClass().getClassLoader()); } } @@ -1153,7 +1172,8 @@ public class JAXXCompiler { public void addDependencyClass(String className) { - if (!JAXXCompilerLaunchor.get().jaxxFileClassNames.contains(className)) { +// if (!JAXXEngine.get().jaxxFileClassNames.contains(className)) { + if (!engine.jaxxFileClassNames.contains(className)) { URL jaxxURL = getClassLoader().getResource(className.replace('.', '/') + ".jaxx"); URL classURL = getClassLoader().getResource(className.replace('.', '/') + ".class"); if (jaxxURL != null && classURL != null) { @@ -1178,11 +1198,14 @@ public class JAXXCompiler { assert jaxxFile.getName().equalsIgnoreCase(className.substring(className.lastIndexOf(".") + 1) + ".jaxx") : "expecting file name to match " + className + ", but found " + jaxxFile.getName(); if (jaxxFile.getName().equals(className.substring(className.lastIndexOf(".") + 1) + ".jaxx")) { // check case match - if (JAXXCompilerLaunchor.get().currentPass != JAXXCompilerLaunchor.LifeCycle.compile_first_pass) { +// if (JAXXEngine.get().currentPass != JAXXEngine.LifeCycle.compile_first_pass) { + if (engine.currentPass != JAXXEngine.LifeCycle.compile_first_pass) { throw new AssertionError("Internal error: adding dependency class " + className + " during second compilation pass"); } - JAXXCompilerLaunchor.get().jaxxFileClassNames.add(className); - JAXXCompilerLaunchor.get().jaxxFiles.add(jaxxFile); +// JAXXEngine.get().jaxxFileClassNames.add(className); +// JAXXEngine.get().jaxxFiles.add(jaxxFile); + engine.jaxxFileClassNames.add(className); + engine.jaxxFiles.add(jaxxFile); } } } @@ -1406,7 +1429,7 @@ public class JAXXCompiler { for (Generator generator : generatorIterator) { generator.prepareJavaFile(compiledObject, this, javaFile, packageName, simpleClassName); } - out.println(javaFile.toString(getLineSeparator())); + out.println(javaFile.toString()); out.close(); } catch (RuntimeException e) { // file could not be generated, so delete it... @@ -1601,4 +1624,8 @@ public class JAXXCompiler { throw new RuntimeException(ex); } } + + public JAXXEngine getEngine() { + return engine; + } } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerLaunchor.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java similarity index 51% rename from jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerLaunchor.java rename to jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java index a8a9043..6d08798 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerLaunchor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java @@ -14,13 +14,19 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.ServiceLoader; -import jaxx.compiler.generators.GeneratorManager; +import java.util.TreeMap; +import jaxx.compiler.decorators.CompiledObjectDecorator; -/** @author chemit */ -public class JAXXCompilerLaunchor { +/** + * @author chemit + * @since 2.0.0 was previously JAXXCompilerLaunchor + */ +public class JAXXEngine { - /** log */ - protected static final Log log = LogFactory.getLog(JAXXCompilerLaunchor.class); + /** + * Logger + */ + protected static final Log log = LogFactory.getLog(JAXXEngine.class); protected enum LifeCycle { @@ -32,14 +38,14 @@ public class JAXXCompilerLaunchor { profile_pass // state when profile } /** shared instance of unique launchor at a givne time. */ - protected static JAXXCompilerLaunchor singleton; + protected static JAXXEngine singleton; /** * Create a new empty launchor and set it as current launchor accessible via method {@link #get()} * * @return the new instanciated launchor */ - public static synchronized JAXXCompilerLaunchor newLaunchor() { + public static synchronized JAXXEngine newLaunchor() { return newLaunchor((File[]) null, null, null); } @@ -55,7 +61,7 @@ public class JAXXCompilerLaunchor { * @param configuration the compiler configuration to use * @return the new instanciated launchor */ - public static synchronized JAXXCompilerLaunchor newLaunchor(File base, String[] relativePaths, CompilerConfiguration configuration) { + public static synchronized JAXXEngine newLaunchor(File base, String[] relativePaths, CompilerConfiguration configuration) { File[] files = new File[relativePaths.length]; String[] classNames = new String[relativePaths.length]; for (int i = 0; i < files.length; i++) { @@ -80,11 +86,11 @@ public class JAXXCompilerLaunchor { * @param configuration the compiler configuration to use * @return the new instanciated launchor */ - public static synchronized JAXXCompilerLaunchor newLaunchor(File[] files, String[] classNames, CompilerConfiguration configuration) { + public static synchronized JAXXEngine newLaunchor(File[] files, String[] classNames, CompilerConfiguration configuration) { if (singleton != null) { singleton.reset(); } - singleton = new JAXXCompilerLaunchor(files, classNames, configuration); + singleton = new JAXXEngine(files, classNames, configuration); return singleton; } @@ -92,7 +98,7 @@ public class JAXXCompilerLaunchor { * @return the current launchor * @throws NullPointerException if no launchor was registred via a <code>newLaunchor-like</code> method. */ - public static JAXXCompilerLaunchor get() throws NullPointerException { + public static JAXXEngine get() throws NullPointerException { if (singleton == null) { throw new NullPointerException("no launchor was registred via newLaunchor method"); } @@ -123,27 +129,64 @@ public class JAXXCompilerLaunchor { initializer.initialize(); } } - /** configuration of the launchor and underlines compilers */ + /** + * configuration of the launchor and underlines compilers + */ protected CompilerConfiguration configuration; - /** original list of files to compile */ + /** + * original list of files to compile + */ protected final File[] files; - /** original list of classes to compile */ + /** + * original list of classes to compile + */ protected final String[] classNames; - /** Files to be treated while compilation. */ + /** + * Files to be treated while compilation. + */ protected List<File> jaxxFiles = new ArrayList<File>(); - /** Class names corresponding to the files in the jaxxFiles list. */ + /** + * Class names corresponding to the files in the jaxxFiles list. + */ protected List<String> jaxxFileClassNames = new ArrayList<String>(); - /** Maps the names of classes being compiled to the compiler instance handling the compilation. */ + /** + * Maps the names of classes being compiled to the compiler instance handling the compilation. + */ protected Map<String, JAXXCompiler> compilers = new HashMap<String, JAXXCompiler>(); - /** Maps the names of classes being compiled to their symbol tables (created after the first compiler pass). */ + /** + * Maps the names of classes being compiled to their symbol tables (created after the first compiler pass). + */ protected Map<File, SymbolTable> symbolTables = new HashMap<File, SymbolTable>(); + /** + * + */ protected LifeCycle currentPass; + /** + * + */ protected int errorCount; + /** + * + */ protected int warningCount; + /** + * number of registred compiler + */ protected int compilerCount; + /** + * profile attached to the engine (can be null) + */ protected JAXXProfile profiler; + /** + * decorators available in engine + */ + protected Map<String, CompiledObjectDecorator> decorators; + /** + * generators available in engine + */ + protected List<Generator> generators; - protected JAXXCompilerLaunchor(File[] files, String[] classNames, CompilerConfiguration options) { + protected JAXXEngine(File[] files, String[] classNames, CompilerConfiguration options) { this.configuration = options == null ? new DefaultCompilerConfiguration() : options; this.files = files; this.classNames = classNames; @@ -156,7 +199,9 @@ public class JAXXCompilerLaunchor { } public void init() { - // forces static initializer to run if it hasn't yet + compilerCount = 0; + jaxxFiles.addAll(Arrays.asList(files)); + jaxxFileClassNames.addAll(Arrays.asList(classNames)); } /** Resets all state in preparation for a new compilation session. */ @@ -168,6 +213,15 @@ public class JAXXCompilerLaunchor { compilers.clear(); if (profiler != null) { profiler.clear(); + profiler = null; + } + if (decorators != null) { + decorators.clear(); + decorators = null; + } + if (generators != null) { + generators.clear(); + generators = null; } } @@ -175,24 +229,24 @@ public class JAXXCompilerLaunchor { return "2.0.0"; } - /** - * Creates a dummy Compiler for use in unit testing. - * - * @return the compiler - */ - public static JAXXCompiler createDummyCompiler() { - return createDummyCompiler(JAXXCompiler.class.getClassLoader()); - } - +// /** +// * Creates a dummy Compiler for use in unit testing. +// * +// * @return the compiler +// */ +// public static JAXXCompiler createDummyCompiler() { +// return createDummyCompiler(JAXXCompiler.class.getClassLoader()); +// } /** * Creates a dummy Compiler for use in unit testing. * * @param classLoader class loader to use * @return the compiler */ - public static JAXXCompiler createDummyCompiler(ClassLoader classLoader) { - return new JAXXCompiler(classLoader) { - }; + public static JAXXCompiler createDummyCompiler(final ClassLoader classLoader) { + JAXXCompiler compiler = new JAXXCompiler(null, null, null, null, null, null); + compiler.classLoader = classLoader; + return compiler; } /** @@ -201,7 +255,7 @@ public class JAXXCompilerLaunchor { * different compiler instance. */ public JAXXCompiler getJAXXCompiler(String className) { - return compilers != null ? compilers.get(className) : null; + return compilers == null ? null : compilers.get(className); } /** @@ -226,16 +280,53 @@ public class JAXXCompilerLaunchor { return System.getProperty("line.separator", "\n"); } + public CompiledObjectDecorator getDecorator(String name) { + CompiledObjectDecorator decorator = getDecorators().get(name); + if (decorator == null) { + throw new IllegalArgumentException("could not find decorator with key " + name + " (known decorators : " + getDecorators().keySet()); + } + return decorator; + } + + public CompiledObjectDecorator getDecorator(Class<?> type) { + for (CompiledObjectDecorator decorator : getDecorators().values()) { + if (type == decorator.getClass()) { + return decorator; + } + } + return null; + } + + protected synchronized Map<String, CompiledObjectDecorator> getDecorators() { + if (decorators == null) { + decorators = new TreeMap<String, CompiledObjectDecorator>(); + // load decorators + ServiceLoader<CompiledObjectDecorator> loader = ServiceLoader.load(CompiledObjectDecorator.class); + for (CompiledObjectDecorator c : loader) { + decorators.put(c.getName(), c); + } + } + return decorators; + } + + public List<Generator> getGenerators() { + if (generators == null) { + generators = new ArrayList<Generator>(); + for (Generator generator : ServiceLoader.load(Generator.class)) { + generators.add(generator); + } + } + return generators; + } + /** * Compiled a set of files. * * @return <code>true</code> if compilation succeeds, <code>false</code> otherwise */ public synchronized boolean compile() { - //reset(); // just to be safe... - compilerCount = 0; - jaxxFiles.addAll(Arrays.asList(files)); - jaxxFileClassNames.addAll(Arrays.asList(classNames)); + + init(); try { boolean success = true; @@ -243,115 +334,28 @@ public class JAXXCompilerLaunchor { if (!nextStep(LifeCycle.compile_first_pass, success)) { return false; } - boolean compiled; - do { - compiled = false; - assert jaxxFiles.size() == jaxxFileClassNames.size(); - java.util.Iterator<File> filesIterator = new ArrayList<File>(jaxxFiles).iterator(); // clone it so it can safely be modified while we're iterating - java.util.Iterator<String> classNamesIterator = new ArrayList<String>(jaxxFileClassNames).iterator(); - while (filesIterator.hasNext()) { - File file = filesIterator.next(); - String className = classNamesIterator.next(); - if (log.isDebugEnabled()) { - log.debug("compile first pass for " + className); - } - if (symbolTables.get(file) == null) { - compiled = true; - if (compilers.containsKey(className)) { - throw new CompilerException("Internal error: " + className + " is already being compiled, attempting to compile it again"); - } - - File destDir = configuration.getTargetDirectory(); - if (destDir != null) { - int dotPos = className.lastIndexOf("."); - if (dotPos != -1) { - destDir = new File(destDir, className.substring(0, dotPos).replace('.', File.separatorChar)); - } - if (!destDir.exists() && !destDir.mkdirs()) { - log.warn("could not create directory " + destDir); - continue; - } - } else { - //destDir = file.getParentFile(); - } - JAXXCompiler compiler = newCompiler(file.getParentFile(), file, className); - addProfileTime(compiler, currentPass.name() + "_start"); - compilers.put(className, compiler); - compiler.compileFirstPass(); - addProfileTime(compiler, currentPass.name() + "_end"); - assert !symbolTables.values().contains(compiler.getSymbolTable()) : "symbolTable is already registered"; - symbolTables.put(file, compiler.getSymbolTable()); - if (compiler.isFailed()) { - success = false; - } - } - } - - } while (compiled); + success = firstPass(); // pass 2 if (!nextStep(LifeCycle.compile_second_pass, success)) { return false; } - assert jaxxFiles.size() == jaxxFileClassNames.size(); - List<File> jaxxFilesClone = new ArrayList<File>(jaxxFiles); - for (String className : jaxxFileClassNames) { - JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during second pass"); - addProfileTime(compiler, currentPass.name() + "_start"); - if (log.isDebugEnabled()) { - log.debug("runInitializers for " + className); - } - if (!compiler.isFailed()) { - compiler.runInitializers(); - } - if (log.isDebugEnabled()) { - log.debug("compile second pass for " + className); - } - compiler.compileSecondPass(); - addProfileTime(compiler, currentPass.name() + "_end"); - if (log.isDebugEnabled()) { - log.debug("done with result [" + !compiler.isFailed() + "] for " + className); - } - if (compiler.isFailed()) { - success = false; - } - } - if (!jaxxFilesClone.equals(jaxxFiles)) { - throw new AssertionError("Internal error: compilation set altered during pass 2 (was " + jaxxFilesClone + ", modified to " + jaxxFiles + ")"); - } + success = secondPass(); // stylesheet application if (!nextStep(LifeCycle.stylesheet_pass, success)) { return false; } assert jaxxFiles.size() == jaxxFileClassNames.size(); - for (String className : jaxxFileClassNames) { - JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during stylesheet application"); - addProfileTime(compiler, currentPass.name() + "_start"); - compiler.applyStylesheets(); - addProfileTime(compiler, currentPass.name() + "_end"); - if (compiler.isFailed()) { - success = false; - } - } + success = applyCss(); // code generation if (!nextStep(LifeCycle.generate_pass, success)) { return false; } assert jaxxFiles.size() == jaxxFileClassNames.size(); - List<Generator> generators = GeneratorManager.getGenerators(); - for (String className : jaxxFileClassNames) { - JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during code generation"); - addProfileTime(compiler, currentPass.name() + "_start"); - compiler.generateCode(generators); - addProfileTime(compiler, currentPass.name() + "_end"); - //compiler.generateCode(); - if (compiler.isFailed()) { - success = false; - } - } + success = generate(); if (configuration.isProfile()) { // profile pass (only if succes compile) @@ -381,6 +385,116 @@ public class JAXXCompilerLaunchor { } } + protected boolean firstPass() throws Exception { + boolean success = true; + boolean compiled; + do { + compiled = false; + assert jaxxFiles.size() == jaxxFileClassNames.size(); + java.util.Iterator<File> filesIterator = new ArrayList<File>(jaxxFiles).iterator(); // clone it so it can safely be modified while we're iterating + java.util.Iterator<String> classNamesIterator = new ArrayList<String>(jaxxFileClassNames).iterator(); + while (filesIterator.hasNext()) { + File file = filesIterator.next(); + String className = classNamesIterator.next(); + if (log.isDebugEnabled()) { + log.debug("compile first pass for " + className); + } + if (symbolTables.get(file) == null) { + compiled = true; + if (compilers.containsKey(className)) { + throw new CompilerException("Internal error: " + className + " is already being compiled, attempting to compile it again"); + } + + File destDir = configuration.getTargetDirectory(); + if (destDir != null) { + int dotPos = className.lastIndexOf("."); + if (dotPos != -1) { + destDir = new File(destDir, className.substring(0, dotPos).replace('.', File.separatorChar)); + } + if (!destDir.exists() && !destDir.mkdirs()) { + log.warn("could not create directory " + destDir); + continue; + } + } else { + //destDir = file.getParentFile(); + } + JAXXCompiler compiler = newCompiler(file.getParentFile(), file, className); + addProfileTime(compiler, currentPass.name() + "_start"); + compilers.put(className, compiler); + compiler.compileFirstPass(); + addProfileTime(compiler, currentPass.name() + "_end"); + assert !symbolTables.values().contains(compiler.getSymbolTable()) : "symbolTable is already registered"; + symbolTables.put(file, compiler.getSymbolTable()); + if (compiler.isFailed()) { + success = false; + } + } + } + + } while (compiled); + return success; + } + + protected boolean secondPass() throws Exception { + boolean success = true; + List<File> jaxxFilesClone = new ArrayList<File>(jaxxFiles); + for (String className : jaxxFileClassNames) { + JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during second pass"); + addProfileTime(compiler, currentPass.name() + "_start"); + if (log.isDebugEnabled()) { + log.debug("runInitializers for " + className); + } + if (!compiler.isFailed()) { + compiler.runInitializers(); + } + if (log.isDebugEnabled()) { + log.debug("compile second pass for " + className); + } + compiler.compileSecondPass(); + addProfileTime(compiler, currentPass.name() + "_end"); + if (log.isDebugEnabled()) { + log.debug("done with result [" + !compiler.isFailed() + "] for " + className); + } + if (compiler.isFailed()) { + success = false; + } + } + if (!jaxxFilesClone.equals(jaxxFiles)) { + throw new AssertionError("Internal error: compilation set altered during pass 2 (was " + jaxxFilesClone + ", modified to " + jaxxFiles + ")"); + } + return success; + } + + protected boolean applyCss() throws Exception { + boolean success = true; + + for (String className : jaxxFileClassNames) { + JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during stylesheet application"); + addProfileTime(compiler, currentPass.name() + "_start"); + compiler.applyStylesheets(); + addProfileTime(compiler, currentPass.name() + "_end"); + if (compiler.isFailed()) { + success = false; + } + } + return success; + } + + protected boolean generate() throws Exception { + boolean success = true; + List<Generator> gens = getGenerators(); + for (String className : jaxxFileClassNames) { + JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during code generation"); + addProfileTime(compiler, currentPass.name() + "_start"); + compiler.generateCode(gens); + addProfileTime(compiler, currentPass.name() + "_end"); + if (compiler.isFailed()) { + success = false; + } + } + return success; + } + public int getCompilerCount() { return compilerCount; } @@ -416,14 +530,29 @@ public class JAXXCompilerLaunchor { } protected JAXXCompiler newCompiler(File parentFile, File file, String className) throws InvocationTargetException, IllegalAccessException, InstantiationException, NoSuchMethodException { - Constructor<? extends JAXXCompiler> cons = configuration.getCompilerClass().getConstructor(File.class, File.class, String.class, CompilerConfiguration.class); - return cons.newInstance(parentFile, file, className, configuration); + Constructor<? extends JAXXCompiler> cons = configuration.getCompilerClass().getConstructor(JAXXEngine.class, File.class, File.class, String.class, CompilerConfiguration.class, List.class); + return cons.newInstance(this, parentFile, file, className, configuration, Arrays.asList(new String[]{ + "java.awt.*", + "java.awt.event.*", + "java.beans.*", + "java.io.*", + "java.lang.*", + "java.util.*", + "javax.swing.*", + "javax.swing.border.*", + "javax.swing.event.*", + "jaxx.runtime.swing.JAXXButtonGroup", + "jaxx.runtime.swing.HBox", + "jaxx.runtime.swing.VBox", + "jaxx.runtime.swing.Table", + "static org.nuiton.i18n.I18n._", + "static jaxx.runtime.Util.createImageIcon" + })); } - public static void addProfileTime(JAXXCompiler compiler, String key) { - JAXXProfile p = JAXXCompilerLaunchor.get().profiler; - if (p != null) { - p.addTime(compiler, key); + public void addProfileTime(JAXXCompiler compiler, String key) { + if (profiler != null) { + profiler.addTime(compiler, key); } } } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXProfile.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXProfile.java index 0ed1f68..054d851 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXProfile.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXProfile.java @@ -5,7 +5,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.SortedMap; -import jaxx.compiler.JAXXCompilerLaunchor.LifeCycle; +import jaxx.compiler.JAXXEngine.LifeCycle; import org.nuiton.util.StringUtil; /** diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JavaField.java b/jaxx-compiler/src/main/java/jaxx/compiler/JavaField.java deleted file mode 100644 index f597b09..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JavaField.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler; - -import java.lang.reflect.Modifier; -import java.util.Comparator; - -/** - * Represents a field in a Java source file being generated for output. <code>JavaFields</code> are created - * and added to a {@link JavaFile}, which can then output Java source code. - */ -public class JavaField implements Comparable<JavaField> { - - private int modifiers; - private String type; - private String name; - private String initializer; - - /** - * Constructs a new <code>JavaField</code>. The <code>modifiers</code> parameter is a bit mask of the - * constants from {@link java.lang.reflect.Modifier}, and the <code>type</code> of the field should be - * represented as it would appear in Java source code. - * - * @param modifiers the modifier keywords that should appear as part of the field's declaration - * @param type the type of the field as it would appear in Java source code - * @param name the field's name - */ - public JavaField(int modifiers, String type, String name) { - this(modifiers, type, name, null); - } - - /** - * Constructs a new <code>JavaField</code>. The <code>modifiers</code> parameter is a bit mask of the - * constants from <code>java.lang.reflect.Modifier</code>, and the <code>type</code> of the field should be - * represented as it would appear in Java source code. The <code>initializer</code> is the initial - * value of the field as it would appear in Java source code, or <code>null</code> to leave it at the - * default value. - * - * @param modifiers the modifier keywords that should appear as part of the field's declaration - * @param type the type of the field as it would appear in Java source code - * @param name the field's name - * @param initializer the initial value of the field, as it would appear in Java source code - */ - public JavaField(int modifiers, String type, String name, String initializer) { - this.modifiers = modifiers; - this.type = type; - this.name = name; - this.initializer = initializer; - } - - /** - * Returns a bit mask describing the modifier keywords which should appear as part of this field's - * declaration. See <code>java.lang.reflect.Modifier</code> for more information on decoding this - * field. - * - * @return the modifier bit mask - */ - public int getModifiers() { - return modifiers; - } - - /** - * Returns the field's name. - * - * @return the field's name - */ - public String getName() { - return name; - } - - /** - * Returns the field's type, as it would be represented in Java source code. - * - * @return the field's type - */ - public String getType() { - return type; - } - - /** - * Returns the Java source code for this field. - * - * @param lineSeparator line separator - * @return the Java source code for this field - */ - public String toString(String lineSeparator) { - StringBuffer result = new StringBuffer(); - result.append(JavaFile.getModifiersText(modifiers)); - result.append(type).append(' ').append(name); - if (initializer != null) { - result.append(" = ").append(initializer); - } - result.append(';').append(lineSeparator); - return result.toString(); - } - - @Override - public int compareTo(JavaField o) { - return COMPARATOR.compare(this, o); - } - public static final Comparator<JavaField> COMPARATOR = new Comparator<JavaField>() { - - @Override - public int compare(JavaField o1, JavaField o2) { - - int result; - if ((result = compareStatic(o1, o2)) != 0) { - return result; - } - - // data sources must be on the last after all other fields - if ((result = compareDataSource(o1, o2)) != 0) { - return result; - } - - // same static - if ((result = compareVisibility(o1, o2)) != 0) { - return result; - } - // same visibility, test name - return o1.name.compareTo(o2.name); - } - - public int compareStatic(JavaField o1, JavaField o2) { - // first comparator modifiers : static always before none static - if (Modifier.isStatic(o1.modifiers) && !Modifier.isStatic(o2.modifiers)) { - return -1; - } - if (!Modifier.isStatic(o1.modifiers) && Modifier.isStatic(o2.modifiers)) { - return 1; - } - return 0; - } - - public int compareDataSource(JavaField o1, JavaField o2) { - // first comparator modifiers : static always before none static - if (o1.name.startsWith("$DataSource") && !o2.name.startsWith("$DataSource")) { - return 1; - } - if (!o1.name.startsWith("$DataSource") && o2.name.startsWith("$DataSource")) { - return -1; - } - return 0; - } - - public int compareVisibility(JavaField o1, JavaField o2) { - // first comparator modifiers : static always before none static - if (!Modifier.isPublic(o1.modifiers) && Modifier.isPublic(o2.modifiers)) { - return 1; - } - - if (Modifier.isPublic(o1.modifiers) && !Modifier.isPublic(o2.modifiers)) { - return -1; - } - - if (Modifier.isProtected(o1.modifiers) && !Modifier.isProtected(o2.modifiers)) { - return -1; - } - if (!Modifier.isProtected(o1.modifiers) && Modifier.isProtected(o2.modifiers)) { - return 1; - } - - if (Modifier.isPrivate(o1.modifiers) && !Modifier.isPrivate(o2.modifiers)) { - return -1; - } - if (!Modifier.isPrivate(o1.modifiers) && Modifier.isPrivate(o2.modifiers)) { - return 1; - } - return 0; - } - }; - - public static JavaField newField(int modifiers, String returnType, String name) { - return newField(modifiers, returnType, name, null); - } - - public static JavaField newField(int modifiers, String returnType, String name, String initializer) { - return new JavaField(modifiers, returnType, name, initializer); - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/StylesheetHelper.java b/jaxx-compiler/src/main/java/jaxx/compiler/StylesheetHelper.java index 96de766..813876d 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/StylesheetHelper.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/StylesheetHelper.java @@ -11,7 +11,6 @@ import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.compiler.reflect.MethodDescriptor; import jaxx.compiler.tags.DefaultObjectHandler; import jaxx.compiler.tags.TagManager; -import jaxx.compiler.types.TypeManager; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; @@ -119,7 +118,7 @@ public class StylesheetHelper { pseudoClass = pseudoClass.substring(1, pseudoClass.length() - 1).trim(); pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode()); String dest = object.getId() + ".style." + pseudoClass + ".add"; - String destCode = TypeManager.getJavaCode(dest); + String destCode = compiler.getJavaCode(dest); if (compiler.haveProcessDataBinding()) { compiler.appendProcessDataBinding("else "); } @@ -229,7 +228,7 @@ public class StylesheetHelper { pseudoClass = pseudoClass.substring(1, pseudoClass.length() - 1).trim(); pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode()); String dest = object.getId() + ".style." + pseudoClass + ".remove"; - String destCode = TypeManager.getJavaCode(dest); + String destCode = compiler.getJavaCode(dest); if (compiler.haveProcessDataBinding()) { compiler.appendProcessDataBinding("else "); } @@ -383,13 +382,13 @@ public class StylesheetHelper { String dataBinding = compiler.processDataBindings(e.getValue(), type); String valueCode; if (dataBinding != null) { - valueCode = "new jaxx.runtime.css.DataBinding(" + TypeManager.getJavaCode(object.getId() + "." + property + "." + priority) + ")"; + valueCode = "new jaxx.runtime.css.DataBinding(" + compiler.getJavaCode(object.getId() + "." + property + "." + priority) + ")"; new DataBinding(dataBinding, object.getId() + "." + property + "." + priority, handler.getSetPropertyCode(object.getJavaCode(), property, "(" + JAXXCompiler.getCanonicalName(type) + ") " + dataBinding, compiler), compiler).compile(false); } else { try { Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null; - valueCode = TypeManager.getJavaCode(TypeManager.convertFromString(e.getValue(), typeClass)); + valueCode = compiler.getJavaCode(compiler.convertFromString(e.getValue(), typeClass)); } catch (ClassNotFoundException ex) { compiler.reportError("could not find class " + type.getName()); return; @@ -399,7 +398,7 @@ public class StylesheetHelper { buffer.append("java.lang.Object "); valueDeclared = true; } - buffer.append("value = jaxx.runtime.css.Pseudoclasses.applyProperty(").append(compiler.getOutputClassName()).append(".this, ").append(object.getJavaCode()).append(", ").append(TypeManager.getJavaCode(property)).append(", ").append(valueCode).append(", jaxx.runtime.css.Pseudoclasses.wrap(").append(handler.getGetPropertyCode(object.getJavaCode(), property, compiler)).append("), ").append(priority).append(");").append(JAXXCompiler.getLineSeparator()); + buffer.append("value = jaxx.runtime.css.Pseudoclasses.applyProperty(").append(compiler.getOutputClassName()).append(".this, ").append(object.getJavaCode()).append(", ").append(compiler.getJavaCode(property)).append(", ").append(valueCode).append(", jaxx.runtime.css.Pseudoclasses.wrap(").append(handler.getGetPropertyCode(object.getJavaCode(), property, compiler)).append("), ").append(priority).append(");").append(JAXXCompiler.getLineSeparator()); buffer.append("if (!(value instanceof jaxx.runtime.css.DataBinding)) {").append(JAXXCompiler.getLineSeparator()); String unwrappedValue = unwrap(type, "value"); buffer.append(" ").append(handler.getSetPropertyCode(object.getJavaCode(), property, "(" + JAXXCompiler.getCanonicalName(type) + @@ -431,13 +430,13 @@ public class StylesheetHelper { String dataBinding = compiler.processDataBindings(e.getValue(), type); String valueCode; if (dataBinding != null) { - valueCode = "new jaxx.runtime.css.DataBinding(" + TypeManager.getJavaCode(object.getId() + "." + property + "." + priority) + ")"; + valueCode = "new jaxx.runtime.css.DataBinding(" + compiler.getJavaCode(object.getId() + "." + property + "." + priority) + ")"; new DataBinding(dataBinding, object.getId() + "." + property + "." + priority, handler.getSetPropertyCode(object.getJavaCode(), property, "(" + JAXXCompiler.getCanonicalName(type) + ") " + dataBinding, compiler), compiler).compile(false); } else { try { Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null; - valueCode = TypeManager.getJavaCode(TypeManager.convertFromString(e.getValue(), typeClass)); + valueCode = compiler.getJavaCode(compiler.convertFromString(e.getValue(), typeClass)); } catch (ClassNotFoundException ex) { compiler.reportError("could not find class " + type.getName()); return; @@ -447,7 +446,7 @@ public class StylesheetHelper { buffer.append("java.lang.Object "); valueDeclared = true; } - buffer.append("value = jaxx.runtime.css.Pseudoclasses.removeProperty(").append(compiler.getOutputClassName()).append(".this, ").append(object.getJavaCode()).append(", ").append(TypeManager.getJavaCode(property)).append(", ").append(valueCode).append(", jaxx.runtime.css.Pseudoclasses.wrap(").append(handler.getGetPropertyCode(object.getJavaCode(), property, compiler)).append("), ").append(priority).append(");").append(JAXXCompiler.getLineSeparator()); + buffer.append("value = jaxx.runtime.css.Pseudoclasses.removeProperty(").append(compiler.getOutputClassName()).append(".this, ").append(object.getJavaCode()).append(", ").append(compiler.getJavaCode(property)).append(", ").append(valueCode).append(", jaxx.runtime.css.Pseudoclasses.wrap(").append(handler.getGetPropertyCode(object.getJavaCode(), property, compiler)).append("), ").append(priority).append(");").append(JAXXCompiler.getLineSeparator()); buffer.append("if (!(value instanceof jaxx.runtime.css.DataBinding)) {").append(JAXXCompiler.getLineSeparator()); String unwrappedValue = unwrap(type, "value"); buffer.append(" ").append(handler.getSetPropertyCode(object.getJavaCode(), property, "(" + JAXXCompiler.getCanonicalName(type) + diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java index abd81f0..ac76eab 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java @@ -3,7 +3,7 @@ package jaxx.compiler.decorators; import jaxx.compiler.CompiledObject; import jaxx.compiler.CompiledObject.ChildRef; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.JavaFile; +import jaxx.compiler.io.JavaFile; import jaxx.runtime.SwingUtil; /** @@ -16,6 +16,11 @@ import jaxx.runtime.SwingUtil; public class BoxedCompiledObjectDecorator extends DefaultCompiledObjectDecorator { @Override + public String getName() { + return "boxed"; + } + + @Override public void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName) { CompiledObject parent = object.getParent(); for (ChildRef child : parent.getChilds()) { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecorator.java index f698e94..a5b36ca 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecorator.java @@ -3,7 +3,7 @@ package jaxx.compiler.decorators; import jaxx.compiler.CompiledObject; import jaxx.compiler.CompilerException; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.JavaFile; +import jaxx.compiler.io.JavaFile; /** * @@ -16,6 +16,8 @@ import jaxx.compiler.JavaFile; */ public interface CompiledObjectDecorator { + String getName(); + String createCompleteSetupMethod(JAXXCompiler compiler, CompiledObject object, JavaFile javaFile, StringBuffer initDataBindings); boolean createInitializer(JAXXCompiler compiler, CompiledObject root, CompiledObject object, StringBuffer code, boolean lastWasMethodCall); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecoratorManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecoratorManager.java deleted file mode 100644 index 1fcfe4d..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecoratorManager.java +++ /dev/null @@ -1,59 +0,0 @@ -package jaxx.compiler.decorators; - -import java.util.Map; -import java.util.TreeMap; - -/** - * - * @author chemit - * @since 2.0.0 - */ -public class CompiledObjectDecoratorManager { - - protected static Map<String, CompiledObjectDecorator> cache; - - public static void registerDecorator(String key, Class<? extends CompiledObjectDecorator> klass) { - synchronized (getCache()) { - if (getCache().containsKey(key)) { - throw new IllegalArgumentException("the decorator with key [" + key + "] is already registred! use another key name"); - } - try { - getCache().put(key, klass.newInstance()); - } catch (InstantiationException ex) { - throw new IllegalArgumentException("could not create decorator " + klass + " for reason " + ex.getMessage(), ex); - } catch (IllegalAccessException ex) { - throw new IllegalArgumentException("could not create decorator " + klass + " for reason " + ex.getMessage(), ex); - } - } - } - - public static CompiledObjectDecorator getDecorator(String name) { - CompiledObjectDecorator decorator = getCache().get(name); - if (decorator == null) { - throw new IllegalArgumentException("could not find decorator with key " + name + " (known decorators : " + getCache().keySet()); - } - return decorator; - } - - public static CompiledObjectDecorator getDecorator(Class<?> type) { - for (CompiledObjectDecorator decorator : getCache().values()) { - if (type == decorator.getClass()) { - return decorator; - } - } - return null; - } - - protected static synchronized Map<String, CompiledObjectDecorator> getCache() { - if (cache == null) { - cache = new TreeMap<String, CompiledObjectDecorator>(); - } - return cache; - } - - public static void reset() { - if (cache != null) { - cache.clear(); - } - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java index 57ff26f..fe91b1c 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java @@ -3,11 +3,10 @@ package jaxx.compiler.decorators; import jaxx.compiler.CompiledObject; import jaxx.compiler.CompilerException; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.JavaField; -import jaxx.compiler.JavaFile; -import jaxx.compiler.JavaMethod; +import jaxx.compiler.io.JavaField; +import jaxx.compiler.io.JavaFile; +import jaxx.compiler.io.JavaMethod; import jaxx.compiler.ScriptInitializer; -import jaxx.compiler.types.TypeManager; import java.lang.reflect.Modifier; import java.util.Map.Entry; @@ -21,21 +20,27 @@ import java.util.Map.Entry; public class DefaultCompiledObjectDecorator implements CompiledObjectDecorator { @Override + public String getName() { + return "default"; + } + + @Override public void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName) { if (!object.isOverride() && !(object instanceof ScriptInitializer)) { String id = object.getId(); int access = id.startsWith("$") ? Modifier.PRIVATE : Modifier.PROTECTED; if (object == root) { - javaFile.addField(new JavaField(access, fullClassName, id, "this")); + javaFile.addField(new JavaField(access, className, id, false, "this")); +// javaFile.addField(new JavaField(access, fullClassName, id, false, "this")); } else { //TC -20081017 can have generic on compiled Object - javaFile.addField(JavaField.newField(access, JAXXCompiler.getCanonicalName(object), id), object.isJavaBean()); + javaFile.addField(JavaField.newField(access, JAXXCompiler.getCanonicalName(object), id, object.isOverride()), object.isJavaBean()); } } if (!compiler.inlineCreation(object) && object != root) { - javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getCreationMethodName(), getCreationCode(compiler, object))); + javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getCreationMethodName(), getCreationCode(compiler, object), object.isOverride())); } } @@ -45,29 +50,35 @@ public class DefaultCompiledObjectDecorator implements CompiledObjectDecorator { return object.getInitializationCode(compiler); } StringBuffer result = new StringBuffer(); + String eol = JAXXCompiler.getLineSeparator(); if (object.isOverride() && object.getOverrideType() == object.getObjectClass()) { //TC-20090309 on utilise le super code quand l'objet est de meme type result.append("super.").append(object.getCreationMethodName()).append("();"); } else { - result.append(object.getId()); - result.append(" = "); + String init = object.getId() + " = "; +// result.append(object.getId()); +// result.append(" = "); if (object.isJavaBean() && object.getJavaBeanInitCode() != null) { - result.append(object.getJavaBeanInitCode()).append(";"); + init += object.getJavaBeanInitCode(); +// result.append(object.getJavaBeanInitCode()).append(";"); } else { String constructorParams = object.getConstructorParams(); + String canonicalName = JAXXCompiler.getCanonicalName(object); if (constructorParams != null) { //TC - 20081017 compiledObject can have generics - result.append(" new ").append(JAXXCompiler.getCanonicalName(object)).append("(").append(constructorParams).append(");"); - //result.append("(").append(getCanonicalName(object.getObjectClass())).append(") new ").append(getCanonicalName(object.getObjectClass())).append("(").append(constructorParams).append(");"); + init += "new " + canonicalName + "(" + constructorParams + ")"; +// result.append(" new ").append(canonicalName).append("(").append(constructorParams).append(");"); } else { //TC - 20081017 compiledObject can have generics - result.append("new ").append(JAXXCompiler.getCanonicalName(object)).append("();"); + init += "new " + canonicalName + "()"; +// result.append("new ").append(canonicalName).append("();"); } } - result.append(JAXXCompiler.getLineSeparator()); - result.append("$objectMap.put(").append(TypeManager.getJavaCode(object.getId())).append(", ").append(object.getId()).append(");"); + result.append(eol); + result.append("$objectMap.put(").append(compiler.getJavaCode(object.getId())).append(", ").append(init).append(");"); +// result.append("$objectMap.put(").append(TypeManager.getJavaCode(object.getId())).append(", ").append(object.getId()).append(");"); } - result.append(JAXXCompiler.getLineSeparator()); + result.append(eol); String initCode = object.getInitializationCode(compiler); if (initCode != null && initCode.length() > 0) { result.append(initCode); @@ -87,41 +98,42 @@ public class DefaultCompiledObjectDecorator implements CompiledObjectDecorator { } } + String eol = JAXXCompiler.getLineSeparator(); //TC - 20081017 only generate the method if not empty ? if (object.getId().startsWith("$")) { - code.append(object.getAdditionCode()).append(JAXXCompiler.getLineSeparator()); + code.append(object.getAdditionCode()).append(eol); } else { String additionCode = object.getAdditionCode(); if (additionCode.length() > 0) { - code.append(object.getAdditionMethodName()).append("();").append(JAXXCompiler.getLineSeparator()); - additionCode = "if (!allComponentsCreated) {" + JAXXCompiler.getLineSeparator() + " return;" + JAXXCompiler.getLineSeparator() + "}" + JAXXCompiler.getLineSeparator() + additionCode; - javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getAdditionMethodName(), additionCode)); + code.append(object.getAdditionMethodName()).append("();").append(eol); + additionCode = "if (!allComponentsCreated) {" + eol + " return;" + eol + "}" + eol + additionCode; + javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getAdditionMethodName(), additionCode, false)); } } - //code.append(getLineSeparator()); return code.toString(); } @Override public boolean createInitializer(JAXXCompiler compiler, CompiledObject root, CompiledObject object, StringBuffer code, boolean lastWasMethodCall) { + String eol = JAXXCompiler.getLineSeparator(); if (object == root) { String rootCode = root.getInitializationCode(compiler); if (rootCode != null && rootCode.length() > 0) { code.append(rootCode); - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); } } else { if (!object.isOverride()) { if (compiler.inlineCreation(object)) { if (lastWasMethodCall) { lastWasMethodCall = false; - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); } code.append(getCreationCode(compiler, object)); - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); } else { code.append(object.getCreationMethodName()).append("();"); - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); lastWasMethodCall = true; } } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java index 44d7c99..35e7061 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java @@ -3,9 +3,9 @@ package jaxx.compiler.decorators; import jaxx.compiler.CompiledObject; import jaxx.compiler.CompilerConfiguration; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.JavaArgument; -import jaxx.compiler.JavaFile; -import jaxx.compiler.JavaMethod; +import jaxx.compiler.io.JavaArgument; +import jaxx.compiler.io.JavaFile; +import jaxx.compiler.io.JavaMethod; import java.lang.reflect.Modifier; import java.util.Iterator; @@ -24,6 +24,11 @@ public class HelpRootCompiledObjectDecorator extends DefaultCompiledObjectDecora */ protected static Set<String> helpIds = new java.util.HashSet<String>(); + @Override + public String getName() { + return "help"; + } + protected String getBrokerFQN(JAXXCompiler compiler) { String helpBrokerFQN = compiler.getConfiguration().getHelpBrokerFQN(); return helpBrokerFQN; @@ -50,18 +55,18 @@ public class HelpRootCompiledObjectDecorator extends DefaultCompiledObjectDecora javaFile.addInterface(JAXXCompiler.getCanonicalName(validatorInterface) + "<" + helpBrokerFQN + ">"); javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", "registerHelpId", - "broker.installUI(component, helpId);", + "broker.installUI(component, helpId);",true, new JavaArgument(helpBrokerFQN, "broker"), new JavaArgument("Component", "component"), new JavaArgument("String", "helpId"))); javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", "showHelp", - "getBroker().showHelp(this, helpId);", + "getBroker().showHelp(this, helpId);",true, new JavaArgument("String", "helpId"))); StringBuilder buffer = new StringBuilder(); - String lineSeparator = JAXXCompiler.getLineSeparator(); + String eol = JAXXCompiler.getLineSeparator(); if (options.isGenerateHelp()) { @@ -72,7 +77,7 @@ public class HelpRootCompiledObjectDecorator extends DefaultCompiledObjectDecora CompiledObject o = itr.next(); String helpID = getHelpId(o); if (helpID != null) { - buffer.append(lineSeparator); + buffer.append(eol); // detects a helpId to register buffer.append("registerHelpId(_broker, " + o.getJavaCode() + ", " + helpID + ");"); //keep the helpID for helpSet generation @@ -84,8 +89,8 @@ public class HelpRootCompiledObjectDecorator extends DefaultCompiledObjectDecora StringBuilder extraCode = new StringBuilder(helpBrokerFQN).append(" _broker = getBroker();"); - buffer.append(lineSeparator).append("_broker.prepareUI(this);"); - buffer.append(lineSeparator); + buffer.append(eol).append("_broker.prepareUI(this);"); + buffer.append(eol); // add the calls compiler.appendLateInitializer(extraCode.toString()); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/generators/Generator.java b/jaxx-compiler/src/main/java/jaxx/compiler/generators/Generator.java index 5677672..1d9b00f 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/generators/Generator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/generators/Generator.java @@ -2,7 +2,7 @@ package jaxx.compiler.generators; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.JavaFile; +import jaxx.compiler.io.JavaFile; /** * TODO javadoc! diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/generators/GeneratorManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/generators/GeneratorManager.java deleted file mode 100644 index 1a79d46..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/generators/GeneratorManager.java +++ /dev/null @@ -1,42 +0,0 @@ -package jaxx.compiler.generators; - -import java.util.ArrayList; -import java.util.List; -import java.util.ServiceLoader; - -/** - * - * @author chemit - * @since 2.0.0 - */ -public class GeneratorManager { - - protected static List<Generator> generators; - - public static List<Generator> getGenerators() { - if (generators == null) { - loadGenerators(); - } - return generators; - } - - public static void addGenerator(Generator g) { - getGenerators().add(g); - } - - public static void clear() { - if (generators != null) { - generators.clear(); - generators = null; - } - } - - protected static void loadGenerators() { - if (generators == null) { - generators = new ArrayList<Generator>(); - for (Generator generator : ServiceLoader.load(Generator.class)) { - generators.add(generator); - } - } - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/generators/JAXXObjectGenerator.java b/jaxx-compiler/src/main/java/jaxx/compiler/generators/JAXXObjectGenerator.java index ff0eeeb..aded870 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/generators/JAXXObjectGenerator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/generators/JAXXObjectGenerator.java @@ -1,5 +1,9 @@ package jaxx.compiler.generators; +import jaxx.compiler.io.JavaMethod; +import jaxx.compiler.io.JavaArgument; +import jaxx.compiler.io.JavaField; +import jaxx.compiler.io.JavaFile; import jaxx.compiler.*; import jaxx.runtime.Base64Coder; import jaxx.compiler.CompilerException; @@ -8,7 +12,6 @@ import jaxx.compiler.reflect.ClassDescriptor; import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.compiler.reflect.FieldDescriptor; import jaxx.compiler.reflect.MethodDescriptor; -import jaxx.compiler.types.TypeManager; import jaxx.runtime.JAXXObject; import jaxx.runtime.JAXXObjectDescriptor; import jaxx.runtime.JAXXContext; @@ -17,9 +20,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.io.IOException; -import java.lang.reflect.Modifier; -import static java.lang.reflect.Modifier.FINAL; -import static java.lang.reflect.Modifier.PROTECTED; +import static java.lang.reflect.Modifier.*; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -36,75 +37,77 @@ public class JAXXObjectGenerator implements Generator { /** log */ protected static final Log log = LogFactory.getLog(JAXXObjectGenerator.class); + protected static final JavaField SERIAL_VERSION_UID_FIELD = JavaField.newField(PRIVATE | STATIC | FINAL, + "long", "serialVersionUID", false, "1L"); protected static final JavaField ACTIVE_BINDINGS_FIELD = JavaField.newField(PROTECTED, - "java.util.List<Object>", "$activeBindings", "new ArrayList<Object>()"); + "java.util.List<Object>", "$activeBindings", false, "new ArrayList<Object>()"); protected static final JavaField BINDING_SOURCES_FIELD = JavaField.newField(PROTECTED, - "java.util.Map<String,Object>", "$bindingSources", "new HashMap<String,Object>()"); + "java.util.Map<String,Object>", "$bindingSources", false, "new HashMap<String,Object>()"); protected static final JavaField OBJECT_MAP_FIELD = JavaField.newField(PROTECTED, - "Map<String,Object>", "$objectMap", "new HashMap<String,Object>()"); - protected static final JavaField ALL_COMPONENTS_CREATED_FIELD = JavaField.newField(java.lang.reflect.Modifier.PRIVATE, - "boolean", "allComponentsCreated"); - protected static final JavaField CONTEXT_INITIALIZED = JavaField.newField(java.lang.reflect.Modifier.PRIVATE, - "boolean", "contextInitialized", "true"); - protected static final JavaField PREVIOUS_VALUES_FIELD = JavaField.newField(0, - "java.util.Map", "$previousValues", "new java.util.HashMap()"); + "Map<String,Object>", "$objectMap", true, "new HashMap<String,Object>()"); + protected static final JavaField ALL_COMPONENTS_CREATED_FIELD = JavaField.newField(PRIVATE, + "boolean", "allComponentsCreated", false); + protected static final JavaField CONTEXT_INITIALIZED = JavaField.newField(PRIVATE, + "boolean", "contextInitialized", false, "true"); + protected static final JavaField PREVIOUS_VALUES_FIELD = JavaField.newField(PROTECTED, + "java.util.Map<?,?>", "$previousValues", false, "new java.util.HashMap<Object,Object>()"); protected static final JavaField DELEGATE_CONTEXT_FIELD = JavaField.newField(PROTECTED, - JAXXContext.class.getName(), "delegateContext"); + JAXXContext.class.getName(), "delegateContext", true); protected static final JavaField PROPERTY_CHANGE_SUPPORT_FIELD = JavaField.newField(0, - "java.beans.PropertyChangeSupport", "$propertyChangeSupport"); - protected static final JavaMethod GET_CONTEXT_VALUE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> T", "getContextValue", - "return delegateContext.getContextValue(clazz, null);", + "java.beans.PropertyChangeSupport", "$propertyChangeSupport", false); + protected static final JavaMethod GET_CONTEXT_VALUE_METHOD = JavaMethod.newMethod(PUBLIC, "<T> T", "getContextValue", + "return delegateContext.getContextValue(clazz, null);", true, new JavaArgument("Class<T>", "clazz")); - protected static final JavaMethod GET_CONTEXT_VALUE_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> T", "getContextValue", - "return delegateContext.getContextValue(clazz, name);", + protected static final JavaMethod GET_CONTEXT_VALUE_NAMED_METHOD = JavaMethod.newMethod(PUBLIC, "<T> T", "getContextValue", + "return delegateContext.getContextValue(clazz, name);", true, new JavaArgument("Class<T>", "clazz"), new JavaArgument("String", "name")); - protected static final JavaMethod SET_CONTEXT_VALUE_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> void", "setContextValue", - "delegateContext.setContextValue(o, name);", + protected static final JavaMethod SET_CONTEXT_VALUE_NAMED_METHOD = JavaMethod.newMethod(PUBLIC, "<T> void", "setContextValue", + "delegateContext.setContextValue(o, name);", true, new JavaArgument("T", "o"), new JavaArgument("String", "name")); - protected static final JavaMethod SET_CONTEXT_VALUE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> void", "setContextValue", - "delegateContext.setContextValue(o, null);", + protected static final JavaMethod SET_CONTEXT_VALUE_METHOD = JavaMethod.newMethod(PUBLIC, "<T> void", "setContextValue", + "delegateContext.setContextValue(o, null);", true, new JavaArgument("T", "o")); - protected static final JavaMethod REMOVE_CONTEXT_VALUE_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> void", "removeContextValue", - "delegateContext.removeContextValue(clazz, name);", + protected static final JavaMethod REMOVE_CONTEXT_VALUE_NAMED_METHOD = JavaMethod.newMethod(PUBLIC, "<T> void", "removeContextValue", + "delegateContext.removeContextValue(clazz, name);", true, new JavaArgument("Class<T>", "clazz"), new JavaArgument("String", "name")); - protected static final JavaMethod REMOVE_CONTEXT_VALUE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<T> void", "removeContextValue", - "delegateContext.removeContextValue(clazz, null);", + protected static final JavaMethod REMOVE_CONTEXT_VALUE_METHOD = JavaMethod.newMethod(PUBLIC, "<T> void", "removeContextValue", + "delegateContext.removeContextValue(clazz, null);", true, new JavaArgument("Class<T>", "clazz")); - protected static final JavaMethod GET_PARENT_CONTAINER_MORE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<O extends Container> O", "getParentContainer", - "return delegateContext.getParentContainer(source, clazz);", + protected static final JavaMethod GET_PARENT_CONTAINER_MORE_METHOD = JavaMethod.newMethod(PUBLIC, "<O extends Container> O", "getParentContainer", + "return delegateContext.getParentContainer(source, clazz);", true, new JavaArgument("Object", "source"), new JavaArgument("Class<O>", "clazz")); - protected static final JavaMethod GET_PARENT_CONTAINER_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "<O extends Container> O", "getParentContainer", - "return delegateContext.getParentContainer(clazz);", + protected static final JavaMethod GET_PARENT_CONTAINER_METHOD = JavaMethod.newMethod(PUBLIC, "<O extends Container> O", "getParentContainer", + "return delegateContext.getParentContainer(clazz);", true, new JavaArgument("Class<O>", "clazz")); - protected static final JavaMethod GET_OBJECT_BY_ID_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "java.lang.Object", "getObjectById", - "return $objectMap.get(id);", + protected static final JavaMethod GET_OBJECT_BY_ID_METHOD = JavaMethod.newMethod(PUBLIC, "java.lang.Object", "getObjectById", + "return $objectMap.get(id);", true, new JavaArgument("String", "id")); - protected static final JavaMethod GET_JAXX_OBJECT_DESCRIPTOR_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC | java.lang.reflect.Modifier.STATIC, "jaxx.runtime.JAXXObjectDescriptor", "$getJAXXObjectDescriptor", - "return jaxx.runtime.Util.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);"); - protected static final JavaMethod PROCESS_DATA_BINDING_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "processDataBinding", - "processDataBinding(dest, false);", + protected static final JavaMethod GET_JAXX_OBJECT_DESCRIPTOR_METHOD = JavaMethod.newMethod(PUBLIC | STATIC, "jaxx.runtime.JAXXObjectDescriptor", "$getJAXXObjectDescriptor", + "return jaxx.runtime.Util.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);", false); + protected static final JavaMethod PROCESS_DATA_BINDING_METHOD = JavaMethod.newMethod(PUBLIC, "void", "processDataBinding", + "processDataBinding(dest, false);", true, new JavaArgument("String", "dest")); - protected static final JavaMethod FIRE_PROPERTY_CHANGE_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "firePropertyChange", - "super.firePropertyChange(propertyName, oldValue, newValue);", + protected static final JavaMethod FIRE_PROPERTY_CHANGE_METHOD = JavaMethod.newMethod(PUBLIC, "void", "firePropertyChange", + "super.firePropertyChange(propertyName, oldValue, newValue);", true, new JavaArgument("String", "propertyName"), new JavaArgument("Object", "oldValue"), new JavaArgument("Object", "newValue")); - protected static final JavaMethod FIRE_PROPERTY_CHANGE_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "firePropertyChange", - "$getPropertyChangeSupport().firePropertyChange(propertyName, oldValue, newValue);", + protected static final JavaMethod FIRE_PROPERTY_CHANGE_NAMED_METHOD = JavaMethod.newMethod(PUBLIC, "void", "firePropertyChange", + "$getPropertyChangeSupport().firePropertyChange(propertyName, oldValue, newValue);", true, new JavaArgument("String", "propertyName"), new JavaArgument("Object", "oldValue"), new JavaArgument("Object", "newValue")); protected static final JavaMethod GET_PROPERTY_CHANGE_SUPPORT_METHOD = JavaMethod.newMethod(0, "java.beans.PropertyChangeSupport", "$getPropertyChangeSupport", "if ($propertyChangeSupport == null)\n" + " $propertyChangeSupport = new PropertyChangeSupport(this);\n" + - "return $propertyChangeSupport;"); - protected static final JavaMethod ADD_PROPERTY_CHANGE_SUPPORT_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "addPropertyChangeListener", - "$getPropertyChangeSupport().addPropertyChangeListener(listener);", + "return $propertyChangeSupport;", false); + protected static final JavaMethod ADD_PROPERTY_CHANGE_SUPPORT_METHOD = JavaMethod.newMethod(PUBLIC, "void", "addPropertyChangeListener", + "$getPropertyChangeSupport().addPropertyChangeListener(listener);", true, new JavaArgument("java.beans.PropertyChangeListener", "listener")); - protected static final JavaMethod ADD_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "addPropertyChangeListener", - "$getPropertyChangeSupport().addPropertyChangeListener(property, listener);", + protected static final JavaMethod ADD_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD = JavaMethod.newMethod(PUBLIC, "void", "addPropertyChangeListener", + "$getPropertyChangeSupport().addPropertyChangeListener(property, listener);", true, new JavaArgument("String", "property"), new JavaArgument("java.beans.PropertyChangeListener", "listener")); - protected static final JavaMethod REMOVE_PROPERTY_CHANGE_SUPPORT_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "removePropertyChangeListener", - "$getPropertyChangeSupport().removePropertyChangeListener(listener);", + protected static final JavaMethod REMOVE_PROPERTY_CHANGE_SUPPORT_METHOD = JavaMethod.newMethod(PUBLIC, "void", "removePropertyChangeListener", + "$getPropertyChangeSupport().removePropertyChangeListener(listener);", true, new JavaArgument("java.beans.PropertyChangeListener", "listener")); - protected static final JavaMethod REMOVE_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD = JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, "void", "removePropertyChangeListener", - "$getPropertyChangeSupport().removePropertyChangeListener(property, listener);", + protected static final JavaMethod REMOVE_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD = JavaMethod.newMethod(PUBLIC, "void", "removePropertyChangeListener", + "$getPropertyChangeSupport().removePropertyChangeListener(property, listener);", true, new JavaArgument("String", "property"), new JavaArgument("java.beans.PropertyChangeListener", "listener")); @Override @@ -117,8 +120,8 @@ public class JAXXObjectGenerator implements Generator { //Map<String, CompiledObject> objects = compiler.getObjects(); ClassDescriptor superclass = root.getObjectClass(); boolean superclassIsJAXXObject = ClassDescriptorLoader.getClassDescriptor(JAXXObject.class).isAssignableFrom(superclass); - javaFile.setModifiers(Modifier.PUBLIC); - javaFile.setClassName(fullClassName); + javaFile.setModifiers(PUBLIC); + javaFile.setName(fullClassName); javaFile.setSuperClass(JAXXCompiler.getCanonicalName(superclass)); javaFile.setSuperclassIsJAXXObject(superclassIsJAXXObject); @@ -130,27 +133,13 @@ public class JAXXObjectGenerator implements Generator { for (CompiledObject object : compiler.getObjects().values()) { CompiledObjectDecorator decorator = object.getDecorator(); decorator.finalizeCompiler(compiler, root, object, javaFile, packageName, className, fullClassName); - - /*if (!object.isOverride() && !(object instanceof ScriptInitializer)) { - String id = object.getId(); - int access = id.startsWith("$") ? Modifier.PRIVATE : Modifier.PROTECTED; - if (object == root) { - javaFile.addField(new JavaField(access, fullClassName, id, "this")); - } else { - //TC -20081017 can have generic on compiled Object - javaFile.addField(JavaField.newField(access, JAXXCompiler.getCanonicalName(object), id), object.isJavaBean()); - } - } - - if (!compiler.inlineCreation(object) && object != root) { - javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getCreationMethodName(), getCreationCode(compiler, object))); - }*/ } + String eol = JAXXCompiler.getLineSeparator(); // DataBinding for (DataBinding dataBinding : compiler.getDataBindings()) { if (dataBinding.compile(true)) { - compiler.getInitDataBindings().append("applyDataBinding(").append(TypeManager.getJavaCode(dataBinding.getId())).append(");").append(JAXXCompiler.getLineSeparator()); + compiler.getInitDataBindings().append("applyDataBinding(").append(compiler.getJavaCode(dataBinding.getId())).append(");").append(eol); } } @@ -158,27 +147,26 @@ public class JAXXObjectGenerator implements Generator { boolean hasBind = compiler.getApplyDataBinding().length() > 0; if (hasBind) { compiler.appendApplyDataBinding(" else {"); - compiler.appendApplyDataBinding(JAXXCompiler.getLineSeparator()); + compiler.appendApplyDataBinding(eol); compiler.appendApplyDataBinding(" "); } compiler.appendApplyDataBinding("super.applyDataBinding($binding);"); - compiler.appendApplyDataBinding(JAXXCompiler.getLineSeparator()); + compiler.appendApplyDataBinding(eol); if (hasBind) { compiler.appendApplyDataBinding(" return;"); - compiler.appendApplyDataBinding(JAXXCompiler.getLineSeparator()); + compiler.appendApplyDataBinding(eol); compiler.appendApplyDataBinding("}"); } - hasBind = compiler.getRemoveDataBinding().length() > 0; if (hasBind) { compiler.appendRemoveDataBinding(" else {"); - compiler.appendRemoveDataBinding(JAXXCompiler.getLineSeparator()); + compiler.appendRemoveDataBinding(eol); compiler.appendRemoveDataBinding(" "); } compiler.appendRemoveDataBinding("super.removeDataBinding($binding);"); - compiler.appendRemoveDataBinding(JAXXCompiler.getLineSeparator()); + compiler.appendRemoveDataBinding(eol); if (hasBind) { compiler.appendRemoveDataBinding("}"); @@ -191,7 +179,7 @@ public class JAXXObjectGenerator implements Generator { @Override public void prepareJavaFile(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws ClassNotFoundException { - String fullClassName = javaFile.getClassName(); + String fullClassName = javaFile.getName(); String jaxxContextImplementorClass = compiler.getConfiguration().getJaxxContextClass().getName(); boolean superclassIsJAXXObject = javaFile.isSuperclassIsJAXXObject(); @@ -200,7 +188,7 @@ public class JAXXObjectGenerator implements Generator { if (compiler.getConfiguration().isAddLogger()) { javaFile.addImport(Log.class); javaFile.addImport(LogFactory.class); - javaFile.addField(JavaField.newField(Modifier.PUBLIC + Modifier.STATIC + FINAL, "Log", "log", "LogFactory.getLog(" + fullClassName + ".class)")); + javaFile.addField(JavaField.newField(PUBLIC + STATIC + FINAL, "Log", "log", false, "LogFactory.getLog(" + fullClassName + ".class)")); } // JAXXObject @@ -210,7 +198,7 @@ public class JAXXObjectGenerator implements Generator { javaFile.addField(ACTIVE_BINDINGS_FIELD); // JAXXContext - javaFile.addField(JavaField.newField(PROTECTED | FINAL, JAXXContext.class.getName(), "delegateContext", "new " + jaxxContextImplementorClass + "(this);")); + javaFile.addField(JavaField.newField(PROTECTED | FINAL, JAXXContext.class.getName(), "delegateContext", true, "new " + jaxxContextImplementorClass + "(this);")); javaFile.addMethod(SET_CONTEXT_VALUE_METHOD); javaFile.addMethod(SET_CONTEXT_VALUE_NAMED_METHOD); javaFile.addMethod(GET_CONTEXT_VALUE_METHOD); @@ -226,8 +214,8 @@ public class JAXXObjectGenerator implements Generator { // DataBinding javaFile.addMethod(PROCESS_DATA_BINDING_METHOD); } - - javaFile.addField(ALL_COMPONENTS_CREATED_FIELD); + javaFile.addSimpleField(SERIAL_VERSION_UID_FIELD); + javaFile.addSimpleField(ALL_COMPONENTS_CREATED_FIELD); boolean overrideContextInitialized = false; FieldDescriptor[] scriptFields = compiler.getScriptFields(); for (FieldDescriptor f : scriptFields) { @@ -237,22 +225,38 @@ public class JAXXObjectGenerator implements Generator { } } if (!overrideContextInitialized) { - javaFile.addField(CONTEXT_INITIALIZED); + javaFile.addSimpleField(CONTEXT_INITIALIZED); } - javaFile.addField(createJAXXObjectDescriptorField(compiler, javaFile)); + javaFile.addSimpleField(createJAXXObjectDescriptorField(compiler, javaFile)); if (compiler.getStylesheet() != null) { - javaFile.addField(PREVIOUS_VALUES_FIELD); - } - /*for (CompiledObject object : compiler.getObjects().values()) { - List<CompiledObject.ChildRef> refList = object.getChilds(); - if (refList==null || refList.isEmpty()) { - continue; - } - for (ChildRef childRef : refList) { - childRef.addToAdditionCode(buffer); + boolean needField = true; + if (superclassIsJAXXObject) { + // check alreay exists on parent + ClassDescriptor superclass = root.getObjectClass(); + if (log.isDebugEnabled()) { + log.debug("superclass : " + superclass); + } + JAXXCompiler parentCompiler = compiler.getEngine().getJAXXCompiler(superclass.getName()); + if (parentCompiler != null) { + needField = parentCompiler.getStylesheet() == null; + } else { + try { + + superclass.getDeclaredFieldDescriptor(PREVIOUS_VALUES_FIELD.getName()); + needField = false; + } catch (NoSuchFieldException ex) { + // field not found + } + } + if (needField && log.isDebugEnabled()) { + log.debug("no " + PREVIOUS_VALUES_FIELD.getName() + " field in super class"); + } + } + if (needField) { + javaFile.addSimpleField(PREVIOUS_VALUES_FIELD); + } } - }*/ //TC 20090228 - only generate constructors if not done in scripts boolean constructorDetected = false; MethodDescriptor[] methods = compiler.getScriptMethods(); @@ -279,13 +283,13 @@ public class JAXXObjectGenerator implements Generator { javaFile.addMethod(createCompleteSetupMethod(compiler, javaFile, compiler.getInitDataBindings())); - - javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", "applyDataBinding", + javaFile.addMethod(JavaMethod.newMethod(PUBLIC, "void", "applyDataBinding", compiler.getApplyDataBinding().toString() + JAXXCompiler.getLineSeparator() + "processDataBinding($binding);", + true, new JavaArgument("String", "$binding"))); - javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", "removeDataBinding", - compiler.getRemoveDataBinding().toString(), new JavaArgument("String", "$binding"))); + javaFile.addMethod(JavaMethod.newMethod(PUBLIC, "void", "removeDataBinding", + compiler.getRemoveDataBinding().toString(), true, new JavaArgument("String", "$binding"))); javaFile.addMethod(createProcessDataBindingMethod(compiler, superclassIsJAXXObject)); @@ -315,19 +319,19 @@ public class JAXXObjectGenerator implements Generator { int sizeLimit = 65000; // constant strings are limited to 64K, and I'm not brave enough to push right up to the limit if (data.length() < sizeLimit) { - return JavaField.newField(Modifier.PRIVATE | Modifier.STATIC, "java.lang.String", "$jaxxObjectDescriptor", TypeManager.getJavaCode(data)); + return JavaField.newField(PRIVATE | STATIC, "java.lang.String", "$jaxxObjectDescriptor", false, compiler.getJavaCode(data)); } else { StringBuffer initializer = new StringBuffer(); for (int i = 0; i < data.length(); i += sizeLimit) { String name = "$jaxxObjectDescriptor" + i; - javaFile.addField(new JavaField(Modifier.PRIVATE | Modifier.STATIC, "java.lang.String", name, - TypeManager.getJavaCode(data.substring(i, Math.min(i + sizeLimit, data.length()))))); + javaFile.addField(new JavaField(PRIVATE | STATIC, "java.lang.String", name, false, + compiler.getJavaCode(data.substring(i, Math.min(i + sizeLimit, data.length()))))); if (initializer.length() > 0) { initializer.append(" + "); } initializer.append("String.valueOf(").append(name).append(")"); } - return JavaField.newField(Modifier.PRIVATE | Modifier.STATIC, "java.lang.String", "$jaxxObjectDescriptor", initializer.toString()); + return JavaField.newField(PRIVATE | STATIC | FINAL, "java.lang.String", "$jaxxObjectDescriptor", false, initializer.toString()); } } catch (IOException e) { throw new RuntimeException("Internal error: can't-happen error", e); @@ -352,10 +356,10 @@ public class JAXXObjectGenerator implements Generator { } int modifiers = firePropertyChange != null ? firePropertyChange.getModifiers() : 0; - if (Modifier.isPublic(modifiers)) { + if (isPublic(modifiers)) { // we have all the support we need } - if (Modifier.isProtected(modifiers)) { + if (isProtected(modifiers)) { // there is property change support but the firePropertyChange method is protected javaFile.addMethod(FIRE_PROPERTY_CHANGE_METHOD); } else { @@ -382,7 +386,7 @@ public class JAXXObjectGenerator implements Generator { if (listenerMethod.getParameterTypes().length != 1) { throw new CompilerException("Expected event handler " + listenerMethod.getName() + " of class " + handler.getListenerClass() + " to have exactly one argument"); } - javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", methodName, handler.getJavaCode(), + javaFile.addMethod(JavaMethod.newMethod(PUBLIC, "void", methodName, handler.getJavaCode(), false, new JavaArgument(JAXXCompiler.getCanonicalName(listenerMethod.getParameterTypes()[0]), "event"))); } } @@ -392,59 +396,51 @@ public class JAXXObjectGenerator implements Generator { protected JavaMethod createConstructor(JAXXCompiler compiler, String className, boolean superclassIsJAXXObject) throws CompilerException { StringBuffer code = new StringBuffer(); String constructorParams = compiler.getRootObject().getConstructorParams(); + String eol = JAXXCompiler.getLineSeparator(); if (constructorParams != null) { - code.append(" super(").append(constructorParams).append(");").append(JAXXCompiler.getLineSeparator()); + code.append(" super(").append(constructorParams).append(");").append(eol); } else { if (superclassIsJAXXObject) { - code.append(" super();").append(JAXXCompiler.getLineSeparator()); + code.append(" super();").append(eol); } } code.append("$initialize();"); - code.append(JAXXCompiler.getLineSeparator()); - return JavaMethod.newMethod(Modifier.PUBLIC, null, className, code.toString()); + code.append(eol); + return JavaMethod.newMethod(PUBLIC, null, className, code.toString(), false); } protected JavaMethod createConstructorWithInitialContext(JAXXCompiler compiler, String className, boolean superclassIsJAXXObject) throws CompilerException { StringBuffer code = new StringBuffer(); String constructorParams = compiler.getRootObject().getConstructorParams(); + String eol = JAXXCompiler.getLineSeparator(); if (constructorParams != null) { - code.append(" super(").append(constructorParams).append(");").append(JAXXCompiler.getLineSeparator()); + code.append(" super(").append(constructorParams).append(");").append(eol); } else { if (superclassIsJAXXObject) { - code.append(" super(parentContext);").append(JAXXCompiler.getLineSeparator()); + code.append(" super(parentContext);").append(eol); } } if (!superclassIsJAXXObject) { code.append(Util.class.getName() + ".initContext(this, parentContext);"); - code.append(JAXXCompiler.getLineSeparator()); - -// code.append("if (parentContext instanceof jaxx.runtime.context.JAXXInitialContext) {"); -// code.append(JAXXCompiler.getLineSeparator()); -// code.append(" ((jaxx.runtime.context.JAXXInitialContext)parentContext).to(this);"); -// code.append(JAXXCompiler.getLineSeparator()); -// code.append("} else {"); -// code.append(JAXXCompiler.getLineSeparator()); -// code.append(" setContextValue(parentContext);"); -// code.append(JAXXCompiler.getLineSeparator()); -// code.append("}"); -// code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); } code.append("$initialize();"); - code.append(JAXXCompiler.getLineSeparator()); - return JavaMethod.newMethod(Modifier.PUBLIC, null, className, code.toString(), new JavaArgument(JAXXContext.class.getName(), "parentContext")); + code.append(eol); + return JavaMethod.newMethod(PUBLIC, null, className, code.toString(), false, new JavaArgument(JAXXContext.class.getName(), "parentContext")); } public JavaMethod createInitializer(JAXXCompiler compiler) throws CompilerException { + String eol = JAXXCompiler.getLineSeparator(); StringBuffer code = new StringBuffer(); CompiledObject root = compiler.getRootObject(); code.append("if (allComponentsCreated || !contextInitialized) {"); - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); code.append(" return;"); - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); code.append("}"); - code.append(JAXXCompiler.getLineSeparator()); - code.append("$objectMap.put(").append(TypeManager.getJavaCode(root.getId())).append(", this);"); - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); + code.append("$objectMap.put(").append(compiler.getJavaCode(root.getId())).append(", this);"); + code.append(eol); Iterator<CompiledObject> i = compiler.getObjectCreationOrder(); boolean lastWasMethodCall = false; @@ -455,150 +451,83 @@ public class JAXXObjectGenerator implements Generator { } CompiledObjectDecorator decorator = object.getDecorator(); lastWasMethodCall = decorator.createInitializer(compiler, root, object, code, lastWasMethodCall); - /*if (object != root && !object.isOverride()) { - if (compiler.inlineCreation(object)) { - if (lastWasMethodCall) { - lastWasMethodCall = false; - code.append(JAXXCompiler.getLineSeparator()); - } - code.append(getCreationCode(compiler, object)); - code.append(JAXXCompiler.getLineSeparator()); - } else { - code.append(object.getCreationMethodName()).append("();"); - code.append(JAXXCompiler.getLineSeparator()); - lastWasMethodCall = true; - } - }*/ } root.getDecorator().createInitializer(compiler, root, root, code, lastWasMethodCall); - /*String rootCode = root.getInitializationCode(compiler); - if (rootCode != null && rootCode.length() > 0) { - code.append(rootCode); - code.append(JAXXCompiler.getLineSeparator()); - }*/ - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); if (compiler.getInitializer().length() > 0) { code.append(compiler.getInitializer()); - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); } code.append("$completeSetup();"); - code.append(JAXXCompiler.getLineSeparator()); - return JavaMethod.newMethod(Modifier.PRIVATE, "void", "$initialize", code.toString()); + code.append(eol); + return JavaMethod.newMethod(PRIVATE, "void", "$initialize", code.toString(), false); } protected JavaMethod createCompleteSetupMethod(JAXXCompiler compiler, JavaFile javaFile, StringBuffer initDataBindings) { StringBuffer code = new StringBuffer(); code.append("allComponentsCreated = true;"); - code.append(JAXXCompiler.getLineSeparator()); + String eol = JAXXCompiler.getLineSeparator(); + code.append(eol); for (CompiledObject object : compiler.getObjects().values()) { CompiledObjectDecorator decorator = object.getDecorator(); code.append(decorator.createCompleteSetupMethod(compiler, object, javaFile, initDataBindings)); - - /*//TC - 20081017 only generate the method if not empty ? - if (object.getId().startsWith("$")) { - code.append(object.getAdditionCode()).append(JAXXCompiler.getLineSeparator()); - } else { - String additionCode = object.getAdditionCode(); - if (additionCode.length() > 0) { - code.append(object.getAdditionMethodName()).append("();").append(JAXXCompiler.getLineSeparator()); - additionCode = "if (!allComponentsCreated) {" + JAXXCompiler.getLineSeparator() + " return;" + JAXXCompiler.getLineSeparator() + "}" + JAXXCompiler.getLineSeparator() + additionCode; - javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getAdditionMethodName(), additionCode)); - } - }*/ - //code.append(getLineSeparator()); } code.append(initDataBindings); if (compiler.getLateInitializer().length() > 0) { code.append(compiler.getLateInitializer()); - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); } //TC-20090313 add an extra method after complete setup MethodDescriptor method = compiler.getScriptMethod("$afterCompleteSetup"); if (method != null) { - code.append("$afterCompleteSetup();").append(JAXXCompiler.getLineSeparator()); + code.append("$afterCompleteSetup();").append(eol); } - return JavaMethod.newMethod(Modifier.PRIVATE, "void", "$completeSetup", code.toString()); + return JavaMethod.newMethod(PRIVATE, "void", "$completeSetup", code.toString(), false); } protected JavaMethod createProcessDataBindingMethod(JAXXCompiler compiler, boolean superclassIsJAXXObject) { StringBuffer code = new StringBuffer(); + String eol = JAXXCompiler.getLineSeparator(); //boolean superclassIsJAXXObject = ClassDescriptorLoader.getClassDescriptor(JAXXObject.class).isAssignableFrom(compiler.getRootObject().getObjectClass()); // the force parameter forces the update to happen even if it is already in activeBindings. This // is used on superclass invocations b/c by the time the call gets to the superclass, it is already // marked active and would otherwise be skipped if (compiler.getProcessDataBinding().length() > 0) { code.append(" if (!$force && $activeBindings.contains($dest)) { "); - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); code.append(" return;"); - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); code.append("}"); - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); code.append("$activeBindings.add($dest);"); - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); code.append("try {"); - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); if (compiler.getProcessDataBinding().length() > 0) { code.append(compiler.getProcessDataBinding().toString()); //code.append(JAXXCompiler.getLineSeparator()); } if (superclassIsJAXXObject) { code.append(" else {"); - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); code.append(" super.processDataBinding($dest, true);"); - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); code.append(" }"); - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); } code.append("} finally {"); - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); code.append(" $activeBindings.remove($dest);"); - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); code.append("}"); - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); } else if (superclassIsJAXXObject) { code.append("super.processDataBinding($dest, true);"); - code.append(JAXXCompiler.getLineSeparator()); + code.append(eol); } - return JavaMethod.newMethod(Modifier.PUBLIC, "void", "processDataBinding", code.toString(), + return JavaMethod.newMethod(PUBLIC, "void", "processDataBinding", code.toString(), superclassIsJAXXObject, new JavaArgument("String", "$dest"), new JavaArgument("boolean", "$force")); } - - /*---------------------------------------------------------------------------------*/ - /*-- Create methods code ----------------------------------------------------------*/ - /*---------------------------------------------------------------------------------*/ - - /* protected String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException { - if (object instanceof ScriptInitializer) { - return object.getInitializationCode(compiler); - } - CompiledObjectDecorator decorator = object.getDecorator(); - String result = decorator.getCreationCode(compiler, object); - return result;*/ - /*StringBuffer result = new StringBuffer(); - result.append(object.getId()); - result.append(" = "); - if (object.isJavaBean() && object.getJavaBeanInitCode() != null) { - result.append(object.getJavaBeanInitCode()).append(";"); - } else { - String constructorParams = object.getConstructorParams(); - if (constructorParams != null) { - //TC - 20081017 compiledObject can have generics - result.append(" new ").append(JAXXCompiler.getCanonicalName(object)).append("(").append(constructorParams).append(");"); - //result.append("(").append(getCanonicalName(object.getObjectClass())).append(") new ").append(getCanonicalName(object.getObjectClass())).append("(").append(constructorParams).append(");"); - } else { - //TC - 20081017 compiledObject can have generics - result.append("new ").append(JAXXCompiler.getCanonicalName(object)).append("();"); - } - } - result.append(JAXXCompiler.getLineSeparator()); - String initCode = object.getInitializationCode(compiler); - if (initCode != null && initCode.length() > 0) { - result.append(initCode); - } - result.append("$objectMap.put(").append(TypeManager.getJavaCode(object.getId())).append(", ").append(object.getId()).append(");"); - - return result.toString();*/ -// } } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/generators/SwingGenerator.java b/jaxx-compiler/src/main/java/jaxx/compiler/generators/SwingGenerator.java index bf2a206..198b67e 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/generators/SwingGenerator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/generators/SwingGenerator.java @@ -1,5 +1,8 @@ package jaxx.compiler.generators; +import jaxx.compiler.io.JavaMethod; +import jaxx.compiler.io.JavaArgument; +import jaxx.compiler.io.JavaFile; import jaxx.compiler.*; import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.runtime.swing.Application; @@ -19,8 +22,12 @@ public class SwingGenerator implements Generator { //TODO : move this to jaxx-compiler-swing generator if (ClassDescriptorLoader.getClassDescriptor(Application.class.getName()).isAssignableFrom(root.getObjectClass()) && !compiler.isMainDeclared()) { // TODO: check for existing main method first - javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC | Modifier.STATIC, "void", "main", + javaFile.addMethod(JavaMethod.newMethod( + Modifier.PUBLIC | Modifier.STATIC, + "void", + "main", "SwingUtilities.invokeLater(new Runnable() { public void run() { new " + className + "().setVisible(true); } });", + false, new JavaArgument("String[]", "arg"))); } } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/generators/ValidatorGenerator.java b/jaxx-compiler/src/main/java/jaxx/compiler/generators/ValidatorGenerator.java index 0f8e3ec..8bd95a7 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/generators/ValidatorGenerator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/generators/ValidatorGenerator.java @@ -1,12 +1,15 @@ package jaxx.compiler.generators; +import jaxx.compiler.io.JavaMethod; +import jaxx.compiler.io.JavaArgument; +import jaxx.compiler.io.JavaField; +import jaxx.compiler.io.JavaFile; import jaxx.compiler.*; import jaxx.compiler.CompiledObject.ChildRef; import jaxx.compiler.reflect.ClassDescriptor; import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.compiler.tags.validator.BeanValidatorHandler; import jaxx.compiler.tags.validator.BeanValidatorHandler.CompiledBeanValidator; -import jaxx.compiler.types.TypeManager; import java.util.List; import jaxx.runtime.SwingUtil; @@ -15,7 +18,7 @@ import jaxx.runtime.SwingUtil; public class ValidatorGenerator implements Generator { protected static final JavaField VALIDATOR_IDS_FIELD = JavaField.newField(java.lang.reflect.Modifier.PROTECTED, - "java.util.List<String>", "validatorIds", "new ArrayList<String>()"); + "java.util.List<String>", "validatorIds", true, "new ArrayList<String>()"); @Override public void finalizeCompiler(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) { @@ -39,19 +42,20 @@ public class ValidatorGenerator implements Generator { } } } + String eol = JAXXCompiler.getLineSeparator(); // register validator for (CompiledBeanValidator validator : BeanValidatorHandler.getValidators(compiler)) { - String id = TypeManager.getJavaCode(validator.getId()); + String id = compiler.getJavaCode(validator.getId()); compiler.appendLateInitializer("validatorIds.add(" + id + ");"); - compiler.appendLateInitializer(JAXXCompiler.getLineSeparator()); + compiler.appendLateInitializer(eol); compiler.appendLateInitializer("getValidator(" + id + ").installUIs();"); - compiler.appendLateInitializer(JAXXCompiler.getLineSeparator()); + compiler.appendLateInitializer(eol); compiler.appendLateInitializer("getValidator(" + id + ").reloadBean();"); //compiler.appendLateInitializer("getValidator(" + id + ").validate();"); - compiler.appendLateInitializer(JAXXCompiler.getLineSeparator()); + compiler.appendLateInitializer(eol); } compiler.appendLateInitializer("validatorIds = java.util.Collections.unmodifiableList(validatorIds);"); - compiler.appendLateInitializer(JAXXCompiler.getLineSeparator()); + compiler.appendLateInitializer(eol); } @Override @@ -81,8 +85,12 @@ public class ValidatorGenerator implements Generator { // implements JAXXValidator javaFile.addField(VALIDATOR_IDS_FIELD); - javaFile.addMethod(JavaMethod.newMethod(java.lang.reflect.Modifier.PUBLIC, validatorFQN + "<?>", "getValidator", - "return (" + validatorFQN + ") (validatorIds.contains(validatorId) ? getObjectById(validatorId) : null);", + javaFile.addMethod(JavaMethod.newMethod( + java.lang.reflect.Modifier.PUBLIC, + validatorFQN + "<?>", + "getValidator", + "return (" + validatorFQN + "<?>) (validatorIds.contains(validatorId) ? getObjectById(validatorId) : null);", + true, new JavaArgument("String", "validatorId"))); } } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JavaArgument.java b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaArgument.java similarity index 84% rename from jaxx-compiler/src/main/java/jaxx/compiler/JavaArgument.java rename to jaxx-compiler/src/main/java/jaxx/compiler/io/JavaArgument.java index 139d70d..6a4665e 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JavaArgument.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaArgument.java @@ -2,16 +2,15 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.compiler; +package jaxx.compiler.io; /** * Represents an argument to a <code>JavaMethod</code>. * * @see JavaMethod */ -public class JavaArgument { +public class JavaArgument extends JavaElement { - private String name; private String type; private boolean isFinal; @@ -36,21 +35,12 @@ public class JavaArgument { * @param isFinal <code>true</code> if the argument should be marked final */ public JavaArgument(String type, String name, boolean isFinal) { + super(0, name); this.type = type; - this.name = name; this.isFinal = isFinal; } /** - * Returns the argument's name. - * - * @return the name of the argument - */ - public String getName() { - return name; - } - - /** * Returns the argument's type as it would be represented in Java source code. * * @return the argument's type @@ -75,7 +65,7 @@ public class JavaArgument { */ @Override public String toString() { - String result = type + ' ' + name; + String result = type + ' ' + getName(); return isFinal ? "final " + result : result; } } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaElement.java b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaElement.java new file mode 100644 index 0000000..d7ec97c --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaElement.java @@ -0,0 +1,79 @@ +package jaxx.compiler.io; + +import java.lang.reflect.Modifier; +import java.util.Arrays; +import jaxx.compiler.JAXXCompiler; + +/** + * Base Java element + * @author chemit + * @since 2.0.0 + */ +public abstract class JavaElement { + + private String lineSeparator; + private String name; + private int modifiers; + + public JavaElement(int modifiers, String name) { + this.modifiers = modifiers; + this.name = name; + } + + public final int getModifiers() { + return modifiers; + } + + public final void setModifiers(int modifiers) { + this.modifiers = modifiers; + } + + public final String getName() { + return name; + } + + public final void setName(String className) { + this.name = className; + } + + public final String getModifiersText() { + if (modifiers == 0) { + return ""; + } else { + return Modifier.toString(modifiers) + ' '; + } + } + + public final String getLineSeparator() { + if (lineSeparator == null) { + lineSeparator = JAXXCompiler.getLineSeparator(); + } + return lineSeparator; + } + + public static String addIndentation(String source, int indentation, String lineSeparator) { + return indent(source, indentation, false, lineSeparator); + } + + public static String setIndentation(String source, int indentation, String lineSeparator) { + return indent(source, indentation, true, lineSeparator); + } + + public static String indent(String source, int indentation, boolean trim, String lineSeparator) { + if (trim) { + source = source.trim(); + } + char[] spaces = new char[indentation]; + Arrays.fill(spaces, ' '); + StringBuffer result = new StringBuffer(); + String[] lines = source.split(System.getProperty("line.separator") + "|\n"); + for (int i = 0; i < lines.length; i++) { + if (i > 0) { + result.append(lineSeparator); + } + result.append(spaces); + result.append(trim ? lines[i].trim() : lines[i]); + } + return result.toString(); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaField.java b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaField.java new file mode 100644 index 0000000..794b322 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaField.java @@ -0,0 +1,100 @@ +/* + * Copyright 2006 Ethan Nicholas. All rights reserved. + * Use is subject to license terms. + */ +package jaxx.compiler.io; + +import java.lang.reflect.Modifier; + +/** + * Represents a field in a Java source file being generated for output. <code>JavaFields</code> are created + * and added to a {@link JavaFile}, which can then output Java source code. + */ +public class JavaField extends JavaElement implements Comparable<JavaField> { + + private String type; + private String initializer; + private boolean override; + + /** + * Constructs a new <code>JavaField</code>. The <code>modifiers</code> parameter is a bit mask of the + * constants from {@link java.lang.reflect.Modifier}, and the <code>type</code> of the field should be + * represented as it would appear in Java source code. + * + * @param modifiers the modifier keywords that should appear as part of the field's declaration + * @param type the type of the field as it would appear in Java source code + * @param name the field's name + * @param override + */ + public JavaField(int modifiers, String type, String name, boolean override) { + this(modifiers, type, name, override, null); + } + + /** + * Constructs a new <code>JavaField</code>. The <code>modifiers</code> parameter is a bit mask of the + * constants from <code>java.lang.reflect.Modifier</code>, and the <code>type</code> of the field should be + * represented as it would appear in Java source code. The <code>initializer</code> is the initial + * value of the field as it would appear in Java source code, or <code>null</code> to leave it at the + * default value. + * + * @param modifiers the modifier keywords that should appear as part of the field's declaration + * @param type the type of the field as it would appear in Java source code + * @param name the field's name + * @param override + * @param initializer the initial value of the field, as it would appear in Java source code + */ + public JavaField(int modifiers, String type, String name, boolean override, String initializer) { + super(modifiers, name); + this.type = type; + this.initializer = initializer; + this.override = override; + } + + /** + * Returns the field's type, as it would be represented in Java source code. + * + * @return the field's type + */ + public String getType() { + return type; + } + + public boolean isOverride() { + return override; + } + + public void setOverride(boolean override) { + this.override = override; + } + + /** + * Returns the Java source code for this field. + * + * @return the Java source code for this field + */ + @Override + public String toString() { + String eol = getLineSeparator(); + StringBuffer result = new StringBuffer(); + result.append(getModifiersText()); + result.append(type).append(' ').append(getName()); + if (initializer != null) { + result.append(" = ").append(initializer); + } + result.append(';').append(eol); + return result.toString(); + } + + @Override + public int compareTo(JavaField o) { + return JavaFieldComparator.COMPARATOR.compare(this, o); + } + + public static JavaField newField(int modifiers, String returnType, String name, boolean override) { + return newField(modifiers, returnType, name, override, null); + } + + public static JavaField newField(int modifiers, String returnType, String name, boolean override, String initializer) { + return new JavaField(modifiers, returnType, name, override, initializer); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaFieldComparator.java b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaFieldComparator.java new file mode 100644 index 0000000..e7ce8bd --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaFieldComparator.java @@ -0,0 +1,72 @@ +package jaxx.compiler.io; + +import java.lang.reflect.Modifier; +import java.util.Comparator; + +class JavaFieldComparator implements Comparator<JavaField> { + + static final JavaFieldComparator COMPARATOR = new JavaFieldComparator(); + + @Override + public int compare(JavaField o1, JavaField o2) { + int result; + if ((result = compareStatic(o1, o2)) != 0) { + return result; + } + // data sources must be on the last after all other fields + if ((result = compareDataSource(o1, o2)) != 0) { + return result; + } + // same static + if ((result = compareVisibility(o1, o2)) != 0) { + return result; + } + // same visibility, test name + return o1.getName().compareTo(o2.getName()); + } + + public int compareStatic(JavaField o1, JavaField o2) { + // first comparator modifiers : static always before none static + if (Modifier.isStatic(o1.getModifiers()) && !Modifier.isStatic(o2.getModifiers())) { + return -1; + } + if (!Modifier.isStatic(o1.getModifiers()) && Modifier.isStatic(o2.getModifiers())) { + return 1; + } + return 0; + } + + public int compareDataSource(JavaField o1, JavaField o2) { + // first comparator modifiers : static always before none static + if (o1.getName().startsWith("$DataSource") && !o2.getName().startsWith("$DataSource")) { + return 1; + } + if (!o1.getName().startsWith("$DataSource") && o2.getName().startsWith("$DataSource")) { + return -1; + } + return 0; + } + + public int compareVisibility(JavaField o1, JavaField o2) { + // first comparator modifiers : static always before none static + if (!Modifier.isPublic(o1.getModifiers()) && Modifier.isPublic(o2.getModifiers())) { + return 1; + } + if (Modifier.isPublic(o1.getModifiers()) && !Modifier.isPublic(o2.getModifiers())) { + return -1; + } + if (Modifier.isProtected(o1.getModifiers()) && !Modifier.isProtected(o2.getModifiers())) { + return -1; + } + if (!Modifier.isProtected(o1.getModifiers()) && Modifier.isProtected(o2.getModifiers())) { + return 1; + } + if (Modifier.isPrivate(o1.getModifiers()) && !Modifier.isPrivate(o2.getModifiers())) { + return -1; + } + if (!Modifier.isPrivate(o1.getModifiers()) && Modifier.isPrivate(o2.getModifiers())) { + return 1; + } + return 0; + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JavaFile.java b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaFile.java similarity index 64% rename from jaxx-compiler/src/main/java/jaxx/compiler/JavaFile.java rename to jaxx-compiler/src/main/java/jaxx/compiler/io/JavaFile.java index d072593..313d160 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JavaFile.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaFile.java @@ -2,28 +2,31 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.compiler; +package jaxx.compiler.io; -import jaxx.compiler.JavaMethod.MethodOrder; +import jaxx.compiler.io.JavaMethod.MethodOrder; import java.lang.reflect.Modifier; import java.util.ArrayList; -import java.util.Arrays; import java.util.EnumMap; import java.util.List; import java.util.Map.Entry; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * A Java source file being generated for output. Once the class is completely initialized, use the * {@link #toString} method to generate source code for it. */ -public class JavaFile { +public class JavaFile extends JavaElement { + /** + * Logger + */ + static private final Log log = LogFactory.getLog(JavaFile.class); protected static final String GETTER_PATTERN = "return %1$s;"; protected static final String BOOLEAN_GETTER_PATTERN = "return %1$s !=null && %1$s;"; protected static final String SETTER_PATTERN = "%1$s oldValue = this.%2$s;\nthis.%2$s = newValue;\nfirePropertyChange(\"%2$s\", oldValue, newValue);"; - private int modifiers; - private String className; private List<String> imports = new ArrayList<String>(); private List<JavaField> fields = new ArrayList<JavaField>(); private List<JavaMethod> methods = new ArrayList<JavaMethod>(); @@ -37,6 +40,7 @@ public class JavaFile { private String superGenericType; public JavaFile() { + super(0, ""); } public JavaFile(int modifiers, String className, String superClass) { @@ -44,8 +48,7 @@ public class JavaFile { } public JavaFile(int modifiers, String className, String superClass, List<String> interfaces) { - this.modifiers = modifiers; - this.className = className; + super(modifiers, className); this.superClass = superClass; this.interfaces = interfaces; } @@ -62,22 +65,6 @@ public class JavaFile { return imports.toArray(new String[imports.size()]); } - public int getModifiers() { - return modifiers; - } - - public void setModifiers(int modifiers) { - this.modifiers = modifiers; - } - - public String getClassName() { - return className; - } - - public void setClassName(String className) { - this.className = className; - } - public String getSuperClass() { return superClass; } @@ -121,17 +108,17 @@ public class JavaFile { String content = String.format(GETTER_PATTERN, id); addMethod(new JavaMethod( Modifier.isProtected(field.getModifiers()) ? Modifier.PUBLIC : Modifier.PROTECTED, - field.getType(), "get" + capitalizedName, null, null, content)); + field.getType(), "get" + capitalizedName, null, null, content, field.isOverride())); if (javaBean) { // add full javabean support if (Boolean.class.getName().equals(field.getType())) { content = String.format(BOOLEAN_GETTER_PATTERN, id); - addMethod(new JavaMethod(Modifier.PUBLIC, field.getType(), "is" + capitalizedName, null, null, content)); + addMethod(new JavaMethod(Modifier.PUBLIC, field.getType(), "is" + capitalizedName, null, null, content, field.isOverride())); } content = String.format(SETTER_PATTERN, field.getType(), id); JavaArgument arg = new JavaArgument(field.getType(), "newValue"); - addMethod(new JavaMethod(Modifier.PUBLIC, "void", "set" + capitalizedName, new JavaArgument[]{arg}, null, content)); + addMethod(new JavaMethod(Modifier.PUBLIC, "void", "set" + capitalizedName, new JavaArgument[]{arg}, null, content, field.isOverride())); } } @@ -143,85 +130,36 @@ public class JavaFile { return fields.toArray(new JavaField[fields.size()]); } - public static String addIndentation(String source, int indentation, String lineSeparator) { - return indent(source, indentation, false, lineSeparator); - } - - public static String setIndentation(String source, int indentation, String lineSeparator) { - return indent(source, indentation, true, lineSeparator); - } - - public static String indent(String source, int indentation, boolean trim, String lineSeparator) { - if (trim) { - source = source.trim(); - } - char[] spaces = new char[indentation]; - Arrays.fill(spaces, ' '); - StringBuffer result = new StringBuffer(); - String[] lines = source.split(System.getProperty("line.separator") + "|\n"); - for (int i = 0; i < lines.length; i++) { - if (i > 0) { - result.append(lineSeparator); - } - result.append(spaces); - result.append(trim ? lines[i].trim() : lines[i]); - } - return result.toString(); - } - public void addBodyCode(String bodyCode) { rawBodyCode.append(bodyCode); } - public String getClassBody(String lineSeparator) { + @Override + public String toString() { + String eol = getLineSeparator(); StringBuffer result = new StringBuffer(); - if (fields.size() > 0) { - java.util.Collections.sort(fields); // sort fields - - for (JavaField field : fields) { - result.append(addIndentation(field.toString(lineSeparator), 4, lineSeparator)); - result.append(lineSeparator); - } - - result.append(lineSeparator); + if (getName().indexOf(".") != -1) { + result.append("package ").append(getName().substring(0, getName().lastIndexOf("."))).append(";"); + result.append(eol); + result.append(eol); } - if (rawBodyCode.length() > 0) { - result.append(addIndentation("/* begin raw body code */\n", 4, lineSeparator)); - String s = rawBodyCode.toString(); - if (!s.startsWith(lineSeparator)) { - result.append(lineSeparator); + if (imports.size() > 0) { + for (String anImport : imports) { + result.append("import "); + result.append(anImport); + result.append(';'); + result.append(eol); } - result.append(addIndentation(s, 4, lineSeparator)); - result.append(lineSeparator); - result.append(addIndentation("/* end raw body code */", 4, lineSeparator)); - result.append(lineSeparator); - } - - for (JavaFile innerClass : innerClasses) { - result.append(addIndentation(innerClass.toString(), 4, lineSeparator)); - result.append(lineSeparator).append(lineSeparator); - } - - EnumMap<MethodOrder, List<JavaMethod>> map = JavaMethod.getSortedMethods(methods); - for (Entry<MethodOrder, List<JavaMethod>> entry : map.entrySet()) { - List<JavaMethod> list = entry.getValue(); - entry.getKey().generate(result, list, lineSeparator); - list.clear(); + result.append(eol); } - map.clear(); - return result.toString(); - } - - public String getClassDefinition(String lineSeparator) { - StringBuffer result = new StringBuffer(); - result.append(getModifiersText(modifiers)); + result.append(getModifiersText()); if (abstractClass) { result.append("abstract "); } result.append("class "); - result.append(className.substring(className.lastIndexOf(".") + 1)); + result.append(getName().substring(getName().lastIndexOf(".") + 1)); if (genericType != null) { result.append('<').append(genericType).append('>'); } @@ -240,45 +178,53 @@ public class JavaFile { } } result.append(" {"); - result.append(lineSeparator); - result.append(getClassBody(lineSeparator)); - result.append("}"); - return result.toString(); - } + result.append(eol); + if (fields.size() > 0) { + java.util.Collections.sort(fields); // sort fields - public static String getModifiersText(int modifiers) { - if (modifiers == 0) { - return ""; - } else { - return Modifier.toString(modifiers) + ' '; - } - } + for (JavaField field : fields) { + if (log.isDebugEnabled()) { + log.debug("generate field " + field); + } + result.append(addIndentation(field.toString(), 4, eol)); + result.append(eol); + } - /** - * Returns the Java source code for this class. - * - * @param lineSeparator line separator - * @return a complete Java file for this class - */ - public String toString(String lineSeparator) { - StringBuffer result = new StringBuffer(); - if (className.indexOf(".") != -1) { - result.append("package ").append(className.substring(0, className.lastIndexOf("."))).append(";"); - result.append(lineSeparator); - result.append(lineSeparator); + result.append(eol); } - if (imports.size() > 0) { - for (String anImport : imports) { - result.append("import "); - result.append(anImport); - result.append(';'); - result.append(lineSeparator); + if (rawBodyCode.length() > 0) { + result.append(addIndentation("/* begin raw body code */\n", 4, eol)); + String s = rawBodyCode.toString(); + if (!s.startsWith(eol)) { + result.append(eol); } - result.append(lineSeparator); + result.append(addIndentation(s, 4, eol)); + result.append(eol); + result.append(addIndentation("/* end raw body code */", 4, eol)); + result.append(eol); } - result.append(getClassDefinition(lineSeparator)); + for (JavaFile innerClass : innerClasses) { + result.append(addIndentation(innerClass.toString(), 4, eol)); + result.append(eol).append(eol); + } + + EnumMap<MethodOrder, List<JavaMethod>> map = JavaMethod.getSortedMethods(methods); + for (Entry<MethodOrder, List<JavaMethod>> entry : map.entrySet()) { + List<JavaMethod> list = entry.getValue(); + if (!list.isEmpty()) { + result.append(addIndentation(entry.getKey().getHeader(), 4, eol)); + result.append(eol).append(eol); + for (JavaMethod method : list) { + result.append(addIndentation(method.toString(), 4, eol)); + result.append(eol).append(eol); + } + } + list.clear(); + } + map.clear(); + result.append("}"); return result.toString(); } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JavaMethod.java b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaMethod.java similarity index 59% rename from jaxx-compiler/src/main/java/jaxx/compiler/JavaMethod.java rename to jaxx-compiler/src/main/java/jaxx/compiler/io/JavaMethod.java index 0d8098e..a453547 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JavaMethod.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaMethod.java @@ -2,12 +2,11 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.compiler; +package jaxx.compiler.io; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Arrays; -import java.util.Comparator; import java.util.EnumMap; import java.util.EnumSet; import java.util.Iterator; @@ -19,61 +18,16 @@ import java.util.List; * <code>JavaMethod</code> can represent a constructor -- constructors should be named after their containing * classes and have a return type of <code>null</code>. */ -public class JavaMethod implements Comparable<JavaMethod> { +public class JavaMethod extends JavaElement implements Comparable<JavaMethod> { - private int modifiers; private String returnType; - private String name; private JavaArgument[] arguments; private String[] exceptions; - private StringBuffer bodyCode; + private String body; + private boolean override; +// private StringBuffer bodyCode; /** - * Constructs a new no-argument <code>JavaMethod</code> which throws no checked exceptions. The - * <code>modifiers</code> parameter is a bit mask of the constants from {@link java.lang.reflect.Modifier}, - * and the <code>returnType</code> of the method should be represented as it would appear in Java source - * code (<code>null</code> for a constructor). The method body is initially empty. - * - * @param modifiers the modifier keywords that should appear as part of the method's declaration - * @param returnType the return type of the method as it would appear in Java source code - * @param name the method's name - * @see #appendBodyCode - */ - //public JavaMethod(int modifiers, String returnType, String name) { - // this(modifiers, returnType, name, null); - //} - /** - * Constructs a new <code>JavaMethod</code> which throws no checked exceptions. The <code>modifiers</code> - * parameter is a bit mask of the constants from {@link java.lang.reflect.Modifier}, and the - * <code>returnType</code> of the method should be represented as it would appear in Java source code - * (<code>null</code> for a constructor). The method body is initially empty. - * - * @param modifiers the modifier keywords that should appear as part of the method's declaration - * @param returnType the return type of the method as it would appear in Java source code - * @param name the method's name - * @param arguments the method's arguments - * @see #appendBodyCode - */ - //public JavaMethod(int modifiers, String returnType, String name, JavaArgument[] arguments) { - // this(modifiers, returnType, name, arguments, null); - //} - /** - * Constructs a new <code>JavaMethod</code>. The <code>modifiers</code> parameter is a bit mask of the - * constants from {@link java.lang.reflect.Modifier}, and the <code>returnType</code> and <code>exceptions</code> - * of the method should be represented as they would appear in Java source code (<code>null</code> for a - * constructor). The method body is initially empty. - * - * @param modifiers the modifier keywords that should appear as part of the method's declaration - * @param returnType the return type of the method as it would appear in Java source code - * @param name the method's name - * @param arguments the method's arguments - * @param exceptions a list of exceptions the methods can throw, as they would be represented in Java source code - * @see #appendBodyCode - */ - //public JavaMethod(int modifiers, String returnType, String name, JavaArgument[] arguments, String[] exceptions) { - // this(modifiers, returnType, name, arguments, exceptions, null); - //} - /** * Constructs a new <code>JavaMethod</code> containing the specified body code. The <code>modifiers</code> parameter * is a bit mask of the constants from {@link java.lang.reflect.Modifier}, and the <code>returnType</code> and * <code>exceptions</code> of the method should be represented as they would appear in Java source code (<code>null</code> @@ -85,25 +39,16 @@ public class JavaMethod implements Comparable<JavaMethod> { * @param arguments the method's arguments * @param exceptions a list of exceptions the methods can throw, as they would be represented in Java source code * @param bodyCode Java source code which should appear in the method body + * @param override flag with {@code true} value when the method overrides (or implements) a super class method */ - public JavaMethod(int modifiers, String returnType, String name, JavaArgument[] arguments, String[] exceptions, String bodyCode) { - this.modifiers = modifiers; + public JavaMethod(int modifiers, String returnType, String name, JavaArgument[] arguments, String[] exceptions, String bodyCode, boolean override) { + super(modifiers, name); this.returnType = returnType; - this.name = name; + this.override = override; this.arguments = arguments; this.exceptions = exceptions; - this.bodyCode = new StringBuffer(bodyCode != null ? bodyCode : ""); - } - - /** - * Returns a bit mask describing the modifier keywords which should appear as part of this method's - * declaration. See <code>java.lang.reflect.Modifier</code> for more information on decoding this - * field. - * - * @return the modifier bit mask - */ - public int getModifiers() { - return modifiers; + this.body = bodyCode == null ? "" : bodyCode; +// this.bodyCode = new StringBuffer(bodyCode != null ? bodyCode : ""); } /** @@ -116,15 +61,6 @@ public class JavaMethod implements Comparable<JavaMethod> { } /** - * Returns the method's name. - * - * @return the method's name - */ - public String getName() { - return name; - } - - /** * Returns a list of the method's arguments. * * @return the method's arguments @@ -142,45 +78,27 @@ public class JavaMethod implements Comparable<JavaMethod> { return exceptions; } - /** - * Returns the Java source code for the method's body. - * - * @return the method's body code - */ - public String getBodyCode() { - return bodyCode.toString(); + public boolean isOverride() { + return override; } - /** - * Appends additional code to the method's body. - * - * @param extraCode Java source code to append to the method's body - * @param lineSeparator line separator - */ - public void appendBodyCode(String extraCode, String lineSeparator) { - if (extraCode.length() == 0) { - return; - } - if (bodyCode.length() > 0 && !bodyCode.toString().endsWith(lineSeparator)) { - bodyCode.append(lineSeparator); - } - bodyCode.append(extraCode); + public void setOverride(boolean override) { + this.override = override; } - /** - * Returns the Java source code for this method. - * - * @param lineSeparator line separator - * @return the Java source code for this method - */ - public String toString(String lineSeparator) { + @Override + public String toString() { + String eol = getLineSeparator(); StringBuffer result = new StringBuffer(); - result.append(JavaFile.getModifiersText(modifiers)); + if (isOverride()) { + result.append("@Override").append(eol); + } + result.append(getModifiersText()); if (returnType != null) { result.append(returnType); result.append(' '); } - result.append(name); + result.append(getName()); result.append('('); if (arguments != null) { for (int i = 0; i < arguments.length; i++) { @@ -191,12 +109,12 @@ public class JavaMethod implements Comparable<JavaMethod> { } } result.append(") {"); - result.append(lineSeparator); - if (bodyCode != null) { - String formattedBodyCode = JavaFile.addIndentation(bodyCode.toString().trim(), 4, lineSeparator); + result.append(eol); + if (body != null) { + String formattedBodyCode = addIndentation(body.trim(), 4, eol); if (formattedBodyCode.length() > 0) { result.append(formattedBodyCode); - result.append(lineSeparator); + result.append(eol); } } result.append("}"); @@ -205,15 +123,15 @@ public class JavaMethod implements Comparable<JavaMethod> { @Override public int compareTo(JavaMethod o) { - return COMPARATOR.compare(this, o); + return JavaMethodComparator.COMPARATOR.compare(this, o); } - public static JavaMethod newMethod(int modifiers, String returnType, String name, String initializer, String[] exceptions, JavaArgument... arguments) { - return new JavaMethod(modifiers, returnType, name, arguments, exceptions, initializer); + public static JavaMethod newMethod(int modifiers, String returnType, String name, String initializer, boolean override, String[] exceptions, JavaArgument... arguments) { + return new JavaMethod(modifiers, returnType, name, arguments, exceptions, initializer, override); } - public static JavaMethod newMethod(int modifiers, String returnType, String name, String initializer, JavaArgument... arguments) { - return newMethod(modifiers, returnType, name, initializer, new String[0], arguments); + public static JavaMethod newMethod(int modifiers, String returnType, String name, String initializer, boolean override, JavaArgument... arguments) { + return newMethod(modifiers, returnType, name, initializer, override, new String[0], arguments); } public enum MethodOrder { @@ -239,7 +157,7 @@ public class JavaMethod implements Comparable<JavaMethod> { @Override public boolean accept(JavaMethod method) { - return methods.contains(method.name); + return methods.contains(method.getName()); } }, JAXXContext(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + @@ -250,7 +168,7 @@ public class JavaMethod implements Comparable<JavaMethod> { @Override public boolean accept(JavaMethod method) { - return methods.contains(method.name); + return methods.contains(method.getName()); } }, JAXXValidation(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + @@ -261,7 +179,7 @@ public class JavaMethod implements Comparable<JavaMethod> { @Override public boolean accept(JavaMethod method) { - return methods.contains(method.name); + return methods.contains(method.getName()); } }, events(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + @@ -270,7 +188,7 @@ public class JavaMethod implements Comparable<JavaMethod> { @Override public boolean accept(JavaMethod method) { - return (method.name.startsWith("do") && method.name.indexOf("__") > -1); + return (method.getName().startsWith("do") && method.getName().indexOf("__") > -1); } }, publicGetters(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + @@ -279,7 +197,7 @@ public class JavaMethod implements Comparable<JavaMethod> { @Override public boolean accept(JavaMethod method) { - return (method.name.startsWith("get") || method.name.startsWith("is")); + return (method.getName().startsWith("get") || method.getName().startsWith("is")); } }, publicSetters(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + @@ -288,7 +206,7 @@ public class JavaMethod implements Comparable<JavaMethod> { @Override public boolean accept(JavaMethod method) { - return (method.name.startsWith("set")); + return (method.getName().startsWith("set")); } }, otherPublic(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + @@ -306,7 +224,7 @@ public class JavaMethod implements Comparable<JavaMethod> { @Override public boolean accept(JavaMethod method) { - return (method.name.startsWith("get") || method.name.startsWith("is")); + return (method.getName().startsWith("get") || method.getName().startsWith("is")); } }, createMethod(Modifier.PROTECTED | Modifier.PRIVATE, "/*---------------------------------------------------------------------------------*/\n" + @@ -315,9 +233,9 @@ public class JavaMethod implements Comparable<JavaMethod> { @Override public boolean accept(JavaMethod method) { - return method.name.startsWith("create") || method.name.startsWith("add") || - method.name.equals("$completeSetup") || - method.name.equals("$initialize"); + return method.getName().startsWith("create") || method.getName().startsWith("add") || + method.getName().equals("$completeSetup") || + method.getName().equals("$initialize"); } }, protecteds(Modifier.PROTECTED, "/*---------------------------------------------------------------------------------*/\n" + @@ -369,18 +287,6 @@ public class JavaMethod implements Comparable<JavaMethod> { } throw new IllegalArgumentException("could not find a " + MethodOrder.class + " for method " + method); } - - public void generate(StringBuffer buffer, List<JavaMethod> methods, String lineSeparator) { - if (methods.isEmpty()) { - return; - } - buffer.append(JavaFile.addIndentation(header, 4, lineSeparator)); - buffer.append(lineSeparator).append(lineSeparator); - for (JavaMethod method : methods) { - buffer.append(JavaFile.addIndentation(method.toString(lineSeparator), 4, lineSeparator)); - buffer.append(lineSeparator).append(lineSeparator); - } - } } public static EnumMap<MethodOrder, List<JavaMethod>> getSortedMethods(List<JavaMethod> methods) { @@ -430,64 +336,4 @@ public class JavaMethod implements Comparable<JavaMethod> { } return constants; } - public static final Comparator<JavaMethod> COMPARATOR = new Comparator<JavaMethod>() { - - @Override - public int compare(JavaMethod o1, JavaMethod o2) { - - /*int result; - if ((result = compareStatic(o1, o2)) != 0) { - return result; - } - if ((result = compareConstructor(o1, o2)) != 0) { - return result; - } - if ((result = compareVisibility(o1, o2)) != 0) { - return result; - }*/ - return o1.name.compareTo(o2.name); - } - - public int compareStatic(JavaMethod o1, JavaMethod o2) { - if (Modifier.isStatic(o1.modifiers) && !Modifier.isStatic(o2.modifiers)) { - return -1; - } - if (!Modifier.isStatic(o1.modifiers) && Modifier.isStatic(o2.modifiers)) { - return 1; - } - return 0; - } - - public int compareConstructor(JavaMethod o1, JavaMethod o2) { - if (o1.returnType == null && o2.returnType != null) { - return -1; - } - if (o1.returnType != null && o2.returnType == null) { - return 1; - } - return 0; - } - - public int compareVisibility(JavaMethod o1, JavaMethod o2) { - if (Modifier.isPublic(o1.modifiers) && !Modifier.isPublic(o2.modifiers)) { - return -1; - } - if (!Modifier.isPublic(o1.modifiers) && Modifier.isPublic(o2.modifiers)) { - return 1; - } - if (Modifier.isProtected(o1.modifiers) && !Modifier.isProtected(o2.modifiers)) { - return -1; - } - if (!Modifier.isProtected(o1.modifiers) && Modifier.isProtected(o2.modifiers)) { - return 1; - } - if (Modifier.isPrivate(o1.modifiers) && !Modifier.isPrivate(o2.modifiers)) { - return -1; - } - if (!Modifier.isPrivate(o1.modifiers) && Modifier.isPrivate(o2.modifiers)) { - return 1; - } - return 0; - } - }; } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaMethodComparator.java b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaMethodComparator.java new file mode 100644 index 0000000..a320aca --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaMethodComparator.java @@ -0,0 +1,72 @@ +package jaxx.compiler.io; + +import java.lang.reflect.Modifier; +import java.util.Comparator; + +/** + * + * @author chemit + * @since 2.0.0 + */ +public class JavaMethodComparator implements Comparator<JavaMethod> { + + static final JavaMethodComparator COMPARATOR = new JavaMethodComparator(); + + @Override + public int compare(JavaMethod o1, JavaMethod o2) { + + /*int result; + if ((result = compareStatic(o1, o2)) != 0) { + return result; + } + if ((result = compareConstructor(o1, o2)) != 0) { + return result; + } + if ((result = compareVisibility(o1, o2)) != 0) { + return result; + }*/ + return o1.getName().compareTo(o2.getName()); + } + + public int compareStatic(JavaMethod o1, JavaMethod o2) { + if (Modifier.isStatic(o1.getModifiers()) && !Modifier.isStatic(o2.getModifiers())) { + return -1; + } + if (!Modifier.isStatic(o1.getModifiers()) && Modifier.isStatic(o2.getModifiers())) { + return 1; + } + return 0; + } + + public int compareConstructor(JavaMethod o1, JavaMethod o2) { + if (o1.getReturnType() == null && o2.getReturnType() != null) { + return -1; + } + if (o1.getReturnType() != null && o2.getReturnType() == null) { + return 1; + } + return 0; + } + + public int compareVisibility(JavaMethod o1, JavaMethod o2) { + if (Modifier.isPublic(o1.getModifiers()) && !Modifier.isPublic(o2.getModifiers())) { + return -1; + } + if (!Modifier.isPublic(o1.getModifiers()) && Modifier.isPublic(o2.getModifiers())) { + return 1; + } + if (Modifier.isProtected(o1.getModifiers()) && !Modifier.isProtected(o2.getModifiers())) { + return -1; + } + if (!Modifier.isProtected(o1.getModifiers()) && Modifier.isProtected(o2.getModifiers())) { + return 1; + } + if (Modifier.isPrivate(o1.getModifiers()) && !Modifier.isPrivate(o2.getModifiers())) { + return -1; + } + if (!Modifier.isPrivate(o1.getModifiers()) && Modifier.isPrivate(o2.getModifiers())) { + return 1; + } + return 0; + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorLoader.java b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorLoader.java index 2abf7f6..f46d3b3 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorLoader.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorLoader.java @@ -2,7 +2,7 @@ package jaxx.compiler.reflect; import jaxx.compiler.CompilerException; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.JAXXCompilerLaunchor; +import jaxx.compiler.JAXXEngine; import jaxx.compiler.SymbolTable; import jaxx.runtime.JAXXObject; import jaxx.runtime.JAXXObjectDescriptor; @@ -50,7 +50,7 @@ public class ClassDescriptorLoader { } // if (result == null) { - if (JAXXCompilerLaunchor.isRegistred() && JAXXCompilerLaunchor.get().getSymbolTable(className) != null) { + if (JAXXEngine.isRegistred() && JAXXEngine.get().getSymbolTable(className) != null) { result = createClassDescriptorFromSymbolTable(className, classLoader); } else { if (classLoader == null) { @@ -90,7 +90,7 @@ public class ClassDescriptorLoader { } } - if (jaxxLastModified != -1 && JAXXCompilerLaunchor.isRegistred() && JAXXCompilerLaunchor.get().getSymbolTable(className) == null) { + if (jaxxLastModified != -1 && JAXXEngine.isRegistred() && JAXXEngine.get().getSymbolTable(className) == null) { jaxxLastModified = -1; // file has been modified, but wasn't included in this } // compilation set so we don't have a symbol table @@ -303,8 +303,8 @@ public class ClassDescriptorLoader { } private static ClassDescriptor createClassDescriptorFromSymbolTable(String className, ClassLoader classLoader) throws ClassNotFoundException { - final JAXXCompiler compiler = JAXXCompilerLaunchor.get().getJAXXCompiler(className); - final SymbolTable symbolTable = JAXXCompilerLaunchor.get().getSymbolTable(className); + final JAXXCompiler compiler = JAXXEngine.get().getJAXXCompiler(className); + final SymbolTable symbolTable = JAXXEngine.get().getSymbolTable(className); if (symbolTable == null) { throw new CompilerException("Internal error: no symbol table was generated for class '" + className + "'"); } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java index a91b3e4..73a57b8 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java @@ -2,7 +2,7 @@ package jaxx.compiler.reflect; import jaxx.compiler.CompilerException; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.JAXXCompilerLaunchor; +import jaxx.compiler.JAXXEngine; import jaxx.compiler.parser.java.JavaParser; import jaxx.compiler.parser.java.JavaParserTreeConstants; import jaxx.compiler.parser.java.ParseException; @@ -31,7 +31,7 @@ public class JavaFileParser { private List<FieldDescriptor> fields = new ArrayList<FieldDescriptor>(); private JavaFileParser(ClassLoader classLoader) { - compiler = JAXXCompilerLaunchor.createDummyCompiler(classLoader); + compiler = JAXXEngine.createDummyCompiler(classLoader); } public static ClassDescriptor parseJavaFile(String displayName, Reader src, ClassLoader classLoader) throws ClassNotFoundException { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java b/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java index f9b0231..6518319 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java @@ -4,10 +4,7 @@ */ package jaxx.compiler.spi; -import java.awt.Color; import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.Insets; import javax.swing.JCheckBox; import javax.swing.JCheckBoxMenuItem; import javax.swing.JComboBox; @@ -35,18 +32,11 @@ import javax.swing.JToggleButton; import javax.swing.JToolBar; import javax.swing.JTree; import javax.swing.JWindow; -import javax.swing.KeyStroke; import javax.swing.text.JTextComponent; import jaxx.compiler.JAXXCompiler; import jaxx.compiler.beans.BeanInfoUtil; -import jaxx.compiler.decorators.BoxedCompiledObjectDecorator; -import jaxx.compiler.decorators.CompiledObjectDecorator; -import jaxx.compiler.decorators.CompiledObjectDecoratorManager; -import jaxx.compiler.decorators.DefaultCompiledObjectDecorator; -import jaxx.compiler.decorators.HelpRootCompiledObjectDecorator; - import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.compiler.tags.DefaultComponentHandler; @@ -87,14 +77,7 @@ import jaxx.compiler.tags.validator.BeanValidatorHandler; import jaxx.compiler.tags.validator.ExcludeFieldValidatorHandler; import jaxx.compiler.tags.validator.FieldValidatorHandler; -import jaxx.compiler.types.ColorConverter; -import jaxx.compiler.types.GridBagConstraintsConverter; -import jaxx.compiler.types.InsetsConverter; -import jaxx.compiler.types.KeyStrokeConverter; -import jaxx.compiler.types.PrimitiveConverter; -import jaxx.compiler.types.TypeConverter; -import jaxx.compiler.types.TypeManager; import jaxx.runtime.swing.Application; import jaxx.runtime.swing.JAXXButtonGroup; import jaxx.runtime.swing.JAXXComboBox; @@ -125,15 +108,6 @@ public class DefaultInitializer implements Initializer { JTextField.class, JTextPane.class); - - // - // Register decorators - // - - registerDecorator("default", DefaultCompiledObjectDecorator.class); - registerDecorator("boxed", BoxedCompiledObjectDecorator.class); - registerDecorator("help", HelpRootCompiledObjectDecorator.class); - // // Register tags // @@ -209,39 +183,8 @@ public class DefaultInitializer implements Initializer { registerBean(Table.class, TableHandler.class); registerBean(JAXXTab.class, JAXXTabHandler.class); - registerBean(SwingValidator.class, BeanValidatorHandler.class); - - - // - // Register converters - // - - PrimitiveConverter primitiveConverter = new PrimitiveConverter(); - registerTypeConverter(boolean.class, primitiveConverter); - registerTypeConverter(Boolean.class, primitiveConverter); - registerTypeConverter(byte.class, primitiveConverter); - registerTypeConverter(Byte.class, primitiveConverter); - registerTypeConverter(short.class, primitiveConverter); - registerTypeConverter(Short.class, primitiveConverter); - registerTypeConverter(int.class, primitiveConverter); - registerTypeConverter(Integer.class, primitiveConverter); - registerTypeConverter(long.class, primitiveConverter); - registerTypeConverter(Long.class, primitiveConverter); - registerTypeConverter(float.class, primitiveConverter); - registerTypeConverter(Float.class, primitiveConverter); - registerTypeConverter(double.class, primitiveConverter); - registerTypeConverter(Double.class, primitiveConverter); - registerTypeConverter(char.class, primitiveConverter); - registerTypeConverter(Character.class, primitiveConverter); - registerTypeConverter(String.class, primitiveConverter); - - registerTypeConverter(Color.class, new ColorConverter()); - registerTypeConverter(GridBagConstraints.class, new GridBagConstraintsConverter()); - registerTypeConverter(Insets.class, new InsetsConverter()); - registerTypeConverter(KeyStroke.class, new KeyStrokeConverter()); - } protected void registerBean(Class<?> beanClass, Class<? extends TagHandler> handlerClass) { @@ -252,16 +195,6 @@ public class DefaultInitializer implements Initializer { TagManager.registerTag(namespace, tagName, handler); } - protected void registerDecorator(String name, Class<? extends CompiledObjectDecorator> decoratorClass) { - - CompiledObjectDecoratorManager.registerDecorator(name, decoratorClass); - } - - protected void registerTypeConverter(Class<?> converterType, TypeConverter converter) { - - TypeManager.registerTypeConverter(converterType, converter); - } - protected void registerDefaultNamespace(String namespace, Class<?>... beanClass) { for (Class<?> c : beanClass) { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java index 250e062..df12ba3 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java @@ -8,15 +8,14 @@ import jaxx.compiler.CompilerException; import jaxx.compiler.UnsupportedAttributeException; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.JavaArgument; -import jaxx.compiler.JavaMethod; +import jaxx.compiler.io.JavaArgument; +import jaxx.compiler.io.JavaMethod; import jaxx.compiler.StylesheetHelper; import jaxx.compiler.beans.JAXXBeanInfo; import jaxx.compiler.beans.JAXXEventSetDescriptor; import jaxx.compiler.beans.JAXXIntrospector; import jaxx.compiler.beans.JAXXPropertyDescriptor; import jaxx.compiler.decorators.CompiledObjectDecorator; -import jaxx.compiler.decorators.CompiledObjectDecoratorManager; import jaxx.compiler.reflect.ClassDescriptor; import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.compiler.reflect.FieldDescriptor; @@ -140,8 +139,6 @@ public class DefaultObjectHandler implements TagHandler { } /** - * Returns - * * @return the class which this <code>DefaultObjectHandler</code> supports. */ public ClassDescriptor getBeanClass() { @@ -286,11 +283,11 @@ public class DefaultObjectHandler implements TagHandler { if (!methodExists) { compiler.addMethodToJavaFile(new JavaMethod(Modifier.PUBLIC, "void", methodName, new JavaArgument[]{new JavaArgument(JAXXCompiler.getCanonicalName(eventClass), "event")}, null, - propertyChangeListenerCode + ".propertyChange(null);")); + propertyChangeListenerCode + ".propertyChange(null);", false)); } String code = objectCode + (eventInfo.modelName != null ? ".get" + org.apache.commons.lang.StringUtils.capitalize(eventInfo.modelName) + "()" : ""); result.append("$bindingSources.put(\"").append(code).append("\", ").append(code).append(");").append(JAXXCompiler.getLineSeparator()); - result.append(code).append('.').append(eventInfo.addMethod).append("((").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(") jaxx.runtime.Util.getEventListener(").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));\n"); + result.append(code).append('.').append(eventInfo.addMethod).append("((").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(") jaxx.runtime.Util.getEventListener(").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(compiler.getJavaCode(methodName)).append("));\n"); if (eventInfo.modelName != null) { result.append(getAddMemberListenerCode(objectCode, dataBinding, "get" + org.apache.commons.lang.StringUtils.capitalize(eventInfo.modelName), "jaxx.runtime.Util.getDataBindingUpdateListener(this , \"" + dataBinding + "\")", @@ -340,13 +337,13 @@ public class DefaultObjectHandler implements TagHandler { ClassDescriptor eventClass = getEventClass(eventInfo.listenerClass); compiler.addMethodToJavaFile(new JavaMethod(Modifier.PUBLIC, "void", methodName, new JavaArgument[]{new JavaArgument(JAXXCompiler.getCanonicalName(eventClass), "event")}, null, - propertyChangeListenerCode + ".propertyChange(null);")); + propertyChangeListenerCode + ".propertyChange(null);", false)); } try { String modelMemberName = eventInfo.modelName != null ? "get" + org.apache.commons.lang.StringUtils.capitalize(eventInfo.modelName) : null; String modelClassName = modelMemberName != null ? getBeanClass().getMethodDescriptor(modelMemberName).getReturnType().getName() : JAXXCompiler.getCanonicalName(getBeanClass()); String code = objectCode + (eventInfo.modelName != null ? "." + modelMemberName + "()" : ""); - result.append("((").append(modelClassName).append(") $bindingSources.remove(\"").append(code).append("\")).").append(eventInfo.removeMethod).append("((").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(") jaxx.runtime.Util.getEventListener(").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(TypeManager.getJavaCode(methodName)).append("));\n"); + result.append("((").append(modelClassName).append(") $bindingSources.remove(\"").append(code).append("\")).").append(eventInfo.removeMethod).append("((").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(") jaxx.runtime.Util.getEventListener(").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(compiler.getJavaCode(methodName)).append("));\n"); if (eventInfo.modelName != null) { result.append(getRemoveMemberListenerCode(objectCode, dataBinding, "get" + org.apache.commons.lang.StringUtils.capitalize(eventInfo.modelName), "jaxx.runtime.Util.getDataBindingUpdateListener(this, \"" + dataBinding + "\")", @@ -690,7 +687,7 @@ public class DefaultObjectHandler implements TagHandler { if (name.equals("decorator")) { if (!value.isEmpty()) { - CompiledObjectDecorator decorator = CompiledObjectDecoratorManager.getDecorator(value); + CompiledObjectDecorator decorator = compiler.getEngine().getDecorator(value); object.setDecorator(decorator); } continue; @@ -751,7 +748,7 @@ public class DefaultObjectHandler implements TagHandler { try { Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null; Object value = convertFromString(propertyName, stringValue, typeClass); - return getSetPropertyCode(object.getJavaCode(), propertyName, TypeManager.getJavaCode(value), compiler); + return getSetPropertyCode(object.getJavaCode(), propertyName, compiler.getJavaCode(value), compiler); } catch (NumberFormatException e) { compiler.reportError("could not convert literal string '" + stringValue + "' to type " + type.getName()); } catch (IllegalArgumentException e) { @@ -778,7 +775,7 @@ public class DefaultObjectHandler implements TagHandler { // check for data binding & remove if found JAXXObjectDescriptor jaxxObjectDescriptor = object.getObjectClass().getJAXXObjectDescriptor(); ComponentDescriptor root = jaxxObjectDescriptor.getComponentDescriptors()[0]; - object.appendInitializationCode(object.getJavaCode() + ".removeDataBinding(" + TypeManager.getJavaCode(root.getId() + "." + propertyName) + ");" + JAXXCompiler.getLineSeparator()); + object.appendInitializationCode(object.getJavaCode() + ".removeDataBinding(" + compiler.getJavaCode(root.getId() + "." + propertyName) + ");" + JAXXCompiler.getLineSeparator()); } object.addProperty(propertyName, stringValue); ClassDescriptor type = getPropertyType(object, propertyName, compiler); @@ -845,7 +842,7 @@ public class DefaultObjectHandler implements TagHandler { String id = isRoot ? object.getId() + ' ' + descriptor.getId() : "( " + object.getId() + " ) " + descriptor.getId(); CompiledObject child = new CompiledObject(id, "((" + JAXXCompiler.getCanonicalName(classDescriptor) + ") " + - object.getJavaCode() + ".getObjectById(" + TypeManager.getJavaCode(descriptor.getId()) + "))", + object.getJavaCode() + ".getObjectById(" + compiler.getJavaCode(descriptor.getId()) + "))", classDescriptor, compiler, true); @@ -983,7 +980,7 @@ public class DefaultObjectHandler implements TagHandler { * @throws CompilerException if a compilation error occurs */ public void setProperty(CompiledObject object, String name, Object value, JAXXCompiler compiler) { - object.appendInitializationCode(getSetPropertyCode(object.getJavaCodeForProperty(name), name, TypeManager.getJavaCode(value), compiler)); + object.appendInitializationCode(getSetPropertyCode(object.getJavaCodeForProperty(name), name, compiler.getJavaCode(value), compiler)); } /** diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java index 85bdfa7..5d3f008 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java @@ -5,7 +5,6 @@ package jaxx.compiler.tags; import jaxx.compiler.*; -import jaxx.compiler.decorators.CompiledObjectDecoratorManager; import jaxx.compiler.reflect.ClassDescriptor; import jaxx.compiler.reflect.ClassDescriptorLoader; import org.apache.commons.logging.Log; @@ -85,8 +84,7 @@ public class TagManager { registeredBeans.clear(); registeredTags.clear(); defaultNamespaces.clear(); - CompiledObjectDecoratorManager.reset(); - JAXXCompilerLaunchor.loadLibraries(verbose); + JAXXEngine.loadLibraries(verbose); } /** @@ -233,22 +231,24 @@ public class TagManager { } boolean found = false; + ClassLoader classLoader = compiler.getClassLoader(); try { - Class.forName(className, true, compiler.getClassLoader()); + Class.forName(className, true,classLoader); found = true; } catch (ClassNotFoundException e) { // ignore ? - } catch (NoClassDefFoundError e) { // we get this instead of ClassNotFoundException on case-insensitive file systems when + } catch (NoClassDefFoundError e) { + // we obtain this instead of ClassNotFoundException on case-insensitive file systems when // looking up a class with the wrong case } if (!found) { // couldn't find .class, check for .java - URL javaURL = compiler.getClassLoader().getResource(className.replace('.', '/') + ".java"); + URL javaURL = classLoader.getResource(className.replace('.', '/') + ".java"); found = javaURL != null; } if (!found) { // couldn't find .java, check for .jaxx - URL jaxxURL = compiler.getClassLoader().getResource(className.replace('.', '/') + ".jaxx"); + URL jaxxURL = classLoader.getResource(className.replace('.', '/') + ".jaxx"); found = jaxxURL != null; } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ApplicationHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ApplicationHandler.java index ba7a215..c95ea13 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ApplicationHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ApplicationHandler.java @@ -25,7 +25,7 @@ public class ApplicationHandler extends JWindowHandler { @Override public void setAttribute(CompiledObject object, String propertyName, String stringValue, boolean inline, JAXXCompiler compiler) throws CompilerException { if (propertyName.equals("lookAndFeel") && stringValue != null && !stringValue.trim().startsWith("{")) { - compiler.appendBodyCode("{ " + object.getJavaCode() + ".setLookAndFeel(" + TypeManager.getJavaCode(stringValue) + "); }" + JAXXCompiler.getLineSeparator()); + compiler.appendBodyCode("{ " + object.getJavaCode() + ".setLookAndFeel(" + compiler.getJavaCode(stringValue) + "); }" + JAXXCompiler.getLineSeparator()); } else { super.setAttribute(object, propertyName, stringValue, inline, compiler); } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXComboBoxHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXComboBoxHandler.java index 29766a8..30e26ed 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXComboBoxHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXComboBoxHandler.java @@ -10,7 +10,6 @@ import jaxx.compiler.JAXXCompiler; import jaxx.compiler.reflect.ClassDescriptor; import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.compiler.tags.DefaultComponentHandler; -import jaxx.compiler.types.TypeManager; import jaxx.runtime.swing.JAXXComboBox; import jaxx.runtime.swing.Item; import org.w3c.dom.Element; @@ -49,7 +48,7 @@ public class JAXXComboBoxHandler extends DefaultComponentHandler { for (Item item : items) { String id = item.getId(); CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(Item.class), compiler); - compiledItem.setConstructorParams(TypeManager.getJavaCode(id) + ", " + TypeManager.getJavaCode(item.getLabel()) + ", " + TypeManager.getJavaCode(item.getValue()) + ", " + item.isSelected()); + compiledItem.setConstructorParams(compiler.getJavaCode(id) + ", " + compiler.getJavaCode(item.getLabel()) + ", " + compiler.getJavaCode(item.getValue()) + ", " + item.isSelected()); compiler.registerCompiledObject(compiledItem); list.appendAdditionCode(listName + ".add(" + id + ");"); } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXListHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXListHandler.java index afe7e47..2bc7559 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXListHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXListHandler.java @@ -10,7 +10,6 @@ import jaxx.compiler.JAXXCompiler; import jaxx.compiler.reflect.ClassDescriptor; import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.compiler.tags.DefaultComponentHandler; -import jaxx.compiler.types.TypeManager; import jaxx.runtime.swing.JAXXList; import jaxx.runtime.swing.Item; import org.w3c.dom.Element; @@ -52,7 +51,7 @@ public class JAXXListHandler extends DefaultComponentHandler { for (Item item : items) { String id = item.getId(); CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(Item.class), compiler); - compiledItem.setConstructorParams(TypeManager.getJavaCode(id) + ", " + TypeManager.getJavaCode(item.getLabel()) + ", " + TypeManager.getJavaCode(item.getValue()) + ", " + item.isSelected()); + compiledItem.setConstructorParams(compiler.getJavaCode(id) + ", " + compiler.getJavaCode(item.getLabel()) + ", " + compiler.getJavaCode(item.getValue()) + ", " + item.isSelected()); compiler.registerCompiledObject(compiledItem); list.appendAdditionCode(listName + ".add(" + id + ");"); } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTreeHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTreeHandler.java index 2059a0f..d1366e3 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTreeHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTreeHandler.java @@ -10,7 +10,6 @@ import jaxx.compiler.JAXXCompiler; import jaxx.compiler.reflect.ClassDescriptor; import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.compiler.tags.DefaultComponentHandler; -import jaxx.compiler.types.TypeManager; import jaxx.runtime.swing.Item; import jaxx.runtime.swing.JAXXTree; import org.w3c.dom.Element; @@ -45,7 +44,7 @@ public class JAXXTreeHandler extends DefaultComponentHandler { for (Item item : items) { String id = item.getId(); CompiledObject compiledItem = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(Item.class), compiler); - compiledItem.setConstructorParams(TypeManager.getJavaCode(id) + ", " + TypeManager.getJavaCode(item.getLabel()) + ", " + TypeManager.getJavaCode(item.getValue()) + ", " + item.isSelected()); + compiledItem.setConstructorParams(compiler.getJavaCode(id) + ", " + compiler.getJavaCode(item.getLabel()) + ", " + compiler.getJavaCode(item.getValue()) + ", " + item.isSelected()); compiler.registerCompiledObject(compiledItem); tree.appendAdditionCode(addMethod + "(" + id + ");"); createItems(tree, item.getChildren(), id + ".addChild", compiler); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JRadioButtonHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JRadioButtonHandler.java index 1f4f65b..04c69b9 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JRadioButtonHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JRadioButtonHandler.java @@ -11,7 +11,6 @@ import jaxx.compiler.JAXXCompiler; import jaxx.compiler.reflect.ClassDescriptor; import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.compiler.tags.DefaultComponentHandler; -import jaxx.compiler.types.TypeManager; import jaxx.runtime.swing.JAXXButtonGroup; import javax.swing.AbstractButton; @@ -53,7 +52,7 @@ public class JRadioButtonHandler extends DefaultComponentHandler { @Override public void setProperty(CompiledObject object, String name, Object value, JAXXCompiler compiler) { if (name.equals(BUTTON_GROUP_PROPERTY)) { - object.appendAdditionCode(getSetPropertyCode(object.getJavaCode(), name, TypeManager.getJavaCode(value), compiler)); + object.appendAdditionCode(getSetPropertyCode(object.getJavaCode(), name, compiler.getJavaCode(value), compiler)); } else { super.setProperty(object, name, value, compiler); } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTabbedPaneHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTabbedPaneHandler.java index 7fb3c96..0caa927 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTabbedPaneHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTabbedPaneHandler.java @@ -11,7 +11,6 @@ import jaxx.compiler.JAXXCompiler; import jaxx.compiler.reflect.ClassDescriptor; import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.compiler.tags.DefaultComponentHandler; -import jaxx.compiler.types.TypeManager; import jaxx.runtime.swing.TabInfo; import javax.swing.Icon; @@ -61,10 +60,10 @@ public class JTabbedPaneHandler extends DefaultComponentHandler { if (I18nHelper.isI18nAttribute("title")) { if (!title.startsWith("_(\"")) { // we did not have the invocation code, add it - title = I18nHelper.addI18nInvocation(getId(), "title", TypeManager.getJavaCode(title), compiler); + title = I18nHelper.addI18nInvocation(getId(), "title", compiler.getJavaCode(title), compiler); } } else { - title = TypeManager.getJavaCode(title); + title = compiler.getJavaCode(title); } appendAdditionCode(getId() + ".setTitleAt(" + tabIndex + ", " + title + ");"); } @@ -74,10 +73,10 @@ public class JTabbedPaneHandler extends DefaultComponentHandler { if (I18nHelper.isI18nAttribute("toolTipText")) { if (!toolTipText.startsWith("_(\"")) { // we did not have the invocation code, add it - toolTipText = I18nHelper.addI18nInvocation(getId(), "toolTipText", TypeManager.getJavaCode(toolTipText), compiler); + toolTipText = I18nHelper.addI18nInvocation(getId(), "toolTipText", compiler.getJavaCode(toolTipText), compiler); } } else { - toolTipText = TypeManager.getJavaCode(toolTipText); + toolTipText = compiler.getJavaCode(toolTipText); } appendAdditionCode(getId() + ".setToolTipTextAt(" + tabIndex + ", " + toolTipText + ");"); } @@ -89,12 +88,12 @@ public class JTabbedPaneHandler extends DefaultComponentHandler { Color foreground = tabInfo.getForeground(); if (foreground != null) { - appendAdditionCode(getId() + ".setForegroundAt(" + tabIndex + ", " + TypeManager.getJavaCode(foreground) + ");"); + appendAdditionCode(getId() + ".setForegroundAt(" + tabIndex + ", " + compiler.getJavaCode(foreground) + ");"); } Color background = tabInfo.getBackground(); if (background != null) { - appendAdditionCode(getId() + ".setBackgroundAt(" + tabIndex + ", " + TypeManager.getJavaCode(background) + ");"); + appendAdditionCode(getId() + ".setBackgroundAt(" + tabIndex + ", " + compiler.getJavaCode(background) + ");"); } int mnemonic = tabInfo.getMnemonic(); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java index fd463fa..7045341 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java @@ -10,7 +10,6 @@ import jaxx.compiler.I18nHelper; import jaxx.compiler.JAXXCompiler; import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.compiler.tags.TagHandler; -import jaxx.compiler.types.TypeManager; import jaxx.runtime.swing.TabInfo; import org.w3c.dom.Attr; import org.w3c.dom.Element; @@ -64,7 +63,7 @@ public class TabHandler implements TagHandler { return; } - String valueCode = TypeManager.getJavaCode(value); + String valueCode = compiler.getJavaCode(value); // add i18n support if (I18nHelper.isI18nableAttribute(name, compiler)) { @@ -80,33 +79,33 @@ public class TabHandler implements TagHandler { compiledTabInfo.appendInitializationCode(id + ".setToolTipText(" + valueCode + ");"); //compiledTabInfo.appendInitializationCode(id + ".setToolTipText(" + TypeManager.getJavaCode(value) + ");"); } else if (name.equals("icon")) { - Icon icon = (Icon) TypeManager.convertFromString(value, Icon.class); + Icon icon = (Icon) compiler.convertFromString(value, Icon.class); tabInfo.setIcon(icon); - compiledTabInfo.appendInitializationCode(id + ".setIcon(" + TypeManager.getJavaCode(icon) + ");"); + compiledTabInfo.appendInitializationCode(id + ".setIcon(" + compiler.getJavaCode(icon) + ");"); } else if (name.equals("enabled")) { - boolean enabled = (Boolean) TypeManager.convertFromString(value, Boolean.class); + boolean enabled = (Boolean) compiler.convertFromString(value, Boolean.class); tabInfo.setEnabled(enabled); compiledTabInfo.appendInitializationCode(id + ".setEnabled(" + enabled + ");"); } else if (name.equals("disabledIcon")) { - Icon disabledIcon = (Icon) TypeManager.convertFromString(value, Icon.class); + Icon disabledIcon = (Icon) compiler.convertFromString(value, Icon.class); tabInfo.setDisabledIcon(disabledIcon); - compiledTabInfo.appendInitializationCode(id + ".setDisabledIcon(" + TypeManager.getJavaCode(disabledIcon) + ");"); + compiledTabInfo.appendInitializationCode(id + ".setDisabledIcon(" + compiler.getJavaCode(disabledIcon) + ");"); } else if (name.equals("mnemonic")) { - int mnemonic = (Character) TypeManager.convertFromString(value, char.class); + int mnemonic = (Character) compiler.convertFromString(value, char.class); tabInfo.setMnemonic(mnemonic); compiledTabInfo.appendInitializationCode(id + ".setMnemonic(" + mnemonic + ");"); } else if (name.equals("displayedMnemonicIndex")) { - int displayedMnemonicIndex = (Integer) TypeManager.convertFromString(value, int.class); + int displayedMnemonicIndex = (Integer) compiler.convertFromString(value, int.class); tabInfo.setDisplayedMnemonicIndex(displayedMnemonicIndex); compiledTabInfo.appendInitializationCode(id + ".setDisplayedMnemonicIndex(" + displayedMnemonicIndex + ");"); } else if (name.equals("foreground")) { - Color foreground = (Color) TypeManager.convertFromString(value, Color.class); + Color foreground = (Color) compiler.convertFromString(value, Color.class); tabInfo.setForeground(foreground); - compiledTabInfo.appendInitializationCode(id + ".setForeground(" + TypeManager.getJavaCode(foreground) + ");"); + compiledTabInfo.appendInitializationCode(id + ".setForeground(" + compiler.getJavaCode(foreground) + ");"); } else if (name.equals("background")) { - Color background = (Color) TypeManager.convertFromString(value, Color.class); + Color background = (Color) compiler.convertFromString(value, Color.class); tabInfo.setBackground(background); - compiledTabInfo.appendInitializationCode(id + ".setBackground(" + TypeManager.getJavaCode(background) + ");"); + compiledTabInfo.appendInitializationCode(id + ".setBackground(" + compiler.getJavaCode(background) + ");"); } else if (name.equals("id")) { // ignore, already handled } else { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TableHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TableHandler.java index cccbaf5..5211116 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TableHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TableHandler.java @@ -11,7 +11,6 @@ import jaxx.compiler.JAXXCompiler; import jaxx.compiler.reflect.ClassDescriptor; import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.compiler.tags.DefaultComponentHandler; -import jaxx.compiler.types.TypeManager; import jaxx.runtime.swing.Table; import java.awt.GridBagConstraints; @@ -77,7 +76,7 @@ public class TableHandler extends DefaultComponentHandler { rowSpans.set(x, c.gridheight); } - super.addChild(child, TypeManager.getJavaCode(c), compiler); + super.addChild(child, compiler.getJavaCode(c), compiler); emptyCell = false; } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java index f2ceeac..54a34a6 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java @@ -421,21 +421,6 @@ public class BeanValidatorHandler extends DefaultObjectHandler { } - /*protected boolean addContextName(BeanValidatorHandler handler, JAXXCompiler compiler) { - if (contextName != null) { - String code = handler.getSetPropertyCode(getJavaCode(), CONTEXT_NAME_ATTRIBUTE, TypeManager.getJavaCode(contextName), compiler); - appendAdditionCode(code); - } - return false; - }*/ - - /*protected boolean addScope(BeanValidatorHandler handler, JAXXCompiler compiler) { - if (scope != null) { - String code = handler.getSetPropertyCode(getJavaCode(), SCOPE_ATTRIBUTE, TypeManager.getJavaCode(scope), compiler); - appendAdditionCode(code); - } - return false; - }*/ protected boolean addParentValidator(Element tag, BeanValidatorHandler handler, JAXXCompiler compiler) { if (parentValidator != null) { String initializer; @@ -556,7 +541,7 @@ public class BeanValidatorHandler extends DefaultObjectHandler { String beanClassName = beanInfo.getJAXXBeanDescriptor().getClassDescriptor().getName(); // contextName must be in constructor to able to init validator with his correct contextName - setConstructorParams(beanClassName + ".class, " + TypeManager.getJavaCode(contextName)); + setConstructorParams(beanClassName + ".class, " + compiler.getJavaCode(contextName)); // add generic type to validator setGenericTypes(new String[]{beanClassName}); @@ -604,12 +589,7 @@ public class BeanValidatorHandler extends DefaultObjectHandler { // editor component not find on ui continue; } - /*if (compiler.isComponentUsedByValidator(component)) { - // component is already used by another validator - compiler.reportError("component '" + component + "' is already used by another validator."); - continue; - }*/ - String keyCode = TypeManager.getJavaCode(propertyName); + String keyCode = compiler.getJavaCode(propertyName); appendAdditionCode(getJavaCode() + ".setFieldRepresentation(" + keyCode + ", " + component + ");"); } } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tools/PrintTagInfo.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/PrintTagInfo.java index 3df8286..13973e7 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tools/PrintTagInfo.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/PrintTagInfo.java @@ -2,7 +2,7 @@ package jaxx.compiler.tools; import jaxx.compiler.tags.*; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.JAXXCompilerLaunchor; +import jaxx.compiler.JAXXEngine; import jaxx.compiler.beans.JAXXPropertyDescriptor; import jaxx.compiler.reflect.ClassDescriptor; import jaxx.compiler.reflect.ClassDescriptorLoader; @@ -36,7 +36,7 @@ public class PrintTagInfo { } try { - JAXXCompilerLaunchor.loadLibraries(false); + JAXXEngine.loadLibraries(false); for (int i = toFile ? 1 : 0; i < arg.length; i++) { String className = arg[i]; treateClass(w, className); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/ObjectHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/ObjectHandler.java index 69e5710..7dbe946 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/ObjectHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/ObjectHandler.java @@ -1,6 +1,5 @@ package jaxx.compiler.tools.jaxxcapture.handlers; -import jaxx.compiler.JavaFile; import jaxx.compiler.JAXXCompiler; import jaxx.compiler.tools.jaxxcapture.CapturedObject; import jaxx.compiler.tools.jaxxcapture.ContextNode; @@ -17,6 +16,7 @@ import java.awt.Container; import java.lang.reflect.Field; import java.util.Map; import java.util.Stack; +import jaxx.compiler.io.JavaElement; public class ObjectHandler { private static int count; @@ -292,7 +292,7 @@ public class ObjectHandler { } result.append(" <script>"); result.append(lineSeparator); - result.append(JavaFile.indent(script, 4, false, lineSeparator)); + result.append(JavaElement.indent(script, 4, false, lineSeparator)); result.append(lineSeparator); result.append(" </script>"); result.append(lineSeparator); @@ -314,7 +314,7 @@ public class ObjectHandler { String lineSeparator = JAXXCompiler.getLineSeparator(); for (CapturedObject aChildren : children) { if (!aChildren.isInlineable()) { - result.append(JavaFile.indent(aChildren.getXML(capture), 2, false, lineSeparator)); + result.append(JavaElement.indent(aChildren.getXML(capture), 2, false, lineSeparator)); result.append(lineSeparator); } } diff --git a/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.decorators.CompiledObjectDecorator b/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.decorators.CompiledObjectDecorator new file mode 100644 index 0000000..55f046a --- /dev/null +++ b/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.decorators.CompiledObjectDecorator @@ -0,0 +1,3 @@ +jaxx.compiler.decorators.DefaultCompiledObjectDecorator +jaxx.compiler.decorators.BoxedCompiledObjectDecorator +jaxx.compiler.decorators.HelpRootCompiledObjectDecorator diff --git a/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.types.TypeConverter b/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.types.TypeConverter new file mode 100644 index 0000000..440367e --- /dev/null +++ b/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.types.TypeConverter @@ -0,0 +1,5 @@ +jaxx.compiler.types.ColorConverter +jaxx.compiler.types.GridBagConstraintsConverter +jaxx.compiler.types.InsetsConverter +jaxx.compiler.types.KeyStrokeConverter +jaxx.compiler.types.PrimitiveConverter diff --git a/jaxx-compiler/src/test/java/jaxx/compiler/JavaMethodTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/JavaMethodTest.java index 94311a6..7d45659 100644 --- a/jaxx-compiler/src/test/java/jaxx/compiler/JavaMethodTest.java +++ b/jaxx-compiler/src/test/java/jaxx/compiler/JavaMethodTest.java @@ -1,7 +1,7 @@ package jaxx.compiler; -import jaxx.compiler.JavaMethod; -import jaxx.compiler.JavaMethod.MethodOrder; +import jaxx.compiler.io.JavaMethod; +import jaxx.compiler.io.JavaMethod.MethodOrder; import org.junit.Assert; import org.junit.Test; diff --git a/jaxx-compiler/src/test/java/jaxx/compiler/tags/TagManagerTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/tags/TagManagerTest.java index f5b3818..878f1fe 100644 --- a/jaxx-compiler/src/test/java/jaxx/compiler/tags/TagManagerTest.java +++ b/jaxx-compiler/src/test/java/jaxx/compiler/tags/TagManagerTest.java @@ -1,7 +1,7 @@ package jaxx.compiler.tags; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.JAXXCompilerLaunchor; +import jaxx.compiler.JAXXEngine; import jaxx.compiler.reflect.ClassDescriptor; import jaxx.compiler.reflect.ClassDescriptorLoader; import org.junit.Assert; @@ -36,8 +36,8 @@ public class TagManagerTest { @Before public void setUp() { - JAXXCompilerLaunchor.newLaunchor(); - compiler = JAXXCompilerLaunchor.createDummyCompiler(JAXXCompiler.class.getClassLoader()); + JAXXEngine.newLaunchor(); + compiler = JAXXEngine.createDummyCompiler(JAXXCompiler.class.getClassLoader()); // compiler = new JAXXCompiler(JAXXCompiler.class.getClassLoader()); compiler.addImport("javax.swing.*"); -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit c5fef28ab28ff91f4833cb7d377cb956c436d0b1 Author: Tony Chemit <chemit@codelutin.com> Date: Sat Oct 24 11:32:31 2009 +0000 amelioration demo du NavigationTreeHandler --- .../jaxx/navigation/FullNavigationTreeDemo.jaxx | 4 ++ .../jaxx/navigation/content/ActorContentUI.jaxx | 54 ++++----------------- .../jaxx/navigation/content/ActorsContentUI.jaxx | 50 +++++++------------ .../jaxx/navigation/content/ContentUI.jaxx | 52 ++++++++++++++++++++ .../jaxx/navigation/content/ContentUIHandler.java | 28 +++++++++++ .../jaxx/navigation/content/MovieContentUI.jaxx | 56 +++++----------------- .../jaxx/navigation/content/MoviesContentUI.jaxx | 48 +++++++------------ .../main/resources/i18n/jaxx-demo-en_GB.properties | 4 ++ .../main/resources/i18n/jaxx-demo-fr_FR.properties | 4 ++ 9 files changed, 145 insertions(+), 155 deletions(-) diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx index 3a3f4d3..420cd3a 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx @@ -26,9 +26,13 @@ <script><![CDATA[ import jaxx.runtime.SwingUtil; +import jaxx.demo.component.jaxx.navigation.content.*; private final FullNavigationTreeHelper helper = new FullNavigationTreeHelper(); +private final ContentUIHandler contentUIHandler = new ContentUIHandler(); setContextValue(helper); +setContextValue(contentUIHandler); +helper.setTree(this, navigation); helper.createModel(this); @Override diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorContentUI.jaxx index 9e04cf5..e7b6c02 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorContentUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorContentUI.jaxx @@ -18,7 +18,7 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<JPanel layout='{new BorderLayout()}' implements='jaxx.runtime.swing.navigation.NavigationContentUI'> +<ContentUI superGenericType='People'> <script><![CDATA[ import jaxx.runtime.SwingUtil; @@ -27,61 +27,27 @@ import jaxx.demo.component.jaxx.navigation.*; @Override public void openUI(NavigationTreeNode node) throws Exception { - People p = (People) getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this); + People p = (People) getHelper().getSelectedBean(this); log.info("selected people = "+p); setData(p); } -@Override -public void closeUI(NavigationTreeNode node) throws Exception { -// nothing to do -} - -String getType(Object data) { - if (data == null) { - return "no type"; - } - if (data instanceof java.util.List<?>) { - java.util.List<?> l = (java.util.List<?>) data; - if (l.isEmpty()) { - return "Empty collection"; - } - return "Collection of " + l.size() + " " + l.get(0).getClass().getSimpleName() + "(s)"; - } - return data.getClass().getSimpleName(); -} - -String getContent(Object data) { +String getContent(People data) { if (data == null) { return "no content"; } StringBuilder buffer = new StringBuilder(); - if (data instanceof java.util.List<?>) { - for (Object o : ((java.util.List<?>)data)) { - buffer.append(o).append("\n"); - } - } else { - buffer.append(data); - } + buffer.append(data); return buffer.toString(); } -ImageIcon getImage(Object data) { - if (data == null) { - return null; - } - if (data instanceof Movie) { - return SwingUtil.createIcon(((Movie)data).getImage()); - } - if (data instanceof People) { - return SwingUtil.createIcon(((People)data).getImage()); - } - return null; +ImageIcon getImage(People data) { + return data == null? null :SwingUtil.createIcon(data.getImage()); } - ]]> +]]> </script> - <People id='data' javaBean='(People) getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this)'/> + <People id='data' javaBean='null'/> <JSplitPane id='splitPane' orientation='{JSplitPane.VERTICAL_SPLIT}' @@ -92,7 +58,7 @@ ImageIcon getImage(Object data) { <JScrollPane border='{null}' horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> - <JTextPane border='{new TitledBorder("Content Type : " + getType(getData()))}' + <JTextPane border='{new TitledBorder(_("jaxxdemo.navigation.actor.title"))}' editable='false' font-size='11' text='{getContent(getData())}'/> @@ -108,4 +74,4 @@ ImageIcon getImage(Object data) { </JScrollPane> </JSplitPane> -</JPanel> \ No newline at end of file +</ContentUI> \ No newline at end of file diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx index 67e20f1..e175ba0 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx @@ -18,7 +18,7 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<JPanel layout='{new BorderLayout()}' implements='jaxx.runtime.swing.navigation.NavigationContentUI'> +<ContentUI superGenericType='java.util.List<People>'> <script><![CDATA[ import jaxx.runtime.SwingUtil; @@ -29,60 +29,42 @@ import jaxx.runtime.swing.navigation.NavigationTreeNode; @Override public void openUI(NavigationTreeNode node) throws Exception { - java.util.List<People> ps = (java.util.List<People>)getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this); + java.util.List<People> ps = (java.util.List<People>)getHelper().getSelectedBean(this); log.info("selected peoples = "+ps.size()); setData(ps); -} - -@Override -public void closeUI(NavigationTreeNode node) throws Exception { -// nothing to do -} - -String getType(Object data) { - if (data == null) { - return "no type"; - } - if (data instanceof java.util.List<?>) { - java.util.List<?> l = (java.util.List<?>) data; - if (l.isEmpty()) { - return "Empty collection"; + if (ps!=null) { + DefaultListModel model = (DefaultListModel) list.getModel(); + for (People p : ps) { + model.addElement(p); } - return "Collection of " + l.size() + " " + l.get(0).getClass().getSimpleName() + "(s)"; } - return data.getClass().getSimpleName(); } -ListModel getModel(java.util.List<People> data) { - - DefaultListModel model = new DefaultListModel(); - for (People m : data) { - model.addElement(m); - } - return model; +@Override +public void closeUI(NavigationTreeNode node) throws Exception { + // clean list model + DefaultListModel model = (DefaultListModel) list.getModel(); + model.removeAllElements(); } - ]]> </script> - <java.util.List id='data' - genericType='People' - javaBean='(java.util.List<People>)getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this)'/> + <java.util.List id='data' genericType='People' javaBean='null'/> - <JScrollPane border='{new TitledBorder("Content Type : " + getType(getData()))}' + <JScrollPane border='{new TitledBorder(_("jaxxdemo.navigation.actors.title"))}' constraints='BorderLayout.CENTER' columnHeaderView='{toolbar}' horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> - <JList id='list' model='{getModel(getData())}' cellRenderer='{new DecoratorListCellRenderer(DecoratorUtils.get(People.class.getSimpleName()))}'/> + <JList id='list' model='{new DefaultListModel()}' cellRenderer='{new DecoratorListCellRenderer(DecoratorUtils.get(People.class.getSimpleName()))}'/> </JScrollPane> <JToolBar id='toolbar' constraints='BorderLayout.SOUTH' floatable='false'> <JPanel layout='{new GridLayout(1,0)}'> - <JButton text='jaxxdemo.action.show' enabled='{list.getSelectedIndex()!=-1}'/> + <JButton text='jaxxdemo.action.show' enabled='{list.getSelectedIndex()!=-1}' onActionPerformed='getHandler().selectChild(this, list.getSelectedIndex())'/> <JButton text='jaxxdemo.action.add'/> <JButton text='jaxxdemo.action.remove' enabled='{list.getSelectedIndex()!=-1}'/> </JPanel> </JToolBar> -</JPanel> \ No newline at end of file +</ContentUI> \ No newline at end of file diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx new file mode 100644 index 0000000..47b70e9 --- /dev/null +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx @@ -0,0 +1,52 @@ +<!-- + *##% + jaxx-demo + Copyright (C) 2008 - 2009 CodeLutin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + ##%* +--> +<JPanel abstract='true' + layout='{new BorderLayout()}' + genericType='B extends Object' + implements='NavigationContentUI'> + + <script><![CDATA[ +import jaxx.runtime.SwingUtil; +import jaxx.demo.component.jaxx.navigation.*; +import jaxx.runtime.decorator.DecoratorUtils; +import jaxx.runtime.decorator.swing.DecoratorListCellRenderer; +import jaxx.runtime.swing.navigation.NavigationTreeNode; +import jaxx.runtime.swing.navigation.NavigationContentUI; + +ContentUIHandler getHandler() { + return getContextValue(ContentUIHandler.class); +} + +FullNavigationTreeHelper getHelper() { + return getContextValue(FullNavigationTreeHelper.class); +} + +public abstract B getData(); + +public abstract void setData(B data); + +@Override +public void closeUI(NavigationTreeNode node) throws Exception { + // nothing to do +} + ]]> + </script> +</JPanel> \ No newline at end of file diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUIHandler.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUIHandler.java new file mode 100644 index 0000000..87163b2 --- /dev/null +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUIHandler.java @@ -0,0 +1,28 @@ +package jaxx.demo.component.jaxx.navigation.content; + +import java.util.List; +import jaxx.demo.component.jaxx.navigation.FullNavigationTreeHelper; +import jaxx.demo.component.jaxx.navigation.Movie; +import jaxx.demo.component.jaxx.navigation.People; +import jaxx.runtime.JAXXContext; + +/** + * + * @author chemit + */ +public class ContentUIHandler { + + public void selectChild(JAXXContext context, int movieIndex) { + FullNavigationTreeHelper helper = context.getContextValue(FullNavigationTreeHelper.class); + helper.gotoChildNode(context, movieIndex); + } + + public void addMovie(JAXXContext context, Movie movie) { + List<Movie> movies = FullNavigationTreeHelper.MOVIES.getContextValue(context); + List<People> actors = FullNavigationTreeHelper.ACTORS.getContextValue(context); + } + + public void addActor(JAXXContext context, People a, Movie... movies) { + List<People> actors = FullNavigationTreeHelper.ACTORS.getContextValue(context); + } +} diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MovieContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MovieContentUI.jaxx index fab8195..921baa4 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MovieContentUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MovieContentUI.jaxx @@ -18,7 +18,7 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<JPanel layout='{new BorderLayout()}' implements='jaxx.runtime.swing.navigation.NavigationContentUI'> +<ContentUI superGenericType='Movie'> <script><![CDATA[ import jaxx.runtime.SwingUtil; @@ -27,61 +27,27 @@ import jaxx.demo.component.jaxx.navigation.*; @Override public void openUI(NavigationTreeNode node) throws Exception { - Movie m = (Movie) getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this); - log.info("selected movie = "+m); + Movie m = (Movie) getHelper().getSelectedBean(this); + log.info("selected movie = " + m); setData(m); } -@Override -public void closeUI(NavigationTreeNode node) throws Exception { -// nothing to do -} - -String getType(Object data) { - if (data == null) { - return "no type"; - } - if (data instanceof java.util.List<?>) { - java.util.List<?> l = (java.util.List<?>) data; - if (l.isEmpty()) { - return "Empty collection"; - } - return "Collection of " + l.size() + " " + l.get(0).getClass().getSimpleName() + "(s)"; - } - return data.getClass().getSimpleName(); -} - -String getContent(Object data) { +String getContent(Movie data) { if (data == null) { return "no content"; } StringBuilder buffer = new StringBuilder(); - if (data instanceof java.util.List<?>) { - for (Object o : ((java.util.List<?>)data)) { - buffer.append(o).append("\n"); - } - } else { - buffer.append(data); - } + buffer.append(data); return buffer.toString(); } -ImageIcon getImage(Object data) { - if (data == null) { - return null; - } - if (data instanceof Movie) { - return SwingUtil.createIcon(((Movie)data).getImage()); - } - if (data instanceof People) { - return SwingUtil.createIcon(((People)data).getImage()); - } - return null; +ImageIcon getImage(Movie data) { + return data == null? null :SwingUtil.createIcon(data.getImage()); } - ]]> +]]> </script> - <Movie id='data' javaBean='(Movie) getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this)'/> + <Movie id='data' javaBean='null'/> <JSplitPane id='splitPane' orientation='{JSplitPane.VERTICAL_SPLIT}' @@ -92,7 +58,7 @@ ImageIcon getImage(Object data) { <JScrollPane border='{null}' horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> - <JTextPane border='{new TitledBorder("Content Type : " + getType(getData()))}' + <JTextPane border='{new TitledBorder(_("jaxxdemo.navigation.movie.title"))}' editable='false' font-size='11' text='{getContent(getData())}'/> @@ -108,4 +74,4 @@ ImageIcon getImage(Object data) { </JScrollPane> </JSplitPane> -</JPanel> \ No newline at end of file +</ContentUI> \ No newline at end of file diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx index d6fcded..aca4933 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx @@ -18,7 +18,7 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<JPanel layout='{new BorderLayout()}' implements='jaxx.runtime.swing.navigation.NavigationContentUI'> +<ContentUI superGenericType='java.util.List<Movie>'> <script><![CDATA[ import jaxx.runtime.SwingUtil; @@ -29,58 +29,42 @@ import jaxx.runtime.swing.navigation.NavigationTreeNode; @Override public void openUI(NavigationTreeNode node) throws Exception { - java.util.List<Movie> ms = (java.util.List<Movie>)getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this); + java.util.List<Movie> ms = (java.util.List<Movie>)getHelper().getSelectedBean(this); log.info("selected movies = "+ms.size()); setData(ms); -} - -@Override -public void closeUI(NavigationTreeNode node) throws Exception { -// nothing to do -} -String getType(Object data) { - if (data == null) { - return "no type"; - } - if (data instanceof java.util.List<?>) { - java.util.List<?> l = (java.util.List<?>) data; - if (l.isEmpty()) { - return "Empty collection"; + if (ms != null) { + DefaultListModel model = (DefaultListModel) list.getModel(); + for (Movie m : ms) { + model.addElement(m); } - return "Collection of " + l.size() + " " + l.get(0).getClass().getSimpleName() + "(s)"; } - return data.getClass().getSimpleName(); } -ListModel getModel(java.util.List<Movie> data) { - DefaultListModel model = new DefaultListModel(); - for (Movie m : data) { - model.addElement(m); - } - return model; +@Override +public void closeUI(NavigationTreeNode node) throws Exception { + // clean list model + DefaultListModel model = (DefaultListModel) list.getModel(); + model.removeAllElements(); } - ]]> </script> - <java.util.List id='data' - genericType='Movie' - javaBean='(java.util.List<Movie>)getContextValue(FullNavigationTreeHelper.class).getSelectedBean(this)'/> + <java.util.List id='data' genericType='Movie' javaBean='null'/> - <JScrollPane border='{new TitledBorder("Content Type : " + getType(getData()))}' + <JScrollPane border='{new TitledBorder(_("jaxxdemo.navigation.movies.title"))}' constraints='BorderLayout.CENTER' columnHeaderView='{toolbar}' horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> - <JList id='list' model='{getModel(getData())}' cellRenderer='{new DecoratorListCellRenderer(DecoratorUtils.get(Movie.class.getSimpleName()))}'/> + <JList id='list' model='{new DefaultListModel()}' cellRenderer='{new DecoratorListCellRenderer(DecoratorUtils.get(Movie.class.getSimpleName()))}'/> </JScrollPane> <JToolBar id='toolbar' opaque='false' constraints='BorderLayout.SOUTH' floatable='false'> <JPanel layout='{new GridLayout(1,0)}'> - <JButton text='jaxxdemo.action.show' enabled='{list.getSelectedIndex()!=-1}'/> + <JButton text='jaxxdemo.action.show' enabled='{list.getSelectedIndex()!=-1}' onActionPerformed='getHandler().selectChild(this, list.getSelectedIndex())'/> <JButton text='jaxxdemo.action.add'/> <JButton text='jaxxdemo.action.remove' enabled='{list.getSelectedIndex()!=-1}'/> </JPanel> </JToolBar> -</JPanel> \ No newline at end of file +</ContentUI> \ No newline at end of file diff --git a/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties b/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties index 9729737..882b626 100644 --- a/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties +++ b/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties @@ -159,6 +159,10 @@ jaxxdemo.menu.file.locale=Languages jaxxdemo.menu.help= jaxxdemo.message.config.loaded=Configuration of JAXXDemo v. %1$s loaded. jaxxdemo.message.goto.site=Go to JAXXDemo Web site +jaxxdemo.navigation.actor.title= +jaxxdemo.navigation.actors.title= +jaxxdemo.navigation.movie.title= +jaxxdemo.navigation.movies.title= jaxxdemo.numbereditor.autoPopup= jaxxdemo.numbereditor.configuration= jaxxdemo.numbereditor.model= diff --git a/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties b/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties index 418d14c..76ec4c2 100644 --- a/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties +++ b/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties @@ -159,6 +159,10 @@ jaxxdemo.menu.file.locale=Langues jaxxdemo.menu.help=Aide jaxxdemo.message.config.loaded=Configuration de JAXX Demo v. %1$s charg\u00E9e. jaxxdemo.message.goto.site=Acc\u00E9der au site de JAXX Demo (%1$s) +jaxxdemo.navigation.actor.title= +jaxxdemo.navigation.actors.title= +jaxxdemo.navigation.movie.title= +jaxxdemo.navigation.movies.title= jaxxdemo.numbereditor.autoPopup=Affichage automatique popup jaxxdemo.numbereditor.configuration=Configuration jaxxdemo.numbereditor.model=R\u00E9sultat -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 092ed9fc20fee8930c452de63305cb844af03723 Author: Tony Chemit <chemit@codelutin.com> Date: Sat Oct 24 11:34:52 2009 +0000 - Evolution #100: amélioration du design du compilateur - Evolution #99: Améliorer le code généré - Evolution #98: les objets JAXX sont serializable --- .../src/main/java/jaxx/runtime/JAXXObject.java | 3 ++- jaxx-runtime/src/main/java/jaxx/runtime/Util.java | 4 +++- .../java/org/nuiton/jaxx/plugin/GenerateMojo.java | 19 ++++++++++++++----- maven-jaxx-plugin/src/main/resources/log4j.properties | 2 +- .../test/java/org/nuiton/jaxx/plugin/Bug1750Test.java | 3 +-- .../java/org/nuiton/jaxx/plugin/CompilerTest.java | 10 ++++------ .../org/nuiton/jaxx/plugin/CompilerValidatorTest.java | 9 ++++----- .../java/org/nuiton/jaxx/plugin/Evolution74Test.java | 10 ++++------ pom.xml | 2 +- 9 files changed, 34 insertions(+), 28 deletions(-) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java index 54a03a1..250067b 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java @@ -4,13 +4,14 @@ */ package jaxx.runtime; +import java.io.Serializable; import java.util.Map; /** * The <code>JAXXObject</code> interface is implemented by all classes * produced by the JAXX compiler. */ -public interface JAXXObject extends JAXXContext { +public interface JAXXObject extends JAXXContext, Serializable { /** * Retrieves an object defined in an XML tag by its ID. diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/Util.java b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java index 2d8f217..e68aae2 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/Util.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java @@ -30,7 +30,9 @@ public class Util { public static final String DEFAULT_ICON_PATH = "/icons/"; public static final String DEFAULT_ICON_PATH_PROPERTY = "default.icon.path"; - /** to use log facility, just put in your code: log.info(\"...\"); */ + /** + * Logger + */ static private final Log log = LogFactory.getLog(Util.class); // Maps root objects to lists of event listeners private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>(); diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java index 1b866f8..91e7048 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java @@ -20,7 +20,7 @@ package org.nuiton.jaxx.plugin; import jaxx.compiler.CompilerConfiguration; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.JAXXCompilerLaunchor; +import jaxx.compiler.JAXXEngine; import jaxx.compiler.beans.BeanInfoUtil; import jaxx.compiler.decorators.CompiledObjectDecorator; import jaxx.compiler.decorators.HelpRootCompiledObjectDecorator; @@ -297,6 +297,10 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat * */ protected ClassLoader cl; + /** + * JAXX engine + */ + private JAXXEngine engine; @SuppressWarnings("unchecked") @Override @@ -393,10 +397,11 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat // force compiler init from here, not in a static block TagManager.reset(verbose); - JAXXCompilerLaunchor launchor; - launchor = JAXXCompilerLaunchor.newLaunchor(src, files, this); - boolean success = launchor.compile(); - getLog().info("Generated " + launchor.getCompilerCount() + " file(s). "); + engine = JAXXEngine.newLaunchor(src, files, this); +// JAXXEngine engine; +// engine = JAXXEngine.newLaunchor(src, files, this); + boolean success = engine.compile(); + getLog().info("Generated " + engine.getCompilerCount() + " file(s). "); if (!success) { throw new MojoExecutionException("Aborting due to errors reported by jaxxc"); @@ -512,6 +517,10 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat return validatorClass; } + public JAXXEngine getEngine() { + return engine; + } + @Override public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); diff --git a/maven-jaxx-plugin/src/main/resources/log4j.properties b/maven-jaxx-plugin/src/main/resources/log4j.properties index 315f4fb..badba27 100644 --- a/maven-jaxx-plugin/src/main/resources/log4j.properties +++ b/maven-jaxx-plugin/src/main/resources/log4j.properties @@ -6,4 +6,4 @@ log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n log4j.logger.org.nuiton.i18n=ERROR -#log4j.logger.jaxx=DEBUG +log4j.logger.jaxx=INFO diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java index 3395019..a8139e5 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java @@ -2,7 +2,6 @@ package org.nuiton.jaxx.plugin; import jaxx.runtime.Base64Coder; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.JAXXCompilerLaunchor; import jaxx.runtime.JAXXObjectDescriptor; import jaxx.runtime.Util; @@ -17,7 +16,7 @@ public class Bug1750Test extends JaxxBaseTest { getMojo().execute(); assertNumberJaxxFiles(1); - JAXXCompiler compiler = JAXXCompilerLaunchor.get().getJAXXCompiler("org.nuiton.jaxx.plugin.Bug1750Test.ComboBox"); + JAXXCompiler compiler = getMojo().getEngine().getJAXXCompiler("org.nuiton.jaxx.plugin.Bug1750Test.ComboBox"); assertNotNull(compiler); JAXXObjectDescriptor descriptor = compiler.getJAXXObjectDescriptor(); diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java index bda7928..37f199b 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java @@ -1,7 +1,7 @@ package org.nuiton.jaxx.plugin; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.JAXXCompilerLaunchor; +import jaxx.compiler.JAXXEngine; import jaxx.runtime.context.DefaultJAXXContext; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.SystemStreamLog; @@ -123,8 +123,8 @@ public class CompilerTest extends JaxxBaseTest { //do nothing } }); - Field fieldCompilers = JAXXCompilerLaunchor.class.getDeclaredField("compilers"); - Field fieldErrorCount = JAXXCompilerLaunchor.class.getDeclaredField("errorCount"); + Field fieldCompilers = JAXXEngine.class.getDeclaredField("compilers"); + Field fieldErrorCount = JAXXEngine.class.getDeclaredField("errorCount"); fieldCompilers.setAccessible(true); fieldErrorCount.setAccessible(true); @@ -141,11 +141,9 @@ public class CompilerTest extends JaxxBaseTest { // ok jaxx compiler failed assertTrue(true); - JAXXCompilerLaunchor launchor = JAXXCompilerLaunchor.get(); + JAXXEngine launchor = mojo.getEngine(); Map<String, JAXXCompiler> compilers = (Map<String, JAXXCompiler>) fieldCompilers.get(launchor); assertEquals(1, compilers.size()); - //JAXXCompiler compiler; - //compiler = compilers.values().iterator().next(); Integer nberrors = (Integer) fieldErrorCount.get(launchor); assertTrue(nberrors != null && nberrors > 0); } diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java index dd0894a..dba524a 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java @@ -1,6 +1,6 @@ package org.nuiton.jaxx.plugin; -import jaxx.compiler.JAXXCompilerLaunchor; +import jaxx.compiler.JAXXEngine; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.SystemStreamLog; @@ -49,8 +49,8 @@ public class CompilerValidatorTest extends JaxxBaseTest { //do nothing } }); - Field fieldCompilers = JAXXCompilerLaunchor.class.getDeclaredField("compilers"); - Field fieldErrorCount = JAXXCompilerLaunchor.class.getDeclaredField("errorCount"); + Field fieldCompilers = JAXXEngine.class.getDeclaredField("compilers"); + Field fieldErrorCount = JAXXEngine.class.getDeclaredField("errorCount"); fieldCompilers.setAccessible(true); fieldErrorCount.setAccessible(true); @@ -66,10 +66,9 @@ public class CompilerValidatorTest extends JaxxBaseTest { } catch (MojoExecutionException e) { // ok jaxx compiler failed assertTrue(true); - JAXXCompilerLaunchor launchor = JAXXCompilerLaunchor.get(); + JAXXEngine launchor = mojo.getEngine(); Map<String, Compiler> compilers = (Map<String, Compiler>) fieldCompilers.get(launchor); assertEquals(1, compilers.size()); - //Compiler compiler = compilers.values().iterator().next(); Integer nberrors = (Integer) fieldErrorCount.get(launchor); assertEquals(1, nberrors.intValue()); } diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java index 92d239c..f4e3b9f 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java @@ -1,7 +1,7 @@ package org.nuiton.jaxx.plugin; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.JAXXCompilerLaunchor; +import jaxx.compiler.JAXXEngine; import org.apache.maven.plugin.MojoExecutionException; import java.lang.reflect.Field; @@ -66,8 +66,8 @@ public class Evolution74Test extends JaxxBaseTest { //do nothing } }); - Field fieldCompilers = JAXXCompilerLaunchor.class.getDeclaredField("compilers"); - Field fieldErrorCount = JAXXCompilerLaunchor.class.getDeclaredField("errorCount"); + Field fieldCompilers = JAXXEngine.class.getDeclaredField("compilers"); + Field fieldErrorCount = JAXXEngine.class.getDeclaredField("errorCount"); fieldCompilers.setAccessible(true); fieldErrorCount.setAccessible(true); @@ -85,11 +85,9 @@ public class Evolution74Test extends JaxxBaseTest { // ok jaxx compiler failed assertTrue(true); - JAXXCompilerLaunchor launchor = JAXXCompilerLaunchor.get(); + JAXXEngine launchor = mojo.getEngine(); Map<String, JAXXCompiler> compilers = (Map<String, JAXXCompiler>) fieldCompilers.get(launchor); assertEquals(1, compilers.size()); - //JAXXCompiler compiler; - //compiler = compilers.values().iterator().next(); Integer nberrors = (Integer) fieldErrorCount.get(launchor); assertTrue(nberrors != null && nberrors > 0); } diff --git a/pom.xml b/pom.xml index e7794b8..c6b1fdd 100644 --- a/pom.xml +++ b/pom.xml @@ -342,7 +342,7 @@ <name>JAXX Project</name> <description>JAXX Project</description> <inceptionYear>2008</inceptionYear> - <url>http://maven-site.nuiton.org/jaxx</url> + <url>http://maven-site.nuiton.org/jaxx-2.0</url> <!-- ************************************************************* --> <!-- *** Build Settings ****************************************** --> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 15a6bbe22a694c9924fd9efdf877888a34b4c859 Author: Tony Chemit <chemit@codelutin.com> Date: Sat Oct 24 11:36:16 2009 +0000 clean code --- jaxx-runtime/src/main/java/jaxx/runtime/Util.java | 1 - 1 file changed, 1 deletion(-) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/Util.java b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java index e68aae2..2ada2ef 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/Util.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java @@ -99,7 +99,6 @@ public class Util { return newListContextEntryDef(null); } - //@SuppressWarnings({"unchecked"}) public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef(String name) { Class<List<O>> castList = Util.<O>castList(); JAXXContextEntryDef<List<O>> contextEntryDef = new JAXXContextEntryDef<List<O>>(name,castList); -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 2b1b1756e88120fb26b9bb8b890f87e32cf2af57 Author: Tony Chemit <chemit@codelutin.com> Date: Sat Oct 24 13:56:24 2009 +0000 remover verbose flag on tests --- .../src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml | 2 +- .../src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml | 2 +- .../src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml | 2 +- .../src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml | 2 +- .../org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml | 2 +- .../org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml | 2 +- .../src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml index 9f234ac..042f3b2 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml @@ -16,7 +16,7 @@ <outJava>${basedir}/target/it-generated-sources/java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> - <verbose>true</verbose> + <!--<verbose>true</verbose>--> <includes> <value>**/Bug1722Test/*.jaxx</value> </includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml index a170eab..7975f5c 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml @@ -16,7 +16,7 @@ <outJava>${basedir}/target/it-generated-sources/java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> - <verbose>true</verbose> + <!--<verbose>true</verbose>--> <resetAfterCompile>false</resetAfterCompile> <includes> <value>**/Bug1750Test/*.jaxx</value> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml index ceae3e8..9c7d24a 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml @@ -17,7 +17,7 @@ <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <i18nable>true</i18nable> <force>true</force> - <verbose>true</verbose> + <!--<verbose>true</verbose>--> <resetAfterCompile>false</resetAfterCompile> <includes> <value>**/Bug1751Test/*.jaxx</value> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml index 3da403e..69318f6 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml @@ -17,7 +17,7 @@ <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <i18nable>false</i18nable> <force>true</force> - <verbose>true</verbose> + <!--<verbose>true</verbose>--> <resetAfterCompile>true</resetAfterCompile> <includes> <value>**/CompilerTest/icon/*.jaxx</value> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml index 57866b5..6e82724 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml @@ -17,7 +17,7 @@ <outJava>${basedir}/target/it-generated-sources/java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> - <verbose>true</verbose> + <!--<verbose>true</verbose>--> <includes> <value>**/CompilerValidatorTest/validator/errors/*.jaxx</value> </includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml index 53dcdde..41cb77f 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml @@ -16,7 +16,7 @@ <outJava>${basedir}/target/it-generated-sources/java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> - <verbose>true</verbose> + <!--<verbose>true</verbose>--> <includes> <value>**/CompilerValidatorTest/validator/ok/*.jaxx</value> </includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml index 2c78380..8209e9f 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml @@ -16,7 +16,7 @@ <outJava>${basedir}/target/it-generated-sources/java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> - <verbose>true</verbose> + <!--<verbose>true</verbose>--> <includes> <value>**/Evolution74Test/error/*.jaxx</value> </includes> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 8c4f66cdb64c946efcb1149741422681d723dde1 Author: Tony Chemit <chemit@codelutin.com> Date: Sun Oct 25 19:48:54 2009 +0000 - Evolution #100: amélioration du design du compilateur - Evolution #99: Améliorer le code généré - amelioration des test dans le plugin --- .../DefaultFinalizer.java} | 161 +- .../SwingFinalizer.java} | 13 +- .../ValidatorFinalizer.java} | 17 +- .../java/jaxx/compiler/generators/Generator.java | 17 - .../main/java/jaxx/compiler/io/JavaArgument.java | 71 - .../main/java/jaxx/compiler/io/JavaElement.java | 79 - .../src/main/java/jaxx/compiler/io/JavaField.java | 100 - .../java/jaxx/compiler/io/JavaFieldComparator.java | 72 - .../src/main/java/jaxx/compiler/io/JavaFile.java | 263 - .../src/main/java/jaxx/compiler/io/JavaMethod.java | 339 - .../jaxx/compiler/io/JavaMethodComparator.java | 72 - .../src/main/java/jaxx/compiler/parser/css/CSS.jj | 587 -- .../src/main/java/jaxx/compiler/parser/css/CSS.jjt | 256 - .../java/jaxx/compiler/parser/css/CSSParser.java | 799 -- .../compiler/parser/css/CSSParserConstants.java | 72 - .../compiler/parser/css/CSSParserTokenManager.java | 1152 --- .../parser/css/CSSParserTreeConstants.java | 40 - .../compiler/parser/css/JJTCSSParserState.java | 123 - .../main/java/jaxx/compiler/parser/css/Node.java | 51 - .../jaxx/compiler/parser/css/ParseException.java | 20 - .../jaxx/compiler/parser/css/SimpleCharStream.java | 398 - .../java/jaxx/compiler/parser/css/SimpleNode.java | 122 - .../main/java/jaxx/compiler/parser/css/Token.java | 76 - .../jaxx/compiler/parser/css/TokenMgrError.java | 126 - .../compiler/parser/java/JJTJavaParserState.java | 123 - .../main/java/jaxx/compiler/parser/java/Java1.5.jj | 5125 ---------- .../java/jaxx/compiler/parser/java/Java1.5.jjt | 2150 ---- .../jaxx/compiler/parser/java/JavaCharStream.java | 530 - .../java/jaxx/compiler/parser/java/JavaParser.java | 10048 ------------------- .../compiler/parser/java/JavaParserConstants.java | 260 - .../parser/java/JavaParserTokenManager.java | 2072 ---- .../parser/java/JavaParserTreeConstants.java | 230 - .../main/java/jaxx/compiler/parser/java/Node.java | 51 - .../jaxx/compiler/parser/java/ParseException.java | 214 - .../java/jaxx/compiler/parser/java/SimpleNode.java | 135 - .../main/java/jaxx/compiler/parser/java/Token.java | 79 - .../jaxx/compiler/parser/java/TokenMgrError.java | 126 - 37 files changed, 94 insertions(+), 26075 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/generators/JAXXObjectGenerator.java b/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java similarity index 82% rename from jaxx-compiler/src/main/java/jaxx/compiler/generators/JAXXObjectGenerator.java rename to jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java index aded870..54b0fd9 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/generators/JAXXObjectGenerator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java @@ -1,17 +1,21 @@ -package jaxx.compiler.generators; +package jaxx.compiler.finalizers; -import jaxx.compiler.io.JavaMethod; -import jaxx.compiler.io.JavaArgument; -import jaxx.compiler.io.JavaField; -import jaxx.compiler.io.JavaFile; -import jaxx.compiler.*; -import jaxx.runtime.Base64Coder; +import jaxx.compiler.JAXXCompilerFinalizer; import jaxx.compiler.CompilerException; -import jaxx.compiler.decorators.CompiledObjectDecorator; +import jaxx.compiler.CompiledObject; +import jaxx.compiler.CompiledObjectDecorator; +import jaxx.compiler.DataBinding; +import jaxx.compiler.EventHandler; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.java.JavaMethod; +import jaxx.compiler.java.JavaArgument; +import jaxx.compiler.java.JavaField; +import jaxx.compiler.java.JavaFile; import jaxx.compiler.reflect.ClassDescriptor; import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.compiler.reflect.FieldDescriptor; import jaxx.compiler.reflect.MethodDescriptor; +import jaxx.runtime.Base64Coder; import jaxx.runtime.JAXXObject; import jaxx.runtime.JAXXObjectDescriptor; import jaxx.runtime.JAXXContext; @@ -24,6 +28,7 @@ import static java.lang.reflect.Modifier.*; import java.util.Iterator; import java.util.List; import java.util.Map; +import static jaxx.compiler.java.JavaFileGenerator.*; /** * This class is a refactoring of the {@link jaxx.compiler.JAXXCompiler}. @@ -33,80 +38,80 @@ import java.util.Map; * * @author chemit */ -public class JAXXObjectGenerator implements Generator { +public class DefaultFinalizer implements JAXXCompilerFinalizer { /** log */ - protected static final Log log = LogFactory.getLog(JAXXObjectGenerator.class); - protected static final JavaField SERIAL_VERSION_UID_FIELD = JavaField.newField(PRIVATE | STATIC | FINAL, + protected static final Log log = LogFactory.getLog(DefaultFinalizer.class); + protected static final JavaField SERIAL_VERSION_UID_FIELD = newField(PRIVATE | STATIC | FINAL, "long", "serialVersionUID", false, "1L"); - protected static final JavaField ACTIVE_BINDINGS_FIELD = JavaField.newField(PROTECTED, + protected static final JavaField ACTIVE_BINDINGS_FIELD = newField(PROTECTED, "java.util.List<Object>", "$activeBindings", false, "new ArrayList<Object>()"); - protected static final JavaField BINDING_SOURCES_FIELD = JavaField.newField(PROTECTED, + protected static final JavaField BINDING_SOURCES_FIELD = newField(PROTECTED, "java.util.Map<String,Object>", "$bindingSources", false, "new HashMap<String,Object>()"); - protected static final JavaField OBJECT_MAP_FIELD = JavaField.newField(PROTECTED, + protected static final JavaField OBJECT_MAP_FIELD = newField(PROTECTED, "Map<String,Object>", "$objectMap", true, "new HashMap<String,Object>()"); - protected static final JavaField ALL_COMPONENTS_CREATED_FIELD = JavaField.newField(PRIVATE, + protected static final JavaField ALL_COMPONENTS_CREATED_FIELD = newField(PRIVATE, "boolean", "allComponentsCreated", false); - protected static final JavaField CONTEXT_INITIALIZED = JavaField.newField(PRIVATE, + protected static final JavaField CONTEXT_INITIALIZED = newField(PRIVATE, "boolean", "contextInitialized", false, "true"); - protected static final JavaField PREVIOUS_VALUES_FIELD = JavaField.newField(PROTECTED, + protected static final JavaField PREVIOUS_VALUES_FIELD = newField(PROTECTED, "java.util.Map<?,?>", "$previousValues", false, "new java.util.HashMap<Object,Object>()"); - protected static final JavaField DELEGATE_CONTEXT_FIELD = JavaField.newField(PROTECTED, + protected static final JavaField DELEGATE_CONTEXT_FIELD = newField(PROTECTED, JAXXContext.class.getName(), "delegateContext", true); - protected static final JavaField PROPERTY_CHANGE_SUPPORT_FIELD = JavaField.newField(0, + protected static final JavaField PROPERTY_CHANGE_SUPPORT_FIELD = newField(0, "java.beans.PropertyChangeSupport", "$propertyChangeSupport", false); - protected static final JavaMethod GET_CONTEXT_VALUE_METHOD = JavaMethod.newMethod(PUBLIC, "<T> T", "getContextValue", + protected static final JavaMethod GET_CONTEXT_VALUE_METHOD = newMethod(PUBLIC, "<T> T", "getContextValue", "return delegateContext.getContextValue(clazz, null);", true, new JavaArgument("Class<T>", "clazz")); - protected static final JavaMethod GET_CONTEXT_VALUE_NAMED_METHOD = JavaMethod.newMethod(PUBLIC, "<T> T", "getContextValue", + protected static final JavaMethod GET_CONTEXT_VALUE_NAMED_METHOD = newMethod(PUBLIC, "<T> T", "getContextValue", "return delegateContext.getContextValue(clazz, name);", true, new JavaArgument("Class<T>", "clazz"), new JavaArgument("String", "name")); - protected static final JavaMethod SET_CONTEXT_VALUE_NAMED_METHOD = JavaMethod.newMethod(PUBLIC, "<T> void", "setContextValue", + protected static final JavaMethod SET_CONTEXT_VALUE_NAMED_METHOD = newMethod(PUBLIC, "<T> void", "setContextValue", "delegateContext.setContextValue(o, name);", true, new JavaArgument("T", "o"), new JavaArgument("String", "name")); - protected static final JavaMethod SET_CONTEXT_VALUE_METHOD = JavaMethod.newMethod(PUBLIC, "<T> void", "setContextValue", + protected static final JavaMethod SET_CONTEXT_VALUE_METHOD = newMethod(PUBLIC, "<T> void", "setContextValue", "delegateContext.setContextValue(o, null);", true, new JavaArgument("T", "o")); - protected static final JavaMethod REMOVE_CONTEXT_VALUE_NAMED_METHOD = JavaMethod.newMethod(PUBLIC, "<T> void", "removeContextValue", + protected static final JavaMethod REMOVE_CONTEXT_VALUE_NAMED_METHOD = newMethod(PUBLIC, "<T> void", "removeContextValue", "delegateContext.removeContextValue(clazz, name);", true, new JavaArgument("Class<T>", "clazz"), new JavaArgument("String", "name")); - protected static final JavaMethod REMOVE_CONTEXT_VALUE_METHOD = JavaMethod.newMethod(PUBLIC, "<T> void", "removeContextValue", + protected static final JavaMethod REMOVE_CONTEXT_VALUE_METHOD = newMethod(PUBLIC, "<T> void", "removeContextValue", "delegateContext.removeContextValue(clazz, null);", true, new JavaArgument("Class<T>", "clazz")); - protected static final JavaMethod GET_PARENT_CONTAINER_MORE_METHOD = JavaMethod.newMethod(PUBLIC, "<O extends Container> O", "getParentContainer", + protected static final JavaMethod GET_PARENT_CONTAINER_MORE_METHOD = newMethod(PUBLIC, "<O extends Container> O", "getParentContainer", "return delegateContext.getParentContainer(source, clazz);", true, new JavaArgument("Object", "source"), new JavaArgument("Class<O>", "clazz")); - protected static final JavaMethod GET_PARENT_CONTAINER_METHOD = JavaMethod.newMethod(PUBLIC, "<O extends Container> O", "getParentContainer", + protected static final JavaMethod GET_PARENT_CONTAINER_METHOD = newMethod(PUBLIC, "<O extends Container> O", "getParentContainer", "return delegateContext.getParentContainer(clazz);", true, new JavaArgument("Class<O>", "clazz")); - protected static final JavaMethod GET_OBJECT_BY_ID_METHOD = JavaMethod.newMethod(PUBLIC, "java.lang.Object", "getObjectById", + protected static final JavaMethod GET_OBJECT_BY_ID_METHOD = newMethod(PUBLIC, "java.lang.Object", "getObjectById", "return $objectMap.get(id);", true, new JavaArgument("String", "id")); - protected static final JavaMethod GET_JAXX_OBJECT_DESCRIPTOR_METHOD = JavaMethod.newMethod(PUBLIC | STATIC, "jaxx.runtime.JAXXObjectDescriptor", "$getJAXXObjectDescriptor", + protected static final JavaMethod GET_JAXX_OBJECT_DESCRIPTOR_METHOD = newMethod(PUBLIC | STATIC, "jaxx.runtime.JAXXObjectDescriptor", "$getJAXXObjectDescriptor", "return jaxx.runtime.Util.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);", false); - protected static final JavaMethod PROCESS_DATA_BINDING_METHOD = JavaMethod.newMethod(PUBLIC, "void", "processDataBinding", + protected static final JavaMethod PROCESS_DATA_BINDING_METHOD = newMethod(PUBLIC, "void", "processDataBinding", "processDataBinding(dest, false);", true, new JavaArgument("String", "dest")); - protected static final JavaMethod FIRE_PROPERTY_CHANGE_METHOD = JavaMethod.newMethod(PUBLIC, "void", "firePropertyChange", + protected static final JavaMethod FIRE_PROPERTY_CHANGE_METHOD = newMethod(PUBLIC, "void", "firePropertyChange", "super.firePropertyChange(propertyName, oldValue, newValue);", true, new JavaArgument("String", "propertyName"), new JavaArgument("Object", "oldValue"), new JavaArgument("Object", "newValue")); - protected static final JavaMethod FIRE_PROPERTY_CHANGE_NAMED_METHOD = JavaMethod.newMethod(PUBLIC, "void", "firePropertyChange", + protected static final JavaMethod FIRE_PROPERTY_CHANGE_NAMED_METHOD = newMethod(PUBLIC, "void", "firePropertyChange", "$getPropertyChangeSupport().firePropertyChange(propertyName, oldValue, newValue);", true, new JavaArgument("String", "propertyName"), new JavaArgument("Object", "oldValue"), new JavaArgument("Object", "newValue")); - protected static final JavaMethod GET_PROPERTY_CHANGE_SUPPORT_METHOD = JavaMethod.newMethod(0, "java.beans.PropertyChangeSupport", "$getPropertyChangeSupport", + protected static final JavaMethod GET_PROPERTY_CHANGE_SUPPORT_METHOD = newMethod(0, "java.beans.PropertyChangeSupport", "$getPropertyChangeSupport", "if ($propertyChangeSupport == null)\n" + " $propertyChangeSupport = new PropertyChangeSupport(this);\n" + "return $propertyChangeSupport;", false); - protected static final JavaMethod ADD_PROPERTY_CHANGE_SUPPORT_METHOD = JavaMethod.newMethod(PUBLIC, "void", "addPropertyChangeListener", + protected static final JavaMethod ADD_PROPERTY_CHANGE_SUPPORT_METHOD = newMethod(PUBLIC, "void", "addPropertyChangeListener", "$getPropertyChangeSupport().addPropertyChangeListener(listener);", true, new JavaArgument("java.beans.PropertyChangeListener", "listener")); - protected static final JavaMethod ADD_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD = JavaMethod.newMethod(PUBLIC, "void", "addPropertyChangeListener", + protected static final JavaMethod ADD_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD = newMethod(PUBLIC, "void", "addPropertyChangeListener", "$getPropertyChangeSupport().addPropertyChangeListener(property, listener);", true, new JavaArgument("String", "property"), new JavaArgument("java.beans.PropertyChangeListener", "listener")); - protected static final JavaMethod REMOVE_PROPERTY_CHANGE_SUPPORT_METHOD = JavaMethod.newMethod(PUBLIC, "void", "removePropertyChangeListener", + protected static final JavaMethod REMOVE_PROPERTY_CHANGE_SUPPORT_METHOD = newMethod(PUBLIC, "void", "removePropertyChangeListener", "$getPropertyChangeSupport().removePropertyChangeListener(listener);", true, new JavaArgument("java.beans.PropertyChangeListener", "listener")); - protected static final JavaMethod REMOVE_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD = JavaMethod.newMethod(PUBLIC, "void", "removePropertyChangeListener", + protected static final JavaMethod REMOVE_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD = newMethod(PUBLIC, "void", "removePropertyChangeListener", "$getPropertyChangeSupport().removePropertyChangeListener(property, listener);", true, new JavaArgument("String", "property"), new JavaArgument("java.beans.PropertyChangeListener", "listener")); @@ -130,6 +135,7 @@ public class JAXXObjectGenerator implements Generator { javaFile.setGenericType(compiler.getGenericType()); javaFile.setSuperGenericType(compiler.getSuperGenericType()); + // finalize all objects via their decorator for (CompiledObject object : compiler.getObjects().values()) { CompiledObjectDecorator decorator = object.getDecorator(); decorator.finalizeCompiler(compiler, root, object, javaFile, packageName, className, fullClassName); @@ -144,7 +150,8 @@ public class JAXXObjectGenerator implements Generator { } if (superclassIsJAXXObject) { - boolean hasBind = compiler.getApplyDataBinding().length() > 0; +// boolean hasBind = compiler.getApplyDataBinding().length() > 0; + boolean hasBind = compiler.hasApplyDataBinding(); if (hasBind) { compiler.appendApplyDataBinding(" else {"); compiler.appendApplyDataBinding(eol); @@ -159,7 +166,8 @@ public class JAXXObjectGenerator implements Generator { compiler.appendApplyDataBinding("}"); } - hasBind = compiler.getRemoveDataBinding().length() > 0; + hasBind = compiler.hasRemoveDataBinding(); +// hasBind = compiler.getRemoveDataBinding().length() > 0; if (hasBind) { compiler.appendRemoveDataBinding(" else {"); compiler.appendRemoveDataBinding(eol); @@ -188,7 +196,7 @@ public class JAXXObjectGenerator implements Generator { if (compiler.getConfiguration().isAddLogger()) { javaFile.addImport(Log.class); javaFile.addImport(LogFactory.class); - javaFile.addField(JavaField.newField(PUBLIC + STATIC + FINAL, "Log", "log", false, "LogFactory.getLog(" + fullClassName + ".class)")); + javaFile.addSimpleField(newField(PUBLIC | STATIC | FINAL, "Log", "log", false, "LogFactory.getLog(" + fullClassName + ".class)")); } // JAXXObject @@ -198,7 +206,7 @@ public class JAXXObjectGenerator implements Generator { javaFile.addField(ACTIVE_BINDINGS_FIELD); // JAXXContext - javaFile.addField(JavaField.newField(PROTECTED | FINAL, JAXXContext.class.getName(), "delegateContext", true, "new " + jaxxContextImplementorClass + "(this);")); + javaFile.addField(newField(PROTECTED | FINAL, JAXXContext.class.getName(), "delegateContext", true, "new " + jaxxContextImplementorClass + "(this);")); javaFile.addMethod(SET_CONTEXT_VALUE_METHOD); javaFile.addMethod(SET_CONTEXT_VALUE_NAMED_METHOD); javaFile.addMethod(GET_CONTEXT_VALUE_METHOD); @@ -283,12 +291,12 @@ public class JAXXObjectGenerator implements Generator { javaFile.addMethod(createCompleteSetupMethod(compiler, javaFile, compiler.getInitDataBindings())); - javaFile.addMethod(JavaMethod.newMethod(PUBLIC, "void", "applyDataBinding", + javaFile.addMethod(newMethod(PUBLIC, "void", "applyDataBinding", compiler.getApplyDataBinding().toString() + JAXXCompiler.getLineSeparator() + "processDataBinding($binding);", true, new JavaArgument("String", "$binding"))); - javaFile.addMethod(JavaMethod.newMethod(PUBLIC, "void", "removeDataBinding", + javaFile.addMethod(newMethod(PUBLIC, "void", "removeDataBinding", compiler.getRemoveDataBinding().toString(), true, new JavaArgument("String", "$binding"))); javaFile.addMethod(createProcessDataBindingMethod(compiler, superclassIsJAXXObject)); @@ -319,7 +327,7 @@ public class JAXXObjectGenerator implements Generator { int sizeLimit = 65000; // constant strings are limited to 64K, and I'm not brave enough to push right up to the limit if (data.length() < sizeLimit) { - return JavaField.newField(PRIVATE | STATIC, "java.lang.String", "$jaxxObjectDescriptor", false, compiler.getJavaCode(data)); + return newField(PRIVATE | STATIC, "java.lang.String", "$jaxxObjectDescriptor", false, compiler.getJavaCode(data)); } else { StringBuffer initializer = new StringBuffer(); for (int i = 0; i < data.length(); i += sizeLimit) { @@ -331,7 +339,7 @@ public class JAXXObjectGenerator implements Generator { } initializer.append("String.valueOf(").append(name).append(")"); } - return JavaField.newField(PRIVATE | STATIC | FINAL, "java.lang.String", "$jaxxObjectDescriptor", false, initializer.toString()); + return newField(PRIVATE | STATIC | FINAL, "java.lang.String", "$jaxxObjectDescriptor", false, initializer.toString()); } } catch (IOException e) { throw new RuntimeException("Internal error: can't-happen error", e); @@ -386,7 +394,7 @@ public class JAXXObjectGenerator implements Generator { if (listenerMethod.getParameterTypes().length != 1) { throw new CompilerException("Expected event handler " + listenerMethod.getName() + " of class " + handler.getListenerClass() + " to have exactly one argument"); } - javaFile.addMethod(JavaMethod.newMethod(PUBLIC, "void", methodName, handler.getJavaCode(), false, + javaFile.addMethod(newMethod(PUBLIC, "void", methodName, handler.getJavaCode(), false, new JavaArgument(JAXXCompiler.getCanonicalName(listenerMethod.getParameterTypes()[0]), "event"))); } } @@ -406,7 +414,7 @@ public class JAXXObjectGenerator implements Generator { } code.append("$initialize();"); code.append(eol); - return JavaMethod.newMethod(PUBLIC, null, className, code.toString(), false); + return newMethod(PUBLIC, null, className, code.toString(), false); } protected JavaMethod createConstructorWithInitialContext(JAXXCompiler compiler, String className, boolean superclassIsJAXXObject) throws CompilerException { @@ -426,7 +434,7 @@ public class JAXXObjectGenerator implements Generator { } code.append("$initialize();"); code.append(eol); - return JavaMethod.newMethod(PUBLIC, null, className, code.toString(), false, new JavaArgument(JAXXContext.class.getName(), "parentContext")); + return newMethod(PUBLIC, null, className, code.toString(), false, new JavaArgument(JAXXContext.class.getName(), "parentContext")); } public JavaMethod createInitializer(JAXXCompiler compiler) throws CompilerException { @@ -439,11 +447,14 @@ public class JAXXObjectGenerator implements Generator { code.append(eol); code.append("}"); code.append(eol); + //TODO-TC20091025 we should remove this if no used anywhere code.append("$objectMap.put(").append(compiler.getJavaCode(root.getId())).append(", this);"); code.append(eol); Iterator<CompiledObject> i = compiler.getObjectCreationOrder(); boolean lastWasMethodCall = false; + //TODO-TC20091025 should do init of root first ? +// root.getDecorator().createInitializer(compiler, root, root, code, lastWasMethodCall); while (i.hasNext()) { CompiledObject object = i.next(); if (object == root) { @@ -453,14 +464,14 @@ public class JAXXObjectGenerator implements Generator { lastWasMethodCall = decorator.createInitializer(compiler, root, object, code, lastWasMethodCall); } root.getDecorator().createInitializer(compiler, root, root, code, lastWasMethodCall); - code.append(eol); +// code.append(eol); if (compiler.getInitializer().length() > 0) { code.append(compiler.getInitializer()); - code.append(eol); +// code.append(eol); } code.append("$completeSetup();"); code.append(eol); - return JavaMethod.newMethod(PRIVATE, "void", "$initialize", code.toString(), false); + return newMethod(PRIVATE, "void", "$initialize", code.toString(), false); } protected JavaMethod createCompleteSetupMethod(JAXXCompiler compiler, JavaFile javaFile, StringBuffer initDataBindings) { @@ -472,19 +483,19 @@ public class JAXXObjectGenerator implements Generator { CompiledObjectDecorator decorator = object.getDecorator(); code.append(decorator.createCompleteSetupMethod(compiler, object, javaFile, initDataBindings)); } - + code.append("// init data bindings").append(eol); code.append(initDataBindings); if (compiler.getLateInitializer().length() > 0) { - code.append(compiler.getLateInitializer()); - code.append(eol); + code.append("// late initializer").append(eol); + code.append(compiler.getLateInitializer()).append(eol); } //TC-20090313 add an extra method after complete setup MethodDescriptor method = compiler.getScriptMethod("$afterCompleteSetup"); if (method != null) { code.append("$afterCompleteSetup();").append(eol); } - return JavaMethod.newMethod(PRIVATE, "void", "$completeSetup", code.toString(), false); + return newMethod(PRIVATE, "void", "$completeSetup", code.toString(), false); } protected JavaMethod createProcessDataBindingMethod(JAXXCompiler compiler, boolean superclassIsJAXXObject) { @@ -497,37 +508,23 @@ public class JAXXObjectGenerator implements Generator { if (compiler.getProcessDataBinding().length() > 0) { code.append(" if (!$force && $activeBindings.contains($dest)) { "); code.append(eol); - code.append(" return;"); - code.append(eol); - code.append("}"); - code.append(eol); - code.append("$activeBindings.add($dest);"); - code.append(eol); - code.append("try {"); - code.append(eol); - if (compiler.getProcessDataBinding().length() > 0) { - code.append(compiler.getProcessDataBinding().toString()); - //code.append(JAXXCompiler.getLineSeparator()); - } + code.append(" return;").append(eol); + code.append("}").append(eol); + code.append("$activeBindings.add($dest);").append(eol); + code.append("try {").append(eol); + code.append(compiler.getProcessDataBinding().toString()); if (superclassIsJAXXObject) { - code.append(" else {"); - code.append(eol); - code.append(" super.processDataBinding($dest, true);"); - code.append(eol); - code.append(" }"); - code.append(eol); + code.append(" else {").append(eol); + code.append(" super.processDataBinding($dest, true);").append(eol); + code.append(" }").append(eol); } - code.append("} finally {"); - code.append(eol); - code.append(" $activeBindings.remove($dest);"); - code.append(eol); - code.append("}"); - code.append(eol); + code.append("} finally {").append(eol); + code.append(" $activeBindings.remove($dest);").append(eol); + code.append("}").append(eol); } else if (superclassIsJAXXObject) { - code.append("super.processDataBinding($dest, true);"); - code.append(eol); + code.append("super.processDataBinding($dest, true);").append(eol); } - return JavaMethod.newMethod(PUBLIC, "void", "processDataBinding", code.toString(), superclassIsJAXXObject, + return newMethod(PUBLIC, "void", "processDataBinding", code.toString(), superclassIsJAXXObject, new JavaArgument("String", "$dest"), new JavaArgument("boolean", "$force")); } } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/generators/SwingGenerator.java b/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/SwingFinalizer.java similarity index 77% rename from jaxx-compiler/src/main/java/jaxx/compiler/generators/SwingGenerator.java rename to jaxx-compiler/src/main/java/jaxx/compiler/finalizers/SwingFinalizer.java index 198b67e..a6f11de 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/generators/SwingGenerator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/SwingFinalizer.java @@ -1,8 +1,8 @@ -package jaxx.compiler.generators; +package jaxx.compiler.finalizers; -import jaxx.compiler.io.JavaMethod; -import jaxx.compiler.io.JavaArgument; -import jaxx.compiler.io.JavaFile; +import jaxx.compiler.java.JavaArgument; +import jaxx.compiler.java.JavaFile; +import jaxx.compiler.java.JavaFileGenerator; import jaxx.compiler.*; import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.runtime.swing.Application; @@ -10,7 +10,7 @@ import jaxx.runtime.swing.Application; import java.lang.reflect.Modifier; /** @author chemit */ -public class SwingGenerator implements Generator { +public class SwingFinalizer implements JAXXCompilerFinalizer { @Override public void finalizeCompiler(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) { @@ -19,10 +19,9 @@ public class SwingGenerator implements Generator { @Override public void prepareJavaFile(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws ClassNotFoundException { - //TODO : move this to jaxx-compiler-swing generator if (ClassDescriptorLoader.getClassDescriptor(Application.class.getName()).isAssignableFrom(root.getObjectClass()) && !compiler.isMainDeclared()) { // TODO: check for existing main method first - javaFile.addMethod(JavaMethod.newMethod( + javaFile.addMethod(JavaFileGenerator.newMethod( Modifier.PUBLIC | Modifier.STATIC, "void", "main", diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/generators/ValidatorGenerator.java b/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorFinalizer.java similarity index 90% rename from jaxx-compiler/src/main/java/jaxx/compiler/generators/ValidatorGenerator.java rename to jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorFinalizer.java index 8bd95a7..6aced22 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/generators/ValidatorGenerator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorFinalizer.java @@ -1,9 +1,9 @@ -package jaxx.compiler.generators; +package jaxx.compiler.finalizers; -import jaxx.compiler.io.JavaMethod; -import jaxx.compiler.io.JavaArgument; -import jaxx.compiler.io.JavaField; -import jaxx.compiler.io.JavaFile; +import jaxx.compiler.java.JavaArgument; +import jaxx.compiler.java.JavaField; +import jaxx.compiler.java.JavaFile; +import jaxx.compiler.java.JavaFileGenerator; import jaxx.compiler.*; import jaxx.compiler.CompiledObject.ChildRef; import jaxx.compiler.reflect.ClassDescriptor; @@ -15,9 +15,9 @@ import java.util.List; import jaxx.runtime.SwingUtil; /** @author chemit */ -public class ValidatorGenerator implements Generator { +public class ValidatorFinalizer implements JAXXCompilerFinalizer { - protected static final JavaField VALIDATOR_IDS_FIELD = JavaField.newField(java.lang.reflect.Modifier.PROTECTED, + protected static final JavaField VALIDATOR_IDS_FIELD = JavaFileGenerator.newField(java.lang.reflect.Modifier.PROTECTED, "java.util.List<String>", "validatorIds", true, "new ArrayList<String>()"); @Override @@ -44,6 +44,7 @@ public class ValidatorGenerator implements Generator { } String eol = JAXXCompiler.getLineSeparator(); // register validator + compiler.appendLateInitializer("// validator setup" + eol); for (CompiledBeanValidator validator : BeanValidatorHandler.getValidators(compiler)) { String id = compiler.getJavaCode(validator.getId()); compiler.appendLateInitializer("validatorIds.add(" + id + ");"); @@ -85,7 +86,7 @@ public class ValidatorGenerator implements Generator { // implements JAXXValidator javaFile.addField(VALIDATOR_IDS_FIELD); - javaFile.addMethod(JavaMethod.newMethod( + javaFile.addMethod(JavaFileGenerator.newMethod( java.lang.reflect.Modifier.PUBLIC, validatorFQN + "<?>", "getValidator", diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/generators/Generator.java b/jaxx-compiler/src/main/java/jaxx/compiler/generators/Generator.java deleted file mode 100644 index 1d9b00f..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/generators/Generator.java +++ /dev/null @@ -1,17 +0,0 @@ -package jaxx.compiler.generators; - -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.io.JavaFile; - -/** - * TODO javadoc! - * - * @author chemit - */ -public interface Generator { - - void finalizeCompiler(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className); - - void prepareJavaFile(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws ClassNotFoundException; -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaArgument.java b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaArgument.java deleted file mode 100644 index 6a4665e..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaArgument.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.io; - -/** - * Represents an argument to a <code>JavaMethod</code>. - * - * @see JavaMethod - */ -public class JavaArgument extends JavaElement { - - private String type; - private boolean isFinal; - - /** - * Creates a new <code>JavaArgument</code> with the specified name and type. For example, the method <code>main()</code> - * might have a <code>JavaArgument</code> with a name of <code>"arg"</code> and a type of <code>"java.lang.String[]"</code>. - * - * @param type the argument's type, as it would appear in Java source code - * @param name the argument's name - */ - public JavaArgument(String type, String name) { - this(type, name, false); - } - - /** - * Creates a new <code>JavaArgument</code> with the specified name, type, and finality. For example, the method <code>main()</code> - * might have a <code>JavaArgument</code> with a name of <code>"arg"</code> and a type of <code>"java.lang.String[]"</code>. The - * <code>isFinal</code> parameter allows the presence of the <code>final</code> keyword on the argument to be controlled. - * - * @param type the argument's type, as it would appear in Java source code - * @param name the argument's name - * @param isFinal <code>true</code> if the argument should be marked final - */ - public JavaArgument(String type, String name, boolean isFinal) { - super(0, name); - this.type = type; - this.isFinal = isFinal; - } - - /** - * Returns the argument's type as it would be represented in Java source code. - * - * @return the argument's type - */ - public String getType() { - return type; - } - - /** - * Returns <code>true</code> if the <code>final</code> keyword should appear before the argument. - * - * @return <code>true</code> if the argument is final - */ - public boolean isFinal() { - return isFinal; - } - - /** - * Returns the Java source code for this argument. - * - * @return the Java source code for this argument - */ - @Override - public String toString() { - String result = type + ' ' + getName(); - return isFinal ? "final " + result : result; - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaElement.java b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaElement.java deleted file mode 100644 index d7ec97c..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaElement.java +++ /dev/null @@ -1,79 +0,0 @@ -package jaxx.compiler.io; - -import java.lang.reflect.Modifier; -import java.util.Arrays; -import jaxx.compiler.JAXXCompiler; - -/** - * Base Java element - * @author chemit - * @since 2.0.0 - */ -public abstract class JavaElement { - - private String lineSeparator; - private String name; - private int modifiers; - - public JavaElement(int modifiers, String name) { - this.modifiers = modifiers; - this.name = name; - } - - public final int getModifiers() { - return modifiers; - } - - public final void setModifiers(int modifiers) { - this.modifiers = modifiers; - } - - public final String getName() { - return name; - } - - public final void setName(String className) { - this.name = className; - } - - public final String getModifiersText() { - if (modifiers == 0) { - return ""; - } else { - return Modifier.toString(modifiers) + ' '; - } - } - - public final String getLineSeparator() { - if (lineSeparator == null) { - lineSeparator = JAXXCompiler.getLineSeparator(); - } - return lineSeparator; - } - - public static String addIndentation(String source, int indentation, String lineSeparator) { - return indent(source, indentation, false, lineSeparator); - } - - public static String setIndentation(String source, int indentation, String lineSeparator) { - return indent(source, indentation, true, lineSeparator); - } - - public static String indent(String source, int indentation, boolean trim, String lineSeparator) { - if (trim) { - source = source.trim(); - } - char[] spaces = new char[indentation]; - Arrays.fill(spaces, ' '); - StringBuffer result = new StringBuffer(); - String[] lines = source.split(System.getProperty("line.separator") + "|\n"); - for (int i = 0; i < lines.length; i++) { - if (i > 0) { - result.append(lineSeparator); - } - result.append(spaces); - result.append(trim ? lines[i].trim() : lines[i]); - } - return result.toString(); - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaField.java b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaField.java deleted file mode 100644 index 794b322..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaField.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.io; - -import java.lang.reflect.Modifier; - -/** - * Represents a field in a Java source file being generated for output. <code>JavaFields</code> are created - * and added to a {@link JavaFile}, which can then output Java source code. - */ -public class JavaField extends JavaElement implements Comparable<JavaField> { - - private String type; - private String initializer; - private boolean override; - - /** - * Constructs a new <code>JavaField</code>. The <code>modifiers</code> parameter is a bit mask of the - * constants from {@link java.lang.reflect.Modifier}, and the <code>type</code> of the field should be - * represented as it would appear in Java source code. - * - * @param modifiers the modifier keywords that should appear as part of the field's declaration - * @param type the type of the field as it would appear in Java source code - * @param name the field's name - * @param override - */ - public JavaField(int modifiers, String type, String name, boolean override) { - this(modifiers, type, name, override, null); - } - - /** - * Constructs a new <code>JavaField</code>. The <code>modifiers</code> parameter is a bit mask of the - * constants from <code>java.lang.reflect.Modifier</code>, and the <code>type</code> of the field should be - * represented as it would appear in Java source code. The <code>initializer</code> is the initial - * value of the field as it would appear in Java source code, or <code>null</code> to leave it at the - * default value. - * - * @param modifiers the modifier keywords that should appear as part of the field's declaration - * @param type the type of the field as it would appear in Java source code - * @param name the field's name - * @param override - * @param initializer the initial value of the field, as it would appear in Java source code - */ - public JavaField(int modifiers, String type, String name, boolean override, String initializer) { - super(modifiers, name); - this.type = type; - this.initializer = initializer; - this.override = override; - } - - /** - * Returns the field's type, as it would be represented in Java source code. - * - * @return the field's type - */ - public String getType() { - return type; - } - - public boolean isOverride() { - return override; - } - - public void setOverride(boolean override) { - this.override = override; - } - - /** - * Returns the Java source code for this field. - * - * @return the Java source code for this field - */ - @Override - public String toString() { - String eol = getLineSeparator(); - StringBuffer result = new StringBuffer(); - result.append(getModifiersText()); - result.append(type).append(' ').append(getName()); - if (initializer != null) { - result.append(" = ").append(initializer); - } - result.append(';').append(eol); - return result.toString(); - } - - @Override - public int compareTo(JavaField o) { - return JavaFieldComparator.COMPARATOR.compare(this, o); - } - - public static JavaField newField(int modifiers, String returnType, String name, boolean override) { - return newField(modifiers, returnType, name, override, null); - } - - public static JavaField newField(int modifiers, String returnType, String name, boolean override, String initializer) { - return new JavaField(modifiers, returnType, name, override, initializer); - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaFieldComparator.java b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaFieldComparator.java deleted file mode 100644 index e7ce8bd..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaFieldComparator.java +++ /dev/null @@ -1,72 +0,0 @@ -package jaxx.compiler.io; - -import java.lang.reflect.Modifier; -import java.util.Comparator; - -class JavaFieldComparator implements Comparator<JavaField> { - - static final JavaFieldComparator COMPARATOR = new JavaFieldComparator(); - - @Override - public int compare(JavaField o1, JavaField o2) { - int result; - if ((result = compareStatic(o1, o2)) != 0) { - return result; - } - // data sources must be on the last after all other fields - if ((result = compareDataSource(o1, o2)) != 0) { - return result; - } - // same static - if ((result = compareVisibility(o1, o2)) != 0) { - return result; - } - // same visibility, test name - return o1.getName().compareTo(o2.getName()); - } - - public int compareStatic(JavaField o1, JavaField o2) { - // first comparator modifiers : static always before none static - if (Modifier.isStatic(o1.getModifiers()) && !Modifier.isStatic(o2.getModifiers())) { - return -1; - } - if (!Modifier.isStatic(o1.getModifiers()) && Modifier.isStatic(o2.getModifiers())) { - return 1; - } - return 0; - } - - public int compareDataSource(JavaField o1, JavaField o2) { - // first comparator modifiers : static always before none static - if (o1.getName().startsWith("$DataSource") && !o2.getName().startsWith("$DataSource")) { - return 1; - } - if (!o1.getName().startsWith("$DataSource") && o2.getName().startsWith("$DataSource")) { - return -1; - } - return 0; - } - - public int compareVisibility(JavaField o1, JavaField o2) { - // first comparator modifiers : static always before none static - if (!Modifier.isPublic(o1.getModifiers()) && Modifier.isPublic(o2.getModifiers())) { - return 1; - } - if (Modifier.isPublic(o1.getModifiers()) && !Modifier.isPublic(o2.getModifiers())) { - return -1; - } - if (Modifier.isProtected(o1.getModifiers()) && !Modifier.isProtected(o2.getModifiers())) { - return -1; - } - if (!Modifier.isProtected(o1.getModifiers()) && Modifier.isProtected(o2.getModifiers())) { - return 1; - } - if (Modifier.isPrivate(o1.getModifiers()) && !Modifier.isPrivate(o2.getModifiers())) { - return -1; - } - if (!Modifier.isPrivate(o1.getModifiers()) && Modifier.isPrivate(o2.getModifiers())) { - return 1; - } - return 0; - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaFile.java b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaFile.java deleted file mode 100644 index 313d160..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaFile.java +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.io; - -import jaxx.compiler.io.JavaMethod.MethodOrder; - -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.EnumMap; -import java.util.List; -import java.util.Map.Entry; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * A Java source file being generated for output. Once the class is completely initialized, use the - * {@link #toString} method to generate source code for it. - */ -public class JavaFile extends JavaElement { - - /** - * Logger - */ - static private final Log log = LogFactory.getLog(JavaFile.class); - protected static final String GETTER_PATTERN = "return %1$s;"; - protected static final String BOOLEAN_GETTER_PATTERN = "return %1$s !=null && %1$s;"; - protected static final String SETTER_PATTERN = "%1$s oldValue = this.%2$s;\nthis.%2$s = newValue;\nfirePropertyChange(\"%2$s\", oldValue, newValue);"; - private List<String> imports = new ArrayList<String>(); - private List<JavaField> fields = new ArrayList<JavaField>(); - private List<JavaMethod> methods = new ArrayList<JavaMethod>(); - private List<JavaFile> innerClasses = new ArrayList<JavaFile>(); - private String superClass; - private List<String> interfaces; - private StringBuffer rawBodyCode = new StringBuffer(); - private boolean superclassIsJAXXObject; - private boolean abstractClass; - private String genericType; - private String superGenericType; - - public JavaFile() { - super(0, ""); - } - - public JavaFile(int modifiers, String className, String superClass) { - this(modifiers, className, superClass, null); - } - - public JavaFile(int modifiers, String className, String superClass, List<String> interfaces) { - super(modifiers, className); - this.superClass = superClass; - this.interfaces = interfaces; - } - - public void addImport(String importString) { - imports.add(importString); - } - - public void addImport(Class<?> importString) { - imports.add(importString.getName()); - } - - public String[] getImports() { - return imports.toArray(new String[imports.size()]); - } - - public String getSuperClass() { - return superClass; - } - - public void setSuperClass(String superClass) { - this.superClass = superClass; - } - - public List<String> getInterfaces() { - if (interfaces == null) { - interfaces = new ArrayList<String>(); - } - return interfaces; - } - - public void setInterfaces(List<String> interfaces) { - this.interfaces = interfaces; - } - - public void setGenericType(String genericType) { - this.genericType = genericType; - } - - public void addMethod(JavaMethod method) { - methods.add(method); - } - - public JavaMethod[] getMethods() { - return methods.toArray(new JavaMethod[methods.size()]); - } - - public void addField(JavaField field) { - addField(field, false); - } - - public void addField(JavaField field, boolean javaBean) { - addSimpleField(field); - String id = field.getName(); - String capitalizedName = org.apache.commons.lang.StringUtils.capitalize(id); - // add getter file - String content = String.format(GETTER_PATTERN, id); - addMethod(new JavaMethod( - Modifier.isProtected(field.getModifiers()) ? Modifier.PUBLIC : Modifier.PROTECTED, - field.getType(), "get" + capitalizedName, null, null, content, field.isOverride())); - - if (javaBean) { - // add full javabean support - if (Boolean.class.getName().equals(field.getType())) { - content = String.format(BOOLEAN_GETTER_PATTERN, id); - addMethod(new JavaMethod(Modifier.PUBLIC, field.getType(), "is" + capitalizedName, null, null, content, field.isOverride())); - } - content = String.format(SETTER_PATTERN, field.getType(), id); - JavaArgument arg = new JavaArgument(field.getType(), "newValue"); - addMethod(new JavaMethod(Modifier.PUBLIC, "void", "set" + capitalizedName, new JavaArgument[]{arg}, null, content, field.isOverride())); - } - } - - public void addSimpleField(JavaField field) { - fields.add(field); - } - - public JavaField[] getFields() { - return fields.toArray(new JavaField[fields.size()]); - } - - public void addBodyCode(String bodyCode) { - rawBodyCode.append(bodyCode); - } - - @Override - public String toString() { - String eol = getLineSeparator(); - StringBuffer result = new StringBuffer(); - if (getName().indexOf(".") != -1) { - result.append("package ").append(getName().substring(0, getName().lastIndexOf("."))).append(";"); - result.append(eol); - result.append(eol); - } - - if (imports.size() > 0) { - for (String anImport : imports) { - result.append("import "); - result.append(anImport); - result.append(';'); - result.append(eol); - } - result.append(eol); - } - - result.append(getModifiersText()); - if (abstractClass) { - result.append("abstract "); - } - result.append("class "); - result.append(getName().substring(getName().lastIndexOf(".") + 1)); - if (genericType != null) { - result.append('<').append(genericType).append('>'); - } - result.append(" extends "); - result.append(superClass); - if (superGenericType != null) { - result.append('<').append(superGenericType).append('>'); - } - if (interfaces != null && !interfaces.isEmpty()) { - result.append(" implements ").append(interfaces.get(0)); - for (int i = 1; i < interfaces.size(); i++) { - /*if (i > 0) { - result.append(", "); - }*/ - result.append(", ").append(interfaces.get(i)); - } - } - result.append(" {"); - result.append(eol); - if (fields.size() > 0) { - java.util.Collections.sort(fields); // sort fields - - for (JavaField field : fields) { - if (log.isDebugEnabled()) { - log.debug("generate field " + field); - } - result.append(addIndentation(field.toString(), 4, eol)); - result.append(eol); - } - - result.append(eol); - } - - if (rawBodyCode.length() > 0) { - result.append(addIndentation("/* begin raw body code */\n", 4, eol)); - String s = rawBodyCode.toString(); - if (!s.startsWith(eol)) { - result.append(eol); - } - result.append(addIndentation(s, 4, eol)); - result.append(eol); - result.append(addIndentation("/* end raw body code */", 4, eol)); - result.append(eol); - } - - for (JavaFile innerClass : innerClasses) { - result.append(addIndentation(innerClass.toString(), 4, eol)); - result.append(eol).append(eol); - } - - EnumMap<MethodOrder, List<JavaMethod>> map = JavaMethod.getSortedMethods(methods); - for (Entry<MethodOrder, List<JavaMethod>> entry : map.entrySet()) { - List<JavaMethod> list = entry.getValue(); - if (!list.isEmpty()) { - result.append(addIndentation(entry.getKey().getHeader(), 4, eol)); - result.append(eol).append(eol); - for (JavaMethod method : list) { - result.append(addIndentation(method.toString(), 4, eol)); - result.append(eol).append(eol); - } - } - list.clear(); - } - map.clear(); - result.append("}"); - return result.toString(); - } - - public void addInterface(String canonicalName) { - if (interfaces == null || !interfaces.contains(canonicalName)) { - getInterfaces().add(canonicalName); - } - } - - public void addInterfaces(String[] canonicalNames) { - if (canonicalNames == null) { - return; - } - for (String canonicalName : canonicalNames) { - if (interfaces == null || !interfaces.contains(canonicalName)) { - getInterfaces().add(canonicalName); - } - } - } - - public boolean isSuperclassIsJAXXObject() { - return superclassIsJAXXObject; - } - - public void setSuperclassIsJAXXObject(boolean superclassIsJAXXObject) { - this.superclassIsJAXXObject = superclassIsJAXXObject; - } - - public void setAbstractClass(boolean abstractClass) { - this.abstractClass = abstractClass; - } - - public void setSuperGenericType(String superGenericType) { - this.superGenericType = superGenericType; - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaMethod.java b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaMethod.java deleted file mode 100644 index a453547..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaMethod.java +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.io; - -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.EnumMap; -import java.util.EnumSet; -import java.util.Iterator; -import java.util.List; - -/** - * Represents a method in a Java source file being generated for output. <code>JavaMethods</code> are created - * and added to a {@link JavaFile}, which can then output Java source code. In addition to normal methods, a - * <code>JavaMethod</code> can represent a constructor -- constructors should be named after their containing - * classes and have a return type of <code>null</code>. - */ -public class JavaMethod extends JavaElement implements Comparable<JavaMethod> { - - private String returnType; - private JavaArgument[] arguments; - private String[] exceptions; - private String body; - private boolean override; -// private StringBuffer bodyCode; - - /** - * Constructs a new <code>JavaMethod</code> containing the specified body code. The <code>modifiers</code> parameter - * is a bit mask of the constants from {@link java.lang.reflect.Modifier}, and the <code>returnType</code> and - * <code>exceptions</code> of the method should be represented as they would appear in Java source code (<code>null</code> - * for a constructor). The method body is initially empty. - * - * @param modifiers the modifier keywords that should appear as part of the method's declaration - * @param returnType the return type of the method as it would appear in Java source code - * @param name the method's name - * @param arguments the method's arguments - * @param exceptions a list of exceptions the methods can throw, as they would be represented in Java source code - * @param bodyCode Java source code which should appear in the method body - * @param override flag with {@code true} value when the method overrides (or implements) a super class method - */ - public JavaMethod(int modifiers, String returnType, String name, JavaArgument[] arguments, String[] exceptions, String bodyCode, boolean override) { - super(modifiers, name); - this.returnType = returnType; - this.override = override; - this.arguments = arguments; - this.exceptions = exceptions; - this.body = bodyCode == null ? "" : bodyCode; -// this.bodyCode = new StringBuffer(bodyCode != null ? bodyCode : ""); - } - - /** - * Returns the method's return type, as it would be represented in Java source code. - * - * @return the method's return type - */ - public String getReturnType() { - return returnType; - } - - /** - * Returns a list of the method's arguments. - * - * @return the method's arguments - */ - public JavaArgument[] getArguments() { - return arguments; - } - - /** - * Returns a list of exceptions the method can throw. - * - * @return the method's exceptions - */ - public String[] getExceptions() { - return exceptions; - } - - public boolean isOverride() { - return override; - } - - public void setOverride(boolean override) { - this.override = override; - } - - @Override - public String toString() { - String eol = getLineSeparator(); - StringBuffer result = new StringBuffer(); - if (isOverride()) { - result.append("@Override").append(eol); - } - result.append(getModifiersText()); - if (returnType != null) { - result.append(returnType); - result.append(' '); - } - result.append(getName()); - result.append('('); - if (arguments != null) { - for (int i = 0; i < arguments.length; i++) { - if (i > 0) { - result.append(", "); - } - result.append(arguments[i].toString()); - } - } - result.append(") {"); - result.append(eol); - if (body != null) { - String formattedBodyCode = addIndentation(body.trim(), 4, eol); - if (formattedBodyCode.length() > 0) { - result.append(formattedBodyCode); - result.append(eol); - } - } - result.append("}"); - return result.toString(); - } - - @Override - public int compareTo(JavaMethod o) { - return JavaMethodComparator.COMPARATOR.compare(this, o); - } - - public static JavaMethod newMethod(int modifiers, String returnType, String name, String initializer, boolean override, String[] exceptions, JavaArgument... arguments) { - return new JavaMethod(modifiers, returnType, name, arguments, exceptions, initializer, override); - } - - public static JavaMethod newMethod(int modifiers, String returnType, String name, String initializer, boolean override, JavaArgument... arguments) { - return newMethod(modifiers, returnType, name, initializer, override, new String[0], arguments); - } - - public enum MethodOrder { - - statics(Modifier.STATIC, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- Statics methods --------------------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { - }, - constructors(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- Constructors -----------------------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { - - @Override - public boolean accept(JavaMethod method) { - return method.returnType == null; - } - }, - JAXXObject(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- JAXXObject implementation ----------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { - - private List<String> methods = Arrays.asList("applyDataBinding", "firePropertyChange", "getObjectById", "get$objectMap", "processDataBinding", "removeDataBinding"); - - @Override - public boolean accept(JavaMethod method) { - return methods.contains(method.getName()); - } - }, - JAXXContext(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- JAXXContext implementation ---------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { - - private List<String> methods = Arrays.asList("getContextValue", "getDelegateContext", "getParentContainer", "removeContextValue", "setContextValue"); - - @Override - public boolean accept(JavaMethod method) { - return methods.contains(method.getName()); - } - }, - JAXXValidation(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- JAXXValidation implementation ------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { - - private List<String> methods = Arrays.asList("getValidator", "getValidatorIds"); - - @Override - public boolean accept(JavaMethod method) { - return methods.contains(method.getName()); - } - }, - events(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- Event methods ----------------------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { - - @Override - public boolean accept(JavaMethod method) { - return (method.getName().startsWith("do") && method.getName().indexOf("__") > -1); - } - }, - publicGetters(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- public acessor methods -------------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { - - @Override - public boolean accept(JavaMethod method) { - return (method.getName().startsWith("get") || method.getName().startsWith("is")); - } - }, - publicSetters(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- public mutator methods -------------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { - - @Override - public boolean accept(JavaMethod method) { - return (method.getName().startsWith("set")); - } - }, - otherPublic(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- public mutator methods -------------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { - - @Override - public boolean accept(int mod) { - return super.accept(mod) && !Modifier.isStatic(mod); - } - }, - protectedGetters(Modifier.PROTECTED, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- protected acessors methods ---------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { - - @Override - public boolean accept(JavaMethod method) { - return (method.getName().startsWith("get") || method.getName().startsWith("is")); - } - }, - createMethod(Modifier.PROTECTED | Modifier.PRIVATE, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- ui creation methods ----------------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { - - @Override - public boolean accept(JavaMethod method) { - return method.getName().startsWith("create") || method.getName().startsWith("add") || - method.getName().equals("$completeSetup") || - method.getName().equals("$initialize"); - } - }, - protecteds(Modifier.PROTECTED, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- Other protected methods ------------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { - }, - packageLocal(0, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- Package methods --------------------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { - - @Override - public boolean accept(int mod) { - return !Modifier.isStatic(mod) && !Modifier.isPublic(mod) && !Modifier.isProtected(mod); - } - }, - privates(Modifier.PRIVATE, "/*---------------------------------------------------------------------------------*/\n" + - "/*-- Private methods --------------------------------------------------------------*/\n" + - "/*---------------------------------------------------------------------------------*/") { - }; - private final String header; - private int modifier; - - MethodOrder(int modifier, String header) { - this.header = header; - this.modifier = modifier; - } - - public String getHeader() { - return header; - } - - public boolean accept(JavaMethod method) { - return true; - } - - public boolean accept(int mod) { - return (mod & modifier) != 0; - } - - public boolean accept(int mod, JavaMethod method) { - return accept(mod) && accept(method); - } - - public static MethodOrder valueOf(JavaMethod method, int scope) { - for (MethodOrder o : values()) { - if (o.accept(scope, method)) { - return o; - } - } - throw new IllegalArgumentException("could not find a " + MethodOrder.class + " for method " + method); - } - } - - public static EnumMap<MethodOrder, List<JavaMethod>> getSortedMethods(List<JavaMethod> methods) { - - EnumMap<MethodOrder, List<JavaMethod>> result = new EnumMap<MethodOrder, List<JavaMethod>>(MethodOrder.class); - for (MethodOrder methodOrder : MethodOrder.values()) { - result.put(methodOrder, new ArrayList<JavaMethod>()); - } - - EnumSet<MethodOrder> allConstants = EnumSet.allOf(MethodOrder.class); - List<JavaMethod> allMethods = new ArrayList<JavaMethod>(methods); - int[] scopes = new int[]{Modifier.STATIC, Modifier.PUBLIC, Modifier.PROTECTED, Modifier.PRIVATE}; - for (int scope : scopes) { - EnumSet<MethodOrder> constants = getMethodOrderScope(allConstants, scope); - - Iterator<JavaMethod> itMethods = allMethods.iterator(); - while (itMethods.hasNext()) { - JavaMethod method = itMethods.next(); - for (MethodOrder constant : constants) { - if (constant.accept(method.getModifiers(), method)) { - result.get(constant).add(method); - itMethods.remove(); - break; - } - } - } - constants.clear(); - } - - if (!allMethods.isEmpty()) { - throw new IllegalArgumentException("could not find a " + MethodOrder.class + " for method " + allMethods); - } - - for (MethodOrder methodOrder : MethodOrder.values()) { - // sort methods - java.util.Collections.sort(result.get(methodOrder)); - } - return result; - } - - public static EnumSet<MethodOrder> getMethodOrderScope(EnumSet<MethodOrder> allConstants, int scope) { - EnumSet<MethodOrder> constants = EnumSet.noneOf(MethodOrder.class); - for (MethodOrder order : allConstants) { - if (order.accept(scope)) { - constants.add(order); - } - } - return constants; - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaMethodComparator.java b/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaMethodComparator.java deleted file mode 100644 index a320aca..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/io/JavaMethodComparator.java +++ /dev/null @@ -1,72 +0,0 @@ -package jaxx.compiler.io; - -import java.lang.reflect.Modifier; -import java.util.Comparator; - -/** - * - * @author chemit - * @since 2.0.0 - */ -public class JavaMethodComparator implements Comparator<JavaMethod> { - - static final JavaMethodComparator COMPARATOR = new JavaMethodComparator(); - - @Override - public int compare(JavaMethod o1, JavaMethod o2) { - - /*int result; - if ((result = compareStatic(o1, o2)) != 0) { - return result; - } - if ((result = compareConstructor(o1, o2)) != 0) { - return result; - } - if ((result = compareVisibility(o1, o2)) != 0) { - return result; - }*/ - return o1.getName().compareTo(o2.getName()); - } - - public int compareStatic(JavaMethod o1, JavaMethod o2) { - if (Modifier.isStatic(o1.getModifiers()) && !Modifier.isStatic(o2.getModifiers())) { - return -1; - } - if (!Modifier.isStatic(o1.getModifiers()) && Modifier.isStatic(o2.getModifiers())) { - return 1; - } - return 0; - } - - public int compareConstructor(JavaMethod o1, JavaMethod o2) { - if (o1.getReturnType() == null && o2.getReturnType() != null) { - return -1; - } - if (o1.getReturnType() != null && o2.getReturnType() == null) { - return 1; - } - return 0; - } - - public int compareVisibility(JavaMethod o1, JavaMethod o2) { - if (Modifier.isPublic(o1.getModifiers()) && !Modifier.isPublic(o2.getModifiers())) { - return -1; - } - if (!Modifier.isPublic(o1.getModifiers()) && Modifier.isPublic(o2.getModifiers())) { - return 1; - } - if (Modifier.isProtected(o1.getModifiers()) && !Modifier.isProtected(o2.getModifiers())) { - return -1; - } - if (!Modifier.isProtected(o1.getModifiers()) && Modifier.isProtected(o2.getModifiers())) { - return 1; - } - if (Modifier.isPrivate(o1.getModifiers()) && !Modifier.isPrivate(o2.getModifiers())) { - return -1; - } - if (!Modifier.isPrivate(o1.getModifiers()) && Modifier.isPrivate(o2.getModifiers())) { - return 1; - } - return 0; - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSS.jj b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSS.jj deleted file mode 100644 index fbd133f..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSS.jj +++ /dev/null @@ -1,587 +0,0 @@ -/*@bgen(jjtree) Generated By:JJTree: Do not edit this line. .\CSS.jj */ -/*@egen*//* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ - -// I would love to have used an existing CSS parser, but all of the ones I could -// find are licensed under the LGPL. As JAXX is BSD licensed and I'm not a big -// fan of the LGPL, unfortunately that won't work. -options { - STATIC = false; - JDK_VERSION = "1.4"; -} - -PARSER_BEGIN(CSSParser) -package jaxx.css; - -public class CSSParser/*@bgen(jjtree)*/implements CSSParserTreeConstants/*@egen*/ {/*@bgen(jjtree)*/ - protected JJTCSSParserState jjtree = new JJTCSSParserState(); - -/*@egen*/ - public SimpleNode popNode() { - if ( jjtree.nodeArity() > 0) // number of child nodes - return (SimpleNode)jjtree.popNode(); - else - return null; - } - - void jjtreeOpenNodeScope(Node n) { - ((SimpleNode) n).firstToken = getToken(1); - } - - void jjtreeCloseNodeScope(Node n) { - ((SimpleNode) n).lastToken = getToken(0); - } - - public static void main(String args[]) { - System.out.println("Reading from standard input..."); - CSSParser css = new CSSParser(System.in); - try { - SimpleNode n = css.Stylesheet(); - n.dump(""); - System.out.println("Thank you."); - } catch (Exception e) { - System.out.println("Oops."); - System.out.println(e.getMessage()); - e.printStackTrace(); - } - } -} - -PARSER_END(CSSParser) - - -<DEFAULT, IN_RULE> SKIP : -{ - " " -| "\t" -| "\n" -| "\r" -| <"//" (~["\n","\r"])* ("\n"|"\r"|"\r\n")> -| <"/*" (~["*"])* "*" (~["/"] (~["*"])* "*")* "/"> -} - -<*> TOKEN : /* LITERALS */ -{ - <DECIMAL_LITERAL: <INTEGER_LITERAL> ("." <INTEGER_LITERAL>)?> -| - <#INTEGER_LITERAL: (["0"-"9"])+> -} - -<DEFAULT, IN_RULE> TOKEN : /* IDENTIFIER */ -{ - <IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)*> -| - <#LETTER: ["_", "-", "a"-"z", "A"-"Z"]> -| - <#DIGIT: ["0"-"9"]> -} - -<IN_PSEUDOCLASS> TOKEN : /* PSEUDOCLASS_IDENTIFIER */ -{ - <PSEUDOCLASS_IDENTIFIER: <IDENTIFIER>> : DEFAULT -} - -<DEFAULT> TOKEN: /* COLON */ -{ - <PSEUDOCLASS_COLON: ":"> : IN_PSEUDOCLASS -} - -<IN_RULE> TOKEN: /* COLON_IN_RULE */ -{ - <COLON: ":"> -} - -<*> TOKEN: /* SEMICOLON */ -{ - <SEMICOLON: ";"> -} - -TOKEN : /* LEFT BRACE */ -{ - <LEFT_BRACE: "{"> : IN_RULE -} - -<IN_RULE> TOKEN : /* RIGHT BRACE */ -{ - <RIGHT_BRACE: "}"> : DEFAULT -} - -<IN_RULE> TOKEN : /* JAVA_CODE_RULE START */ -{ - <JAVA_CODE_START: <LEFT_BRACE>> : JAVA_CODE_RULE -} - -<JAVA_CODE_RULE> TOKEN : /* JAVA_CODE_RULE */ -{ - <JAVA_CODE: (~["}"])+ > -} - -<JAVA_CODE_RULE> TOKEN : /* JAVA_CODE_RULE END */ -{ - <JAVA_CODE_END: <RIGHT_BRACE>> : IN_RULE -} - - -<IN_PSEUDOCLASS> TOKEN : /* PROGRAMMATIC_PSEUDOCLASS */ -{ - <PROGRAMMATIC_PSEUDOCLASS: "{" (~["}"])+ "}"> : DEFAULT -} - -<IN_RULE> TOKEN : /* STRINGS */ -{ - <STRING: "\"" (~["\"", "\\", "\n", "\r"])* "\""> -} - -<IN_RULE> TOKEN : /* COLORS */ -{ - <HEXCOLOR: "#" <HEXDIGIT> <HEXDIGIT> <HEXDIGIT> (<HEXDIGIT> <HEXDIGIT> <HEXDIGIT>)?> -| - <#HEXDIGIT: ["0"-"9", "a"-"f", "A"-"F"]> -} - - -<IN_RULE> TOKEN : /* EMS */ -{ - <EMS: <DECIMAL_LITERAL> "em"> -} - - -<IN_RULE> TOKEN : /* EXS */ -{ - <EXS: <DECIMAL_LITERAL> "ex"> -} - - -<IN_RULE> TOKEN : /* LENGTH */ -{ - <LENGTH: <DECIMAL_LITERAL> ("pt" | "mm" | "cm" | "pc" | "in")> -} - - -SimpleNode Stylesheet() : {/*@bgen(jjtree) Stylesheet */ - SimpleNode jjtn000 = new SimpleNode(JJTSTYLESHEET); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) Stylesheet */ - try { -/*@egen*/ - (Rule())*/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - } -/*@egen*/ - { return jjtn000; }/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - - -void Rule() : {/*@bgen(jjtree) Rule */ - SimpleNode jjtn000 = new SimpleNode(JJTRULE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) Rule */ - try { -/*@egen*/ - Selectors() - <LEFT_BRACE> Declaration() (";" (Declaration())?)* <RIGHT_BRACE>/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - - -void Selectors() : {/*@bgen(jjtree) Selectors */ - SimpleNode jjtn000 = new SimpleNode(JJTSELECTORS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) Selectors */ - try { -/*@egen*/ - Selector() ("," Selector())*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - - -void Selector() : {/*@bgen(jjtree) Selector */ - SimpleNode jjtn000 = new SimpleNode(JJTSELECTOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) Selector */ - try { -/*@egen*/ - JavaClass() (Id())? (Class())? (PseudoClass())? -| - Id() (Class())? (PseudoClass())? -| - Class() (PseudoClass())? -| - PseudoClass()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - - -void JavaClass() : {/*@bgen(jjtree) JavaClass */ - SimpleNode jjtn000 = new SimpleNode(JJTJAVACLASS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) JavaClass */ - try { -/*@egen*/ - <IDENTIFIER> | "*"/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - - -void Id() : {/*@bgen(jjtree) Id */ - SimpleNode jjtn000 = new SimpleNode(JJTID); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) Id */ - try { -/*@egen*/ - "#" <IDENTIFIER>/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - - -void Class() : {/*@bgen(jjtree) Class */ - SimpleNode jjtn000 = new SimpleNode(JJTCLASS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) Class */ - try { -/*@egen*/ - "." <IDENTIFIER>/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - - -void PseudoClass() : {/*@bgen(jjtree) PseudoClass */ - SimpleNode jjtn000 = new SimpleNode(JJTPSEUDOCLASS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) PseudoClass */ - try { -/*@egen*/ - <PSEUDOCLASS_COLON> (<PSEUDOCLASS_IDENTIFIER> | <PROGRAMMATIC_PSEUDOCLASS>) (AnimationProperties())?/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - - -void AnimationProperties() : {/*@bgen(jjtree) AnimationProperties */ - SimpleNode jjtn000 = new SimpleNode(JJTANIMATIONPROPERTIES); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) AnimationProperties */ - try { -/*@egen*/ - "[" AnimationProperty() ("," AnimationProperty())* "]"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - - -void AnimationProperty() : {/*@bgen(jjtree) AnimationProperty */ - SimpleNode jjtn000 = new SimpleNode(JJTANIMATIONPROPERTY); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) AnimationProperty */ - try { -/*@egen*/ - <IDENTIFIER> "=" <DECIMAL_LITERAL> (<IDENTIFIER>)?/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - - -void Declaration() : {/*@bgen(jjtree) Declaration */ - SimpleNode jjtn000 = new SimpleNode(JJTDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) Declaration */ - try { -/*@egen*/ - Property() <COLON> Expression()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - - -void Property() : {/*@bgen(jjtree) Property */ - SimpleNode jjtn000 = new SimpleNode(JJTPROPERTY); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) Property */ - try { -/*@egen*/ - <IDENTIFIER>/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - - -void Expression() : {/*@bgen(jjtree) Expression */ - SimpleNode jjtn000 = new SimpleNode(JJTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) Expression */ - try { -/*@egen*/ - (<DECIMAL_LITERAL> | <STRING> | <IDENTIFIER> | <HEXCOLOR> | <EMS> | <EXS> | <LENGTH> | - JavaCode())/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - - -void JavaCode() : {/*@bgen(jjtree) JavaCode */ - SimpleNode jjtn000 = new SimpleNode(JJTJAVACODE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) JavaCode */ - try { -/*@egen*/ - <JAVA_CODE_START> <JAVA_CODE> <JAVA_CODE_END>/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - - -void Identifier() : {/*@bgen(jjtree) Identifier */ - SimpleNode jjtn000 = new SimpleNode(JJTIDENTIFIER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) Identifier */ - try { -/*@egen*/ - <IDENTIFIER>/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSS.jjt b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSS.jjt deleted file mode 100644 index 80cc349..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSS.jjt +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ - -// I would love to have used an existing CSS parser, but all of the ones I could -// find are licensed under the LGPL. As JAXX is BSD licensed and I'm not a big -// fan of the LGPL, unfortunately that won't work. -options { - STATIC = false; - JDK_VERSION = "1.4"; - NODE_SCOPE_HOOK = true; -} - -PARSER_BEGIN(CSSParser) -package jaxx.css; - -public class CSSParser { - public SimpleNode popNode() { - if ( jjtree.nodeArity() > 0) // number of child nodes - return (SimpleNode)jjtree.popNode(); - else - return null; - } - - void jjtreeOpenNodeScope(Node n) { - ((SimpleNode) n).firstToken = getToken(1); - } - - void jjtreeCloseNodeScope(Node n) { - ((SimpleNode) n).lastToken = getToken(0); - } - - public static void main(String args[]) { - System.out.println("Reading from standard input..."); - CSSParser css = new CSSParser(System.in); - try { - SimpleNode n = css.Stylesheet(); - n.dump(""); - System.out.println("Thank you."); - } catch (Exception e) { - System.out.println("Oops."); - System.out.println(e.getMessage()); - e.printStackTrace(); - } - } -} - -PARSER_END(CSSParser) - - -<DEFAULT, IN_RULE> SKIP : -{ - " " -| "\t" -| "\n" -| "\r" -| <"//" (~["\n","\r"])* ("\n"|"\r"|"\r\n")> -| <"/*" (~["*"])* "*" (~["/"] (~["*"])* "*")* "/"> -} - -<*> TOKEN : /* LITERALS */ -{ - <DECIMAL_LITERAL: <INTEGER_LITERAL> ("." <INTEGER_LITERAL>)?> -| - <#INTEGER_LITERAL: (["0"-"9"])+> -} - -<DEFAULT, IN_RULE> TOKEN : /* IDENTIFIER */ -{ - <IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)*> -| - <#LETTER: ["_", "-", "a"-"z", "A"-"Z"]> -| - <#DIGIT: ["0"-"9"]> -} - -<IN_PSEUDOCLASS> TOKEN : /* PSEUDOCLASS_IDENTIFIER */ -{ - <PSEUDOCLASS_IDENTIFIER: <IDENTIFIER>> : DEFAULT -} - -<DEFAULT> TOKEN: /* COLON */ -{ - <PSEUDOCLASS_COLON: ":"> : IN_PSEUDOCLASS -} - -<IN_RULE> TOKEN: /* COLON_IN_RULE */ -{ - <COLON: ":"> -} - -<*> TOKEN: /* SEMICOLON */ -{ - <SEMICOLON: ";"> -} - -TOKEN : /* LEFT BRACE */ -{ - <LEFT_BRACE: "{"> : IN_RULE -} - -<IN_RULE> TOKEN : /* RIGHT BRACE */ -{ - <RIGHT_BRACE: "}"> : DEFAULT -} - -<IN_RULE> TOKEN : /* JAVA_CODE_RULE START */ -{ - <JAVA_CODE_START: <LEFT_BRACE>> : JAVA_CODE_RULE -} - -<JAVA_CODE_RULE> TOKEN : /* JAVA_CODE_RULE */ -{ - <JAVA_CODE: (~["}"])+ > -} - -<JAVA_CODE_RULE> TOKEN : /* JAVA_CODE_RULE END */ -{ - <JAVA_CODE_END: <RIGHT_BRACE>> : IN_RULE -} - - -<IN_PSEUDOCLASS> TOKEN : /* PROGRAMMATIC_PSEUDOCLASS */ -{ - <PROGRAMMATIC_PSEUDOCLASS: "{" (~["}"])+ "}"> : DEFAULT -} - -<IN_RULE> TOKEN : /* STRINGS */ -{ - <STRING: "\"" (~["\"", "\\", "\n", "\r"])* "\""> -} - -<IN_RULE> TOKEN : /* COLORS */ -{ - <HEXCOLOR: "#" <HEXDIGIT> <HEXDIGIT> <HEXDIGIT> (<HEXDIGIT> <HEXDIGIT> <HEXDIGIT>)?> -| - <#HEXDIGIT: ["0"-"9", "a"-"f", "A"-"F"]> -} - - -<IN_RULE> TOKEN : /* EMS */ -{ - <EMS: <DECIMAL_LITERAL> "em"> -} - - -<IN_RULE> TOKEN : /* EXS */ -{ - <EXS: <DECIMAL_LITERAL> "ex"> -} - - -<IN_RULE> TOKEN : /* LENGTH */ -{ - <LENGTH: <DECIMAL_LITERAL> ("pt" | "mm" | "cm" | "pc" | "in")> -} - - -SimpleNode Stylesheet() : {} -{ - (Rule())* - { return jjtThis; } -} - - -void Rule() : {} -{ - Selectors() - <LEFT_BRACE> Declaration() (";" (Declaration())?)* <RIGHT_BRACE> -} - - -void Selectors() : {} -{ - Selector() ("," Selector())* -} - - -void Selector() : {} -{ - JavaClass() (Id())? (Class())? (PseudoClass())? -| - Id() (Class())? (PseudoClass())? -| - Class() (PseudoClass())? -| - PseudoClass() -} - - -void JavaClass() : {} -{ - <IDENTIFIER> | "*" -} - - -void Id() : {} -{ - "#" <IDENTIFIER> -} - - -void Class() : {} -{ - "." <IDENTIFIER> -} - - -void PseudoClass() : {} -{ - <PSEUDOCLASS_COLON> (<PSEUDOCLASS_IDENTIFIER> | <PROGRAMMATIC_PSEUDOCLASS>) (AnimationProperties())? -} - - -void AnimationProperties() : {} -{ - "[" AnimationProperty() ("," AnimationProperty())* "]" -} - - -void AnimationProperty() : {} -{ - <IDENTIFIER> "=" <DECIMAL_LITERAL> (<IDENTIFIER>)? -} - - -void Declaration() : {} -{ - Property() <COLON> Expression() -} - - -void Property() : {} -{ - <IDENTIFIER> -} - - -void Expression() : {} -{ - (<DECIMAL_LITERAL> | <STRING> | <IDENTIFIER> | <HEXCOLOR> | <EMS> | <EXS> | <LENGTH> | - JavaCode()) -} - - -void JavaCode() : {} -{ - <JAVA_CODE_START> <JAVA_CODE> <JAVA_CODE_END> -} - - -void Identifier() : {} -{ - <IDENTIFIER> -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParser.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParser.java deleted file mode 100644 index 4f3ec61..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParser.java +++ /dev/null @@ -1,799 +0,0 @@ -/* Generated By:JJTree&JavaCC: Do not edit this line. CSSParser.java */ -package jaxx.compiler.parser.css; - -public class CSSParser/*@bgen(jjtree)*/ implements CSSParserTreeConstants, CSSParserConstants {/*@bgen(jjtree)*/ - protected JJTCSSParserState jjtree = new JJTCSSParserState(); - - public SimpleNode popNode() { - if (jjtree.nodeArity() > 0) // number of child nodes - return (SimpleNode) jjtree.popNode(); - else - return null; - } - - void jjtreeOpenNodeScope(Node n) { - ((SimpleNode) n).firstToken = getToken(1); - } - - void jjtreeCloseNodeScope(Node n) { - ((SimpleNode) n).lastToken = getToken(0); - } - - public static void main(String args[]) { - System.out.println("Reading from standard input..."); - CSSParser css = new CSSParser(System.in); - try { - SimpleNode n = css.Stylesheet(); - n.dump(""); - System.out.println("Thank you."); - } catch (Exception e) { - System.out.println("Oops."); - System.out.println(e.getMessage()); - e.printStackTrace(); - } - } - - final public SimpleNode Stylesheet() throws ParseException { - /*@bgen(jjtree) Stylesheet */ - SimpleNode jjtn000 = new SimpleNode(JJTSTYLESHEET); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - label_1: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IDENTIFIER: - case PSEUDOCLASS_COLON: - case 29: - case 30: - case 31: - ; - break; - default: - jj_la1[0] = jj_gen; - break label_1; - } - Rule(); - } - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - { - if (true) return jjtn000; - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - throw new Error("Missing return statement in function"); - } - - final public void Rule() throws ParseException { - /*@bgen(jjtree) Rule */ - SimpleNode jjtn000 = new SimpleNode(JJTRULE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - Selectors(); - jj_consume_token(LEFT_BRACE); - Declaration(); - label_2: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case SEMICOLON: - ; - break; - default: - jj_la1[1] = jj_gen; - break label_2; - } - jj_consume_token(SEMICOLON); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IDENTIFIER: - Declaration(); - break; - default: - jj_la1[2] = jj_gen; - ; - } - } - jj_consume_token(RIGHT_BRACE); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Selectors() throws ParseException { - /*@bgen(jjtree) Selectors */ - SimpleNode jjtn000 = new SimpleNode(JJTSELECTORS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - Selector(); - label_3: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case 28: - ; - break; - default: - jj_la1[3] = jj_gen; - break label_3; - } - jj_consume_token(28); - Selector(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Selector() throws ParseException { - /*@bgen(jjtree) Selector */ - SimpleNode jjtn000 = new SimpleNode(JJTSELECTOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IDENTIFIER: - case 29: - JavaClass(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case 30: - Id(); - break; - default: - jj_la1[4] = jj_gen; - ; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case 31: - Class(); - break; - default: - jj_la1[5] = jj_gen; - ; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PSEUDOCLASS_COLON: - PseudoClass(); - break; - default: - jj_la1[6] = jj_gen; - ; - } - break; - case 30: - Id(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case 31: - Class(); - break; - default: - jj_la1[7] = jj_gen; - ; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PSEUDOCLASS_COLON: - PseudoClass(); - break; - default: - jj_la1[8] = jj_gen; - ; - } - break; - case 31: - Class(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PSEUDOCLASS_COLON: - PseudoClass(); - break; - default: - jj_la1[9] = jj_gen; - ; - } - break; - case PSEUDOCLASS_COLON: - PseudoClass(); - break; - default: - jj_la1[10] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void JavaClass() throws ParseException { - /*@bgen(jjtree) JavaClass */ - SimpleNode jjtn000 = new SimpleNode(JJTJAVACLASS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IDENTIFIER: - jj_consume_token(IDENTIFIER); - break; - case 29: - jj_consume_token(29); - break; - default: - jj_la1[11] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Id() throws ParseException { - /*@bgen(jjtree) Id */ - SimpleNode jjtn000 = new SimpleNode(JJTID); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(30); - jj_consume_token(IDENTIFIER); - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Class() throws ParseException { - /*@bgen(jjtree) Class */ - SimpleNode jjtn000 = new SimpleNode(JJTCLASS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(31); - jj_consume_token(IDENTIFIER); - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void PseudoClass() throws ParseException { - /*@bgen(jjtree) PseudoClass */ - SimpleNode jjtn000 = new SimpleNode(JJTPSEUDOCLASS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(PSEUDOCLASS_COLON); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PSEUDOCLASS_IDENTIFIER: - jj_consume_token(PSEUDOCLASS_IDENTIFIER); - break; - case PROGRAMMATIC_PSEUDOCLASS: - jj_consume_token(PROGRAMMATIC_PSEUDOCLASS); - break; - default: - jj_la1[12] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case 32: - AnimationProperties(); - break; - default: - jj_la1[13] = jj_gen; - ; - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void AnimationProperties() throws ParseException { - /*@bgen(jjtree) AnimationProperties */ - SimpleNode jjtn000 = new SimpleNode(JJTANIMATIONPROPERTIES); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(32); - AnimationProperty(); - label_4: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case 28: - ; - break; - default: - jj_la1[14] = jj_gen; - break label_4; - } - jj_consume_token(28); - AnimationProperty(); - } - jj_consume_token(33); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void AnimationProperty() throws ParseException { - /*@bgen(jjtree) AnimationProperty */ - SimpleNode jjtn000 = new SimpleNode(JJTANIMATIONPROPERTY); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(IDENTIFIER); - jj_consume_token(34); - jj_consume_token(DECIMAL_LITERAL); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IDENTIFIER: - jj_consume_token(IDENTIFIER); - break; - default: - jj_la1[15] = jj_gen; - ; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Declaration() throws ParseException { - /*@bgen(jjtree) Declaration */ - SimpleNode jjtn000 = new SimpleNode(JJTDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - Property(); - jj_consume_token(COLON); - Expression(); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Property() throws ParseException { - /*@bgen(jjtree) Property */ - SimpleNode jjtn000 = new SimpleNode(JJTPROPERTY); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(IDENTIFIER); - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Expression() throws ParseException { - /*@bgen(jjtree) Expression */ - SimpleNode jjtn000 = new SimpleNode(JJTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case DECIMAL_LITERAL: - jj_consume_token(DECIMAL_LITERAL); - break; - case STRING: - jj_consume_token(STRING); - break; - case IDENTIFIER: - jj_consume_token(IDENTIFIER); - break; - case HEXCOLOR: - jj_consume_token(HEXCOLOR); - break; - case EMS: - jj_consume_token(EMS); - break; - case EXS: - jj_consume_token(EXS); - break; - case LENGTH: - jj_consume_token(LENGTH); - break; - case JAVA_CODE_START: - JavaCode(); - break; - default: - jj_la1[16] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void JavaCode() throws ParseException { - /*@bgen(jjtree) JavaCode */ - SimpleNode jjtn000 = new SimpleNode(JJTJAVACODE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(JAVA_CODE_START); - jj_consume_token(JAVA_CODE); - jj_consume_token(JAVA_CODE_END); - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Identifier() throws ParseException { - /*@bgen(jjtree) Identifier */ - SimpleNode jjtn000 = new SimpleNode(JJTIDENTIFIER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(IDENTIFIER); - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - public CSSParserTokenManager token_source; - SimpleCharStream jj_input_stream; - public Token token, jj_nt; - private int jj_ntk; - private int jj_gen; - final private int[] jj_la1 = new int[17]; - static private int[] jj_la1_0; - static private int[] jj_la1_1; - - static { - jj_la1_0(); - jj_la1_1(); - } - - private static void jj_la1_0() { - jj_la1_0 = new int[]{0xe0002200, 0x8000, 0x200, 0x10000000, 0x40000000, 0x80000000, 0x2000, 0x80000000, 0x2000, 0x2000, 0xe0002200, 0x20000200, 0x201000, 0x0, 0x10000000, 0x200, 0xec40280,}; - } - - private static void jj_la1_1() { - jj_la1_1 = new int[]{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,}; - } - - public CSSParser(java.io.InputStream stream) { - this(stream, null); - } - - public CSSParser(java.io.InputStream stream, String encoding) { - try { - jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); - } catch (java.io.UnsupportedEncodingException e) { - throw new RuntimeException(e); - } - token_source = new CSSParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 17; i++) jj_la1[i] = -1; - } - - public void ReInit(java.io.InputStream stream) { - ReInit(stream, null); - } - - public void ReInit(java.io.InputStream stream, String encoding) { - try { - jj_input_stream.ReInit(stream, encoding, 1, 1); - } catch (java.io.UnsupportedEncodingException e) { - throw new RuntimeException(e); - } - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jjtree.reset(); - jj_gen = 0; - for (int i = 0; i < 17; i++) jj_la1[i] = -1; - } - - public CSSParser(java.io.Reader stream) { - jj_input_stream = new SimpleCharStream(stream, 1, 1); - token_source = new CSSParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 17; i++) jj_la1[i] = -1; - } - - public void ReInit(java.io.Reader stream) { - jj_input_stream.ReInit(stream, 1, 1); - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jjtree.reset(); - jj_gen = 0; - for (int i = 0; i < 17; i++) jj_la1[i] = -1; - } - - public CSSParser(CSSParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 17; i++) jj_la1[i] = -1; - } - - public void ReInit(CSSParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jjtree.reset(); - jj_gen = 0; - for (int i = 0; i < 17; i++) jj_la1[i] = -1; - } - - final private Token jj_consume_token(int kind) throws ParseException { - Token oldToken; - if ((oldToken = token).next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - if (token.kind == kind) { - jj_gen++; - return token; - } - token = oldToken; - jj_kind = kind; - throw generateParseException(); - } - - final public Token getNextToken() { - if (token.next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - jj_gen++; - return token; - } - - final public Token getToken(int index) { - Token t = token; - for (int i = 0; i < index; i++) { - if (t.next != null) t = t.next; - else t = t.next = token_source.getNextToken(); - } - return t; - } - - final private int jj_ntk() { - if ((jj_nt = token.next) == null) - return (jj_ntk = (token.next = token_source.getNextToken()).kind); - else - return (jj_ntk = jj_nt.kind); - } - - private java.util.Vector jj_expentries = new java.util.Vector(); - private int[] jj_expentry; - private int jj_kind = -1; - - public ParseException generateParseException() { - Token errortok = token.next; - int line = errortok.beginLine, column = errortok.beginColumn; - String mess = (errortok.kind == 0) ? tokenImage[0] : errortok.image; - return new ParseException("Parse error. Encountered: " + mess, line, column); - } - - final public void enable_tracing() { - } - - final public void disable_tracing() { - } - -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParserConstants.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParserConstants.java deleted file mode 100644 index fba80d5..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParserConstants.java +++ /dev/null @@ -1,72 +0,0 @@ -/* Generated By:JJTree&JavaCC: Do not edit this line. CSSParserConstants.java */ -package jaxx.compiler.parser.css; - -public interface CSSParserConstants { - - int EOF = 0; - int DECIMAL_LITERAL = 7; - int INTEGER_LITERAL = 8; - int IDENTIFIER = 9; - int LETTER = 10; - int DIGIT = 11; - int PSEUDOCLASS_IDENTIFIER = 12; - int PSEUDOCLASS_COLON = 13; - int COLON = 14; - int SEMICOLON = 15; - int LEFT_BRACE = 16; - int RIGHT_BRACE = 17; - int JAVA_CODE_START = 18; - int JAVA_CODE = 19; - int JAVA_CODE_END = 20; - int PROGRAMMATIC_PSEUDOCLASS = 21; - int STRING = 22; - int HEXCOLOR = 23; - int HEXDIGIT = 24; - int EMS = 25; - int EXS = 26; - int LENGTH = 27; - - int DEFAULT = 0; - int IN_RULE = 1; - int JAVA_CODE_RULE = 2; - int IN_PSEUDOCLASS = 3; - - String[] tokenImage = { - "<EOF>", - "\" \"", - "\"\\t\"", - "\"\\n\"", - "\"\\r\"", - "<token of kind 5>", - "<token of kind 6>", - "<DECIMAL_LITERAL>", - "<INTEGER_LITERAL>", - "<IDENTIFIER>", - "<LETTER>", - "<DIGIT>", - "<PSEUDOCLASS_IDENTIFIER>", - "\":\"", - "\":\"", - "\";\"", - "\"{\"", - "\"}\"", - "<JAVA_CODE_START>", - "<JAVA_CODE>", - "<JAVA_CODE_END>", - "<PROGRAMMATIC_PSEUDOCLASS>", - "<STRING>", - "<HEXCOLOR>", - "<HEXDIGIT>", - "<EMS>", - "<EXS>", - "<LENGTH>", - "\",\"", - "\"*\"", - "\"#\"", - "\".\"", - "\"[\"", - "\"]\"", - "\"=\"", - }; - -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParserTokenManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParserTokenManager.java deleted file mode 100644 index cd67bae..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParserTokenManager.java +++ /dev/null @@ -1,1152 +0,0 @@ -/* Generated By:JJTree&JavaCC: Do not edit this line. CSSParserTokenManager.java */ -package jaxx.compiler.parser.css; - -public class CSSParserTokenManager implements CSSParserConstants { - public java.io.PrintStream debugStream = System.out; - - public void setDebugStream(java.io.PrintStream ds) { - debugStream = ds; - } - - private int jjStopStringLiteralDfa_0(int pos, long active0) { - switch (pos) { - default: - return -1; - } - } - - private int jjStartNfa_0(int pos, long active0) { - return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); - } - - private int jjStopAtPos(int pos, int kind) { - jjmatchedKind = kind; - jjmatchedPos = pos; - return pos + 1; - } - - private int jjStartNfaWithStates_0(int pos, int kind, int state) { - jjmatchedKind = kind; - jjmatchedPos = pos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return pos + 1; - } - return jjMoveNfa_0(state, pos + 1); - } - - private int jjMoveStringLiteralDfa0_0() { - switch (curChar) { - case 35: - return jjStopAtPos(0, 30); - case 42: - return jjStopAtPos(0, 29); - case 44: - return jjStopAtPos(0, 28); - case 46: - return jjStopAtPos(0, 31); - case 58: - return jjStopAtPos(0, 13); - case 59: - return jjStopAtPos(0, 15); - case 61: - return jjStopAtPos(0, 34); - case 91: - return jjStopAtPos(0, 32); - case 93: - return jjStopAtPos(0, 33); - case 123: - return jjStopAtPos(0, 16); - default: - return jjMoveNfa_0(3, 0); - } - } - - private void jjCheckNAdd(int state) { - if (jjrounds[state] != jjround) { - jjstateSet[jjnewStateCnt++] = state; - jjrounds[state] = jjround; - } - } - - private void jjAddStates(int start, int end) { - do { - jjstateSet[jjnewStateCnt++] = jjnextStates[start]; - } while (start++ != end); - } - - private void jjCheckNAddTwoStates(int state1, int state2) { - jjCheckNAdd(state1); - jjCheckNAdd(state2); - } - - private void jjCheckNAddStates(int start, int end) { - do { - jjCheckNAdd(jjnextStates[start]); - } while (start++ != end); - } - - private void jjCheckNAddStates(int start) { - jjCheckNAdd(jjnextStates[start]); - jjCheckNAdd(jjnextStates[start + 1]); - } - - static final long[] jjbitVec0 = { - 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL - }; - - private int jjMoveNfa_0(int startState, int curPos) { - int[] nextStates; - int startsAt = 0; - jjnewStateCnt = 17; - int i = 1; - jjstateSet[0] = startState; - int j, kind = 0x7fffffff; - for (; ;) { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) { - long l = 1L << curChar; - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 3: - if ((0x3ff000000000000L & l) != 0L) { - if (kind > 7) - kind = 7; - jjCheckNAddTwoStates(0, 1); - } else if (curChar == 47) - jjAddStates(0, 1); - else if (curChar == 45) { - if (kind > 9) - kind = 9; - jjCheckNAdd(4); - } - break; - case 0: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 7) - kind = 7; - jjCheckNAddTwoStates(0, 1); - break; - case 1: - if (curChar == 46) - jjCheckNAdd(2); - break; - case 2: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 7) - kind = 7; - jjCheckNAdd(2); - break; - case 4: - if ((0x3ff200000000000L & l) == 0L) - break; - if (kind > 9) - kind = 9; - jjCheckNAdd(4); - break; - case 5: - if (curChar == 47) - jjAddStates(0, 1); - break; - case 6: - if (curChar == 47) - jjCheckNAddStates(2, 4); - break; - case 7: - if ((0xffffffffffffdbffL & l) != 0L) - jjCheckNAddStates(2, 4); - break; - case 8: - if ((0x2400L & l) != 0L && kind > 5) - kind = 5; - break; - case 9: - if (curChar == 10 && kind > 5) - kind = 5; - break; - case 10: - if (curChar == 13) - jjstateSet[jjnewStateCnt++] = 9; - break; - case 11: - if (curChar == 42) - jjCheckNAddTwoStates(12, 13); - break; - case 12: - if ((0xfffffbffffffffffL & l) != 0L) - jjCheckNAddTwoStates(12, 13); - break; - case 13: - if (curChar == 42) - jjAddStates(5, 6); - break; - case 14: - if ((0xffff7fffffffffffL & l) != 0L) - jjCheckNAddTwoStates(15, 13); - break; - case 15: - if ((0xfffffbffffffffffL & l) != 0L) - jjCheckNAddTwoStates(15, 13); - break; - case 16: - if (curChar == 47 && kind > 6) - kind = 6; - break; - default: - break; - } - } while (i != startsAt); - } else if (curChar < 128) { - long l = 1L << (curChar & 077); - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 3: - case 4: - if ((0x7fffffe87fffffeL & l) == 0L) - break; - if (kind > 9) - kind = 9; - jjCheckNAdd(4); - break; - case 7: - jjAddStates(2, 4); - break; - case 12: - jjCheckNAddTwoStates(12, 13); - break; - case 14: - case 15: - jjCheckNAddTwoStates(15, 13); - break; - default: - break; - } - } while (i != startsAt); - } else { - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 7: - if ((jjbitVec0[i2] & l2) != 0L) - jjAddStates(2, 4); - break; - case 12: - if ((jjbitVec0[i2] & l2) != 0L) - jjCheckNAddTwoStates(12, 13); - break; - case 14: - case 15: - if ((jjbitVec0[i2] & l2) != 0L) - jjCheckNAddTwoStates(15, 13); - break; - default: - break; - } - } while (i != startsAt); - } - if (kind != 0x7fffffff) { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 17 - (jjnewStateCnt = startsAt))) - return curPos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return curPos; - } - } - } - - private int jjStopStringLiteralDfa_3(int pos, long active0) { - switch (pos) { - default: - return -1; - } - } - - private int jjStartNfa_3(int pos, long active0) { - return jjMoveNfa_3(jjStopStringLiteralDfa_3(pos, active0), pos + 1); - } - - private int jjStartNfaWithStates_3(int pos, int kind, int state) { - jjmatchedKind = kind; - jjmatchedPos = pos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return pos + 1; - } - return jjMoveNfa_3(state, pos + 1); - } - - private int jjMoveStringLiteralDfa0_3() { - switch (curChar) { - case 59: - return jjStopAtPos(0, 15); - default: - return jjMoveNfa_3(3, 0); - } - } - - private int jjMoveNfa_3(int startState, int curPos) { - int[] nextStates; - int startsAt = 0; - jjnewStateCnt = 8; - int i = 1; - jjstateSet[0] = startState; - int j, kind = 0x7fffffff; - for (; ;) { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) { - long l = 1L << curChar; - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 3: - if ((0x3ff000000000000L & l) != 0L) { - if (kind > 7) - kind = 7; - jjCheckNAddTwoStates(0, 1); - } else if (curChar == 45) { - if (kind > 12) - kind = 12; - jjCheckNAdd(4); - } - break; - case 0: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 7) - kind = 7; - jjCheckNAddTwoStates(0, 1); - break; - case 1: - if (curChar == 46) - jjCheckNAdd(2); - break; - case 2: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 7) - kind = 7; - jjCheckNAdd(2); - break; - case 4: - if ((0x3ff200000000000L & l) == 0L) - break; - if (kind > 12) - kind = 12; - jjCheckNAdd(4); - break; - case 6: - jjAddStates(7, 8); - break; - default: - break; - } - } while (i != startsAt); - } else if (curChar < 128) { - long l = 1L << (curChar & 077); - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 3: - if ((0x7fffffe87fffffeL & l) != 0L) { - if (kind > 12) - kind = 12; - jjCheckNAdd(4); - } else if (curChar == 123) - jjCheckNAdd(6); - break; - case 4: - if ((0x7fffffe87fffffeL & l) == 0L) - break; - if (kind > 12) - kind = 12; - jjCheckNAdd(4); - break; - case 5: - if (curChar == 123) - jjCheckNAdd(6); - break; - case 6: - if ((0xdfffffffffffffffL & l) != 0L) - jjCheckNAddTwoStates(6, 7); - break; - case 7: - if (curChar == 125) - kind = 21; - break; - default: - break; - } - } while (i != startsAt); - } else { - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 6: - if ((jjbitVec0[i2] & l2) != 0L) - jjAddStates(7, 8); - break; - default: - break; - } - } while (i != startsAt); - } - if (kind != 0x7fffffff) { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 8 - (jjnewStateCnt = startsAt))) - return curPos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return curPos; - } - } - } - - private int jjStopStringLiteralDfa_1(int pos, long active0) { - switch (pos) { - default: - return -1; - } - } - - private int jjStartNfa_1(int pos, long active0) { - return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0), pos + 1); - } - - private int jjStartNfaWithStates_1(int pos, int kind, int state) { - jjmatchedKind = kind; - jjmatchedPos = pos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return pos + 1; - } - return jjMoveNfa_1(state, pos + 1); - } - - private int jjMoveStringLiteralDfa0_1() { - switch (curChar) { - case 58: - return jjStopAtPos(0, 14); - case 59: - return jjStopAtPos(0, 15); - case 125: - return jjStopAtPos(0, 17); - default: - return jjMoveNfa_1(0, 0); - } - } - - private int jjMoveNfa_1(int startState, int curPos) { - int[] nextStates; - int startsAt = 0; - jjnewStateCnt = 50; - int i = 1; - jjstateSet[0] = startState; - int j, kind = 0x7fffffff; - for (; ;) { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) { - long l = 1L << curChar; - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 0: - if ((0x3ff000000000000L & l) != 0L) { - if (kind > 7) - kind = 7; - jjCheckNAddStates(9, 22); - } else if (curChar == 47) - jjAddStates(23, 24); - else if (curChar == 35) - jjstateSet[jjnewStateCnt++] = 7; - else if (curChar == 34) - jjCheckNAddTwoStates(4, 5); - else if (curChar == 45) { - if (kind > 9) - kind = 9; - jjCheckNAdd(1); - } - break; - case 1: - if ((0x3ff200000000000L & l) == 0L) - break; - if (kind > 9) - kind = 9; - jjCheckNAdd(1); - break; - case 3: - if (curChar == 34) - jjCheckNAddTwoStates(4, 5); - break; - case 4: - if ((0xfffffffbffffdbffL & l) != 0L) - jjCheckNAddTwoStates(4, 5); - break; - case 5: - if (curChar == 34 && kind > 22) - kind = 22; - break; - case 6: - if (curChar == 35) - jjstateSet[jjnewStateCnt++] = 7; - break; - case 7: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 8; - break; - case 8: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 9; - break; - case 9: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 23) - kind = 23; - jjstateSet[jjnewStateCnt++] = 10; - break; - case 10: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 11; - break; - case 11: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 12; - break; - case 12: - if ((0x3ff000000000000L & l) != 0L && kind > 23) - kind = 23; - break; - case 13: - if (curChar == 47) - jjAddStates(23, 24); - break; - case 14: - if (curChar == 47) - jjCheckNAddStates(25, 27); - break; - case 15: - if ((0xffffffffffffdbffL & l) != 0L) - jjCheckNAddStates(25, 27); - break; - case 16: - if ((0x2400L & l) != 0L && kind > 5) - kind = 5; - break; - case 17: - if (curChar == 10 && kind > 5) - kind = 5; - break; - case 18: - if (curChar == 13) - jjstateSet[jjnewStateCnt++] = 17; - break; - case 19: - if (curChar == 42) - jjCheckNAddTwoStates(20, 21); - break; - case 20: - if ((0xfffffbffffffffffL & l) != 0L) - jjCheckNAddTwoStates(20, 21); - break; - case 21: - if (curChar == 42) - jjAddStates(28, 29); - break; - case 22: - if ((0xffff7fffffffffffL & l) != 0L) - jjCheckNAddTwoStates(23, 21); - break; - case 23: - if ((0xfffffbffffffffffL & l) != 0L) - jjCheckNAddTwoStates(23, 21); - break; - case 24: - if (curChar == 47 && kind > 6) - kind = 6; - break; - case 25: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 7) - kind = 7; - jjCheckNAddStates(9, 22); - break; - case 26: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 7) - kind = 7; - jjCheckNAddTwoStates(26, 27); - break; - case 27: - if (curChar == 46) - jjCheckNAdd(28); - break; - case 28: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 7) - kind = 7; - jjCheckNAdd(28); - break; - case 29: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(30, 32); - break; - case 30: - if (curChar == 46) - jjCheckNAdd(31); - break; - case 31: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(31, 33); - break; - case 34: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(33, 35); - break; - case 35: - if (curChar == 46) - jjCheckNAdd(36); - break; - case 36: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(36, 38); - break; - case 39: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(36, 41); - break; - case 40: - if (curChar == 46) - jjCheckNAdd(41); - break; - case 41: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(42, 46); - break; - default: - break; - } - } while (i != startsAt); - } else if (curChar < 128) { - long l = 1L << (curChar & 077); - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 0: - if ((0x7fffffe87fffffeL & l) != 0L) { - if (kind > 9) - kind = 9; - jjCheckNAdd(1); - } else if (curChar == 123) { - if (kind > 18) - kind = 18; - } - break; - case 1: - if ((0x7fffffe87fffffeL & l) == 0L) - break; - if (kind > 9) - kind = 9; - jjCheckNAdd(1); - break; - case 2: - if (curChar == 123 && kind > 18) - kind = 18; - break; - case 4: - if ((0xffffffffefffffffL & l) != 0L) - jjAddStates(47, 48); - break; - case 7: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 8; - break; - case 8: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 9; - break; - case 9: - if ((0x7e0000007eL & l) == 0L) - break; - if (kind > 23) - kind = 23; - jjstateSet[jjnewStateCnt++] = 10; - break; - case 10: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 11; - break; - case 11: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 12; - break; - case 12: - if ((0x7e0000007eL & l) != 0L && kind > 23) - kind = 23; - break; - case 15: - jjAddStates(25, 27); - break; - case 20: - jjCheckNAddTwoStates(20, 21); - break; - case 22: - case 23: - jjCheckNAddTwoStates(23, 21); - break; - case 32: - if (curChar == 109 && kind > 25) - kind = 25; - break; - case 33: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 32; - break; - case 37: - if (curChar == 120 && kind > 26) - kind = 26; - break; - case 38: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 37; - break; - case 42: - if (curChar == 109 && kind > 27) - kind = 27; - break; - case 43: - if (curChar == 109) - jjCheckNAdd(42); - break; - case 44: - if (curChar == 99) - jjCheckNAdd(42); - break; - case 45: - if (curChar == 110 && kind > 27) - kind = 27; - break; - case 46: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 45; - break; - case 47: - if (curChar == 112) - jjAddStates(49, 50); - break; - case 48: - if (curChar == 116 && kind > 27) - kind = 27; - break; - case 49: - if (curChar == 99 && kind > 27) - kind = 27; - break; - default: - break; - } - } while (i != startsAt); - } else { - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 4: - if ((jjbitVec0[i2] & l2) != 0L) - jjAddStates(47, 48); - break; - case 15: - if ((jjbitVec0[i2] & l2) != 0L) - jjAddStates(25, 27); - break; - case 20: - if ((jjbitVec0[i2] & l2) != 0L) - jjCheckNAddTwoStates(20, 21); - break; - case 22: - case 23: - if ((jjbitVec0[i2] & l2) != 0L) - jjCheckNAddTwoStates(23, 21); - break; - default: - break; - } - } while (i != startsAt); - } - if (kind != 0x7fffffff) { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 50 - (jjnewStateCnt = startsAt))) - return curPos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return curPos; - } - } - } - - private int jjStopStringLiteralDfa_2(int pos, long active0) { - switch (pos) { - default: - return -1; - } - } - - private int jjStartNfa_2(int pos, long active0) { - return jjMoveNfa_2(jjStopStringLiteralDfa_2(pos, active0), pos + 1); - } - - private int jjStartNfaWithStates_2(int pos, int kind, int state) { - jjmatchedKind = kind; - jjmatchedPos = pos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return pos + 1; - } - return jjMoveNfa_2(state, pos + 1); - } - - private int jjMoveStringLiteralDfa0_2() { - switch (curChar) { - case 59: - return jjStartNfaWithStates_2(0, 15, 3); - default: - return jjMoveNfa_2(4, 0); - } - } - - private int jjMoveNfa_2(int startState, int curPos) { - int[] nextStates; - int startsAt = 0; - jjnewStateCnt = 5; - int i = 1; - jjstateSet[0] = startState; - int j, kind = 0x7fffffff; - for (; ;) { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) { - long l = 1L << curChar; - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 4: - if (kind > 19) - kind = 19; - jjCheckNAdd(3); - if ((0x3ff000000000000L & l) != 0L) { - if (kind > 7) - kind = 7; - jjCheckNAddTwoStates(0, 1); - } - break; - case 0: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 7) - kind = 7; - jjCheckNAddTwoStates(0, 1); - break; - case 1: - if (curChar == 46) - jjCheckNAdd(2); - break; - case 2: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 7) - kind = 7; - jjCheckNAdd(2); - break; - case 3: - if (kind > 19) - kind = 19; - jjCheckNAdd(3); - break; - default: - break; - } - } while (i != startsAt); - } else if (curChar < 128) { - long l = 1L << (curChar & 077); - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 4: - if ((0xdfffffffffffffffL & l) != 0L) { - if (kind > 19) - kind = 19; - jjCheckNAdd(3); - } else if (curChar == 125) { - if (kind > 20) - kind = 20; - } - break; - case 3: - if ((0xdfffffffffffffffL & l) == 0L) - break; - kind = 19; - jjCheckNAdd(3); - break; - default: - break; - } - } while (i != startsAt); - } else { - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 4: - case 3: - if ((jjbitVec0[i2] & l2) == 0L) - break; - if (kind > 19) - kind = 19; - jjCheckNAdd(3); - break; - default: - break; - } - } while (i != startsAt); - } - if (kind != 0x7fffffff) { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 5 - (jjnewStateCnt = startsAt))) - return curPos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return curPos; - } - } - } - - static final int[] jjnextStates = { - 6, 11, 7, 8, 10, 14, 16, 6, 7, 26, 27, 29, 30, 33, 34, 35, - 38, 39, 40, 43, 44, 46, 47, 14, 19, 15, 16, 18, 22, 24, 29, 30, - 33, 34, 35, 38, 39, 40, 43, 44, 46, 47, 41, 43, 44, 46, 47, 4, - 5, 48, 49, - }; - public static final String[] jjstrLiteralImages = { - "", null, null, null, null, null, null, null, null, null, null, null, null, - "\72", "\72", "\73", "\173", "\175", null, null, null, null, null, null, null, null, - null, null, "\54", "\52", "\43", "\56", "\133", "\135", "\75",}; - public static final String[] lexStateNames = { - "DEFAULT", - "IN_RULE", - "JAVA_CODE_RULE", - "IN_PSEUDOCLASS", - }; - public static final int[] jjnewLexState = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 3, -1, -1, 1, 0, 2, -1, 1, 0, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - }; - static final long[] jjtoToken = { - 0x7fefff281L, - }; - static final long[] jjtoSkip = { - 0x7eL, - }; - protected SimpleCharStream input_stream; - private final int[] jjrounds = new int[50]; - private final int[] jjstateSet = new int[100]; - protected char curChar; - - public CSSParserTokenManager(SimpleCharStream stream) { - if (SimpleCharStream.staticFlag) - throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); - input_stream = stream; - } - - public CSSParserTokenManager(SimpleCharStream stream, int lexState) { - this(stream); - SwitchTo(lexState); - } - - public void ReInit(SimpleCharStream stream) { - jjmatchedPos = jjnewStateCnt = 0; - curLexState = defaultLexState; - input_stream = stream; - ReInitRounds(); - } - - private void ReInitRounds() { - int i; - jjround = 0x80000001; - for (i = 50; i-- > 0;) - jjrounds[i] = 0x80000000; - } - - public void ReInit(SimpleCharStream stream, int lexState) { - ReInit(stream); - SwitchTo(lexState); - } - - public void SwitchTo(int lexState) { - if (lexState >= 4 || lexState < 0) - throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - else - curLexState = lexState; - } - - protected Token jjFillToken() { - Token t = Token.newToken(jjmatchedKind); - t.kind = jjmatchedKind; - String im = jjstrLiteralImages[jjmatchedKind]; - t.image = (im == null) ? input_stream.GetImage() : im; - t.beginLine = input_stream.getBeginLine(); - t.beginColumn = input_stream.getBeginColumn(); - t.endLine = input_stream.getEndLine(); - t.endColumn = input_stream.getEndColumn(); - return t; - } - - int curLexState = 0; - int defaultLexState = 0; - int jjnewStateCnt; - int jjround; - int jjmatchedPos; - int jjmatchedKind; - - public Token getNextToken() { - int kind; - Token specialToken = null; - Token matchedToken; - int curPos = 0; - - EOFLoop: - for (; ;) { - try { - curChar = input_stream.BeginToken(); - } - catch (java.io.IOException e) { - jjmatchedKind = 0; - matchedToken = jjFillToken(); - return matchedToken; - } - - switch (curLexState) { - case 0: - try { - input_stream.backup(0); - while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L) - curChar = input_stream.BeginToken(); - } - catch (java.io.IOException e1) { - continue EOFLoop; - } - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_0(); - break; - case 1: - try { - input_stream.backup(0); - while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L) - curChar = input_stream.BeginToken(); - } - catch (java.io.IOException e1) { - continue EOFLoop; - } - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_1(); - break; - case 2: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_2(); - break; - case 3: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_3(); - break; - } - if (jjmatchedKind != 0x7fffffff) { - if (jjmatchedPos + 1 < curPos) - input_stream.backup(curPos - jjmatchedPos - 1); - if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { - matchedToken = jjFillToken(); - if (jjnewLexState[jjmatchedKind] != -1) - curLexState = jjnewLexState[jjmatchedKind]; - return matchedToken; - } else { - if (jjnewLexState[jjmatchedKind] != -1) - curLexState = jjnewLexState[jjmatchedKind]; - continue EOFLoop; - } - } - int error_line = input_stream.getEndLine(); - int error_column = input_stream.getEndColumn(); - String error_after = null; - boolean EOFSeen = false; - try { - input_stream.readChar(); - input_stream.backup(1); - } - catch (java.io.IOException e1) { - EOFSeen = true; - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - if (curChar == '\n' || curChar == '\r') { - error_line++; - error_column = 0; - } else - error_column++; - } - if (!EOFSeen) { - input_stream.backup(1); - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - } - throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); - } - } - -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParserTreeConstants.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParserTreeConstants.java deleted file mode 100644 index ae5e812..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/CSSParserTreeConstants.java +++ /dev/null @@ -1,40 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. .\CSSParserTreeConstants.java */ - -package jaxx.compiler.parser.css; - -public interface CSSParserTreeConstants { - public int JJTSTYLESHEET = 0; - public int JJTRULE = 1; - public int JJTSELECTORS = 2; - public int JJTSELECTOR = 3; - public int JJTJAVACLASS = 4; - public int JJTID = 5; - public int JJTCLASS = 6; - public int JJTPSEUDOCLASS = 7; - public int JJTANIMATIONPROPERTIES = 8; - public int JJTANIMATIONPROPERTY = 9; - public int JJTDECLARATION = 10; - public int JJTPROPERTY = 11; - public int JJTEXPRESSION = 12; - public int JJTJAVACODE = 13; - public int JJTIDENTIFIER = 14; - - - public String[] jjtNodeName = { - "Stylesheet", - "Rule", - "Selectors", - "Selector", - "JavaClass", - "Id", - "Class", - "PseudoClass", - "AnimationProperties", - "AnimationProperty", - "Declaration", - "Property", - "Expression", - "JavaCode", - "Identifier", - }; -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/JJTCSSParserState.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/JJTCSSParserState.java deleted file mode 100644 index 1388962..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/JJTCSSParserState.java +++ /dev/null @@ -1,123 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. .\JJTCSSParserState.java */ - -package jaxx.compiler.parser.css; - -class JJTCSSParserState { - private java.util.Stack<Node> nodes; - private java.util.Stack<Integer> marks; - - private int sp; // number of nodes on stack - private int mk; // current mark - private boolean node_created; - - JJTCSSParserState() { - nodes = new java.util.Stack<Node>(); - marks = new java.util.Stack<Integer>(); - sp = 0; - mk = 0; - } - - /* Determines whether the current node was actually closed and - pushed. This should only be called in the final user action of a - node scope. */ - boolean nodeCreated() { - return node_created; - } - - /* Call this to reinitialize the node stack. It is called -automatically by the parser's ReInit() method. */ - void reset() { - nodes.removeAllElements(); - marks.removeAllElements(); - sp = 0; - mk = 0; - } - - /* Returns the root node of the AST. It only makes sense to call -this after a successful parse. */ - Node rootNode() { - return nodes.elementAt(0); - } - - /* Pushes a node on to the stack. */ - void pushNode(Node n) { - nodes.push(n); - ++sp; - } - - /* Returns the node on the top of the stack, and remove it from the - stack. */ - Node popNode() { - if (--sp < mk) { - mk = marks.pop(); - } - return nodes.pop(); - } - - /* Returns the node currently on the top of the stack. */ - Node peekNode() { - return nodes.peek(); - } - - /* Returns the number of children on the stack in the current node - scope. */ - int nodeArity() { - return sp - mk; - } - - - void clearNodeScope(Node n) { - while (sp > mk) { - popNode(); - } - mk = marks.pop(); - } - - - void openNodeScope(Node n) { - marks.push(mk); - mk = sp; - n.jjtOpen(); - } - - - /* A definite node is constructed from a specified number of -children. That number of nodes are popped from the stack and -made the children of the definite node. Then the definite node -is pushed on to the stack. */ - void closeNodeScope(Node n, int num) { - mk = marks.pop(); - while (num-- > 0) { - Node c = popNode(); - c.jjtSetParent(n); - n.jjtAddChild(c, num); - } - n.jjtClose(); - pushNode(n); - node_created = true; - } - - - /* A conditional node is constructed if its condition is true. All -the nodes that have been pushed since the node was opened are -made children of the the conditional node, which is then pushed -on to the stack. If the condition is false the node is not -constructed and they are left on the stack. */ - void closeNodeScope(Node n, boolean condition) { - if (condition) { - int a = nodeArity(); - mk = marks.pop(); - while (a-- > 0) { - Node c = popNode(); - c.jjtSetParent(n); - n.jjtAddChild(c, a); - } - n.jjtClose(); - pushNode(n); - node_created = true; - } else { - mk = marks.pop(); - node_created = false; - } - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/Node.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/Node.java deleted file mode 100644 index e625f18..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/Node.java +++ /dev/null @@ -1,51 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. Node.java */ - -package jaxx.compiler.parser.css; - -/* All AST nodes must implement this interface. It provides basic - machinery for constructing the parent and child relationships - between nodes. */ - -public interface Node { - - /** - * This method is called after the node has been made the current - * node. It indicates that child nodes can now be added to it. - */ - public void jjtOpen(); - - /** - * This method is called after all the child nodes have been - * added. - */ - public void jjtClose(); - - /** - * This pair of methods are used to inform the node of its - * parent. - * - * @param n node - */ - public void jjtSetParent(Node n); - - public Node jjtGetParent(); - - /** - * This method tells the node to add its argument to the node's - * list of children. - * - * @param n node - * @param i pos - */ - public void jjtAddChild(Node n, int i); - - /** - * @param i pos - * @return a child node. The children are numbered - * from zero, left to right. - */ - public Node jjtGetChild(int i); - - /** @return the number of children the node has. */ - public int jjtGetNumChildren(); -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/ParseException.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/ParseException.java deleted file mode 100644 index ef13517..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/ParseException.java +++ /dev/null @@ -1,20 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */ -package jaxx.compiler.parser.css; - -public class ParseException extends jaxx.compiler.parser.java.ParseException { - private static final long serialVersionUID = 229575674880359031L; - - public ParseException() { - super(); - } - - - public ParseException(String message) { - super(message); - } - - - public ParseException(String message, int line, int column) { - super(message, line, column); - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/SimpleCharStream.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/SimpleCharStream.java deleted file mode 100644 index 7375608..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/SimpleCharStream.java +++ /dev/null @@ -1,398 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 4.0 */ -package jaxx.compiler.parser.css; - -/** - * An implementation of interface CharStream, where the stream is assumed to - * contain only ASCII characters (without unicode processing). - */ - -public class SimpleCharStream { - public static final boolean staticFlag = false; - int bufsize; - int available; - int tokenBegin; - public int bufpos = -1; - protected int bufline[]; - protected int bufcolumn[]; - - protected int column = 0; - protected int line = 1; - - protected boolean prevCharIsCR = false; - protected boolean prevCharIsLF = false; - - protected java.io.Reader inputStream; - - protected char[] buffer; - protected int maxNextCharInd = 0; - protected int inBuf = 0; - protected int tabSize = 8; - - protected void setTabSize(int i) { - tabSize = i; - } - - protected int getTabSize(int i) { - return tabSize; - } - - - protected void ExpandBuff(boolean wrapAround) { - char[] newbuffer = new char[bufsize + 2048]; - int newbufline[] = new int[bufsize + 2048]; - int newbufcolumn[] = new int[bufsize + 2048]; - - try { - if (wrapAround) { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - System.arraycopy(buffer, 0, newbuffer, - bufsize - tokenBegin, bufpos); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); - bufcolumn = newbufcolumn; - - maxNextCharInd = (bufpos += (bufsize - tokenBegin)); - } else { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - bufcolumn = newbufcolumn; - - maxNextCharInd = (bufpos -= tokenBegin); - } - } - catch (Throwable t) { - throw new Error(t.getMessage()); - } - - - bufsize += 2048; - available = bufsize; - tokenBegin = 0; - } - - protected void FillBuff() throws java.io.IOException { - if (maxNextCharInd == available) { - if (available == bufsize) { - if (tokenBegin > 2048) { - bufpos = maxNextCharInd = 0; - available = tokenBegin; - } else if (tokenBegin < 0) - bufpos = maxNextCharInd = 0; - else - ExpandBuff(false); - } else if (available > tokenBegin) - available = bufsize; - else if ((tokenBegin - available) < 2048) - ExpandBuff(true); - else - available = tokenBegin; - } - - int i; - try { - if ((i = inputStream.read(buffer, maxNextCharInd, - available - maxNextCharInd)) == -1) { - inputStream.close(); - throw new java.io.IOException(); - } else - maxNextCharInd += i; - } - catch (java.io.IOException e) { - --bufpos; - backup(0); - if (tokenBegin == -1) - tokenBegin = bufpos; - throw e; - } - } - - public char BeginToken() throws java.io.IOException { - tokenBegin = -1; - char c = readChar(); - tokenBegin = bufpos; - - return c; - } - - protected void UpdateLineColumn(char c) { - column++; - - if (prevCharIsLF) { - prevCharIsLF = false; - line += (column = 1); - } else if (prevCharIsCR) { - prevCharIsCR = false; - if (c == '\n') { - prevCharIsLF = true; - } else - line += (column = 1); - } - - switch (c) { - case '\r': - prevCharIsCR = true; - break; - case '\n': - prevCharIsLF = true; - break; - case '\t': - column--; - column += (tabSize - (column % tabSize)); - break; - default: - break; - } - - bufline[bufpos] = line; - bufcolumn[bufpos] = column; - } - - public char readChar() throws java.io.IOException { - if (inBuf > 0) { - --inBuf; - - if (++bufpos == bufsize) - bufpos = 0; - - return buffer[bufpos]; - } - - if (++bufpos >= maxNextCharInd) - FillBuff(); - - char c = buffer[bufpos]; - - UpdateLineColumn(c); - return (c); - } - - /** - * @return ??? - * @see #getEndColumn - * @deprecated - */ - - public int getColumn() { - return bufcolumn[bufpos]; - } - - /** - * @return ??? - * @see #getEndLine - * @deprecated - */ - - public int getLine() { - return bufline[bufpos]; - } - - public int getEndColumn() { - return bufcolumn[bufpos]; - } - - public int getEndLine() { - return bufline[bufpos]; - } - - public int getBeginColumn() { - return bufcolumn[tokenBegin]; - } - - public int getBeginLine() { - return bufline[tokenBegin]; - } - - public void backup(int amount) { - - inBuf += amount; - if ((bufpos -= amount) < 0) - bufpos += bufsize; - } - - public SimpleCharStream(java.io.Reader dstream, int startline, - int startcolumn, int buffersize) { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - } - - public SimpleCharStream(java.io.Reader dstream, int startline, - int startcolumn) { - this(dstream, startline, startcolumn, 4096); - } - - public SimpleCharStream(java.io.Reader dstream) { - this(dstream, 1, 1, 4096); - } - - public void ReInit(java.io.Reader dstream, int startline, - int startcolumn, int buffersize) { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - if (buffer == null || buffersize != buffer.length) { - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - } - prevCharIsLF = prevCharIsCR = false; - tokenBegin = inBuf = maxNextCharInd = 0; - bufpos = -1; - } - - public void ReInit(java.io.Reader dstream, int startline, - int startcolumn) { - ReInit(dstream, startline, startcolumn, 4096); - } - - public void ReInit(java.io.Reader dstream) { - ReInit(dstream, 1, 1, 4096); - } - - public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, - int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { - this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); - } - - public SimpleCharStream(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) { - this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); - } - - public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, - int startcolumn) throws java.io.UnsupportedEncodingException { - this(dstream, encoding, startline, startcolumn, 4096); - } - - public SimpleCharStream(java.io.InputStream dstream, int startline, - int startcolumn) { - this(dstream, startline, startcolumn, 4096); - } - - public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { - this(dstream, encoding, 1, 1, 4096); - } - - public SimpleCharStream(java.io.InputStream dstream) { - this(dstream, 1, 1, 4096); - } - - public void ReInit(java.io.InputStream dstream, String encoding, int startline, - int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { - ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); - } - - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) { - ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); - } - - public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { - ReInit(dstream, encoding, 1, 1, 4096); - } - - public void ReInit(java.io.InputStream dstream) { - ReInit(dstream, 1, 1, 4096); - } - - public void ReInit(java.io.InputStream dstream, String encoding, int startline, - int startcolumn) throws java.io.UnsupportedEncodingException { - ReInit(dstream, encoding, startline, startcolumn, 4096); - } - - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn) { - ReInit(dstream, startline, startcolumn, 4096); - } - - public String GetImage() { - if (bufpos >= tokenBegin) - return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); - else - return new String(buffer, tokenBegin, bufsize - tokenBegin) + - new String(buffer, 0, bufpos + 1); - } - - public char[] GetSuffix(int len) { - char[] ret = new char[len]; - - if ((bufpos + 1) >= len) - System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); - else { - System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, - len - bufpos - 1); - System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); - } - - return ret; - } - - public void Done() { - buffer = null; - bufline = null; - bufcolumn = null; - } - - /** - * Method to adjust line and column numbers for the start of a token. - * - * @param newLine ? - * @param newCol ? - */ - public void adjustBeginLineColumn(int newLine, int newCol) { - int start = tokenBegin; - int len; - - if (bufpos >= tokenBegin) { - len = bufpos - tokenBegin + inBuf + 1; - } else { - len = bufsize - tokenBegin + bufpos + 1 + inBuf; - } - - int i = 0, j = 0, k; - int nextColDiff, columnDiff = 0; - - while (i < len && - bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { - bufline[j] = newLine; - nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; - bufcolumn[j] = newCol + columnDiff; - columnDiff = nextColDiff; - i++; - } - - if (i < len) { - bufline[j] = newLine++; - bufcolumn[j] = newCol + columnDiff; - - while (i++ < len) { - if (bufline[j = start % bufsize] != bufline[++start % bufsize]) - bufline[j] = newLine++; - else - bufline[j] = newLine; - } - } - - line = bufline[j]; - column = bufcolumn[j]; - } - -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/SimpleNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/SimpleNode.java deleted file mode 100644 index 7248314..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/SimpleNode.java +++ /dev/null @@ -1,122 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. SimpleNode.java */ - -package jaxx.compiler.parser.css; - -public class SimpleNode implements Node { - protected Node parent; - protected Node[] children; - protected int id; - protected CSSParser parser; - public Token firstToken; - public Token lastToken; - - - public SimpleNode(int i) { - id = i; - } - - public SimpleNode(CSSParser p, int i) { - this(i); - parser = p; - } - - - public int getId() { - return id; - } - - public void jjtOpen() { - } - - public void jjtClose() { - } - - public void jjtSetParent(Node n) { - parent = n; - } - - public Node jjtGetParent() { - return parent; - } - - public SimpleNode getParent() { - return (SimpleNode) parent; - } - - public void jjtAddChild(Node n, int i) { - if (children == null) { - children = new Node[i + 1]; - } else if (i >= children.length) { - Node c[] = new Node[i + 1]; - System.arraycopy(children, 0, c, 0, children.length); - children = c; - } - children[i] = n; - } - - public Node jjtGetChild(int i) { - return children[i]; - } - - public SimpleNode getChild(int i) { - return (SimpleNode) children[i]; - } - - public int jjtGetNumChildren() { - return (children == null) ? 0 : children.length; - } - - /* You can override these two methods in subclasses of SimpleNode to -customize the way the node appears when the tree is dumped. If -your output uses more than one line you should override -toString(String), otherwise overriding toString() is probably all -you need to do. */ - - @Override - public String toString() { - return getClass().getName() + "[" + getText() + "]"; - } - - public String toString(String prefix) { - return prefix + toString(); - } - - /* Override this method if you want to customize how the node dumps - out its children. */ - - public void dump(String prefix) { - System.out.println(toString(prefix)); - if (children != null) { - for (Node aChildren : children) { - SimpleNode n = (SimpleNode) aChildren; - if (n != null) { - n.dump(prefix + " "); - } - } - } - } - - private void appendSpecialTokens(StringBuffer s, Token st) { - if (st != null) { - appendSpecialTokens(s, st.specialToken); - s.append(st.image); - } - } - - - /** @return the text of the tokens comprising this node. */ - public String getText() { - StringBuffer text = new StringBuffer(); - Token t = firstToken; - while (t != null) { - appendSpecialTokens(text, t.specialToken); - text.append(t.image); - if (t == lastToken) - break; - t = t.next; - } - - return text.toString(); - } -} - diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/Token.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/Token.java deleted file mode 100644 index 2faa436..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/Token.java +++ /dev/null @@ -1,76 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */ -package jaxx.compiler.parser.css; - -/** Describes the input token stream. */ - -public class Token { - - /** - * An integer that describes the kind of this token. This numbering - * system is determined by JavaCCParser, and a table of these numbers is - * stored in the file ...Constants.java. - */ - public int kind; - - /** - * beginLine and beginColumn describe the position of the first character - * of this token; endLine and endColumn describe the position of the - * last character of this token. - */ - public int beginLine, beginColumn, endLine, endColumn; - - /** The string image of the token. */ - public String image; - - /** - * A reference to the next regular (non-special) token from the input - * stream. If this is the last token from the input stream, or if the - * token manager has not read tokens beyond this one, this field is - * set to null. This is true only if this token is also a regular - * token. Otherwise, see below for a description of the contents of - * this field. - */ - public Token next; - - /** - * This field is used to access special tokens that occur prior to this - * token, but after the immediately preceding regular (non-special) token. - * If there are no such special tokens, this field is set to null. - * When there are more than one such special token, this field refers - * to the last of these special tokens, which in turn refers to the next - * previous special token through its specialToken field, and so on - * until the first special token (whose specialToken field is null). - * The next fields of special tokens refer to other special tokens that - * immediately follow it (without an intervening regular token). If there - * is no such token, this field is null. - */ - public Token specialToken; - - /** Returns the image. */ - public String toString() { - return image; - } - - /** - * Returns a new Token object, by default. However, if you want, you - * can create and return subclass objects based on the value of ofKind. - * Simply add the cases to the switch for all those special cases. - * For example, if you have a subclass of Token called IDToken that - * you want to create if ofKind is ID, simlpy add something like : - * <p/> - * case MyParserConstants.ID : return new IDToken(); - * <p/> - * to the following switch statement. Then you can cast matchedToken - * variable to the appropriate type and use it in your lexical actions. - * - * @param ofKind kind of token - * @return the new token - */ - public static Token newToken(int ofKind) { - switch (ofKind) { - default: - return new Token(); - } - } - -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/TokenMgrError.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/TokenMgrError.java deleted file mode 100644 index f2d7370..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/css/TokenMgrError.java +++ /dev/null @@ -1,126 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */ -package jaxx.compiler.parser.css; - -public class TokenMgrError extends Error { - /* - * Ordinals for various reasons why an Error of this type can be thrown. - */ - - /** Lexical error occured. */ - static final int LEXICAL_ERROR = 0; - - /** An attempt wass made to create a second instance of a static token manager. */ - static final int STATIC_LEXER_ERROR = 1; - - /** Tried to change to an invalid lexical state. */ - static final int INVALID_LEXICAL_STATE = 2; - - /** Detected (and bailed out of) an infinite loop in the token manager. */ - static final int LOOP_DETECTED = 3; - - /** - * Indicates the reason why the exception is thrown. It will have - * one of the above 4 values. - */ - int errorCode; - private static final long serialVersionUID = -4308847190164230336L; - - /** - * Replaces unprintable characters by their espaced (or unicode escaped) - * equivalents in the given string - * - * @param str text to espace - * @return the espaced text - */ - protected static String addEscapes(String str) { - StringBuffer retval = new StringBuffer(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) { - case 0: - continue; - case '\b': - retval.append("\\b"); - continue; - case '\t': - retval.append("\\t"); - continue; - case '\n': - retval.append("\\n"); - continue; - case '\f': - retval.append("\\f"); - continue; - case '\r': - retval.append("\\r"); - continue; - case '\"': - retval.append("\\\""); - continue; - case '\'': - retval.append("\\\'"); - continue; - case '\\': - retval.append("\\\\"); - continue; - default: - if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { - String s = "0000" + Integer.toString(ch, 16); - retval.append("\\u").append(s.substring(s.length() - 4, s.length())); - } else { - retval.append(ch); - } - } - } - return retval.toString(); - } - - /** - * @param EOFSeen : indicates if EOF caused the lexicl error - * @param lexState : lexical state in which this error occured - * @param errorLine : line number when the error occured - * @param errorColumn : column number when the error occured - * @param errorAfter : prefix that was seen before this error occured - * @param curChar : the offending character - * Note: You can customize the lexical error message by modifying this method. - * @return a detailed message for the Error when it is thrown by the - * token manager to indicate a lexical error. - */ - protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { - return ("Lexical error at line " + - errorLine + ", column " + - errorColumn + ". Encountered: " + - (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int) curChar + "), ") + - "after : \"" + addEscapes(errorAfter) + "\""); - } - - /** - * You can also modify the body of this method to customize your error messages. - * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not - * of end-users concern, so you can return something like : - * <p/> - * "Internal Error : Please file a bug report .... " - * <p/> - * from this method for such cases in the release version of your parser. - */ - @Override - public String getMessage() { - return super.getMessage(); - } - - /* - * Constructors of various flavors follow. - */ - - public TokenMgrError() { - } - - public TokenMgrError(String message, int reason) { - super(message); - errorCode = reason; - } - - public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { - this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JJTJavaParserState.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JJTJavaParserState.java deleted file mode 100644 index dbe4436..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JJTJavaParserState.java +++ /dev/null @@ -1,123 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. .\JJTJavaParserState.java */ - -package jaxx.compiler.parser.java; - -class JJTJavaParserState { - private java.util.Stack<Node> nodes; - private java.util.Stack<Integer> marks; - - private int sp; // number of nodes on stack - private int mk; // current mark - private boolean node_created; - - JJTJavaParserState() { - nodes = new java.util.Stack<Node>(); - marks = new java.util.Stack<Integer>(); - sp = 0; - mk = 0; - } - - /* Determines whether the current node was actually closed and - pushed. This should only be called in the final user action of a - node scope. */ - boolean nodeCreated() { - return node_created; - } - - /* Call this to reinitialize the node stack. It is called -automatically by the parser's ReInit() method. */ - void reset() { - nodes.removeAllElements(); - marks.removeAllElements(); - sp = 0; - mk = 0; - } - - /* Returns the root node of the AST. It only makes sense to call -this after a successful parse. */ - Node rootNode() { - return nodes.elementAt(0); - } - - /* Pushes a node on to the stack. */ - void pushNode(Node n) { - nodes.push(n); - ++sp; - } - - /* Returns the node on the top of the stack, and remove it from the - stack. */ - Node popNode() { - if (--sp < mk) { - mk = marks.pop(); - } - return nodes.pop(); - } - - /* Returns the node currently on the top of the stack. */ - Node peekNode() { - return nodes.peek(); - } - - /* Returns the number of children on the stack in the current node - scope. */ - int nodeArity() { - return sp - mk; - } - - - void clearNodeScope(Node n) { - while (sp > mk) { - popNode(); - } - mk = marks.pop(); - } - - - void openNodeScope(Node n) { - marks.push(mk); - mk = sp; - n.jjtOpen(); - } - - - /* A definite node is constructed from a specified number of -children. That number of nodes are popped from the stack and -made the children of the definite node. Then the definite node -is pushed on to the stack. */ - void closeNodeScope(Node n, int num) { - mk = marks.pop(); - while (num-- > 0) { - Node c = popNode(); - c.jjtSetParent(n); - n.jjtAddChild(c, num); - } - n.jjtClose(); - pushNode(n); - node_created = true; - } - - - /* A conditional node is constructed if its condition is true. All -the nodes that have been pushed since the node was opened are -made children of the the conditional node, which is then pushed -on to the stack. If the condition is false the node is not -constructed and they are left on the stack. */ - void closeNodeScope(Node n, boolean condition) { - if (condition) { - int a = nodeArity(); - mk = marks.pop(); - while (a-- > 0) { - Node c = popNode(); - c.jjtSetParent(n); - n.jjtAddChild(c, a); - } - n.jjtClose(); - pushNode(n); - node_created = true; - } else { - mk = marks.pop(); - node_created = false; - } - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Java1.5.jj b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Java1.5.jj deleted file mode 100644 index 96d01d3..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Java1.5.jj +++ /dev/null @@ -1,5125 +0,0 @@ -/*@bgen(jjtree) Generated By:JJTree: Do not edit this line. ./Java1.5.jj */ -/*@egen*/ -/* - * Copyright \u00a9 2002 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * California 95054, U.S.A. All rights reserved. Sun Microsystems, Inc. has - * intellectual property rights relating to technology embodied in the product - * that is described in this document. In particular, and without limitation, - * these intellectual property rights may include one or more of the U.S. - * patents listed at http://www.sun.com/patents and one or more additional - * patents or pending patent applications in the U.S. and in other countries. - * U.S. Government Rights - Commercial software. Government users are subject - * to the Sun Microsystems, Inc. standard license agreement and applicable - * provisions of the FAR and its supplements. Use is subject to license terms. - * Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered - * trademarks of Sun Microsystems, Inc. in the U.S. and other countries. This - * product is covered and controlled by U.S. Export Control laws and may be - * subject to the export or import laws in other countries. Nuclear, missile, - * chemical biological weapons or nuclear maritime end uses or end users, - * whether direct or indirect, are strictly prohibited. Export or reexport - * to countries subject to U.S. embargo or to entities identified on U.S. - * export exclusion lists, including, but not limited to, the denied persons - * and specially designated nationals lists is strictly prohibited. - */ - -// Slightly modified version of javacc's reference 1.5 grammar, tweaked for -// usage with JAXX. There are two main areas of changes: several new -// nonterminals were added to make identifying certain constructs easier, -// and the Line nonterminal was added to support JAXX's script tags. -// Several of the new changes are inefficient and require excess lookahead, -// but at this point I'd rather have inefficiency than risk breaking it during -// attempted optimizations. - -options { - JAVA_UNICODE_ESCAPE = true; - ERROR_REPORTING = false; - STATIC = false; - JDK_VERSION = "1.4"; -} - -PARSER_BEGIN(JavaParser) -package jaxx.parser; - -import java.io.*; - -/** - * Grammar to parse Java version 1.5 - * @author Sreenivasa Viswanadha - Simplified and enhanced for 1.5 - */ -public class JavaParser/*@bgen(jjtree)*/implements JavaParserTreeConstants/*@egen*/ -{/*@bgen(jjtree)*/ - protected JJTJavaParserState jjtree = new JJTJavaParserState(); - -/*@egen*/ - /** - * Class to hold modifiers. - */ - static public final class ModifierSet - { - /* Definitions of the bits in the modifiers field. */ - public static final int PUBLIC = 0x0001; - public static final int PROTECTED = 0x0002; - public static final int PRIVATE = 0x0004; - public static final int ABSTRACT = 0x0008; - public static final int STATIC = 0x0010; - public static final int FINAL = 0x0020; - public static final int SYNCHRONIZED = 0x0040; - public static final int NATIVE = 0x0080; - public static final int TRANSIENT = 0x0100; - public static final int VOLATILE = 0x0200; - public static final int STRICTFP = 0x1000; - - /** A set of accessors that indicate whether the specified modifier - is in the set. */ - - public boolean isPublic(int modifiers) - { - return (modifiers & PUBLIC) != 0; - } - - public boolean isProtected(int modifiers) - { - return (modifiers & PROTECTED) != 0; - } - - public boolean isPrivate(int modifiers) - { - return (modifiers & PRIVATE) != 0; - } - - public boolean isStatic(int modifiers) - { - return (modifiers & STATIC) != 0; - } - - public boolean isAbstract(int modifiers) - { - return (modifiers & ABSTRACT) != 0; - } - - public boolean isFinal(int modifiers) - { - return (modifiers & FINAL) != 0; - } - - public boolean isNative(int modifiers) - { - return (modifiers & NATIVE) != 0; - } - - public boolean isStrictfp(int modifiers) - { - return (modifiers & STRICTFP) != 0; - } - - public boolean isSynchronized(int modifiers) - { - return (modifiers & SYNCHRONIZED) != 0; - } - - public boolean isTransient(int modifiers) - { - return (modifiers & TRANSIENT) != 0; - } - - public boolean isVolatile(int modifiers) - { - return (modifiers & VOLATILE) != 0; - } - - /** - * Removes the given modifier. - */ - static int removeModifier(int modifiers, int mod) - { - return modifiers & ~mod; - } - } - - public JavaParser(String fileName) - { - this(System.in); - try { ReInit(new FileInputStream(new File(fileName))); } - catch(Exception e) { e.printStackTrace(); } - } - - void jjtreeOpenNodeScope(Node n) { - ((SimpleNode) n).firstToken = getToken(1); - } - - void jjtreeCloseNodeScope(Node n) { - ((SimpleNode) n).lastToken = getToken(0); - } - - public SimpleNode popNode() - { - if ( jjtree.nodeArity() > 0) // number of child nodes - return (SimpleNode)jjtree.popNode(); - else - return null; - } - public static void main(String args[]) { - JavaParser parser; - if (args.length == 0) { - System.out.println("Java Parser Version 1.1: Reading from standard input . . ."); - parser = new JavaParser(System.in); - } else if (args.length == 1) { - System.out.println("Java Parser Version 1.1: Reading from file " + args[0] + " . . ."); - try { - parser = new JavaParser(new java.io.FileInputStream(args[0])); - } catch (java.io.FileNotFoundException e) { - System.out.println("Java Parser Version 1.1: File " + args[0] + " not found."); - return; - } - } else { - System.out.println("Java Parser Version 1.1: Usage is one of:"); - System.out.println(" java JavaParser < inputfile"); - System.out.println("OR"); - System.out.println(" java JavaParser inputfile"); - return; - } - try { - parser.CompilationUnit(); - System.out.println("Java Parser Version 1.1: Java program parsed successfully."); - } catch (ParseException e) { - System.out.println(e.getMessage()); - System.out.println("Java Parser Version 1.1: Encountered errors during parse."); - } - } - -} - -PARSER_END(JavaParser) - -/* COMMENTS */ - -MORE : -{ - <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT -| - "/*" : IN_MULTI_LINE_COMMENT -} - -SPECIAL_TOKEN: -{ - <WHITE_SPACE: ([" ", "\n", "\r", "\t", "\f"])+> -} - -SPECIAL_TOKEN : -{ - <SINGLE_LINE_COMMENT: "//" (~["\n", "\r"])* ("\n" | "\r" | "\r\n")?> -} - -<IN_FORMAL_COMMENT> -SPECIAL_TOKEN : -{ - <FORMAL_COMMENT: "*/" > : DEFAULT -} - -<IN_MULTI_LINE_COMMENT> -SPECIAL_TOKEN : -{ - <MULTI_LINE_COMMENT: "*/" > : DEFAULT -} - -<IN_FORMAL_COMMENT,IN_MULTI_LINE_COMMENT> -MORE : -{ - < ~[] > -} - -/* RESERVED WORDS AND LITERALS */ - -TOKEN : -{ - < ABSTRACT: "abstract" > -| < ASSERT: "assert" > -| < BOOLEAN: "boolean" > -| < BREAK: "break" > -| < BYTE: "byte" > -| < CASE: "case" > -| < CATCH: "catch" > -| < CHAR: "char" > -| < CLASS: "class" > -| < CONST: "const" > -| < CONTINUE: "continue" > -| < _DEFAULT: "default" > -| < DO: "do" > -| < DOUBLE: "double" > -| < ELSE: "else" > -| < ENUM: "enum" > -| < EXTENDS: "extends" > -| < FALSE: "false" > -| < FINAL: "final" > -| < FINALLY: "finally" > -| < FLOAT: "float" > -| < FOR: "for" > -| < GOTO: "goto" > -| < IF: "if" > -| < IMPLEMENTS: "implements" > -| < IMPORT: "import" > -| < INSTANCEOF: "instanceof" > -| < INT: "int" > -| < INTERFACE: "interface" > -| < LONG: "long" > -| < NATIVE: "native" > -| < NEW: "new" > -| < NULL: "null" > -| < PACKAGE: "package"> -| < PRIVATE: "private" > -| < PROTECTED: "protected" > -| < PUBLIC: "public" > -| < RETURN: "return" > -| < SHORT: "short" > -| < STATIC: "static" > -| < STRICTFP: "strictfp" > -| < SUPER: "super" > -| < SWITCH: "switch" > -| < SYNCHRONIZED: "synchronized" > -| < THIS: "this" > -| < THROW: "throw" > -| < THROWS: "throws" > -| < TRANSIENT: "transient" > -| < TRUE: "true" > -| < TRY: "try" > -| < VOID: "void" > -| < VOLATILE: "volatile" > -| < WHILE: "while" > -} - -/* LITERALS */ - -TOKEN : -{ - < INTEGER_LITERAL: - <DECIMAL_LITERAL> (["l","L"])? - | <HEX_LITERAL> (["l","L"])? - | <OCTAL_LITERAL> (["l","L"])? - > -| - < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > -| - < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > -| - < #OCTAL_LITERAL: "0" (["0"-"7"])* > -| - < FLOATING_POINT_LITERAL: - <DECIMAL_FLOATING_POINT_LITERAL> - | <HEXADECIMAL_FLOATING_POINT_LITERAL> - > -| - < #DECIMAL_FLOATING_POINT_LITERAL: - (["0"-"9"])+ "." (["0"-"9"])* (<DECIMAL_EXPONENT>)? (["f","F","d","D"])? - | "." (["0"-"9"])+ (<DECIMAL_EXPONENT>)? (["f","F","d","D"])? - | (["0"-"9"])+ <DECIMAL_EXPONENT> (["f","F","d","D"])? - | (["0"-"9"])+ (<DECIMAL_EXPONENT>)? ["f","F","d","D"] - > -| - < #DECIMAL_EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > -| - < #HEXADECIMAL_FLOATING_POINT_LITERAL: - "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])+ (".")? <HEXADECIMAL_EXPONENT> (["f","F","d","D"])? - | "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])* "." (["0"-"9","a"-"f","A"-"F"])+ <HEXADECIMAL_EXPONENT> (["f","F","d","D"])? - > -| - < #HEXADECIMAL_EXPONENT: ["p","P"] (["+","-"])? (["0"-"9"])+ > -| - < CHARACTER_LITERAL: - "'" - ( (~["'","\\","\n","\r"]) - | ("\\" - ( ["n","t","b","r","f","\\","'","\""] - | ["0"-"7"] ( ["0"-"7"] )? - | ["0"-"3"] ["0"-"7"] ["0"-"7"] - ) - ) - ) - "'" - > -| - < STRING_LITERAL: - "\"" - ( (~["\"","\\","\n","\r"]) - | ("\\" - ( ["n","t","b","r","f","\\","'","\""] - | ["0"-"7"] ( ["0"-"7"] )? - | ["0"-"3"] ["0"-"7"] ["0"-"7"] - ) - ) - )* - "\"" - > -} - -/* IDENTIFIERS */ - -TOKEN : -{ - < IDENTIFIER: <LETTER> (<PART_LETTER>)* > -| - < #LETTER: - [ // all chars for which Character.isIdentifierStart is true - "$", - "A"-"Z", - "_", - "a"-"z", - "\u00a2"-"\u00a5", - "\u00aa", - "\u00b5", - "\u00ba", - "\u00c0"-"\u00d6", - "\u00d8"-"\u00f6", - "\u00f8"-"\u021f", - "\u0222"-"\u0233", - "\u0250"-"\u02ad", - "\u02b0"-"\u02b8", - "\u02bb"-"\u02c1", - "\u02d0"-"\u02d1", - "\u02e0"-"\u02e4", - "\u02ee", - "\u037a", - "\u0386", - "\u0388"-"\u038a", - "\u038c", - "\u038e"-"\u03a1", - "\u03a3"-"\u03ce", - "\u03d0"-"\u03d7", - "\u03da"-"\u03f3", - "\u0400"-"\u0481", - "\u048c"-"\u04c4", - "\u04c7"-"\u04c8", - "\u04cb"-"\u04cc", - "\u04d0"-"\u04f5", - "\u04f8"-"\u04f9", - "\u0531"-"\u0556", - "\u0559", - "\u0561"-"\u0587", - "\u05d0"-"\u05ea", - "\u05f0"-"\u05f2", - "\u0621"-"\u063a", - "\u0640"-"\u064a", - "\u0671"-"\u06d3", - "\u06d5", - "\u06e5"-"\u06e6", - "\u06fa"-"\u06fc", - "\u0710", - "\u0712"-"\u072c", - "\u0780"-"\u07a5", - "\u0905"-"\u0939", - "\u093d", - "\u0950", - "\u0958"-"\u0961", - "\u0985"-"\u098c", - "\u098f"-"\u0990", - "\u0993"-"\u09a8", - "\u09aa"-"\u09b0", - "\u09b2", - "\u09b6"-"\u09b9", - "\u09dc"-"\u09dd", - "\u09df"-"\u09e1", - "\u09f0"-"\u09f3", - "\u0a05"-"\u0a0a", - "\u0a0f"-"\u0a10", - "\u0a13"-"\u0a28", - "\u0a2a"-"\u0a30", - "\u0a32"-"\u0a33", - "\u0a35"-"\u0a36", - "\u0a38"-"\u0a39", - "\u0a59"-"\u0a5c", - "\u0a5e", - "\u0a72"-"\u0a74", - "\u0a85"-"\u0a8b", - "\u0a8d", - "\u0a8f"-"\u0a91", - "\u0a93"-"\u0aa8", - "\u0aaa"-"\u0ab0", - "\u0ab2"-"\u0ab3", - "\u0ab5"-"\u0ab9", - "\u0abd", - "\u0ad0", - "\u0ae0", - "\u0b05"-"\u0b0c", - "\u0b0f"-"\u0b10", - "\u0b13"-"\u0b28", - "\u0b2a"-"\u0b30", - "\u0b32"-"\u0b33", - "\u0b36"-"\u0b39", - "\u0b3d", - "\u0b5c"-"\u0b5d", - "\u0b5f"-"\u0b61", - "\u0b85"-"\u0b8a", - "\u0b8e"-"\u0b90", - "\u0b92"-"\u0b95", - "\u0b99"-"\u0b9a", - "\u0b9c", - "\u0b9e"-"\u0b9f", - "\u0ba3"-"\u0ba4", - "\u0ba8"-"\u0baa", - "\u0bae"-"\u0bb5", - "\u0bb7"-"\u0bb9", - "\u0c05"-"\u0c0c", - "\u0c0e"-"\u0c10", - "\u0c12"-"\u0c28", - "\u0c2a"-"\u0c33", - "\u0c35"-"\u0c39", - "\u0c60"-"\u0c61", - "\u0c85"-"\u0c8c", - "\u0c8e"-"\u0c90", - "\u0c92"-"\u0ca8", - "\u0caa"-"\u0cb3", - "\u0cb5"-"\u0cb9", - "\u0cde", - "\u0ce0"-"\u0ce1", - "\u0d05"-"\u0d0c", - "\u0d0e"-"\u0d10", - "\u0d12"-"\u0d28", - "\u0d2a"-"\u0d39", - "\u0d60"-"\u0d61", - "\u0d85"-"\u0d96", - "\u0d9a"-"\u0db1", - "\u0db3"-"\u0dbb", - "\u0dbd", - "\u0dc0"-"\u0dc6", - "\u0e01"-"\u0e30", - "\u0e32"-"\u0e33", - "\u0e3f"-"\u0e46", - "\u0e81"-"\u0e82", - "\u0e84", - "\u0e87"-"\u0e88", - "\u0e8a", - "\u0e8d", - "\u0e94"-"\u0e97", - "\u0e99"-"\u0e9f", - "\u0ea1"-"\u0ea3", - "\u0ea5", - "\u0ea7", - "\u0eaa"-"\u0eab", - "\u0ead"-"\u0eb0", - "\u0eb2"-"\u0eb3", - "\u0ebd", - "\u0ec0"-"\u0ec4", - "\u0ec6", - "\u0edc"-"\u0edd", - "\u0f00", - "\u0f40"-"\u0f47", - "\u0f49"-"\u0f6a", - "\u0f88"-"\u0f8b", - "\u1000"-"\u1021", - "\u1023"-"\u1027", - "\u1029"-"\u102a", - "\u1050"-"\u1055", - "\u10a0"-"\u10c5", - "\u10d0"-"\u10f6", - "\u1100"-"\u1159", - "\u115f"-"\u11a2", - "\u11a8"-"\u11f9", - "\u1200"-"\u1206", - "\u1208"-"\u1246", - "\u1248", - "\u124a"-"\u124d", - "\u1250"-"\u1256", - "\u1258", - "\u125a"-"\u125d", - "\u1260"-"\u1286", - "\u1288", - "\u128a"-"\u128d", - "\u1290"-"\u12ae", - "\u12b0", - "\u12b2"-"\u12b5", - "\u12b8"-"\u12be", - "\u12c0", - "\u12c2"-"\u12c5", - "\u12c8"-"\u12ce", - "\u12d0"-"\u12d6", - "\u12d8"-"\u12ee", - "\u12f0"-"\u130e", - "\u1310", - "\u1312"-"\u1315", - "\u1318"-"\u131e", - "\u1320"-"\u1346", - "\u1348"-"\u135a", - "\u13a0"-"\u13f4", - "\u1401"-"\u166c", - "\u166f"-"\u1676", - "\u1681"-"\u169a", - "\u16a0"-"\u16ea", - "\u1780"-"\u17b3", - "\u17db", - "\u1820"-"\u1877", - "\u1880"-"\u18a8", - "\u1e00"-"\u1e9b", - "\u1ea0"-"\u1ef9", - "\u1f00"-"\u1f15", - "\u1f18"-"\u1f1d", - "\u1f20"-"\u1f45", - "\u1f48"-"\u1f4d", - "\u1f50"-"\u1f57", - "\u1f59", - "\u1f5b", - "\u1f5d", - "\u1f5f"-"\u1f7d", - "\u1f80"-"\u1fb4", - "\u1fb6"-"\u1fbc", - "\u1fbe", - "\u1fc2"-"\u1fc4", - "\u1fc6"-"\u1fcc", - "\u1fd0"-"\u1fd3", - "\u1fd6"-"\u1fdb", - "\u1fe0"-"\u1fec", - "\u1ff2"-"\u1ff4", - "\u1ff6"-"\u1ffc", - "\u203f"-"\u2040", - "\u207f", - "\u20a0"-"\u20af", - "\u2102", - "\u2107", - "\u210a"-"\u2113", - "\u2115", - "\u2119"-"\u211d", - "\u2124", - "\u2126", - "\u2128", - "\u212a"-"\u212d", - "\u212f"-"\u2131", - "\u2133"-"\u2139", - "\u2160"-"\u2183", - "\u3005"-"\u3007", - "\u3021"-"\u3029", - "\u3031"-"\u3035", - "\u3038"-"\u303a", - "\u3041"-"\u3094", - "\u309d"-"\u309e", - "\u30a1"-"\u30fe", - "\u3105"-"\u312c", - "\u3131"-"\u318e", - "\u31a0"-"\u31b7", - "\u3400"-"\u4db5", - "\u4e00"-"\u9fa5", - "\ua000"-"\ua48c", - "\uac00"-"\ud7a3", - "\uf900"-"\ufa2d", - "\ufb00"-"\ufb06", - "\ufb13"-"\ufb17", - "\ufb1d", - "\ufb1f"-"\ufb28", - "\ufb2a"-"\ufb36", - "\ufb38"-"\ufb3c", - "\ufb3e", - "\ufb40"-"\ufb41", - "\ufb43"-"\ufb44", - "\ufb46"-"\ufbb1", - "\ufbd3"-"\ufd3d", - "\ufd50"-"\ufd8f", - "\ufd92"-"\ufdc7", - "\ufdf0"-"\ufdfb", - "\ufe33"-"\ufe34", - "\ufe4d"-"\ufe4f", - "\ufe69", - "\ufe70"-"\ufe72", - "\ufe74", - "\ufe76"-"\ufefc", - "\uff04", - "\uff21"-"\uff3a", - "\uff3f", - "\uff41"-"\uff5a", - "\uff65"-"\uffbe", - "\uffc2"-"\uffc7", - "\uffca"-"\uffcf", - "\uffd2"-"\uffd7", - "\uffda"-"\uffdc", - "\uffe0"-"\uffe1", - "\uffe5"-"\uffe6" - ] - > -| - < #PART_LETTER: - [ // all chars for which Character.isIdentifierPart is true - "\u0000"-"\u0008", - "\u000e"-"\u001b", - "$", - "0"-"9", - "A"-"Z", - "_", - "a"-"z", - "\u007f"-"\u009f", - "\u00a2"-"\u00a5", - "\u00aa", - "\u00b5", - "\u00ba", - "\u00c0"-"\u00d6", - "\u00d8"-"\u00f6", - "\u00f8"-"\u021f", - "\u0222"-"\u0233", - "\u0250"-"\u02ad", - "\u02b0"-"\u02b8", - "\u02bb"-"\u02c1", - "\u02d0"-"\u02d1", - "\u02e0"-"\u02e4", - "\u02ee", - "\u0300"-"\u034e", - "\u0360"-"\u0362", - "\u037a", - "\u0386", - "\u0388"-"\u038a", - "\u038c", - "\u038e"-"\u03a1", - "\u03a3"-"\u03ce", - "\u03d0"-"\u03d7", - "\u03da"-"\u03f3", - "\u0400"-"\u0481", - "\u0483"-"\u0486", - "\u048c"-"\u04c4", - "\u04c7"-"\u04c8", - "\u04cb"-"\u04cc", - "\u04d0"-"\u04f5", - "\u04f8"-"\u04f9", - "\u0531"-"\u0556", - "\u0559", - "\u0561"-"\u0587", - "\u0591"-"\u05a1", - "\u05a3"-"\u05b9", - "\u05bb"-"\u05bd", - "\u05bf", - "\u05c1"-"\u05c2", - "\u05c4", - "\u05d0"-"\u05ea", - "\u05f0"-"\u05f2", - "\u0621"-"\u063a", - "\u0640"-"\u0655", - "\u0660"-"\u0669", - "\u0670"-"\u06d3", - "\u06d5"-"\u06dc", - "\u06df"-"\u06e8", - "\u06ea"-"\u06ed", - "\u06f0"-"\u06fc", - "\u070f"-"\u072c", - "\u0730"-"\u074a", - "\u0780"-"\u07b0", - "\u0901"-"\u0903", - "\u0905"-"\u0939", - "\u093c"-"\u094d", - "\u0950"-"\u0954", - "\u0958"-"\u0963", - "\u0966"-"\u096f", - "\u0981"-"\u0983", - "\u0985"-"\u098c", - "\u098f"-"\u0990", - "\u0993"-"\u09a8", - "\u09aa"-"\u09b0", - "\u09b2", - "\u09b6"-"\u09b9", - "\u09bc", - "\u09be"-"\u09c4", - "\u09c7"-"\u09c8", - "\u09cb"-"\u09cd", - "\u09d7", - "\u09dc"-"\u09dd", - "\u09df"-"\u09e3", - "\u09e6"-"\u09f3", - "\u0a02", - "\u0a05"-"\u0a0a", - "\u0a0f"-"\u0a10", - "\u0a13"-"\u0a28", - "\u0a2a"-"\u0a30", - "\u0a32"-"\u0a33", - "\u0a35"-"\u0a36", - "\u0a38"-"\u0a39", - "\u0a3c", - "\u0a3e"-"\u0a42", - "\u0a47"-"\u0a48", - "\u0a4b"-"\u0a4d", - "\u0a59"-"\u0a5c", - "\u0a5e", - "\u0a66"-"\u0a74", - "\u0a81"-"\u0a83", - "\u0a85"-"\u0a8b", - "\u0a8d", - "\u0a8f"-"\u0a91", - "\u0a93"-"\u0aa8", - "\u0aaa"-"\u0ab0", - "\u0ab2"-"\u0ab3", - "\u0ab5"-"\u0ab9", - "\u0abc"-"\u0ac5", - "\u0ac7"-"\u0ac9", - "\u0acb"-"\u0acd", - "\u0ad0", - "\u0ae0", - "\u0ae6"-"\u0aef", - "\u0b01"-"\u0b03", - "\u0b05"-"\u0b0c", - "\u0b0f"-"\u0b10", - "\u0b13"-"\u0b28", - "\u0b2a"-"\u0b30", - "\u0b32"-"\u0b33", - "\u0b36"-"\u0b39", - "\u0b3c"-"\u0b43", - "\u0b47"-"\u0b48", - "\u0b4b"-"\u0b4d", - "\u0b56"-"\u0b57", - "\u0b5c"-"\u0b5d", - "\u0b5f"-"\u0b61", - "\u0b66"-"\u0b6f", - "\u0b82"-"\u0b83", - "\u0b85"-"\u0b8a", - "\u0b8e"-"\u0b90", - "\u0b92"-"\u0b95", - "\u0b99"-"\u0b9a", - "\u0b9c", - "\u0b9e"-"\u0b9f", - "\u0ba3"-"\u0ba4", - "\u0ba8"-"\u0baa", - "\u0bae"-"\u0bb5", - "\u0bb7"-"\u0bb9", - "\u0bbe"-"\u0bc2", - "\u0bc6"-"\u0bc8", - "\u0bca"-"\u0bcd", - "\u0bd7", - "\u0be7"-"\u0bef", - "\u0c01"-"\u0c03", - "\u0c05"-"\u0c0c", - "\u0c0e"-"\u0c10", - "\u0c12"-"\u0c28", - "\u0c2a"-"\u0c33", - "\u0c35"-"\u0c39", - "\u0c3e"-"\u0c44", - "\u0c46"-"\u0c48", - "\u0c4a"-"\u0c4d", - "\u0c55"-"\u0c56", - "\u0c60"-"\u0c61", - "\u0c66"-"\u0c6f", - "\u0c82"-"\u0c83", - "\u0c85"-"\u0c8c", - "\u0c8e"-"\u0c90", - "\u0c92"-"\u0ca8", - "\u0caa"-"\u0cb3", - "\u0cb5"-"\u0cb9", - "\u0cbe"-"\u0cc4", - "\u0cc6"-"\u0cc8", - "\u0cca"-"\u0ccd", - "\u0cd5"-"\u0cd6", - "\u0cde", - "\u0ce0"-"\u0ce1", - "\u0ce6"-"\u0cef", - "\u0d02"-"\u0d03", - "\u0d05"-"\u0d0c", - "\u0d0e"-"\u0d10", - "\u0d12"-"\u0d28", - "\u0d2a"-"\u0d39", - "\u0d3e"-"\u0d43", - "\u0d46"-"\u0d48", - "\u0d4a"-"\u0d4d", - "\u0d57", - "\u0d60"-"\u0d61", - "\u0d66"-"\u0d6f", - "\u0d82"-"\u0d83", - "\u0d85"-"\u0d96", - "\u0d9a"-"\u0db1", - "\u0db3"-"\u0dbb", - "\u0dbd", - "\u0dc0"-"\u0dc6", - "\u0dca", - "\u0dcf"-"\u0dd4", - "\u0dd6", - "\u0dd8"-"\u0ddf", - "\u0df2"-"\u0df3", - "\u0e01"-"\u0e3a", - "\u0e3f"-"\u0e4e", - "\u0e50"-"\u0e59", - "\u0e81"-"\u0e82", - "\u0e84", - "\u0e87"-"\u0e88", - "\u0e8a", - "\u0e8d", - "\u0e94"-"\u0e97", - "\u0e99"-"\u0e9f", - "\u0ea1"-"\u0ea3", - "\u0ea5", - "\u0ea7", - "\u0eaa"-"\u0eab", - "\u0ead"-"\u0eb9", - "\u0ebb"-"\u0ebd", - "\u0ec0"-"\u0ec4", - "\u0ec6", - "\u0ec8"-"\u0ecd", - "\u0ed0"-"\u0ed9", - "\u0edc"-"\u0edd", - "\u0f00", - "\u0f18"-"\u0f19", - "\u0f20"-"\u0f29", - "\u0f35", - "\u0f37", - "\u0f39", - "\u0f3e"-"\u0f47", - "\u0f49"-"\u0f6a", - "\u0f71"-"\u0f84", - "\u0f86"-"\u0f8b", - "\u0f90"-"\u0f97", - "\u0f99"-"\u0fbc", - "\u0fc6", - "\u1000"-"\u1021", - "\u1023"-"\u1027", - "\u1029"-"\u102a", - "\u102c"-"\u1032", - "\u1036"-"\u1039", - "\u1040"-"\u1049", - "\u1050"-"\u1059", - "\u10a0"-"\u10c5", - "\u10d0"-"\u10f6", - "\u1100"-"\u1159", - "\u115f"-"\u11a2", - "\u11a8"-"\u11f9", - "\u1200"-"\u1206", - "\u1208"-"\u1246", - "\u1248", - "\u124a"-"\u124d", - "\u1250"-"\u1256", - "\u1258", - "\u125a"-"\u125d", - "\u1260"-"\u1286", - "\u1288", - "\u128a"-"\u128d", - "\u1290"-"\u12ae", - "\u12b0", - "\u12b2"-"\u12b5", - "\u12b8"-"\u12be", - "\u12c0", - "\u12c2"-"\u12c5", - "\u12c8"-"\u12ce", - "\u12d0"-"\u12d6", - "\u12d8"-"\u12ee", - "\u12f0"-"\u130e", - "\u1310", - "\u1312"-"\u1315", - "\u1318"-"\u131e", - "\u1320"-"\u1346", - "\u1348"-"\u135a", - "\u1369"-"\u1371", - "\u13a0"-"\u13f4", - "\u1401"-"\u166c", - "\u166f"-"\u1676", - "\u1681"-"\u169a", - "\u16a0"-"\u16ea", - "\u1780"-"\u17d3", - "\u17db", - "\u17e0"-"\u17e9", - "\u180b"-"\u180e", - "\u1810"-"\u1819", - "\u1820"-"\u1877", - "\u1880"-"\u18a9", - "\u1e00"-"\u1e9b", - "\u1ea0"-"\u1ef9", - "\u1f00"-"\u1f15", - "\u1f18"-"\u1f1d", - "\u1f20"-"\u1f45", - "\u1f48"-"\u1f4d", - "\u1f50"-"\u1f57", - "\u1f59", - "\u1f5b", - "\u1f5d", - "\u1f5f"-"\u1f7d", - "\u1f80"-"\u1fb4", - "\u1fb6"-"\u1fbc", - "\u1fbe", - "\u1fc2"-"\u1fc4", - "\u1fc6"-"\u1fcc", - "\u1fd0"-"\u1fd3", - "\u1fd6"-"\u1fdb", - "\u1fe0"-"\u1fec", - "\u1ff2"-"\u1ff4", - "\u1ff6"-"\u1ffc", - "\u200c"-"\u200f", - "\u202a"-"\u202e", - "\u203f"-"\u2040", - "\u206a"-"\u206f", - "\u207f", - "\u20a0"-"\u20af", - "\u20d0"-"\u20dc", - "\u20e1", - "\u2102", - "\u2107", - "\u210a"-"\u2113", - "\u2115", - "\u2119"-"\u211d", - "\u2124", - "\u2126", - "\u2128", - "\u212a"-"\u212d", - "\u212f"-"\u2131", - "\u2133"-"\u2139", - "\u2160"-"\u2183", - "\u3005"-"\u3007", - "\u3021"-"\u302f", - "\u3031"-"\u3035", - "\u3038"-"\u303a", - "\u3041"-"\u3094", - "\u3099"-"\u309a", - "\u309d"-"\u309e", - "\u30a1"-"\u30fe", - "\u3105"-"\u312c", - "\u3131"-"\u318e", - "\u31a0"-"\u31b7", - "\u3400"-"\u4db5", - "\u4e00"-"\u9fa5", - "\ua000"-"\ua48c", - "\uac00"-"\ud7a3", - "\uf900"-"\ufa2d", - "\ufb00"-"\ufb06", - "\ufb13"-"\ufb17", - "\ufb1d"-"\ufb28", - "\ufb2a"-"\ufb36", - "\ufb38"-"\ufb3c", - "\ufb3e", - "\ufb40"-"\ufb41", - "\ufb43"-"\ufb44", - "\ufb46"-"\ufbb1", - "\ufbd3"-"\ufd3d", - "\ufd50"-"\ufd8f", - "\ufd92"-"\ufdc7", - "\ufdf0"-"\ufdfb", - "\ufe20"-"\ufe23", - "\ufe33"-"\ufe34", - "\ufe4d"-"\ufe4f", - "\ufe69", - "\ufe70"-"\ufe72", - "\ufe74", - "\ufe76"-"\ufefc", - "\ufeff", - "\uff04", - "\uff10"-"\uff19", - "\uff21"-"\uff3a", - "\uff3f", - "\uff41"-"\uff5a", - "\uff65"-"\uffbe", - "\uffc2"-"\uffc7", - "\uffca"-"\uffcf", - "\uffd2"-"\uffd7", - "\uffda"-"\uffdc", - "\uffe0"-"\uffe1", - "\uffe5"-"\uffe6", - "\ufff9"-"\ufffb" - ] - > -} - -/* SEPARATORS */ - -TOKEN : -{ - < LPAREN: "(" > -| < RPAREN: ")" > -| < LBRACE: "{" > -| < RBRACE: "}" > -| < LBRACKET: "[" > -| < RBRACKET: "]" > -| < SEMICOLON: ";" > -| < COMMA: "," > -| < DOT: "." > -| < AT: "@" > -} - -/* OPERATORS */ - -TOKEN : -{ - < ASSIGN: "=" > -| < LT: "<" > -| < BANG: "!" > -| < TILDE: "~" > -| < HOOK: "?" > -| < COLON: ":" > -| < EQ: "==" > -| < LE: "<=" > -| < GE: ">=" > -| < NE: "!=" > -| < SC_OR: "||" > -| < SC_AND: "&&" > -| < INCR: "++" > -| < DECR: "--" > -| < PLUS: "+" > -| < MINUS: "-" > -| < STAR: "*" > -| < SLASH: "/" > -| < BIT_AND: "&" > -| < BIT_OR: "|" > -| < XOR: "^" > -| < REM: "%" > -| < LSHIFT: "<<" > -| < PLUSASSIGN: "+=" > -| < MINUSASSIGN: "-=" > -| < STARASSIGN: "*=" > -| < SLASHASSIGN: "/=" > -| < ANDASSIGN: "&=" > -| < ORASSIGN: "|=" > -| < XORASSIGN: "^=" > -| < REMASSIGN: "%=" > -| < LSHIFTASSIGN: "<<=" > -| < RSIGNEDSHIFTASSIGN: ">>=" > -| < RUNSIGNEDSHIFTASSIGN: ">>>=" > -| < ELLIPSIS: "..." > -} - -/* >'s need special attention due to generics syntax. */ -TOKEN : -{ - < RUNSIGNEDSHIFT: ">>>" > - { - matchedToken.kind = GT; - ((Token.GTToken)matchedToken).realKind = RUNSIGNEDSHIFT; - input_stream.backup(2); - matchedToken.image = ">"; - } -| < RSIGNEDSHIFT: ">>" > - { - matchedToken.kind = GT; - ((Token.GTToken)matchedToken).realKind = RSIGNEDSHIFT; - input_stream.backup(1); - matchedToken.image = ">"; - } -| < GT: ">" > -} - -boolean Line() : -{/*@bgen(jjtree) Line */ - SimpleNode jjtn000 = new SimpleNode(JJTLINE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/ - int modifiers; -} -{/*@bgen(jjtree) Line */ - try { -/*@egen*/ - <EOF>/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - } -/*@egen*/ { - return true; - } -| - LOOKAHEAD(BlockStatement()) - BlockStatement()/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - } -/*@egen*/ { - return false; - } -| - LOOKAHEAD(Modifiers() [ TypeParameters() ] [ ResultType() ] <IDENTIFIER> FormalParameters() [ "throws" NameList() ] "{") - ClassOrInterfaceBodyDeclaration(false)/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - } -/*@egen*/ { - return false; - } -| - LOOKAHEAD(ClassOrInterfaceBodyDeclaration(false)) - ClassOrInterfaceBodyDeclaration(false)/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - } -/*@egen*/ { - return false; - } -| - LOOKAHEAD(Expression()) - Expression()/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - } -/*@egen*/ { - return false; - } -| - ImportDeclaration()/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - } -/*@egen*/ { - return false; - }/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -/***************************************** - * THE JAVA LANGUAGE GRAMMAR STARTS HERE * - *****************************************/ - -/* - * Program structuring syntax follows. - */ - -void CompilationUnit(): -{/*@bgen(jjtree) CompilationUnit */ - SimpleNode jjtn000 = new SimpleNode(JJTCOMPILATIONUNIT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) CompilationUnit */ - try { -/*@egen*/ - [ LOOKAHEAD( ( Annotation() )* "package" ) PackageDeclaration() ] - ( ImportDeclaration() )* - ( TypeDeclaration() )* - ( < "\u001a" > )? - ( <STUFF_TO_IGNORE: ~[]> )? - <EOF>/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void PackageDeclaration(): -{/*@bgen(jjtree) PackageDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTPACKAGEDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) PackageDeclaration */ - try { -/*@egen*/ - Modifiers() "package" Name() ";"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ImportDeclaration(): -{/*@bgen(jjtree) ImportDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTIMPORTDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ImportDeclaration */ - try { -/*@egen*/ - "import" [ "static" ] Name() [ "." "*" ] ";"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -/* - * Modifiers. We match all modifiers in a single rule to reduce the chances of - * syntax errors for simple modifier mistakes. It will also enable us to give - * better error messages. - */ - -int Modifiers(): -{/*@bgen(jjtree) Modifiers */ - SimpleNode jjtn000 = new SimpleNode(JJTMODIFIERS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/ - int modifiers = 0; -} -{/*@bgen(jjtree) Modifiers */ - try { -/*@egen*/ - ( - LOOKAHEAD(2) - ( - "public" { modifiers |= ModifierSet.PUBLIC; } - | - "static" { modifiers |= ModifierSet.STATIC; } - | - "protected" { modifiers |= ModifierSet.PROTECTED; } - | - "private" { modifiers |= ModifierSet.PRIVATE; } - | - "final" { modifiers |= ModifierSet.FINAL; } - | - "abstract" { modifiers |= ModifierSet.ABSTRACT; } - | - "synchronized" { modifiers |= ModifierSet.SYNCHRONIZED; } - | - "native" { modifiers |= ModifierSet.NATIVE; } - | - "transient" { modifiers |= ModifierSet.TRANSIENT; } - | - "volatile" { modifiers |= ModifierSet.VOLATILE; } - | - "strictfp" { modifiers |= ModifierSet.STRICTFP; } - | - Annotation() - ) - )*/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - } -/*@egen*/ - - { - return modifiers; - }/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -/* - * Declaration syntax follows. - */ -void TypeDeclaration(): -{/*@bgen(jjtree) TypeDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTTYPEDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/ - int modifiers; -} -{/*@bgen(jjtree) TypeDeclaration */ - try { -/*@egen*/ - ";" -| - modifiers = Modifiers() - ( - ClassOrInterfaceDeclaration(modifiers) - | - EnumDeclaration(modifiers) - | - AnnotationTypeDeclaration(modifiers) - )/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - - -void ClassOrInterfaceDeclaration(int modifiers): -{/*@bgen(jjtree) ClassOrInterfaceDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACEDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/ - boolean isInterface = false; -} -{/*@bgen(jjtree) ClassOrInterfaceDeclaration */ - try { -/*@egen*/ - ( "class" | "interface" { isInterface = true; } ) - <IDENTIFIER> - [ TypeParameters() ] - [ ExtendsList(isInterface) ] - [ ImplementsList(isInterface) ] - ClassOrInterfaceBody(isInterface)/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ExtendsList(boolean isInterface): -{/*@bgen(jjtree) ExtendsList */ - SimpleNode jjtn000 = new SimpleNode(JJTEXTENDSLIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/ - boolean extendsMoreThanOne = false; -} -{/*@bgen(jjtree) ExtendsList */ - try { -/*@egen*/ - "extends" ClassOrInterfaceType() - ( "," ClassOrInterfaceType() { extendsMoreThanOne = true; } )*/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - } -/*@egen*/ - { - if (extendsMoreThanOne && !isInterface) - throw new ParseException("A class cannot extend more than one other class"); - }/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ImplementsList(boolean isInterface): -{/*@bgen(jjtree) ImplementsList */ - SimpleNode jjtn000 = new SimpleNode(JJTIMPLEMENTSLIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ImplementsList */ - try { -/*@egen*/ - "implements" ClassOrInterfaceType() - ( "," ClassOrInterfaceType() )*/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - } -/*@egen*/ - { - if (isInterface) - throw new ParseException("An interface cannot implement other interfaces"); - }/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void EnumDeclaration(int modifiers): -{/*@bgen(jjtree) EnumDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTENUMDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) EnumDeclaration */ - try { -/*@egen*/ - "enum" <IDENTIFIER> - [ ImplementsList(false) ] - EnumBody()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void EnumBody(): -{/*@bgen(jjtree) EnumBody */ - SimpleNode jjtn000 = new SimpleNode(JJTENUMBODY); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) EnumBody */ - try { -/*@egen*/ - "{" - [ EnumConstant() ( LOOKAHEAD(2) "," EnumConstant() )* ] - [ "," ] - [ ";" ( ClassOrInterfaceBodyDeclaration(false) )* ] - "}"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void EnumConstant(): -{/*@bgen(jjtree) EnumConstant */ - SimpleNode jjtn000 = new SimpleNode(JJTENUMCONSTANT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) EnumConstant */ - try { -/*@egen*/ - Modifiers() <IDENTIFIER> [ Arguments() ] [ ClassOrInterfaceBody(false) ]/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void TypeParameters(): -{/*@bgen(jjtree) TypeParameters */ - SimpleNode jjtn000 = new SimpleNode(JJTTYPEPARAMETERS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) TypeParameters */ - try { -/*@egen*/ - "<" TypeParameter() ( "," TypeParameter() )* ">"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void TypeParameter(): -{/*@bgen(jjtree) TypeParameter */ - SimpleNode jjtn000 = new SimpleNode(JJTTYPEPARAMETER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) TypeParameter */ - try { -/*@egen*/ - <IDENTIFIER> [ TypeBound() ]/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void TypeBound(): -{/*@bgen(jjtree) TypeBound */ - SimpleNode jjtn000 = new SimpleNode(JJTTYPEBOUND); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) TypeBound */ - try { -/*@egen*/ - "extends" ClassOrInterfaceType() ( "&" ClassOrInterfaceType() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ClassOrInterfaceBody(boolean isInterface): -{/*@bgen(jjtree) ClassOrInterfaceBody */ - SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACEBODY); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ClassOrInterfaceBody */ - try { -/*@egen*/ - "{" ( ClassOrInterfaceBodyDeclaration(isInterface) )* "}"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ClassOrInterfaceBodyDeclaration(boolean isInterface): -{/*@bgen(jjtree) ClassOrInterfaceBodyDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACEBODYDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/ - boolean isNestedInterface = false; - int modifiers; -} -{/*@bgen(jjtree) ClassOrInterfaceBodyDeclaration */ - try { -/*@egen*/ - LOOKAHEAD(2) - Initializer()/*@bgen(jjtree)*/ - { - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - } -/*@egen*/ - { - if (isInterface) - throw new ParseException("An interface cannot have initializers"); - } -| - modifiers = Modifiers() // Just get all the modifiers out of the way. If you want to do - // more checks, pass the modifiers down to the member - ( - ClassOrInterfaceDeclaration(modifiers) - | - EnumDeclaration(modifiers) - | - LOOKAHEAD( [ TypeParameters() ] <IDENTIFIER> "(" ) - ConstructorDeclaration() - | - LOOKAHEAD( Type() <IDENTIFIER> ( "[" "]" )* ( "," | "=" | ";" ) ) - FieldDeclaration(modifiers) - | - MethodDeclaration(modifiers) - ) -| - ";"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void FieldDeclaration(int modifiers): -{/*@bgen(jjtree) FieldDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTFIELDDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) FieldDeclaration */ - try { -/*@egen*/ - // Modifiers are already matched in the caller - Type() VariableDeclarator() ( "," VariableDeclarator() )* ";"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void VariableDeclarator(): -{/*@bgen(jjtree) VariableDeclarator */ - SimpleNode jjtn000 = new SimpleNode(JJTVARIABLEDECLARATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) VariableDeclarator */ - try { -/*@egen*/ - VariableDeclaratorId() [ "=" VariableInitializer() ]/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void VariableDeclaratorId(): -{/*@bgen(jjtree) VariableDeclaratorId */ - SimpleNode jjtn000 = new SimpleNode(JJTVARIABLEDECLARATORID); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) VariableDeclaratorId */ - try { -/*@egen*/ - <IDENTIFIER> ( "[" "]" )*/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void VariableInitializer(): -{/*@bgen(jjtree) VariableInitializer */ - SimpleNode jjtn000 = new SimpleNode(JJTVARIABLEINITIALIZER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) VariableInitializer */ - try { -/*@egen*/ - ArrayInitializer() -| - Expression()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ArrayInitializer(): -{/*@bgen(jjtree) ArrayInitializer */ - SimpleNode jjtn000 = new SimpleNode(JJTARRAYINITIALIZER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ArrayInitializer */ - try { -/*@egen*/ - "{" [ VariableInitializer() ( LOOKAHEAD(2) "," VariableInitializer() )* ] [ "," ] "}"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void MethodDeclaration(int modifiers): -{/*@bgen(jjtree) MethodDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTMETHODDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) MethodDeclaration */ - try { -/*@egen*/ - // Modifiers already matched in the caller! - [ TypeParameters() ] - ResultType() - MethodDeclarator() [ "throws" NameList() ] - ( Block() | ";" )/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void MethodDeclarator(): -{/*@bgen(jjtree) MethodDeclarator */ - SimpleNode jjtn000 = new SimpleNode(JJTMETHODDECLARATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) MethodDeclarator */ - try { -/*@egen*/ - <IDENTIFIER> FormalParameters() ( "[" "]" )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void FormalParameters(): -{/*@bgen(jjtree) FormalParameters */ - SimpleNode jjtn000 = new SimpleNode(JJTFORMALPARAMETERS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) FormalParameters */ - try { -/*@egen*/ - "(" [ FormalParameter() ( "," FormalParameter() )* ] ")"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void FormalParameter(): -{/*@bgen(jjtree) FormalParameter */ - SimpleNode jjtn000 = new SimpleNode(JJTFORMALPARAMETER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) FormalParameter */ - try { -/*@egen*/ - Modifiers() Type() [ "..." ] VariableDeclaratorId()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ConstructorDeclaration(): -{/*@bgen(jjtree) ConstructorDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTCONSTRUCTORDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ConstructorDeclaration */ - try { -/*@egen*/ - [ TypeParameters() ] - // Modifiers matched in the caller - <IDENTIFIER> FormalParameters() [ "throws" NameList() ] - "{" - [ LOOKAHEAD(ExplicitConstructorInvocation()) - ExplicitConstructorInvocation() - ] - ( BlockStatement() )* - "}"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ExplicitConstructorInvocation(): -{/*@bgen(jjtree) ExplicitConstructorInvocation */ - SimpleNode jjtn000 = new SimpleNode(JJTEXPLICITCONSTRUCTORINVOCATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ExplicitConstructorInvocation */ - try { -/*@egen*/ - ( <IDENTIFIER> "." )* [ LOOKAHEAD(2) "this" "." ] - [ TypeArguments() ] ("this"|"super") Arguments() ";"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void Initializer(): -{/*@bgen(jjtree) Initializer */ - SimpleNode jjtn000 = new SimpleNode(JJTINITIALIZER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) Initializer */ - try { -/*@egen*/ - [ "static" ] Block()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - - -/* - * Type, name and expression syntax follows. - */ - -void Type(): -{/*@bgen(jjtree) Type */ - SimpleNode jjtn000 = new SimpleNode(JJTTYPE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) Type */ - try { -/*@egen*/ - LOOKAHEAD(2) ReferenceType() - | - PrimitiveType()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ReferenceType(): -{/*@bgen(jjtree) ReferenceType */ - SimpleNode jjtn000 = new SimpleNode(JJTREFERENCETYPE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ReferenceType */ - try { -/*@egen*/ - PrimitiveType() ( LOOKAHEAD(2) "[" "]" )+ - | - ( ClassOrInterfaceType() ) ( LOOKAHEAD(2) "[" "]" )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ClassOrInterfaceType(): -{/*@bgen(jjtree) ClassOrInterfaceType */ - SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACETYPE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ClassOrInterfaceType */ - try { -/*@egen*/ - <IDENTIFIER> [ LOOKAHEAD(2) TypeArguments() ] - ( LOOKAHEAD(2) "." <IDENTIFIER> [ LOOKAHEAD(2) TypeArguments() ] )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void TypeArguments(): -{/*@bgen(jjtree) TypeArguments */ - SimpleNode jjtn000 = new SimpleNode(JJTTYPEARGUMENTS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) TypeArguments */ - try { -/*@egen*/ - "<" TypeArgument() ( "," TypeArgument() )* ">"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void TypeArgument(): -{/*@bgen(jjtree) TypeArgument */ - SimpleNode jjtn000 = new SimpleNode(JJTTYPEARGUMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) TypeArgument */ - try { -/*@egen*/ - ReferenceType() - | - "?" [ WildcardBounds() ]/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void WildcardBounds(): -{/*@bgen(jjtree) WildcardBounds */ - SimpleNode jjtn000 = new SimpleNode(JJTWILDCARDBOUNDS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) WildcardBounds */ - try { -/*@egen*/ - "extends" ReferenceType() - | - "super" ReferenceType()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - - -void PrimitiveType(): -{/*@bgen(jjtree) PrimitiveType */ - SimpleNode jjtn000 = new SimpleNode(JJTPRIMITIVETYPE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) PrimitiveType */ - try { -/*@egen*/ - "boolean" -| - "char" -| - "byte" -| - "short" -| - "int" -| - "long" -| - "float" -| - "double"/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ResultType(): -{/*@bgen(jjtree) ResultType */ - SimpleNode jjtn000 = new SimpleNode(JJTRESULTTYPE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ResultType */ - try { -/*@egen*/ - "void" -| - Type()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void Name(): -/* - * A lookahead of 2 is required below since "Name" can be followed - * by a ".*" when used in the context of an "ImportDeclaration". - */ -{/*@bgen(jjtree) Name */ - SimpleNode jjtn000 = new SimpleNode(JJTNAME); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) Name */ - try { -/*@egen*/ - <IDENTIFIER> - ( LOOKAHEAD(2) "." <IDENTIFIER> - )*/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void NameList(): -{/*@bgen(jjtree) NameList */ - SimpleNode jjtn000 = new SimpleNode(JJTNAMELIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) NameList */ - try { -/*@egen*/ - Name() ( "," Name() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - - -/* - * Expression syntax follows. - */ - -void Expression(): -/* - * This expansion has been written this way instead of: - * Assignment() | ConditionalExpression() - * for performance reasons. - * However, it is a weakening of the grammar for it allows the LHS of - * assignments to be any conditional expression whereas it can only be - * a primary expression. Consider adding a semantic predicate to work - * around this. - */ -{/*@bgen(jjtree) Expression */ - SimpleNode jjtn000 = new SimpleNode(JJTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) Expression */ - try { -/*@egen*/ - ConditionalExpression() - [ - LOOKAHEAD(2) - AssignmentOperator() Expression() - ]/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void AssignmentOperator(): -{/*@bgen(jjtree) AssignmentOperator */ - SimpleNode jjtn000 = new SimpleNode(JJTASSIGNMENTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) AssignmentOperator */ - try { -/*@egen*/ - "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|="/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void AssignmentExpression(): -{/*@bgen(jjtree) AssignmentExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTASSIGNMENTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) AssignmentExpression */ - try { -/*@egen*/ - PrimaryExpression() AssignmentOperator() Expression()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ConditionalExpression(): -{/*@bgen(jjtree) ConditionalExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTCONDITIONALEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ConditionalExpression */ - try { -/*@egen*/ - ConditionalOrExpression() [ "?" Expression() ":" Expression() ]/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ConditionalOrExpression(): -{/*@bgen(jjtree) ConditionalOrExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTCONDITIONALOREXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ConditionalOrExpression */ - try { -/*@egen*/ - ConditionalAndExpression() ( "||" ConditionalAndExpression() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ConditionalAndExpression(): -{/*@bgen(jjtree) ConditionalAndExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTCONDITIONALANDEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ConditionalAndExpression */ - try { -/*@egen*/ - InclusiveOrExpression() ( "&&" InclusiveOrExpression() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void InclusiveOrExpression(): -{/*@bgen(jjtree) InclusiveOrExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTINCLUSIVEOREXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) InclusiveOrExpression */ - try { -/*@egen*/ - ExclusiveOrExpression() ( "|" ExclusiveOrExpression() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ExclusiveOrExpression(): -{/*@bgen(jjtree) ExclusiveOrExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTEXCLUSIVEOREXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ExclusiveOrExpression */ - try { -/*@egen*/ - AndExpression() ( "^" AndExpression() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void AndExpression(): -{/*@bgen(jjtree) AndExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTANDEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) AndExpression */ - try { -/*@egen*/ - EqualityExpression() ( "&" EqualityExpression() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void EqualityExpression(): -{/*@bgen(jjtree) EqualityExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTEQUALITYEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) EqualityExpression */ - try { -/*@egen*/ - InstanceOfExpression() ( ( "==" | "!=" ) InstanceOfExpression() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void InstanceOfExpression(): -{/*@bgen(jjtree) InstanceOfExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTINSTANCEOFEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) InstanceOfExpression */ - try { -/*@egen*/ - RelationalExpression() [ "instanceof" Type() ]/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void RelationalExpression(): -{/*@bgen(jjtree) RelationalExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTRELATIONALEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) RelationalExpression */ - try { -/*@egen*/ - ShiftExpression() ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ShiftExpression(): -{/*@bgen(jjtree) ShiftExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTSHIFTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ShiftExpression */ - try { -/*@egen*/ - AdditiveExpression() ( ( "<<" | RSIGNEDSHIFT() | RUNSIGNEDSHIFT() ) AdditiveExpression() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void AdditiveExpression(): -{/*@bgen(jjtree) AdditiveExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTADDITIVEEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) AdditiveExpression */ - try { -/*@egen*/ - MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void MultiplicativeExpression(): -{/*@bgen(jjtree) MultiplicativeExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTMULTIPLICATIVEEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) MultiplicativeExpression */ - try { -/*@egen*/ - UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void UnaryExpression(): -{/*@bgen(jjtree) UnaryExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTUNARYEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) UnaryExpression */ - try { -/*@egen*/ - ( "+" | "-" ) UnaryExpression() -| - PreIncrementExpression() -| - PreDecrementExpression() -| - UnaryExpressionNotPlusMinus()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void PreIncrementExpression(): -{/*@bgen(jjtree) PreIncrementExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTPREINCREMENTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) PreIncrementExpression */ - try { -/*@egen*/ - "++" PrimaryExpression()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void PreDecrementExpression(): -{/*@bgen(jjtree) PreDecrementExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTPREDECREMENTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) PreDecrementExpression */ - try { -/*@egen*/ - "--" PrimaryExpression()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void UnaryExpressionNotPlusMinus(): -{/*@bgen(jjtree) UnaryExpressionNotPlusMinus */ - SimpleNode jjtn000 = new SimpleNode(JJTUNARYEXPRESSIONNOTPLUSMINUS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) UnaryExpressionNotPlusMinus */ - try { -/*@egen*/ - ( "~" | "!" ) UnaryExpression() -| - LOOKAHEAD( CastLookahead() ) - CastExpression() -| - PostfixExpression()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -// This production is to determine lookahead only. The LOOKAHEAD specifications -// below are not used, but they are there just to indicate that we know about -// this. -void CastLookahead(): -{/*@bgen(jjtree) CastLookahead */ - SimpleNode jjtn000 = new SimpleNode(JJTCASTLOOKAHEAD); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) CastLookahead */ - try { -/*@egen*/ - LOOKAHEAD(2) - "(" PrimitiveType() -| - LOOKAHEAD("(" Type() "[") - "(" Type() "[" "]" -| - "(" Type() ")" ( "~" | "!" | "(" | <IDENTIFIER> | "this" | "super" | "new" | Literal() )/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void PostfixExpression(): -{/*@bgen(jjtree) PostfixExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTPOSTFIXEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) PostfixExpression */ - try { -/*@egen*/ - PrimaryExpression() [ PostfixOperator() ]/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void PostfixOperator(): -{/*@bgen(jjtree) PostfixOperator */ - SimpleNode jjtn000 = new SimpleNode(JJTPOSTFIXOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) PostfixOperator */ - try { -/*@egen*/ - "++" | "--"/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void CastExpression(): -{/*@bgen(jjtree) CastExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTCASTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) CastExpression */ - try { -/*@egen*/ - LOOKAHEAD("(" PrimitiveType()) - "(" Type() ")" UnaryExpression() -| - "(" Type() ")" UnaryExpressionNotPlusMinus()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void PrimaryExpression(): -{/*@bgen(jjtree) PrimaryExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTPRIMARYEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) PrimaryExpression */ - try { -/*@egen*/ - PrimaryPrefix() ( LOOKAHEAD(2) PrimarySuffix() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void MemberSelector(): -{/*@bgen(jjtree) MemberSelector */ - SimpleNode jjtn000 = new SimpleNode(JJTMEMBERSELECTOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) MemberSelector */ - try { -/*@egen*/ - "." TypeArguments() <IDENTIFIER>/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void PrimaryPrefix(): -{/*@bgen(jjtree) PrimaryPrefix */ - SimpleNode jjtn000 = new SimpleNode(JJTPRIMARYPREFIX); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) PrimaryPrefix */ - try { -/*@egen*/ - Literal() -| - LOOKAHEAD( ( <IDENTIFIER> "." )* "this" ) - ( <IDENTIFIER> "." )* - "this" -| - "super" "." <IDENTIFIER> -| - "(" Expression() ")" -| - AllocationExpression() -| - LOOKAHEAD( ResultType() "." "class" ) - ResultType() "." "class" -| - Name()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void PrimarySuffix(): -{/*@bgen(jjtree) PrimarySuffix */ - SimpleNode jjtn000 = new SimpleNode(JJTPRIMARYSUFFIX); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) PrimarySuffix */ - try { -/*@egen*/ - LOOKAHEAD("." "super" ".") - "." "super" -| - LOOKAHEAD("." "this") - "." "this" -| - LOOKAHEAD(2) - "." AllocationExpression() -| - LOOKAHEAD(3) - MemberSelector() -| - "[" Expression() "]" -| - "." <IDENTIFIER> -| - Arguments()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void Literal(): -{/*@bgen(jjtree) Literal */ - SimpleNode jjtn000 = new SimpleNode(JJTLITERAL); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) Literal */ - try { -/*@egen*/ - <INTEGER_LITERAL> -| - <FLOATING_POINT_LITERAL> -| - <CHARACTER_LITERAL> -| - <STRING_LITERAL> -| - BooleanLiteral() -| - NullLiteral()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void BooleanLiteral(): -{/*@bgen(jjtree) BooleanLiteral */ - SimpleNode jjtn000 = new SimpleNode(JJTBOOLEANLITERAL); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) BooleanLiteral */ - try { -/*@egen*/ - "true" -| - "false"/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void NullLiteral(): -{/*@bgen(jjtree) NullLiteral */ - SimpleNode jjtn000 = new SimpleNode(JJTNULLLITERAL); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) NullLiteral */ - try { -/*@egen*/ - "null"/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void Arguments(): -{/*@bgen(jjtree) Arguments */ - SimpleNode jjtn000 = new SimpleNode(JJTARGUMENTS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) Arguments */ - try { -/*@egen*/ - "(" [ ArgumentList() ] ")"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ArgumentList(): -{/*@bgen(jjtree) ArgumentList */ - SimpleNode jjtn000 = new SimpleNode(JJTARGUMENTLIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ArgumentList */ - try { -/*@egen*/ - Expression() ( "," Expression() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void AllocationExpression(): -{/*@bgen(jjtree) AllocationExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTALLOCATIONEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) AllocationExpression */ - try { -/*@egen*/ - LOOKAHEAD(2) - "new" PrimitiveType() ArrayDimsAndInits() -| - "new" ClassOrInterfaceType() [ TypeArguments() ] - ( - ArrayDimsAndInits() - | - Arguments() [ ClassOrInterfaceBody(false) ] - )/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -/* - * The third LOOKAHEAD specification below is to parse to PrimarySuffix - * if there is an expression between the "[...]". - */ -void ArrayDimsAndInits(): -{/*@bgen(jjtree) ArrayDimsAndInits */ - SimpleNode jjtn000 = new SimpleNode(JJTARRAYDIMSANDINITS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ArrayDimsAndInits */ - try { -/*@egen*/ - LOOKAHEAD(2) - ( LOOKAHEAD(2) "[" Expression() "]" )+ ( LOOKAHEAD(2) "[" "]" )* -| - ( "[" "]" )+ ArrayInitializer()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - - -/* - * Statement syntax follows. - */ - -void Statement(): -{/*@bgen(jjtree) Statement */ - SimpleNode jjtn000 = new SimpleNode(JJTSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) Statement */ - try { -/*@egen*/ - LOOKAHEAD(2) - LabeledStatement() -| - AssertStatement() -| - Block() -| - EmptyStatement() -| - StatementExpression() ";" -| - SwitchStatement() -| - IfStatement() -| - WhileStatement() -| - DoStatement() -| - ForStatement() -| - BreakStatement() -| - ContinueStatement() -| - ReturnStatement() -| - ThrowStatement() -| - SynchronizedStatement() -| - TryStatement()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void AssertStatement(): -{/*@bgen(jjtree) AssertStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTASSERTSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) AssertStatement */ - try { -/*@egen*/ - "assert" Expression() [ ":" Expression() ] ";"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void LabeledStatement(): -{/*@bgen(jjtree) LabeledStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTLABELEDSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) LabeledStatement */ - try { -/*@egen*/ - <IDENTIFIER> ":" Statement()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void Block(): -{/*@bgen(jjtree) Block */ - SimpleNode jjtn000 = new SimpleNode(JJTBLOCK); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) Block */ - try { -/*@egen*/ - "{" ( BlockStatement() )* "}"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void BlockStatement(): -{/*@bgen(jjtree) BlockStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTBLOCKSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) BlockStatement */ - try { -/*@egen*/ - LOOKAHEAD( Modifiers() Type() <IDENTIFIER> ) - LocalVariableDeclaration() ";" -| - Statement() -| - ClassOrInterfaceDeclaration(0)/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void LocalVariableDeclaration(): -{/*@bgen(jjtree) LocalVariableDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTLOCALVARIABLEDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) LocalVariableDeclaration */ - try { -/*@egen*/ - Modifiers() Type() VariableDeclarator() ( "," VariableDeclarator() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void EmptyStatement(): -{/*@bgen(jjtree) EmptyStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTEMPTYSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) EmptyStatement */ - try { -/*@egen*/ - ";"/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void StatementExpression(): -{/*@bgen(jjtree) StatementExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTSTATEMENTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) StatementExpression */ - try { -/*@egen*/ - PreIncrementExpression() -| - PreDecrementExpression() -| - LOOKAHEAD(PrimaryExpression() AssignmentOperator()) - AssignmentExpression() -| - PostfixExpression()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void SwitchStatement(): -{/*@bgen(jjtree) SwitchStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTSWITCHSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) SwitchStatement */ - try { -/*@egen*/ - "switch" "(" Expression() ")" "{" - ( SwitchLabel() ( BlockStatement() )* )* - "}"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void SwitchLabel(): -{/*@bgen(jjtree) SwitchLabel */ - SimpleNode jjtn000 = new SimpleNode(JJTSWITCHLABEL); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) SwitchLabel */ - try { -/*@egen*/ - "case" Expression() ":" -| - "default" ":"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void IfStatement(): -/* - * The disambiguating algorithm of JavaCC automatically binds dangling - * else's to the innermost if statement. The LOOKAHEAD specification - * is to tell JavaCC that we know what we are doing. - */ -{/*@bgen(jjtree) IfStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTIFSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) IfStatement */ - try { -/*@egen*/ - "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ]/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void WhileStatement(): -{/*@bgen(jjtree) WhileStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTWHILESTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) WhileStatement */ - try { -/*@egen*/ - "while" "(" Expression() ")" Statement()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void DoStatement(): -{/*@bgen(jjtree) DoStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTDOSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) DoStatement */ - try { -/*@egen*/ - "do" Statement() "while" "(" Expression() ")" ";"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ForStatement(): -{/*@bgen(jjtree) ForStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTFORSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ForStatement */ - try { -/*@egen*/ - "for" "(" - - ( - LOOKAHEAD(Modifiers() Type() <IDENTIFIER> ":") - Modifiers() Type() <IDENTIFIER> ":" Expression() - | - [ ForInit() ] ";" [ Expression() ] ";" [ ForUpdate() ] - ) - - ")" Statement()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ForInit(): -{/*@bgen(jjtree) ForInit */ - SimpleNode jjtn000 = new SimpleNode(JJTFORINIT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ForInit */ - try { -/*@egen*/ - LOOKAHEAD( Modifiers() Type() <IDENTIFIER> ) - LocalVariableDeclaration() -| - StatementExpressionList()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void StatementExpressionList(): -{/*@bgen(jjtree) StatementExpressionList */ - SimpleNode jjtn000 = new SimpleNode(JJTSTATEMENTEXPRESSIONLIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) StatementExpressionList */ - try { -/*@egen*/ - StatementExpression() ( "," StatementExpression() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ForUpdate(): -{/*@bgen(jjtree) ForUpdate */ - SimpleNode jjtn000 = new SimpleNode(JJTFORUPDATE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ForUpdate */ - try { -/*@egen*/ - StatementExpressionList()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void BreakStatement(): -{/*@bgen(jjtree) BreakStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTBREAKSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) BreakStatement */ - try { -/*@egen*/ - "break" [ <IDENTIFIER> ] ";"/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ContinueStatement(): -{/*@bgen(jjtree) ContinueStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTCONTINUESTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ContinueStatement */ - try { -/*@egen*/ - "continue" [ <IDENTIFIER> ] ";"/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ReturnStatement(): -{/*@bgen(jjtree) ReturnStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTRETURNSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ReturnStatement */ - try { -/*@egen*/ - "return" [ Expression() ] ";"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void ThrowStatement(): -{/*@bgen(jjtree) ThrowStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTTHROWSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) ThrowStatement */ - try { -/*@egen*/ - "throw" Expression() ";"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void SynchronizedStatement(): -{/*@bgen(jjtree) SynchronizedStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTSYNCHRONIZEDSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) SynchronizedStatement */ - try { -/*@egen*/ - "synchronized" "(" Expression() ")" Block()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void TryStatement(): -/* - * Semantic check required here to make sure that at least one - * finally/catch is present. - */ -{/*@bgen(jjtree) TryStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTTRYSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) TryStatement */ - try { -/*@egen*/ - "try" Block() - ( "catch" "(" FormalParameter() ")" Block() )* - [ "finally" Block() ]/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -/* We use productions to match >>>, >> and > so that we can keep the - * type declaration syntax with generics clean - */ - -void RUNSIGNEDSHIFT(): -{/*@bgen(jjtree) RUNSIGNEDSHIFT */ - SimpleNode jjtn000 = new SimpleNode(JJTRUNSIGNEDSHIFT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) RUNSIGNEDSHIFT */ - try { -/*@egen*/ - ( LOOKAHEAD({ getToken(1).kind == GT && - ((Token.GTToken)getToken(1)).realKind == RUNSIGNEDSHIFT} ) - ">" ">" ">" - )/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void RSIGNEDSHIFT(): -{/*@bgen(jjtree) RSIGNEDSHIFT */ - SimpleNode jjtn000 = new SimpleNode(JJTRSIGNEDSHIFT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) RSIGNEDSHIFT */ - try { -/*@egen*/ - ( LOOKAHEAD({ getToken(1).kind == GT && - ((Token.GTToken)getToken(1)).realKind == RSIGNEDSHIFT} ) - ">" ">" - )/*@bgen(jjtree)*/ - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -/* Annotation syntax follows. */ - -void Annotation(): -{/*@bgen(jjtree) Annotation */ - SimpleNode jjtn000 = new SimpleNode(JJTANNOTATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) Annotation */ - try { -/*@egen*/ - LOOKAHEAD( "@" Name() "(" ( <IDENTIFIER> "=" | ")" )) - NormalAnnotation() - | - LOOKAHEAD( "@" Name() "(" ) - SingleMemberAnnotation() - | - MarkerAnnotation()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void NormalAnnotation(): -{/*@bgen(jjtree) NormalAnnotation */ - SimpleNode jjtn000 = new SimpleNode(JJTNORMALANNOTATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) NormalAnnotation */ - try { -/*@egen*/ - "@" Name() "(" [ MemberValuePairs() ] ")"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void MarkerAnnotation(): -{/*@bgen(jjtree) MarkerAnnotation */ - SimpleNode jjtn000 = new SimpleNode(JJTMARKERANNOTATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) MarkerAnnotation */ - try { -/*@egen*/ - "@" Name()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void SingleMemberAnnotation(): -{/*@bgen(jjtree) SingleMemberAnnotation */ - SimpleNode jjtn000 = new SimpleNode(JJTSINGLEMEMBERANNOTATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) SingleMemberAnnotation */ - try { -/*@egen*/ - "@" Name() "(" MemberValue() ")"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void MemberValuePairs(): -{/*@bgen(jjtree) MemberValuePairs */ - SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUEPAIRS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) MemberValuePairs */ - try { -/*@egen*/ - MemberValuePair() ( "," MemberValuePair() )*/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void MemberValuePair(): -{/*@bgen(jjtree) MemberValuePair */ - SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUEPAIR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) MemberValuePair */ - try { -/*@egen*/ - <IDENTIFIER> "=" MemberValue()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void MemberValue(): -{/*@bgen(jjtree) MemberValue */ - SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) MemberValue */ - try { -/*@egen*/ - Annotation() - | - MemberValueArrayInitializer() - | - ConditionalExpression()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void MemberValueArrayInitializer(): -{/*@bgen(jjtree) MemberValueArrayInitializer */ - SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUEARRAYINITIALIZER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) MemberValueArrayInitializer */ - try { -/*@egen*/ - "{" MemberValue() ( LOOKAHEAD(2) "," MemberValue() )* [ "," ] "}"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - - -/* Annotation Types. */ - -void AnnotationTypeDeclaration(int modifiers): -{/*@bgen(jjtree) AnnotationTypeDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTANNOTATIONTYPEDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) AnnotationTypeDeclaration */ - try { -/*@egen*/ - "@" "interface" <IDENTIFIER> AnnotationTypeBody()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void AnnotationTypeBody(): -{/*@bgen(jjtree) AnnotationTypeBody */ - SimpleNode jjtn000 = new SimpleNode(JJTANNOTATIONTYPEBODY); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) AnnotationTypeBody */ - try { -/*@egen*/ - "{" ( AnnotationTypeMemberDeclaration() )* "}"/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void AnnotationTypeMemberDeclaration(): -{/*@bgen(jjtree) AnnotationTypeMemberDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTANNOTATIONTYPEMEMBERDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/ - int modifiers; -} -{/*@bgen(jjtree) AnnotationTypeMemberDeclaration */ - try { -/*@egen*/ - modifiers = Modifiers() - ( - LOOKAHEAD(Type() <IDENTIFIER> "(") - Type() <IDENTIFIER> "(" ")" [ DefaultValue() ] ";" - | - ClassOrInterfaceDeclaration(modifiers) - | - EnumDeclaration(modifiers) - | - AnnotationTypeDeclaration(modifiers) - | - FieldDeclaration(modifiers) - ) - | - ( ";" )/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} - -void DefaultValue(): -{/*@bgen(jjtree) DefaultValue */ - SimpleNode jjtn000 = new SimpleNode(JJTDEFAULTVALUE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); -/*@egen*/} -{/*@bgen(jjtree) DefaultValue */ - try { -/*@egen*/ - "default" MemberValue()/*@bgen(jjtree)*/ - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - throw (RuntimeException)jjte000; - } - if (jjte000 instanceof ParseException) { - throw (ParseException)jjte000; - } - throw (Error)jjte000; - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } -/*@egen*/ -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Java1.5.jjt b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Java1.5.jjt deleted file mode 100644 index b47955f..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Java1.5.jjt +++ /dev/null @@ -1,2150 +0,0 @@ - -/* - * Copyright © 2002 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * California 95054, U.S.A. All rights reserved. Sun Microsystems, Inc. has - * intellectual property rights relating to technology embodied in the product - * that is described in this document. In particular, and without limitation, - * these intellectual property rights may include one or more of the U.S. - * patents listed at http://www.sun.com/patents and one or more additional - * patents or pending patent applications in the U.S. and in other countries. - * U.S. Government Rights - Commercial software. Government users are subject - * to the Sun Microsystems, Inc. standard license agreement and applicable - * provisions of the FAR and its supplements. Use is subject to license terms. - * Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered - * trademarks of Sun Microsystems, Inc. in the U.S. and other countries. This - * product is covered and controlled by U.S. Export Control laws and may be - * subject to the export or import laws in other countries. Nuclear, missile, - * chemical biological weapons or nuclear maritime end uses or end users, - * whether direct or indirect, are strictly prohibited. Export or reexport - * to countries subject to U.S. embargo or to entities identified on U.S. - * export exclusion lists, including, but not limited to, the denied persons - * and specially designated nationals lists is strictly prohibited. - */ - -// Slightly modified version of javacc's reference 1.5 grammar, tweaked for -// usage with JAXX. There are two main areas of changes: several new -// nonterminals were added to make identifying certain constructs easier, -// and the Line nonterminal was added to support JAXX's script tags. -// Several of the new changes are inefficient and require excess lookahead, -// but at this point I'd rather have inefficiency than risk breaking it during -// attempted optimizations. - -options { - JAVA_UNICODE_ESCAPE = true; - ERROR_REPORTING = false; - STATIC = false; - JDK_VERSION = "1.4"; - NODE_SCOPE_HOOK=true; -} - -PARSER_BEGIN(JavaParser) -package jaxx.parser; - -import java.io.*; - -/** - * Grammar to parse Java version 1.5 - * @author Sreenivasa Viswanadha - Simplified and enhanced for 1.5 - */ -public class JavaParser -{ - /** - * Class to hold modifiers. - */ - static public final class ModifierSet - { - /* Definitions of the bits in the modifiers field. */ - public static final int PUBLIC = 0x0001; - public static final int PROTECTED = 0x0002; - public static final int PRIVATE = 0x0004; - public static final int ABSTRACT = 0x0008; - public static final int STATIC = 0x0010; - public static final int FINAL = 0x0020; - public static final int SYNCHRONIZED = 0x0040; - public static final int NATIVE = 0x0080; - public static final int TRANSIENT = 0x0100; - public static final int VOLATILE = 0x0200; - public static final int STRICTFP = 0x1000; - - /** A set of accessors that indicate whether the specified modifier - is in the set. */ - - public boolean isPublic(int modifiers) - { - return (modifiers & PUBLIC) != 0; - } - - public boolean isProtected(int modifiers) - { - return (modifiers & PROTECTED) != 0; - } - - public boolean isPrivate(int modifiers) - { - return (modifiers & PRIVATE) != 0; - } - - public boolean isStatic(int modifiers) - { - return (modifiers & STATIC) != 0; - } - - public boolean isAbstract(int modifiers) - { - return (modifiers & ABSTRACT) != 0; - } - - public boolean isFinal(int modifiers) - { - return (modifiers & FINAL) != 0; - } - - public boolean isNative(int modifiers) - { - return (modifiers & NATIVE) != 0; - } - - public boolean isStrictfp(int modifiers) - { - return (modifiers & STRICTFP) != 0; - } - - public boolean isSynchronized(int modifiers) - { - return (modifiers & SYNCHRONIZED) != 0; - } - - public boolean isTransient(int modifiers) - { - return (modifiers & TRANSIENT) != 0; - } - - public boolean isVolatile(int modifiers) - { - return (modifiers & VOLATILE) != 0; - } - - /** - * Removes the given modifier. - */ - static int removeModifier(int modifiers, int mod) - { - return modifiers & ~mod; - } - } - - public JavaParser(String fileName) - { - this(System.in); - try { ReInit(new FileInputStream(new File(fileName))); } - catch(Exception e) { e.printStackTrace(); } - } - - void jjtreeOpenNodeScope(Node n) { - ((SimpleNode) n).firstToken = getToken(1); - } - - void jjtreeCloseNodeScope(Node n) { - ((SimpleNode) n).lastToken = getToken(0); - } - - public SimpleNode popNode() - { - if ( jjtree.nodeArity() > 0) // number of child nodes - return (SimpleNode)jjtree.popNode(); - else - return null; - } - public static void main(String args[]) { - JavaParser parser; - if (args.length == 0) { - System.out.println("Java Parser Version 1.1: Reading from standard input . . ."); - parser = new JavaParser(System.in); - } else if (args.length == 1) { - System.out.println("Java Parser Version 1.1: Reading from file " + args[0] + " . . ."); - try { - parser = new JavaParser(new java.io.FileInputStream(args[0])); - } catch (java.io.FileNotFoundException e) { - System.out.println("Java Parser Version 1.1: File " + args[0] + " not found."); - return; - } - } else { - System.out.println("Java Parser Version 1.1: Usage is one of:"); - System.out.println(" java JavaParser < inputfile"); - System.out.println("OR"); - System.out.println(" java JavaParser inputfile"); - return; - } - try { - parser.CompilationUnit(); - System.out.println("Java Parser Version 1.1: Java program parsed successfully."); - } catch (ParseException e) { - System.out.println(e.getMessage()); - System.out.println("Java Parser Version 1.1: Encountered errors during parse."); - } - } - -} - -PARSER_END(JavaParser) - -/* COMMENTS */ - -MORE : -{ - <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT -| - "/*" : IN_MULTI_LINE_COMMENT -} - -SPECIAL_TOKEN: -{ - <WHITE_SPACE: ([" ", "\n", "\r", "\t", "\f"])+> -} - -SPECIAL_TOKEN : -{ - <SINGLE_LINE_COMMENT: "//" (~["\n", "\r"])* ("\n" | "\r" | "\r\n")?> -} - -<IN_FORMAL_COMMENT> -SPECIAL_TOKEN : -{ - <FORMAL_COMMENT: "*/" > : DEFAULT -} - -<IN_MULTI_LINE_COMMENT> -SPECIAL_TOKEN : -{ - <MULTI_LINE_COMMENT: "*/" > : DEFAULT -} - -<IN_FORMAL_COMMENT,IN_MULTI_LINE_COMMENT> -MORE : -{ - < ~[] > -} - -/* RESERVED WORDS AND LITERALS */ - -TOKEN : -{ - < ABSTRACT: "abstract" > -| < ASSERT: "assert" > -| < BOOLEAN: "boolean" > -| < BREAK: "break" > -| < BYTE: "byte" > -| < CASE: "case" > -| < CATCH: "catch" > -| < CHAR: "char" > -| < CLASS: "class" > -| < CONST: "const" > -| < CONTINUE: "continue" > -| < _DEFAULT: "default" > -| < DO: "do" > -| < DOUBLE: "double" > -| < ELSE: "else" > -| < ENUM: "enum" > -| < EXTENDS: "extends" > -| < FALSE: "false" > -| < FINAL: "final" > -| < FINALLY: "finally" > -| < FLOAT: "float" > -| < FOR: "for" > -| < GOTO: "goto" > -| < IF: "if" > -| < IMPLEMENTS: "implements" > -| < IMPORT: "import" > -| < INSTANCEOF: "instanceof" > -| < INT: "int" > -| < INTERFACE: "interface" > -| < LONG: "long" > -| < NATIVE: "native" > -| < NEW: "new" > -| < NULL: "null" > -| < PACKAGE: "package"> -| < PRIVATE: "private" > -| < PROTECTED: "protected" > -| < PUBLIC: "public" > -| < RETURN: "return" > -| < SHORT: "short" > -| < STATIC: "static" > -| < STRICTFP: "strictfp" > -| < SUPER: "super" > -| < SWITCH: "switch" > -| < SYNCHRONIZED: "synchronized" > -| < THIS: "this" > -| < THROW: "throw" > -| < THROWS: "throws" > -| < TRANSIENT: "transient" > -| < TRUE: "true" > -| < TRY: "try" > -| < VOID: "void" > -| < VOLATILE: "volatile" > -| < WHILE: "while" > -} - -/* LITERALS */ - -TOKEN : -{ - < INTEGER_LITERAL: - <DECIMAL_LITERAL> (["l","L"])? - | <HEX_LITERAL> (["l","L"])? - | <OCTAL_LITERAL> (["l","L"])? - > -| - < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > -| - < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > -| - < #OCTAL_LITERAL: "0" (["0"-"7"])* > -| - < FLOATING_POINT_LITERAL: - <DECIMAL_FLOATING_POINT_LITERAL> - | <HEXADECIMAL_FLOATING_POINT_LITERAL> - > -| - < #DECIMAL_FLOATING_POINT_LITERAL: - (["0"-"9"])+ "." (["0"-"9"])* (<DECIMAL_EXPONENT>)? (["f","F","d","D"])? - | "." (["0"-"9"])+ (<DECIMAL_EXPONENT>)? (["f","F","d","D"])? - | (["0"-"9"])+ <DECIMAL_EXPONENT> (["f","F","d","D"])? - | (["0"-"9"])+ (<DECIMAL_EXPONENT>)? ["f","F","d","D"] - > -| - < #DECIMAL_EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > -| - < #HEXADECIMAL_FLOATING_POINT_LITERAL: - "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])+ (".")? <HEXADECIMAL_EXPONENT> (["f","F","d","D"])? - | "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])* "." (["0"-"9","a"-"f","A"-"F"])+ <HEXADECIMAL_EXPONENT> (["f","F","d","D"])? - > -| - < #HEXADECIMAL_EXPONENT: ["p","P"] (["+","-"])? (["0"-"9"])+ > -| - < CHARACTER_LITERAL: - "'" - ( (~["'","\\","\n","\r"]) - | ("\\" - ( ["n","t","b","r","f","\\","'","\""] - | ["0"-"7"] ( ["0"-"7"] )? - | ["0"-"3"] ["0"-"7"] ["0"-"7"] - ) - ) - ) - "'" - > -| - < STRING_LITERAL: - "\"" - ( (~["\"","\\","\n","\r"]) - | ("\\" - ( ["n","t","b","r","f","\\","'","\""] - | ["0"-"7"] ( ["0"-"7"] )? - | ["0"-"3"] ["0"-"7"] ["0"-"7"] - ) - ) - )* - "\"" - > -} - -/* IDENTIFIERS */ - -TOKEN : -{ - < IDENTIFIER: <LETTER> (<PART_LETTER>)* > -| - < #LETTER: - [ // all chars for which Character.isIdentifierStart is true - "$", - "A"-"Z", - "_", - "a"-"z", - "\u00a2"-"\u00a5", - "\u00aa", - "\u00b5", - "\u00ba", - "\u00c0"-"\u00d6", - "\u00d8"-"\u00f6", - "\u00f8"-"\u021f", - "\u0222"-"\u0233", - "\u0250"-"\u02ad", - "\u02b0"-"\u02b8", - "\u02bb"-"\u02c1", - "\u02d0"-"\u02d1", - "\u02e0"-"\u02e4", - "\u02ee", - "\u037a", - "\u0386", - "\u0388"-"\u038a", - "\u038c", - "\u038e"-"\u03a1", - "\u03a3"-"\u03ce", - "\u03d0"-"\u03d7", - "\u03da"-"\u03f3", - "\u0400"-"\u0481", - "\u048c"-"\u04c4", - "\u04c7"-"\u04c8", - "\u04cb"-"\u04cc", - "\u04d0"-"\u04f5", - "\u04f8"-"\u04f9", - "\u0531"-"\u0556", - "\u0559", - "\u0561"-"\u0587", - "\u05d0"-"\u05ea", - "\u05f0"-"\u05f2", - "\u0621"-"\u063a", - "\u0640"-"\u064a", - "\u0671"-"\u06d3", - "\u06d5", - "\u06e5"-"\u06e6", - "\u06fa"-"\u06fc", - "\u0710", - "\u0712"-"\u072c", - "\u0780"-"\u07a5", - "\u0905"-"\u0939", - "\u093d", - "\u0950", - "\u0958"-"\u0961", - "\u0985"-"\u098c", - "\u098f"-"\u0990", - "\u0993"-"\u09a8", - "\u09aa"-"\u09b0", - "\u09b2", - "\u09b6"-"\u09b9", - "\u09dc"-"\u09dd", - "\u09df"-"\u09e1", - "\u09f0"-"\u09f3", - "\u0a05"-"\u0a0a", - "\u0a0f"-"\u0a10", - "\u0a13"-"\u0a28", - "\u0a2a"-"\u0a30", - "\u0a32"-"\u0a33", - "\u0a35"-"\u0a36", - "\u0a38"-"\u0a39", - "\u0a59"-"\u0a5c", - "\u0a5e", - "\u0a72"-"\u0a74", - "\u0a85"-"\u0a8b", - "\u0a8d", - "\u0a8f"-"\u0a91", - "\u0a93"-"\u0aa8", - "\u0aaa"-"\u0ab0", - "\u0ab2"-"\u0ab3", - "\u0ab5"-"\u0ab9", - "\u0abd", - "\u0ad0", - "\u0ae0", - "\u0b05"-"\u0b0c", - "\u0b0f"-"\u0b10", - "\u0b13"-"\u0b28", - "\u0b2a"-"\u0b30", - "\u0b32"-"\u0b33", - "\u0b36"-"\u0b39", - "\u0b3d", - "\u0b5c"-"\u0b5d", - "\u0b5f"-"\u0b61", - "\u0b85"-"\u0b8a", - "\u0b8e"-"\u0b90", - "\u0b92"-"\u0b95", - "\u0b99"-"\u0b9a", - "\u0b9c", - "\u0b9e"-"\u0b9f", - "\u0ba3"-"\u0ba4", - "\u0ba8"-"\u0baa", - "\u0bae"-"\u0bb5", - "\u0bb7"-"\u0bb9", - "\u0c05"-"\u0c0c", - "\u0c0e"-"\u0c10", - "\u0c12"-"\u0c28", - "\u0c2a"-"\u0c33", - "\u0c35"-"\u0c39", - "\u0c60"-"\u0c61", - "\u0c85"-"\u0c8c", - "\u0c8e"-"\u0c90", - "\u0c92"-"\u0ca8", - "\u0caa"-"\u0cb3", - "\u0cb5"-"\u0cb9", - "\u0cde", - "\u0ce0"-"\u0ce1", - "\u0d05"-"\u0d0c", - "\u0d0e"-"\u0d10", - "\u0d12"-"\u0d28", - "\u0d2a"-"\u0d39", - "\u0d60"-"\u0d61", - "\u0d85"-"\u0d96", - "\u0d9a"-"\u0db1", - "\u0db3"-"\u0dbb", - "\u0dbd", - "\u0dc0"-"\u0dc6", - "\u0e01"-"\u0e30", - "\u0e32"-"\u0e33", - "\u0e3f"-"\u0e46", - "\u0e81"-"\u0e82", - "\u0e84", - "\u0e87"-"\u0e88", - "\u0e8a", - "\u0e8d", - "\u0e94"-"\u0e97", - "\u0e99"-"\u0e9f", - "\u0ea1"-"\u0ea3", - "\u0ea5", - "\u0ea7", - "\u0eaa"-"\u0eab", - "\u0ead"-"\u0eb0", - "\u0eb2"-"\u0eb3", - "\u0ebd", - "\u0ec0"-"\u0ec4", - "\u0ec6", - "\u0edc"-"\u0edd", - "\u0f00", - "\u0f40"-"\u0f47", - "\u0f49"-"\u0f6a", - "\u0f88"-"\u0f8b", - "\u1000"-"\u1021", - "\u1023"-"\u1027", - "\u1029"-"\u102a", - "\u1050"-"\u1055", - "\u10a0"-"\u10c5", - "\u10d0"-"\u10f6", - "\u1100"-"\u1159", - "\u115f"-"\u11a2", - "\u11a8"-"\u11f9", - "\u1200"-"\u1206", - "\u1208"-"\u1246", - "\u1248", - "\u124a"-"\u124d", - "\u1250"-"\u1256", - "\u1258", - "\u125a"-"\u125d", - "\u1260"-"\u1286", - "\u1288", - "\u128a"-"\u128d", - "\u1290"-"\u12ae", - "\u12b0", - "\u12b2"-"\u12b5", - "\u12b8"-"\u12be", - "\u12c0", - "\u12c2"-"\u12c5", - "\u12c8"-"\u12ce", - "\u12d0"-"\u12d6", - "\u12d8"-"\u12ee", - "\u12f0"-"\u130e", - "\u1310", - "\u1312"-"\u1315", - "\u1318"-"\u131e", - "\u1320"-"\u1346", - "\u1348"-"\u135a", - "\u13a0"-"\u13f4", - "\u1401"-"\u166c", - "\u166f"-"\u1676", - "\u1681"-"\u169a", - "\u16a0"-"\u16ea", - "\u1780"-"\u17b3", - "\u17db", - "\u1820"-"\u1877", - "\u1880"-"\u18a8", - "\u1e00"-"\u1e9b", - "\u1ea0"-"\u1ef9", - "\u1f00"-"\u1f15", - "\u1f18"-"\u1f1d", - "\u1f20"-"\u1f45", - "\u1f48"-"\u1f4d", - "\u1f50"-"\u1f57", - "\u1f59", - "\u1f5b", - "\u1f5d", - "\u1f5f"-"\u1f7d", - "\u1f80"-"\u1fb4", - "\u1fb6"-"\u1fbc", - "\u1fbe", - "\u1fc2"-"\u1fc4", - "\u1fc6"-"\u1fcc", - "\u1fd0"-"\u1fd3", - "\u1fd6"-"\u1fdb", - "\u1fe0"-"\u1fec", - "\u1ff2"-"\u1ff4", - "\u1ff6"-"\u1ffc", - "\u203f"-"\u2040", - "\u207f", - "\u20a0"-"\u20af", - "\u2102", - "\u2107", - "\u210a"-"\u2113", - "\u2115", - "\u2119"-"\u211d", - "\u2124", - "\u2126", - "\u2128", - "\u212a"-"\u212d", - "\u212f"-"\u2131", - "\u2133"-"\u2139", - "\u2160"-"\u2183", - "\u3005"-"\u3007", - "\u3021"-"\u3029", - "\u3031"-"\u3035", - "\u3038"-"\u303a", - "\u3041"-"\u3094", - "\u309d"-"\u309e", - "\u30a1"-"\u30fe", - "\u3105"-"\u312c", - "\u3131"-"\u318e", - "\u31a0"-"\u31b7", - "\u3400"-"\u4db5", - "\u4e00"-"\u9fa5", - "\ua000"-"\ua48c", - "\uac00"-"\ud7a3", - "\uf900"-"\ufa2d", - "\ufb00"-"\ufb06", - "\ufb13"-"\ufb17", - "\ufb1d", - "\ufb1f"-"\ufb28", - "\ufb2a"-"\ufb36", - "\ufb38"-"\ufb3c", - "\ufb3e", - "\ufb40"-"\ufb41", - "\ufb43"-"\ufb44", - "\ufb46"-"\ufbb1", - "\ufbd3"-"\ufd3d", - "\ufd50"-"\ufd8f", - "\ufd92"-"\ufdc7", - "\ufdf0"-"\ufdfb", - "\ufe33"-"\ufe34", - "\ufe4d"-"\ufe4f", - "\ufe69", - "\ufe70"-"\ufe72", - "\ufe74", - "\ufe76"-"\ufefc", - "\uff04", - "\uff21"-"\uff3a", - "\uff3f", - "\uff41"-"\uff5a", - "\uff65"-"\uffbe", - "\uffc2"-"\uffc7", - "\uffca"-"\uffcf", - "\uffd2"-"\uffd7", - "\uffda"-"\uffdc", - "\uffe0"-"\uffe1", - "\uffe5"-"\uffe6" - ] - > -| - < #PART_LETTER: - [ // all chars for which Character.isIdentifierPart is true - "\u0000"-"\u0008", - "\u000e"-"\u001b", - "$", - "0"-"9", - "A"-"Z", - "_", - "a"-"z", - "\u007f"-"\u009f", - "\u00a2"-"\u00a5", - "\u00aa", - "\u00b5", - "\u00ba", - "\u00c0"-"\u00d6", - "\u00d8"-"\u00f6", - "\u00f8"-"\u021f", - "\u0222"-"\u0233", - "\u0250"-"\u02ad", - "\u02b0"-"\u02b8", - "\u02bb"-"\u02c1", - "\u02d0"-"\u02d1", - "\u02e0"-"\u02e4", - "\u02ee", - "\u0300"-"\u034e", - "\u0360"-"\u0362", - "\u037a", - "\u0386", - "\u0388"-"\u038a", - "\u038c", - "\u038e"-"\u03a1", - "\u03a3"-"\u03ce", - "\u03d0"-"\u03d7", - "\u03da"-"\u03f3", - "\u0400"-"\u0481", - "\u0483"-"\u0486", - "\u048c"-"\u04c4", - "\u04c7"-"\u04c8", - "\u04cb"-"\u04cc", - "\u04d0"-"\u04f5", - "\u04f8"-"\u04f9", - "\u0531"-"\u0556", - "\u0559", - "\u0561"-"\u0587", - "\u0591"-"\u05a1", - "\u05a3"-"\u05b9", - "\u05bb"-"\u05bd", - "\u05bf", - "\u05c1"-"\u05c2", - "\u05c4", - "\u05d0"-"\u05ea", - "\u05f0"-"\u05f2", - "\u0621"-"\u063a", - "\u0640"-"\u0655", - "\u0660"-"\u0669", - "\u0670"-"\u06d3", - "\u06d5"-"\u06dc", - "\u06df"-"\u06e8", - "\u06ea"-"\u06ed", - "\u06f0"-"\u06fc", - "\u070f"-"\u072c", - "\u0730"-"\u074a", - "\u0780"-"\u07b0", - "\u0901"-"\u0903", - "\u0905"-"\u0939", - "\u093c"-"\u094d", - "\u0950"-"\u0954", - "\u0958"-"\u0963", - "\u0966"-"\u096f", - "\u0981"-"\u0983", - "\u0985"-"\u098c", - "\u098f"-"\u0990", - "\u0993"-"\u09a8", - "\u09aa"-"\u09b0", - "\u09b2", - "\u09b6"-"\u09b9", - "\u09bc", - "\u09be"-"\u09c4", - "\u09c7"-"\u09c8", - "\u09cb"-"\u09cd", - "\u09d7", - "\u09dc"-"\u09dd", - "\u09df"-"\u09e3", - "\u09e6"-"\u09f3", - "\u0a02", - "\u0a05"-"\u0a0a", - "\u0a0f"-"\u0a10", - "\u0a13"-"\u0a28", - "\u0a2a"-"\u0a30", - "\u0a32"-"\u0a33", - "\u0a35"-"\u0a36", - "\u0a38"-"\u0a39", - "\u0a3c", - "\u0a3e"-"\u0a42", - "\u0a47"-"\u0a48", - "\u0a4b"-"\u0a4d", - "\u0a59"-"\u0a5c", - "\u0a5e", - "\u0a66"-"\u0a74", - "\u0a81"-"\u0a83", - "\u0a85"-"\u0a8b", - "\u0a8d", - "\u0a8f"-"\u0a91", - "\u0a93"-"\u0aa8", - "\u0aaa"-"\u0ab0", - "\u0ab2"-"\u0ab3", - "\u0ab5"-"\u0ab9", - "\u0abc"-"\u0ac5", - "\u0ac7"-"\u0ac9", - "\u0acb"-"\u0acd", - "\u0ad0", - "\u0ae0", - "\u0ae6"-"\u0aef", - "\u0b01"-"\u0b03", - "\u0b05"-"\u0b0c", - "\u0b0f"-"\u0b10", - "\u0b13"-"\u0b28", - "\u0b2a"-"\u0b30", - "\u0b32"-"\u0b33", - "\u0b36"-"\u0b39", - "\u0b3c"-"\u0b43", - "\u0b47"-"\u0b48", - "\u0b4b"-"\u0b4d", - "\u0b56"-"\u0b57", - "\u0b5c"-"\u0b5d", - "\u0b5f"-"\u0b61", - "\u0b66"-"\u0b6f", - "\u0b82"-"\u0b83", - "\u0b85"-"\u0b8a", - "\u0b8e"-"\u0b90", - "\u0b92"-"\u0b95", - "\u0b99"-"\u0b9a", - "\u0b9c", - "\u0b9e"-"\u0b9f", - "\u0ba3"-"\u0ba4", - "\u0ba8"-"\u0baa", - "\u0bae"-"\u0bb5", - "\u0bb7"-"\u0bb9", - "\u0bbe"-"\u0bc2", - "\u0bc6"-"\u0bc8", - "\u0bca"-"\u0bcd", - "\u0bd7", - "\u0be7"-"\u0bef", - "\u0c01"-"\u0c03", - "\u0c05"-"\u0c0c", - "\u0c0e"-"\u0c10", - "\u0c12"-"\u0c28", - "\u0c2a"-"\u0c33", - "\u0c35"-"\u0c39", - "\u0c3e"-"\u0c44", - "\u0c46"-"\u0c48", - "\u0c4a"-"\u0c4d", - "\u0c55"-"\u0c56", - "\u0c60"-"\u0c61", - "\u0c66"-"\u0c6f", - "\u0c82"-"\u0c83", - "\u0c85"-"\u0c8c", - "\u0c8e"-"\u0c90", - "\u0c92"-"\u0ca8", - "\u0caa"-"\u0cb3", - "\u0cb5"-"\u0cb9", - "\u0cbe"-"\u0cc4", - "\u0cc6"-"\u0cc8", - "\u0cca"-"\u0ccd", - "\u0cd5"-"\u0cd6", - "\u0cde", - "\u0ce0"-"\u0ce1", - "\u0ce6"-"\u0cef", - "\u0d02"-"\u0d03", - "\u0d05"-"\u0d0c", - "\u0d0e"-"\u0d10", - "\u0d12"-"\u0d28", - "\u0d2a"-"\u0d39", - "\u0d3e"-"\u0d43", - "\u0d46"-"\u0d48", - "\u0d4a"-"\u0d4d", - "\u0d57", - "\u0d60"-"\u0d61", - "\u0d66"-"\u0d6f", - "\u0d82"-"\u0d83", - "\u0d85"-"\u0d96", - "\u0d9a"-"\u0db1", - "\u0db3"-"\u0dbb", - "\u0dbd", - "\u0dc0"-"\u0dc6", - "\u0dca", - "\u0dcf"-"\u0dd4", - "\u0dd6", - "\u0dd8"-"\u0ddf", - "\u0df2"-"\u0df3", - "\u0e01"-"\u0e3a", - "\u0e3f"-"\u0e4e", - "\u0e50"-"\u0e59", - "\u0e81"-"\u0e82", - "\u0e84", - "\u0e87"-"\u0e88", - "\u0e8a", - "\u0e8d", - "\u0e94"-"\u0e97", - "\u0e99"-"\u0e9f", - "\u0ea1"-"\u0ea3", - "\u0ea5", - "\u0ea7", - "\u0eaa"-"\u0eab", - "\u0ead"-"\u0eb9", - "\u0ebb"-"\u0ebd", - "\u0ec0"-"\u0ec4", - "\u0ec6", - "\u0ec8"-"\u0ecd", - "\u0ed0"-"\u0ed9", - "\u0edc"-"\u0edd", - "\u0f00", - "\u0f18"-"\u0f19", - "\u0f20"-"\u0f29", - "\u0f35", - "\u0f37", - "\u0f39", - "\u0f3e"-"\u0f47", - "\u0f49"-"\u0f6a", - "\u0f71"-"\u0f84", - "\u0f86"-"\u0f8b", - "\u0f90"-"\u0f97", - "\u0f99"-"\u0fbc", - "\u0fc6", - "\u1000"-"\u1021", - "\u1023"-"\u1027", - "\u1029"-"\u102a", - "\u102c"-"\u1032", - "\u1036"-"\u1039", - "\u1040"-"\u1049", - "\u1050"-"\u1059", - "\u10a0"-"\u10c5", - "\u10d0"-"\u10f6", - "\u1100"-"\u1159", - "\u115f"-"\u11a2", - "\u11a8"-"\u11f9", - "\u1200"-"\u1206", - "\u1208"-"\u1246", - "\u1248", - "\u124a"-"\u124d", - "\u1250"-"\u1256", - "\u1258", - "\u125a"-"\u125d", - "\u1260"-"\u1286", - "\u1288", - "\u128a"-"\u128d", - "\u1290"-"\u12ae", - "\u12b0", - "\u12b2"-"\u12b5", - "\u12b8"-"\u12be", - "\u12c0", - "\u12c2"-"\u12c5", - "\u12c8"-"\u12ce", - "\u12d0"-"\u12d6", - "\u12d8"-"\u12ee", - "\u12f0"-"\u130e", - "\u1310", - "\u1312"-"\u1315", - "\u1318"-"\u131e", - "\u1320"-"\u1346", - "\u1348"-"\u135a", - "\u1369"-"\u1371", - "\u13a0"-"\u13f4", - "\u1401"-"\u166c", - "\u166f"-"\u1676", - "\u1681"-"\u169a", - "\u16a0"-"\u16ea", - "\u1780"-"\u17d3", - "\u17db", - "\u17e0"-"\u17e9", - "\u180b"-"\u180e", - "\u1810"-"\u1819", - "\u1820"-"\u1877", - "\u1880"-"\u18a9", - "\u1e00"-"\u1e9b", - "\u1ea0"-"\u1ef9", - "\u1f00"-"\u1f15", - "\u1f18"-"\u1f1d", - "\u1f20"-"\u1f45", - "\u1f48"-"\u1f4d", - "\u1f50"-"\u1f57", - "\u1f59", - "\u1f5b", - "\u1f5d", - "\u1f5f"-"\u1f7d", - "\u1f80"-"\u1fb4", - "\u1fb6"-"\u1fbc", - "\u1fbe", - "\u1fc2"-"\u1fc4", - "\u1fc6"-"\u1fcc", - "\u1fd0"-"\u1fd3", - "\u1fd6"-"\u1fdb", - "\u1fe0"-"\u1fec", - "\u1ff2"-"\u1ff4", - "\u1ff6"-"\u1ffc", - "\u200c"-"\u200f", - "\u202a"-"\u202e", - "\u203f"-"\u2040", - "\u206a"-"\u206f", - "\u207f", - "\u20a0"-"\u20af", - "\u20d0"-"\u20dc", - "\u20e1", - "\u2102", - "\u2107", - "\u210a"-"\u2113", - "\u2115", - "\u2119"-"\u211d", - "\u2124", - "\u2126", - "\u2128", - "\u212a"-"\u212d", - "\u212f"-"\u2131", - "\u2133"-"\u2139", - "\u2160"-"\u2183", - "\u3005"-"\u3007", - "\u3021"-"\u302f", - "\u3031"-"\u3035", - "\u3038"-"\u303a", - "\u3041"-"\u3094", - "\u3099"-"\u309a", - "\u309d"-"\u309e", - "\u30a1"-"\u30fe", - "\u3105"-"\u312c", - "\u3131"-"\u318e", - "\u31a0"-"\u31b7", - "\u3400"-"\u4db5", - "\u4e00"-"\u9fa5", - "\ua000"-"\ua48c", - "\uac00"-"\ud7a3", - "\uf900"-"\ufa2d", - "\ufb00"-"\ufb06", - "\ufb13"-"\ufb17", - "\ufb1d"-"\ufb28", - "\ufb2a"-"\ufb36", - "\ufb38"-"\ufb3c", - "\ufb3e", - "\ufb40"-"\ufb41", - "\ufb43"-"\ufb44", - "\ufb46"-"\ufbb1", - "\ufbd3"-"\ufd3d", - "\ufd50"-"\ufd8f", - "\ufd92"-"\ufdc7", - "\ufdf0"-"\ufdfb", - "\ufe20"-"\ufe23", - "\ufe33"-"\ufe34", - "\ufe4d"-"\ufe4f", - "\ufe69", - "\ufe70"-"\ufe72", - "\ufe74", - "\ufe76"-"\ufefc", - "\ufeff", - "\uff04", - "\uff10"-"\uff19", - "\uff21"-"\uff3a", - "\uff3f", - "\uff41"-"\uff5a", - "\uff65"-"\uffbe", - "\uffc2"-"\uffc7", - "\uffca"-"\uffcf", - "\uffd2"-"\uffd7", - "\uffda"-"\uffdc", - "\uffe0"-"\uffe1", - "\uffe5"-"\uffe6", - "\ufff9"-"\ufffb" - ] - > -} - -/* SEPARATORS */ - -TOKEN : -{ - < LPAREN: "(" > -| < RPAREN: ")" > -| < LBRACE: "{" > -| < RBRACE: "}" > -| < LBRACKET: "[" > -| < RBRACKET: "]" > -| < SEMICOLON: ";" > -| < COMMA: "," > -| < DOT: "." > -| < AT: "@" > -} - -/* OPERATORS */ - -TOKEN : -{ - < ASSIGN: "=" > -| < LT: "<" > -| < BANG: "!" > -| < TILDE: "~" > -| < HOOK: "?" > -| < COLON: ":" > -| < EQ: "==" > -| < LE: "<=" > -| < GE: ">=" > -| < NE: "!=" > -| < SC_OR: "||" > -| < SC_AND: "&&" > -| < INCR: "++" > -| < DECR: "--" > -| < PLUS: "+" > -| < MINUS: "-" > -| < STAR: "*" > -| < SLASH: "/" > -| < BIT_AND: "&" > -| < BIT_OR: "|" > -| < XOR: "^" > -| < REM: "%" > -| < LSHIFT: "<<" > -| < PLUSASSIGN: "+=" > -| < MINUSASSIGN: "-=" > -| < STARASSIGN: "*=" > -| < SLASHASSIGN: "/=" > -| < ANDASSIGN: "&=" > -| < ORASSIGN: "|=" > -| < XORASSIGN: "^=" > -| < REMASSIGN: "%=" > -| < LSHIFTASSIGN: "<<=" > -| < RSIGNEDSHIFTASSIGN: ">>=" > -| < RUNSIGNEDSHIFTASSIGN: ">>>=" > -| < ELLIPSIS: "..." > -} - -/* >'s need special attention due to generics syntax. */ -TOKEN : -{ - < RUNSIGNEDSHIFT: ">>>" > - { - matchedToken.kind = GT; - ((Token.GTToken)matchedToken).realKind = RUNSIGNEDSHIFT; - input_stream.backup(2); - matchedToken.image = ">"; - } -| < RSIGNEDSHIFT: ">>" > - { - matchedToken.kind = GT; - ((Token.GTToken)matchedToken).realKind = RSIGNEDSHIFT; - input_stream.backup(1); - matchedToken.image = ">"; - } -| < GT: ">" > -} - -boolean Line() : -{ - int modifiers; -} -{ - <EOF> { - return true; - } -| - LOOKAHEAD(BlockStatement()) - BlockStatement() { - return false; - } -| - LOOKAHEAD(Modifiers() [ TypeParameters() ] [ ResultType() ] <IDENTIFIER> FormalParameters() [ "throws" NameList() ] "{") - ClassOrInterfaceBodyDeclaration(false) { - return false; - } -| - LOOKAHEAD(ClassOrInterfaceBodyDeclaration(false)) - ClassOrInterfaceBodyDeclaration(false) { - return false; - } -| - LOOKAHEAD(Expression()) - Expression() { - return false; - } -| - ImportDeclaration() { - return false; - } -} - -/***************************************** - * THE JAVA LANGUAGE GRAMMAR STARTS HERE * - *****************************************/ - -/* - * Program structuring syntax follows. - */ - -void CompilationUnit(): -{} -{ - [ LOOKAHEAD( ( Annotation() )* "package" ) PackageDeclaration() ] - ( ImportDeclaration() )* - ( TypeDeclaration() )* - ( < "\u001a" > )? - ( <STUFF_TO_IGNORE: ~[]> )? - <EOF> -} - -void PackageDeclaration(): -{} -{ - Modifiers() "package" Name() ";" -} - -void ImportDeclaration(): -{} -{ - "import" [ "static" ] Name() [ "." "*" ] ";" -} - -/* - * Modifiers. We match all modifiers in a single rule to reduce the chances of - * syntax errors for simple modifier mistakes. It will also enable us to give - * better error messages. - */ - -int Modifiers(): -{ - int modifiers = 0; -} -{ - ( - LOOKAHEAD(2) - ( - "public" { modifiers |= ModifierSet.PUBLIC; } - | - "static" { modifiers |= ModifierSet.STATIC; } - | - "protected" { modifiers |= ModifierSet.PROTECTED; } - | - "private" { modifiers |= ModifierSet.PRIVATE; } - | - "final" { modifiers |= ModifierSet.FINAL; } - | - "abstract" { modifiers |= ModifierSet.ABSTRACT; } - | - "synchronized" { modifiers |= ModifierSet.SYNCHRONIZED; } - | - "native" { modifiers |= ModifierSet.NATIVE; } - | - "transient" { modifiers |= ModifierSet.TRANSIENT; } - | - "volatile" { modifiers |= ModifierSet.VOLATILE; } - | - "strictfp" { modifiers |= ModifierSet.STRICTFP; } - | - Annotation() - ) - )* - - { - return modifiers; - } -} - -/* - * Declaration syntax follows. - */ -void TypeDeclaration(): -{ - int modifiers; -} -{ - ";" -| - modifiers = Modifiers() - ( - ClassOrInterfaceDeclaration(modifiers) - | - EnumDeclaration(modifiers) - | - AnnotationTypeDeclaration(modifiers) - ) -} - - -void ClassOrInterfaceDeclaration(int modifiers): -{ - boolean isInterface = false; -} -{ - ( "class" | "interface" { isInterface = true; } ) - <IDENTIFIER> - [ TypeParameters() ] - [ ExtendsList(isInterface) ] - [ ImplementsList(isInterface) ] - ClassOrInterfaceBody(isInterface) -} - -void ExtendsList(boolean isInterface): -{ - boolean extendsMoreThanOne = false; -} -{ - "extends" ClassOrInterfaceType() - ( "," ClassOrInterfaceType() { extendsMoreThanOne = true; } )* - { - if (extendsMoreThanOne && !isInterface) - throw new ParseException("A class cannot extend more than one other class"); - } -} - -void ImplementsList(boolean isInterface): -{} -{ - "implements" ClassOrInterfaceType() - ( "," ClassOrInterfaceType() )* - { - if (isInterface) - throw new ParseException("An interface cannot implement other interfaces"); - } -} - -void EnumDeclaration(int modifiers): -{} -{ - "enum" <IDENTIFIER> - [ ImplementsList(false) ] - EnumBody() -} - -void EnumBody(): -{} -{ - "{" - [ EnumConstant() ( LOOKAHEAD(2) "," EnumConstant() )* ] - [ "," ] - [ ";" ( ClassOrInterfaceBodyDeclaration(false) )* ] - "}" -} - -void EnumConstant(): -{} -{ - Modifiers() <IDENTIFIER> [ Arguments() ] [ ClassOrInterfaceBody(false) ] -} - -void TypeParameters(): -{} -{ - "<" TypeParameter() ( "," TypeParameter() )* ">" -} - -void TypeParameter(): -{} -{ - <IDENTIFIER> [ TypeBound() ] -} - -void TypeBound(): -{} -{ - "extends" ClassOrInterfaceType() ( "&" ClassOrInterfaceType() )* -} - -void ClassOrInterfaceBody(boolean isInterface): -{} -{ - "{" ( ClassOrInterfaceBodyDeclaration(isInterface) )* "}" -} - -void ClassOrInterfaceBodyDeclaration(boolean isInterface): -{ - boolean isNestedInterface = false; - int modifiers; -} -{ - LOOKAHEAD(2) - Initializer() - { - if (isInterface) - throw new ParseException("An interface cannot have initializers"); - } -| - modifiers = Modifiers() // Just get all the modifiers out of the way. If you want to do - // more checks, pass the modifiers down to the member - ( - ClassOrInterfaceDeclaration(modifiers) - | - EnumDeclaration(modifiers) - | - LOOKAHEAD( [ TypeParameters() ] <IDENTIFIER> "(" ) - ConstructorDeclaration() - | - LOOKAHEAD( Type() <IDENTIFIER> ( "[" "]" )* ( "," | "=" | ";" ) ) - FieldDeclaration(modifiers) - | - MethodDeclaration(modifiers) - ) -| - ";" -} - -void FieldDeclaration(int modifiers): -{} -{ - // Modifiers are already matched in the caller - Type() VariableDeclarator() ( "," VariableDeclarator() )* ";" -} - -void VariableDeclarator(): -{} -{ - VariableDeclaratorId() [ "=" VariableInitializer() ] -} - -void VariableDeclaratorId(): -{} -{ - <IDENTIFIER> ( "[" "]" )* -} - -void VariableInitializer(): -{} -{ - ArrayInitializer() -| - Expression() -} - -void ArrayInitializer(): -{} -{ - "{" [ VariableInitializer() ( LOOKAHEAD(2) "," VariableInitializer() )* ] [ "," ] "}" -} - -void MethodDeclaration(int modifiers): -{} -{ - // Modifiers already matched in the caller! - [ TypeParameters() ] - ResultType() - MethodDeclarator() [ "throws" NameList() ] - ( Block() | ";" ) -} - -void MethodDeclarator(): -{} -{ - <IDENTIFIER> FormalParameters() ( "[" "]" )* -} - -void FormalParameters(): -{} -{ - "(" [ FormalParameter() ( "," FormalParameter() )* ] ")" -} - -void FormalParameter(): -{} -{ - Modifiers() Type() [ "..." ] VariableDeclaratorId() -} - -void ConstructorDeclaration(): -{} -{ - [ TypeParameters() ] - // Modifiers matched in the caller - <IDENTIFIER> FormalParameters() [ "throws" NameList() ] - "{" - [ LOOKAHEAD(ExplicitConstructorInvocation()) - ExplicitConstructorInvocation() - ] - ( BlockStatement() )* - "}" -} - -void ExplicitConstructorInvocation(): -{} -{ - ( <IDENTIFIER> "." )* [ LOOKAHEAD(2) "this" "." ] - [ TypeArguments() ] ("this"|"super") Arguments() ";" -} - -void Initializer(): -{} -{ - [ "static" ] Block() -} - - -/* - * Type, name and expression syntax follows. - */ - -void Type(): -{} -{ - LOOKAHEAD(2) ReferenceType() - | - PrimitiveType() -} - -void ReferenceType(): -{} -{ - PrimitiveType() ( LOOKAHEAD(2) "[" "]" )+ - | - ( ClassOrInterfaceType() ) ( LOOKAHEAD(2) "[" "]" )* -} - -void ClassOrInterfaceType(): -{} -{ - <IDENTIFIER> [ LOOKAHEAD(2) TypeArguments() ] - ( LOOKAHEAD(2) "." <IDENTIFIER> [ LOOKAHEAD(2) TypeArguments() ] )* -} - -void TypeArguments(): -{} -{ - "<" TypeArgument() ( "," TypeArgument() )* ">" -} - -void TypeArgument(): -{} -{ - ReferenceType() - | - "?" [ WildcardBounds() ] -} - -void WildcardBounds(): -{} -{ - "extends" ReferenceType() - | - "super" ReferenceType() -} - - -void PrimitiveType(): -{} -{ - "boolean" -| - "char" -| - "byte" -| - "short" -| - "int" -| - "long" -| - "float" -| - "double" -} - -void ResultType(): -{} -{ - "void" -| - Type() -} - -void Name(): -/* - * A lookahead of 2 is required below since "Name" can be followed - * by a ".*" when used in the context of an "ImportDeclaration". - */ -{} -{ - <IDENTIFIER> - ( LOOKAHEAD(2) "." <IDENTIFIER> - )* -} - -void NameList(): -{} -{ - Name() ( "," Name() )* -} - - -/* - * Expression syntax follows. - */ - -void Expression(): -/* - * This expansion has been written this way instead of: - * Assignment() | ConditionalExpression() - * for performance reasons. - * However, it is a weakening of the grammar for it allows the LHS of - * assignments to be any conditional expression whereas it can only be - * a primary expression. Consider adding a semantic predicate to work - * around this. - */ -{} -{ - ConditionalExpression() - [ - LOOKAHEAD(2) - AssignmentOperator() Expression() - ] -} - -void AssignmentOperator(): -{} -{ - "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|=" -} - -void AssignmentExpression(): -{} -{ - PrimaryExpression() AssignmentOperator() Expression() -} - -void ConditionalExpression(): -{} -{ - ConditionalOrExpression() [ "?" Expression() ":" Expression() ] -} - -void ConditionalOrExpression(): -{} -{ - ConditionalAndExpression() ( "||" ConditionalAndExpression() )* -} - -void ConditionalAndExpression(): -{} -{ - InclusiveOrExpression() ( "&&" InclusiveOrExpression() )* -} - -void InclusiveOrExpression(): -{} -{ - ExclusiveOrExpression() ( "|" ExclusiveOrExpression() )* -} - -void ExclusiveOrExpression(): -{} -{ - AndExpression() ( "^" AndExpression() )* -} - -void AndExpression(): -{} -{ - EqualityExpression() ( "&" EqualityExpression() )* -} - -void EqualityExpression(): -{} -{ - InstanceOfExpression() ( ( "==" | "!=" ) InstanceOfExpression() )* -} - -void InstanceOfExpression(): -{} -{ - RelationalExpression() [ "instanceof" Type() ] -} - -void RelationalExpression(): -{} -{ - ShiftExpression() ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression() )* -} - -void ShiftExpression(): -{} -{ - AdditiveExpression() ( ( "<<" | RSIGNEDSHIFT() | RUNSIGNEDSHIFT() ) AdditiveExpression() )* -} - -void AdditiveExpression(): -{} -{ - MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )* -} - -void MultiplicativeExpression(): -{} -{ - UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )* -} - -void UnaryExpression(): -{} -{ - ( "+" | "-" ) UnaryExpression() -| - PreIncrementExpression() -| - PreDecrementExpression() -| - UnaryExpressionNotPlusMinus() -} - -void PreIncrementExpression(): -{} -{ - "++" PrimaryExpression() -} - -void PreDecrementExpression(): -{} -{ - "--" PrimaryExpression() -} - -void UnaryExpressionNotPlusMinus(): -{} -{ - ( "~" | "!" ) UnaryExpression() -| - LOOKAHEAD( CastLookahead() ) - CastExpression() -| - PostfixExpression() -} - -// This production is to determine lookahead only. The LOOKAHEAD specifications -// below are not used, but they are there just to indicate that we know about -// this. -void CastLookahead(): -{} -{ - LOOKAHEAD(2) - "(" PrimitiveType() -| - LOOKAHEAD("(" Type() "[") - "(" Type() "[" "]" -| - "(" Type() ")" ( "~" | "!" | "(" | <IDENTIFIER> | "this" | "super" | "new" | Literal() ) -} - -void PostfixExpression(): -{} -{ - PrimaryExpression() [ PostfixOperator() ] -} - -void PostfixOperator(): -{} -{ - "++" | "--" -} - -void CastExpression(): -{} -{ - LOOKAHEAD("(" PrimitiveType()) - "(" Type() ")" UnaryExpression() -| - "(" Type() ")" UnaryExpressionNotPlusMinus() -} - -void PrimaryExpression(): -{} -{ - PrimaryPrefix() ( LOOKAHEAD(2) PrimarySuffix() )* -} - -void MemberSelector(): -{} -{ - "." TypeArguments() <IDENTIFIER> -} - -void PrimaryPrefix(): -{} -{ - Literal() -| - LOOKAHEAD( ( <IDENTIFIER> "." )* "this" ) - ( <IDENTIFIER> "." )* - "this" -| - "super" "." <IDENTIFIER> -| - "(" Expression() ")" -| - AllocationExpression() -| - LOOKAHEAD( ResultType() "." "class" ) - ResultType() "." "class" -| - Name() -} - -void PrimarySuffix(): -{} -{ - LOOKAHEAD("." "super" ".") - "." "super" -| - LOOKAHEAD("." "this") - "." "this" -| - LOOKAHEAD(2) - "." AllocationExpression() -| - LOOKAHEAD(3) - MemberSelector() -| - "[" Expression() "]" -| - "." <IDENTIFIER> -| - Arguments() -} - -void Literal(): -{} -{ - <INTEGER_LITERAL> -| - <FLOATING_POINT_LITERAL> -| - <CHARACTER_LITERAL> -| - <STRING_LITERAL> -| - BooleanLiteral() -| - NullLiteral() -} - -void BooleanLiteral(): -{} -{ - "true" -| - "false" -} - -void NullLiteral(): -{} -{ - "null" -} - -void Arguments(): -{} -{ - "(" [ ArgumentList() ] ")" -} - -void ArgumentList(): -{} -{ - Expression() ( "," Expression() )* -} - -void AllocationExpression(): -{} -{ - LOOKAHEAD(2) - "new" PrimitiveType() ArrayDimsAndInits() -| - "new" ClassOrInterfaceType() [ TypeArguments() ] - ( - ArrayDimsAndInits() - | - Arguments() [ ClassOrInterfaceBody(false) ] - ) -} - -/* - * The third LOOKAHEAD specification below is to parse to PrimarySuffix - * if there is an expression between the "[...]". - */ -void ArrayDimsAndInits(): -{} -{ - LOOKAHEAD(2) - ( LOOKAHEAD(2) "[" Expression() "]" )+ ( LOOKAHEAD(2) "[" "]" )* -| - ( "[" "]" )+ ArrayInitializer() -} - - -/* - * Statement syntax follows. - */ - -void Statement(): -{} -{ - LOOKAHEAD(2) - LabeledStatement() -| - AssertStatement() -| - Block() -| - EmptyStatement() -| - StatementExpression() ";" -| - SwitchStatement() -| - IfStatement() -| - WhileStatement() -| - DoStatement() -| - ForStatement() -| - BreakStatement() -| - ContinueStatement() -| - ReturnStatement() -| - ThrowStatement() -| - SynchronizedStatement() -| - TryStatement() -} - -void AssertStatement(): -{} -{ - "assert" Expression() [ ":" Expression() ] ";" -} - -void LabeledStatement(): -{} -{ - <IDENTIFIER> ":" Statement() -} - -void Block(): -{} -{ - "{" ( BlockStatement() )* "}" -} - -void BlockStatement(): -{} -{ - LOOKAHEAD( Modifiers() Type() <IDENTIFIER> ) - LocalVariableDeclaration() ";" -| - Statement() -| - ClassOrInterfaceDeclaration(0) -} - -void LocalVariableDeclaration(): -{} -{ - Modifiers() Type() VariableDeclarator() ( "," VariableDeclarator() )* -} - -void EmptyStatement(): -{} -{ - ";" -} - -void StatementExpression(): -{} -{ - PreIncrementExpression() -| - PreDecrementExpression() -| - LOOKAHEAD(PrimaryExpression() AssignmentOperator()) - AssignmentExpression() -| - PostfixExpression() -} - -void SwitchStatement(): -{} -{ - "switch" "(" Expression() ")" "{" - ( SwitchLabel() ( BlockStatement() )* )* - "}" -} - -void SwitchLabel(): -{} -{ - "case" Expression() ":" -| - "default" ":" -} - -void IfStatement(): -/* - * The disambiguating algorithm of JavaCC automatically binds dangling - * else's to the innermost if statement. The LOOKAHEAD specification - * is to tell JavaCC that we know what we are doing. - */ -{} -{ - "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ] -} - -void WhileStatement(): -{} -{ - "while" "(" Expression() ")" Statement() -} - -void DoStatement(): -{} -{ - "do" Statement() "while" "(" Expression() ")" ";" -} - -void ForStatement(): -{} -{ - "for" "(" - - ( - LOOKAHEAD(Modifiers() Type() <IDENTIFIER> ":") - Modifiers() Type() <IDENTIFIER> ":" Expression() - | - [ ForInit() ] ";" [ Expression() ] ";" [ ForUpdate() ] - ) - - ")" Statement() -} - -void ForInit(): -{} -{ - LOOKAHEAD( Modifiers() Type() <IDENTIFIER> ) - LocalVariableDeclaration() -| - StatementExpressionList() -} - -void StatementExpressionList(): -{} -{ - StatementExpression() ( "," StatementExpression() )* -} - -void ForUpdate(): -{} -{ - StatementExpressionList() -} - -void BreakStatement(): -{} -{ - "break" [ <IDENTIFIER> ] ";" -} - -void ContinueStatement(): -{} -{ - "continue" [ <IDENTIFIER> ] ";" -} - -void ReturnStatement(): -{} -{ - "return" [ Expression() ] ";" -} - -void ThrowStatement(): -{} -{ - "throw" Expression() ";" -} - -void SynchronizedStatement(): -{} -{ - "synchronized" "(" Expression() ")" Block() -} - -void TryStatement(): -/* - * Semantic check required here to make sure that at least one - * finally/catch is present. - */ -{} -{ - "try" Block() - ( "catch" "(" FormalParameter() ")" Block() )* - [ "finally" Block() ] -} - -/* We use productions to match >>>, >> and > so that we can keep the - * type declaration syntax with generics clean - */ - -void RUNSIGNEDSHIFT(): -{} -{ - ( LOOKAHEAD({ getToken(1).kind == GT && - ((Token.GTToken)getToken(1)).realKind == RUNSIGNEDSHIFT} ) - ">" ">" ">" - ) -} - -void RSIGNEDSHIFT(): -{} -{ - ( LOOKAHEAD({ getToken(1).kind == GT && - ((Token.GTToken)getToken(1)).realKind == RSIGNEDSHIFT} ) - ">" ">" - ) -} - -/* Annotation syntax follows. */ - -void Annotation(): -{} -{ - LOOKAHEAD( "@" Name() "(" ( <IDENTIFIER> "=" | ")" )) - NormalAnnotation() - | - LOOKAHEAD( "@" Name() "(" ) - SingleMemberAnnotation() - | - MarkerAnnotation() -} - -void NormalAnnotation(): -{} -{ - "@" Name() "(" [ MemberValuePairs() ] ")" -} - -void MarkerAnnotation(): -{} -{ - "@" Name() -} - -void SingleMemberAnnotation(): -{} -{ - "@" Name() "(" MemberValue() ")" -} - -void MemberValuePairs(): -{} -{ - MemberValuePair() ( "," MemberValuePair() )* -} - -void MemberValuePair(): -{} -{ - <IDENTIFIER> "=" MemberValue() -} - -void MemberValue(): -{} -{ - Annotation() - | - MemberValueArrayInitializer() - | - ConditionalExpression() -} - -void MemberValueArrayInitializer(): -{} -{ - "{" MemberValue() ( LOOKAHEAD(2) "," MemberValue() )* [ "," ] "}" -} - - -/* Annotation Types. */ - -void AnnotationTypeDeclaration(int modifiers): -{} -{ - "@" "interface" <IDENTIFIER> AnnotationTypeBody() -} - -void AnnotationTypeBody(): -{} -{ - "{" ( AnnotationTypeMemberDeclaration() )* "}" -} - -void AnnotationTypeMemberDeclaration(): -{ - int modifiers; -} -{ - modifiers = Modifiers() - ( - LOOKAHEAD(Type() <IDENTIFIER> "(") - Type() <IDENTIFIER> "(" ")" [ DefaultValue() ] ";" - | - ClassOrInterfaceDeclaration(modifiers) - | - EnumDeclaration(modifiers) - | - AnnotationTypeDeclaration(modifiers) - | - FieldDeclaration(modifiers) - ) - | - ( ";" ) -} - -void DefaultValue(): -{} -{ - "default" MemberValue() -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaCharStream.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaCharStream.java deleted file mode 100644 index 3681bce..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaCharStream.java +++ /dev/null @@ -1,530 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 4.0 */ -package jaxx.compiler.parser.java; - -/** - * An implementation of interface CharStream, where the stream is assumed to - * contain only ASCII characters (with java-like unicode escape processing). - */ - -public class JavaCharStream { - public static final boolean staticFlag = false; - - static int hexval(char c) throws java.io.IOException { - switch (c) { - case '0': - return 0; - case '1': - return 1; - case '2': - return 2; - case '3': - return 3; - case '4': - return 4; - case '5': - return 5; - case '6': - return 6; - case '7': - return 7; - case '8': - return 8; - case '9': - return 9; - - case 'a': - case 'A': - return 10; - case 'b': - case 'B': - return 11; - case 'c': - case 'C': - return 12; - case 'd': - case 'D': - return 13; - case 'e': - case 'E': - return 14; - case 'f': - case 'F': - return 15; - } - - throw new java.io.IOException(); // Should never come here - } - - public int bufpos = -1; - int bufsize; - int available; - int tokenBegin; - protected int bufline[]; - protected int bufcolumn[]; - - protected int column = 0; - protected int line = 1; - - protected boolean prevCharIsCR = false; - protected boolean prevCharIsLF = false; - - protected java.io.Reader inputStream; - - protected char[] nextCharBuf; - protected char[] buffer; - protected int maxNextCharInd = 0; - protected int nextCharInd = -1; - protected int inBuf = 0; - protected int tabSize = 8; - - protected void setTabSize(int i) { - tabSize = i; - } - - protected int getTabSize(int i) { - return tabSize; - } - - protected void ExpandBuff(boolean wrapAround) { - char[] newbuffer = new char[bufsize + 2048]; - int newbufline[] = new int[bufsize + 2048]; - int newbufcolumn[] = new int[bufsize + 2048]; - - try { - if (wrapAround) { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - System.arraycopy(buffer, 0, newbuffer, - bufsize - tokenBegin, bufpos); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); - bufcolumn = newbufcolumn; - - bufpos += (bufsize - tokenBegin); - } else { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - bufcolumn = newbufcolumn; - - bufpos -= tokenBegin; - } - } - catch (Throwable t) { - throw new Error(t.getMessage()); - } - - available = (bufsize += 2048); - tokenBegin = 0; - } - - protected void FillBuff() throws java.io.IOException { - int i; - if (maxNextCharInd == 4096) - maxNextCharInd = nextCharInd = 0; - - try { - if ((i = inputStream.read(nextCharBuf, maxNextCharInd, - 4096 - maxNextCharInd)) == -1) { - inputStream.close(); - throw new java.io.IOException(); - } else { - maxNextCharInd += i; - } - } - catch (java.io.IOException e) { - if (bufpos != 0) { - --bufpos; - backup(0); - } else { - bufline[bufpos] = line; - bufcolumn[bufpos] = column; - } - throw e; - } - } - - protected char ReadByte() throws java.io.IOException { - if (++nextCharInd >= maxNextCharInd) - FillBuff(); - - return nextCharBuf[nextCharInd]; - } - - public char BeginToken() throws java.io.IOException { - if (inBuf > 0) { - --inBuf; - - if (++bufpos == bufsize) { - bufpos = 0; - } - - tokenBegin = bufpos; - return buffer[bufpos]; - } - - tokenBegin = 0; - bufpos = -1; - - return readChar(); - } - - protected void AdjustBuffSize() { - if (available == bufsize) { - if (tokenBegin > 2048) { - bufpos = 0; - available = tokenBegin; - } else - ExpandBuff(false); - } else if (available > tokenBegin) - available = bufsize; - else if ((tokenBegin - available) < 2048) - ExpandBuff(true); - else - available = tokenBegin; - } - - protected void UpdateLineColumn(char c) { - column++; - - if (prevCharIsLF) { - prevCharIsLF = false; - line += (column = 1); - } else if (prevCharIsCR) { - prevCharIsCR = false; - if (c == '\n') { - prevCharIsLF = true; - } else - line += (column = 1); - } - - switch (c) { - case '\r': - prevCharIsCR = true; - break; - case '\n': - prevCharIsLF = true; - break; - case '\t': - column--; - column += (tabSize - (column % tabSize)); - break; - default: - break; - } - - bufline[bufpos] = line; - bufcolumn[bufpos] = column; - } - - public char readChar() throws java.io.IOException { - if (inBuf > 0) { - --inBuf; - - if (++bufpos == bufsize) - bufpos = 0; - - return buffer[bufpos]; - } - - char c; - - if (++bufpos == available) - AdjustBuffSize(); - - if ((buffer[bufpos] = c = ReadByte()) == '\\') { - UpdateLineColumn(c); - - int backSlashCnt = 1; - - for (; ;) // Read all the backslashes - { - if (++bufpos == available) - AdjustBuffSize(); - - try { - if ((buffer[bufpos] = c = ReadByte()) != '\\') { - UpdateLineColumn(c); - // found a non-backslash char. - if ((c == 'u') && ((backSlashCnt & 1) == 1)) { - if (--bufpos < 0) - bufpos = bufsize - 1; - - break; - } - - backup(backSlashCnt); - return '\\'; - } - } - catch (java.io.IOException e) { - if (backSlashCnt > 1) - backup(backSlashCnt); - - return '\\'; - } - - UpdateLineColumn(c); - backSlashCnt++; - } - - // Here, we have seen an odd number of backslash's followed by a 'u' - try { - while ((c = ReadByte()) == 'u') - ++column; - - buffer[bufpos] = c = (char) (hexval(c) << 12 | - hexval(ReadByte()) << 8 | - hexval(ReadByte()) << 4 | - hexval(ReadByte())); - - column += 4; - } - catch (java.io.IOException e) { - throw new Error("Invalid escape character at line " + line + - " column " + column + "."); - } - - if (backSlashCnt == 1) - return c; - else { - backup(backSlashCnt - 1); - return '\\'; - } - } else { - UpdateLineColumn(c); - return (c); - } - } - - /** - * @return column index - * @see #getEndColumn - * @deprecated - */ - - public int getColumn() { - return bufcolumn[bufpos]; - } - - /** - * @return line type ??? - * @see #getEndLine - * @deprecated - */ - - public int getLine() { - return bufline[bufpos]; - } - - public int getEndColumn() { - return bufcolumn[bufpos]; - } - - public int getEndLine() { - return bufline[bufpos]; - } - - public int getBeginColumn() { - return bufcolumn[tokenBegin]; - } - - public int getBeginLine() { - return bufline[tokenBegin]; - } - - public void backup(int amount) { - - inBuf += amount; - if ((bufpos -= amount) < 0) - bufpos += bufsize; - } - - public JavaCharStream(java.io.Reader dstream, - int startline, int startcolumn, int buffersize) { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - nextCharBuf = new char[4096]; - } - - public JavaCharStream(java.io.Reader dstream, - int startline, int startcolumn) { - this(dstream, startline, startcolumn, 4096); - } - - public JavaCharStream(java.io.Reader dstream) { - this(dstream, 1, 1, 4096); - } - - public void ReInit(java.io.Reader dstream, - int startline, int startcolumn, int buffersize) { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - if (buffer == null || buffersize != buffer.length) { - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - nextCharBuf = new char[4096]; - } - prevCharIsLF = prevCharIsCR = false; - tokenBegin = inBuf = maxNextCharInd = 0; - nextCharInd = bufpos = -1; - } - - public void ReInit(java.io.Reader dstream, - int startline, int startcolumn) { - ReInit(dstream, startline, startcolumn, 4096); - } - - public void ReInit(java.io.Reader dstream) { - ReInit(dstream, 1, 1, 4096); - } - - public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, - int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { - this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); - } - - public JavaCharStream(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) { - this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); - } - - public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, - int startcolumn) throws java.io.UnsupportedEncodingException { - this(dstream, encoding, startline, startcolumn, 4096); - } - - public JavaCharStream(java.io.InputStream dstream, int startline, - int startcolumn) { - this(dstream, startline, startcolumn, 4096); - } - - public JavaCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { - this(dstream, encoding, 1, 1, 4096); - } - - public JavaCharStream(java.io.InputStream dstream) { - this(dstream, 1, 1, 4096); - } - - public void ReInit(java.io.InputStream dstream, String encoding, int startline, - int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { - ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); - } - - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) { - ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); - } - - public void ReInit(java.io.InputStream dstream, String encoding, int startline, - int startcolumn) throws java.io.UnsupportedEncodingException { - ReInit(dstream, encoding, startline, startcolumn, 4096); - } - - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn) { - ReInit(dstream, startline, startcolumn, 4096); - } - - public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { - ReInit(dstream, encoding, 1, 1, 4096); - } - - public void ReInit(java.io.InputStream dstream) { - ReInit(dstream, 1, 1, 4096); - } - - public String GetImage() { - if (bufpos >= tokenBegin) - return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); - else - return new String(buffer, tokenBegin, bufsize - tokenBegin) + - new String(buffer, 0, bufpos + 1); - } - - public char[] GetSuffix(int len) { - char[] ret = new char[len]; - - if ((bufpos + 1) >= len) - System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); - else { - System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, - len - bufpos - 1); - System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); - } - - return ret; - } - - public void Done() { - nextCharBuf = null; - buffer = null; - bufline = null; - bufcolumn = null; - } - - /** - * Method to adjust line and column numbers for the start of a token. - * - * @param newLine line number ? - * @param newCol column number ? - */ - public void adjustBeginLineColumn(int newLine, int newCol) { - int start = tokenBegin; - int len; - - if (bufpos >= tokenBegin) { - len = bufpos - tokenBegin + inBuf + 1; - } else { - len = bufsize - tokenBegin + bufpos + 1 + inBuf; - } - - int i = 0, j = 0, k; - int nextColDiff, columnDiff = 0; - - while (i < len && - bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { - bufline[j] = newLine; - nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; - bufcolumn[j] = newCol + columnDiff; - columnDiff = nextColDiff; - i++; - } - - if (i < len) { - bufline[j] = newLine++; - bufcolumn[j] = newCol + columnDiff; - - while (i++ < len) { - if (bufline[j = start % bufsize] != bufline[++start % bufsize]) - bufline[j] = newLine++; - else - bufline[j] = newLine; - } - } - - line = bufline[j]; - column = bufcolumn[j]; - } - -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParser.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParser.java deleted file mode 100644 index a678cec..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParser.java +++ /dev/null @@ -1,10048 +0,0 @@ -/* Generated By:JJTree&JavaCC: Do not edit this line. JavaParser.java */ -package jaxx.compiler.parser.java; - -import java.io.File; -import java.io.FileInputStream; - -/** - * Grammar to parse Java version 1.5 - * - * @author Sreenivasa Viswanadha - Simplified and enhanced for 1.5 - */ -public class JavaParser/*@bgen(jjtree)*/ implements JavaParserTreeConstants, JavaParserConstants {/*@bgen(jjtree)*/ - protected JJTJavaParserState jjtree = new JJTJavaParserState(); - - /** Class to hold modifiers. */ - static public final class ModifierSet { - /* Definitions of the bits in the modifiers field. */ - public static final int PUBLIC = 0x0001; - public static final int PROTECTED = 0x0002; - public static final int PRIVATE = 0x0004; - public static final int ABSTRACT = 0x0008; - public static final int STATIC = 0x0010; - public static final int FINAL = 0x0020; - public static final int SYNCHRONIZED = 0x0040; - public static final int NATIVE = 0x0080; - public static final int TRANSIENT = 0x0100; - public static final int VOLATILE = 0x0200; - public static final int STRICTFP = 0x1000; - - /** - * A set of accessors that indicate whether the specified modifier - * is in the set. - */ - - public boolean isPublic(int modifiers) { - return (modifiers & PUBLIC) != 0; - } - - public boolean isProtected(int modifiers) { - return (modifiers & PROTECTED) != 0; - } - - public boolean isPrivate(int modifiers) { - return (modifiers & PRIVATE) != 0; - } - - public boolean isStatic(int modifiers) { - return (modifiers & STATIC) != 0; - } - - public boolean isAbstract(int modifiers) { - return (modifiers & ABSTRACT) != 0; - } - - public boolean isFinal(int modifiers) { - return (modifiers & FINAL) != 0; - } - - public boolean isNative(int modifiers) { - return (modifiers & NATIVE) != 0; - } - - public boolean isStrictfp(int modifiers) { - return (modifiers & STRICTFP) != 0; - } - - public boolean isSynchronized(int modifiers) { - return (modifiers & SYNCHRONIZED) != 0; - } - - public boolean isTransient(int modifiers) { - return (modifiers & TRANSIENT) != 0; - } - - public boolean isVolatile(int modifiers) { - return (modifiers & VOLATILE) != 0; - } - - /** Removes the given modifier. */ - static int removeModifier(int modifiers, int mod) { - return modifiers & ~mod; - } - } - - public JavaParser(String fileName) { - this(System.in); - try { - ReInit(new FileInputStream(new File(fileName))); - } - catch (Exception e) { - e.printStackTrace(); - } - } - - void jjtreeOpenNodeScope(Node n) { - ((SimpleNode) n).firstToken = getToken(1); - } - - void jjtreeCloseNodeScope(Node n) { - ((SimpleNode) n).lastToken = getToken(0); - } - - public SimpleNode popNode() { - if (jjtree.nodeArity() > 0) // number of child nodes - return (SimpleNode) jjtree.popNode(); - else - return null; - } - - public static void main(String args[]) { - JavaParser parser; - if (args.length == 0) { - System.out.println("Java Parser Version 1.1: Reading from standard input . . ."); - parser = new JavaParser(System.in); - } else if (args.length == 1) { - System.out.println("Java Parser Version 1.1: Reading from file " + args[0] + " . . ."); - try { - parser = new JavaParser(new java.io.FileInputStream(args[0])); - } catch (java.io.FileNotFoundException e) { - System.out.println("Java Parser Version 1.1: File " + args[0] + " not found."); - return; - } - } else { - System.out.println("Java Parser Version 1.1: Usage is one of:"); - System.out.println(" java JavaParser < inputfile"); - System.out.println("OR"); - System.out.println(" java JavaParser inputfile"); - return; - } - try { - parser.CompilationUnit(); - System.out.println("Java Parser Version 1.1: Java program parsed successfully."); - } catch (ParseException e) { - System.out.println(e.getMessage()); - System.out.println("Java Parser Version 1.1: Encountered errors during parse."); - } - } - - final public boolean Line() throws ParseException { - /*@bgen(jjtree) Line */ - SimpleNode jjtn000 = new SimpleNode(JJTLINE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - int modifiers; - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case 0: - jj_consume_token(0); - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - { - if (true) return true; - } - break; - default: - if (jj_2_1(2147483647)) { - BlockStatement(); - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - { - if (true) return false; - } - } else if (jj_2_2(2147483647)) { - ClassOrInterfaceBodyDeclaration(false); - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - { - if (true) return false; - } - } else if (jj_2_3(2147483647)) { - ClassOrInterfaceBodyDeclaration(false); - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - { - if (true) return false; - } - } else if (jj_2_4(2147483647)) { - Expression(); - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - { - if (true) return false; - } - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IMPORT: - ImportDeclaration(); - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - { - if (true) return false; - } - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - throw new Error("Missing return statement in function"); - } - - /** - * ************************************** - * THE JAVA LANGUAGE GRAMMAR STARTS HERE * - * *************************************** - */ - -/* - * Program structuring syntax follows. - */ - final public void CompilationUnit() throws ParseException { - /*@bgen(jjtree) CompilationUnit */ - SimpleNode jjtn000 = new SimpleNode(JJTCOMPILATIONUNIT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - if (jj_2_5(2147483647)) { - PackageDeclaration(); - } else { - ; - } - label_1: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IMPORT: - ; - break; - default: - break label_1; - } - ImportDeclaration(); - } - label_2: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ABSTRACT: - case CLASS: - case ENUM: - case FINAL: - case INTERFACE: - case NATIVE: - case PRIVATE: - case PROTECTED: - case PUBLIC: - case STATIC: - case STRICTFP: - case SYNCHRONIZED: - case TRANSIENT: - case VOLATILE: - case SEMICOLON: - case AT: - ; - break; - default: - break label_2; - } - TypeDeclaration(); - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case 123: - jj_consume_token(123); - break; - default: - ; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case STUFF_TO_IGNORE: - jj_consume_token(STUFF_TO_IGNORE); - break; - default: - ; - } - jj_consume_token(0); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void PackageDeclaration() throws ParseException { - /*@bgen(jjtree) PackageDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTPACKAGEDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - Modifiers(); - jj_consume_token(PACKAGE); - Name(); - jj_consume_token(SEMICOLON); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ImportDeclaration() throws ParseException { - /*@bgen(jjtree) ImportDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTIMPORTDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(IMPORT); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case STATIC: - jj_consume_token(STATIC); - break; - default: - ; - } - Name(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case DOT: - jj_consume_token(DOT); - jj_consume_token(STAR); - break; - default: - ; - } - jj_consume_token(SEMICOLON); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - /* - * Modifiers. We match all modifiers in a single rule to reduce the chances of - * syntax errors for simple modifier mistakes. It will also enable us to give - * better error messages. - */ - final public int Modifiers() throws ParseException { - /*@bgen(jjtree) Modifiers */ - SimpleNode jjtn000 = new SimpleNode(JJTMODIFIERS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - int modifiers = 0; - try { - label_3: - while (true) { - if (jj_2_6(2)) { - ; - } else { - break label_3; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PUBLIC: - jj_consume_token(PUBLIC); - modifiers |= ModifierSet.PUBLIC; - break; - case STATIC: - jj_consume_token(STATIC); - modifiers |= ModifierSet.STATIC; - break; - case PROTECTED: - jj_consume_token(PROTECTED); - modifiers |= ModifierSet.PROTECTED; - break; - case PRIVATE: - jj_consume_token(PRIVATE); - modifiers |= ModifierSet.PRIVATE; - break; - case FINAL: - jj_consume_token(FINAL); - modifiers |= ModifierSet.FINAL; - break; - case ABSTRACT: - jj_consume_token(ABSTRACT); - modifiers |= ModifierSet.ABSTRACT; - break; - case SYNCHRONIZED: - jj_consume_token(SYNCHRONIZED); - modifiers |= ModifierSet.SYNCHRONIZED; - break; - case NATIVE: - jj_consume_token(NATIVE); - modifiers |= ModifierSet.NATIVE; - break; - case TRANSIENT: - jj_consume_token(TRANSIENT); - modifiers |= ModifierSet.TRANSIENT; - break; - case VOLATILE: - jj_consume_token(VOLATILE); - modifiers |= ModifierSet.VOLATILE; - break; - case STRICTFP: - jj_consume_token(STRICTFP); - modifiers |= ModifierSet.STRICTFP; - break; - case AT: - Annotation(); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - { - if (true) return modifiers; - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - throw new Error("Missing return statement in function"); - } - - /* - * Declaration syntax follows. - */ - final public void TypeDeclaration() throws ParseException { - /*@bgen(jjtree) TypeDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTTYPEDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - int modifiers; - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case SEMICOLON: - jj_consume_token(SEMICOLON); - break; - case ABSTRACT: - case CLASS: - case ENUM: - case FINAL: - case INTERFACE: - case NATIVE: - case PRIVATE: - case PROTECTED: - case PUBLIC: - case STATIC: - case STRICTFP: - case SYNCHRONIZED: - case TRANSIENT: - case VOLATILE: - case AT: - modifiers = Modifiers(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case CLASS: - case INTERFACE: - ClassOrInterfaceDeclaration(modifiers); - break; - case ENUM: - EnumDeclaration(modifiers); - break; - case AT: - AnnotationTypeDeclaration(modifiers); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ClassOrInterfaceDeclaration(int modifiers) throws ParseException { - /*@bgen(jjtree) ClassOrInterfaceDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACEDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - boolean isInterface = false; - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case CLASS: - jj_consume_token(CLASS); - break; - case INTERFACE: - jj_consume_token(INTERFACE); - isInterface = true; - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - jj_consume_token(IDENTIFIER); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LT: - TypeParameters(); - break; - default: - ; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case EXTENDS: - ExtendsList(isInterface); - break; - default: - ; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IMPLEMENTS: - ImplementsList(isInterface); - break; - default: - ; - } - ClassOrInterfaceBody(isInterface); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ExtendsList(boolean isInterface) throws ParseException { - /*@bgen(jjtree) ExtendsList */ - SimpleNode jjtn000 = new SimpleNode(JJTEXTENDSLIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - boolean extendsMoreThanOne = false; - try { - jj_consume_token(EXTENDS); - ClassOrInterfaceType(); - label_4: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - ; - break; - default: - break label_4; - } - jj_consume_token(COMMA); - ClassOrInterfaceType(); - extendsMoreThanOne = true; - } - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - if (extendsMoreThanOne && !isInterface) { - if (true) - throw new ParseException("A class cannot extend more than one other class"); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ImplementsList(boolean isInterface) throws ParseException { - /*@bgen(jjtree) ImplementsList */ - SimpleNode jjtn000 = new SimpleNode(JJTIMPLEMENTSLIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(IMPLEMENTS); - ClassOrInterfaceType(); - label_5: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - ; - break; - default: - break label_5; - } - jj_consume_token(COMMA); - ClassOrInterfaceType(); - } - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - if (isInterface) { - if (true) - throw new ParseException("An interface cannot implement other interfaces"); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void EnumDeclaration(int modifiers) throws ParseException { - /*@bgen(jjtree) EnumDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTENUMDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(ENUM); - jj_consume_token(IDENTIFIER); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IMPLEMENTS: - ImplementsList(false); - break; - default: - ; - } - EnumBody(); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void EnumBody() throws ParseException { - /*@bgen(jjtree) EnumBody */ - SimpleNode jjtn000 = new SimpleNode(JJTENUMBODY); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(LBRACE); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ABSTRACT: - case FINAL: - case NATIVE: - case PRIVATE: - case PROTECTED: - case PUBLIC: - case STATIC: - case STRICTFP: - case SYNCHRONIZED: - case TRANSIENT: - case VOLATILE: - case IDENTIFIER: - case AT: - EnumConstant(); - label_6: - while (true) { - if (jj_2_7(2)) { - ; - } else { - break label_6; - } - jj_consume_token(COMMA); - EnumConstant(); - } - break; - default: - ; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - jj_consume_token(COMMA); - break; - default: - ; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case SEMICOLON: - jj_consume_token(SEMICOLON); - label_7: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ABSTRACT: - case BOOLEAN: - case BYTE: - case CHAR: - case CLASS: - case DOUBLE: - case ENUM: - case FINAL: - case FLOAT: - case INT: - case INTERFACE: - case LONG: - case NATIVE: - case PRIVATE: - case PROTECTED: - case PUBLIC: - case SHORT: - case STATIC: - case STRICTFP: - case SYNCHRONIZED: - case TRANSIENT: - case VOID: - case VOLATILE: - case IDENTIFIER: - case LBRACE: - case SEMICOLON: - case AT: - case LT: - ; - break; - default: - break label_7; - } - ClassOrInterfaceBodyDeclaration(false); - } - break; - default: - ; - } - jj_consume_token(RBRACE); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void EnumConstant() throws ParseException { - /*@bgen(jjtree) EnumConstant */ - SimpleNode jjtn000 = new SimpleNode(JJTENUMCONSTANT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - Modifiers(); - jj_consume_token(IDENTIFIER); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LPAREN: - Arguments(); - break; - default: - ; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LBRACE: - ClassOrInterfaceBody(false); - break; - default: - ; - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void TypeParameters() throws ParseException { - /*@bgen(jjtree) TypeParameters */ - SimpleNode jjtn000 = new SimpleNode(JJTTYPEPARAMETERS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(LT); - TypeParameter(); - label_8: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - ; - break; - default: - break label_8; - } - jj_consume_token(COMMA); - TypeParameter(); - } - jj_consume_token(GT); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void TypeParameter() throws ParseException { - /*@bgen(jjtree) TypeParameter */ - SimpleNode jjtn000 = new SimpleNode(JJTTYPEPARAMETER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(IDENTIFIER); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case EXTENDS: - TypeBound(); - break; - default: - ; - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void TypeBound() throws ParseException { - /*@bgen(jjtree) TypeBound */ - SimpleNode jjtn000 = new SimpleNode(JJTTYPEBOUND); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(EXTENDS); - ClassOrInterfaceType(); - label_9: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case BIT_AND: - ; - break; - default: - break label_9; - } - jj_consume_token(BIT_AND); - ClassOrInterfaceType(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ClassOrInterfaceBody(boolean isInterface) throws ParseException { - /*@bgen(jjtree) ClassOrInterfaceBody */ - SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACEBODY); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(LBRACE); - label_10: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ABSTRACT: - case BOOLEAN: - case BYTE: - case CHAR: - case CLASS: - case DOUBLE: - case ENUM: - case FINAL: - case FLOAT: - case INT: - case INTERFACE: - case LONG: - case NATIVE: - case PRIVATE: - case PROTECTED: - case PUBLIC: - case SHORT: - case STATIC: - case STRICTFP: - case SYNCHRONIZED: - case TRANSIENT: - case VOID: - case VOLATILE: - case IDENTIFIER: - case LBRACE: - case SEMICOLON: - case AT: - case LT: - ; - break; - default: - break label_10; - } - ClassOrInterfaceBodyDeclaration(isInterface); - } - jj_consume_token(RBRACE); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ClassOrInterfaceBodyDeclaration(boolean isInterface) throws ParseException { - /*@bgen(jjtree) ClassOrInterfaceBodyDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACEBODYDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - boolean isNestedInterface = false; - int modifiers; - try { - if (jj_2_10(2)) { - Initializer(); - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - if (isInterface) { - if (true) - throw new ParseException("An interface cannot have initializers"); - } - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ABSTRACT: - case BOOLEAN: - case BYTE: - case CHAR: - case CLASS: - case DOUBLE: - case ENUM: - case FINAL: - case FLOAT: - case INT: - case INTERFACE: - case LONG: - case NATIVE: - case PRIVATE: - case PROTECTED: - case PUBLIC: - case SHORT: - case STATIC: - case STRICTFP: - case SYNCHRONIZED: - case TRANSIENT: - case VOID: - case VOLATILE: - case IDENTIFIER: - case AT: - case LT: - modifiers = Modifiers(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case CLASS: - case INTERFACE: - ClassOrInterfaceDeclaration(modifiers); - break; - case ENUM: - EnumDeclaration(modifiers); - break; - default: - if (jj_2_8(2147483647)) { - ConstructorDeclaration(); - } else if (jj_2_9(2147483647)) { - FieldDeclaration(modifiers); - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FLOAT: - case INT: - case LONG: - case SHORT: - case VOID: - case IDENTIFIER: - case LT: - MethodDeclaration(modifiers); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } - } - break; - case SEMICOLON: - jj_consume_token(SEMICOLON); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void FieldDeclaration(int modifiers) throws ParseException { - /*@bgen(jjtree) FieldDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTFIELDDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - Type(); - VariableDeclarator(); - label_11: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - ; - break; - default: - break label_11; - } - jj_consume_token(COMMA); - VariableDeclarator(); - } - jj_consume_token(SEMICOLON); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void VariableDeclarator() throws ParseException { - /*@bgen(jjtree) VariableDeclarator */ - SimpleNode jjtn000 = new SimpleNode(JJTVARIABLEDECLARATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - VariableDeclaratorId(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ASSIGN: - jj_consume_token(ASSIGN); - VariableInitializer(); - break; - default: - ; - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void VariableDeclaratorId() throws ParseException { - /*@bgen(jjtree) VariableDeclaratorId */ - SimpleNode jjtn000 = new SimpleNode(JJTVARIABLEDECLARATORID); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(IDENTIFIER); - label_12: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LBRACKET: - ; - break; - default: - break label_12; - } - jj_consume_token(LBRACKET); - jj_consume_token(RBRACKET); - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void VariableInitializer() throws ParseException { - /*@bgen(jjtree) VariableInitializer */ - SimpleNode jjtn000 = new SimpleNode(JJTVARIABLEINITIALIZER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LBRACE: - ArrayInitializer(); - break; - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FALSE: - case FLOAT: - case INT: - case LONG: - case NEW: - case NULL: - case SHORT: - case SUPER: - case THIS: - case TRUE: - case VOID: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case IDENTIFIER: - case LPAREN: - case BANG: - case TILDE: - case INCR: - case DECR: - case PLUS: - case MINUS: - Expression(); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ArrayInitializer() throws ParseException { - /*@bgen(jjtree) ArrayInitializer */ - SimpleNode jjtn000 = new SimpleNode(JJTARRAYINITIALIZER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(LBRACE); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FALSE: - case FLOAT: - case INT: - case LONG: - case NEW: - case NULL: - case SHORT: - case SUPER: - case THIS: - case TRUE: - case VOID: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case IDENTIFIER: - case LPAREN: - case LBRACE: - case BANG: - case TILDE: - case INCR: - case DECR: - case PLUS: - case MINUS: - VariableInitializer(); - label_13: - while (true) { - if (jj_2_11(2)) { - ; - } else { - break label_13; - } - jj_consume_token(COMMA); - VariableInitializer(); - } - break; - default: - ; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - jj_consume_token(COMMA); - break; - default: - ; - } - jj_consume_token(RBRACE); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void MethodDeclaration(int modifiers) throws ParseException { - /*@bgen(jjtree) MethodDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTMETHODDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LT: - TypeParameters(); - break; - default: - ; - } - ResultType(); - MethodDeclarator(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case THROWS: - jj_consume_token(THROWS); - NameList(); - break; - default: - ; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LBRACE: - Block(); - break; - case SEMICOLON: - jj_consume_token(SEMICOLON); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void MethodDeclarator() throws ParseException { - /*@bgen(jjtree) MethodDeclarator */ - SimpleNode jjtn000 = new SimpleNode(JJTMETHODDECLARATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(IDENTIFIER); - FormalParameters(); - label_14: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LBRACKET: - ; - break; - default: - break label_14; - } - jj_consume_token(LBRACKET); - jj_consume_token(RBRACKET); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void FormalParameters() throws ParseException { - /*@bgen(jjtree) FormalParameters */ - SimpleNode jjtn000 = new SimpleNode(JJTFORMALPARAMETERS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(LPAREN); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ABSTRACT: - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FINAL: - case FLOAT: - case INT: - case LONG: - case NATIVE: - case PRIVATE: - case PROTECTED: - case PUBLIC: - case SHORT: - case STATIC: - case STRICTFP: - case SYNCHRONIZED: - case TRANSIENT: - case VOLATILE: - case IDENTIFIER: - case AT: - FormalParameter(); - label_15: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - ; - break; - default: - break label_15; - } - jj_consume_token(COMMA); - FormalParameter(); - } - break; - default: - ; - } - jj_consume_token(RPAREN); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void FormalParameter() throws ParseException { - /*@bgen(jjtree) FormalParameter */ - SimpleNode jjtn000 = new SimpleNode(JJTFORMALPARAMETER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - Modifiers(); - Type(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ELLIPSIS: - jj_consume_token(ELLIPSIS); - break; - default: - ; - } - VariableDeclaratorId(); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ConstructorDeclaration() throws ParseException { - /*@bgen(jjtree) ConstructorDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTCONSTRUCTORDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LT: - TypeParameters(); - break; - default: - ; - } - jj_consume_token(IDENTIFIER); - FormalParameters(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case THROWS: - jj_consume_token(THROWS); - NameList(); - break; - default: - ; - } - jj_consume_token(LBRACE); - if (jj_2_12(2147483647)) { - ExplicitConstructorInvocation(); - } else { - ; - } - label_16: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ABSTRACT: - case ASSERT: - case BOOLEAN: - case BREAK: - case BYTE: - case CHAR: - case CLASS: - case CONTINUE: - case DO: - case DOUBLE: - case FALSE: - case FINAL: - case FLOAT: - case FOR: - case IF: - case INT: - case INTERFACE: - case LONG: - case NATIVE: - case NEW: - case NULL: - case PRIVATE: - case PROTECTED: - case PUBLIC: - case RETURN: - case SHORT: - case STATIC: - case STRICTFP: - case SUPER: - case SWITCH: - case SYNCHRONIZED: - case THIS: - case THROW: - case TRANSIENT: - case TRUE: - case TRY: - case VOID: - case VOLATILE: - case WHILE: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case IDENTIFIER: - case LPAREN: - case LBRACE: - case SEMICOLON: - case AT: - case INCR: - case DECR: - ; - break; - default: - break label_16; - } - BlockStatement(); - } - jj_consume_token(RBRACE); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ExplicitConstructorInvocation() throws ParseException { - /*@bgen(jjtree) ExplicitConstructorInvocation */ - SimpleNode jjtn000 = new SimpleNode(JJTEXPLICITCONSTRUCTORINVOCATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - label_17: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IDENTIFIER: - ; - break; - default: - break label_17; - } - jj_consume_token(IDENTIFIER); - jj_consume_token(DOT); - } - if (jj_2_13(2)) { - jj_consume_token(THIS); - jj_consume_token(DOT); - } else { - ; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LT: - TypeArguments(); - break; - default: - ; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case THIS: - jj_consume_token(THIS); - break; - case SUPER: - jj_consume_token(SUPER); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - Arguments(); - jj_consume_token(SEMICOLON); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Initializer() throws ParseException { - /*@bgen(jjtree) Initializer */ - SimpleNode jjtn000 = new SimpleNode(JJTINITIALIZER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case STATIC: - jj_consume_token(STATIC); - break; - default: - ; - } - Block(); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - /* - * Type, name and expression syntax follows. - */ - final public void Type() throws ParseException { - /*@bgen(jjtree) Type */ - SimpleNode jjtn000 = new SimpleNode(JJTTYPE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - if (jj_2_14(2)) { - ReferenceType(); - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FLOAT: - case INT: - case LONG: - case SHORT: - PrimitiveType(); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ReferenceType() throws ParseException { - /*@bgen(jjtree) ReferenceType */ - SimpleNode jjtn000 = new SimpleNode(JJTREFERENCETYPE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FLOAT: - case INT: - case LONG: - case SHORT: - PrimitiveType(); - label_18: - while (true) { - jj_consume_token(LBRACKET); - jj_consume_token(RBRACKET); - if (jj_2_15(2)) { - ; - } else { - break label_18; - } - } - break; - case IDENTIFIER: - ClassOrInterfaceType(); - label_19: - while (true) { - if (jj_2_16(2)) { - ; - } else { - break label_19; - } - jj_consume_token(LBRACKET); - jj_consume_token(RBRACKET); - } - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ClassOrInterfaceType() throws ParseException { - /*@bgen(jjtree) ClassOrInterfaceType */ - SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACETYPE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(IDENTIFIER); - if (jj_2_17(2)) { - TypeArguments(); - } else { - ; - } - label_20: - while (true) { - if (jj_2_18(2)) { - ; - } else { - break label_20; - } - jj_consume_token(DOT); - jj_consume_token(IDENTIFIER); - if (jj_2_19(2)) { - TypeArguments(); - } else { - ; - } - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void TypeArguments() throws ParseException { - /*@bgen(jjtree) TypeArguments */ - SimpleNode jjtn000 = new SimpleNode(JJTTYPEARGUMENTS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(LT); - TypeArgument(); - label_21: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - ; - break; - default: - break label_21; - } - jj_consume_token(COMMA); - TypeArgument(); - } - jj_consume_token(GT); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void TypeArgument() throws ParseException { - /*@bgen(jjtree) TypeArgument */ - SimpleNode jjtn000 = new SimpleNode(JJTTYPEARGUMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FLOAT: - case INT: - case LONG: - case SHORT: - case IDENTIFIER: - ReferenceType(); - break; - case HOOK: - jj_consume_token(HOOK); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case EXTENDS: - case SUPER: - WildcardBounds(); - break; - default: - ; - } - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void WildcardBounds() throws ParseException { - /*@bgen(jjtree) WildcardBounds */ - SimpleNode jjtn000 = new SimpleNode(JJTWILDCARDBOUNDS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case EXTENDS: - jj_consume_token(EXTENDS); - ReferenceType(); - break; - case SUPER: - jj_consume_token(SUPER); - ReferenceType(); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void PrimitiveType() throws ParseException { - /*@bgen(jjtree) PrimitiveType */ - SimpleNode jjtn000 = new SimpleNode(JJTPRIMITIVETYPE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case BOOLEAN: - jj_consume_token(BOOLEAN); - break; - case CHAR: - jj_consume_token(CHAR); - break; - case BYTE: - jj_consume_token(BYTE); - break; - case SHORT: - jj_consume_token(SHORT); - break; - case INT: - jj_consume_token(INT); - break; - case LONG: - jj_consume_token(LONG); - break; - case FLOAT: - jj_consume_token(FLOAT); - break; - case DOUBLE: - jj_consume_token(DOUBLE); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ResultType() throws ParseException { - /*@bgen(jjtree) ResultType */ - SimpleNode jjtn000 = new SimpleNode(JJTRESULTTYPE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case VOID: - jj_consume_token(VOID); - break; - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FLOAT: - case INT: - case LONG: - case SHORT: - case IDENTIFIER: - Type(); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Name() throws ParseException { - /*@bgen(jjtree) Name */ - SimpleNode jjtn000 = new SimpleNode(JJTNAME); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(IDENTIFIER); - label_22: - while (true) { - if (jj_2_20(2)) { - ; - } else { - break label_22; - } - jj_consume_token(DOT); - jj_consume_token(IDENTIFIER); - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void NameList() throws ParseException { - /*@bgen(jjtree) NameList */ - SimpleNode jjtn000 = new SimpleNode(JJTNAMELIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - Name(); - label_23: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - ; - break; - default: - break label_23; - } - jj_consume_token(COMMA); - Name(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - /* - * Expression syntax follows. - */ - final public void Expression() throws ParseException { - /*@bgen(jjtree) Expression */ - SimpleNode jjtn000 = new SimpleNode(JJTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - ConditionalExpression(); - if (jj_2_21(2)) { - AssignmentOperator(); - Expression(); - } else { - ; - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void AssignmentOperator() throws ParseException { - /*@bgen(jjtree) AssignmentOperator */ - SimpleNode jjtn000 = new SimpleNode(JJTASSIGNMENTOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ASSIGN: - jj_consume_token(ASSIGN); - break; - case STARASSIGN: - jj_consume_token(STARASSIGN); - break; - case SLASHASSIGN: - jj_consume_token(SLASHASSIGN); - break; - case REMASSIGN: - jj_consume_token(REMASSIGN); - break; - case PLUSASSIGN: - jj_consume_token(PLUSASSIGN); - break; - case MINUSASSIGN: - jj_consume_token(MINUSASSIGN); - break; - case LSHIFTASSIGN: - jj_consume_token(LSHIFTASSIGN); - break; - case RSIGNEDSHIFTASSIGN: - jj_consume_token(RSIGNEDSHIFTASSIGN); - break; - case RUNSIGNEDSHIFTASSIGN: - jj_consume_token(RUNSIGNEDSHIFTASSIGN); - break; - case ANDASSIGN: - jj_consume_token(ANDASSIGN); - break; - case XORASSIGN: - jj_consume_token(XORASSIGN); - break; - case ORASSIGN: - jj_consume_token(ORASSIGN); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void AssignmentExpression() throws ParseException { - /*@bgen(jjtree) AssignmentExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTASSIGNMENTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - PrimaryExpression(); - AssignmentOperator(); - Expression(); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ConditionalExpression() throws ParseException { - /*@bgen(jjtree) ConditionalExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTCONDITIONALEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - ConditionalOrExpression(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case HOOK: - jj_consume_token(HOOK); - Expression(); - jj_consume_token(COLON); - Expression(); - break; - default: - ; - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ConditionalOrExpression() throws ParseException { - /*@bgen(jjtree) ConditionalOrExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTCONDITIONALOREXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - ConditionalAndExpression(); - label_24: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case SC_OR: - ; - break; - default: - break label_24; - } - jj_consume_token(SC_OR); - ConditionalAndExpression(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ConditionalAndExpression() throws ParseException { - /*@bgen(jjtree) ConditionalAndExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTCONDITIONALANDEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - InclusiveOrExpression(); - label_25: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case SC_AND: - ; - break; - default: - break label_25; - } - jj_consume_token(SC_AND); - InclusiveOrExpression(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void InclusiveOrExpression() throws ParseException { - /*@bgen(jjtree) InclusiveOrExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTINCLUSIVEOREXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - ExclusiveOrExpression(); - label_26: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case BIT_OR: - ; - break; - default: - break label_26; - } - jj_consume_token(BIT_OR); - ExclusiveOrExpression(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ExclusiveOrExpression() throws ParseException { - /*@bgen(jjtree) ExclusiveOrExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTEXCLUSIVEOREXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - AndExpression(); - label_27: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case XOR: - ; - break; - default: - break label_27; - } - jj_consume_token(XOR); - AndExpression(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void AndExpression() throws ParseException { - /*@bgen(jjtree) AndExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTANDEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - EqualityExpression(); - label_28: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case BIT_AND: - ; - break; - default: - break label_28; - } - jj_consume_token(BIT_AND); - EqualityExpression(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void EqualityExpression() throws ParseException { - /*@bgen(jjtree) EqualityExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTEQUALITYEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - InstanceOfExpression(); - label_29: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case EQ: - case NE: - ; - break; - default: - break label_29; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case EQ: - jj_consume_token(EQ); - break; - case NE: - jj_consume_token(NE); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - InstanceOfExpression(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void InstanceOfExpression() throws ParseException { - /*@bgen(jjtree) InstanceOfExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTINSTANCEOFEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - RelationalExpression(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case INSTANCEOF: - jj_consume_token(INSTANCEOF); - Type(); - break; - default: - ; - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void RelationalExpression() throws ParseException { - /*@bgen(jjtree) RelationalExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTRELATIONALEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - ShiftExpression(); - label_30: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LT: - case LE: - case GE: - case GT: - ; - break; - default: - break label_30; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LT: - jj_consume_token(LT); - break; - case GT: - jj_consume_token(GT); - break; - case LE: - jj_consume_token(LE); - break; - case GE: - jj_consume_token(GE); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - ShiftExpression(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ShiftExpression() throws ParseException { - /*@bgen(jjtree) ShiftExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTSHIFTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - AdditiveExpression(); - label_31: - while (true) { - if (jj_2_22(1)) { - ; - } else { - break label_31; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LSHIFT: - jj_consume_token(LSHIFT); - break; - default: - if (jj_2_23(1)) { - RSIGNEDSHIFT(); - } else if (jj_2_24(1)) { - RUNSIGNEDSHIFT(); - } else { - jj_consume_token(-1); - throw new ParseException(); - } - } - AdditiveExpression(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void AdditiveExpression() throws ParseException { - /*@bgen(jjtree) AdditiveExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTADDITIVEEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - MultiplicativeExpression(); - label_32: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PLUS: - case MINUS: - ; - break; - default: - break label_32; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PLUS: - jj_consume_token(PLUS); - break; - case MINUS: - jj_consume_token(MINUS); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - MultiplicativeExpression(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void MultiplicativeExpression() throws ParseException { - /*@bgen(jjtree) MultiplicativeExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTMULTIPLICATIVEEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - UnaryExpression(); - label_33: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case STAR: - case SLASH: - case REM: - ; - break; - default: - break label_33; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case STAR: - jj_consume_token(STAR); - break; - case SLASH: - jj_consume_token(SLASH); - break; - case REM: - jj_consume_token(REM); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - UnaryExpression(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void UnaryExpression() throws ParseException { - /*@bgen(jjtree) UnaryExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTUNARYEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PLUS: - case MINUS: - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PLUS: - jj_consume_token(PLUS); - break; - case MINUS: - jj_consume_token(MINUS); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - UnaryExpression(); - break; - case INCR: - PreIncrementExpression(); - break; - case DECR: - PreDecrementExpression(); - break; - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FALSE: - case FLOAT: - case INT: - case LONG: - case NEW: - case NULL: - case SHORT: - case SUPER: - case THIS: - case TRUE: - case VOID: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case IDENTIFIER: - case LPAREN: - case BANG: - case TILDE: - UnaryExpressionNotPlusMinus(); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void PreIncrementExpression() throws ParseException { - /*@bgen(jjtree) PreIncrementExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTPREINCREMENTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(INCR); - PrimaryExpression(); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void PreDecrementExpression() throws ParseException { - /*@bgen(jjtree) PreDecrementExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTPREDECREMENTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(DECR); - PrimaryExpression(); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void UnaryExpressionNotPlusMinus() throws ParseException { - /*@bgen(jjtree) UnaryExpressionNotPlusMinus */ - SimpleNode jjtn000 = new SimpleNode(JJTUNARYEXPRESSIONNOTPLUSMINUS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case BANG: - case TILDE: - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case TILDE: - jj_consume_token(TILDE); - break; - case BANG: - jj_consume_token(BANG); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - UnaryExpression(); - break; - default: - if (jj_2_25(2147483647)) { - CastExpression(); - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FALSE: - case FLOAT: - case INT: - case LONG: - case NEW: - case NULL: - case SHORT: - case SUPER: - case THIS: - case TRUE: - case VOID: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case IDENTIFIER: - case LPAREN: - PostfixExpression(); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - -// This production is to determine lookahead only. The LOOKAHEAD specifications -// below are not used, but they are there just to indicate that we know about - - // this. - final public void CastLookahead() throws ParseException { - /*@bgen(jjtree) CastLookahead */ - SimpleNode jjtn000 = new SimpleNode(JJTCASTLOOKAHEAD); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - if (jj_2_26(2)) { - jj_consume_token(LPAREN); - PrimitiveType(); - } else if (jj_2_27(2147483647)) { - jj_consume_token(LPAREN); - Type(); - jj_consume_token(LBRACKET); - jj_consume_token(RBRACKET); - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LPAREN: - jj_consume_token(LPAREN); - Type(); - jj_consume_token(RPAREN); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case TILDE: - jj_consume_token(TILDE); - break; - case BANG: - jj_consume_token(BANG); - break; - case LPAREN: - jj_consume_token(LPAREN); - break; - case IDENTIFIER: - jj_consume_token(IDENTIFIER); - break; - case THIS: - jj_consume_token(THIS); - break; - case SUPER: - jj_consume_token(SUPER); - break; - case NEW: - jj_consume_token(NEW); - break; - case FALSE: - case NULL: - case TRUE: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - Literal(); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void PostfixExpression() throws ParseException { - /*@bgen(jjtree) PostfixExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTPOSTFIXEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - PrimaryExpression(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case INCR: - case DECR: - PostfixOperator(); - break; - default: - ; - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void PostfixOperator() throws ParseException { - /*@bgen(jjtree) PostfixOperator */ - SimpleNode jjtn000 = new SimpleNode(JJTPOSTFIXOPERATOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case INCR: - jj_consume_token(INCR); - break; - case DECR: - jj_consume_token(DECR); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void CastExpression() throws ParseException { - /*@bgen(jjtree) CastExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTCASTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - if (jj_2_28(2147483647)) { - jj_consume_token(LPAREN); - Type(); - jj_consume_token(RPAREN); - UnaryExpression(); - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LPAREN: - jj_consume_token(LPAREN); - Type(); - jj_consume_token(RPAREN); - UnaryExpressionNotPlusMinus(); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void PrimaryExpression() throws ParseException { - /*@bgen(jjtree) PrimaryExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTPRIMARYEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - PrimaryPrefix(); - label_34: - while (true) { - if (jj_2_29(2)) { - ; - } else { - break label_34; - } - PrimarySuffix(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void MemberSelector() throws ParseException { - /*@bgen(jjtree) MemberSelector */ - SimpleNode jjtn000 = new SimpleNode(JJTMEMBERSELECTOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(DOT); - TypeArguments(); - jj_consume_token(IDENTIFIER); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void PrimaryPrefix() throws ParseException { - /*@bgen(jjtree) PrimaryPrefix */ - SimpleNode jjtn000 = new SimpleNode(JJTPRIMARYPREFIX); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case FALSE: - case NULL: - case TRUE: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - Literal(); - break; - default: - if (jj_2_30(2147483647)) { - label_35: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IDENTIFIER: - ; - break; - default: - break label_35; - } - jj_consume_token(IDENTIFIER); - jj_consume_token(DOT); - } - jj_consume_token(THIS); - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case SUPER: - jj_consume_token(SUPER); - jj_consume_token(DOT); - jj_consume_token(IDENTIFIER); - break; - case LPAREN: - jj_consume_token(LPAREN); - Expression(); - jj_consume_token(RPAREN); - break; - case NEW: - AllocationExpression(); - break; - default: - if (jj_2_31(2147483647)) { - ResultType(); - jj_consume_token(DOT); - jj_consume_token(CLASS); - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IDENTIFIER: - Name(); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } - } - } - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void PrimarySuffix() throws ParseException { - /*@bgen(jjtree) PrimarySuffix */ - SimpleNode jjtn000 = new SimpleNode(JJTPRIMARYSUFFIX); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - if (jj_2_32(2147483647)) { - jj_consume_token(DOT); - jj_consume_token(SUPER); - } else if (jj_2_33(2147483647)) { - jj_consume_token(DOT); - jj_consume_token(THIS); - } else if (jj_2_34(2)) { - jj_consume_token(DOT); - AllocationExpression(); - } else if (jj_2_35(3)) { - MemberSelector(); - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LBRACKET: - jj_consume_token(LBRACKET); - Expression(); - jj_consume_token(RBRACKET); - break; - case DOT: - jj_consume_token(DOT); - jj_consume_token(IDENTIFIER); - break; - case LPAREN: - Arguments(); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Literal() throws ParseException { - /*@bgen(jjtree) Literal */ - SimpleNode jjtn000 = new SimpleNode(JJTLITERAL); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case INTEGER_LITERAL: - jj_consume_token(INTEGER_LITERAL); - break; - case FLOATING_POINT_LITERAL: - jj_consume_token(FLOATING_POINT_LITERAL); - break; - case CHARACTER_LITERAL: - jj_consume_token(CHARACTER_LITERAL); - break; - case STRING_LITERAL: - jj_consume_token(STRING_LITERAL); - break; - case FALSE: - case TRUE: - BooleanLiteral(); - break; - case NULL: - NullLiteral(); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void BooleanLiteral() throws ParseException { - /*@bgen(jjtree) BooleanLiteral */ - SimpleNode jjtn000 = new SimpleNode(JJTBOOLEANLITERAL); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case TRUE: - jj_consume_token(TRUE); - break; - case FALSE: - jj_consume_token(FALSE); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void NullLiteral() throws ParseException { - /*@bgen(jjtree) NullLiteral */ - SimpleNode jjtn000 = new SimpleNode(JJTNULLLITERAL); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(NULL); - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Arguments() throws ParseException { - /*@bgen(jjtree) Arguments */ - SimpleNode jjtn000 = new SimpleNode(JJTARGUMENTS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(LPAREN); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FALSE: - case FLOAT: - case INT: - case LONG: - case NEW: - case NULL: - case SHORT: - case SUPER: - case THIS: - case TRUE: - case VOID: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case IDENTIFIER: - case LPAREN: - case BANG: - case TILDE: - case INCR: - case DECR: - case PLUS: - case MINUS: - ArgumentList(); - break; - default: - ; - } - jj_consume_token(RPAREN); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ArgumentList() throws ParseException { - /*@bgen(jjtree) ArgumentList */ - SimpleNode jjtn000 = new SimpleNode(JJTARGUMENTLIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - Expression(); - label_36: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - ; - break; - default: - break label_36; - } - jj_consume_token(COMMA); - Expression(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void AllocationExpression() throws ParseException { - /*@bgen(jjtree) AllocationExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTALLOCATIONEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - if (jj_2_36(2)) { - jj_consume_token(NEW); - PrimitiveType(); - ArrayDimsAndInits(); - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case NEW: - jj_consume_token(NEW); - ClassOrInterfaceType(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LT: - TypeArguments(); - break; - default: - ; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LBRACKET: - ArrayDimsAndInits(); - break; - case LPAREN: - Arguments(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LBRACE: - ClassOrInterfaceBody(false); - break; - default: - ; - } - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - /* - * The third LOOKAHEAD specification below is to parse to PrimarySuffix - * if there is an expression between the "[...]". - */ - final public void ArrayDimsAndInits() throws ParseException { - /*@bgen(jjtree) ArrayDimsAndInits */ - SimpleNode jjtn000 = new SimpleNode(JJTARRAYDIMSANDINITS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - if (jj_2_39(2)) { - label_37: - while (true) { - jj_consume_token(LBRACKET); - Expression(); - jj_consume_token(RBRACKET); - if (jj_2_37(2)) { - ; - } else { - break label_37; - } - } - label_38: - while (true) { - if (jj_2_38(2)) { - ; - } else { - break label_38; - } - jj_consume_token(LBRACKET); - jj_consume_token(RBRACKET); - } - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LBRACKET: - label_39: - while (true) { - jj_consume_token(LBRACKET); - jj_consume_token(RBRACKET); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case LBRACKET: - ; - break; - default: - break label_39; - } - } - ArrayInitializer(); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - /* - * Statement syntax follows. - */ - final public void Statement() throws ParseException { - /*@bgen(jjtree) Statement */ - SimpleNode jjtn000 = new SimpleNode(JJTSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - if (jj_2_40(2)) { - LabeledStatement(); - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ASSERT: - AssertStatement(); - break; - case LBRACE: - Block(); - break; - case SEMICOLON: - EmptyStatement(); - break; - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FALSE: - case FLOAT: - case INT: - case LONG: - case NEW: - case NULL: - case SHORT: - case SUPER: - case THIS: - case TRUE: - case VOID: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case IDENTIFIER: - case LPAREN: - case INCR: - case DECR: - StatementExpression(); - jj_consume_token(SEMICOLON); - break; - case SWITCH: - SwitchStatement(); - break; - case IF: - IfStatement(); - break; - case WHILE: - WhileStatement(); - break; - case DO: - DoStatement(); - break; - case FOR: - ForStatement(); - break; - case BREAK: - BreakStatement(); - break; - case CONTINUE: - ContinueStatement(); - break; - case RETURN: - ReturnStatement(); - break; - case THROW: - ThrowStatement(); - break; - case SYNCHRONIZED: - SynchronizedStatement(); - break; - case TRY: - TryStatement(); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void AssertStatement() throws ParseException { - /*@bgen(jjtree) AssertStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTASSERTSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(ASSERT); - Expression(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COLON: - jj_consume_token(COLON); - Expression(); - break; - default: - ; - } - jj_consume_token(SEMICOLON); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void LabeledStatement() throws ParseException { - /*@bgen(jjtree) LabeledStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTLABELEDSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(IDENTIFIER); - jj_consume_token(COLON); - Statement(); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Block() throws ParseException { - /*@bgen(jjtree) Block */ - SimpleNode jjtn000 = new SimpleNode(JJTBLOCK); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(LBRACE); - label_40: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ABSTRACT: - case ASSERT: - case BOOLEAN: - case BREAK: - case BYTE: - case CHAR: - case CLASS: - case CONTINUE: - case DO: - case DOUBLE: - case FALSE: - case FINAL: - case FLOAT: - case FOR: - case IF: - case INT: - case INTERFACE: - case LONG: - case NATIVE: - case NEW: - case NULL: - case PRIVATE: - case PROTECTED: - case PUBLIC: - case RETURN: - case SHORT: - case STATIC: - case STRICTFP: - case SUPER: - case SWITCH: - case SYNCHRONIZED: - case THIS: - case THROW: - case TRANSIENT: - case TRUE: - case TRY: - case VOID: - case VOLATILE: - case WHILE: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case IDENTIFIER: - case LPAREN: - case LBRACE: - case SEMICOLON: - case AT: - case INCR: - case DECR: - ; - break; - default: - break label_40; - } - BlockStatement(); - } - jj_consume_token(RBRACE); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void BlockStatement() throws ParseException { - /*@bgen(jjtree) BlockStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTBLOCKSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - if (jj_2_41(2147483647)) { - LocalVariableDeclaration(); - jj_consume_token(SEMICOLON); - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ASSERT: - case BOOLEAN: - case BREAK: - case BYTE: - case CHAR: - case CONTINUE: - case DO: - case DOUBLE: - case FALSE: - case FLOAT: - case FOR: - case IF: - case INT: - case LONG: - case NEW: - case NULL: - case RETURN: - case SHORT: - case SUPER: - case SWITCH: - case SYNCHRONIZED: - case THIS: - case THROW: - case TRUE: - case TRY: - case VOID: - case WHILE: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case IDENTIFIER: - case LPAREN: - case LBRACE: - case SEMICOLON: - case INCR: - case DECR: - Statement(); - break; - case CLASS: - case INTERFACE: - ClassOrInterfaceDeclaration(0); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void LocalVariableDeclaration() throws ParseException { - /*@bgen(jjtree) LocalVariableDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTLOCALVARIABLEDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - Modifiers(); - Type(); - VariableDeclarator(); - label_41: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - ; - break; - default: - break label_41; - } - jj_consume_token(COMMA); - VariableDeclarator(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void EmptyStatement() throws ParseException { - /*@bgen(jjtree) EmptyStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTEMPTYSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(SEMICOLON); - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void StatementExpression() throws ParseException { - /*@bgen(jjtree) StatementExpression */ - SimpleNode jjtn000 = new SimpleNode(JJTSTATEMENTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case INCR: - PreIncrementExpression(); - break; - case DECR: - PreDecrementExpression(); - break; - default: - if (jj_2_42(2147483647)) { - AssignmentExpression(); - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FALSE: - case FLOAT: - case INT: - case LONG: - case NEW: - case NULL: - case SHORT: - case SUPER: - case THIS: - case TRUE: - case VOID: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case IDENTIFIER: - case LPAREN: - PostfixExpression(); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void SwitchStatement() throws ParseException { - /*@bgen(jjtree) SwitchStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTSWITCHSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(SWITCH); - jj_consume_token(LPAREN); - Expression(); - jj_consume_token(RPAREN); - jj_consume_token(LBRACE); - label_42: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case CASE: - case _DEFAULT: - ; - break; - default: - break label_42; - } - SwitchLabel(); - label_43: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ABSTRACT: - case ASSERT: - case BOOLEAN: - case BREAK: - case BYTE: - case CHAR: - case CLASS: - case CONTINUE: - case DO: - case DOUBLE: - case FALSE: - case FINAL: - case FLOAT: - case FOR: - case IF: - case INT: - case INTERFACE: - case LONG: - case NATIVE: - case NEW: - case NULL: - case PRIVATE: - case PROTECTED: - case PUBLIC: - case RETURN: - case SHORT: - case STATIC: - case STRICTFP: - case SUPER: - case SWITCH: - case SYNCHRONIZED: - case THIS: - case THROW: - case TRANSIENT: - case TRUE: - case TRY: - case VOID: - case VOLATILE: - case WHILE: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case IDENTIFIER: - case LPAREN: - case LBRACE: - case SEMICOLON: - case AT: - case INCR: - case DECR: - ; - break; - default: - break label_43; - } - BlockStatement(); - } - } - jj_consume_token(RBRACE); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void SwitchLabel() throws ParseException { - /*@bgen(jjtree) SwitchLabel */ - SimpleNode jjtn000 = new SimpleNode(JJTSWITCHLABEL); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case CASE: - jj_consume_token(CASE); - Expression(); - jj_consume_token(COLON); - break; - case _DEFAULT: - jj_consume_token(_DEFAULT); - jj_consume_token(COLON); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void IfStatement() throws ParseException { - /*@bgen(jjtree) IfStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTIFSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(IF); - jj_consume_token(LPAREN); - Expression(); - jj_consume_token(RPAREN); - Statement(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ELSE: - jj_consume_token(ELSE); - Statement(); - break; - default: - ; - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void WhileStatement() throws ParseException { - /*@bgen(jjtree) WhileStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTWHILESTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(WHILE); - jj_consume_token(LPAREN); - Expression(); - jj_consume_token(RPAREN); - Statement(); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void DoStatement() throws ParseException { - /*@bgen(jjtree) DoStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTDOSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(DO); - Statement(); - jj_consume_token(WHILE); - jj_consume_token(LPAREN); - Expression(); - jj_consume_token(RPAREN); - jj_consume_token(SEMICOLON); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ForStatement() throws ParseException { - /*@bgen(jjtree) ForStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTFORSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(FOR); - jj_consume_token(LPAREN); - if (jj_2_43(2147483647)) { - Modifiers(); - Type(); - jj_consume_token(IDENTIFIER); - jj_consume_token(COLON); - Expression(); - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ABSTRACT: - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FALSE: - case FINAL: - case FLOAT: - case INT: - case LONG: - case NATIVE: - case NEW: - case NULL: - case PRIVATE: - case PROTECTED: - case PUBLIC: - case SHORT: - case STATIC: - case STRICTFP: - case SUPER: - case SYNCHRONIZED: - case THIS: - case TRANSIENT: - case TRUE: - case VOID: - case VOLATILE: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case IDENTIFIER: - case LPAREN: - case SEMICOLON: - case AT: - case INCR: - case DECR: - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ABSTRACT: - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FALSE: - case FINAL: - case FLOAT: - case INT: - case LONG: - case NATIVE: - case NEW: - case NULL: - case PRIVATE: - case PROTECTED: - case PUBLIC: - case SHORT: - case STATIC: - case STRICTFP: - case SUPER: - case SYNCHRONIZED: - case THIS: - case TRANSIENT: - case TRUE: - case VOID: - case VOLATILE: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case IDENTIFIER: - case LPAREN: - case AT: - case INCR: - case DECR: - ForInit(); - break; - default: - ; - } - jj_consume_token(SEMICOLON); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FALSE: - case FLOAT: - case INT: - case LONG: - case NEW: - case NULL: - case SHORT: - case SUPER: - case THIS: - case TRUE: - case VOID: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case IDENTIFIER: - case LPAREN: - case BANG: - case TILDE: - case INCR: - case DECR: - case PLUS: - case MINUS: - Expression(); - break; - default: - ; - } - jj_consume_token(SEMICOLON); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FALSE: - case FLOAT: - case INT: - case LONG: - case NEW: - case NULL: - case SHORT: - case SUPER: - case THIS: - case TRUE: - case VOID: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case IDENTIFIER: - case LPAREN: - case INCR: - case DECR: - ForUpdate(); - break; - default: - ; - } - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } - jj_consume_token(RPAREN); - Statement(); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ForInit() throws ParseException { - /*@bgen(jjtree) ForInit */ - SimpleNode jjtn000 = new SimpleNode(JJTFORINIT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - if (jj_2_44(2147483647)) { - LocalVariableDeclaration(); - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FALSE: - case FLOAT: - case INT: - case LONG: - case NEW: - case NULL: - case SHORT: - case SUPER: - case THIS: - case TRUE: - case VOID: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case IDENTIFIER: - case LPAREN: - case INCR: - case DECR: - StatementExpressionList(); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void StatementExpressionList() throws ParseException { - /*@bgen(jjtree) StatementExpressionList */ - SimpleNode jjtn000 = new SimpleNode(JJTSTATEMENTEXPRESSIONLIST); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - StatementExpression(); - label_44: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - ; - break; - default: - break label_44; - } - jj_consume_token(COMMA); - StatementExpression(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ForUpdate() throws ParseException { - /*@bgen(jjtree) ForUpdate */ - SimpleNode jjtn000 = new SimpleNode(JJTFORUPDATE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - StatementExpressionList(); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void BreakStatement() throws ParseException { - /*@bgen(jjtree) BreakStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTBREAKSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(BREAK); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IDENTIFIER: - jj_consume_token(IDENTIFIER); - break; - default: - ; - } - jj_consume_token(SEMICOLON); - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ContinueStatement() throws ParseException { - /*@bgen(jjtree) ContinueStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTCONTINUESTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(CONTINUE); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IDENTIFIER: - jj_consume_token(IDENTIFIER); - break; - default: - ; - } - jj_consume_token(SEMICOLON); - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ReturnStatement() throws ParseException { - /*@bgen(jjtree) ReturnStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTRETURNSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(RETURN); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FALSE: - case FLOAT: - case INT: - case LONG: - case NEW: - case NULL: - case SHORT: - case SUPER: - case THIS: - case TRUE: - case VOID: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case IDENTIFIER: - case LPAREN: - case BANG: - case TILDE: - case INCR: - case DECR: - case PLUS: - case MINUS: - Expression(); - break; - default: - ; - } - jj_consume_token(SEMICOLON); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void ThrowStatement() throws ParseException { - /*@bgen(jjtree) ThrowStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTTHROWSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(THROW); - Expression(); - jj_consume_token(SEMICOLON); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void SynchronizedStatement() throws ParseException { - /*@bgen(jjtree) SynchronizedStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTSYNCHRONIZEDSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(SYNCHRONIZED); - jj_consume_token(LPAREN); - Expression(); - jj_consume_token(RPAREN); - Block(); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void TryStatement() throws ParseException { - /*@bgen(jjtree) TryStatement */ - SimpleNode jjtn000 = new SimpleNode(JJTTRYSTATEMENT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(TRY); - Block(); - label_45: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case CATCH: - ; - break; - default: - break label_45; - } - jj_consume_token(CATCH); - jj_consume_token(LPAREN); - FormalParameter(); - jj_consume_token(RPAREN); - Block(); - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case FINALLY: - jj_consume_token(FINALLY); - Block(); - break; - default: - ; - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - /* We use productions to match >>>, >> and > so that we can keep the - * type declaration syntax with generics clean - */ - final public void RUNSIGNEDSHIFT() throws ParseException { - /*@bgen(jjtree) RUNSIGNEDSHIFT */ - SimpleNode jjtn000 = new SimpleNode(JJTRUNSIGNEDSHIFT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - if (getToken(1).kind == GT && - ((Token.GTToken) getToken(1)).realKind == RUNSIGNEDSHIFT) { - - } else { - jj_consume_token(-1); - throw new ParseException(); - } - jj_consume_token(GT); - jj_consume_token(GT); - jj_consume_token(GT); - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void RSIGNEDSHIFT() throws ParseException { - /*@bgen(jjtree) RSIGNEDSHIFT */ - SimpleNode jjtn000 = new SimpleNode(JJTRSIGNEDSHIFT); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - if (getToken(1).kind == GT && - ((Token.GTToken) getToken(1)).realKind == RSIGNEDSHIFT) { - - } else { - jj_consume_token(-1); - throw new ParseException(); - } - jj_consume_token(GT); - jj_consume_token(GT); - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - /* Annotation syntax follows. */ - final public void Annotation() throws ParseException { - /*@bgen(jjtree) Annotation */ - SimpleNode jjtn000 = new SimpleNode(JJTANNOTATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - if (jj_2_45(2147483647)) { - NormalAnnotation(); - } else if (jj_2_46(2147483647)) { - SingleMemberAnnotation(); - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case AT: - MarkerAnnotation(); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void NormalAnnotation() throws ParseException { - /*@bgen(jjtree) NormalAnnotation */ - SimpleNode jjtn000 = new SimpleNode(JJTNORMALANNOTATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(AT); - Name(); - jj_consume_token(LPAREN); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IDENTIFIER: - MemberValuePairs(); - break; - default: - ; - } - jj_consume_token(RPAREN); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void MarkerAnnotation() throws ParseException { - /*@bgen(jjtree) MarkerAnnotation */ - SimpleNode jjtn000 = new SimpleNode(JJTMARKERANNOTATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(AT); - Name(); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void SingleMemberAnnotation() throws ParseException { - /*@bgen(jjtree) SingleMemberAnnotation */ - SimpleNode jjtn000 = new SimpleNode(JJTSINGLEMEMBERANNOTATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(AT); - Name(); - jj_consume_token(LPAREN); - MemberValue(); - jj_consume_token(RPAREN); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void MemberValuePairs() throws ParseException { - /*@bgen(jjtree) MemberValuePairs */ - SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUEPAIRS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - MemberValuePair(); - label_46: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - ; - break; - default: - break label_46; - } - jj_consume_token(COMMA); - MemberValuePair(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void MemberValuePair() throws ParseException { - /*@bgen(jjtree) MemberValuePair */ - SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUEPAIR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(IDENTIFIER); - jj_consume_token(ASSIGN); - MemberValue(); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void MemberValue() throws ParseException { - /*@bgen(jjtree) MemberValue */ - SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case AT: - Annotation(); - break; - case LBRACE: - MemberValueArrayInitializer(); - break; - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FALSE: - case FLOAT: - case INT: - case LONG: - case NEW: - case NULL: - case SHORT: - case SUPER: - case THIS: - case TRUE: - case VOID: - case INTEGER_LITERAL: - case FLOATING_POINT_LITERAL: - case CHARACTER_LITERAL: - case STRING_LITERAL: - case IDENTIFIER: - case LPAREN: - case BANG: - case TILDE: - case INCR: - case DECR: - case PLUS: - case MINUS: - ConditionalExpression(); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void MemberValueArrayInitializer() throws ParseException { - /*@bgen(jjtree) MemberValueArrayInitializer */ - SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUEARRAYINITIALIZER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(LBRACE); - MemberValue(); - label_47: - while (true) { - if (jj_2_47(2)) { - ; - } else { - break label_47; - } - jj_consume_token(COMMA); - MemberValue(); - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case COMMA: - jj_consume_token(COMMA); - break; - default: - ; - } - jj_consume_token(RBRACE); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - /* Annotation Types. */ - final public void AnnotationTypeDeclaration(int modifiers) throws ParseException { - /*@bgen(jjtree) AnnotationTypeDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTANNOTATIONTYPEDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(AT); - jj_consume_token(INTERFACE); - jj_consume_token(IDENTIFIER); - AnnotationTypeBody(); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void AnnotationTypeBody() throws ParseException { - /*@bgen(jjtree) AnnotationTypeBody */ - SimpleNode jjtn000 = new SimpleNode(JJTANNOTATIONTYPEBODY); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(LBRACE); - label_48: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ABSTRACT: - case BOOLEAN: - case BYTE: - case CHAR: - case CLASS: - case DOUBLE: - case ENUM: - case FINAL: - case FLOAT: - case INT: - case INTERFACE: - case LONG: - case NATIVE: - case PRIVATE: - case PROTECTED: - case PUBLIC: - case SHORT: - case STATIC: - case STRICTFP: - case SYNCHRONIZED: - case TRANSIENT: - case VOLATILE: - case IDENTIFIER: - case SEMICOLON: - case AT: - ; - break; - default: - break label_48; - } - AnnotationTypeMemberDeclaration(); - } - jj_consume_token(RBRACE); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void AnnotationTypeMemberDeclaration() throws ParseException { - /*@bgen(jjtree) AnnotationTypeMemberDeclaration */ - SimpleNode jjtn000 = new SimpleNode(JJTANNOTATIONTYPEMEMBERDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - int modifiers; - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case ABSTRACT: - case BOOLEAN: - case BYTE: - case CHAR: - case CLASS: - case DOUBLE: - case ENUM: - case FINAL: - case FLOAT: - case INT: - case INTERFACE: - case LONG: - case NATIVE: - case PRIVATE: - case PROTECTED: - case PUBLIC: - case SHORT: - case STATIC: - case STRICTFP: - case SYNCHRONIZED: - case TRANSIENT: - case VOLATILE: - case IDENTIFIER: - case AT: - modifiers = Modifiers(); - if (jj_2_48(2147483647)) { - Type(); - jj_consume_token(IDENTIFIER); - jj_consume_token(LPAREN); - jj_consume_token(RPAREN); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case _DEFAULT: - DefaultValue(); - break; - default: - ; - } - jj_consume_token(SEMICOLON); - } else { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case CLASS: - case INTERFACE: - ClassOrInterfaceDeclaration(modifiers); - break; - case ENUM: - EnumDeclaration(modifiers); - break; - case AT: - AnnotationTypeDeclaration(modifiers); - break; - case BOOLEAN: - case BYTE: - case CHAR: - case DOUBLE: - case FLOAT: - case INT: - case LONG: - case SHORT: - case IDENTIFIER: - FieldDeclaration(modifiers); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } - break; - case SEMICOLON: - jj_consume_token(SEMICOLON); - break; - default: - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void DefaultValue() throws ParseException { - /*@bgen(jjtree) DefaultValue */ - SimpleNode jjtn000 = new SimpleNode(JJTDEFAULTVALUE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(_DEFAULT); - MemberValue(); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final private boolean jj_2_1(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_1(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_2(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_2(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_3(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_3(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_4(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_4(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_5(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_5(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_6(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_6(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_7(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_7(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_8(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_8(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_9(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_9(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_10(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_10(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_11(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_11(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_12(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_12(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_13(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_13(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_14(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_14(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_15(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_15(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_16(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_16(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_17(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_17(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_18(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_18(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_19(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_19(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_20(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_20(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_21(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_21(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_22(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_22(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_23(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_23(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_24(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_24(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_25(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_25(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_26(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_26(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_27(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_27(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_28(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_28(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_29(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_29(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_30(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_30(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_31(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_31(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_32(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_32(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_33(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_33(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_34(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_34(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_35(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_35(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_36(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_36(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_37(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_37(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_38(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_38(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_39(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_39(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_40(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_40(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_41(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_41(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_42(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_42(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_43(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_43(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_44(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_44(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_45(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_45(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_46(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_46(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_47(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_47(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_2_48(int xla) { - jj_la = xla; - jj_lastpos = jj_scanpos = token; - try { - return !jj_3_48(); - } - catch (LookaheadSuccess ls) { - return true; - } - } - - final private boolean jj_3R_56() { - if (jj_3R_101()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3_21()) jj_scanpos = xsp; - return false; - } - - final private boolean jj_3R_135() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_91()) return true; - return false; - } - - final private boolean jj_3R_99() { - if (jj_3R_91()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_135()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3_20() { - if (jj_scan_token(DOT)) return true; - if (jj_scan_token(IDENTIFIER)) return true; - return false; - } - - final private boolean jj_3R_91() { - if (jj_scan_token(IDENTIFIER)) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3_20()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_122() { - if (jj_3R_72()) return true; - return false; - } - - final private boolean jj_3R_86() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(58)) { - jj_scanpos = xsp; - if (jj_3R_122()) return true; - } - return false; - } - - final private boolean jj_3_19() { - if (jj_3R_78()) return true; - return false; - } - - final private boolean jj_3R_83() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(10)) { - jj_scanpos = xsp; - if (jj_scan_token(15)) { - jj_scanpos = xsp; - if (jj_scan_token(12)) { - jj_scanpos = xsp; - if (jj_scan_token(46)) { - jj_scanpos = xsp; - if (jj_scan_token(35)) { - jj_scanpos = xsp; - if (jj_scan_token(37)) { - jj_scanpos = xsp; - if (jj_scan_token(28)) { - jj_scanpos = xsp; - if (jj_scan_token(21)) return true; - } - } - } - } - } - } - } - return false; - } - - final private boolean jj_3R_194() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_112()) return true; - return false; - } - - final private boolean jj_3R_290() { - if (jj_scan_token(SUPER)) return true; - if (jj_3R_77()) return true; - return false; - } - - final private boolean jj_3_16() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_scan_token(RBRACKET)) return true; - return false; - } - - final private boolean jj_3R_289() { - if (jj_scan_token(EXTENDS)) return true; - if (jj_3R_77()) return true; - return false; - } - - final private boolean jj_3R_277() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_289()) { - jj_scanpos = xsp; - if (jj_3R_290()) return true; - } - return false; - } - - final private boolean jj_3R_256() { - if (jj_3R_277()) return true; - return false; - } - - final private boolean jj_3R_151() { - if (jj_scan_token(HOOK)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_256()) jj_scanpos = xsp; - return false; - } - - final private boolean jj_3_17() { - if (jj_3R_78()) return true; - return false; - } - - final private boolean jj_3R_112() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_150()) { - jj_scanpos = xsp; - if (jj_3R_151()) return true; - } - return false; - } - - final private boolean jj_3R_150() { - if (jj_3R_77()) return true; - return false; - } - - final private boolean jj_3_15() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_scan_token(RBRACKET)) return true; - return false; - } - - final private boolean jj_3R_78() { - if (jj_scan_token(LT)) return true; - if (jj_3R_112()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_194()) { - jj_scanpos = xsp; - break; - } - } - if (jj_scan_token(GT)) return true; - return false; - } - - final private boolean jj_3_18() { - if (jj_scan_token(DOT)) return true; - if (jj_scan_token(IDENTIFIER)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3_19()) jj_scanpos = xsp; - return false; - } - - final private boolean jj_3R_149() { - if (jj_scan_token(IDENTIFIER)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3_17()) jj_scanpos = xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3_18()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_111() { - if (jj_3R_149()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3_16()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_110() { - if (jj_3R_83()) return true; - Token xsp; - if (jj_3_15()) return true; - while (true) { - xsp = jj_scanpos; - if (jj_3_15()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_77() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_110()) { - jj_scanpos = xsp; - if (jj_3R_111()) return true; - } - return false; - } - - final private boolean jj_3_13() { - if (jj_scan_token(THIS)) return true; - if (jj_scan_token(DOT)) return true; - return false; - } - - final private boolean jj_3R_221() { - if (jj_scan_token(THROWS)) return true; - if (jj_3R_99()) return true; - return false; - } - - final private boolean jj_3R_103() { - if (jj_3R_83()) return true; - return false; - } - - final private boolean jj_3R_72() { - Token xsp; - xsp = jj_scanpos; - if (jj_3_14()) { - jj_scanpos = xsp; - if (jj_3R_103()) return true; - } - return false; - } - - final private boolean jj_3_14() { - if (jj_3R_77()) return true; - return false; - } - - final private boolean jj_3R_74() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(47)) jj_scanpos = xsp; - if (jj_3R_104()) return true; - return false; - } - - final private boolean jj_3_12() { - if (jj_3R_76()) return true; - return false; - } - - final private boolean jj_3R_108() { - if (jj_3R_78()) return true; - return false; - } - - final private boolean jj_3R_107() { - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_scan_token(DOT)) return true; - return false; - } - - final private boolean jj_3R_252() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_scan_token(RBRACKET)) return true; - return false; - } - - final private boolean jj_3R_76() { - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_107()) { - jj_scanpos = xsp; - break; - } - } - xsp = jj_scanpos; - if (jj_3_13()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_3R_108()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_scan_token(52)) { - jj_scanpos = xsp; - if (jj_scan_token(49)) return true; - } - if (jj_3R_109()) return true; - if (jj_scan_token(SEMICOLON)) return true; - return false; - } - - final private boolean jj_3R_134() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_133()) return true; - return false; - } - - final private boolean jj_3R_223() { - if (jj_3R_49()) return true; - return false; - } - - final private boolean jj_3R_222() { - if (jj_3R_76()) return true; - return false; - } - - final private boolean jj_3R_220() { - if (jj_3R_97()) return true; - return false; - } - - final private boolean jj_3R_186() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_220()) jj_scanpos = xsp; - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_3R_53()) return true; - xsp = jj_scanpos; - if (jj_3R_221()) jj_scanpos = xsp; - if (jj_scan_token(LBRACE)) return true; - xsp = jj_scanpos; - if (jj_3R_222()) jj_scanpos = xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_223()) { - jj_scanpos = xsp; - break; - } - } - if (jj_scan_token(RBRACE)) return true; - return false; - } - - final private boolean jj_3_11() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_75()) return true; - return false; - } - - final private boolean jj_3R_227() { - if (jj_scan_token(THROWS)) return true; - if (jj_3R_99()) return true; - return false; - } - - final private boolean jj_3R_98() { - if (jj_3R_133()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_134()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_133() { - if (jj_3R_50()) return true; - if (jj_3R_72()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(119)) jj_scanpos = xsp; - if (jj_3R_184()) return true; - return false; - } - - final private boolean jj_3R_53() { - if (jj_scan_token(LPAREN)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_98()) jj_scanpos = xsp; - if (jj_scan_token(RPAREN)) return true; - return false; - } - - final private boolean jj_3_48() { - if (jj_3R_72()) return true; - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - final private boolean jj_3R_226() { - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_3R_53()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_252()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_228() { - if (jj_3R_104()) return true; - return false; - } - - final private boolean jj_3R_225() { - if (jj_3R_97()) return true; - return false; - } - - final private boolean jj_3R_292() { - if (jj_3R_75()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3_11()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_188() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_225()) jj_scanpos = xsp; - if (jj_3R_86()) return true; - if (jj_3R_226()) return true; - xsp = jj_scanpos; - if (jj_3R_227()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_3R_228()) { - jj_scanpos = xsp; - if (jj_scan_token(81)) return true; - } - return false; - } - - final private boolean jj_3R_198() { - if (jj_scan_token(ASSIGN)) return true; - if (jj_3R_75()) return true; - return false; - } - - final private boolean jj_3R_224() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_161()) return true; - return false; - } - - final private boolean jj_3_47() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_93()) return true; - return false; - } - - final private boolean jj_3R_217() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_scan_token(RBRACKET)) return true; - return false; - } - - final private boolean jj_3R_147() { - if (jj_scan_token(LBRACE)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_292()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_scan_token(82)) jj_scanpos = xsp; - if (jj_scan_token(RBRACE)) return true; - return false; - } - - final private boolean jj_3R_73() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_scan_token(RBRACKET)) return true; - return false; - } - - final private boolean jj_3R_106() { - if (jj_3R_56()) return true; - return false; - } - - final private boolean jj_3R_105() { - if (jj_3R_147()) return true; - return false; - } - - final private boolean jj_3R_75() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_105()) { - jj_scanpos = xsp; - if (jj_3R_106()) return true; - } - return false; - } - - final private boolean jj_3R_184() { - if (jj_scan_token(IDENTIFIER)) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_217()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_160() { - if (jj_scan_token(LBRACE)) return true; - if (jj_3R_93()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3_47()) { - jj_scanpos = xsp; - break; - } - } - xsp = jj_scanpos; - if (jj_scan_token(82)) jj_scanpos = xsp; - if (jj_scan_token(RBRACE)) return true; - return false; - } - - final private boolean jj_3R_276() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_275()) return true; - return false; - } - - final private boolean jj_3R_161() { - if (jj_3R_184()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_198()) jj_scanpos = xsp; - return false; - } - - final private boolean jj_3R_127() { - if (jj_3R_101()) return true; - return false; - } - - final private boolean jj_3_9() { - if (jj_3R_72()) return true; - if (jj_scan_token(IDENTIFIER)) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_73()) { - jj_scanpos = xsp; - break; - } - } - xsp = jj_scanpos; - if (jj_scan_token(82)) { - jj_scanpos = xsp; - if (jj_scan_token(85)) { - jj_scanpos = xsp; - if (jj_scan_token(81)) return true; - } - } - return false; - } - - final private boolean jj_3R_126() { - if (jj_3R_160()) return true; - return false; - } - - final private boolean jj_3R_71() { - if (jj_3R_97()) return true; - return false; - } - - final private boolean jj_3R_93() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_125()) { - jj_scanpos = xsp; - if (jj_3R_126()) { - jj_scanpos = xsp; - if (jj_3R_127()) return true; - } - } - return false; - } - - final private boolean jj_3R_125() { - if (jj_3R_102()) return true; - return false; - } - - final private boolean jj_3_8() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_71()) jj_scanpos = xsp; - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - final private boolean jj_3R_187() { - if (jj_3R_72()) return true; - if (jj_3R_161()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_224()) { - jj_scanpos = xsp; - break; - } - } - if (jj_scan_token(SEMICOLON)) return true; - return false; - } - - final private boolean jj_3R_275() { - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_scan_token(ASSIGN)) return true; - if (jj_3R_93()) return true; - return false; - } - - final private boolean jj_3R_140() { - if (jj_3R_188()) return true; - return false; - } - - final private boolean jj_3R_139() { - if (jj_3R_187()) return true; - return false; - } - - final private boolean jj_3R_249() { - if (jj_scan_token(BIT_AND)) return true; - if (jj_3R_149()) return true; - return false; - } - - final private boolean jj_3R_138() { - if (jj_3R_186()) return true; - return false; - } - - final private boolean jj_3R_255() { - if (jj_3R_275()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_276()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_231() { - if (jj_3R_255()) return true; - return false; - } - - final private boolean jj_3R_137() { - if (jj_3R_185()) return true; - return false; - } - - final private boolean jj_3R_92() { - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_scan_token(ASSIGN)) return true; - return false; - } - - final private boolean jj_3R_136() { - if (jj_3R_130()) return true; - return false; - } - - final private boolean jj_3R_192() { - if (jj_scan_token(AT)) return true; - if (jj_3R_91()) return true; - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_93()) return true; - if (jj_scan_token(RPAREN)) return true; - return false; - } - - final private boolean jj_3R_286() { - if (jj_3R_182()) return true; - return false; - } - - final private boolean jj_3R_100() { - if (jj_3R_50()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_136()) { - jj_scanpos = xsp; - if (jj_3R_137()) { - jj_scanpos = xsp; - if (jj_3R_138()) { - jj_scanpos = xsp; - if (jj_3R_139()) { - jj_scanpos = xsp; - if (jj_3R_140()) return true; - } - } - } - } - return false; - } - - final private boolean jj_3R_193() { - if (jj_scan_token(AT)) return true; - if (jj_3R_91()) return true; - return false; - } - - final private boolean jj_3_46() { - if (jj_scan_token(AT)) return true; - if (jj_3R_91()) return true; - if (jj_scan_token(LPAREN)) return true; - return false; - } - - final private boolean jj_3_10() { - if (jj_3R_74()) return true; - return false; - } - - final private boolean jj_3R_55() { - Token xsp; - xsp = jj_scanpos; - if (jj_3_10()) { - jj_scanpos = xsp; - if (jj_3R_100()) { - jj_scanpos = xsp; - if (jj_scan_token(81)) return true; - } - } - return false; - } - - final private boolean jj_3R_191() { - if (jj_scan_token(AT)) return true; - if (jj_3R_91()) return true; - if (jj_scan_token(LPAREN)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_231()) jj_scanpos = xsp; - if (jj_scan_token(RPAREN)) return true; - return false; - } - - final private boolean jj_3_45() { - if (jj_scan_token(AT)) return true; - if (jj_3R_91()) return true; - if (jj_scan_token(LPAREN)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_92()) { - jj_scanpos = xsp; - if (jj_scan_token(76)) return true; - } - return false; - } - - final private boolean jj_3R_215() { - if (jj_3R_55()) return true; - return false; - } - - final private boolean jj_3R_132() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_131()) return true; - return false; - } - - final private boolean jj_3R_183() { - if (jj_3R_216()) return true; - return false; - } - - final private boolean jj_3R_285() { - if (jj_3R_109()) return true; - return false; - } - - final private boolean jj_3R_145() { - if (jj_3R_193()) return true; - return false; - } - - final private boolean jj_3R_182() { - if (jj_scan_token(LBRACE)) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_215()) { - jj_scanpos = xsp; - break; - } - } - if (jj_scan_token(RBRACE)) return true; - return false; - } - - final private boolean jj_3R_144() { - if (jj_3R_192()) return true; - return false; - } - - final private boolean jj_3R_113() { - return false; - } - - final private boolean jj_3R_102() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_143()) { - jj_scanpos = xsp; - if (jj_3R_144()) { - jj_scanpos = xsp; - if (jj_3R_145()) return true; - } - } - return false; - } - - final private boolean jj_3R_143() { - if (jj_3R_191()) return true; - return false; - } - - final private boolean jj_3R_216() { - if (jj_scan_token(EXTENDS)) return true; - if (jj_3R_149()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_249()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_131() { - if (jj_scan_token(IDENTIFIER)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_183()) jj_scanpos = xsp; - return false; - } - - final private boolean jj_3R_114() { - return false; - } - - final private boolean jj_3_7() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_70()) return true; - return false; - } - - final private boolean jj_3R_80() { - Token xsp; - xsp = jj_scanpos; - lookingAhead = true; - jj_semLA = getToken(1).kind == GT && - ((Token.GTToken) getToken(1)).realKind == RSIGNEDSHIFT; - lookingAhead = false; - if (!jj_semLA || jj_3R_113()) return true; - if (jj_scan_token(GT)) return true; - if (jj_scan_token(GT)) return true; - return false; - } - - final private boolean jj_3R_97() { - if (jj_scan_token(LT)) return true; - if (jj_3R_131()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_132()) { - jj_scanpos = xsp; - break; - } - } - if (jj_scan_token(GT)) return true; - return false; - } - - final private boolean jj_3R_272() { - if (jj_3R_55()) return true; - return false; - } - - final private boolean jj_3R_70() { - if (jj_3R_50()) return true; - if (jj_scan_token(IDENTIFIER)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_285()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_3R_286()) jj_scanpos = xsp; - return false; - } - - final private boolean jj_3R_81() { - Token xsp; - xsp = jj_scanpos; - lookingAhead = true; - jj_semLA = getToken(1).kind == GT && - ((Token.GTToken) getToken(1)).realKind == RUNSIGNEDSHIFT; - lookingAhead = false; - if (!jj_semLA || jj_3R_114()) return true; - if (jj_scan_token(GT)) return true; - if (jj_scan_token(GT)) return true; - if (jj_scan_token(GT)) return true; - return false; - } - - final private boolean jj_3R_251() { - if (jj_scan_token(SEMICOLON)) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_272()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_250() { - if (jj_3R_70()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3_7()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_246() { - if (jj_scan_token(FINALLY)) return true; - if (jj_3R_104()) return true; - return false; - } - - final private boolean jj_3R_219() { - if (jj_scan_token(LBRACE)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_250()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_scan_token(82)) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_3R_251()) jj_scanpos = xsp; - if (jj_scan_token(RBRACE)) return true; - return false; - } - - final private boolean jj_3R_245() { - if (jj_scan_token(CATCH)) return true; - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_133()) return true; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_104()) return true; - return false; - } - - final private boolean jj_3R_212() { - if (jj_scan_token(TRY)) return true; - if (jj_3R_104()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_245()) { - jj_scanpos = xsp; - break; - } - } - xsp = jj_scanpos; - if (jj_3R_246()) jj_scanpos = xsp; - return false; - } - - final private boolean jj_3R_218() { - if (jj_3R_214()) return true; - return false; - } - - final private boolean jj_3R_185() { - if (jj_scan_token(ENUM)) return true; - if (jj_scan_token(IDENTIFIER)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_218()) jj_scanpos = xsp; - if (jj_3R_219()) return true; - return false; - } - - final private boolean jj_3R_211() { - if (jj_scan_token(SYNCHRONIZED)) return true; - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_56()) return true; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_104()) return true; - return false; - } - - final private boolean jj_3R_244() { - if (jj_3R_56()) return true; - return false; - } - - final private boolean jj_3R_248() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_149()) return true; - return false; - } - - final private boolean jj_3R_214() { - if (jj_scan_token(IMPLEMENTS)) return true; - if (jj_3R_149()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_248()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_210() { - if (jj_scan_token(THROW)) return true; - if (jj_3R_56()) return true; - if (jj_scan_token(SEMICOLON)) return true; - return false; - } - - final private boolean jj_3R_271() { - if (jj_3R_284()) return true; - return false; - } - - final private boolean jj_3R_299() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_201()) return true; - return false; - } - - final private boolean jj_3R_209() { - if (jj_scan_token(RETURN)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_244()) jj_scanpos = xsp; - if (jj_scan_token(SEMICOLON)) return true; - return false; - } - - final private boolean jj_3R_247() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_149()) return true; - return false; - } - - final private boolean jj_3R_213() { - if (jj_scan_token(EXTENDS)) return true; - if (jj_3R_149()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_247()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_208() { - if (jj_scan_token(CONTINUE)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(72)) jj_scanpos = xsp; - if (jj_scan_token(SEMICOLON)) return true; - return false; - } - - final private boolean jj_3R_178() { - if (jj_scan_token(INTERFACE)) return true; - return false; - } - - final private boolean jj_3R_207() { - if (jj_scan_token(BREAK)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(72)) jj_scanpos = xsp; - if (jj_scan_token(SEMICOLON)) return true; - return false; - } - - final private boolean jj_3R_181() { - if (jj_3R_214()) return true; - return false; - } - - final private boolean jj_3R_180() { - if (jj_3R_213()) return true; - return false; - } - - final private boolean jj_3R_179() { - if (jj_3R_97()) return true; - return false; - } - - final private boolean jj_3R_284() { - if (jj_3R_296()) return true; - return false; - } - - final private boolean jj_3R_270() { - if (jj_3R_56()) return true; - return false; - } - - final private boolean jj_3R_130() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(16)) { - jj_scanpos = xsp; - if (jj_3R_178()) return true; - } - if (jj_scan_token(IDENTIFIER)) return true; - xsp = jj_scanpos; - if (jj_3R_179()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_3R_180()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_3R_181()) jj_scanpos = xsp; - if (jj_3R_182()) return true; - return false; - } - - final private boolean jj_3_44() { - if (jj_3R_50()) return true; - if (jj_3R_72()) return true; - if (jj_scan_token(IDENTIFIER)) return true; - return false; - } - - final private boolean jj_3R_296() { - if (jj_3R_201()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_299()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_241() { - if (jj_scan_token(ELSE)) return true; - if (jj_3R_129()) return true; - return false; - } - - final private boolean jj_3R_295() { - if (jj_3R_296()) return true; - return false; - } - - final private boolean jj_3_43() { - if (jj_3R_50()) return true; - if (jj_3R_72()) return true; - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_scan_token(COLON)) return true; - return false; - } - - final private boolean jj_3R_294() { - if (jj_3R_128()) return true; - return false; - } - - final private boolean jj_3R_283() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_294()) { - jj_scanpos = xsp; - if (jj_3R_295()) return true; - } - return false; - } - - final private boolean jj_3R_269() { - if (jj_3R_283()) return true; - return false; - } - - final private boolean jj_3R_243() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_269()) jj_scanpos = xsp; - if (jj_scan_token(SEMICOLON)) return true; - xsp = jj_scanpos; - if (jj_3R_270()) jj_scanpos = xsp; - if (jj_scan_token(SEMICOLON)) return true; - xsp = jj_scanpos; - if (jj_3R_271()) jj_scanpos = xsp; - return false; - } - - final private boolean jj_3R_242() { - if (jj_3R_50()) return true; - if (jj_3R_72()) return true; - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_scan_token(COLON)) return true; - if (jj_3R_56()) return true; - return false; - } - - final private boolean jj_3R_54() { - if (jj_scan_token(THROWS)) return true; - if (jj_3R_99()) return true; - return false; - } - - final private boolean jj_3R_206() { - if (jj_scan_token(FOR)) return true; - if (jj_scan_token(LPAREN)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_242()) { - jj_scanpos = xsp; - if (jj_3R_243()) return true; - } - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_129()) return true; - return false; - } - - final private boolean jj_3R_69() { - if (jj_3R_102()) return true; - return false; - } - - final private boolean jj_3R_205() { - if (jj_scan_token(DO)) return true; - if (jj_3R_129()) return true; - if (jj_scan_token(WHILE)) return true; - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_56()) return true; - if (jj_scan_token(RPAREN)) return true; - if (jj_scan_token(SEMICOLON)) return true; - return false; - } - - final private boolean jj_3R_68() { - if (jj_scan_token(STRICTFP)) return true; - return false; - } - - final private boolean jj_3R_67() { - if (jj_scan_token(VOLATILE)) return true; - return false; - } - - final private boolean jj_3R_66() { - if (jj_scan_token(TRANSIENT)) return true; - return false; - } - - final private boolean jj_3R_204() { - if (jj_scan_token(WHILE)) return true; - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_56()) return true; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_129()) return true; - return false; - } - - final private boolean jj_3R_65() { - if (jj_scan_token(NATIVE)) return true; - return false; - } - - final private boolean jj_3R_64() { - if (jj_scan_token(SYNCHRONIZED)) return true; - return false; - } - - final private boolean jj_3R_63() { - if (jj_scan_token(ABSTRACT)) return true; - return false; - } - - final private boolean jj_3R_268() { - if (jj_3R_49()) return true; - return false; - } - - final private boolean jj_3R_203() { - if (jj_scan_token(IF)) return true; - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_56()) return true; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_129()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_241()) jj_scanpos = xsp; - return false; - } - - final private boolean jj_3R_62() { - if (jj_scan_token(FINAL)) return true; - return false; - } - - final private boolean jj_3R_61() { - if (jj_scan_token(PRIVATE)) return true; - return false; - } - - final private boolean jj_3R_162() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_161()) return true; - return false; - } - - final private boolean jj_3R_60() { - if (jj_scan_token(PROTECTED)) return true; - return false; - } - - final private boolean jj_3R_59() { - if (jj_scan_token(STATIC)) return true; - return false; - } - - final private boolean jj_3R_58() { - if (jj_scan_token(PUBLIC)) return true; - return false; - } - - final private boolean jj_3R_282() { - if (jj_scan_token(_DEFAULT)) return true; - if (jj_scan_token(COLON)) return true; - return false; - } - - final private boolean jj_3_6() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_58()) { - jj_scanpos = xsp; - if (jj_3R_59()) { - jj_scanpos = xsp; - if (jj_3R_60()) { - jj_scanpos = xsp; - if (jj_3R_61()) { - jj_scanpos = xsp; - if (jj_3R_62()) { - jj_scanpos = xsp; - if (jj_3R_63()) { - jj_scanpos = xsp; - if (jj_3R_64()) { - jj_scanpos = xsp; - if (jj_3R_65()) { - jj_scanpos = xsp; - if (jj_3R_66()) { - jj_scanpos = xsp; - if (jj_3R_67()) { - jj_scanpos = xsp; - if (jj_3R_68()) { - jj_scanpos = xsp; - if (jj_3R_69()) return true; - } - } - } - } - } - } - } - } - } - } - } - return false; - } - - final private boolean jj_3R_281() { - if (jj_scan_token(CASE)) return true; - if (jj_3R_56()) return true; - if (jj_scan_token(COLON)) return true; - return false; - } - - final private boolean jj_3R_267() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_281()) { - jj_scanpos = xsp; - if (jj_3R_282()) return true; - } - return false; - } - - final private boolean jj_3R_50() { - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3_6()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_240() { - if (jj_3R_267()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_268()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3_42() { - if (jj_3R_90()) return true; - if (jj_3R_79()) return true; - return false; - } - - final private boolean jj_3R_202() { - if (jj_scan_token(SWITCH)) return true; - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_56()) return true; - if (jj_scan_token(RPAREN)) return true; - if (jj_scan_token(LBRACE)) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_240()) { - jj_scanpos = xsp; - break; - } - } - if (jj_scan_token(RBRACE)) return true; - return false; - } - - final private boolean jj_3R_239() { - if (jj_3R_266()) return true; - return false; - } - - final private boolean jj_3R_57() { - if (jj_3R_102()) return true; - return false; - } - - final private boolean jj_3R_52() { - if (jj_3R_86()) return true; - return false; - } - - final private boolean jj_3R_238() { - if (jj_3R_265()) return true; - return false; - } - - final private boolean jj_3_5() { - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_57()) { - jj_scanpos = xsp; - break; - } - } - if (jj_scan_token(PACKAGE)) return true; - return false; - } - - final private boolean jj_3R_237() { - if (jj_3R_264()) return true; - return false; - } - - final private boolean jj_3R_201() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_236()) { - jj_scanpos = xsp; - if (jj_3R_237()) { - jj_scanpos = xsp; - if (jj_3R_238()) { - jj_scanpos = xsp; - if (jj_3R_239()) return true; - } - } - } - return false; - } - - final private boolean jj_3R_236() { - if (jj_3R_263()) return true; - return false; - } - - final private boolean jj_3R_200() { - if (jj_scan_token(SEMICOLON)) return true; - return false; - } - - final private boolean jj_3_41() { - if (jj_3R_50()) return true; - if (jj_3R_72()) return true; - if (jj_scan_token(IDENTIFIER)) return true; - return false; - } - - final private boolean jj_3R_128() { - if (jj_3R_50()) return true; - if (jj_3R_72()) return true; - if (jj_3R_161()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_162()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_51() { - if (jj_3R_97()) return true; - return false; - } - - final private boolean jj_3R_235() { - if (jj_scan_token(COLON)) return true; - if (jj_3R_56()) return true; - return false; - } - - final private boolean jj_3R_96() { - if (jj_3R_130()) return true; - return false; - } - - final private boolean jj_3R_95() { - if (jj_3R_129()) return true; - return false; - } - - final private boolean jj_3_4() { - if (jj_3R_56()) return true; - return false; - } - - final private boolean jj_3R_94() { - if (jj_3R_128()) return true; - if (jj_scan_token(SEMICOLON)) return true; - return false; - } - - final private boolean jj_3R_49() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_94()) { - jj_scanpos = xsp; - if (jj_3R_95()) { - jj_scanpos = xsp; - if (jj_3R_96()) return true; - } - } - return false; - } - - final private boolean jj_3R_146() { - if (jj_3R_49()) return true; - return false; - } - - final private boolean jj_3_3() { - if (jj_3R_55()) return true; - return false; - } - - final private boolean jj_3R_104() { - if (jj_scan_token(LBRACE)) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_146()) { - jj_scanpos = xsp; - break; - } - } - if (jj_scan_token(RBRACE)) return true; - return false; - } - - final private boolean jj_3_2() { - if (jj_3R_50()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_51()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_3R_52()) jj_scanpos = xsp; - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_3R_53()) return true; - xsp = jj_scanpos; - if (jj_3R_54()) jj_scanpos = xsp; - if (jj_scan_token(LBRACE)) return true; - return false; - } - - final private boolean jj_3R_89() { - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_scan_token(COLON)) return true; - if (jj_3R_129()) return true; - return false; - } - - final private boolean jj_3_1() { - if (jj_3R_49()) return true; - return false; - } - - final private boolean jj_3R_199() { - if (jj_scan_token(ASSERT)) return true; - if (jj_3R_56()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_235()) jj_scanpos = xsp; - if (jj_scan_token(SEMICOLON)) return true; - return false; - } - - final private boolean jj_3R_177() { - if (jj_3R_212()) return true; - return false; - } - - final private boolean jj_3R_176() { - if (jj_3R_211()) return true; - return false; - } - - final private boolean jj_3_38() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_scan_token(RBRACKET)) return true; - return false; - } - - final private boolean jj_3R_175() { - if (jj_3R_210()) return true; - return false; - } - - final private boolean jj_3R_174() { - if (jj_3R_209()) return true; - return false; - } - - final private boolean jj_3R_173() { - if (jj_3R_208()) return true; - return false; - } - - final private boolean jj_3R_172() { - if (jj_3R_207()) return true; - return false; - } - - final private boolean jj_3R_171() { - if (jj_3R_206()) return true; - return false; - } - - final private boolean jj_3R_170() { - if (jj_3R_205()) return true; - return false; - } - - final private boolean jj_3R_169() { - if (jj_3R_204()) return true; - return false; - } - - final private boolean jj_3R_168() { - if (jj_3R_203()) return true; - return false; - } - - final private boolean jj_3R_167() { - if (jj_3R_202()) return true; - return false; - } - - final private boolean jj_3R_166() { - if (jj_3R_201()) return true; - if (jj_scan_token(SEMICOLON)) return true; - return false; - } - - final private boolean jj_3R_165() { - if (jj_3R_200()) return true; - return false; - } - - final private boolean jj_3R_164() { - if (jj_3R_104()) return true; - return false; - } - - final private boolean jj_3R_163() { - if (jj_3R_199()) return true; - return false; - } - - final private boolean jj_3R_260() { - if (jj_3R_78()) return true; - return false; - } - - final private boolean jj_3_40() { - if (jj_3R_89()) return true; - return false; - } - - final private boolean jj_3R_129() { - Token xsp; - xsp = jj_scanpos; - if (jj_3_40()) { - jj_scanpos = xsp; - if (jj_3R_163()) { - jj_scanpos = xsp; - if (jj_3R_164()) { - jj_scanpos = xsp; - if (jj_3R_165()) { - jj_scanpos = xsp; - if (jj_3R_166()) { - jj_scanpos = xsp; - if (jj_3R_167()) { - jj_scanpos = xsp; - if (jj_3R_168()) { - jj_scanpos = xsp; - if (jj_3R_169()) { - jj_scanpos = xsp; - if (jj_3R_170()) { - jj_scanpos = xsp; - if (jj_3R_171()) { - jj_scanpos = xsp; - if (jj_3R_172()) { - jj_scanpos = xsp; - if (jj_3R_173()) { - jj_scanpos = xsp; - if (jj_3R_174()) { - jj_scanpos = xsp; - if (jj_3R_175()) { - jj_scanpos = xsp; - if (jj_3R_176()) { - jj_scanpos = xsp; - if (jj_3R_177()) - return true; - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - return false; - } - - final private boolean jj_3R_279() { - if (jj_3R_182()) return true; - return false; - } - - final private boolean jj_3R_291() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_scan_token(RBRACKET)) return true; - return false; - } - - final private boolean jj_3R_278() { - Token xsp; - if (jj_3R_291()) return true; - while (true) { - xsp = jj_scanpos; - if (jj_3R_291()) { - jj_scanpos = xsp; - break; - } - } - if (jj_3R_147()) return true; - return false; - } - - final private boolean jj_3_37() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_3R_56()) return true; - if (jj_scan_token(RBRACKET)) return true; - return false; - } - - final private boolean jj_3_39() { - Token xsp; - if (jj_3_37()) return true; - while (true) { - xsp = jj_scanpos; - if (jj_3_37()) { - jj_scanpos = xsp; - break; - } - } - while (true) { - xsp = jj_scanpos; - if (jj_3_38()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_259() { - Token xsp; - xsp = jj_scanpos; - if (jj_3_39()) { - jj_scanpos = xsp; - if (jj_3R_278()) return true; - } - return false; - } - - final private boolean jj_3R_262() { - if (jj_3R_109()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_279()) jj_scanpos = xsp; - return false; - } - - final private boolean jj_3R_232() { - if (jj_scan_token(COMMA)) return true; - if (jj_3R_56()) return true; - return false; - } - - final private boolean jj_3R_261() { - if (jj_3R_259()) return true; - return false; - } - - final private boolean jj_3R_123() { - if (jj_scan_token(NEW)) return true; - if (jj_3R_149()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_260()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_3R_261()) { - jj_scanpos = xsp; - if (jj_3R_262()) return true; - } - return false; - } - - final private boolean jj_3R_87() { - Token xsp; - xsp = jj_scanpos; - if (jj_3_36()) { - jj_scanpos = xsp; - if (jj_3R_123()) return true; - } - return false; - } - - final private boolean jj_3_36() { - if (jj_scan_token(NEW)) return true; - if (jj_3R_83()) return true; - if (jj_3R_259()) return true; - return false; - } - - final private boolean jj_3R_148() { - if (jj_3R_195()) return true; - return false; - } - - final private boolean jj_3R_195() { - if (jj_3R_56()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_232()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_109() { - if (jj_scan_token(LPAREN)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_148()) jj_scanpos = xsp; - if (jj_scan_token(RPAREN)) return true; - return false; - } - - final private boolean jj_3R_258() { - if (jj_scan_token(NULL)) return true; - return false; - } - - final private boolean jj_3R_257() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(56)) { - jj_scanpos = xsp; - if (jj_scan_token(25)) return true; - } - return false; - } - - final private boolean jj_3R_234() { - if (jj_3R_258()) return true; - return false; - } - - final private boolean jj_3R_233() { - if (jj_3R_257()) return true; - return false; - } - - final private boolean jj_3R_196() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(61)) { - jj_scanpos = xsp; - if (jj_scan_token(65)) { - jj_scanpos = xsp; - if (jj_scan_token(70)) { - jj_scanpos = xsp; - if (jj_scan_token(71)) { - jj_scanpos = xsp; - if (jj_3R_233()) { - jj_scanpos = xsp; - if (jj_3R_234()) return true; - } - } - } - } - } - return false; - } - - final private boolean jj_3R_152() { - if (jj_3R_196()) return true; - return false; - } - - final private boolean jj_3R_121() { - if (jj_3R_109()) return true; - return false; - } - - final private boolean jj_3R_120() { - if (jj_scan_token(DOT)) return true; - if (jj_scan_token(IDENTIFIER)) return true; - return false; - } - - final private boolean jj_3_33() { - if (jj_scan_token(DOT)) return true; - if (jj_scan_token(THIS)) return true; - return false; - } - - final private boolean jj_3R_119() { - if (jj_scan_token(LBRACKET)) return true; - if (jj_3R_56()) return true; - if (jj_scan_token(RBRACKET)) return true; - return false; - } - - final private boolean jj_3_32() { - if (jj_scan_token(DOT)) return true; - if (jj_scan_token(SUPER)) return true; - if (jj_scan_token(DOT)) return true; - return false; - } - - final private boolean jj_3_35() { - if (jj_3R_88()) return true; - return false; - } - - final private boolean jj_3_34() { - if (jj_scan_token(DOT)) return true; - if (jj_3R_87()) return true; - return false; - } - - final private boolean jj_3R_118() { - if (jj_scan_token(DOT)) return true; - if (jj_scan_token(THIS)) return true; - return false; - } - - final private boolean jj_3_31() { - if (jj_3R_86()) return true; - if (jj_scan_token(DOT)) return true; - if (jj_scan_token(CLASS)) return true; - return false; - } - - final private boolean jj_3R_117() { - if (jj_scan_token(DOT)) return true; - if (jj_scan_token(SUPER)) return true; - return false; - } - - final private boolean jj_3R_84() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_117()) { - jj_scanpos = xsp; - if (jj_3R_118()) { - jj_scanpos = xsp; - if (jj_3_34()) { - jj_scanpos = xsp; - if (jj_3_35()) { - jj_scanpos = xsp; - if (jj_3R_119()) { - jj_scanpos = xsp; - if (jj_3R_120()) { - jj_scanpos = xsp; - if (jj_3R_121()) return true; - } - } - } - } - } - } - return false; - } - - final private boolean jj_3R_85() { - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_scan_token(DOT)) return true; - return false; - } - - final private boolean jj_3R_159() { - if (jj_3R_91()) return true; - return false; - } - - final private boolean jj_3_30() { - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_85()) { - jj_scanpos = xsp; - break; - } - } - if (jj_scan_token(THIS)) return true; - return false; - } - - final private boolean jj_3R_158() { - if (jj_3R_86()) return true; - if (jj_scan_token(DOT)) return true; - if (jj_scan_token(CLASS)) return true; - return false; - } - - final private boolean jj_3R_157() { - if (jj_3R_87()) return true; - return false; - } - - final private boolean jj_3R_156() { - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_56()) return true; - if (jj_scan_token(RPAREN)) return true; - return false; - } - - final private boolean jj_3_29() { - if (jj_3R_84()) return true; - return false; - } - - final private boolean jj_3R_155() { - if (jj_scan_token(SUPER)) return true; - if (jj_scan_token(DOT)) return true; - if (jj_scan_token(IDENTIFIER)) return true; - return false; - } - - final private boolean jj_3R_197() { - if (jj_scan_token(IDENTIFIER)) return true; - if (jj_scan_token(DOT)) return true; - return false; - } - - final private boolean jj_3R_154() { - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_197()) { - jj_scanpos = xsp; - break; - } - } - if (jj_scan_token(THIS)) return true; - return false; - } - - final private boolean jj_3R_124() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_153()) { - jj_scanpos = xsp; - if (jj_3R_154()) { - jj_scanpos = xsp; - if (jj_3R_155()) { - jj_scanpos = xsp; - if (jj_3R_156()) { - jj_scanpos = xsp; - if (jj_3R_157()) { - jj_scanpos = xsp; - if (jj_3R_158()) { - jj_scanpos = xsp; - if (jj_3R_159()) return true; - } - } - } - } - } - } - return false; - } - - final private boolean jj_3R_153() { - if (jj_3R_196()) return true; - return false; - } - - final private boolean jj_3R_88() { - if (jj_scan_token(DOT)) return true; - if (jj_3R_78()) return true; - if (jj_scan_token(IDENTIFIER)) return true; - return false; - } - - final private boolean jj_3R_280() { - if (jj_3R_293()) return true; - return false; - } - - final private boolean jj_3_28() { - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_83()) return true; - return false; - } - - final private boolean jj_3R_90() { - if (jj_3R_124()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3_29()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_319() { - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_72()) return true; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_313()) return true; - return false; - } - - final private boolean jj_3R_318() { - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_72()) return true; - if (jj_scan_token(RPAREN)) return true; - if (jj_3R_307()) return true; - return false; - } - - final private boolean jj_3R_317() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_318()) { - jj_scanpos = xsp; - if (jj_3R_319()) return true; - } - return false; - } - - final private boolean jj_3R_293() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(97)) { - jj_scanpos = xsp; - if (jj_scan_token(98)) return true; - } - return false; - } - - final private boolean jj_3_27() { - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_72()) return true; - if (jj_scan_token(LBRACKET)) return true; - return false; - } - - final private boolean jj_3R_266() { - if (jj_3R_90()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_280()) jj_scanpos = xsp; - return false; - } - - final private boolean jj_3R_116() { - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_72()) return true; - if (jj_scan_token(RPAREN)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(88)) { - jj_scanpos = xsp; - if (jj_scan_token(87)) { - jj_scanpos = xsp; - if (jj_scan_token(75)) { - jj_scanpos = xsp; - if (jj_scan_token(72)) { - jj_scanpos = xsp; - if (jj_scan_token(52)) { - jj_scanpos = xsp; - if (jj_scan_token(49)) { - jj_scanpos = xsp; - if (jj_scan_token(39)) { - jj_scanpos = xsp; - if (jj_3R_152()) return true; - } - } - } - } - } - } - } - return false; - } - - final private boolean jj_3R_115() { - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_72()) return true; - if (jj_scan_token(LBRACKET)) return true; - if (jj_scan_token(RBRACKET)) return true; - return false; - } - - final private boolean jj_3R_82() { - Token xsp; - xsp = jj_scanpos; - if (jj_3_26()) { - jj_scanpos = xsp; - if (jj_3R_115()) { - jj_scanpos = xsp; - if (jj_3R_116()) return true; - } - } - return false; - } - - final private boolean jj_3_26() { - if (jj_scan_token(LPAREN)) return true; - if (jj_3R_83()) return true; - return false; - } - - final private boolean jj_3_25() { - if (jj_3R_82()) return true; - return false; - } - - final private boolean jj_3_24() { - if (jj_3R_81()) return true; - return false; - } - - final private boolean jj_3R_316() { - if (jj_3R_266()) return true; - return false; - } - - final private boolean jj_3R_315() { - if (jj_3R_317()) return true; - return false; - } - - final private boolean jj_3R_314() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(88)) { - jj_scanpos = xsp; - if (jj_scan_token(87)) return true; - } - if (jj_3R_307()) return true; - return false; - } - - final private boolean jj_3R_313() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_314()) { - jj_scanpos = xsp; - if (jj_3R_315()) { - jj_scanpos = xsp; - if (jj_3R_316()) return true; - } - } - return false; - } - - final private boolean jj_3R_264() { - if (jj_scan_token(DECR)) return true; - if (jj_3R_90()) return true; - return false; - } - - final private boolean jj_3R_306() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(99)) { - jj_scanpos = xsp; - if (jj_scan_token(100)) return true; - } - if (jj_3R_305()) return true; - return false; - } - - final private boolean jj_3R_308() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(101)) { - jj_scanpos = xsp; - if (jj_scan_token(102)) { - jj_scanpos = xsp; - if (jj_scan_token(106)) return true; - } - } - if (jj_3R_307()) return true; - return false; - } - - final private boolean jj_3_23() { - if (jj_3R_80()) return true; - return false; - } - - final private boolean jj_3R_263() { - if (jj_scan_token(INCR)) return true; - if (jj_3R_90()) return true; - return false; - } - - final private boolean jj_3R_312() { - if (jj_3R_313()) return true; - return false; - } - - final private boolean jj_3_22() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(107)) { - jj_scanpos = xsp; - if (jj_3_23()) { - jj_scanpos = xsp; - if (jj_3_24()) return true; - } - } - if (jj_3R_304()) return true; - return false; - } - - final private boolean jj_3R_311() { - if (jj_3R_264()) return true; - return false; - } - - final private boolean jj_3R_310() { - if (jj_3R_263()) return true; - return false; - } - - final private boolean jj_3R_309() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(99)) { - jj_scanpos = xsp; - if (jj_scan_token(100)) return true; - } - if (jj_3R_307()) return true; - return false; - } - - final private boolean jj_3R_307() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_309()) { - jj_scanpos = xsp; - if (jj_3R_310()) { - jj_scanpos = xsp; - if (jj_3R_311()) { - jj_scanpos = xsp; - if (jj_3R_312()) return true; - } - } - } - return false; - } - - final private boolean jj_3R_303() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(86)) { - jj_scanpos = xsp; - if (jj_scan_token(122)) { - jj_scanpos = xsp; - if (jj_scan_token(92)) { - jj_scanpos = xsp; - if (jj_scan_token(93)) return true; - } - } - } - if (jj_3R_302()) return true; - return false; - } - - final private boolean jj_3R_301() { - if (jj_scan_token(INSTANCEOF)) return true; - if (jj_3R_72()) return true; - return false; - } - - final private boolean jj_3R_305() { - if (jj_3R_307()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_308()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_298() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(91)) { - jj_scanpos = xsp; - if (jj_scan_token(94)) return true; - } - if (jj_3R_297()) return true; - return false; - } - - final private boolean jj_3R_304() { - if (jj_3R_305()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_306()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_302() { - if (jj_3R_304()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3_22()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_288() { - if (jj_scan_token(BIT_AND)) return true; - if (jj_3R_287()) return true; - return false; - } - - final private boolean jj_3R_300() { - if (jj_3R_302()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_303()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_254() { - if (jj_scan_token(BIT_OR)) return true; - if (jj_3R_253()) return true; - return false; - } - - final private boolean jj_3R_297() { - if (jj_3R_300()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_301()) jj_scanpos = xsp; - return false; - } - - final private boolean jj_3R_274() { - if (jj_scan_token(XOR)) return true; - if (jj_3R_273()) return true; - return false; - } - - final private boolean jj_3R_230() { - if (jj_scan_token(SC_AND)) return true; - if (jj_3R_229()) return true; - return false; - } - - final private boolean jj_3R_287() { - if (jj_3R_297()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_298()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_190() { - if (jj_scan_token(SC_OR)) return true; - if (jj_3R_189()) return true; - return false; - } - - final private boolean jj_3R_273() { - if (jj_3R_287()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_288()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_142() { - if (jj_scan_token(HOOK)) return true; - if (jj_3R_56()) return true; - if (jj_scan_token(COLON)) return true; - if (jj_3R_56()) return true; - return false; - } - - final private boolean jj_3R_253() { - if (jj_3R_273()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_274()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_229() { - if (jj_3R_253()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_254()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_189() { - if (jj_3R_229()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_230()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_141() { - if (jj_3R_189()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_190()) { - jj_scanpos = xsp; - break; - } - } - return false; - } - - final private boolean jj_3R_101() { - if (jj_3R_141()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_142()) jj_scanpos = xsp; - return false; - } - - final private boolean jj_3R_265() { - if (jj_3R_90()) return true; - if (jj_3R_79()) return true; - if (jj_3R_56()) return true; - return false; - } - - final private boolean jj_3R_79() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(85)) { - jj_scanpos = xsp; - if (jj_scan_token(110)) { - jj_scanpos = xsp; - if (jj_scan_token(111)) { - jj_scanpos = xsp; - if (jj_scan_token(115)) { - jj_scanpos = xsp; - if (jj_scan_token(108)) { - jj_scanpos = xsp; - if (jj_scan_token(109)) { - jj_scanpos = xsp; - if (jj_scan_token(116)) { - jj_scanpos = xsp; - if (jj_scan_token(117)) { - jj_scanpos = xsp; - if (jj_scan_token(118)) { - jj_scanpos = xsp; - if (jj_scan_token(112)) { - jj_scanpos = xsp; - if (jj_scan_token(114)) { - jj_scanpos = xsp; - if (jj_scan_token(113)) - return true; - } - } - } - } - } - } - } - } - } - } - } - return false; - } - - final private boolean jj_3_21() { - if (jj_3R_79()) return true; - if (jj_3R_56()) return true; - return false; - } - - public JavaParserTokenManager token_source; - JavaCharStream jj_input_stream; - public Token token, jj_nt; - private int jj_ntk; - private Token jj_scanpos, jj_lastpos; - private int jj_la; - public boolean lookingAhead = false; - private boolean jj_semLA; - - public JavaParser(java.io.InputStream stream) { - this(stream, null); - } - - public JavaParser(java.io.InputStream stream, String encoding) { - try { - jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); - } catch (java.io.UnsupportedEncodingException e) { - throw new RuntimeException(e); - } - token_source = new JavaParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - } - - public void ReInit(java.io.InputStream stream) { - ReInit(stream, null); - } - - public void ReInit(java.io.InputStream stream, String encoding) { - try { - jj_input_stream.ReInit(stream, encoding, 1, 1); - } catch (java.io.UnsupportedEncodingException e) { - throw new RuntimeException(e); - } - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jjtree.reset(); - } - - public JavaParser(java.io.Reader stream) { - jj_input_stream = new JavaCharStream(stream, 1, 1); - token_source = new JavaParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - } - - public void ReInit(java.io.Reader stream) { - jj_input_stream.ReInit(stream, 1, 1); - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jjtree.reset(); - } - - public JavaParser(JavaParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - } - - public void ReInit(JavaParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jjtree.reset(); - } - - final private Token jj_consume_token(int kind) throws ParseException { - Token oldToken; - if ((oldToken = token).next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - if (token.kind == kind) { - return token; - } - token = oldToken; - throw generateParseException(); - } - - static private final class LookaheadSuccess extends java.lang.Error { - } - - final private LookaheadSuccess jj_ls = new LookaheadSuccess(); - - final private boolean jj_scan_token(int kind) { - if (jj_scanpos == jj_lastpos) { - jj_la--; - if (jj_scanpos.next == null) { - jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); - } else { - jj_lastpos = jj_scanpos = jj_scanpos.next; - } - } else { - jj_scanpos = jj_scanpos.next; - } - if (jj_scanpos.kind != kind) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; - return false; - } - - final public Token getNextToken() { - if (token.next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - return token; - } - - final public Token getToken(int index) { - Token t = lookingAhead ? jj_scanpos : token; - for (int i = 0; i < index; i++) { - if (t.next != null) t = t.next; - else t = t.next = token_source.getNextToken(); - } - return t; - } - - final private int jj_ntk() { - if ((jj_nt = token.next) == null) - return (jj_ntk = (token.next = token_source.getNextToken()).kind); - else - return (jj_ntk = jj_nt.kind); - } - - public ParseException generateParseException() { - Token errortok = token.next; - int line = errortok.beginLine, column = errortok.beginColumn; - String mess = (errortok.kind == 0) ? tokenImage[0] : errortok.image; - return new ParseException("Unable to parse Java code near token: " + mess, line, column); - } - - final public void enable_tracing() { - } - - final public void disable_tracing() { - } - -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParserConstants.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParserConstants.java deleted file mode 100644 index 250800e..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParserConstants.java +++ /dev/null @@ -1,260 +0,0 @@ -/* Generated By:JJTree&JavaCC: Do not edit this line. JavaParserConstants.java */ -package jaxx.compiler.parser.java; - -public interface JavaParserConstants { - - int EOF = 0; - int WHITE_SPACE = 3; - int SINGLE_LINE_COMMENT = 4; - int FORMAL_COMMENT = 5; - int MULTI_LINE_COMMENT = 6; - int ABSTRACT = 8; - int ASSERT = 9; - int BOOLEAN = 10; - int BREAK = 11; - int BYTE = 12; - int CASE = 13; - int CATCH = 14; - int CHAR = 15; - int CLASS = 16; - int CONST = 17; - int CONTINUE = 18; - int _DEFAULT = 19; - int DO = 20; - int DOUBLE = 21; - int ELSE = 22; - int ENUM = 23; - int EXTENDS = 24; - int FALSE = 25; - int FINAL = 26; - int FINALLY = 27; - int FLOAT = 28; - int FOR = 29; - int GOTO = 30; - int IF = 31; - int IMPLEMENTS = 32; - int IMPORT = 33; - int INSTANCEOF = 34; - int INT = 35; - int INTERFACE = 36; - int LONG = 37; - int NATIVE = 38; - int NEW = 39; - int NULL = 40; - int PACKAGE = 41; - int PRIVATE = 42; - int PROTECTED = 43; - int PUBLIC = 44; - int RETURN = 45; - int SHORT = 46; - int STATIC = 47; - int STRICTFP = 48; - int SUPER = 49; - int SWITCH = 50; - int SYNCHRONIZED = 51; - int THIS = 52; - int THROW = 53; - int THROWS = 54; - int TRANSIENT = 55; - int TRUE = 56; - int TRY = 57; - int VOID = 58; - int VOLATILE = 59; - int WHILE = 60; - int INTEGER_LITERAL = 61; - int DECIMAL_LITERAL = 62; - int HEX_LITERAL = 63; - int OCTAL_LITERAL = 64; - int FLOATING_POINT_LITERAL = 65; - int DECIMAL_FLOATING_POINT_LITERAL = 66; - int DECIMAL_EXPONENT = 67; - int HEXADECIMAL_FLOATING_POINT_LITERAL = 68; - int HEXADECIMAL_EXPONENT = 69; - int CHARACTER_LITERAL = 70; - int STRING_LITERAL = 71; - int IDENTIFIER = 72; - int LETTER = 73; - int PART_LETTER = 74; - int LPAREN = 75; - int RPAREN = 76; - int LBRACE = 77; - int RBRACE = 78; - int LBRACKET = 79; - int RBRACKET = 80; - int SEMICOLON = 81; - int COMMA = 82; - int DOT = 83; - int AT = 84; - int ASSIGN = 85; - int LT = 86; - int BANG = 87; - int TILDE = 88; - int HOOK = 89; - int COLON = 90; - int EQ = 91; - int LE = 92; - int GE = 93; - int NE = 94; - int SC_OR = 95; - int SC_AND = 96; - int INCR = 97; - int DECR = 98; - int PLUS = 99; - int MINUS = 100; - int STAR = 101; - int SLASH = 102; - int BIT_AND = 103; - int BIT_OR = 104; - int XOR = 105; - int REM = 106; - int LSHIFT = 107; - int PLUSASSIGN = 108; - int MINUSASSIGN = 109; - int STARASSIGN = 110; - int SLASHASSIGN = 111; - int ANDASSIGN = 112; - int ORASSIGN = 113; - int XORASSIGN = 114; - int REMASSIGN = 115; - int LSHIFTASSIGN = 116; - int RSIGNEDSHIFTASSIGN = 117; - int RUNSIGNEDSHIFTASSIGN = 118; - int ELLIPSIS = 119; - int RUNSIGNEDSHIFT = 120; - int RSIGNEDSHIFT = 121; - int GT = 122; - int STUFF_TO_IGNORE = 124; - - int DEFAULT = 0; - int IN_FORMAL_COMMENT = 1; - int IN_MULTI_LINE_COMMENT = 2; - - String[] tokenImage = { - "<EOF>", - "<token of kind 1>", - "\"/*\"", - "<WHITE_SPACE>", - "<SINGLE_LINE_COMMENT>", - "\"*/\"", - "\"*/\"", - "<token of kind 7>", - "\"abstract\"", - "\"assert\"", - "\"boolean\"", - "\"break\"", - "\"byte\"", - "\"case\"", - "\"catch\"", - "\"char\"", - "\"class\"", - "\"const\"", - "\"continue\"", - "\"default\"", - "\"do\"", - "\"double\"", - "\"else\"", - "\"enum\"", - "\"extends\"", - "\"false\"", - "\"final\"", - "\"finally\"", - "\"float\"", - "\"for\"", - "\"goto\"", - "\"if\"", - "\"implements\"", - "\"import\"", - "\"instanceof\"", - "\"int\"", - "\"interface\"", - "\"long\"", - "\"native\"", - "\"new\"", - "\"null\"", - "\"package\"", - "\"private\"", - "\"protected\"", - "\"public\"", - "\"return\"", - "\"short\"", - "\"static\"", - "\"strictfp\"", - "\"super\"", - "\"switch\"", - "\"synchronized\"", - "\"this\"", - "\"throw\"", - "\"throws\"", - "\"transient\"", - "\"true\"", - "\"try\"", - "\"void\"", - "\"volatile\"", - "\"while\"", - "<INTEGER_LITERAL>", - "<DECIMAL_LITERAL>", - "<HEX_LITERAL>", - "<OCTAL_LITERAL>", - "<FLOATING_POINT_LITERAL>", - "<DECIMAL_FLOATING_POINT_LITERAL>", - "<DECIMAL_EXPONENT>", - "<HEXADECIMAL_FLOATING_POINT_LITERAL>", - "<HEXADECIMAL_EXPONENT>", - "<CHARACTER_LITERAL>", - "<STRING_LITERAL>", - "<IDENTIFIER>", - "<LETTER>", - "<PART_LETTER>", - "\"(\"", - "\")\"", - "\"{\"", - "\"}\"", - "\"[\"", - "\"]\"", - "\";\"", - "\",\"", - "\".\"", - "\"@\"", - "\"=\"", - "\"<\"", - "\"!\"", - "\"~\"", - "\"?\"", - "\":\"", - "\"==\"", - "\"<=\"", - "\">=\"", - "\"!=\"", - "\"||\"", - "\"&&\"", - "\"++\"", - "\"--\"", - "\"+\"", - "\"-\"", - "\"*\"", - "\"/\"", - "\"&\"", - "\"|\"", - "\"^\"", - "\"%\"", - "\"<<\"", - "\"+=\"", - "\"-=\"", - "\"*=\"", - "\"/=\"", - "\"&=\"", - "\"|=\"", - "\"^=\"", - "\"%=\"", - "\"<<=\"", - "\">>=\"", - "\">>>=\"", - "\"...\"", - "\">>>\"", - "\">>\"", - "\">\"", - "\"\\u001a\"", - "<STUFF_TO_IGNORE>", - }; - -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParserTokenManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParserTokenManager.java deleted file mode 100644 index 091b13e..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParserTokenManager.java +++ /dev/null @@ -1,2072 +0,0 @@ -/* Generated By:JJTree&JavaCC: Do not edit this line. JavaParserTokenManager.java */ -package jaxx.compiler.parser.java; - -public class JavaParserTokenManager implements JavaParserConstants { - public java.io.PrintStream debugStream = System.out; - - public void setDebugStream(java.io.PrintStream ds) { - debugStream = ds; - } - - private int jjStopStringLiteralDfa_0(int pos, long active0, long active1) { - switch (pos) { - case 0: - if ((active0 & 0x4L) != 0L || (active1 & 0x804000000000L) != 0L) - return 48; - if ((active1 & 0x80000000080000L) != 0L) - return 5; - if ((active0 & 0x1fffffffffffff00L) != 0L) { - jjmatchedKind = 72; - return 29; - } - return -1; - case 1: - if ((active0 & 0x4L) != 0L) - return 46; - if ((active0 & 0x1fffffff7fcfff00L) != 0L) { - if (jjmatchedPos != 1) { - jjmatchedKind = 72; - jjmatchedPos = 1; - } - return 29; - } - if ((active0 & 0x80300000L) != 0L) - return 29; - return -1; - case 2: - if ((active0 & 0x1dffff675fefff00L) != 0L) { - if (jjmatchedPos != 2) { - jjmatchedKind = 72; - jjmatchedPos = 2; - } - return 29; - } - if ((active0 & 0x200009820000000L) != 0L) - return 29; - return -1; - case 3: - if ((active0 & 0x18effe571f2f4f00L) != 0L) { - jjmatchedKind = 72; - jjmatchedPos = 3; - return 29; - } - if ((active0 & 0x510012040c0b000L) != 0L) - return 29; - return -1; - case 4: - if ((active0 & 0x88dbe57012c0700L) != 0L) { - if (jjmatchedPos != 4) { - jjmatchedKind = 72; - jjmatchedPos = 4; - } - return 29; - } - if ((active0 & 0x106240001e034800L) != 0L) - return 29; - return -1; - case 5: - if ((active0 & 0x8890e15090c0500L) != 0L) { - jjmatchedKind = 72; - jjmatchedPos = 5; - return 29; - } - if ((active0 & 0x44b04200200200L) != 0L) - return 29; - return -1; - case 6: - if ((active0 & 0x889081500040100L) != 0L) { - jjmatchedKind = 72; - jjmatchedPos = 6; - return 29; - } - if ((active0 & 0x60009080400L) != 0L) - return 29; - return -1; - case 7: - if ((active0 & 0x801000000040100L) != 0L) - return 29; - if ((active0 & 0x88081500000000L) != 0L) { - jjmatchedKind = 72; - jjmatchedPos = 7; - return 29; - } - return -1; - case 8: - if ((active0 & 0x8000500000000L) != 0L) { - jjmatchedKind = 72; - jjmatchedPos = 8; - return 29; - } - if ((active0 & 0x80081000000000L) != 0L) - return 29; - return -1; - case 9: - if ((active0 & 0x8000000000000L) != 0L) { - jjmatchedKind = 72; - jjmatchedPos = 9; - return 29; - } - if ((active0 & 0x500000000L) != 0L) - return 29; - return -1; - case 10: - if ((active0 & 0x8000000000000L) != 0L) { - jjmatchedKind = 72; - jjmatchedPos = 10; - return 29; - } - return -1; - default: - return -1; - } - } - - private int jjStartNfa_0(int pos, long active0, long active1) { - return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0, active1), pos + 1); - } - - private int jjStopAtPos(int pos, int kind) { - jjmatchedKind = kind; - jjmatchedPos = pos; - return pos + 1; - } - - private int jjStartNfaWithStates_0(int pos, int kind, int state) { - jjmatchedKind = kind; - jjmatchedPos = pos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return pos + 1; - } - return jjMoveNfa_0(state, pos + 1); - } - - private int jjMoveStringLiteralDfa0_0() { - switch (curChar) { - case 26: - return jjStopAtPos(0, 123); - case 33: - jjmatchedKind = 87; - return jjMoveStringLiteralDfa1_0(0x0L, 0x40000000L); - case 37: - jjmatchedKind = 106; - return jjMoveStringLiteralDfa1_0(0x0L, 0x8000000000000L); - case 38: - jjmatchedKind = 103; - return jjMoveStringLiteralDfa1_0(0x0L, 0x1000100000000L); - case 40: - return jjStopAtPos(0, 75); - case 41: - return jjStopAtPos(0, 76); - case 42: - jjmatchedKind = 101; - return jjMoveStringLiteralDfa1_0(0x0L, 0x400000000000L); - case 43: - jjmatchedKind = 99; - return jjMoveStringLiteralDfa1_0(0x0L, 0x100200000000L); - case 44: - return jjStopAtPos(0, 82); - case 45: - jjmatchedKind = 100; - return jjMoveStringLiteralDfa1_0(0x0L, 0x200400000000L); - case 46: - jjmatchedKind = 83; - return jjMoveStringLiteralDfa1_0(0x0L, 0x80000000000000L); - case 47: - jjmatchedKind = 102; - return jjMoveStringLiteralDfa1_0(0x4L, 0x800000000000L); - case 58: - return jjStopAtPos(0, 90); - case 59: - return jjStopAtPos(0, 81); - case 60: - jjmatchedKind = 86; - return jjMoveStringLiteralDfa1_0(0x0L, 0x10080010000000L); - case 61: - jjmatchedKind = 85; - return jjMoveStringLiteralDfa1_0(0x0L, 0x8000000L); - case 62: - jjmatchedKind = 122; - return jjMoveStringLiteralDfa1_0(0x0L, 0x360000020000000L); - case 63: - return jjStopAtPos(0, 89); - case 64: - return jjStopAtPos(0, 84); - case 91: - return jjStopAtPos(0, 79); - case 93: - return jjStopAtPos(0, 80); - case 94: - jjmatchedKind = 105; - return jjMoveStringLiteralDfa1_0(0x0L, 0x4000000000000L); - case 97: - return jjMoveStringLiteralDfa1_0(0x300L, 0x0L); - case 98: - return jjMoveStringLiteralDfa1_0(0x1c00L, 0x0L); - case 99: - return jjMoveStringLiteralDfa1_0(0x7e000L, 0x0L); - case 100: - return jjMoveStringLiteralDfa1_0(0x380000L, 0x0L); - case 101: - return jjMoveStringLiteralDfa1_0(0x1c00000L, 0x0L); - case 102: - return jjMoveStringLiteralDfa1_0(0x3e000000L, 0x0L); - case 103: - return jjMoveStringLiteralDfa1_0(0x40000000L, 0x0L); - case 105: - return jjMoveStringLiteralDfa1_0(0x1f80000000L, 0x0L); - case 108: - return jjMoveStringLiteralDfa1_0(0x2000000000L, 0x0L); - case 110: - return jjMoveStringLiteralDfa1_0(0x1c000000000L, 0x0L); - case 112: - return jjMoveStringLiteralDfa1_0(0x1e0000000000L, 0x0L); - case 114: - return jjMoveStringLiteralDfa1_0(0x200000000000L, 0x0L); - case 115: - return jjMoveStringLiteralDfa1_0(0xfc00000000000L, 0x0L); - case 116: - return jjMoveStringLiteralDfa1_0(0x3f0000000000000L, 0x0L); - case 118: - return jjMoveStringLiteralDfa1_0(0xc00000000000000L, 0x0L); - case 119: - return jjMoveStringLiteralDfa1_0(0x1000000000000000L, 0x0L); - case 123: - return jjStopAtPos(0, 77); - case 124: - jjmatchedKind = 104; - return jjMoveStringLiteralDfa1_0(0x0L, 0x2000080000000L); - case 125: - return jjStopAtPos(0, 78); - case 126: - return jjStopAtPos(0, 88); - default: - return jjMoveNfa_0(1, 0); - } - } - - private int jjMoveStringLiteralDfa1_0(long active0, long active1) { - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(0, active0, active1); - return 1; - } - switch (curChar) { - case 38: - if ((active1 & 0x100000000L) != 0L) - return jjStopAtPos(1, 96); - break; - case 42: - if ((active0 & 0x4L) != 0L) - return jjStartNfaWithStates_0(1, 2, 46); - break; - case 43: - if ((active1 & 0x200000000L) != 0L) - return jjStopAtPos(1, 97); - break; - case 45: - if ((active1 & 0x400000000L) != 0L) - return jjStopAtPos(1, 98); - break; - case 46: - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x80000000000000L); - case 60: - if ((active1 & 0x80000000000L) != 0L) { - jjmatchedKind = 107; - jjmatchedPos = 1; - } - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x10000000000000L); - case 61: - if ((active1 & 0x8000000L) != 0L) - return jjStopAtPos(1, 91); - else if ((active1 & 0x10000000L) != 0L) - return jjStopAtPos(1, 92); - else if ((active1 & 0x20000000L) != 0L) - return jjStopAtPos(1, 93); - else if ((active1 & 0x40000000L) != 0L) - return jjStopAtPos(1, 94); - else if ((active1 & 0x100000000000L) != 0L) - return jjStopAtPos(1, 108); - else if ((active1 & 0x200000000000L) != 0L) - return jjStopAtPos(1, 109); - else if ((active1 & 0x400000000000L) != 0L) - return jjStopAtPos(1, 110); - else if ((active1 & 0x800000000000L) != 0L) - return jjStopAtPos(1, 111); - else if ((active1 & 0x1000000000000L) != 0L) - return jjStopAtPos(1, 112); - else if ((active1 & 0x2000000000000L) != 0L) - return jjStopAtPos(1, 113); - else if ((active1 & 0x4000000000000L) != 0L) - return jjStopAtPos(1, 114); - else if ((active1 & 0x8000000000000L) != 0L) - return jjStopAtPos(1, 115); - break; - case 62: - if ((active1 & 0x200000000000000L) != 0L) { - jjmatchedKind = 121; - jjmatchedPos = 1; - } - return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x160000000000000L); - case 97: - return jjMoveStringLiteralDfa2_0(active0, 0x24002006000L, active1, 0L); - case 98: - return jjMoveStringLiteralDfa2_0(active0, 0x100L, active1, 0L); - case 101: - return jjMoveStringLiteralDfa2_0(active0, 0x208000080000L, active1, 0L); - case 102: - if ((active0 & 0x80000000L) != 0L) - return jjStartNfaWithStates_0(1, 31, 29); - break; - case 104: - return jjMoveStringLiteralDfa2_0(active0, 0x1070400000008000L, active1, 0L); - case 105: - return jjMoveStringLiteralDfa2_0(active0, 0xc000000L, active1, 0L); - case 108: - return jjMoveStringLiteralDfa2_0(active0, 0x10410000L, active1, 0L); - case 109: - return jjMoveStringLiteralDfa2_0(active0, 0x300000000L, active1, 0L); - case 110: - return jjMoveStringLiteralDfa2_0(active0, 0x1c00800000L, active1, 0L); - case 111: - if ((active0 & 0x100000L) != 0L) { - jjmatchedKind = 20; - jjmatchedPos = 1; - } - return jjMoveStringLiteralDfa2_0(active0, 0xc00002060260400L, active1, 0L); - case 114: - return jjMoveStringLiteralDfa2_0(active0, 0x3800c0000000800L, active1, 0L); - case 115: - return jjMoveStringLiteralDfa2_0(active0, 0x200L, active1, 0L); - case 116: - return jjMoveStringLiteralDfa2_0(active0, 0x1800000000000L, active1, 0L); - case 117: - return jjMoveStringLiteralDfa2_0(active0, 0x2110000000000L, active1, 0L); - case 119: - return jjMoveStringLiteralDfa2_0(active0, 0x4000000000000L, active1, 0L); - case 120: - return jjMoveStringLiteralDfa2_0(active0, 0x1000000L, active1, 0L); - case 121: - return jjMoveStringLiteralDfa2_0(active0, 0x8000000001000L, active1, 0L); - case 124: - if ((active1 & 0x80000000L) != 0L) - return jjStopAtPos(1, 95); - break; - default: - break; - } - return jjStartNfa_0(0, active0, active1); - } - - private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1) { - if (((active0 &= old0) | (active1 &= old1)) == 0L) - return jjStartNfa_0(0, old0, old1); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(1, active0, active1); - return 2; - } - switch (curChar) { - case 46: - if ((active1 & 0x80000000000000L) != 0L) - return jjStopAtPos(2, 119); - break; - case 61: - if ((active1 & 0x10000000000000L) != 0L) - return jjStopAtPos(2, 116); - else if ((active1 & 0x20000000000000L) != 0L) - return jjStopAtPos(2, 117); - break; - case 62: - if ((active1 & 0x100000000000000L) != 0L) { - jjmatchedKind = 120; - jjmatchedPos = 2; - } - return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x40000000000000L); - case 97: - return jjMoveStringLiteralDfa3_0(active0, 0x80800000018000L, active1, 0L); - case 98: - return jjMoveStringLiteralDfa3_0(active0, 0x100000000000L, active1, 0L); - case 99: - return jjMoveStringLiteralDfa3_0(active0, 0x20000000000L, active1, 0L); - case 101: - return jjMoveStringLiteralDfa3_0(active0, 0x800L, active1, 0L); - case 102: - return jjMoveStringLiteralDfa3_0(active0, 0x80000L, active1, 0L); - case 105: - return jjMoveStringLiteralDfa3_0(active0, 0x1414040000000000L, active1, 0L); - case 108: - return jjMoveStringLiteralDfa3_0(active0, 0x800010002000000L, active1, 0L); - case 110: - return jjMoveStringLiteralDfa3_0(active0, 0x800200c060000L, active1, 0L); - case 111: - return jjMoveStringLiteralDfa3_0(active0, 0x480010000400L, active1, 0L); - case 112: - return jjMoveStringLiteralDfa3_0(active0, 0x2000300000000L, active1, 0L); - case 114: - if ((active0 & 0x20000000L) != 0L) - return jjStartNfaWithStates_0(2, 29, 29); - return jjMoveStringLiteralDfa3_0(active0, 0x61000000000000L, active1, 0L); - case 115: - return jjMoveStringLiteralDfa3_0(active0, 0x400402300L, active1, 0L); - case 116: - if ((active0 & 0x800000000L) != 0L) { - jjmatchedKind = 35; - jjmatchedPos = 2; - } - return jjMoveStringLiteralDfa3_0(active0, 0x205041005000L, active1, 0L); - case 117: - return jjMoveStringLiteralDfa3_0(active0, 0x100000000a00000L, active1, 0L); - case 119: - if ((active0 & 0x8000000000L) != 0L) - return jjStartNfaWithStates_0(2, 39, 29); - break; - case 121: - if ((active0 & 0x200000000000000L) != 0L) - return jjStartNfaWithStates_0(2, 57, 29); - break; - default: - break; - } - return jjStartNfa_0(1, active0, active1); - } - - private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1) { - if (((active0 &= old0) | (active1 &= old1)) == 0L) - return jjStartNfa_0(1, old0, old1); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(2, active0, active1); - return 3; - } - switch (curChar) { - case 61: - if ((active1 & 0x40000000000000L) != 0L) - return jjStopAtPos(3, 118); - break; - case 97: - return jjMoveStringLiteralDfa4_0(active0, 0x80000001c080800L, active1, 0L); - case 98: - return jjMoveStringLiteralDfa4_0(active0, 0x200000L, active1, 0L); - case 99: - return jjMoveStringLiteralDfa4_0(active0, 0x8000000004000L, active1, 0L); - case 100: - if ((active0 & 0x400000000000000L) != 0L) - return jjStartNfaWithStates_0(3, 58, 29); - break; - case 101: - if ((active0 & 0x1000L) != 0L) - return jjStartNfaWithStates_0(3, 12, 29); - else if ((active0 & 0x2000L) != 0L) - return jjStartNfaWithStates_0(3, 13, 29); - else if ((active0 & 0x400000L) != 0L) - return jjStartNfaWithStates_0(3, 22, 29); - else if ((active0 & 0x100000000000000L) != 0L) - return jjStartNfaWithStates_0(3, 56, 29); - return jjMoveStringLiteralDfa4_0(active0, 0x2001001000200L, active1, 0L); - case 103: - if ((active0 & 0x2000000000L) != 0L) - return jjStartNfaWithStates_0(3, 37, 29); - break; - case 105: - return jjMoveStringLiteralDfa4_0(active0, 0x1004000000000L, active1, 0L); - case 107: - return jjMoveStringLiteralDfa4_0(active0, 0x20000000000L, active1, 0L); - case 108: - if ((active0 & 0x10000000000L) != 0L) - return jjStartNfaWithStates_0(3, 40, 29); - return jjMoveStringLiteralDfa4_0(active0, 0x1000100100000400L, active1, 0L); - case 109: - if ((active0 & 0x800000L) != 0L) - return jjStartNfaWithStates_0(3, 23, 29); - break; - case 110: - return jjMoveStringLiteralDfa4_0(active0, 0x80000000000000L, active1, 0L); - case 111: - if ((active0 & 0x40000000L) != 0L) - return jjStartNfaWithStates_0(3, 30, 29); - return jjMoveStringLiteralDfa4_0(active0, 0x60000200000000L, active1, 0L); - case 114: - if ((active0 & 0x8000L) != 0L) - return jjStartNfaWithStates_0(3, 15, 29); - return jjMoveStringLiteralDfa4_0(active0, 0x400000000000L, active1, 0L); - case 115: - if ((active0 & 0x10000000000000L) != 0L) - return jjStartNfaWithStates_0(3, 52, 29); - return jjMoveStringLiteralDfa4_0(active0, 0x2030000L, active1, 0L); - case 116: - return jjMoveStringLiteralDfa4_0(active0, 0x4880400040100L, active1, 0L); - case 117: - return jjMoveStringLiteralDfa4_0(active0, 0x200000000000L, active1, 0L); - case 118: - return jjMoveStringLiteralDfa4_0(active0, 0x40000000000L, active1, 0L); - default: - break; - } - return jjStartNfa_0(2, active0, active1); - } - - private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1) { - if (((active0 &= old0) | (active1 &= old1)) == 0L) - return jjStartNfa_0(2, old0, old1); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(3, active0, 0L); - return 4; - } - switch (curChar) { - case 97: - return jjMoveStringLiteralDfa5_0(active0, 0x60400000000L); - case 99: - return jjMoveStringLiteralDfa5_0(active0, 0x5000000000000L); - case 101: - if ((active0 & 0x2000000L) != 0L) - return jjStartNfaWithStates_0(4, 25, 29); - else if ((active0 & 0x1000000000000000L) != 0L) - return jjStartNfaWithStates_0(4, 60, 29); - return jjMoveStringLiteralDfa5_0(active0, 0x80100000400L); - case 104: - if ((active0 & 0x4000L) != 0L) - return jjStartNfaWithStates_0(4, 14, 29); - return jjMoveStringLiteralDfa5_0(active0, 0x8000000000000L); - case 105: - return jjMoveStringLiteralDfa5_0(active0, 0x900000040000L); - case 107: - if ((active0 & 0x800L) != 0L) - return jjStartNfaWithStates_0(4, 11, 29); - break; - case 108: - if ((active0 & 0x4000000L) != 0L) { - jjmatchedKind = 26; - jjmatchedPos = 4; - } - return jjMoveStringLiteralDfa5_0(active0, 0x8200000L); - case 110: - return jjMoveStringLiteralDfa5_0(active0, 0x1000000L); - case 114: - if ((active0 & 0x2000000000000L) != 0L) - return jjStartNfaWithStates_0(4, 49, 29); - return jjMoveStringLiteralDfa5_0(active0, 0x201200000300L); - case 115: - if ((active0 & 0x10000L) != 0L) - return jjStartNfaWithStates_0(4, 16, 29); - return jjMoveStringLiteralDfa5_0(active0, 0x80000000000000L); - case 116: - if ((active0 & 0x20000L) != 0L) - return jjStartNfaWithStates_0(4, 17, 29); - else if ((active0 & 0x10000000L) != 0L) - return jjStartNfaWithStates_0(4, 28, 29); - else if ((active0 & 0x400000000000L) != 0L) - return jjStartNfaWithStates_0(4, 46, 29); - return jjMoveStringLiteralDfa5_0(active0, 0x800000000000000L); - case 117: - return jjMoveStringLiteralDfa5_0(active0, 0x80000L); - case 118: - return jjMoveStringLiteralDfa5_0(active0, 0x4000000000L); - case 119: - if ((active0 & 0x20000000000000L) != 0L) { - jjmatchedKind = 53; - jjmatchedPos = 4; - } - return jjMoveStringLiteralDfa5_0(active0, 0x40000000000000L); - default: - break; - } - return jjStartNfa_0(3, active0, 0L); - } - - private int jjMoveStringLiteralDfa5_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(3, old0, 0L); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(4, active0, 0L); - return 5; - } - switch (curChar) { - case 97: - return jjMoveStringLiteralDfa6_0(active0, 0x500L); - case 99: - if ((active0 & 0x100000000000L) != 0L) - return jjStartNfaWithStates_0(5, 44, 29); - else if ((active0 & 0x800000000000L) != 0L) - return jjStartNfaWithStates_0(5, 47, 29); - return jjMoveStringLiteralDfa6_0(active0, 0x80000000000L); - case 100: - return jjMoveStringLiteralDfa6_0(active0, 0x1000000L); - case 101: - if ((active0 & 0x200000L) != 0L) - return jjStartNfaWithStates_0(5, 21, 29); - else if ((active0 & 0x4000000000L) != 0L) - return jjStartNfaWithStates_0(5, 38, 29); - break; - case 102: - return jjMoveStringLiteralDfa6_0(active0, 0x1000000000L); - case 103: - return jjMoveStringLiteralDfa6_0(active0, 0x20000000000L); - case 104: - if ((active0 & 0x4000000000000L) != 0L) - return jjStartNfaWithStates_0(5, 50, 29); - break; - case 105: - return jjMoveStringLiteralDfa6_0(active0, 0x880000000000000L); - case 108: - return jjMoveStringLiteralDfa6_0(active0, 0x8080000L); - case 109: - return jjMoveStringLiteralDfa6_0(active0, 0x100000000L); - case 110: - if ((active0 & 0x200000000000L) != 0L) - return jjStartNfaWithStates_0(5, 45, 29); - return jjMoveStringLiteralDfa6_0(active0, 0x400040000L); - case 114: - return jjMoveStringLiteralDfa6_0(active0, 0x8000000000000L); - case 115: - if ((active0 & 0x40000000000000L) != 0L) - return jjStartNfaWithStates_0(5, 54, 29); - break; - case 116: - if ((active0 & 0x200L) != 0L) - return jjStartNfaWithStates_0(5, 9, 29); - else if ((active0 & 0x200000000L) != 0L) - return jjStartNfaWithStates_0(5, 33, 29); - return jjMoveStringLiteralDfa6_0(active0, 0x1040000000000L); - default: - break; - } - return jjStartNfa_0(4, active0, 0L); - } - - private int jjMoveStringLiteralDfa6_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(4, old0, 0L); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(5, active0, 0L); - return 6; - } - switch (curChar) { - case 97: - return jjMoveStringLiteralDfa7_0(active0, 0x1000000000L); - case 99: - return jjMoveStringLiteralDfa7_0(active0, 0x400000100L); - case 101: - if ((active0 & 0x20000000000L) != 0L) - return jjStartNfaWithStates_0(6, 41, 29); - else if ((active0 & 0x40000000000L) != 0L) - return jjStartNfaWithStates_0(6, 42, 29); - return jjMoveStringLiteralDfa7_0(active0, 0x80000100000000L); - case 102: - return jjMoveStringLiteralDfa7_0(active0, 0x1000000000000L); - case 108: - return jjMoveStringLiteralDfa7_0(active0, 0x800000000000000L); - case 110: - if ((active0 & 0x400L) != 0L) - return jjStartNfaWithStates_0(6, 10, 29); - break; - case 111: - return jjMoveStringLiteralDfa7_0(active0, 0x8000000000000L); - case 115: - if ((active0 & 0x1000000L) != 0L) - return jjStartNfaWithStates_0(6, 24, 29); - break; - case 116: - if ((active0 & 0x80000L) != 0L) - return jjStartNfaWithStates_0(6, 19, 29); - return jjMoveStringLiteralDfa7_0(active0, 0x80000000000L); - case 117: - return jjMoveStringLiteralDfa7_0(active0, 0x40000L); - case 121: - if ((active0 & 0x8000000L) != 0L) - return jjStartNfaWithStates_0(6, 27, 29); - break; - default: - break; - } - return jjStartNfa_0(5, active0, 0L); - } - - private int jjMoveStringLiteralDfa7_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(5, old0, 0L); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(6, active0, 0L); - return 7; - } - switch (curChar) { - case 99: - return jjMoveStringLiteralDfa8_0(active0, 0x1000000000L); - case 101: - if ((active0 & 0x40000L) != 0L) - return jjStartNfaWithStates_0(7, 18, 29); - else if ((active0 & 0x800000000000000L) != 0L) - return jjStartNfaWithStates_0(7, 59, 29); - return jjMoveStringLiteralDfa8_0(active0, 0x80400000000L); - case 110: - return jjMoveStringLiteralDfa8_0(active0, 0x88000100000000L); - case 112: - if ((active0 & 0x1000000000000L) != 0L) - return jjStartNfaWithStates_0(7, 48, 29); - break; - case 116: - if ((active0 & 0x100L) != 0L) - return jjStartNfaWithStates_0(7, 8, 29); - break; - default: - break; - } - return jjStartNfa_0(6, active0, 0L); - } - - private int jjMoveStringLiteralDfa8_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(6, old0, 0L); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(7, active0, 0L); - return 8; - } - switch (curChar) { - case 100: - if ((active0 & 0x80000000000L) != 0L) - return jjStartNfaWithStates_0(8, 43, 29); - break; - case 101: - if ((active0 & 0x1000000000L) != 0L) - return jjStartNfaWithStates_0(8, 36, 29); - break; - case 105: - return jjMoveStringLiteralDfa9_0(active0, 0x8000000000000L); - case 111: - return jjMoveStringLiteralDfa9_0(active0, 0x400000000L); - case 116: - if ((active0 & 0x80000000000000L) != 0L) - return jjStartNfaWithStates_0(8, 55, 29); - return jjMoveStringLiteralDfa9_0(active0, 0x100000000L); - default: - break; - } - return jjStartNfa_0(7, active0, 0L); - } - - private int jjMoveStringLiteralDfa9_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(7, old0, 0L); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(8, active0, 0L); - return 9; - } - switch (curChar) { - case 102: - if ((active0 & 0x400000000L) != 0L) - return jjStartNfaWithStates_0(9, 34, 29); - break; - case 115: - if ((active0 & 0x100000000L) != 0L) - return jjStartNfaWithStates_0(9, 32, 29); - break; - case 122: - return jjMoveStringLiteralDfa10_0(active0, 0x8000000000000L); - default: - break; - } - return jjStartNfa_0(8, active0, 0L); - } - - private int jjMoveStringLiteralDfa10_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(8, old0, 0L); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(9, active0, 0L); - return 10; - } - switch (curChar) { - case 101: - return jjMoveStringLiteralDfa11_0(active0, 0x8000000000000L); - default: - break; - } - return jjStartNfa_0(9, active0, 0L); - } - - private int jjMoveStringLiteralDfa11_0(long old0, long active0) { - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(9, old0, 0L); - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - jjStopStringLiteralDfa_0(10, active0, 0L); - return 11; - } - switch (curChar) { - case 100: - if ((active0 & 0x8000000000000L) != 0L) - return jjStartNfaWithStates_0(11, 51, 29); - break; - default: - break; - } - return jjStartNfa_0(10, active0, 0L); - } - - private void jjCheckNAdd(int state) { - if (jjrounds[state] != jjround) { - jjstateSet[jjnewStateCnt++] = state; - jjrounds[state] = jjround; - } - } - - private void jjAddStates(int start, int end) { - do { - jjstateSet[jjnewStateCnt++] = jjnextStates[start]; - } while (start++ != end); - } - - private void jjCheckNAddTwoStates(int state1, int state2) { - jjCheckNAdd(state1); - jjCheckNAdd(state2); - } - - private void jjCheckNAddStates(int start, int end) { - do { - jjCheckNAdd(jjnextStates[start]); - } while (start++ != end); - } - - private void jjCheckNAddStates(int start) { - jjCheckNAdd(jjnextStates[start]); - jjCheckNAdd(jjnextStates[start + 1]); - } - - static final long[] jjbitVec0 = { - 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL - }; - static final long[] jjbitVec2 = { - 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL - }; - static final long[] jjbitVec3 = { - 0xfff0000000200002L, 0xffffffffffffdfffL, 0xfffff00f7fffffffL, 0x12000000007fffffL - }; - static final long[] jjbitVec4 = { - 0x0L, 0x0L, 0x420043c00000000L, 0xff7fffffff7fffffL - }; - static final long[] jjbitVec5 = { - 0xffffcffffffffL, 0xffffffffffff0000L, 0xf9ff3fffffffffffL, 0x401f00030003L - }; - static final long[] jjbitVec6 = { - 0x0L, 0x400000000000000L, 0xfffffffbffffd740L, 0xffffffcff7fffL - }; - static final long[] jjbitVec7 = { - 0xffffffffffffffffL, 0xffffffffffffffffL, 0xfffffffffffff003L, 0x33fffffffff199fL - }; - static final long[] jjbitVec8 = { - 0xfffe000000000000L, 0xfffffffe027fffffL, 0xffL, 0x707ffffff0000L - }; - static final long[] jjbitVec9 = { - 0x7fffffe00000000L, 0xfffe0000000007ffL, 0xffffffffffffffffL, 0x1c000060002fffffL - }; - static final long[] jjbitVec10 = { - 0x1ffffffd0000L, 0x0L, 0x3fffffffffL, 0x0L - }; - static final long[] jjbitVec11 = { - 0x23ffffffffffffe0L, 0x3ff010000L, 0x3c5fdfffff99fe0L, 0xf0003b0000000L - }; - static final long[] jjbitVec12 = { - 0x36dfdfffff987e0L, 0x1c00005e000000L, 0x23edfdfffffbafe0L, 0x100010000L - }; - static final long[] jjbitVec13 = { - 0x23cdfdfffff99fe0L, 0x3b0000000L, 0x3bfc718d63dc7e0L, 0x0L - }; - static final long[] jjbitVec14 = { - 0x3effdfffffddfe0L, 0x300000000L, 0x3effdfffffddfe0L, 0x340000000L - }; - static final long[] jjbitVec15 = { - 0x3fffdfffffddfe0L, 0x300000000L, 0x2ffbfffffc7fffe0L, 0x7fL - }; - static final long[] jjbitVec16 = { - 0x800dfffffffffffeL, 0x7fL, 0x200decaefef02596L, 0x3000005fL - }; - static final long[] jjbitVec17 = { - 0x1L, 0x7fffffffeffL, 0xf00L, 0x0L - }; - static final long[] jjbitVec18 = { - 0x6fbffffffffL, 0x3f0000L, 0xffffffff00000000L, 0x7fffffffff003fL - }; - static final long[] jjbitVec19 = { - 0xffffffffffffffffL, 0xffffffff83ffffffL, 0xffffff07ffffffffL, 0x3ffffffffffffffL - }; - static final long[] jjbitVec20 = { - 0xffffffffffffff7fL, 0xffffffff3d7f3d7fL, 0x7f3d7fffffff3d7fL, 0xffff7fffff7f7f3dL - }; - static final long[] jjbitVec21 = { - 0xffffffff7f3d7fffL, 0x7ffff7fL, 0xffffffff00000000L, 0x1fffffffffffffL - }; - static final long[] jjbitVec22 = { - 0xffffffffffffffffL, 0x7f9fffffffffffL, 0xffffffff07fffffeL, 0x7ffffffffffL - }; - static final long[] jjbitVec23 = { - 0x0L, 0x0L, 0xfffffffffffffL, 0x8000000L - }; - static final long[] jjbitVec24 = { - 0xffffffff00000000L, 0xffffffffffffffL, 0x1ffffffffffL, 0x0L - }; - static final long[] jjbitVec25 = { - 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffff0fffffffL, 0x3ffffffffffffffL - }; - static final long[] jjbitVec26 = { - 0xffffffff3f3fffffL, 0x3fffffffaaff3f3fL, 0x5fdfffffffffffffL, 0x1fdc1fff0fcf1fdcL - }; - static final long[] jjbitVec27 = { - 0x8000000000000000L, 0x8000000000000001L, 0xffff00000000L, 0x0L - }; - static final long[] jjbitVec28 = { - 0x3fbbd503e2ffc84L, 0xffffffff00000000L, 0xfL, 0x0L - }; - static final long[] jjbitVec29 = { - 0x73e03fe000000e0L, 0xfffffffffffffffeL, 0xfffffffe601fffffL, 0x7fffffffffffffffL - }; - static final long[] jjbitVec30 = { - 0xfffe1fffffffffe0L, 0xffffffffffffffffL, 0xffffff00007fffL, 0x0L - }; - static final long[] jjbitVec31 = { - 0xffffffffffffffffL, 0xffffffffffffffffL, 0x3fffffffffffffL, 0x0L - }; - static final long[] jjbitVec32 = { - 0xffffffffffffffffL, 0xffffffffffffffffL, 0x3fffffffffL, 0x0L - }; - static final long[] jjbitVec33 = { - 0xffffffffffffffffL, 0xffffffffffffffffL, 0x1fffL, 0x0L - }; - static final long[] jjbitVec34 = { - 0xffffffffffffffffL, 0xffffffffffffffffL, 0xfffffffffL, 0x0L - }; - static final long[] jjbitVec35 = { - 0x3fffffffffffL, 0x0L, 0x0L, 0x0L - }; - static final long[] jjbitVec36 = { - 0x5f7ffdffa0f8007fL, 0xffffffffffffffdbL, 0x3ffffffffffffL, 0xfffffffffff80000L - }; - static final long[] jjbitVec37 = { - 0x3fffffffffffffffL, 0xffffffffffff0000L, 0xfffffffffffcffffL, 0xfff0000000000ffL - }; - static final long[] jjbitVec38 = { - 0x18000000000000L, 0xffd702000000e000L, 0xffffffffffffffffL, 0x1fffffffffffffffL - }; - static final long[] jjbitVec39 = { - 0x87fffffe00000010L, 0xffffffe007fffffeL, 0x7fffffffffffffffL, 0x631cfcfcfcL - }; - static final long[] jjbitVec40 = { - 0x0L, 0x0L, 0x420043cffffffffL, 0xff7fffffff7fffffL - }; - static final long[] jjbitVec41 = { - 0xffffffffffffffffL, 0x400000700007fffL, 0xfffffffbffffd740L, 0xffffffcff7fffL - }; - static final long[] jjbitVec42 = { - 0xffffffffffffffffL, 0xffffffffffffffffL, 0xfffffffffffff07bL, 0x33fffffffff199fL - }; - static final long[] jjbitVec43 = { - 0xfffe000000000000L, 0xfffffffe027fffffL, 0xbbfffffbfffe00ffL, 0x707ffffff0016L - }; - static final long[] jjbitVec44 = { - 0x7fffffe00000000L, 0xffff03ff003fffffL, 0xffffffffffffffffL, 0x1fff3dff9fefffffL - }; - static final long[] jjbitVec45 = { - 0xffff1fffffff8000L, 0x7ffL, 0x1ffffffffffffL, 0x0L - }; - static final long[] jjbitVec46 = { - 0xf3ffffffffffffeeL, 0xffcfff1f3fffL, 0xd3c5fdfffff99feeL, 0xfffcfb080399fL - }; - static final long[] jjbitVec47 = { - 0xd36dfdfffff987e4L, 0x1fffc05e003987L, 0xf3edfdfffffbafeeL, 0xffc100013bbfL - }; - static final long[] jjbitVec48 = { - 0xf3cdfdfffff99feeL, 0xffc3b0c0398fL, 0xc3bfc718d63dc7ecL, 0xff8000803dc7L - }; - static final long[] jjbitVec49 = { - 0xc3effdfffffddfeeL, 0xffc300603ddfL, 0xc3effdfffffddfecL, 0xffc340603ddfL - }; - static final long[] jjbitVec50 = { - 0xc3fffdfffffddfecL, 0xffc300803dcfL, 0x2ffbfffffc7fffecL, 0xc0000ff5f847fL - }; - static final long[] jjbitVec51 = { - 0x87fffffffffffffeL, 0x3ff7fffL, 0x3bffecaefef02596L, 0x33ff3f5fL - }; - static final long[] jjbitVec52 = { - 0xc2a003ff03000001L, 0xfffe07fffffffeffL, 0x1ffffffffeff0fdfL, 0x40L - }; - static final long[] jjbitVec53 = { - 0x3c7f6fbffffffffL, 0x3ff03ffL, 0xffffffff00000000L, 0x7fffffffff003fL - }; - static final long[] jjbitVec54 = { - 0xffffffff7f3d7fffL, 0x3fe0007ffff7fL, 0xffffffff00000000L, 0x1fffffffffffffL - }; - static final long[] jjbitVec55 = { - 0x0L, 0x0L, 0xffffffffffffffffL, 0x3ff080fffffL - }; - static final long[] jjbitVec56 = { - 0xffffffff03ff7800L, 0xffffffffffffffL, 0x3ffffffffffL, 0x0L - }; - static final long[] jjbitVec57 = { - 0x80007c000000f000L, 0x8000fc0000000001L, 0xffff00000000L, 0x21fff0000L - }; - static final long[] jjbitVec58 = { - 0x73efffe000000e0L, 0xfffffffffffffffeL, 0xfffffffe661fffffL, 0x7fffffffffffffffL - }; - static final long[] jjbitVec59 = { - 0x5f7ffdffe0f8007fL, 0xffffffffffffffdbL, 0x3ffffffffffffL, 0xfffffffffff80000L - }; - static final long[] jjbitVec60 = { - 0x18000f00000000L, 0xffd702000000e000L, 0xffffffffffffffffL, 0x9fffffffffffffffL - }; - static final long[] jjbitVec61 = { - 0x87fffffe03ff0010L, 0xffffffe007fffffeL, 0x7fffffffffffffffL, 0xe0000631cfcfcfcL - }; - - private int jjMoveNfa_0(int startState, int curPos) { - int[] nextStates; - int startsAt = 0; - jjnewStateCnt = 71; - int i = 1; - jjstateSet[0] = startState; - int j, kind = 0x7fffffff; - for (; ;) { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) { - long l = 1L << curChar; - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 1: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(0, 6); - else if ((0x100003600L & l) != 0L) { - if (kind > 3) - kind = 3; - jjCheckNAdd(0); - } else if (curChar == 47) - jjAddStates(7, 8); - else if (curChar == 36) { - if (kind > 72) - kind = 72; - jjCheckNAdd(29); - } else if (curChar == 34) - jjCheckNAddStates(9, 11); - else if (curChar == 39) - jjAddStates(12, 13); - else if (curChar == 46) - jjCheckNAdd(5); - if ((0x3fe000000000000L & l) != 0L) { - if (kind > 61) - kind = 61; - jjCheckNAddTwoStates(2, 3); - } else if (curChar == 48) { - if (kind > 61) - kind = 61; - jjCheckNAddStates(14, 18); - } - break; - case 48: - if (curChar == 47) { - if (kind > 4) - kind = 4; - jjCheckNAddStates(19, 21); - } else if (curChar == 42) - jjstateSet[jjnewStateCnt++] = 46; - break; - case 0: - if ((0x100003600L & l) == 0L) - break; - if (kind > 3) - kind = 3; - jjCheckNAdd(0); - break; - case 2: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 61) - kind = 61; - jjCheckNAddTwoStates(2, 3); - break; - case 4: - if (curChar == 46) - jjCheckNAdd(5); - break; - case 5: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 65) - kind = 65; - jjCheckNAddStates(22, 24); - break; - case 7: - if ((0x280000000000L & l) != 0L) - jjCheckNAdd(8); - break; - case 8: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 65) - kind = 65; - jjCheckNAddTwoStates(8, 9); - break; - case 10: - if (curChar == 39) - jjAddStates(12, 13); - break; - case 11: - if ((0xffffff7fffffdbffL & l) != 0L) - jjCheckNAdd(12); - break; - case 12: - if (curChar == 39 && kind > 70) - kind = 70; - break; - case 14: - if ((0x8400000000L & l) != 0L) - jjCheckNAdd(12); - break; - case 15: - if ((0xff000000000000L & l) != 0L) - jjCheckNAddTwoStates(16, 12); - break; - case 16: - if ((0xff000000000000L & l) != 0L) - jjCheckNAdd(12); - break; - case 17: - if ((0xf000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 18; - break; - case 18: - if ((0xff000000000000L & l) != 0L) - jjCheckNAdd(16); - break; - case 19: - if (curChar == 34) - jjCheckNAddStates(9, 11); - break; - case 20: - if ((0xfffffffbffffdbffL & l) != 0L) - jjCheckNAddStates(9, 11); - break; - case 22: - if ((0x8400000000L & l) != 0L) - jjCheckNAddStates(9, 11); - break; - case 23: - if (curChar == 34 && kind > 71) - kind = 71; - break; - case 24: - if ((0xff000000000000L & l) != 0L) - jjCheckNAddStates(25, 28); - break; - case 25: - if ((0xff000000000000L & l) != 0L) - jjCheckNAddStates(9, 11); - break; - case 26: - if ((0xf000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 27; - break; - case 27: - if ((0xff000000000000L & l) != 0L) - jjCheckNAdd(25); - break; - case 28: - if (curChar != 36) - break; - if (kind > 72) - kind = 72; - jjCheckNAdd(29); - break; - case 29: - if ((0x3ff00100fffc1ffL & l) == 0L) - break; - if (kind > 72) - kind = 72; - jjCheckNAdd(29); - break; - case 30: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(0, 6); - break; - case 31: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(29, 31); - break; - case 33: - if ((0x280000000000L & l) != 0L) - jjCheckNAdd(34); - break; - case 34: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(34, 9); - break; - case 35: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(35, 36); - break; - case 37: - if ((0x280000000000L & l) != 0L) - jjCheckNAdd(38); - break; - case 38: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 65) - kind = 65; - jjCheckNAddTwoStates(38, 9); - break; - case 39: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(39, 40); - break; - case 40: - if (curChar != 46) - break; - if (kind > 65) - kind = 65; - jjCheckNAddStates(32, 34); - break; - case 41: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 65) - kind = 65; - jjCheckNAddStates(32, 34); - break; - case 43: - if ((0x280000000000L & l) != 0L) - jjCheckNAdd(44); - break; - case 44: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 65) - kind = 65; - jjCheckNAddTwoStates(44, 9); - break; - case 45: - if (curChar == 47) - jjAddStates(7, 8); - break; - case 46: - if (curChar == 42) - jjstateSet[jjnewStateCnt++] = 47; - break; - case 47: - if ((0xffff7fffffffffffL & l) != 0L && kind > 1) - kind = 1; - break; - case 49: - if (curChar != 47) - break; - if (kind > 4) - kind = 4; - jjCheckNAddStates(19, 21); - break; - case 50: - if ((0xffffffffffffdbffL & l) == 0L) - break; - if (kind > 4) - kind = 4; - jjCheckNAddStates(19, 21); - break; - case 51: - if ((0x2400L & l) != 0L && kind > 4) - kind = 4; - break; - case 52: - if (curChar == 10 && kind > 4) - kind = 4; - break; - case 53: - if (curChar == 13) - jjstateSet[jjnewStateCnt++] = 52; - break; - case 54: - if (curChar != 48) - break; - if (kind > 61) - kind = 61; - jjCheckNAddStates(14, 18); - break; - case 56: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 61) - kind = 61; - jjCheckNAddTwoStates(56, 3); - break; - case 57: - if ((0xff000000000000L & l) == 0L) - break; - if (kind > 61) - kind = 61; - jjCheckNAddTwoStates(57, 3); - break; - case 59: - if ((0x3ff000000000000L & l) != 0L) - jjAddStates(35, 36); - break; - case 60: - if (curChar == 46) - jjCheckNAdd(61); - break; - case 61: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(61, 62); - break; - case 63: - if ((0x280000000000L & l) != 0L) - jjCheckNAdd(64); - break; - case 64: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 65) - kind = 65; - jjCheckNAddTwoStates(64, 9); - break; - case 66: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(37, 39); - break; - case 67: - if (curChar == 46) - jjCheckNAdd(68); - break; - case 69: - if ((0x280000000000L & l) != 0L) - jjCheckNAdd(70); - break; - case 70: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 65) - kind = 65; - jjCheckNAddTwoStates(70, 9); - break; - default: - break; - } - } while (i != startsAt); - } else if (curChar < 128) { - long l = 1L << (curChar & 077); - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 1: - if ((0x7fffffe87fffffeL & l) == 0L) - break; - if (kind > 72) - kind = 72; - jjCheckNAdd(29); - break; - case 3: - if ((0x100000001000L & l) != 0L && kind > 61) - kind = 61; - break; - case 6: - if ((0x2000000020L & l) != 0L) - jjAddStates(40, 41); - break; - case 9: - if ((0x5000000050L & l) != 0L && kind > 65) - kind = 65; - break; - case 11: - if ((0xffffffffefffffffL & l) != 0L) - jjCheckNAdd(12); - break; - case 13: - if (curChar == 92) - jjAddStates(42, 44); - break; - case 14: - if ((0x14404410000000L & l) != 0L) - jjCheckNAdd(12); - break; - case 20: - if ((0xffffffffefffffffL & l) != 0L) - jjCheckNAddStates(9, 11); - break; - case 21: - if (curChar == 92) - jjAddStates(45, 47); - break; - case 22: - if ((0x14404410000000L & l) != 0L) - jjCheckNAddStates(9, 11); - break; - case 29: - if ((0x87fffffe87fffffeL & l) == 0L) - break; - if (kind > 72) - kind = 72; - jjCheckNAdd(29); - break; - case 32: - if ((0x2000000020L & l) != 0L) - jjAddStates(48, 49); - break; - case 36: - if ((0x2000000020L & l) != 0L) - jjAddStates(50, 51); - break; - case 42: - if ((0x2000000020L & l) != 0L) - jjAddStates(52, 53); - break; - case 47: - if (kind > 1) - kind = 1; - break; - case 50: - if (kind > 4) - kind = 4; - jjAddStates(19, 21); - break; - case 55: - if ((0x100000001000000L & l) != 0L) - jjCheckNAdd(56); - break; - case 56: - if ((0x7e0000007eL & l) == 0L) - break; - if (kind > 61) - kind = 61; - jjCheckNAddTwoStates(56, 3); - break; - case 58: - if ((0x100000001000000L & l) != 0L) - jjCheckNAddTwoStates(59, 60); - break; - case 59: - if ((0x7e0000007eL & l) != 0L) - jjCheckNAddTwoStates(59, 60); - break; - case 61: - if ((0x7e0000007eL & l) != 0L) - jjAddStates(54, 55); - break; - case 62: - if ((0x1000000010000L & l) != 0L) - jjAddStates(56, 57); - break; - case 65: - if ((0x100000001000000L & l) != 0L) - jjCheckNAdd(66); - break; - case 66: - if ((0x7e0000007eL & l) != 0L) - jjCheckNAddStates(37, 39); - break; - case 68: - if ((0x1000000010000L & l) != 0L) - jjAddStates(58, 59); - break; - default: - break; - } - } while (i != startsAt); - } else { - int hiByte = (int) (curChar >> 8); - int i1 = hiByte >> 6; - long l1 = 1L << (hiByte & 077); - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 1: - if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) - break; - if (kind > 72) - kind = 72; - jjCheckNAdd(29); - break; - case 11: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - jjstateSet[jjnewStateCnt++] = 12; - break; - case 20: - if (jjCanMove_0(hiByte, i1, i2, l1, l2)) - jjAddStates(9, 11); - break; - case 29: - if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) - break; - if (kind > 72) - kind = 72; - jjCheckNAdd(29); - break; - case 47: - if (jjCanMove_0(hiByte, i1, i2, l1, l2) && kind > 1) - kind = 1; - break; - case 50: - if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) - break; - if (kind > 4) - kind = 4; - jjAddStates(19, 21); - break; - default: - break; - } - } while (i != startsAt); - } - if (kind != 0x7fffffff) { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 71 - (jjnewStateCnt = startsAt))) - return curPos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return curPos; - } - } - } - - private int jjMoveStringLiteralDfa0_2() { - switch (curChar) { - case 42: - return jjMoveStringLiteralDfa1_2(0x40L); - default: - return 1; - } - } - - private int jjMoveStringLiteralDfa1_2(long active0) { - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return 1; - } - switch (curChar) { - case 47: - if ((active0 & 0x40L) != 0L) - return jjStopAtPos(1, 6); - break; - default: - return 2; - } - return 2; - } - - private int jjMoveStringLiteralDfa0_1() { - switch (curChar) { - case 42: - return jjMoveStringLiteralDfa1_1(0x20L); - default: - return 1; - } - } - - private int jjMoveStringLiteralDfa1_1(long active0) { - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return 1; - } - switch (curChar) { - case 47: - if ((active0 & 0x20L) != 0L) - return jjStopAtPos(1, 5); - break; - default: - return 2; - } - return 2; - } - - static final int[] jjnextStates = { - 31, 32, 9, 35, 36, 39, 40, 48, 49, 20, 21, 23, 11, 13, 55, 57, - 3, 58, 65, 50, 51, 53, 5, 6, 9, 20, 21, 25, 23, 31, 32, 9, - 41, 42, 9, 59, 60, 66, 67, 68, 7, 8, 14, 15, 17, 22, 24, 26, - 33, 34, 37, 38, 43, 44, 61, 62, 63, 64, 69, 70, - }; - - private static boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) { - switch (hiByte) { - case 0: - return ((jjbitVec2[i2] & l2) != 0L); - default: - if ((jjbitVec0[i1] & l1) != 0L) - return true; - return false; - } - } - - private static boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2) { - switch (hiByte) { - case 0: - return ((jjbitVec4[i2] & l2) != 0L); - case 2: - return ((jjbitVec5[i2] & l2) != 0L); - case 3: - return ((jjbitVec6[i2] & l2) != 0L); - case 4: - return ((jjbitVec7[i2] & l2) != 0L); - case 5: - return ((jjbitVec8[i2] & l2) != 0L); - case 6: - return ((jjbitVec9[i2] & l2) != 0L); - case 7: - return ((jjbitVec10[i2] & l2) != 0L); - case 9: - return ((jjbitVec11[i2] & l2) != 0L); - case 10: - return ((jjbitVec12[i2] & l2) != 0L); - case 11: - return ((jjbitVec13[i2] & l2) != 0L); - case 12: - return ((jjbitVec14[i2] & l2) != 0L); - case 13: - return ((jjbitVec15[i2] & l2) != 0L); - case 14: - return ((jjbitVec16[i2] & l2) != 0L); - case 15: - return ((jjbitVec17[i2] & l2) != 0L); - case 16: - return ((jjbitVec18[i2] & l2) != 0L); - case 17: - return ((jjbitVec19[i2] & l2) != 0L); - case 18: - return ((jjbitVec20[i2] & l2) != 0L); - case 19: - return ((jjbitVec21[i2] & l2) != 0L); - case 20: - return ((jjbitVec0[i2] & l2) != 0L); - case 22: - return ((jjbitVec22[i2] & l2) != 0L); - case 23: - return ((jjbitVec23[i2] & l2) != 0L); - case 24: - return ((jjbitVec24[i2] & l2) != 0L); - case 30: - return ((jjbitVec25[i2] & l2) != 0L); - case 31: - return ((jjbitVec26[i2] & l2) != 0L); - case 32: - return ((jjbitVec27[i2] & l2) != 0L); - case 33: - return ((jjbitVec28[i2] & l2) != 0L); - case 48: - return ((jjbitVec29[i2] & l2) != 0L); - case 49: - return ((jjbitVec30[i2] & l2) != 0L); - case 77: - return ((jjbitVec31[i2] & l2) != 0L); - case 159: - return ((jjbitVec32[i2] & l2) != 0L); - case 164: - return ((jjbitVec33[i2] & l2) != 0L); - case 215: - return ((jjbitVec34[i2] & l2) != 0L); - case 250: - return ((jjbitVec35[i2] & l2) != 0L); - case 251: - return ((jjbitVec36[i2] & l2) != 0L); - case 253: - return ((jjbitVec37[i2] & l2) != 0L); - case 254: - return ((jjbitVec38[i2] & l2) != 0L); - case 255: - return ((jjbitVec39[i2] & l2) != 0L); - default: - if ((jjbitVec3[i1] & l1) != 0L) - return true; - return false; - } - } - - private static boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2) { - switch (hiByte) { - case 0: - return ((jjbitVec40[i2] & l2) != 0L); - case 2: - return ((jjbitVec5[i2] & l2) != 0L); - case 3: - return ((jjbitVec41[i2] & l2) != 0L); - case 4: - return ((jjbitVec42[i2] & l2) != 0L); - case 5: - return ((jjbitVec43[i2] & l2) != 0L); - case 6: - return ((jjbitVec44[i2] & l2) != 0L); - case 7: - return ((jjbitVec45[i2] & l2) != 0L); - case 9: - return ((jjbitVec46[i2] & l2) != 0L); - case 10: - return ((jjbitVec47[i2] & l2) != 0L); - case 11: - return ((jjbitVec48[i2] & l2) != 0L); - case 12: - return ((jjbitVec49[i2] & l2) != 0L); - case 13: - return ((jjbitVec50[i2] & l2) != 0L); - case 14: - return ((jjbitVec51[i2] & l2) != 0L); - case 15: - return ((jjbitVec52[i2] & l2) != 0L); - case 16: - return ((jjbitVec53[i2] & l2) != 0L); - case 17: - return ((jjbitVec19[i2] & l2) != 0L); - case 18: - return ((jjbitVec20[i2] & l2) != 0L); - case 19: - return ((jjbitVec54[i2] & l2) != 0L); - case 20: - return ((jjbitVec0[i2] & l2) != 0L); - case 22: - return ((jjbitVec22[i2] & l2) != 0L); - case 23: - return ((jjbitVec55[i2] & l2) != 0L); - case 24: - return ((jjbitVec56[i2] & l2) != 0L); - case 30: - return ((jjbitVec25[i2] & l2) != 0L); - case 31: - return ((jjbitVec26[i2] & l2) != 0L); - case 32: - return ((jjbitVec57[i2] & l2) != 0L); - case 33: - return ((jjbitVec28[i2] & l2) != 0L); - case 48: - return ((jjbitVec58[i2] & l2) != 0L); - case 49: - return ((jjbitVec30[i2] & l2) != 0L); - case 77: - return ((jjbitVec31[i2] & l2) != 0L); - case 159: - return ((jjbitVec32[i2] & l2) != 0L); - case 164: - return ((jjbitVec33[i2] & l2) != 0L); - case 215: - return ((jjbitVec34[i2] & l2) != 0L); - case 250: - return ((jjbitVec35[i2] & l2) != 0L); - case 251: - return ((jjbitVec59[i2] & l2) != 0L); - case 253: - return ((jjbitVec37[i2] & l2) != 0L); - case 254: - return ((jjbitVec60[i2] & l2) != 0L); - case 255: - return ((jjbitVec61[i2] & l2) != 0L); - default: - if ((jjbitVec3[i1] & l1) != 0L) - return true; - return false; - } - } - - public static final String[] jjstrLiteralImages = { - "", null, null, null, null, null, null, null, - "\141\142\163\164\162\141\143\164", "\141\163\163\145\162\164", "\142\157\157\154\145\141\156", - "\142\162\145\141\153", "\142\171\164\145", "\143\141\163\145", "\143\141\164\143\150", - "\143\150\141\162", "\143\154\141\163\163", "\143\157\156\163\164", - "\143\157\156\164\151\156\165\145", "\144\145\146\141\165\154\164", "\144\157", "\144\157\165\142\154\145", - "\145\154\163\145", "\145\156\165\155", "\145\170\164\145\156\144\163", "\146\141\154\163\145", - "\146\151\156\141\154", "\146\151\156\141\154\154\171", "\146\154\157\141\164", "\146\157\162", - "\147\157\164\157", "\151\146", "\151\155\160\154\145\155\145\156\164\163", - "\151\155\160\157\162\164", "\151\156\163\164\141\156\143\145\157\146", "\151\156\164", - "\151\156\164\145\162\146\141\143\145", "\154\157\156\147", "\156\141\164\151\166\145", "\156\145\167", - "\156\165\154\154", "\160\141\143\153\141\147\145", "\160\162\151\166\141\164\145", - "\160\162\157\164\145\143\164\145\144", "\160\165\142\154\151\143", "\162\145\164\165\162\156", - "\163\150\157\162\164", "\163\164\141\164\151\143", "\163\164\162\151\143\164\146\160", - "\163\165\160\145\162", "\163\167\151\164\143\150", - "\163\171\156\143\150\162\157\156\151\172\145\144", "\164\150\151\163", "\164\150\162\157\167", "\164\150\162\157\167\163", - "\164\162\141\156\163\151\145\156\164", "\164\162\165\145", "\164\162\171", "\166\157\151\144", - "\166\157\154\141\164\151\154\145", "\167\150\151\154\145", null, null, null, null, null, null, null, null, null, - null, null, null, null, null, "\50", "\51", "\173", "\175", "\133", "\135", "\73", - "\54", "\56", "\100", "\75", "\74", "\41", "\176", "\77", "\72", "\75\75", "\74\75", - "\76\75", "\41\75", "\174\174", "\46\46", "\53\53", "\55\55", "\53", "\55", "\52", - "\57", "\46", "\174", "\136", "\45", "\74\74", "\53\75", "\55\75", "\52\75", - "\57\75", "\46\75", "\174\75", "\136\75", "\45\75", "\74\74\75", "\76\76\75", - "\76\76\76\75", "\56\56\56", "\76\76\76", "\76\76", "\76", "\32", null,}; - public static final String[] lexStateNames = { - "DEFAULT", - "IN_FORMAL_COMMENT", - "IN_MULTI_LINE_COMMENT", - }; - public static final int[] jjnewLexState = { - -1, 1, 2, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - }; - static final long[] jjtoToken = { - 0x3fffffffffffff01L, 0x1ffffffffffff9c2L, - }; - static final long[] jjtoSkip = { - 0x78L, 0x0L, - }; - static final long[] jjtoSpecial = { - 0x78L, 0x0L, - }; - static final long[] jjtoMore = { - 0x86L, 0x0L, - }; - protected JavaCharStream input_stream; - private final int[] jjrounds = new int[71]; - private final int[] jjstateSet = new int[142]; - StringBuffer image; - int jjimageLen; - int lengthOfMatch; - protected char curChar; - - public JavaParserTokenManager(JavaCharStream stream) { - if (JavaCharStream.staticFlag) - throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); - input_stream = stream; - } - - public JavaParserTokenManager(JavaCharStream stream, int lexState) { - this(stream); - SwitchTo(lexState); - } - - public void ReInit(JavaCharStream stream) { - jjmatchedPos = jjnewStateCnt = 0; - curLexState = defaultLexState; - input_stream = stream; - ReInitRounds(); - } - - private void ReInitRounds() { - int i; - jjround = 0x80000001; - for (i = 71; i-- > 0;) - jjrounds[i] = 0x80000000; - } - - public void ReInit(JavaCharStream stream, int lexState) { - ReInit(stream); - SwitchTo(lexState); - } - - public void SwitchTo(int lexState) { - if (lexState >= 3 || lexState < 0) - throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - else - curLexState = lexState; - } - - protected Token jjFillToken() { - Token t = Token.newToken(jjmatchedKind); - t.kind = jjmatchedKind; - String im = jjstrLiteralImages[jjmatchedKind]; - t.image = (im == null) ? input_stream.GetImage() : im; - t.beginLine = input_stream.getBeginLine(); - t.beginColumn = input_stream.getBeginColumn(); - t.endLine = input_stream.getEndLine(); - t.endColumn = input_stream.getEndColumn(); - return t; - } - - int curLexState = 0; - int defaultLexState = 0; - int jjnewStateCnt; - int jjround; - int jjmatchedPos; - int jjmatchedKind; - - public Token getNextToken() { - int kind; - Token specialToken = null; - Token matchedToken; - int curPos = 0; - - EOFLoop: - for (; ;) { - try { - curChar = input_stream.BeginToken(); - } - catch (java.io.IOException e) { - jjmatchedKind = 0; - matchedToken = jjFillToken(); - matchedToken.specialToken = specialToken; - return matchedToken; - } - image = null; - jjimageLen = 0; - - for (; ;) { - switch (curLexState) { - case 0: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_0(); - if (jjmatchedPos == 0 && jjmatchedKind > 124) { - jjmatchedKind = 124; - } - break; - case 1: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_1(); - if (jjmatchedPos == 0 && jjmatchedKind > 7) { - jjmatchedKind = 7; - } - break; - case 2: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_2(); - if (jjmatchedPos == 0 && jjmatchedKind > 7) { - jjmatchedKind = 7; - } - break; - } - if (jjmatchedKind != 0x7fffffff) { - if (jjmatchedPos + 1 < curPos) - input_stream.backup(curPos - jjmatchedPos - 1); - if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { - matchedToken = jjFillToken(); - matchedToken.specialToken = specialToken; - TokenLexicalActions(matchedToken); - if (jjnewLexState[jjmatchedKind] != -1) - curLexState = jjnewLexState[jjmatchedKind]; - return matchedToken; - } else - if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { - if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { - matchedToken = jjFillToken(); - if (specialToken == null) - specialToken = matchedToken; - else { - matchedToken.specialToken = specialToken; - specialToken = (specialToken.next = matchedToken); - } - SkipLexicalActions(matchedToken); - } else - SkipLexicalActions(null); - if (jjnewLexState[jjmatchedKind] != -1) - curLexState = jjnewLexState[jjmatchedKind]; - continue EOFLoop; - } - MoreLexicalActions(); - if (jjnewLexState[jjmatchedKind] != -1) - curLexState = jjnewLexState[jjmatchedKind]; - curPos = 0; - jjmatchedKind = 0x7fffffff; - try { - curChar = input_stream.readChar(); - continue; - } - catch (java.io.IOException e1) { - } - } - int error_line = input_stream.getEndLine(); - int error_column = input_stream.getEndColumn(); - String error_after = null; - boolean EOFSeen = false; - try { - input_stream.readChar(); - input_stream.backup(1); - } - catch (java.io.IOException e1) { - EOFSeen = true; - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - if (curChar == '\n' || curChar == '\r') { - error_line++; - error_column = 0; - } else - error_column++; - } - if (!EOFSeen) { - input_stream.backup(1); - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - } - throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); - } - } - } - - void SkipLexicalActions(Token matchedToken) { - switch (jjmatchedKind) { - default: - break; - } - } - - void MoreLexicalActions() { - jjimageLen += (lengthOfMatch = jjmatchedPos + 1); - switch (jjmatchedKind) { - case 1: - if (image == null) - image = new StringBuffer(); - image.append(input_stream.GetSuffix(jjimageLen)); - jjimageLen = 0; - input_stream.backup(1); - break; - default: - break; - } - } - - void TokenLexicalActions(Token matchedToken) { - switch (jjmatchedKind) { - case 120: - if (image == null) - image = new StringBuffer(); - image.append(jjstrLiteralImages[120]); - matchedToken.kind = GT; - ((Token.GTToken) matchedToken).realKind = RUNSIGNEDSHIFT; - input_stream.backup(2); - matchedToken.image = ">"; - break; - case 121: - if (image == null) - image = new StringBuffer(); - image.append(jjstrLiteralImages[121]); - matchedToken.kind = GT; - ((Token.GTToken) matchedToken).realKind = RSIGNEDSHIFT; - input_stream.backup(1); - matchedToken.image = ">"; - break; - default: - break; - } - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParserTreeConstants.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParserTreeConstants.java deleted file mode 100644 index 662a6bd..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/JavaParserTreeConstants.java +++ /dev/null @@ -1,230 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. ./JavaParserTreeConstants.java */ - -package jaxx.compiler.parser.java; - -public interface JavaParserTreeConstants { - public int JJTLINE = 0; - public int JJTCOMPILATIONUNIT = 1; - public int JJTPACKAGEDECLARATION = 2; - public int JJTIMPORTDECLARATION = 3; - public int JJTMODIFIERS = 4; - public int JJTTYPEDECLARATION = 5; - public int JJTCLASSORINTERFACEDECLARATION = 6; - public int JJTEXTENDSLIST = 7; - public int JJTIMPLEMENTSLIST = 8; - public int JJTENUMDECLARATION = 9; - public int JJTENUMBODY = 10; - public int JJTENUMCONSTANT = 11; - public int JJTTYPEPARAMETERS = 12; - public int JJTTYPEPARAMETER = 13; - public int JJTTYPEBOUND = 14; - public int JJTCLASSORINTERFACEBODY = 15; - public int JJTCLASSORINTERFACEBODYDECLARATION = 16; - public int JJTFIELDDECLARATION = 17; - public int JJTVARIABLEDECLARATOR = 18; - public int JJTVARIABLEDECLARATORID = 19; - public int JJTVARIABLEINITIALIZER = 20; - public int JJTARRAYINITIALIZER = 21; - public int JJTMETHODDECLARATION = 22; - public int JJTMETHODDECLARATOR = 23; - public int JJTFORMALPARAMETERS = 24; - public int JJTFORMALPARAMETER = 25; - public int JJTCONSTRUCTORDECLARATION = 26; - public int JJTEXPLICITCONSTRUCTORINVOCATION = 27; - public int JJTINITIALIZER = 28; - public int JJTTYPE = 29; - public int JJTREFERENCETYPE = 30; - public int JJTCLASSORINTERFACETYPE = 31; - public int JJTTYPEARGUMENTS = 32; - public int JJTTYPEARGUMENT = 33; - public int JJTWILDCARDBOUNDS = 34; - public int JJTPRIMITIVETYPE = 35; - public int JJTRESULTTYPE = 36; - public int JJTNAME = 37; - public int JJTNAMELIST = 38; - public int JJTEXPRESSION = 39; - public int JJTASSIGNMENTOPERATOR = 40; - public int JJTASSIGNMENTEXPRESSION = 41; - public int JJTCONDITIONALEXPRESSION = 42; - public int JJTCONDITIONALOREXPRESSION = 43; - public int JJTCONDITIONALANDEXPRESSION = 44; - public int JJTINCLUSIVEOREXPRESSION = 45; - public int JJTEXCLUSIVEOREXPRESSION = 46; - public int JJTANDEXPRESSION = 47; - public int JJTEQUALITYEXPRESSION = 48; - public int JJTINSTANCEOFEXPRESSION = 49; - public int JJTRELATIONALEXPRESSION = 50; - public int JJTSHIFTEXPRESSION = 51; - public int JJTADDITIVEEXPRESSION = 52; - public int JJTMULTIPLICATIVEEXPRESSION = 53; - public int JJTUNARYEXPRESSION = 54; - public int JJTPREINCREMENTEXPRESSION = 55; - public int JJTPREDECREMENTEXPRESSION = 56; - public int JJTUNARYEXPRESSIONNOTPLUSMINUS = 57; - public int JJTCASTLOOKAHEAD = 58; - public int JJTPOSTFIXEXPRESSION = 59; - public int JJTPOSTFIXOPERATOR = 60; - public int JJTCASTEXPRESSION = 61; - public int JJTPRIMARYEXPRESSION = 62; - public int JJTMEMBERSELECTOR = 63; - public int JJTPRIMARYPREFIX = 64; - public int JJTPRIMARYSUFFIX = 65; - public int JJTLITERAL = 66; - public int JJTBOOLEANLITERAL = 67; - public int JJTNULLLITERAL = 68; - public int JJTARGUMENTS = 69; - public int JJTARGUMENTLIST = 70; - public int JJTALLOCATIONEXPRESSION = 71; - public int JJTARRAYDIMSANDINITS = 72; - public int JJTSTATEMENT = 73; - public int JJTASSERTSTATEMENT = 74; - public int JJTLABELEDSTATEMENT = 75; - public int JJTBLOCK = 76; - public int JJTBLOCKSTATEMENT = 77; - public int JJTLOCALVARIABLEDECLARATION = 78; - public int JJTEMPTYSTATEMENT = 79; - public int JJTSTATEMENTEXPRESSION = 80; - public int JJTSWITCHSTATEMENT = 81; - public int JJTSWITCHLABEL = 82; - public int JJTIFSTATEMENT = 83; - public int JJTWHILESTATEMENT = 84; - public int JJTDOSTATEMENT = 85; - public int JJTFORSTATEMENT = 86; - public int JJTFORINIT = 87; - public int JJTSTATEMENTEXPRESSIONLIST = 88; - public int JJTFORUPDATE = 89; - public int JJTBREAKSTATEMENT = 90; - public int JJTCONTINUESTATEMENT = 91; - public int JJTRETURNSTATEMENT = 92; - public int JJTTHROWSTATEMENT = 93; - public int JJTSYNCHRONIZEDSTATEMENT = 94; - public int JJTTRYSTATEMENT = 95; - public int JJTRUNSIGNEDSHIFT = 96; - public int JJTRSIGNEDSHIFT = 97; - public int JJTANNOTATION = 98; - public int JJTNORMALANNOTATION = 99; - public int JJTMARKERANNOTATION = 100; - public int JJTSINGLEMEMBERANNOTATION = 101; - public int JJTMEMBERVALUEPAIRS = 102; - public int JJTMEMBERVALUEPAIR = 103; - public int JJTMEMBERVALUE = 104; - public int JJTMEMBERVALUEARRAYINITIALIZER = 105; - public int JJTANNOTATIONTYPEDECLARATION = 106; - public int JJTANNOTATIONTYPEBODY = 107; - public int JJTANNOTATIONTYPEMEMBERDECLARATION = 108; - public int JJTDEFAULTVALUE = 109; - - - public String[] jjtNodeName = { - "Line", - "CompilationUnit", - "PackageDeclaration", - "ImportDeclaration", - "Modifiers", - "TypeDeclaration", - "ClassOrInterfaceDeclaration", - "ExtendsList", - "ImplementsList", - "EnumDeclaration", - "EnumBody", - "EnumConstant", - "TypeParameters", - "TypeParameter", - "TypeBound", - "ClassOrInterfaceBody", - "ClassOrInterfaceBodyDeclaration", - "FieldDeclaration", - "VariableDeclarator", - "VariableDeclaratorId", - "VariableInitializer", - "ArrayInitializer", - "MethodDeclaration", - "MethodDeclarator", - "FormalParameters", - "FormalParameter", - "ConstructorDeclaration", - "ExplicitConstructorInvocation", - "Initializer", - "Type", - "ReferenceType", - "ClassOrInterfaceType", - "TypeArguments", - "TypeArgument", - "WildcardBounds", - "PrimitiveType", - "ResultType", - "Name", - "NameList", - "Expression", - "AssignmentOperator", - "AssignmentExpression", - "ConditionalExpression", - "ConditionalOrExpression", - "ConditionalAndExpression", - "InclusiveOrExpression", - "ExclusiveOrExpression", - "AndExpression", - "EqualityExpression", - "InstanceOfExpression", - "RelationalExpression", - "ShiftExpression", - "AdditiveExpression", - "MultiplicativeExpression", - "UnaryExpression", - "PreIncrementExpression", - "PreDecrementExpression", - "UnaryExpressionNotPlusMinus", - "CastLookahead", - "PostfixExpression", - "PostfixOperator", - "CastExpression", - "PrimaryExpression", - "MemberSelector", - "PrimaryPrefix", - "PrimarySuffix", - "Literal", - "BooleanLiteral", - "NullLiteral", - "Arguments", - "ArgumentList", - "AllocationExpression", - "ArrayDimsAndInits", - "Statement", - "AssertStatement", - "LabeledStatement", - "Block", - "BlockStatement", - "LocalVariableDeclaration", - "EmptyStatement", - "StatementExpression", - "SwitchStatement", - "SwitchLabel", - "IfStatement", - "WhileStatement", - "DoStatement", - "ForStatement", - "ForInit", - "StatementExpressionList", - "ForUpdate", - "BreakStatement", - "ContinueStatement", - "ReturnStatement", - "ThrowStatement", - "SynchronizedStatement", - "TryStatement", - "RUNSIGNEDSHIFT", - "RSIGNEDSHIFT", - "Annotation", - "NormalAnnotation", - "MarkerAnnotation", - "SingleMemberAnnotation", - "MemberValuePairs", - "MemberValuePair", - "MemberValue", - "MemberValueArrayInitializer", - "AnnotationTypeDeclaration", - "AnnotationTypeBody", - "AnnotationTypeMemberDeclaration", - "DefaultValue", - }; -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Node.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Node.java deleted file mode 100644 index 38fa56e..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Node.java +++ /dev/null @@ -1,51 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. Node.java */ - -package jaxx.compiler.parser.java; - -/* All AST nodes must implement this interface. It provides basic - machinery for constructing the parent and child relationships - between nodes. */ - -public interface Node { - - /** - * This method is called after the node has been made the current - * node. It indicates that child nodes can now be added to it. - */ - public void jjtOpen(); - - /** - * This method is called after all the child nodes have been - * added. - */ - public void jjtClose(); - - /** - * This pair of methods are used to inform the node of its - * parent. - * - * @param n node - */ - public void jjtSetParent(Node n); - - public Node jjtGetParent(); - - /** - * This method tells the node to add its argument to the node's - * list of children. - * - * @param n node - * @param i index ? - */ - public void jjtAddChild(Node n, int i); - - /** - * @param i index of child - * @return a child node. The children are numbered - * from zero, left to right. - */ - public Node jjtGetChild(int i); - - /** @return the number of children the node has. */ - public int jjtGetNumChildren(); -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/ParseException.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/ParseException.java deleted file mode 100644 index 3ea02a4..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/ParseException.java +++ /dev/null @@ -1,214 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */ -package jaxx.compiler.parser.java; - -/** - * This exception is thrown when parse errors are encountered. - * You can explicitly create objects of this exception type by - * calling the method generateParseException in the generated - * parser. - * <p/> - * You can modify this class to customize your error reporting - * mechanisms so long as you retain the public fields. - */ -public class ParseException extends jaxx.compiler.CompilerException { - int line; - int column; - private static final long serialVersionUID = 6179854408401024700L; - - /** - * This constructor is used by the method "generateParseException" - * in the generated parser. Calling this constructor generates - * a new object of this type with the fields "currentToken", - * "expectedTokenSequences", and "tokenImage" set. The boolean - * flag "specialConstructor" is also set to true to indicate that - * this constructor was used to create this object. - * This constructor calls its super class with the empty string - * to force the "toString" method of parent class "Throwable" to - * print the error message in the form: - * ParseException: <result of getMessage> - * - * @param currentTokenVal ? - * @param expectedTokenSequencesVal ? - * @param tokenImageVal ? - */ - public ParseException(Token currentTokenVal, - int[][] expectedTokenSequencesVal, - String[] tokenImageVal - ) { - super(""); - specialConstructor = true; - currentToken = currentTokenVal; - expectedTokenSequences = expectedTokenSequencesVal; - tokenImage = tokenImageVal; - } - - /** - * The following constructors are for use by you for whatever - * purpose you can think of. Constructing the exception in this - * manner makes the exception behave in the normal way - i.e., as - * documented in the class "Throwable". The fields "errorToken", - * "expectedTokenSequences", and "tokenImage" do not contain - * relevant information. The JavaCC generated code does not use - * these constructors. - */ - - public ParseException() { - super(); - specialConstructor = false; - } - - public ParseException(String message) { - super(message); - specialConstructor = false; - } - - public ParseException(String message, int line, int column) { - super(message); - specialConstructor = false; - this.line = line; - this.column = column; - } - - - /** - * This variable determines which constructor was used to create - * this object and thereby affects the semantics of the - * "getMessage" method (see below). - */ - protected boolean specialConstructor; - - /** - * This is the last token that has been consumed successfully. If - * this object has been created due to a parse error, the token - * followng this token will (therefore) be the first error token. - */ - public Token currentToken; - - /** - * Each entry in this array is an array of integers. Each array - * of integers represents a sequence of tokens (by their ordinal - * values) that is expected at this point of the parse. - */ - public int[][] expectedTokenSequences; - - /** - * This is a reference to the "tokenImage" array of the generated - * parser within which the parse error occurred. This array is - * defined in the generated ...Constants interface. - */ - public String[] tokenImage; - - /** - * This method has the standard behavior when this object has been - * created using the standard constructors. Otherwise, it uses - * "currentToken" and "expectedTokenSequences" to generate a parse - * error message and returns it. If this object has been created - * due to a parse error, and you do not catch it (it gets thrown - * from the parser), then this method is called during the printing - * of the final stack trace, and hence the correct error message - * gets displayed. - */ - public String getMessage() { - if (!specialConstructor) { - return super.getMessage(); - } - StringBuffer expected = new StringBuffer(); - int maxSize = 0; - for (int[] expectedTokenSequence : expectedTokenSequences) { - if (maxSize < expectedTokenSequence.length) { - maxSize = expectedTokenSequence.length; - } - for (int anExpectedTokenSequence : expectedTokenSequence) { - expected.append(tokenImage[anExpectedTokenSequence]).append(" "); - } - if (expectedTokenSequence[expectedTokenSequence.length - 1] != 0) { - expected.append("..."); - } - expected.append(eol).append(" "); - } - String retval = "Encountered \""; - Token tok = currentToken.next; - for (int i = 0; i < maxSize; i++) { - if (i != 0) retval += " "; - if (tok.kind == 0) { - retval += tokenImage[0]; - break; - } - retval += add_escapes(tok.image); - tok = tok.next; - } - retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; - retval += "." + eol; - if (expectedTokenSequences.length == 1) { - retval += "Was expecting:" + eol + " "; - } else { - retval += "Was expecting one of:" + eol + " "; - } - retval += expected.toString(); - return retval; - } - - - public int getLine() { - return line; - } - - public int getColumn() { - return column; - } - - /** The end of line string for this machine. */ - protected String eol = System.getProperty("line.separator", "\n"); - - /** - * Used to convert raw characters to their escaped version - * when these raw version cannot be used as part of an ASCII - * string literal. - * - * @param str text to treate - * @return the escaped version of text - */ - protected String add_escapes(String str) { - StringBuffer retval = new StringBuffer(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) { - case 0: - continue; - case '\b': - retval.append("\\b"); - continue; - case '\t': - retval.append("\\t"); - continue; - case '\n': - retval.append("\\n"); - continue; - case '\f': - retval.append("\\f"); - continue; - case '\r': - retval.append("\\r"); - continue; - case '\"': - retval.append("\\\""); - continue; - case '\'': - retval.append("\\\'"); - continue; - case '\\': - retval.append("\\\\"); - continue; - default: - if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { - String s = "0000" + Integer.toString(ch, 16); - retval.append("\\u").append(s.substring(s.length() - 4, s.length())); - } else { - retval.append(ch); - } - } - } - return retval.toString(); - } - -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/SimpleNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/SimpleNode.java deleted file mode 100644 index 3b4ce20..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/SimpleNode.java +++ /dev/null @@ -1,135 +0,0 @@ -/* Generated By:JJTree: Do not edit this line. SimpleNode.java */ - -package jaxx.compiler.parser.java; - -import jaxx.compiler.reflect.ClassDescriptor; - -public class SimpleNode implements Node { - protected Node parent; - protected Node[] children; - protected int id; - protected JavaParser parser; - public Token firstToken; - public Token lastToken; - private ClassDescriptor javaType; - - - public SimpleNode(int i) { - id = i; - } - - public SimpleNode(JavaParser p, int i) { - this(i); - parser = p; - } - - - public int getId() { - return id; - } - - public void jjtOpen() { - } - - public void jjtClose() { - } - - public void jjtSetParent(Node n) { - parent = n; - } - - public Node jjtGetParent() { - return parent; - } - - public SimpleNode getParent() { - return (SimpleNode) parent; - } - - - public ClassDescriptor getJavaType() { - return javaType; - } - - - public void setJavaType(ClassDescriptor javaType) { - this.javaType = javaType; - } - - public void jjtAddChild(Node n, int i) { - if (children == null) { - children = new Node[i + 1]; - } else if (i >= children.length) { - Node c[] = new Node[i + 1]; - System.arraycopy(children, 0, c, 0, children.length); - children = c; - } - children[i] = n; - } - - public Node jjtGetChild(int i) { - return children[i]; - } - - public SimpleNode getChild(int i) { - return (SimpleNode) children[i]; - } - - public int jjtGetNumChildren() { - return (children == null) ? 0 : children.length; - } - - /* You can override these two methods in subclasses of SimpleNode to -customize the way the node appears when the tree is dumped. If -your output uses more than one line you should override -toString(String), otherwise overriding toString() is probably all -you need to do. */ - - @Override - public String toString() { - return getClass().getName() + "[" + getText() + "]"; - } - - public String toString(String prefix) { - return prefix + toString(); - } - - /* Override this method if you want to customize how the node dumps - out its children. */ - - public void dump(String prefix) { - System.out.println(toString(prefix)); - if (children != null) { - for (Node aChildren : children) { - SimpleNode n = (SimpleNode) aChildren; - if (n != null) { - n.dump(prefix + " "); - } - } - } - } - - private void appendSpecialTokens(StringBuffer s, Token st) { - if (st != null) { - appendSpecialTokens(s, st.specialToken); - s.append(st.image); - } - } - - - /** @return the text of the tokens comprising this node. */ - public String getText() { - StringBuffer text = new StringBuffer(); - Token t = firstToken; - while (t != null) { - appendSpecialTokens(text, t.specialToken); - text.append(t.image); - if (t == lastToken) - break; - t = t.next; - } - - return text.toString(); - } -} - diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Token.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Token.java deleted file mode 100644 index 00b9fdf..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/Token.java +++ /dev/null @@ -1,79 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */ -package jaxx.compiler.parser.java; - -/** Describes the input token stream. */ - -public class Token { - /** - * An integer that describes the kind of this token. This numbering - * system is determined by JavaCCParser, and a table of these numbers is - * stored in the file ...Constants.java. - */ - public int kind; - - /** - * beginLine and beginColumn describe the position of the first character - * of this token; endLine and endColumn describe the position of the - * last character of this token. - */ - public int beginLine, beginColumn, endLine, endColumn; - - /** The string image of the token. */ - public String image; - - /** - * A reference to the next regular (non-special) token from the input - * stream. If this is the last token from the input stream, or if the - * token manager has not read tokens beyond this one, this field is - * set to null. This is true only if this token is also a regular - * token. Otherwise, see below for a description of the contents of - * this field. - */ - public Token next; - - /** - * This field is used to access special tokens that occur prior to this - * token, but after the immediately preceding regular (non-special) token. - * If there are no such special tokens, this field is set to null. - * When there are more than one such special token, this field refers - * to the last of these special tokens, which in turn refers to the next - * previous special token through its specialToken field, and so on - * until the first special token (whose specialToken field is null). - * The next fields of special tokens refer to other special tokens that - * immediately follow it (without an intervening regular token). If there - * is no such token, this field is null. - */ - public Token specialToken; - - /** Returns the image. */ - public String toString() { - return image; - } - - /** - * Returns a new Token object, by default. However, if you want, you - * can create and return subclass objects based on the value of ofKind. - * Simply add the cases to the switch for all those special cases. - * For example, if you have a subclass of Token called IDToken that - * you want to create if ofKind is ID, simlpy add something like : - * <p/> - * case MyParserConstants.ID : return new IDToken(); - * <p/> - * to the following switch statement. Then you can cast matchedToken - * variable to the appropriate type and use it in your lexical actions. - */ - public static final Token newToken(int ofKind) { - switch (ofKind) { - default: - return new Token(); - case JavaParserConstants.RUNSIGNEDSHIFT: - case JavaParserConstants.RSIGNEDSHIFT: - case JavaParserConstants.GT: - return new GTToken(); - } - } - - public static class GTToken extends Token { - int realKind = JavaParserConstants.GT; - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/TokenMgrError.java b/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/TokenMgrError.java deleted file mode 100644 index 6bec3d0..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/parser/java/TokenMgrError.java +++ /dev/null @@ -1,126 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */ -package jaxx.compiler.parser.java; - -public class TokenMgrError extends Error { - /* - * Ordinals for various reasons why an Error of this type can be thrown. - */ - - /** Lexical error occured. */ - static final int LEXICAL_ERROR = 0; - - /** An attempt wass made to create a second instance of a static token manager. */ - static final int STATIC_LEXER_ERROR = 1; - - /** Tried to change to an invalid lexical state. */ - static final int INVALID_LEXICAL_STATE = 2; - - /** Detected (and bailed out of) an infinite loop in the token manager. */ - static final int LOOP_DETECTED = 3; - - /** - * Indicates the reason why the exception is thrown. It will have - * one of the above 4 values. - */ - int errorCode; - private static final long serialVersionUID = -9131500865453532454L; - - /** - * Replaces unprintable characters by their espaced (or unicode escaped) - * equivalents in the given string - * - * @param str text to treate - * @return the treated text - */ - protected static String addEscapes(String str) { - StringBuffer retval = new StringBuffer(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) { - case 0: - continue; - case '\b': - retval.append("\\b"); - continue; - case '\t': - retval.append("\\t"); - continue; - case '\n': - retval.append("\\n"); - continue; - case '\f': - retval.append("\\f"); - continue; - case '\r': - retval.append("\\r"); - continue; - case '\"': - retval.append("\\\""); - continue; - case '\'': - retval.append("\\\'"); - continue; - case '\\': - retval.append("\\\\"); - continue; - default: - if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { - String s = "0000" + Integer.toString(ch, 16); - retval.append("\\u").append(s.substring(s.length() - 4, s.length())); - } else { - retval.append(ch); - } - } - } - return retval.toString(); - } - - /** - * @param EOFSeen : indicates if EOF caused the lexicl error - * @param lexState : lexical state in which this error occured - * @param errorLine : line number when the error occured - * @param errorColumn : column number when the error occured - * @param errorAfter : prefix that was seen before this error occured - * @param curChar : the offending character - * Note: You can customize the lexical error message by modifying this method. - * @return a detailed message for the Error when it is thrown by the - * token manager to indicate a lexical error. - */ - protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { - return ("Lexical error at line " + - errorLine + ", column " + - errorColumn + ". Encountered: " + - (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int) curChar + "), ") + - "after : \"" + addEscapes(errorAfter) + "\""); - } - - /** - * You can also modify the body of this method to customize your error messages. - * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not - * of end-users concern, so you can return something like : - * <p/> - * "Internal Error : Please file a bug report .... " - * <p/> - * from this method for such cases in the release version of your parser. - */ - @Override - public String getMessage() { - return super.getMessage(); - } - - /* - * Constructors of various flavors follow. - */ - - public TokenMgrError() { - } - - public TokenMgrError(String message, int reason) { - super(message); - errorCode = reason; - } - - public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { - this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); - } -} -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 9be82c2570dc176f1b4bdd4ae6923959f32541de Author: Tony Chemit <chemit@codelutin.com> Date: Sun Oct 25 19:49:15 2009 +0000 - Evolution #100: amélioration du design du compilateur - Evolution #99: Améliorer le code généré - amelioration des test dans le plugin --- .../main/java/jaxx/compiler/CompiledObject.java | 19 +- .../{decorators => }/CompiledObjectDecorator.java | 48 +- .../java/jaxx/compiler/CompilerConfiguration.java | 1 - .../src/main/java/jaxx/compiler/DataBinding.java | 2 +- .../src/main/java/jaxx/compiler/DataSource.java | 14 +- .../compiler/DefaultCompilerConfiguration.java | 1 - .../src/main/java/jaxx/compiler/JAXXCompiler.java | 277 +- .../java/jaxx/compiler/JAXXCompilerFinalizer.java | 39 + .../src/main/java/jaxx/compiler/JAXXEngine.java | 530 +- .../src/main/java/jaxx/compiler/JAXXProfile.java | 28 +- .../jaxx/compiler/{ => css}/StylesheetHelper.java | 29 +- .../src/main/java/jaxx/compiler/css/parser/CSS.jj | 587 ++ .../src/main/java/jaxx/compiler/css/parser/CSS.jjt | 256 + .../java/jaxx/compiler/css/parser/CSSParser.java | 799 ++ .../compiler/css/parser/CSSParserConstants.java | 72 + .../compiler/css/parser/CSSParserTokenManager.java | 1152 +++ .../css/parser/CSSParserTreeConstants.java | 40 + .../compiler/css/parser/JJTCSSParserState.java | 123 + .../main/java/jaxx/compiler/css/parser/Node.java | 51 + .../jaxx/compiler/css/parser/ParseException.java | 20 + .../jaxx/compiler/css/parser/SimpleCharStream.java | 398 + .../java/jaxx/compiler/css/parser/SimpleNode.java | 122 + .../main/java/jaxx/compiler/css/parser/Token.java | 76 + .../jaxx/compiler/css/parser/TokenMgrError.java | 126 + .../decorators/BoxedCompiledObjectDecorator.java | 2 +- .../decorators/DefaultCompiledObjectDecorator.java | 83 +- .../HelpRootCompiledObjectDecorator.java | 15 +- .../main/java/jaxx/compiler/java/JavaArgument.java | 56 + .../main/java/jaxx/compiler/java/JavaElement.java | 77 + .../main/java/jaxx/compiler/java/JavaField.java | 154 + .../src/main/java/jaxx/compiler/java/JavaFile.java | 181 + .../java/jaxx/compiler/java/JavaFileGenerator.java | 265 + .../main/java/jaxx/compiler/java/JavaMethod.java | 375 + .../compiler/java/parser/JJTJavaParserState.java | 123 + .../main/java/jaxx/compiler/java/parser/Java1.5.jj | 5125 ++++++++++ .../java/jaxx/compiler/java/parser/Java1.5.jjt | 2150 ++++ .../jaxx/compiler/java/parser/JavaCharStream.java | 530 + .../java/jaxx/compiler/java/parser/JavaParser.java | 10048 +++++++++++++++++++ .../compiler/java/parser/JavaParserConstants.java | 260 + .../java/parser/JavaParserTokenManager.java | 2072 ++++ .../java/parser/JavaParserTreeConstants.java | 230 + .../main/java/jaxx/compiler/java/parser/Node.java | 51 + .../jaxx/compiler/java/parser/ParseException.java | 214 + .../java/jaxx/compiler/java/parser/SimpleNode.java | 135 + .../main/java/jaxx/compiler/java/parser/Token.java | 79 + .../jaxx/compiler/java/parser/TokenMgrError.java | 126 + .../java/jaxx/compiler/reflect/JavaFileParser.java | 8 +- .../compiler/{ => script}/ScriptInitializer.java | 4 +- .../jaxx/compiler/{ => script}/ScriptManager.java | 11 +- .../compiler/tags/DefaultComponentHandler.java | 29 +- .../jaxx/compiler/tags/DefaultObjectHandler.java | 26 +- .../main/java/jaxx/compiler/tags/StyleHandler.java | 8 +- .../main/java/jaxx/compiler/tags/TagManager.java | 6 +- .../tags/validator/BeanValidatorHandler.java | 27 +- .../tags/validator/FieldValidatorHandler.java | 4 +- .../tools/jaxxcapture/handlers/ObjectHandler.java | 6 +- ...rator => jaxx.compiler.CompiledObjectDecorator} | 0 .../services/jaxx.compiler.JAXXCompilerFinalizer | 3 + .../services/jaxx.compiler.generators.Generator | 3 - .../test/java/jaxx/compiler/JavaMethodTest.java | 4 +- .../java/org/nuiton/jaxx/plugin/GenerateMojo.java | 43 +- .../java/org/nuiton/jaxx/plugin/CompilerTest.java | 16 +- .../nuiton/jaxx/plugin/CompilerValidatorTest.java | 18 +- .../org/nuiton/jaxx/plugin/Evolution74Test.java | 17 +- .../java/org/nuiton/jaxx/plugin/JaxxBaseTest.java | 21 + 65 files changed, 26795 insertions(+), 620 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java index 04fd2de..5815db6 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java @@ -4,7 +4,6 @@ */ package jaxx.compiler; -import jaxx.compiler.decorators.CompiledObjectDecorator; import jaxx.compiler.reflect.ClassDescriptor; import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.compiler.reflect.MethodDescriptor; @@ -409,8 +408,10 @@ public class CompiledObject { * @see #getInitializationCode */ public void appendInitializationCode(String code) { - this.initializationCode.append(code); - this.initializationCode.append(JAXXCompiler.getLineSeparator()); + if (!code.isEmpty()) { + this.initializationCode.append(code); + this.initializationCode.append(JAXXCompiler.getLineSeparator()); + } } /** @@ -420,8 +421,10 @@ public class CompiledObject { * @see #getAdditionCode */ public void appendAdditionCode(String code) { - this.additionCode.append(code); - this.additionCode.append(JAXXCompiler.getLineSeparator()); + if (!code.isEmpty()) { + this.additionCode.append(code); + this.additionCode.append(JAXXCompiler.getLineSeparator()); + } } /** @@ -553,9 +556,9 @@ public class CompiledObject { return getObjectClass().getName() + "[id='" + id + "']"; } - public void registerDataBinding(String src, String property, String assignment, JAXXCompiler compiler) throws CompilerException { - compiler.registerDataBinding(src, getId() + "." + property, assignment); - } +// public void registerDataBinding(String src, String property, String assignment, JAXXCompiler compiler) throws CompilerException { +// compiler.registerDataBinding(src, getId() + "." + property, assignment); +// } public String getGenericTypes() { if (getGenericTypesLength() == 0) { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObjectDecorator.java similarity index 50% rename from jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecorator.java rename to jaxx-compiler/src/main/java/jaxx/compiler/CompiledObjectDecorator.java index a5b36ca..5d4ae7f 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/CompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObjectDecorator.java @@ -1,9 +1,6 @@ -package jaxx.compiler.decorators; +package jaxx.compiler; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.CompilerException; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.io.JavaFile; +import jaxx.compiler.java.JavaFile; /** * @@ -16,13 +13,52 @@ import jaxx.compiler.io.JavaFile; */ public interface CompiledObjectDecorator { + /** + * + * @return the name of the decorator (match the content of a decorator + * attribute value in a JAXX file) + */ String getName(); - + + /** + * + * @param compiler + * @param object + * @param javaFile + * @param initDataBindings + * @return + */ String createCompleteSetupMethod(JAXXCompiler compiler, CompiledObject object, JavaFile javaFile, StringBuffer initDataBindings); + /** + * + * @param compiler + * @param root + * @param object + * @param code + * @param lastWasMethodCall + * @return + */ boolean createInitializer(JAXXCompiler compiler, CompiledObject root, CompiledObject object, StringBuffer code, boolean lastWasMethodCall); + /** + * + * @param compiler + * @param root + * @param object + * @param javaFile + * @param packageName + * @param className + * @param fullClassName + */ void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName); + /** + * + * @param compiler + * @param object + * @return + * @throws CompilerException + */ String getCreationCode(JAXXCompiler compiler, CompiledObject object) throws CompilerException; } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java index e9cb408..64b7542 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java @@ -1,7 +1,6 @@ package jaxx.compiler; import java.io.File; -import jaxx.compiler.decorators.CompiledObjectDecorator; import jaxx.runtime.JAXXContext; /** diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java b/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java index 4de7fef..97c59e7 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java @@ -62,7 +62,7 @@ public class DataBinding { } return false; // no dependencies, just a static expression } - if (compiler.haveProcessDataBinding()) { + if (compiler.hasProcessDataBinding()) { compiler.appendProcessDataBinding(" else "); } else { compiler.appendProcessDataBinding(" "); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java b/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java index fab9b08..121906a 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java @@ -4,11 +4,11 @@ */ package jaxx.compiler; -import jaxx.compiler.io.JavaField; -import jaxx.compiler.parser.java.JavaParser; -import jaxx.compiler.parser.java.JavaParserConstants; -import jaxx.compiler.parser.java.JavaParserTreeConstants; -import jaxx.compiler.parser.java.SimpleNode; +import jaxx.compiler.java.JavaField; +import jaxx.compiler.java.parser.JavaParser; +import jaxx.compiler.java.parser.JavaParserConstants; +import jaxx.compiler.java.parser.JavaParserTreeConstants; +import jaxx.compiler.java.parser.SimpleNode; import jaxx.compiler.reflect.ClassDescriptor; import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.compiler.reflect.FieldDescriptor; @@ -416,7 +416,7 @@ public class DataSource { String javaCodeId = TypeManager.getJavaCode(id); String eol = JAXXCompiler.getLineSeparator(); if (addListenerCode.length() > 0) { - if (compiler.haveApplyDataBinding()) { + if (compiler.hasApplyDataBinding()) { compiler.appendApplyDataBinding(" else "); } compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol); @@ -430,7 +430,7 @@ public class DataSource { } if (removeListenerCode.length() > 0) { - if (compiler.haveRemoveDataBinding()) { + if (compiler.hasRemoveDataBinding()) { compiler.appendRemoveDataBinding(" else "); } compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java b/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java index 64f9c60..2010df9 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java @@ -1,6 +1,5 @@ package jaxx.compiler; -import jaxx.compiler.decorators.CompiledObjectDecorator; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java index d704851..f76b44a 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java @@ -4,12 +4,12 @@ */ package jaxx.compiler; -import jaxx.compiler.io.JavaMethod; -import jaxx.compiler.io.JavaField; -import jaxx.compiler.io.JavaFile; -import jaxx.compiler.decorators.CompiledObjectDecorator; -import jaxx.compiler.generators.Generator; -import jaxx.compiler.parser.java.ParseException; +import jaxx.compiler.css.StylesheetHelper; +import jaxx.compiler.script.ScriptManager; +import jaxx.compiler.java.JavaMethod; +import jaxx.compiler.java.JavaField; +import jaxx.compiler.java.JavaFile; +import jaxx.compiler.java.parser.ParseException; import jaxx.compiler.reflect.ClassDescriptor; import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.compiler.reflect.FieldDescriptor; @@ -65,12 +65,13 @@ import java.util.Set; import java.util.Stack; import java.util.regex.Matcher; import java.util.regex.Pattern; +import jaxx.compiler.java.JavaFileGenerator; import jaxx.compiler.types.TypeManager; /** * Compiles JAXX files into Java classes. * <p/> - * use {@link Generator} ... todo finish javadoc + * use {@link JAXXCompilerFinalizer} ... todo finish javadoc */ public class JAXXCompiler { @@ -82,7 +83,7 @@ public class JAXXCompiler { * True to throw exceptions when we encounter unresolvable classes, false to ignore. * This is currently set to false until JAXX has full support for inner classes * (including enumerations), because currently they don't always resolve (but will - * generally compile without error anyway). + * generally run without error anyway). */ public static final boolean STRICT_CHECKS = false; /** @@ -101,14 +102,10 @@ public class JAXXCompiler { * The unique object handler used in first pass */ protected final DefaultObjectHandler firstPassClassTagHandler; -// /** -// * list of static imports -// */ -// protected List<String> staticImports = new ArrayList<String>(); - - /*---------------------------------------------------------------------------------*/ - /*-- compiler fields --------------------------------------------------------------*/ - /*---------------------------------------------------------------------------------*/ + + /*------------------------------------------------------------------------*/ + /*-- compiler fields -----------------------------------------------------*/ + /*------------------------------------------------------------------------*/ /** * flag to detec if an error occurs while compiling jaxx file */ @@ -147,7 +144,7 @@ public class JAXXCompiler { */ protected File baseDir; /** - * .jaxx file being compiled. + * jaxx file being compiled. */ protected File src; /** @@ -234,23 +231,23 @@ public class JAXXCompiler { * Code to initialize data bindings. */ protected StringBuffer initDataBindings = new StringBuffer(); - /** + /** * Body of the applyDataBinding method. */ protected StringBuffer applyDataBinding = new StringBuffer(); - /** + /** * Body of the removeDataBinding method. */ protected StringBuffer removeDataBinding = new StringBuffer(); - /** + /** * Body of the processDataBinding method. */ protected StringBuffer processDataBinding = new StringBuffer(); - /** + /** * true if a main() method has been declared in a script */ protected boolean mainDeclared; - /** + /** * the file to be generated */ protected JavaFile javaFile; @@ -258,19 +255,19 @@ public class JAXXCompiler { * configuration of the compiler */ protected CompilerConfiguration configuration; - /** + /** * Used for error reporting purposes, so we can report the right line number. */ protected Stack<Element> tagsBeingCompiled = new Stack<Element>(); - /** + /** * Used for error reporting purposes, so we can report the right source file. */ protected Stack<File> sourceFiles = new Stack<File>(); - /** + /** * Maps object ID strings to the objects themselves. These are created during the second compilation pass. */ protected Map<String, CompiledObject> objects = new LinkedHashMap<String, CompiledObject>(); - /** + /** * Maps objects to their ID strings. These are created during the second compilation pass. */ protected Map<CompiledObject, String> ids = new LinkedHashMap<CompiledObject, String>(); @@ -283,39 +280,12 @@ public class JAXXCompiler { */ protected final JAXXEngine engine; - /*---------------------------------------------------------------------------------*/ - /*-- Constructor methods ----------------------------------------------------------*/ - /*---------------------------------------------------------------------------------*/ -// protected JAXXCompiler(ClassLoader classLoader) { -// -// this.firstPassClassTagHandler = new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(Object.class)); -// this.configuration = new DefaultCompilerConfiguration(); -// this.classLoader = classLoader; -//// this.staticImports = Arrays.asList(new String[]{ -//// "java.awt.*", -//// "java.awt.event.*", -//// "java.beans.*", -//// "java.io.*", -//// "java.lang.*", -//// "java.util.*", -//// "javax.swing.*", -//// "javax.swing.border.*", -//// "javax.swing.event.*", -//// "jaxx.runtime.swing.JAXXButtonGroup", -//// "jaxx.runtime.swing.HBox", -//// "jaxx.runtime.swing.VBox", -//// "jaxx.runtime.swing.Table", -//// "static org.nuiton.i18n.I18n._", -//// "static jaxx.runtime.Util.createImageIcon" -//// }); -// addImport("java.lang.*"); -// } /** * Creates a new JAXXCompiler. * * @param engine engine which use the compiler (could be null if not attach to any engine) * @param baseDir classpath location - * @param src location of file to compile + * @param src location of file to run * @param outputClassName the out file name * @param configuration configuration to pass to javac * @param defaultImports list of default imports to add to java files @@ -325,23 +295,6 @@ public class JAXXCompiler { this.baseDir = baseDir; this.src = src; this.firstPassClassTagHandler = new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(Object.class)); -// this.staticImports = Arrays.asList(new String[]{ -// "java.awt.*", -// "java.awt.event.*", -// "java.beans.*", -// "java.io.*", -// "java.lang.*", -// "java.util.*", -// "javax.swing.*", -// "javax.swing.border.*", -// "javax.swing.event.*", -// "jaxx.runtime.swing.JAXXButtonGroup", -// "jaxx.runtime.swing.HBox", -// "jaxx.runtime.swing.VBox", -// "jaxx.runtime.swing.Table", -// "static org.nuiton.i18n.I18n._", -// "static jaxx.runtime.Util.createImageIcon" -// }); sourceFiles.push(src); this.outputClassName = outputClassName; this.configuration = configuration; @@ -368,9 +321,9 @@ public class JAXXCompiler { } } - /*---------------------------------------------------------------------------------*/ - /*-- Initializer methods -----------------------------------------------------------*/ - /*---------------------------------------------------------------------------------*/ + /*------------------------------------------------------------------------*/ + /*-- Initializer methods -------------------------------------------------*/ + /*------------------------------------------------------------------------*/ public void runInitializers() { for (Runnable runnable : initializers) { if (log.isDebugEnabled()) { @@ -397,9 +350,9 @@ public class JAXXCompiler { initializers.add(r); } - /*---------------------------------------------------------------------------------*/ - /*-- Compile methods --------------------------------------------------------------*/ - /*---------------------------------------------------------------------------------*/ + /*------------------------------------------------------------------------*/ + /*-- Compile methods -----------------------------------------------------*/ + /*------------------------------------------------------------------------*/ public void compileFirstPass(final Element tag) throws IOException { tagsBeingCompiled.push(tag); @@ -505,7 +458,6 @@ public class JAXXCompiler { if (finished != tag) { throw new RuntimeException("internal error: just finished compiling " + tag + ", but top of tagsBeingCompiled stack is " + finished); } - } protected void compileFirstPass() throws IOException { @@ -528,9 +480,9 @@ public class JAXXCompiler { compileSecondPass(document.getDocumentElement()); } - /*---------------------------------------------------------------------------------*/ - /*-- CompiledObject methods -------------------------------------------------------*/ - /*---------------------------------------------------------------------------------*/ + /*------------------------------------------------------------------------*/ + /*-- CompiledObject methods ----------------------------------------------*/ + /*------------------------------------------------------------------------*/ public void openComponent(CompiledObject component) throws CompilerException { openComponent(component, null); } @@ -579,7 +531,7 @@ public class JAXXCompiler { objects.put(id, object); ids.put(object, id); if (object.getDecorator() == null) { - // use compiler decorator + // use default decorator object.setDecorator(defaultDecorator); } } @@ -627,9 +579,9 @@ public class JAXXCompiler { return result; } - /*---------------------------------------------------------------------------------*/ - /*-- DataBinding methods ----------------------------------------------------------*/ - /*---------------------------------------------------------------------------------*/ + /*------------------------------------------------------------------------*/ + /*-- DataBinding methods -------------------------------------------------*/ + /*------------------------------------------------------------------------*/ /** * Examine an attribute value for data binding expressions. Returns a 'cooked' expression which * can be used to determine the resulting value. It is expected that this expression will be used @@ -692,6 +644,9 @@ public class JAXXCompiler { public void registerDataBinding(String src, String dest, String assignment) { try { src = checkJavaCode(src); +// if (log.isDebugEnabled()) { +// log.info(getRootObject().getId() + " src=" + src + ", dst=" + dest.trim()); +// } dataBindings.add(new DataBinding(src, dest, assignment, this)); } catch (CompilerException e) { reportError("While parsing data binding for '" + dest.substring(dest.lastIndexOf(".") + 1) + "': " + e.getMessage()); @@ -732,9 +687,9 @@ public class JAXXCompiler { return result; } - /*---------------------------------------------------------------------------------*/ - /*-- Script methods ---------------------------------------------------------------*/ - /*---------------------------------------------------------------------------------*/ + /*------------------------------------------------------------------------*/ + /*-- Script methods ------------------------------------------------------*/ + /*------------------------------------------------------------------------*/ public void addScriptField(FieldDescriptor field) { symbolTable.getScriptFields().add(field); } @@ -772,9 +727,9 @@ public class JAXXCompiler { return scriptManager.preprocessScript(script); } - /*---------------------------------------------------------------------------------*/ - /*-- StyleSheet methods -----------------------------------------------------------*/ - /*---------------------------------------------------------------------------------*/ + /*------------------------------------------------------------------------*/ + /*-- StyleSheet methods --------------------------------------------------*/ + /*------------------------------------------------------------------------*/ public void applyStylesheets() { for (Object o : new ArrayList<CompiledObject>(objects.values())) { CompiledObject object = (CompiledObject) o; @@ -794,9 +749,9 @@ public class JAXXCompiler { inlineStyles.add(StylesheetHelper.inlineAttribute(object, propertyName, dataBinding)); } - /*---------------------------------------------------------------------------------*/ - /*-- Report methods ---------------------------------------------------------------*/ - /*---------------------------------------------------------------------------------*/ + /*------------------------------------------------------------------------*/ + /*-- Report methods ------------------------------------------------------*/ + /*------------------------------------------------------------------------*/ public void reportWarning(String warning) { Element currentTag = null; if (!tagsBeingCompiled.isEmpty()) { @@ -819,16 +774,21 @@ public class JAXXCompiler { } catch (IOException e) { // ignore ? } - - System.err.print(srcFile); + StringBuilder buffer = new StringBuilder(); + buffer.append(srcFile); +// System.err.print(srcFile); if (lineNumber != null) { - System.err.print(":" + ((sourceFiles.size() == 1) ? Integer.parseInt(lineNumber) + lineOffset : lineOffset + 1)); + buffer.append(":" + ((sourceFiles.size() == 1) ? Integer.parseInt(lineNumber) + lineOffset : lineOffset + 1)); +// System.err.print(":" + ((sourceFiles.size() == 1) ? Integer.parseInt(lineNumber) + lineOffset : lineOffset + 1)); } - System.err.println(": Warning: " + warning); + buffer.append(getLineSeparator()).append(warning.trim()); +// System.err.println(": Warning: " + warning); if (engine != null) { - engine.warningCount++; + engine.addWarning(buffer.toString()); +// engine.warningCount++; + } else { + System.err.println(buffer.toString()); } -// JAXXEngine.get().warningCount++; } public void reportError(String error) { @@ -886,22 +846,27 @@ public class JAXXCompiler { } catch (IOException e) { // ignore ? } - - System.err.print(errorFile != null ? errorFile.getPath() : "<unknown source>"); + StringBuilder buffer = new StringBuilder(); + buffer.append(errorFile != null ? errorFile.getPath() : "<unknown source>"); +// System.err.print(errorFile != null ? errorFile.getPath() : "<unknown source>"); if (lineNumber > 0) { - System.err.print(":" + lineNumber); + buffer.append(":" + lineNumber); +// System.err.print(":" + lineNumber); } - System.err.println(": " + error); + buffer.append(getLineSeparator()).append(": " + error); +// System.err.println(": " + error); if (engine != null) { - engine.errorCount++; + engine.addError(buffer.toString()); +// engine.errorCount++; + } else { + System.err.println(buffer.toString()); } -// JAXXEngine.get().errorCount++; failed = true; } - /*---------------------------------------------------------------------------------*/ - /*-- Getter methods ---------------------------------------------------------------*/ - /*---------------------------------------------------------------------------------*/ + /*------------------------------------------------------------------------*/ + /*-- Getter methods ------------------------------------------------------*/ + /*------------------------------------------------------------------------*/ public Map<String, CompiledObject> getObjects() { return objects; } @@ -910,9 +875,6 @@ public class JAXXCompiler { return dataBindings; } - /*public List<CompiledBeanValidator> getValidators() { - return validators; - }*/ public Map<String, Map<ClassDescriptor, List<EventHandler>>> getEventHandlers() { return eventHandlers; } @@ -1055,16 +1017,16 @@ public class JAXXCompiler { return new JAXXObjectDescriptor(descriptors, css); } - /*---------------------------------------------------------------------------------*/ - /*-- Setter methods ---------------------------------------------------------------*/ - /*---------------------------------------------------------------------------------*/ + /*------------------------------------------------------------------------*/ + /*-- Setter methods ------------------------------------------------------*/ + /*------------------------------------------------------------------------*/ public void setFailed(boolean failed) { this.failed = failed; } - /*---------------------------------------------------------------------------------*/ - /*-- Buffer ------------------------------------*/ - /*---------------------------------------------------------------------------------*/ + /*------------------------------------------------------------------------*/ + /*-- Buffer --------------------------------------------------------------*/ + /*------------------------------------------------------------------------*/ public StringBuffer getInitializer() { return initializer; } @@ -1129,15 +1091,15 @@ public class JAXXCompiler { getLateInitializer().append(code); } - public boolean haveProcessDataBinding() { + public boolean hasProcessDataBinding() { return getProcessDataBinding().length() > 0; } - public boolean haveApplyDataBinding() { + public boolean hasApplyDataBinding() { return getApplyDataBinding().length() > 0; } - public boolean haveRemoveDataBinding() { + public boolean hasRemoveDataBinding() { return getRemoveDataBinding().length() > 0; } @@ -1146,8 +1108,7 @@ public class JAXXCompiler { } public boolean hasMethod(String methodName) { - JavaMethod[] methods = getJavaFile().getMethods(); - for (JavaMethod method : methods) { + for (JavaMethod method : getJavaFile().getMethods()) { if (methodName.equals(method.getName())) { return true; } @@ -1155,9 +1116,9 @@ public class JAXXCompiler { return false; } - /*---------------------------------------------------------------------------------*/ - /*-- Other methods ----------------------------------------------------------------*/ - /*---------------------------------------------------------------------------------*/ + /*------------------------------------------------------------------------*/ + /*-- Other methods -------------------------------------------------------*/ + /*------------------------------------------------------------------------*/ public void addImport(String text) { if (text.endsWith("*")) { importedPackages.add(text.substring(0, text.length() - 1)); @@ -1172,8 +1133,7 @@ public class JAXXCompiler { public void addDependencyClass(String className) { -// if (!JAXXEngine.get().jaxxFileClassNames.contains(className)) { - if (!engine.jaxxFileClassNames.contains(className)) { + if (!engine.containsJaxxFileClassName(className)) { URL jaxxURL = getClassLoader().getResource(className.replace('.', '/') + ".jaxx"); URL classURL = getClassLoader().getResource(className.replace('.', '/') + ".class"); if (jaxxURL != null && classURL != null) { @@ -1198,14 +1158,11 @@ public class JAXXCompiler { assert jaxxFile.getName().equalsIgnoreCase(className.substring(className.lastIndexOf(".") + 1) + ".jaxx") : "expecting file name to match " + className + ", but found " + jaxxFile.getName(); if (jaxxFile.getName().equals(className.substring(className.lastIndexOf(".") + 1) + ".jaxx")) { // check case match -// if (JAXXEngine.get().currentPass != JAXXEngine.LifeCycle.compile_first_pass) { - if (engine.currentPass != JAXXEngine.LifeCycle.compile_first_pass) { + if (engine.getCurrentPass() != JAXXEngine.LifeCycle.compile_first_pass) { throw new AssertionError("Internal error: adding dependency class " + className + " during second compilation pass"); } -// JAXXEngine.get().jaxxFileClassNames.add(className); -// JAXXEngine.get().jaxxFiles.add(jaxxFile); - engine.jaxxFileClassNames.add(className); - engine.jaxxFiles.add(jaxxFile); + engine.addJaxxFileClassName(className); + engine.addJaxxFile(jaxxFile); } } } @@ -1402,7 +1359,26 @@ public class JAXXCompiler { return javaFile; } - public void generateCode(Iterable<Generator> generatorIterator) throws IOException { + public void finalizeCompilers(Iterable<JAXXCompilerFinalizer> generatorIterator) throws Exception { + + int dotPos = getOutputClassName().lastIndexOf("."); + String packageName = dotPos != -1 ? getOutputClassName().substring(0, dotPos) : null; + String simpleClassName = getOutputClassName().substring(dotPos + 1); + CompiledObject compiledObject = getRootObject(); + for (JAXXCompilerFinalizer generator : generatorIterator) { + generator.finalizeCompiler(compiledObject, this, javaFile, packageName, simpleClassName); + } + + for (CompiledObject object : getObjects().values()) { + object.finalizeCompiler(); + } + + for (JAXXCompilerFinalizer generator : generatorIterator) { + generator.prepareJavaFile(compiledObject, this, javaFile, packageName, simpleClassName); + } + } + + public void generate(JavaFileGenerator generator, Iterable<JAXXCompilerFinalizer> generatorIterator) throws IOException { File dest; if (getConfiguration().getTargetDirectory() != null) { dest = new File(getConfiguration().getTargetDirectory(), getOutputClassName().replace('.', File.separatorChar) + ".java"); @@ -1412,37 +1388,20 @@ public class JAXXCompiler { if (dest.exists() && !dest.setLastModified(System.currentTimeMillis())) { log.warn("could not touch file " + dest); } + PrintWriter out = null; try { - PrintWriter out = new PrintWriter(new FileWriter(dest)); - int dotPos = getOutputClassName().lastIndexOf("."); - String packageName = dotPos != -1 ? getOutputClassName().substring(0, dotPos) : null; - String simpleClassName = getOutputClassName().substring(dotPos + 1); - CompiledObject compiledObject = getRootObject(); - for (Generator generator : generatorIterator) { - generator.finalizeCompiler(compiledObject, this, javaFile, packageName, simpleClassName); - } - - for (CompiledObject object : getObjects().values()) { - object.finalizeCompiler(); - } - - for (Generator generator : generatorIterator) { - generator.prepareJavaFile(compiledObject, this, javaFile, packageName, simpleClassName); - } - out.println(javaFile.toString()); - out.close(); - } catch (RuntimeException e) { + out = new PrintWriter(new FileWriter(dest)); + generator.generateFile(javaFile, out); + } catch (IOException e) { // file could not be generated, so delete it... if (!dest.delete()) { log.warn("could not delete file " + dest); } throw e; - } catch (ClassNotFoundException e) { - // file could not be generated, so delete it... - if (!dest.delete()) { - log.warn("could not delete file " + dest); + } finally { + if (out != null) { + out.close(); } - throw new CompilerException(e); } } /** line separator cached value */ diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerFinalizer.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerFinalizer.java new file mode 100644 index 0000000..5f91313 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerFinalizer.java @@ -0,0 +1,39 @@ +package jaxx.compiler; + +import jaxx.compiler.java.JavaFile; + +/** + * Contract of any object to interact with a {@link JAXXCompiler} before the + * generation pass. + * + * @author chemit + * @since 2.0.0 + */ +public interface JAXXCompilerFinalizer { + + /** + * Finalize compiler for a given compiler on the finalizer pass before any + * generation. + * + * @param root the root object + * @param compiler the current compiler + * @param javaFile the java file to generate + * @param packageName the package name of the file to generate + * @param className the class name of the file to generate + * @throws Exception + */ + void finalizeCompiler(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws Exception; + + /** + * Prepare java file after any compiler finalizer pass, says the last + * action before generation. + * + * @param root the root object + * @param compiler the current compiler + * @param javaFile the java file to generate + * @param packageName the package name of the file to generate + * @param className the class name of the file to generate + * @throws Exception + */ + void prepareJavaFile(CompiledObject root, JAXXCompiler compiler, JavaFile javaFile, String packageName, String className) throws Exception; +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java index 6d08798..2b88ebd 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java @@ -1,6 +1,6 @@ package jaxx.compiler; -import jaxx.compiler.generators.Generator; +import jaxx.compiler.java.JavaFileGenerator; import jaxx.compiler.spi.Initializer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -15,7 +15,6 @@ import java.util.List; import java.util.Map; import java.util.ServiceLoader; import java.util.TreeMap; -import jaxx.compiler.decorators.CompiledObjectDecorator; /** * @author chemit @@ -28,14 +27,20 @@ public class JAXXEngine { */ protected static final Log log = LogFactory.getLog(JAXXEngine.class); - protected enum LifeCycle { + public void addJaxxFileClassName(String className) { + jaxxFileClassNames.add(className); + } - init,// state before compilation - compile_first_pass, // state when first pass of compilation - compile_second_pass, // state when second pass of compilation - stylesheet_pass, // state when applygin stylesheet phase after compilation - generate_pass, // state when generation phase - profile_pass // state when profile + public void addJaxxFile(File jaxxFile) { + jaxxFiles.add(jaxxFile); + } + + public boolean containsJaxxFileClassName(String className) { + return jaxxFileClassNames.contains(className); + } + + public LifeCycle getCurrentPass() { + return currentPass; } /** shared instance of unique launchor at a givne time. */ protected static JAXXEngine singleton; @@ -52,7 +57,7 @@ public class JAXXEngine { /** * Create a new launchor and set it as current launchor accessible via method {@link #get()}. * <p/> - * The launchor will be prepared to compile a set of files, expressed as paths relative to a base directory. + * The launchor will be prepared to run a set of files, expressed as paths relative to a base directory. * The class names of the compiled files are derived from the relative path strings * (e.g. "example/Foo.jaxx" compiles into a class named "example.Foo"). * @@ -78,10 +83,10 @@ public class JAXXEngine { /** * Create a new launchor and set it as current launchor accessible via method {@link #get()}. * <p/> - * The launchor will be prepared to compile a set of files, with the class names specified explicitly. + * The launchor will be prepared to run a set of files, with the class names specified explicitly. * The class compiled from files[i] will be named classNames[i]. * - * @param files the .jaxx files to compile + * @param files the .jaxx files to run * @param classNames the names of the classes being compiled * @param configuration the compiler configuration to use * @return the new instanciated launchor @@ -134,21 +139,21 @@ public class JAXXEngine { */ protected CompilerConfiguration configuration; /** - * original list of files to compile + * original list of files to run */ protected final File[] files; /** - * original list of classes to compile + * original list of classes to run */ protected final String[] classNames; /** * Files to be treated while compilation. */ - protected List<File> jaxxFiles = new ArrayList<File>(); + private List<File> jaxxFiles = new ArrayList<File>(); /** * Class names corresponding to the files in the jaxxFiles list. */ - protected List<String> jaxxFileClassNames = new ArrayList<String>(); + private List<String> jaxxFileClassNames = new ArrayList<String>(); /** * Maps the names of classes being compiled to the compiler instance handling the compilation. */ @@ -160,15 +165,23 @@ public class JAXXEngine { /** * */ - protected LifeCycle currentPass; + private LifeCycle currentPass; +// /** +// * +// */ +// protected int errorCount; +// /** +// * +// */ +// protected int warningCount; /** - * + * Warnings detected while running. */ - protected int errorCount; + protected List<String> warnings = new ArrayList<String>(); /** - * + * Errors detected while running. */ - protected int warningCount; + protected List<String> errors = new ArrayList<String>(); /** * number of registred compiler */ @@ -182,31 +195,245 @@ public class JAXXEngine { */ protected Map<String, CompiledObjectDecorator> decorators; /** - * generators available in engine + * finalizers available in engine */ - protected List<Generator> generators; + protected List<JAXXCompilerFinalizer> finalizers; + + /** + * Different passes of the engine. + * + * Each pass defines the {@link #run(JAXXEngine)} method which implements + * the logic of the pass. + */ + protected enum LifeCycle { + + /** + * state before compilation + */ + init { + + @Override + public boolean run(JAXXEngine engine) { + boolean success = true; + engine.compilerCount = 0; + engine.warnings.clear(); + engine.errors.clear(); + // init decorators + if (engine.decorators == null) { + engine.decorators = new TreeMap<String, CompiledObjectDecorator>(); + // load decorators + for (CompiledObjectDecorator decorator : ServiceLoader.load(CompiledObjectDecorator.class)) { + engine.decorators.put(decorator.getName(), decorator); + } + } + + // init finalizers + engine.finalizers = new ArrayList<JAXXCompilerFinalizer>(); + for (JAXXCompilerFinalizer finalizer : ServiceLoader.load(JAXXCompilerFinalizer.class)) { + engine.finalizers.add(finalizer); + } + + engine.jaxxFiles.addAll(Arrays.asList(engine.files)); + engine.jaxxFileClassNames.addAll(Arrays.asList(engine.classNames)); + return success; + } + }, + /** + * first pass of compilation + */ + compile_first_pass { + + @Override + public boolean run(JAXXEngine engine) throws Exception { + boolean success = true; + boolean compiled; + do { + compiled = false; + assert engine.jaxxFiles.size() == engine.jaxxFileClassNames.size(); + java.util.Iterator<File> filesIterator = new ArrayList<File>(engine.jaxxFiles).iterator(); // clone it so it can safely be modified while we're iterating + java.util.Iterator<String> classNamesIterator = new ArrayList<String>(engine.jaxxFileClassNames).iterator(); + while (filesIterator.hasNext()) { + File file = filesIterator.next(); + String className = classNamesIterator.next(); + if (log.isDebugEnabled()) { + log.debug("compile first pass for " + className); + } + if (engine.symbolTables.get(file) == null) { + compiled = true; + if (engine.compilers.containsKey(className)) { + throw new CompilerException("Internal error: " + className + " is already being compiled, attempting to compile it again"); + } + + File destDir = engine.configuration.getTargetDirectory(); + if (destDir != null) { + int dotPos = className.lastIndexOf("."); + if (dotPos != -1) { + destDir = new File(destDir, className.substring(0, dotPos).replace('.', File.separatorChar)); + } + if (!destDir.exists() && !destDir.mkdirs()) { + log.warn("could not create directory " + destDir); + continue; + } + } else { + //destDir = file.getParentFile(); + } + JAXXCompiler compiler = engine.newCompiler(file.getParentFile(), file, className); + addStartProfileTime(engine, compiler); + engine.compilers.put(className, compiler); + compiler.compileFirstPass(); + addEndProfileTime(engine, compiler); + assert !engine.symbolTables.values().contains(compiler.getSymbolTable()) : "symbolTable is already registered"; + engine.symbolTables.put(file, compiler.getSymbolTable()); + if (compiler.isFailed()) { + success = false; + } + } + } + + } while (compiled); + return success; + } + }, + /** + * second pass of compilation + */ + compile_second_pass { + + @Override + public boolean run(JAXXEngine engine) throws Exception { + boolean success = true; + List<File> jaxxFilesClone = new ArrayList<File>(engine.jaxxFiles); + for (String className : engine.jaxxFileClassNames) { + JAXXCompiler compiler = engine.getCompiler(className, "Internal error: could not find compiler for " + className + " during second pass"); + addStartProfileTime(engine, compiler); + if (log.isDebugEnabled()) { + log.debug("runInitializers for " + className); + } + if (!compiler.isFailed()) { + compiler.runInitializers(); + } + if (log.isDebugEnabled()) { + log.debug("compile second pass for " + className); + } + compiler.compileSecondPass(); + addEndProfileTime(engine, compiler); + if (log.isDebugEnabled()) { + log.debug("done with result [" + !compiler.isFailed() + "] for " + className); + } + if (compiler.isFailed()) { + success = false; + } + } + if (!jaxxFilesClone.equals(engine.jaxxFiles)) { + throw new AssertionError("Internal error: compilation set altered during pass 2 (was " + jaxxFilesClone + ", modified to " + engine.jaxxFiles + ")"); + } + return success; + } + }, + /** + * applying stylesheet + */ + stylesheet_pass { + + @Override + public boolean run(JAXXEngine engine) throws Exception { + boolean success = true; + for (String className : engine.jaxxFileClassNames) { + JAXXCompiler compiler = engine.getCompiler(className, "Internal error: could not find compiler for " + className + " during stylesheet application"); + addStartProfileTime(engine, compiler); + compiler.applyStylesheets(); + addEndProfileTime(engine, compiler); + if (compiler.isFailed()) { + success = false; + } + } + return success; + } + }, + /** + * finalize compiler + */ + finalize_compiler { + + @Override + public boolean run(JAXXEngine engine) throws Exception { + boolean success = true; + for (String className : engine.jaxxFileClassNames) { + JAXXCompiler compiler = engine.getCompiler(className, "Internal error: could not find compiler for " + className + " during code generation"); + addStartProfileTime(engine, compiler); + compiler.finalizeCompilers(engine.finalizers); + addEndProfileTime(engine, compiler); + if (compiler.isFailed()) { + success = false; + } + } + return success; + } + }, + /** + * generate java file + */ + generate_pass { + + @Override + public boolean run(JAXXEngine engine) throws Exception { + boolean success = true; + JavaFileGenerator generator = new JavaFileGenerator(JAXXCompiler.getLineSeparator(), engine.configuration.isVerbose()); + + for (String className : engine.jaxxFileClassNames) { + JAXXCompiler compiler = engine.getCompiler(className, "Internal error: could not find compiler for " + className + " during code generation"); + addStartProfileTime(engine, compiler); + compiler.generate(generator, engine.finalizers); + addEndProfileTime(engine, compiler); + if (compiler.isFailed()) { + success = false; + } + } + return success; + } + }, + /** + * display profile + */ + profile_pass { + + @Override + public boolean run(JAXXEngine engine) throws Exception { + boolean success = true; + if (engine.configuration.isProfile()) { + StringBuilder buffer = engine.profiler.computeProfileReport(); + log.info(buffer.toString()); + } + return success; + } + }; + + public abstract boolean run(JAXXEngine engine) throws Exception; + + void addStartProfileTime(JAXXEngine engine, JAXXCompiler compiler) { + engine.addProfileTime(compiler, name() + "_start"); + } + + void addEndProfileTime(JAXXEngine engine, JAXXCompiler compiler) { + engine.addProfileTime(compiler, name() + "_end"); + } + } protected JAXXEngine(File[] files, String[] classNames, CompilerConfiguration options) { this.configuration = options == null ? new DefaultCompilerConfiguration() : options; this.files = files; this.classNames = classNames; - if (this.configuration.isVerbose()) { - log.info("files : " + Arrays.toString(files)); + if (log.isDebugEnabled()) { + log.debug("files : " + Arrays.toString(files)); } if (this.configuration.isProfile()) { profiler = new JAXXProfile(); } } - public void init() { - compilerCount = 0; - jaxxFiles.addAll(Arrays.asList(files)); - jaxxFileClassNames.addAll(Arrays.asList(classNames)); - } - /** Resets all state in preparation for a new compilation session. */ protected void reset() { - errorCount = warningCount = 0; +// errorCount = warningCount = 0; jaxxFiles.clear(); jaxxFileClassNames.clear(); symbolTables.clear(); @@ -219,9 +446,9 @@ public class JAXXEngine { decorators.clear(); decorators = null; } - if (generators != null) { - generators.clear(); - generators = null; + if (finalizers != null) { + finalizers.clear(); + finalizers = null; } } @@ -229,14 +456,6 @@ public class JAXXEngine { return "2.0.0"; } -// /** -// * Creates a dummy Compiler for use in unit testing. -// * -// * @return the compiler -// */ -// public static JAXXCompiler createDummyCompiler() { -// return createDummyCompiler(JAXXCompiler.class.getClassLoader()); -// } /** * Creates a dummy Compiler for use in unit testing. * @@ -271,25 +490,16 @@ public class JAXXEngine { return compiler.getSymbolTable(); } - /** - * Returns the system line separator string. - * - * @return the string used to separate lines - */ - public String getLineSeparator() { - return System.getProperty("line.separator", "\n"); - } - public CompiledObjectDecorator getDecorator(String name) { - CompiledObjectDecorator decorator = getDecorators().get(name); + CompiledObjectDecorator decorator = decorators.get(name); if (decorator == null) { - throw new IllegalArgumentException("could not find decorator with key " + name + " (known decorators : " + getDecorators().keySet()); + throw new IllegalArgumentException("could not find decorator with key " + name + " (known decorators : " + decorators.keySet()); } return decorator; } public CompiledObjectDecorator getDecorator(Class<?> type) { - for (CompiledObjectDecorator decorator : getDecorators().values()) { + for (CompiledObjectDecorator decorator : decorators.values()) { if (type == decorator.getClass()) { return decorator; } @@ -297,26 +507,20 @@ public class JAXXEngine { return null; } - protected synchronized Map<String, CompiledObjectDecorator> getDecorators() { - if (decorators == null) { - decorators = new TreeMap<String, CompiledObjectDecorator>(); - // load decorators - ServiceLoader<CompiledObjectDecorator> loader = ServiceLoader.load(CompiledObjectDecorator.class); - for (CompiledObjectDecorator c : loader) { - decorators.put(c.getName(), c); - } - } - return decorators; + public void addWarning(String warning) { + warnings.add(warning); } - public List<Generator> getGenerators() { - if (generators == null) { - generators = new ArrayList<Generator>(); - for (Generator generator : ServiceLoader.load(Generator.class)) { - generators.add(generator); - } - } - return generators; + public void addError(String error) { + errors.add(error); + } + + public List<String> getErrors() { + return errors; + } + + public List<String> getWarnings() { + return warnings; } /** @@ -324,49 +528,21 @@ public class JAXXEngine { * * @return <code>true</code> if compilation succeeds, <code>false</code> otherwise */ - public synchronized boolean compile() { - - init(); + public synchronized boolean run() { try { boolean success = true; - // pass 1 - if (!nextStep(LifeCycle.compile_first_pass, success)) { - return false; - } - success = firstPass(); - - // pass 2 - if (!nextStep(LifeCycle.compile_second_pass, success)) { - return false; - } - assert jaxxFiles.size() == jaxxFileClassNames.size(); - success = secondPass(); - - // stylesheet application - if (!nextStep(LifeCycle.stylesheet_pass, success)) { - return false; - } - assert jaxxFiles.size() == jaxxFileClassNames.size(); - success = applyCss(); - - // code generation - if (!nextStep(LifeCycle.generate_pass, success)) { - return false; - } - assert jaxxFiles.size() == jaxxFileClassNames.size(); - success = generate(); - - if (configuration.isProfile()) { - // profile pass (only if succes compile) - if (!nextStep(LifeCycle.profile_pass, success)) { + for (LifeCycle state : LifeCycle.values()) { + if (!success) { return false; } - StringBuilder buffer = profiler.computeProfileReport(); - log.info(buffer.toString()); + currentPass = state; + if (configuration.isVerbose()) { + log.info("start " + state + " on " + jaxxFiles.size() + " file(s)"); + } + success = state.run(this); } - - return report(success); + return success; //FIXME : deal better the exception treatment... } catch (CompilerException e) { @@ -379,122 +555,12 @@ public class JAXXEngine { } finally { compilerCount = compilers.size(); //TC - 20081018 only reset when no error was detected - if (configuration.isResetAfterCompile() && errorCount == 0) { + if (configuration.isResetAfterCompile() && errors.isEmpty()) { reset(); } } } - protected boolean firstPass() throws Exception { - boolean success = true; - boolean compiled; - do { - compiled = false; - assert jaxxFiles.size() == jaxxFileClassNames.size(); - java.util.Iterator<File> filesIterator = new ArrayList<File>(jaxxFiles).iterator(); // clone it so it can safely be modified while we're iterating - java.util.Iterator<String> classNamesIterator = new ArrayList<String>(jaxxFileClassNames).iterator(); - while (filesIterator.hasNext()) { - File file = filesIterator.next(); - String className = classNamesIterator.next(); - if (log.isDebugEnabled()) { - log.debug("compile first pass for " + className); - } - if (symbolTables.get(file) == null) { - compiled = true; - if (compilers.containsKey(className)) { - throw new CompilerException("Internal error: " + className + " is already being compiled, attempting to compile it again"); - } - - File destDir = configuration.getTargetDirectory(); - if (destDir != null) { - int dotPos = className.lastIndexOf("."); - if (dotPos != -1) { - destDir = new File(destDir, className.substring(0, dotPos).replace('.', File.separatorChar)); - } - if (!destDir.exists() && !destDir.mkdirs()) { - log.warn("could not create directory " + destDir); - continue; - } - } else { - //destDir = file.getParentFile(); - } - JAXXCompiler compiler = newCompiler(file.getParentFile(), file, className); - addProfileTime(compiler, currentPass.name() + "_start"); - compilers.put(className, compiler); - compiler.compileFirstPass(); - addProfileTime(compiler, currentPass.name() + "_end"); - assert !symbolTables.values().contains(compiler.getSymbolTable()) : "symbolTable is already registered"; - symbolTables.put(file, compiler.getSymbolTable()); - if (compiler.isFailed()) { - success = false; - } - } - } - - } while (compiled); - return success; - } - - protected boolean secondPass() throws Exception { - boolean success = true; - List<File> jaxxFilesClone = new ArrayList<File>(jaxxFiles); - for (String className : jaxxFileClassNames) { - JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during second pass"); - addProfileTime(compiler, currentPass.name() + "_start"); - if (log.isDebugEnabled()) { - log.debug("runInitializers for " + className); - } - if (!compiler.isFailed()) { - compiler.runInitializers(); - } - if (log.isDebugEnabled()) { - log.debug("compile second pass for " + className); - } - compiler.compileSecondPass(); - addProfileTime(compiler, currentPass.name() + "_end"); - if (log.isDebugEnabled()) { - log.debug("done with result [" + !compiler.isFailed() + "] for " + className); - } - if (compiler.isFailed()) { - success = false; - } - } - if (!jaxxFilesClone.equals(jaxxFiles)) { - throw new AssertionError("Internal error: compilation set altered during pass 2 (was " + jaxxFilesClone + ", modified to " + jaxxFiles + ")"); - } - return success; - } - - protected boolean applyCss() throws Exception { - boolean success = true; - - for (String className : jaxxFileClassNames) { - JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during stylesheet application"); - addProfileTime(compiler, currentPass.name() + "_start"); - compiler.applyStylesheets(); - addProfileTime(compiler, currentPass.name() + "_end"); - if (compiler.isFailed()) { - success = false; - } - } - return success; - } - - protected boolean generate() throws Exception { - boolean success = true; - List<Generator> gens = getGenerators(); - for (String className : jaxxFileClassNames) { - JAXXCompiler compiler = getCompiler(className, "Internal error: could not find compiler for " + className + " during code generation"); - addProfileTime(compiler, currentPass.name() + "_start"); - compiler.generateCode(gens); - addProfileTime(compiler, currentPass.name() + "_end"); - if (compiler.isFailed()) { - success = false; - } - } - return success; - } - public int getCompilerCount() { return compilerCount; } @@ -507,28 +573,6 @@ public class JAXXEngine { return compiler; } - protected boolean nextStep(LifeCycle nextCycle, boolean success) { - if (!success) { - return report(false); - } - currentPass = nextCycle; - return true; - } - - protected boolean report(boolean success) { - if (warningCount == 1) { - System.err.println("1 warning"); - } else if (warningCount > 0) { - System.err.println(warningCount + " warnings"); - } - if (errorCount == 1) { - System.err.println("1 error"); - } else if (errorCount > 0) { - System.err.println(errorCount + " errors"); - } - return success; - } - protected JAXXCompiler newCompiler(File parentFile, File file, String className) throws InvocationTargetException, IllegalAccessException, InstantiationException, NoSuchMethodException { Constructor<? extends JAXXCompiler> cons = configuration.getCompilerClass().getConstructor(JAXXEngine.class, File.class, File.class, String.class, CompilerConfiguration.class, List.class); return cons.newInstance(this, parentFile, file, className, configuration, Arrays.asList(new String[]{ diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXProfile.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXProfile.java index 054d851..c6acddf 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXProfile.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXProfile.java @@ -150,10 +150,11 @@ public class JAXXProfile { ProfileResult cfp = newProfileResult(LifeCycle.compile_first_pass); ProfileResult csp = newProfileResult(LifeCycle.compile_second_pass); ProfileResult ssp = newProfileResult(LifeCycle.stylesheet_pass); + ProfileResult fp = newProfileResult(LifeCycle.finalize_compiler); ProfileResult gp = newProfileResult(LifeCycle.generate_pass); - ProfileResult total = newProfileResult(cfp, csp, ssp, gp); + ProfileResult total = newProfileResult(cfp, csp, ssp,fp, gp); - String reportPattern = "\n|%1$-" + maxLength + "s|%2$15s|%3$15s|%4$15s|%5$15s|%6$15s|"; + String reportPattern = "\n|%1$-" + maxLength + "s|%2$15s|%3$15s|%4$15s|%5$15s|%6$15s|%7$15s|"; char[] tmpC = new char[maxLength]; Arrays.fill(tmpC, '-'); @@ -163,32 +164,33 @@ public class JAXXProfile { "---------------", "---------------", "---------------", + "---------------", "---------------"); buffer.append(line); buffer.append(String.format(reportPattern, "(files / stats) \\ passes", - "compile round 1", "compile round 2", "stylesheet", "generation", "all passes")); + "compile round 1", "compile round 2", "stylesheet", "finalize", "generation", "all passes")); buffer.append(line); // affiche les temps de tous les fichiers en temp total croissant for (Long l : total.times) { JAXXCompiler c = total.getCompiler(l); - printReportLine(buffer, reportPattern, c.getOutputClassName(), cfp.getTime(c), csp.getTime(c), ssp.getTime(c), gp.getTime(c), total.getTime(c)); + printReportLine(buffer, reportPattern, c.getOutputClassName(), cfp.getTime(c), csp.getTime(c), ssp.getTime(c), fp.getTime(c), gp.getTime(c), total.getTime(c)); } buffer.append(line); if (compilers.size() > 1) { - printReportLine(buffer, reportPattern, "total (" + compilers.size() + " files)", cfp.total, csp.total, ssp.total, gp.total, total.total); + printReportLine(buffer, reportPattern, "total (" + compilers.size() + " files)", cfp.total, csp.total, ssp.total, fp.total, gp.total, total.total); buffer.append(line); - printReportLine2(buffer, reportPattern, "min", cfp.min, csp.min, ssp.min, gp.min, total.min); - printReportLine2(buffer, reportPattern, "max", cfp.max, csp.max, ssp.max, gp.max, total.max); - printReportLine(buffer, reportPattern, "average", cfp.average, csp.average, ssp.average, gp.average, total.average); + printReportLine2(buffer, reportPattern, "min", cfp.min, csp.min, ssp.min, fp.min, gp.min, total.min); + printReportLine2(buffer, reportPattern, "max", cfp.max, csp.max, ssp.max, fp.max, gp.max, total.max); + printReportLine(buffer, reportPattern, "average", cfp.average, csp.average, ssp.average, fp.average, gp.average, total.average); buffer.append(line); } cfp.clear(); @@ -201,21 +203,23 @@ public class JAXXProfile { } public static final String TIME_PATTERN = "%1$9s - %2$2d%%"; - protected void printReportLine(StringBuilder buffer, String reportPattern, String label, long firstPassCounter, long secondPassCounter, long cssCounter, long generatorCounter, long totalCounter) { + protected void printReportLine(StringBuilder buffer, String reportPattern, String label, long firstPassCounter, long secondPassCounter, long cssCounter, long finalizeCounter, long generatorCounter, long totalCounter) { float percentCFP = ((float) firstPassCounter / totalCounter) * 100; float percentCSP = ((float) secondPassCounter / totalCounter) * 100; float percentCSSP = ((float) cssCounter / totalCounter) * 100; + float percentFP = ((float) finalizeCounter / totalCounter) * 100; float percentGP = ((float) generatorCounter / totalCounter) * 100; String strCFP = String.format(TIME_PATTERN, StringUtil.convertTime(firstPassCounter), (int) percentCFP); String strCSP = String.format(TIME_PATTERN, StringUtil.convertTime(secondPassCounter), (int) percentCSP); String strCSSP = String.format(TIME_PATTERN, StringUtil.convertTime(cssCounter), (int) percentCSSP); + String strFP = String.format(TIME_PATTERN, StringUtil.convertTime(finalizeCounter), (int) percentFP); String strGP = String.format(TIME_PATTERN, StringUtil.convertTime(generatorCounter), (int) percentGP); - buffer.append(String.format(reportPattern, label, strCFP, strCSP, strCSSP, strGP, StringUtil.convertTime(totalCounter))); + buffer.append(String.format(reportPattern, label, strCFP, strCSP, strCSSP, strFP, strGP, StringUtil.convertTime(totalCounter))); } - protected void printReportLine2(StringBuilder buffer, String reportPattern, String label, long firstPassCounter, long secondPassCounter, long cssCounter, long generatorCounter, long totalCounter) { - buffer.append(String.format(reportPattern, label, StringUtil.convertTime(firstPassCounter), StringUtil.convertTime(secondPassCounter), StringUtil.convertTime(cssCounter), StringUtil.convertTime(generatorCounter), StringUtil.convertTime(totalCounter))); + protected void printReportLine2(StringBuilder buffer, String reportPattern, String label, long firstPassCounter, long secondPassCounter, long cssCounter, long finalizeCounter, long generatorCounter, long totalCounter) { + buffer.append(String.format(reportPattern, label, StringUtil.convertTime(firstPassCounter), StringUtil.convertTime(secondPassCounter), StringUtil.convertTime(cssCounter), StringUtil.convertTime(finalizeCounter), StringUtil.convertTime(generatorCounter), StringUtil.convertTime(totalCounter))); } protected CompilerEntry getEntry(JAXXCompiler compiler) { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/StylesheetHelper.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java similarity index 97% rename from jaxx-compiler/src/main/java/jaxx/compiler/StylesheetHelper.java rename to jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java index 813876d..9a25d46 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/StylesheetHelper.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java @@ -1,11 +1,12 @@ -package jaxx.compiler; +package jaxx.compiler.css; +import jaxx.compiler.*; import jaxx.runtime.css.Selector; import jaxx.runtime.css.Rule; import jaxx.runtime.css.Stylesheet; -import jaxx.compiler.parser.java.JavaParser; -import jaxx.compiler.parser.java.JavaParserTreeConstants; -import jaxx.compiler.parser.java.SimpleNode; +import jaxx.compiler.java.parser.JavaParser; +import jaxx.compiler.java.parser.JavaParserTreeConstants; +import jaxx.compiler.java.parser.SimpleNode; import jaxx.compiler.reflect.ClassDescriptor; import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.compiler.reflect.MethodDescriptor; @@ -93,7 +94,7 @@ public class StylesheetHelper { public static String replaceObjectReferences(String code, String id) throws CompilerException { JavaParser p = new JavaParser(new StringReader(code + ";")); p.Expression(); - jaxx.compiler.parser.java.SimpleNode node = p.popNode(); + jaxx.compiler.java.parser.SimpleNode node = p.popNode(); scanNode(node, id); return node.getText(); } @@ -119,7 +120,7 @@ public class StylesheetHelper { pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode()); String dest = object.getId() + ".style." + pseudoClass + ".add"; String destCode = compiler.getJavaCode(dest); - if (compiler.haveProcessDataBinding()) { + if (compiler.hasProcessDataBinding()) { compiler.appendProcessDataBinding("else "); } compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + pseudoClass + ") { " + propertyCode + "} }"); @@ -213,7 +214,7 @@ public class StylesheetHelper { pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode()); String dest = object.getId() + ".style." + pseudoClass + ".add"; String destCode = TypeManager.getJavaCode(dest); - if (compiler.haveProcessDataBinding()) { + if (compiler.hasProcessDataBinding()) { compiler.appendProcessDataBinding("else "); } compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + pseudoClass + ") { "+ propertyCode + "} }"); @@ -229,7 +230,7 @@ public class StylesheetHelper { pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode()); String dest = object.getId() + ".style." + pseudoClass + ".remove"; String destCode = compiler.getJavaCode(dest); - if (compiler.haveProcessDataBinding()) { + if (compiler.hasProcessDataBinding()) { compiler.appendProcessDataBinding("else "); } compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + invert(pseudoClass) + ") { " + propertyCode + "} }"); @@ -321,7 +322,7 @@ public class StylesheetHelper { pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode()); String dest = object.getId() + ".style." + pseudoClass + ".remove"; String destCode = TypeManager.getJavaCode(dest); - if (compiler.haveProcessDataBinding()) { + if (compiler.hasProcessDataBinding()) { compiler.appendProcessDataBinding("else "); } compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + invert(pseudoClass) + ") { " + propertyCode + "} }"); @@ -365,15 +366,7 @@ public class StylesheetHelper { pseudoClass = pseudoClass.substring(0, pseudoClass.indexOf("[")); } final StringBuffer buffer = new StringBuffer(); - /*CompiledObject bufferObject = new CompiledObject(object.getId(), object.getJavaCode(), object.getObjectClass(), compiler, true) { - public void appendInitializationCode(String code) { - buffer.append(code); - } - public void registerDataBinding(String src, String property, String assignment, JAXXCompiler compiler) throws CompilerException { - buffer.append(assignment); - } - };*/ - + DefaultObjectHandler handler = TagManager.getTagHandler(object.getObjectClass()); boolean valueDeclared = false; for (Map.Entry<String, String> e : properties.entrySet()) { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSS.jj b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSS.jj new file mode 100644 index 0000000..fbd133f --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSS.jj @@ -0,0 +1,587 @@ +/*@bgen(jjtree) Generated By:JJTree: Do not edit this line. .\CSS.jj */ +/*@egen*//* + * Copyright 2006 Ethan Nicholas. All rights reserved. + * Use is subject to license terms. + */ + +// I would love to have used an existing CSS parser, but all of the ones I could +// find are licensed under the LGPL. As JAXX is BSD licensed and I'm not a big +// fan of the LGPL, unfortunately that won't work. +options { + STATIC = false; + JDK_VERSION = "1.4"; +} + +PARSER_BEGIN(CSSParser) +package jaxx.css; + +public class CSSParser/*@bgen(jjtree)*/implements CSSParserTreeConstants/*@egen*/ {/*@bgen(jjtree)*/ + protected JJTCSSParserState jjtree = new JJTCSSParserState(); + +/*@egen*/ + public SimpleNode popNode() { + if ( jjtree.nodeArity() > 0) // number of child nodes + return (SimpleNode)jjtree.popNode(); + else + return null; + } + + void jjtreeOpenNodeScope(Node n) { + ((SimpleNode) n).firstToken = getToken(1); + } + + void jjtreeCloseNodeScope(Node n) { + ((SimpleNode) n).lastToken = getToken(0); + } + + public static void main(String args[]) { + System.out.println("Reading from standard input..."); + CSSParser css = new CSSParser(System.in); + try { + SimpleNode n = css.Stylesheet(); + n.dump(""); + System.out.println("Thank you."); + } catch (Exception e) { + System.out.println("Oops."); + System.out.println(e.getMessage()); + e.printStackTrace(); + } + } +} + +PARSER_END(CSSParser) + + +<DEFAULT, IN_RULE> SKIP : +{ + " " +| "\t" +| "\n" +| "\r" +| <"//" (~["\n","\r"])* ("\n"|"\r"|"\r\n")> +| <"/*" (~["*"])* "*" (~["/"] (~["*"])* "*")* "/"> +} + +<*> TOKEN : /* LITERALS */ +{ + <DECIMAL_LITERAL: <INTEGER_LITERAL> ("." <INTEGER_LITERAL>)?> +| + <#INTEGER_LITERAL: (["0"-"9"])+> +} + +<DEFAULT, IN_RULE> TOKEN : /* IDENTIFIER */ +{ + <IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)*> +| + <#LETTER: ["_", "-", "a"-"z", "A"-"Z"]> +| + <#DIGIT: ["0"-"9"]> +} + +<IN_PSEUDOCLASS> TOKEN : /* PSEUDOCLASS_IDENTIFIER */ +{ + <PSEUDOCLASS_IDENTIFIER: <IDENTIFIER>> : DEFAULT +} + +<DEFAULT> TOKEN: /* COLON */ +{ + <PSEUDOCLASS_COLON: ":"> : IN_PSEUDOCLASS +} + +<IN_RULE> TOKEN: /* COLON_IN_RULE */ +{ + <COLON: ":"> +} + +<*> TOKEN: /* SEMICOLON */ +{ + <SEMICOLON: ";"> +} + +TOKEN : /* LEFT BRACE */ +{ + <LEFT_BRACE: "{"> : IN_RULE +} + +<IN_RULE> TOKEN : /* RIGHT BRACE */ +{ + <RIGHT_BRACE: "}"> : DEFAULT +} + +<IN_RULE> TOKEN : /* JAVA_CODE_RULE START */ +{ + <JAVA_CODE_START: <LEFT_BRACE>> : JAVA_CODE_RULE +} + +<JAVA_CODE_RULE> TOKEN : /* JAVA_CODE_RULE */ +{ + <JAVA_CODE: (~["}"])+ > +} + +<JAVA_CODE_RULE> TOKEN : /* JAVA_CODE_RULE END */ +{ + <JAVA_CODE_END: <RIGHT_BRACE>> : IN_RULE +} + + +<IN_PSEUDOCLASS> TOKEN : /* PROGRAMMATIC_PSEUDOCLASS */ +{ + <PROGRAMMATIC_PSEUDOCLASS: "{" (~["}"])+ "}"> : DEFAULT +} + +<IN_RULE> TOKEN : /* STRINGS */ +{ + <STRING: "\"" (~["\"", "\\", "\n", "\r"])* "\""> +} + +<IN_RULE> TOKEN : /* COLORS */ +{ + <HEXCOLOR: "#" <HEXDIGIT> <HEXDIGIT> <HEXDIGIT> (<HEXDIGIT> <HEXDIGIT> <HEXDIGIT>)?> +| + <#HEXDIGIT: ["0"-"9", "a"-"f", "A"-"F"]> +} + + +<IN_RULE> TOKEN : /* EMS */ +{ + <EMS: <DECIMAL_LITERAL> "em"> +} + + +<IN_RULE> TOKEN : /* EXS */ +{ + <EXS: <DECIMAL_LITERAL> "ex"> +} + + +<IN_RULE> TOKEN : /* LENGTH */ +{ + <LENGTH: <DECIMAL_LITERAL> ("pt" | "mm" | "cm" | "pc" | "in")> +} + + +SimpleNode Stylesheet() : {/*@bgen(jjtree) Stylesheet */ + SimpleNode jjtn000 = new SimpleNode(JJTSTYLESHEET); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) Stylesheet */ + try { +/*@egen*/ + (Rule())*/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + } +/*@egen*/ + { return jjtn000; }/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + + +void Rule() : {/*@bgen(jjtree) Rule */ + SimpleNode jjtn000 = new SimpleNode(JJTRULE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) Rule */ + try { +/*@egen*/ + Selectors() + <LEFT_BRACE> Declaration() (";" (Declaration())?)* <RIGHT_BRACE>/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + + +void Selectors() : {/*@bgen(jjtree) Selectors */ + SimpleNode jjtn000 = new SimpleNode(JJTSELECTORS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) Selectors */ + try { +/*@egen*/ + Selector() ("," Selector())*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + + +void Selector() : {/*@bgen(jjtree) Selector */ + SimpleNode jjtn000 = new SimpleNode(JJTSELECTOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) Selector */ + try { +/*@egen*/ + JavaClass() (Id())? (Class())? (PseudoClass())? +| + Id() (Class())? (PseudoClass())? +| + Class() (PseudoClass())? +| + PseudoClass()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + + +void JavaClass() : {/*@bgen(jjtree) JavaClass */ + SimpleNode jjtn000 = new SimpleNode(JJTJAVACLASS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) JavaClass */ + try { +/*@egen*/ + <IDENTIFIER> | "*"/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + + +void Id() : {/*@bgen(jjtree) Id */ + SimpleNode jjtn000 = new SimpleNode(JJTID); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) Id */ + try { +/*@egen*/ + "#" <IDENTIFIER>/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + + +void Class() : {/*@bgen(jjtree) Class */ + SimpleNode jjtn000 = new SimpleNode(JJTCLASS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) Class */ + try { +/*@egen*/ + "." <IDENTIFIER>/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + + +void PseudoClass() : {/*@bgen(jjtree) PseudoClass */ + SimpleNode jjtn000 = new SimpleNode(JJTPSEUDOCLASS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) PseudoClass */ + try { +/*@egen*/ + <PSEUDOCLASS_COLON> (<PSEUDOCLASS_IDENTIFIER> | <PROGRAMMATIC_PSEUDOCLASS>) (AnimationProperties())?/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + + +void AnimationProperties() : {/*@bgen(jjtree) AnimationProperties */ + SimpleNode jjtn000 = new SimpleNode(JJTANIMATIONPROPERTIES); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) AnimationProperties */ + try { +/*@egen*/ + "[" AnimationProperty() ("," AnimationProperty())* "]"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + + +void AnimationProperty() : {/*@bgen(jjtree) AnimationProperty */ + SimpleNode jjtn000 = new SimpleNode(JJTANIMATIONPROPERTY); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) AnimationProperty */ + try { +/*@egen*/ + <IDENTIFIER> "=" <DECIMAL_LITERAL> (<IDENTIFIER>)?/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + + +void Declaration() : {/*@bgen(jjtree) Declaration */ + SimpleNode jjtn000 = new SimpleNode(JJTDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) Declaration */ + try { +/*@egen*/ + Property() <COLON> Expression()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + + +void Property() : {/*@bgen(jjtree) Property */ + SimpleNode jjtn000 = new SimpleNode(JJTPROPERTY); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) Property */ + try { +/*@egen*/ + <IDENTIFIER>/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + + +void Expression() : {/*@bgen(jjtree) Expression */ + SimpleNode jjtn000 = new SimpleNode(JJTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) Expression */ + try { +/*@egen*/ + (<DECIMAL_LITERAL> | <STRING> | <IDENTIFIER> | <HEXCOLOR> | <EMS> | <EXS> | <LENGTH> | + JavaCode())/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + + +void JavaCode() : {/*@bgen(jjtree) JavaCode */ + SimpleNode jjtn000 = new SimpleNode(JJTJAVACODE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) JavaCode */ + try { +/*@egen*/ + <JAVA_CODE_START> <JAVA_CODE> <JAVA_CODE_END>/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + + +void Identifier() : {/*@bgen(jjtree) Identifier */ + SimpleNode jjtn000 = new SimpleNode(JJTIDENTIFIER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) Identifier */ + try { +/*@egen*/ + <IDENTIFIER>/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSS.jjt b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSS.jjt new file mode 100644 index 0000000..80cc349 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSS.jjt @@ -0,0 +1,256 @@ +/* + * Copyright 2006 Ethan Nicholas. All rights reserved. + * Use is subject to license terms. + */ + +// I would love to have used an existing CSS parser, but all of the ones I could +// find are licensed under the LGPL. As JAXX is BSD licensed and I'm not a big +// fan of the LGPL, unfortunately that won't work. +options { + STATIC = false; + JDK_VERSION = "1.4"; + NODE_SCOPE_HOOK = true; +} + +PARSER_BEGIN(CSSParser) +package jaxx.css; + +public class CSSParser { + public SimpleNode popNode() { + if ( jjtree.nodeArity() > 0) // number of child nodes + return (SimpleNode)jjtree.popNode(); + else + return null; + } + + void jjtreeOpenNodeScope(Node n) { + ((SimpleNode) n).firstToken = getToken(1); + } + + void jjtreeCloseNodeScope(Node n) { + ((SimpleNode) n).lastToken = getToken(0); + } + + public static void main(String args[]) { + System.out.println("Reading from standard input..."); + CSSParser css = new CSSParser(System.in); + try { + SimpleNode n = css.Stylesheet(); + n.dump(""); + System.out.println("Thank you."); + } catch (Exception e) { + System.out.println("Oops."); + System.out.println(e.getMessage()); + e.printStackTrace(); + } + } +} + +PARSER_END(CSSParser) + + +<DEFAULT, IN_RULE> SKIP : +{ + " " +| "\t" +| "\n" +| "\r" +| <"//" (~["\n","\r"])* ("\n"|"\r"|"\r\n")> +| <"/*" (~["*"])* "*" (~["/"] (~["*"])* "*")* "/"> +} + +<*> TOKEN : /* LITERALS */ +{ + <DECIMAL_LITERAL: <INTEGER_LITERAL> ("." <INTEGER_LITERAL>)?> +| + <#INTEGER_LITERAL: (["0"-"9"])+> +} + +<DEFAULT, IN_RULE> TOKEN : /* IDENTIFIER */ +{ + <IDENTIFIER: <LETTER> (<LETTER>|<DIGIT>)*> +| + <#LETTER: ["_", "-", "a"-"z", "A"-"Z"]> +| + <#DIGIT: ["0"-"9"]> +} + +<IN_PSEUDOCLASS> TOKEN : /* PSEUDOCLASS_IDENTIFIER */ +{ + <PSEUDOCLASS_IDENTIFIER: <IDENTIFIER>> : DEFAULT +} + +<DEFAULT> TOKEN: /* COLON */ +{ + <PSEUDOCLASS_COLON: ":"> : IN_PSEUDOCLASS +} + +<IN_RULE> TOKEN: /* COLON_IN_RULE */ +{ + <COLON: ":"> +} + +<*> TOKEN: /* SEMICOLON */ +{ + <SEMICOLON: ";"> +} + +TOKEN : /* LEFT BRACE */ +{ + <LEFT_BRACE: "{"> : IN_RULE +} + +<IN_RULE> TOKEN : /* RIGHT BRACE */ +{ + <RIGHT_BRACE: "}"> : DEFAULT +} + +<IN_RULE> TOKEN : /* JAVA_CODE_RULE START */ +{ + <JAVA_CODE_START: <LEFT_BRACE>> : JAVA_CODE_RULE +} + +<JAVA_CODE_RULE> TOKEN : /* JAVA_CODE_RULE */ +{ + <JAVA_CODE: (~["}"])+ > +} + +<JAVA_CODE_RULE> TOKEN : /* JAVA_CODE_RULE END */ +{ + <JAVA_CODE_END: <RIGHT_BRACE>> : IN_RULE +} + + +<IN_PSEUDOCLASS> TOKEN : /* PROGRAMMATIC_PSEUDOCLASS */ +{ + <PROGRAMMATIC_PSEUDOCLASS: "{" (~["}"])+ "}"> : DEFAULT +} + +<IN_RULE> TOKEN : /* STRINGS */ +{ + <STRING: "\"" (~["\"", "\\", "\n", "\r"])* "\""> +} + +<IN_RULE> TOKEN : /* COLORS */ +{ + <HEXCOLOR: "#" <HEXDIGIT> <HEXDIGIT> <HEXDIGIT> (<HEXDIGIT> <HEXDIGIT> <HEXDIGIT>)?> +| + <#HEXDIGIT: ["0"-"9", "a"-"f", "A"-"F"]> +} + + +<IN_RULE> TOKEN : /* EMS */ +{ + <EMS: <DECIMAL_LITERAL> "em"> +} + + +<IN_RULE> TOKEN : /* EXS */ +{ + <EXS: <DECIMAL_LITERAL> "ex"> +} + + +<IN_RULE> TOKEN : /* LENGTH */ +{ + <LENGTH: <DECIMAL_LITERAL> ("pt" | "mm" | "cm" | "pc" | "in")> +} + + +SimpleNode Stylesheet() : {} +{ + (Rule())* + { return jjtThis; } +} + + +void Rule() : {} +{ + Selectors() + <LEFT_BRACE> Declaration() (";" (Declaration())?)* <RIGHT_BRACE> +} + + +void Selectors() : {} +{ + Selector() ("," Selector())* +} + + +void Selector() : {} +{ + JavaClass() (Id())? (Class())? (PseudoClass())? +| + Id() (Class())? (PseudoClass())? +| + Class() (PseudoClass())? +| + PseudoClass() +} + + +void JavaClass() : {} +{ + <IDENTIFIER> | "*" +} + + +void Id() : {} +{ + "#" <IDENTIFIER> +} + + +void Class() : {} +{ + "." <IDENTIFIER> +} + + +void PseudoClass() : {} +{ + <PSEUDOCLASS_COLON> (<PSEUDOCLASS_IDENTIFIER> | <PROGRAMMATIC_PSEUDOCLASS>) (AnimationProperties())? +} + + +void AnimationProperties() : {} +{ + "[" AnimationProperty() ("," AnimationProperty())* "]" +} + + +void AnimationProperty() : {} +{ + <IDENTIFIER> "=" <DECIMAL_LITERAL> (<IDENTIFIER>)? +} + + +void Declaration() : {} +{ + Property() <COLON> Expression() +} + + +void Property() : {} +{ + <IDENTIFIER> +} + + +void Expression() : {} +{ + (<DECIMAL_LITERAL> | <STRING> | <IDENTIFIER> | <HEXCOLOR> | <EMS> | <EXS> | <LENGTH> | + JavaCode()) +} + + +void JavaCode() : {} +{ + <JAVA_CODE_START> <JAVA_CODE> <JAVA_CODE_END> +} + + +void Identifier() : {} +{ + <IDENTIFIER> +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParser.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParser.java new file mode 100644 index 0000000..4f90ef9 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParser.java @@ -0,0 +1,799 @@ +/* Generated By:JJTree&JavaCC: Do not edit this line. CSSParser.java */ +package jaxx.compiler.css.parser; + +public class CSSParser/*@bgen(jjtree)*/ implements CSSParserTreeConstants, CSSParserConstants {/*@bgen(jjtree)*/ + protected JJTCSSParserState jjtree = new JJTCSSParserState(); + + public SimpleNode popNode() { + if (jjtree.nodeArity() > 0) // number of child nodes + return (SimpleNode) jjtree.popNode(); + else + return null; + } + + void jjtreeOpenNodeScope(Node n) { + ((SimpleNode) n).firstToken = getToken(1); + } + + void jjtreeCloseNodeScope(Node n) { + ((SimpleNode) n).lastToken = getToken(0); + } + + public static void main(String args[]) { + System.out.println("Reading from standard input..."); + CSSParser css = new CSSParser(System.in); + try { + SimpleNode n = css.Stylesheet(); + n.dump(""); + System.out.println("Thank you."); + } catch (Exception e) { + System.out.println("Oops."); + System.out.println(e.getMessage()); + e.printStackTrace(); + } + } + + final public SimpleNode Stylesheet() throws ParseException { + /*@bgen(jjtree) Stylesheet */ + SimpleNode jjtn000 = new SimpleNode(JJTSTYLESHEET); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + label_1: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case IDENTIFIER: + case PSEUDOCLASS_COLON: + case 29: + case 30: + case 31: + ; + break; + default: + jj_la1[0] = jj_gen; + break label_1; + } + Rule(); + } + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + { + if (true) return jjtn000; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + throw new Error("Missing return statement in function"); + } + + final public void Rule() throws ParseException { + /*@bgen(jjtree) Rule */ + SimpleNode jjtn000 = new SimpleNode(JJTRULE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + Selectors(); + jj_consume_token(LEFT_BRACE); + Declaration(); + label_2: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case SEMICOLON: + ; + break; + default: + jj_la1[1] = jj_gen; + break label_2; + } + jj_consume_token(SEMICOLON); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case IDENTIFIER: + Declaration(); + break; + default: + jj_la1[2] = jj_gen; + ; + } + } + jj_consume_token(RIGHT_BRACE); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Selectors() throws ParseException { + /*@bgen(jjtree) Selectors */ + SimpleNode jjtn000 = new SimpleNode(JJTSELECTORS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + Selector(); + label_3: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case 28: + ; + break; + default: + jj_la1[3] = jj_gen; + break label_3; + } + jj_consume_token(28); + Selector(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Selector() throws ParseException { + /*@bgen(jjtree) Selector */ + SimpleNode jjtn000 = new SimpleNode(JJTSELECTOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case IDENTIFIER: + case 29: + JavaClass(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case 30: + Id(); + break; + default: + jj_la1[4] = jj_gen; + ; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case 31: + Class(); + break; + default: + jj_la1[5] = jj_gen; + ; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case PSEUDOCLASS_COLON: + PseudoClass(); + break; + default: + jj_la1[6] = jj_gen; + ; + } + break; + case 30: + Id(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case 31: + Class(); + break; + default: + jj_la1[7] = jj_gen; + ; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case PSEUDOCLASS_COLON: + PseudoClass(); + break; + default: + jj_la1[8] = jj_gen; + ; + } + break; + case 31: + Class(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case PSEUDOCLASS_COLON: + PseudoClass(); + break; + default: + jj_la1[9] = jj_gen; + ; + } + break; + case PSEUDOCLASS_COLON: + PseudoClass(); + break; + default: + jj_la1[10] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void JavaClass() throws ParseException { + /*@bgen(jjtree) JavaClass */ + SimpleNode jjtn000 = new SimpleNode(JJTJAVACLASS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case IDENTIFIER: + jj_consume_token(IDENTIFIER); + break; + case 29: + jj_consume_token(29); + break; + default: + jj_la1[11] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Id() throws ParseException { + /*@bgen(jjtree) Id */ + SimpleNode jjtn000 = new SimpleNode(JJTID); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(30); + jj_consume_token(IDENTIFIER); + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Class() throws ParseException { + /*@bgen(jjtree) Class */ + SimpleNode jjtn000 = new SimpleNode(JJTCLASS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(31); + jj_consume_token(IDENTIFIER); + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void PseudoClass() throws ParseException { + /*@bgen(jjtree) PseudoClass */ + SimpleNode jjtn000 = new SimpleNode(JJTPSEUDOCLASS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(PSEUDOCLASS_COLON); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case PSEUDOCLASS_IDENTIFIER: + jj_consume_token(PSEUDOCLASS_IDENTIFIER); + break; + case PROGRAMMATIC_PSEUDOCLASS: + jj_consume_token(PROGRAMMATIC_PSEUDOCLASS); + break; + default: + jj_la1[12] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case 32: + AnimationProperties(); + break; + default: + jj_la1[13] = jj_gen; + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void AnimationProperties() throws ParseException { + /*@bgen(jjtree) AnimationProperties */ + SimpleNode jjtn000 = new SimpleNode(JJTANIMATIONPROPERTIES); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(32); + AnimationProperty(); + label_4: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case 28: + ; + break; + default: + jj_la1[14] = jj_gen; + break label_4; + } + jj_consume_token(28); + AnimationProperty(); + } + jj_consume_token(33); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void AnimationProperty() throws ParseException { + /*@bgen(jjtree) AnimationProperty */ + SimpleNode jjtn000 = new SimpleNode(JJTANIMATIONPROPERTY); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(IDENTIFIER); + jj_consume_token(34); + jj_consume_token(DECIMAL_LITERAL); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case IDENTIFIER: + jj_consume_token(IDENTIFIER); + break; + default: + jj_la1[15] = jj_gen; + ; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Declaration() throws ParseException { + /*@bgen(jjtree) Declaration */ + SimpleNode jjtn000 = new SimpleNode(JJTDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + Property(); + jj_consume_token(COLON); + Expression(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Property() throws ParseException { + /*@bgen(jjtree) Property */ + SimpleNode jjtn000 = new SimpleNode(JJTPROPERTY); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(IDENTIFIER); + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Expression() throws ParseException { + /*@bgen(jjtree) Expression */ + SimpleNode jjtn000 = new SimpleNode(JJTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case DECIMAL_LITERAL: + jj_consume_token(DECIMAL_LITERAL); + break; + case STRING: + jj_consume_token(STRING); + break; + case IDENTIFIER: + jj_consume_token(IDENTIFIER); + break; + case HEXCOLOR: + jj_consume_token(HEXCOLOR); + break; + case EMS: + jj_consume_token(EMS); + break; + case EXS: + jj_consume_token(EXS); + break; + case LENGTH: + jj_consume_token(LENGTH); + break; + case JAVA_CODE_START: + JavaCode(); + break; + default: + jj_la1[16] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void JavaCode() throws ParseException { + /*@bgen(jjtree) JavaCode */ + SimpleNode jjtn000 = new SimpleNode(JJTJAVACODE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(JAVA_CODE_START); + jj_consume_token(JAVA_CODE); + jj_consume_token(JAVA_CODE_END); + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Identifier() throws ParseException { + /*@bgen(jjtree) Identifier */ + SimpleNode jjtn000 = new SimpleNode(JJTIDENTIFIER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(IDENTIFIER); + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + public CSSParserTokenManager token_source; + SimpleCharStream jj_input_stream; + public Token token, jj_nt; + private int jj_ntk; + private int jj_gen; + final private int[] jj_la1 = new int[17]; + static private int[] jj_la1_0; + static private int[] jj_la1_1; + + static { + jj_la1_0(); + jj_la1_1(); + } + + private static void jj_la1_0() { + jj_la1_0 = new int[]{0xe0002200, 0x8000, 0x200, 0x10000000, 0x40000000, 0x80000000, 0x2000, 0x80000000, 0x2000, 0x2000, 0xe0002200, 0x20000200, 0x201000, 0x0, 0x10000000, 0x200, 0xec40280,}; + } + + private static void jj_la1_1() { + jj_la1_1 = new int[]{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,}; + } + + public CSSParser(java.io.InputStream stream) { + this(stream, null); + } + + public CSSParser(java.io.InputStream stream, String encoding) { + try { + jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); + } catch (java.io.UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + token_source = new CSSParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 17; i++) jj_la1[i] = -1; + } + + public void ReInit(java.io.InputStream stream) { + ReInit(stream, null); + } + + public void ReInit(java.io.InputStream stream, String encoding) { + try { + jj_input_stream.ReInit(stream, encoding, 1, 1); + } catch (java.io.UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jjtree.reset(); + jj_gen = 0; + for (int i = 0; i < 17; i++) jj_la1[i] = -1; + } + + public CSSParser(java.io.Reader stream) { + jj_input_stream = new SimpleCharStream(stream, 1, 1); + token_source = new CSSParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 17; i++) jj_la1[i] = -1; + } + + public void ReInit(java.io.Reader stream) { + jj_input_stream.ReInit(stream, 1, 1); + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jjtree.reset(); + jj_gen = 0; + for (int i = 0; i < 17; i++) jj_la1[i] = -1; + } + + public CSSParser(CSSParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 17; i++) jj_la1[i] = -1; + } + + public void ReInit(CSSParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jjtree.reset(); + jj_gen = 0; + for (int i = 0; i < 17; i++) jj_la1[i] = -1; + } + + final private Token jj_consume_token(int kind) throws ParseException { + Token oldToken; + if ((oldToken = token).next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + jj_gen++; + return token; + } + token = oldToken; + jj_kind = kind; + throw generateParseException(); + } + + final public Token getNextToken() { + if (token.next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + jj_gen++; + return token; + } + + final public Token getToken(int index) { + Token t = token; + for (int i = 0; i < index; i++) { + if (t.next != null) t = t.next; + else t = t.next = token_source.getNextToken(); + } + return t; + } + + final private int jj_ntk() { + if ((jj_nt = token.next) == null) + return (jj_ntk = (token.next = token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); + } + + private java.util.Vector jj_expentries = new java.util.Vector(); + private int[] jj_expentry; + private int jj_kind = -1; + + public ParseException generateParseException() { + Token errortok = token.next; + int line = errortok.beginLine, column = errortok.beginColumn; + String mess = (errortok.kind == 0) ? tokenImage[0] : errortok.image; + return new ParseException("Parse error. Encountered: " + mess, line, column); + } + + final public void enable_tracing() { + } + + final public void disable_tracing() { + } + +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserConstants.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserConstants.java new file mode 100644 index 0000000..be8dba5 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserConstants.java @@ -0,0 +1,72 @@ +/* Generated By:JJTree&JavaCC: Do not edit this line. CSSParserConstants.java */ +package jaxx.compiler.css.parser; + +public interface CSSParserConstants { + + int EOF = 0; + int DECIMAL_LITERAL = 7; + int INTEGER_LITERAL = 8; + int IDENTIFIER = 9; + int LETTER = 10; + int DIGIT = 11; + int PSEUDOCLASS_IDENTIFIER = 12; + int PSEUDOCLASS_COLON = 13; + int COLON = 14; + int SEMICOLON = 15; + int LEFT_BRACE = 16; + int RIGHT_BRACE = 17; + int JAVA_CODE_START = 18; + int JAVA_CODE = 19; + int JAVA_CODE_END = 20; + int PROGRAMMATIC_PSEUDOCLASS = 21; + int STRING = 22; + int HEXCOLOR = 23; + int HEXDIGIT = 24; + int EMS = 25; + int EXS = 26; + int LENGTH = 27; + + int DEFAULT = 0; + int IN_RULE = 1; + int JAVA_CODE_RULE = 2; + int IN_PSEUDOCLASS = 3; + + String[] tokenImage = { + "<EOF>", + "\" \"", + "\"\\t\"", + "\"\\n\"", + "\"\\r\"", + "<token of kind 5>", + "<token of kind 6>", + "<DECIMAL_LITERAL>", + "<INTEGER_LITERAL>", + "<IDENTIFIER>", + "<LETTER>", + "<DIGIT>", + "<PSEUDOCLASS_IDENTIFIER>", + "\":\"", + "\":\"", + "\";\"", + "\"{\"", + "\"}\"", + "<JAVA_CODE_START>", + "<JAVA_CODE>", + "<JAVA_CODE_END>", + "<PROGRAMMATIC_PSEUDOCLASS>", + "<STRING>", + "<HEXCOLOR>", + "<HEXDIGIT>", + "<EMS>", + "<EXS>", + "<LENGTH>", + "\",\"", + "\"*\"", + "\"#\"", + "\".\"", + "\"[\"", + "\"]\"", + "\"=\"", + }; + +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTokenManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTokenManager.java new file mode 100644 index 0000000..9b67ccb --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTokenManager.java @@ -0,0 +1,1152 @@ +/* Generated By:JJTree&JavaCC: Do not edit this line. CSSParserTokenManager.java */ +package jaxx.compiler.css.parser; + +public class CSSParserTokenManager implements CSSParserConstants { + public java.io.PrintStream debugStream = System.out; + + public void setDebugStream(java.io.PrintStream ds) { + debugStream = ds; + } + + private int jjStopStringLiteralDfa_0(int pos, long active0) { + switch (pos) { + default: + return -1; + } + } + + private int jjStartNfa_0(int pos, long active0) { + return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); + } + + private int jjStopAtPos(int pos, int kind) { + jjmatchedKind = kind; + jjmatchedPos = pos; + return pos + 1; + } + + private int jjStartNfaWithStates_0(int pos, int kind, int state) { + jjmatchedKind = kind; + jjmatchedPos = pos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return pos + 1; + } + return jjMoveNfa_0(state, pos + 1); + } + + private int jjMoveStringLiteralDfa0_0() { + switch (curChar) { + case 35: + return jjStopAtPos(0, 30); + case 42: + return jjStopAtPos(0, 29); + case 44: + return jjStopAtPos(0, 28); + case 46: + return jjStopAtPos(0, 31); + case 58: + return jjStopAtPos(0, 13); + case 59: + return jjStopAtPos(0, 15); + case 61: + return jjStopAtPos(0, 34); + case 91: + return jjStopAtPos(0, 32); + case 93: + return jjStopAtPos(0, 33); + case 123: + return jjStopAtPos(0, 16); + default: + return jjMoveNfa_0(3, 0); + } + } + + private void jjCheckNAdd(int state) { + if (jjrounds[state] != jjround) { + jjstateSet[jjnewStateCnt++] = state; + jjrounds[state] = jjround; + } + } + + private void jjAddStates(int start, int end) { + do { + jjstateSet[jjnewStateCnt++] = jjnextStates[start]; + } while (start++ != end); + } + + private void jjCheckNAddTwoStates(int state1, int state2) { + jjCheckNAdd(state1); + jjCheckNAdd(state2); + } + + private void jjCheckNAddStates(int start, int end) { + do { + jjCheckNAdd(jjnextStates[start]); + } while (start++ != end); + } + + private void jjCheckNAddStates(int start) { + jjCheckNAdd(jjnextStates[start]); + jjCheckNAdd(jjnextStates[start + 1]); + } + + static final long[] jjbitVec0 = { + 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL + }; + + private int jjMoveNfa_0(int startState, int curPos) { + int[] nextStates; + int startsAt = 0; + jjnewStateCnt = 17; + int i = 1; + jjstateSet[0] = startState; + int j, kind = 0x7fffffff; + for (; ;) { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) { + long l = 1L << curChar; + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 3: + if ((0x3ff000000000000L & l) != 0L) { + if (kind > 7) + kind = 7; + jjCheckNAddTwoStates(0, 1); + } else if (curChar == 47) + jjAddStates(0, 1); + else if (curChar == 45) { + if (kind > 9) + kind = 9; + jjCheckNAdd(4); + } + break; + case 0: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 7) + kind = 7; + jjCheckNAddTwoStates(0, 1); + break; + case 1: + if (curChar == 46) + jjCheckNAdd(2); + break; + case 2: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 7) + kind = 7; + jjCheckNAdd(2); + break; + case 4: + if ((0x3ff200000000000L & l) == 0L) + break; + if (kind > 9) + kind = 9; + jjCheckNAdd(4); + break; + case 5: + if (curChar == 47) + jjAddStates(0, 1); + break; + case 6: + if (curChar == 47) + jjCheckNAddStates(2, 4); + break; + case 7: + if ((0xffffffffffffdbffL & l) != 0L) + jjCheckNAddStates(2, 4); + break; + case 8: + if ((0x2400L & l) != 0L && kind > 5) + kind = 5; + break; + case 9: + if (curChar == 10 && kind > 5) + kind = 5; + break; + case 10: + if (curChar == 13) + jjstateSet[jjnewStateCnt++] = 9; + break; + case 11: + if (curChar == 42) + jjCheckNAddTwoStates(12, 13); + break; + case 12: + if ((0xfffffbffffffffffL & l) != 0L) + jjCheckNAddTwoStates(12, 13); + break; + case 13: + if (curChar == 42) + jjAddStates(5, 6); + break; + case 14: + if ((0xffff7fffffffffffL & l) != 0L) + jjCheckNAddTwoStates(15, 13); + break; + case 15: + if ((0xfffffbffffffffffL & l) != 0L) + jjCheckNAddTwoStates(15, 13); + break; + case 16: + if (curChar == 47 && kind > 6) + kind = 6; + break; + default: + break; + } + } while (i != startsAt); + } else if (curChar < 128) { + long l = 1L << (curChar & 077); + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 3: + case 4: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 9) + kind = 9; + jjCheckNAdd(4); + break; + case 7: + jjAddStates(2, 4); + break; + case 12: + jjCheckNAddTwoStates(12, 13); + break; + case 14: + case 15: + jjCheckNAddTwoStates(15, 13); + break; + default: + break; + } + } while (i != startsAt); + } else { + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 7: + if ((jjbitVec0[i2] & l2) != 0L) + jjAddStates(2, 4); + break; + case 12: + if ((jjbitVec0[i2] & l2) != 0L) + jjCheckNAddTwoStates(12, 13); + break; + case 14: + case 15: + if ((jjbitVec0[i2] & l2) != 0L) + jjCheckNAddTwoStates(15, 13); + break; + default: + break; + } + } while (i != startsAt); + } + if (kind != 0x7fffffff) { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 17 - (jjnewStateCnt = startsAt))) + return curPos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return curPos; + } + } + } + + private int jjStopStringLiteralDfa_3(int pos, long active0) { + switch (pos) { + default: + return -1; + } + } + + private int jjStartNfa_3(int pos, long active0) { + return jjMoveNfa_3(jjStopStringLiteralDfa_3(pos, active0), pos + 1); + } + + private int jjStartNfaWithStates_3(int pos, int kind, int state) { + jjmatchedKind = kind; + jjmatchedPos = pos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return pos + 1; + } + return jjMoveNfa_3(state, pos + 1); + } + + private int jjMoveStringLiteralDfa0_3() { + switch (curChar) { + case 59: + return jjStopAtPos(0, 15); + default: + return jjMoveNfa_3(3, 0); + } + } + + private int jjMoveNfa_3(int startState, int curPos) { + int[] nextStates; + int startsAt = 0; + jjnewStateCnt = 8; + int i = 1; + jjstateSet[0] = startState; + int j, kind = 0x7fffffff; + for (; ;) { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) { + long l = 1L << curChar; + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 3: + if ((0x3ff000000000000L & l) != 0L) { + if (kind > 7) + kind = 7; + jjCheckNAddTwoStates(0, 1); + } else if (curChar == 45) { + if (kind > 12) + kind = 12; + jjCheckNAdd(4); + } + break; + case 0: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 7) + kind = 7; + jjCheckNAddTwoStates(0, 1); + break; + case 1: + if (curChar == 46) + jjCheckNAdd(2); + break; + case 2: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 7) + kind = 7; + jjCheckNAdd(2); + break; + case 4: + if ((0x3ff200000000000L & l) == 0L) + break; + if (kind > 12) + kind = 12; + jjCheckNAdd(4); + break; + case 6: + jjAddStates(7, 8); + break; + default: + break; + } + } while (i != startsAt); + } else if (curChar < 128) { + long l = 1L << (curChar & 077); + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 3: + if ((0x7fffffe87fffffeL & l) != 0L) { + if (kind > 12) + kind = 12; + jjCheckNAdd(4); + } else if (curChar == 123) + jjCheckNAdd(6); + break; + case 4: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 12) + kind = 12; + jjCheckNAdd(4); + break; + case 5: + if (curChar == 123) + jjCheckNAdd(6); + break; + case 6: + if ((0xdfffffffffffffffL & l) != 0L) + jjCheckNAddTwoStates(6, 7); + break; + case 7: + if (curChar == 125) + kind = 21; + break; + default: + break; + } + } while (i != startsAt); + } else { + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 6: + if ((jjbitVec0[i2] & l2) != 0L) + jjAddStates(7, 8); + break; + default: + break; + } + } while (i != startsAt); + } + if (kind != 0x7fffffff) { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 8 - (jjnewStateCnt = startsAt))) + return curPos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return curPos; + } + } + } + + private int jjStopStringLiteralDfa_1(int pos, long active0) { + switch (pos) { + default: + return -1; + } + } + + private int jjStartNfa_1(int pos, long active0) { + return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0), pos + 1); + } + + private int jjStartNfaWithStates_1(int pos, int kind, int state) { + jjmatchedKind = kind; + jjmatchedPos = pos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return pos + 1; + } + return jjMoveNfa_1(state, pos + 1); + } + + private int jjMoveStringLiteralDfa0_1() { + switch (curChar) { + case 58: + return jjStopAtPos(0, 14); + case 59: + return jjStopAtPos(0, 15); + case 125: + return jjStopAtPos(0, 17); + default: + return jjMoveNfa_1(0, 0); + } + } + + private int jjMoveNfa_1(int startState, int curPos) { + int[] nextStates; + int startsAt = 0; + jjnewStateCnt = 50; + int i = 1; + jjstateSet[0] = startState; + int j, kind = 0x7fffffff; + for (; ;) { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) { + long l = 1L << curChar; + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 0: + if ((0x3ff000000000000L & l) != 0L) { + if (kind > 7) + kind = 7; + jjCheckNAddStates(9, 22); + } else if (curChar == 47) + jjAddStates(23, 24); + else if (curChar == 35) + jjstateSet[jjnewStateCnt++] = 7; + else if (curChar == 34) + jjCheckNAddTwoStates(4, 5); + else if (curChar == 45) { + if (kind > 9) + kind = 9; + jjCheckNAdd(1); + } + break; + case 1: + if ((0x3ff200000000000L & l) == 0L) + break; + if (kind > 9) + kind = 9; + jjCheckNAdd(1); + break; + case 3: + if (curChar == 34) + jjCheckNAddTwoStates(4, 5); + break; + case 4: + if ((0xfffffffbffffdbffL & l) != 0L) + jjCheckNAddTwoStates(4, 5); + break; + case 5: + if (curChar == 34 && kind > 22) + kind = 22; + break; + case 6: + if (curChar == 35) + jjstateSet[jjnewStateCnt++] = 7; + break; + case 7: + if ((0x3ff000000000000L & l) != 0L) + jjstateSet[jjnewStateCnt++] = 8; + break; + case 8: + if ((0x3ff000000000000L & l) != 0L) + jjstateSet[jjnewStateCnt++] = 9; + break; + case 9: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 23) + kind = 23; + jjstateSet[jjnewStateCnt++] = 10; + break; + case 10: + if ((0x3ff000000000000L & l) != 0L) + jjstateSet[jjnewStateCnt++] = 11; + break; + case 11: + if ((0x3ff000000000000L & l) != 0L) + jjstateSet[jjnewStateCnt++] = 12; + break; + case 12: + if ((0x3ff000000000000L & l) != 0L && kind > 23) + kind = 23; + break; + case 13: + if (curChar == 47) + jjAddStates(23, 24); + break; + case 14: + if (curChar == 47) + jjCheckNAddStates(25, 27); + break; + case 15: + if ((0xffffffffffffdbffL & l) != 0L) + jjCheckNAddStates(25, 27); + break; + case 16: + if ((0x2400L & l) != 0L && kind > 5) + kind = 5; + break; + case 17: + if (curChar == 10 && kind > 5) + kind = 5; + break; + case 18: + if (curChar == 13) + jjstateSet[jjnewStateCnt++] = 17; + break; + case 19: + if (curChar == 42) + jjCheckNAddTwoStates(20, 21); + break; + case 20: + if ((0xfffffbffffffffffL & l) != 0L) + jjCheckNAddTwoStates(20, 21); + break; + case 21: + if (curChar == 42) + jjAddStates(28, 29); + break; + case 22: + if ((0xffff7fffffffffffL & l) != 0L) + jjCheckNAddTwoStates(23, 21); + break; + case 23: + if ((0xfffffbffffffffffL & l) != 0L) + jjCheckNAddTwoStates(23, 21); + break; + case 24: + if (curChar == 47 && kind > 6) + kind = 6; + break; + case 25: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 7) + kind = 7; + jjCheckNAddStates(9, 22); + break; + case 26: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 7) + kind = 7; + jjCheckNAddTwoStates(26, 27); + break; + case 27: + if (curChar == 46) + jjCheckNAdd(28); + break; + case 28: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 7) + kind = 7; + jjCheckNAdd(28); + break; + case 29: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(30, 32); + break; + case 30: + if (curChar == 46) + jjCheckNAdd(31); + break; + case 31: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(31, 33); + break; + case 34: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(33, 35); + break; + case 35: + if (curChar == 46) + jjCheckNAdd(36); + break; + case 36: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(36, 38); + break; + case 39: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(36, 41); + break; + case 40: + if (curChar == 46) + jjCheckNAdd(41); + break; + case 41: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(42, 46); + break; + default: + break; + } + } while (i != startsAt); + } else if (curChar < 128) { + long l = 1L << (curChar & 077); + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 0: + if ((0x7fffffe87fffffeL & l) != 0L) { + if (kind > 9) + kind = 9; + jjCheckNAdd(1); + } else if (curChar == 123) { + if (kind > 18) + kind = 18; + } + break; + case 1: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 9) + kind = 9; + jjCheckNAdd(1); + break; + case 2: + if (curChar == 123 && kind > 18) + kind = 18; + break; + case 4: + if ((0xffffffffefffffffL & l) != 0L) + jjAddStates(47, 48); + break; + case 7: + if ((0x7e0000007eL & l) != 0L) + jjstateSet[jjnewStateCnt++] = 8; + break; + case 8: + if ((0x7e0000007eL & l) != 0L) + jjstateSet[jjnewStateCnt++] = 9; + break; + case 9: + if ((0x7e0000007eL & l) == 0L) + break; + if (kind > 23) + kind = 23; + jjstateSet[jjnewStateCnt++] = 10; + break; + case 10: + if ((0x7e0000007eL & l) != 0L) + jjstateSet[jjnewStateCnt++] = 11; + break; + case 11: + if ((0x7e0000007eL & l) != 0L) + jjstateSet[jjnewStateCnt++] = 12; + break; + case 12: + if ((0x7e0000007eL & l) != 0L && kind > 23) + kind = 23; + break; + case 15: + jjAddStates(25, 27); + break; + case 20: + jjCheckNAddTwoStates(20, 21); + break; + case 22: + case 23: + jjCheckNAddTwoStates(23, 21); + break; + case 32: + if (curChar == 109 && kind > 25) + kind = 25; + break; + case 33: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 32; + break; + case 37: + if (curChar == 120 && kind > 26) + kind = 26; + break; + case 38: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 37; + break; + case 42: + if (curChar == 109 && kind > 27) + kind = 27; + break; + case 43: + if (curChar == 109) + jjCheckNAdd(42); + break; + case 44: + if (curChar == 99) + jjCheckNAdd(42); + break; + case 45: + if (curChar == 110 && kind > 27) + kind = 27; + break; + case 46: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 45; + break; + case 47: + if (curChar == 112) + jjAddStates(49, 50); + break; + case 48: + if (curChar == 116 && kind > 27) + kind = 27; + break; + case 49: + if (curChar == 99 && kind > 27) + kind = 27; + break; + default: + break; + } + } while (i != startsAt); + } else { + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 4: + if ((jjbitVec0[i2] & l2) != 0L) + jjAddStates(47, 48); + break; + case 15: + if ((jjbitVec0[i2] & l2) != 0L) + jjAddStates(25, 27); + break; + case 20: + if ((jjbitVec0[i2] & l2) != 0L) + jjCheckNAddTwoStates(20, 21); + break; + case 22: + case 23: + if ((jjbitVec0[i2] & l2) != 0L) + jjCheckNAddTwoStates(23, 21); + break; + default: + break; + } + } while (i != startsAt); + } + if (kind != 0x7fffffff) { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 50 - (jjnewStateCnt = startsAt))) + return curPos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return curPos; + } + } + } + + private int jjStopStringLiteralDfa_2(int pos, long active0) { + switch (pos) { + default: + return -1; + } + } + + private int jjStartNfa_2(int pos, long active0) { + return jjMoveNfa_2(jjStopStringLiteralDfa_2(pos, active0), pos + 1); + } + + private int jjStartNfaWithStates_2(int pos, int kind, int state) { + jjmatchedKind = kind; + jjmatchedPos = pos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return pos + 1; + } + return jjMoveNfa_2(state, pos + 1); + } + + private int jjMoveStringLiteralDfa0_2() { + switch (curChar) { + case 59: + return jjStartNfaWithStates_2(0, 15, 3); + default: + return jjMoveNfa_2(4, 0); + } + } + + private int jjMoveNfa_2(int startState, int curPos) { + int[] nextStates; + int startsAt = 0; + jjnewStateCnt = 5; + int i = 1; + jjstateSet[0] = startState; + int j, kind = 0x7fffffff; + for (; ;) { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) { + long l = 1L << curChar; + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 4: + if (kind > 19) + kind = 19; + jjCheckNAdd(3); + if ((0x3ff000000000000L & l) != 0L) { + if (kind > 7) + kind = 7; + jjCheckNAddTwoStates(0, 1); + } + break; + case 0: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 7) + kind = 7; + jjCheckNAddTwoStates(0, 1); + break; + case 1: + if (curChar == 46) + jjCheckNAdd(2); + break; + case 2: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 7) + kind = 7; + jjCheckNAdd(2); + break; + case 3: + if (kind > 19) + kind = 19; + jjCheckNAdd(3); + break; + default: + break; + } + } while (i != startsAt); + } else if (curChar < 128) { + long l = 1L << (curChar & 077); + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 4: + if ((0xdfffffffffffffffL & l) != 0L) { + if (kind > 19) + kind = 19; + jjCheckNAdd(3); + } else if (curChar == 125) { + if (kind > 20) + kind = 20; + } + break; + case 3: + if ((0xdfffffffffffffffL & l) == 0L) + break; + kind = 19; + jjCheckNAdd(3); + break; + default: + break; + } + } while (i != startsAt); + } else { + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 4: + case 3: + if ((jjbitVec0[i2] & l2) == 0L) + break; + if (kind > 19) + kind = 19; + jjCheckNAdd(3); + break; + default: + break; + } + } while (i != startsAt); + } + if (kind != 0x7fffffff) { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 5 - (jjnewStateCnt = startsAt))) + return curPos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return curPos; + } + } + } + + static final int[] jjnextStates = { + 6, 11, 7, 8, 10, 14, 16, 6, 7, 26, 27, 29, 30, 33, 34, 35, + 38, 39, 40, 43, 44, 46, 47, 14, 19, 15, 16, 18, 22, 24, 29, 30, + 33, 34, 35, 38, 39, 40, 43, 44, 46, 47, 41, 43, 44, 46, 47, 4, + 5, 48, 49, + }; + public static final String[] jjstrLiteralImages = { + "", null, null, null, null, null, null, null, null, null, null, null, null, + "\72", "\72", "\73", "\173", "\175", null, null, null, null, null, null, null, null, + null, null, "\54", "\52", "\43", "\56", "\133", "\135", "\75",}; + public static final String[] lexStateNames = { + "DEFAULT", + "IN_RULE", + "JAVA_CODE_RULE", + "IN_PSEUDOCLASS", + }; + public static final int[] jjnewLexState = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 3, -1, -1, 1, 0, 2, -1, 1, 0, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + }; + static final long[] jjtoToken = { + 0x7fefff281L, + }; + static final long[] jjtoSkip = { + 0x7eL, + }; + protected SimpleCharStream input_stream; + private final int[] jjrounds = new int[50]; + private final int[] jjstateSet = new int[100]; + protected char curChar; + + public CSSParserTokenManager(SimpleCharStream stream) { + if (SimpleCharStream.staticFlag) + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + input_stream = stream; + } + + public CSSParserTokenManager(SimpleCharStream stream, int lexState) { + this(stream); + SwitchTo(lexState); + } + + public void ReInit(SimpleCharStream stream) { + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); + } + + private void ReInitRounds() { + int i; + jjround = 0x80000001; + for (i = 50; i-- > 0;) + jjrounds[i] = 0x80000000; + } + + public void ReInit(SimpleCharStream stream, int lexState) { + ReInit(stream); + SwitchTo(lexState); + } + + public void SwitchTo(int lexState) { + if (lexState >= 4 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; + } + + protected Token jjFillToken() { + Token t = Token.newToken(jjmatchedKind); + t.kind = jjmatchedKind; + String im = jjstrLiteralImages[jjmatchedKind]; + t.image = (im == null) ? input_stream.GetImage() : im; + t.beginLine = input_stream.getBeginLine(); + t.beginColumn = input_stream.getBeginColumn(); + t.endLine = input_stream.getEndLine(); + t.endColumn = input_stream.getEndColumn(); + return t; + } + + int curLexState = 0; + int defaultLexState = 0; + int jjnewStateCnt; + int jjround; + int jjmatchedPos; + int jjmatchedKind; + + public Token getNextToken() { + int kind; + Token specialToken = null; + Token matchedToken; + int curPos = 0; + + EOFLoop: + for (; ;) { + try { + curChar = input_stream.BeginToken(); + } + catch (java.io.IOException e) { + jjmatchedKind = 0; + matchedToken = jjFillToken(); + return matchedToken; + } + + switch (curLexState) { + case 0: + try { + input_stream.backup(0); + while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L) + curChar = input_stream.BeginToken(); + } + catch (java.io.IOException e1) { + continue EOFLoop; + } + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_0(); + break; + case 1: + try { + input_stream.backup(0); + while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L) + curChar = input_stream.BeginToken(); + } + catch (java.io.IOException e1) { + continue EOFLoop; + } + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_1(); + break; + case 2: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_2(); + break; + case 3: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_3(); + break; + } + if (jjmatchedKind != 0x7fffffff) { + if (jjmatchedPos + 1 < curPos) + input_stream.backup(curPos - jjmatchedPos - 1); + if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { + matchedToken = jjFillToken(); + if (jjnewLexState[jjmatchedKind] != -1) + curLexState = jjnewLexState[jjmatchedKind]; + return matchedToken; + } else { + if (jjnewLexState[jjmatchedKind] != -1) + curLexState = jjnewLexState[jjmatchedKind]; + continue EOFLoop; + } + } + int error_line = input_stream.getEndLine(); + int error_column = input_stream.getEndColumn(); + String error_after = null; + boolean EOFSeen = false; + try { + input_stream.readChar(); + input_stream.backup(1); + } + catch (java.io.IOException e1) { + EOFSeen = true; + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + if (curChar == '\n' || curChar == '\r') { + error_line++; + error_column = 0; + } else + error_column++; + } + if (!EOFSeen) { + input_stream.backup(1); + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + } + throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); + } + } + +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTreeConstants.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTreeConstants.java new file mode 100644 index 0000000..e044bdc --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTreeConstants.java @@ -0,0 +1,40 @@ +/* Generated By:JJTree: Do not edit this line. .\CSSParserTreeConstants.java */ + +package jaxx.compiler.css.parser; + +public interface CSSParserTreeConstants { + public int JJTSTYLESHEET = 0; + public int JJTRULE = 1; + public int JJTSELECTORS = 2; + public int JJTSELECTOR = 3; + public int JJTJAVACLASS = 4; + public int JJTID = 5; + public int JJTCLASS = 6; + public int JJTPSEUDOCLASS = 7; + public int JJTANIMATIONPROPERTIES = 8; + public int JJTANIMATIONPROPERTY = 9; + public int JJTDECLARATION = 10; + public int JJTPROPERTY = 11; + public int JJTEXPRESSION = 12; + public int JJTJAVACODE = 13; + public int JJTIDENTIFIER = 14; + + + public String[] jjtNodeName = { + "Stylesheet", + "Rule", + "Selectors", + "Selector", + "JavaClass", + "Id", + "Class", + "PseudoClass", + "AnimationProperties", + "AnimationProperty", + "Declaration", + "Property", + "Expression", + "JavaCode", + "Identifier", + }; +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/JJTCSSParserState.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/JJTCSSParserState.java new file mode 100644 index 0000000..ef22e6c --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/JJTCSSParserState.java @@ -0,0 +1,123 @@ +/* Generated By:JJTree: Do not edit this line. .\JJTCSSParserState.java */ + +package jaxx.compiler.css.parser; + +class JJTCSSParserState { + private java.util.Stack<Node> nodes; + private java.util.Stack<Integer> marks; + + private int sp; // number of nodes on stack + private int mk; // current mark + private boolean node_created; + + JJTCSSParserState() { + nodes = new java.util.Stack<Node>(); + marks = new java.util.Stack<Integer>(); + sp = 0; + mk = 0; + } + + /* Determines whether the current node was actually closed and + pushed. This should only be called in the final user action of a + node scope. */ + boolean nodeCreated() { + return node_created; + } + + /* Call this to reinitialize the node stack. It is called +automatically by the parser's ReInit() method. */ + void reset() { + nodes.removeAllElements(); + marks.removeAllElements(); + sp = 0; + mk = 0; + } + + /* Returns the root node of the AST. It only makes sense to call +this after a successful parse. */ + Node rootNode() { + return nodes.elementAt(0); + } + + /* Pushes a node on to the stack. */ + void pushNode(Node n) { + nodes.push(n); + ++sp; + } + + /* Returns the node on the top of the stack, and remove it from the + stack. */ + Node popNode() { + if (--sp < mk) { + mk = marks.pop(); + } + return nodes.pop(); + } + + /* Returns the node currently on the top of the stack. */ + Node peekNode() { + return nodes.peek(); + } + + /* Returns the number of children on the stack in the current node + scope. */ + int nodeArity() { + return sp - mk; + } + + + void clearNodeScope(Node n) { + while (sp > mk) { + popNode(); + } + mk = marks.pop(); + } + + + void openNodeScope(Node n) { + marks.push(mk); + mk = sp; + n.jjtOpen(); + } + + + /* A definite node is constructed from a specified number of +children. That number of nodes are popped from the stack and +made the children of the definite node. Then the definite node +is pushed on to the stack. */ + void closeNodeScope(Node n, int num) { + mk = marks.pop(); + while (num-- > 0) { + Node c = popNode(); + c.jjtSetParent(n); + n.jjtAddChild(c, num); + } + n.jjtClose(); + pushNode(n); + node_created = true; + } + + + /* A conditional node is constructed if its condition is true. All +the nodes that have been pushed since the node was opened are +made children of the the conditional node, which is then pushed +on to the stack. If the condition is false the node is not +constructed and they are left on the stack. */ + void closeNodeScope(Node n, boolean condition) { + if (condition) { + int a = nodeArity(); + mk = marks.pop(); + while (a-- > 0) { + Node c = popNode(); + c.jjtSetParent(n); + n.jjtAddChild(c, a); + } + n.jjtClose(); + pushNode(n); + node_created = true; + } else { + mk = marks.pop(); + node_created = false; + } + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Node.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Node.java new file mode 100644 index 0000000..625c4e6 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Node.java @@ -0,0 +1,51 @@ +/* Generated By:JJTree: Do not edit this line. Node.java */ + +package jaxx.compiler.css.parser; + +/* All AST nodes must implement this interface. It provides basic + machinery for constructing the parent and child relationships + between nodes. */ + +public interface Node { + + /** + * This method is called after the node has been made the current + * node. It indicates that child nodes can now be added to it. + */ + public void jjtOpen(); + + /** + * This method is called after all the child nodes have been + * added. + */ + public void jjtClose(); + + /** + * This pair of methods are used to inform the node of its + * parent. + * + * @param n node + */ + public void jjtSetParent(Node n); + + public Node jjtGetParent(); + + /** + * This method tells the node to add its argument to the node's + * list of children. + * + * @param n node + * @param i pos + */ + public void jjtAddChild(Node n, int i); + + /** + * @param i pos + * @return a child node. The children are numbered + * from zero, left to right. + */ + public Node jjtGetChild(int i); + + /** @return the number of children the node has. */ + public int jjtGetNumChildren(); +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/ParseException.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/ParseException.java new file mode 100644 index 0000000..df1572a --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/ParseException.java @@ -0,0 +1,20 @@ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */ +package jaxx.compiler.css.parser; + +public class ParseException extends jaxx.compiler.java.parser.ParseException { + private static final long serialVersionUID = 229575674880359031L; + + public ParseException() { + super(); + } + + + public ParseException(String message) { + super(message); + } + + + public ParseException(String message, int line, int column) { + super(message, line, column); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleCharStream.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleCharStream.java new file mode 100644 index 0000000..3e401b6 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleCharStream.java @@ -0,0 +1,398 @@ +/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 4.0 */ +package jaxx.compiler.css.parser; + +/** + * An implementation of interface CharStream, where the stream is assumed to + * contain only ASCII characters (without unicode processing). + */ + +public class SimpleCharStream { + public static final boolean staticFlag = false; + int bufsize; + int available; + int tokenBegin; + public int bufpos = -1; + protected int bufline[]; + protected int bufcolumn[]; + + protected int column = 0; + protected int line = 1; + + protected boolean prevCharIsCR = false; + protected boolean prevCharIsLF = false; + + protected java.io.Reader inputStream; + + protected char[] buffer; + protected int maxNextCharInd = 0; + protected int inBuf = 0; + protected int tabSize = 8; + + protected void setTabSize(int i) { + tabSize = i; + } + + protected int getTabSize(int i) { + return tabSize; + } + + + protected void ExpandBuff(boolean wrapAround) { + char[] newbuffer = new char[bufsize + 2048]; + int newbufline[] = new int[bufsize + 2048]; + int newbufcolumn[] = new int[bufsize + 2048]; + + try { + if (wrapAround) { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + System.arraycopy(buffer, 0, newbuffer, + bufsize - tokenBegin, bufpos); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); + bufcolumn = newbufcolumn; + + maxNextCharInd = (bufpos += (bufsize - tokenBegin)); + } else { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + bufcolumn = newbufcolumn; + + maxNextCharInd = (bufpos -= tokenBegin); + } + } + catch (Throwable t) { + throw new Error(t.getMessage()); + } + + + bufsize += 2048; + available = bufsize; + tokenBegin = 0; + } + + protected void FillBuff() throws java.io.IOException { + if (maxNextCharInd == available) { + if (available == bufsize) { + if (tokenBegin > 2048) { + bufpos = maxNextCharInd = 0; + available = tokenBegin; + } else if (tokenBegin < 0) + bufpos = maxNextCharInd = 0; + else + ExpandBuff(false); + } else if (available > tokenBegin) + available = bufsize; + else if ((tokenBegin - available) < 2048) + ExpandBuff(true); + else + available = tokenBegin; + } + + int i; + try { + if ((i = inputStream.read(buffer, maxNextCharInd, + available - maxNextCharInd)) == -1) { + inputStream.close(); + throw new java.io.IOException(); + } else + maxNextCharInd += i; + } + catch (java.io.IOException e) { + --bufpos; + backup(0); + if (tokenBegin == -1) + tokenBegin = bufpos; + throw e; + } + } + + public char BeginToken() throws java.io.IOException { + tokenBegin = -1; + char c = readChar(); + tokenBegin = bufpos; + + return c; + } + + protected void UpdateLineColumn(char c) { + column++; + + if (prevCharIsLF) { + prevCharIsLF = false; + line += (column = 1); + } else if (prevCharIsCR) { + prevCharIsCR = false; + if (c == '\n') { + prevCharIsLF = true; + } else + line += (column = 1); + } + + switch (c) { + case '\r': + prevCharIsCR = true; + break; + case '\n': + prevCharIsLF = true; + break; + case '\t': + column--; + column += (tabSize - (column % tabSize)); + break; + default: + break; + } + + bufline[bufpos] = line; + bufcolumn[bufpos] = column; + } + + public char readChar() throws java.io.IOException { + if (inBuf > 0) { + --inBuf; + + if (++bufpos == bufsize) + bufpos = 0; + + return buffer[bufpos]; + } + + if (++bufpos >= maxNextCharInd) + FillBuff(); + + char c = buffer[bufpos]; + + UpdateLineColumn(c); + return (c); + } + + /** + * @return ??? + * @see #getEndColumn + * @deprecated + */ + + public int getColumn() { + return bufcolumn[bufpos]; + } + + /** + * @return ??? + * @see #getEndLine + * @deprecated + */ + + public int getLine() { + return bufline[bufpos]; + } + + public int getEndColumn() { + return bufcolumn[bufpos]; + } + + public int getEndLine() { + return bufline[bufpos]; + } + + public int getBeginColumn() { + return bufcolumn[tokenBegin]; + } + + public int getBeginLine() { + return bufline[tokenBegin]; + } + + public void backup(int amount) { + + inBuf += amount; + if ((bufpos -= amount) < 0) + bufpos += bufsize; + } + + public SimpleCharStream(java.io.Reader dstream, int startline, + int startcolumn, int buffersize) { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + } + + public SimpleCharStream(java.io.Reader dstream, int startline, + int startcolumn) { + this(dstream, startline, startcolumn, 4096); + } + + public SimpleCharStream(java.io.Reader dstream) { + this(dstream, 1, 1, 4096); + } + + public void ReInit(java.io.Reader dstream, int startline, + int startcolumn, int buffersize) { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + if (buffer == null || buffersize != buffer.length) { + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + } + prevCharIsLF = prevCharIsCR = false; + tokenBegin = inBuf = maxNextCharInd = 0; + bufpos = -1; + } + + public void ReInit(java.io.Reader dstream, int startline, + int startcolumn) { + ReInit(dstream, startline, startcolumn, 4096); + } + + public void ReInit(java.io.Reader dstream) { + ReInit(dstream, 1, 1, 4096); + } + + public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { + this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + + public SimpleCharStream(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) { + this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); + } + + public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException { + this(dstream, encoding, startline, startcolumn, 4096); + } + + public SimpleCharStream(java.io.InputStream dstream, int startline, + int startcolumn) { + this(dstream, startline, startcolumn, 4096); + } + + public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { + this(dstream, encoding, 1, 1, 4096); + } + + public SimpleCharStream(java.io.InputStream dstream) { + this(dstream, 1, 1, 4096); + } + + public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { + ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + + public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) { + ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); + } + + public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { + ReInit(dstream, encoding, 1, 1, 4096); + } + + public void ReInit(java.io.InputStream dstream) { + ReInit(dstream, 1, 1, 4096); + } + + public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException { + ReInit(dstream, encoding, startline, startcolumn, 4096); + } + + public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn) { + ReInit(dstream, startline, startcolumn, 4096); + } + + public String GetImage() { + if (bufpos >= tokenBegin) + return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); + else + return new String(buffer, tokenBegin, bufsize - tokenBegin) + + new String(buffer, 0, bufpos + 1); + } + + public char[] GetSuffix(int len) { + char[] ret = new char[len]; + + if ((bufpos + 1) >= len) + System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); + else { + System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, + len - bufpos - 1); + System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); + } + + return ret; + } + + public void Done() { + buffer = null; + bufline = null; + bufcolumn = null; + } + + /** + * Method to adjust line and column numbers for the start of a token. + * + * @param newLine ? + * @param newCol ? + */ + public void adjustBeginLineColumn(int newLine, int newCol) { + int start = tokenBegin; + int len; + + if (bufpos >= tokenBegin) { + len = bufpos - tokenBegin + inBuf + 1; + } else { + len = bufsize - tokenBegin + bufpos + 1 + inBuf; + } + + int i = 0, j = 0, k; + int nextColDiff, columnDiff = 0; + + while (i < len && + bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { + bufline[j] = newLine; + nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; + bufcolumn[j] = newCol + columnDiff; + columnDiff = nextColDiff; + i++; + } + + if (i < len) { + bufline[j] = newLine++; + bufcolumn[j] = newCol + columnDiff; + + while (i++ < len) { + if (bufline[j = start % bufsize] != bufline[++start % bufsize]) + bufline[j] = newLine++; + else + bufline[j] = newLine; + } + } + + line = bufline[j]; + column = bufcolumn[j]; + } + +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleNode.java new file mode 100644 index 0000000..3e95780 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleNode.java @@ -0,0 +1,122 @@ +/* Generated By:JJTree: Do not edit this line. SimpleNode.java */ + +package jaxx.compiler.css.parser; + +public class SimpleNode implements Node { + protected Node parent; + protected Node[] children; + protected int id; + protected CSSParser parser; + public Token firstToken; + public Token lastToken; + + + public SimpleNode(int i) { + id = i; + } + + public SimpleNode(CSSParser p, int i) { + this(i); + parser = p; + } + + + public int getId() { + return id; + } + + public void jjtOpen() { + } + + public void jjtClose() { + } + + public void jjtSetParent(Node n) { + parent = n; + } + + public Node jjtGetParent() { + return parent; + } + + public SimpleNode getParent() { + return (SimpleNode) parent; + } + + public void jjtAddChild(Node n, int i) { + if (children == null) { + children = new Node[i + 1]; + } else if (i >= children.length) { + Node c[] = new Node[i + 1]; + System.arraycopy(children, 0, c, 0, children.length); + children = c; + } + children[i] = n; + } + + public Node jjtGetChild(int i) { + return children[i]; + } + + public SimpleNode getChild(int i) { + return (SimpleNode) children[i]; + } + + public int jjtGetNumChildren() { + return (children == null) ? 0 : children.length; + } + + /* You can override these two methods in subclasses of SimpleNode to +customize the way the node appears when the tree is dumped. If +your output uses more than one line you should override +toString(String), otherwise overriding toString() is probably all +you need to do. */ + + @Override + public String toString() { + return getClass().getName() + "[" + getText() + "]"; + } + + public String toString(String prefix) { + return prefix + toString(); + } + + /* Override this method if you want to customize how the node dumps + out its children. */ + + public void dump(String prefix) { + System.out.println(toString(prefix)); + if (children != null) { + for (Node aChildren : children) { + SimpleNode n = (SimpleNode) aChildren; + if (n != null) { + n.dump(prefix + " "); + } + } + } + } + + private void appendSpecialTokens(StringBuffer s, Token st) { + if (st != null) { + appendSpecialTokens(s, st.specialToken); + s.append(st.image); + } + } + + + /** @return the text of the tokens comprising this node. */ + public String getText() { + StringBuffer text = new StringBuffer(); + Token t = firstToken; + while (t != null) { + appendSpecialTokens(text, t.specialToken); + text.append(t.image); + if (t == lastToken) + break; + t = t.next; + } + + return text.toString(); + } +} + diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Token.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Token.java new file mode 100644 index 0000000..aebb228 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Token.java @@ -0,0 +1,76 @@ +/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */ +package jaxx.compiler.css.parser; + +/** Describes the input token stream. */ + +public class Token { + + /** + * An integer that describes the kind of this token. This numbering + * system is determined by JavaCCParser, and a table of these numbers is + * stored in the file ...Constants.java. + */ + public int kind; + + /** + * beginLine and beginColumn describe the position of the first character + * of this token; endLine and endColumn describe the position of the + * last character of this token. + */ + public int beginLine, beginColumn, endLine, endColumn; + + /** The string image of the token. */ + public String image; + + /** + * A reference to the next regular (non-special) token from the input + * stream. If this is the last token from the input stream, or if the + * token manager has not read tokens beyond this one, this field is + * set to null. This is true only if this token is also a regular + * token. Otherwise, see below for a description of the contents of + * this field. + */ + public Token next; + + /** + * This field is used to access special tokens that occur prior to this + * token, but after the immediately preceding regular (non-special) token. + * If there are no such special tokens, this field is set to null. + * When there are more than one such special token, this field refers + * to the last of these special tokens, which in turn refers to the next + * previous special token through its specialToken field, and so on + * until the first special token (whose specialToken field is null). + * The next fields of special tokens refer to other special tokens that + * immediately follow it (without an intervening regular token). If there + * is no such token, this field is null. + */ + public Token specialToken; + + /** Returns the image. */ + public String toString() { + return image; + } + + /** + * Returns a new Token object, by default. However, if you want, you + * can create and return subclass objects based on the value of ofKind. + * Simply add the cases to the switch for all those special cases. + * For example, if you have a subclass of Token called IDToken that + * you want to create if ofKind is ID, simlpy add something like : + * <p/> + * case MyParserConstants.ID : return new IDToken(); + * <p/> + * to the following switch statement. Then you can cast matchedToken + * variable to the appropriate type and use it in your lexical actions. + * + * @param ofKind kind of token + * @return the new token + */ + public static Token newToken(int ofKind) { + switch (ofKind) { + default: + return new Token(); + } + } + +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/TokenMgrError.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/TokenMgrError.java new file mode 100644 index 0000000..04be2db --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/TokenMgrError.java @@ -0,0 +1,126 @@ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */ +package jaxx.compiler.css.parser; + +public class TokenMgrError extends Error { + /* + * Ordinals for various reasons why an Error of this type can be thrown. + */ + + /** Lexical error occured. */ + static final int LEXICAL_ERROR = 0; + + /** An attempt wass made to create a second instance of a static token manager. */ + static final int STATIC_LEXER_ERROR = 1; + + /** Tried to change to an invalid lexical state. */ + static final int INVALID_LEXICAL_STATE = 2; + + /** Detected (and bailed out of) an infinite loop in the token manager. */ + static final int LOOP_DETECTED = 3; + + /** + * Indicates the reason why the exception is thrown. It will have + * one of the above 4 values. + */ + int errorCode; + private static final long serialVersionUID = -4308847190164230336L; + + /** + * Replaces unprintable characters by their espaced (or unicode escaped) + * equivalents in the given string + * + * @param str text to espace + * @return the espaced text + */ + protected static String addEscapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) { + case 0: + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u").append(s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + } + } + return retval.toString(); + } + + /** + * @param EOFSeen : indicates if EOF caused the lexicl error + * @param lexState : lexical state in which this error occured + * @param errorLine : line number when the error occured + * @param errorColumn : column number when the error occured + * @param errorAfter : prefix that was seen before this error occured + * @param curChar : the offending character + * Note: You can customize the lexical error message by modifying this method. + * @return a detailed message for the Error when it is thrown by the + * token manager to indicate a lexical error. + */ + protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { + return ("Lexical error at line " + + errorLine + ", column " + + errorColumn + ". Encountered: " + + (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int) curChar + "), ") + + "after : \"" + addEscapes(errorAfter) + "\""); + } + + /** + * You can also modify the body of this method to customize your error messages. + * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not + * of end-users concern, so you can return something like : + * <p/> + * "Internal Error : Please file a bug report .... " + * <p/> + * from this method for such cases in the release version of your parser. + */ + @Override + public String getMessage() { + return super.getMessage(); + } + + /* + * Constructors of various flavors follow. + */ + + public TokenMgrError() { + } + + public TokenMgrError(String message, int reason) { + super(message); + errorCode = reason; + } + + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { + this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java index ac76eab..5465320 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java @@ -3,7 +3,7 @@ package jaxx.compiler.decorators; import jaxx.compiler.CompiledObject; import jaxx.compiler.CompiledObject.ChildRef; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.io.JavaFile; +import jaxx.compiler.java.JavaFile; import jaxx.runtime.SwingUtil; /** diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java index fe91b1c..02f9203 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java @@ -1,12 +1,12 @@ package jaxx.compiler.decorators; import jaxx.compiler.CompiledObject; +import jaxx.compiler.CompiledObjectDecorator; import jaxx.compiler.CompilerException; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.io.JavaField; -import jaxx.compiler.io.JavaFile; -import jaxx.compiler.io.JavaMethod; -import jaxx.compiler.ScriptInitializer; +import jaxx.compiler.java.JavaFile; +import jaxx.compiler.java.JavaFileGenerator; +import jaxx.compiler.script.ScriptInitializer; import java.lang.reflect.Modifier; import java.util.Map.Entry; @@ -31,16 +31,16 @@ public class DefaultCompiledObjectDecorator implements CompiledObjectDecorator { String id = object.getId(); int access = id.startsWith("$") ? Modifier.PRIVATE : Modifier.PROTECTED; if (object == root) { - javaFile.addField(new JavaField(access, className, id, false, "this")); + javaFile.addSimpleField(JavaFileGenerator.newField(access, className, id, false, "this")); // javaFile.addField(new JavaField(access, fullClassName, id, false, "this")); } else { //TC -20081017 can have generic on compiled Object - javaFile.addField(JavaField.newField(access, JAXXCompiler.getCanonicalName(object), id, object.isOverride()), object.isJavaBean()); + javaFile.addField(JavaFileGenerator.newField(access, JAXXCompiler.getCanonicalName(object), id, object.isOverride()), object.isJavaBean()); } } if (!compiler.inlineCreation(object) && object != root) { - javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getCreationMethodName(), getCreationCode(compiler, object), object.isOverride())); + javaFile.addMethod(JavaFileGenerator.newMethod(Modifier.PROTECTED, "void", object.getCreationMethodName(), getCreationCode(compiler, object), object.isOverride())); } } @@ -49,68 +49,68 @@ public class DefaultCompiledObjectDecorator implements CompiledObjectDecorator { if (object instanceof ScriptInitializer) { return object.getInitializationCode(compiler); } - StringBuffer result = new StringBuffer(); String eol = JAXXCompiler.getLineSeparator(); + StringBuffer result = new StringBuffer(); + if (compiler.getRootObject() == object || compiler.inlineCreation(object)) { + result.append("// inline creation of " + object.getId()); + } if (object.isOverride() && object.getOverrideType() == object.getObjectClass()) { //TC-20090309 on utilise le super code quand l'objet est de meme type result.append("super.").append(object.getCreationMethodName()).append("();"); } else { String init = object.getId() + " = "; -// result.append(object.getId()); -// result.append(" = "); if (object.isJavaBean() && object.getJavaBeanInitCode() != null) { init += object.getJavaBeanInitCode(); -// result.append(object.getJavaBeanInitCode()).append(";"); } else { - String constructorParams = object.getConstructorParams(); + //TC - 20081017 compiledObject can have generics String canonicalName = JAXXCompiler.getCanonicalName(object); + init += "new " + canonicalName + "("; + String constructorParams = object.getConstructorParams(); if (constructorParams != null) { - //TC - 20081017 compiledObject can have generics - init += "new " + canonicalName + "(" + constructorParams + ")"; -// result.append(" new ").append(canonicalName).append("(").append(constructorParams).append(");"); - } else { - //TC - 20081017 compiledObject can have generics - init += "new " + canonicalName + "()"; -// result.append("new ").append(canonicalName).append("();"); + init += constructorParams; } + init += ")"; } result.append(eol); result.append("$objectMap.put(").append(compiler.getJavaCode(object.getId())).append(", ").append(init).append(");"); -// result.append("$objectMap.put(").append(TypeManager.getJavaCode(object.getId())).append(", ").append(object.getId()).append(");"); } result.append(eol); String initCode = object.getInitializationCode(compiler); if (initCode != null && initCode.length() > 0) { result.append(initCode); } - + //TC-20091025 generate client properties at creation time (not at setup time) + // in some case can save to create a setup method (when there is only client properties + // to store) + addClientProperties(object); return result.toString(); } @Override public String createCompleteSetupMethod(JAXXCompiler compiler, CompiledObject object, JavaFile javaFile, StringBuffer initDataBindings) { StringBuffer code = new StringBuffer(); - //TC-20090327 generate client properties - if (object.hasClientProperties()) { - // generate putClientProperty invocations - for (Entry<String, String> entry : object.getClientProperties().entrySet()) { - object.appendAdditionCode(object.getJavaCode() + ".putClientProperty(\"" + entry.getKey() + "\", " + entry.getValue() + ");"); - } - - } String eol = JAXXCompiler.getLineSeparator(); - //TC - 20081017 only generate the method if not empty ? + //TC-20091025 generate client properties at creation time (not at setup time) + // in some case can save to create a setup method (when there is only client properties + // to store) +// addClientProperties(object); + //TC-20091025 only generate the code if not empty if (object.getId().startsWith("$")) { - code.append(object.getAdditionCode()).append(eol); + String additionCode = object.getAdditionCode(); + if (!additionCode.isEmpty()) { + code.append("// inline complete setup of " + object.getId()).append(eol); + code.append(additionCode); + } } else { String additionCode = object.getAdditionCode(); if (additionCode.length() > 0) { code.append(object.getAdditionMethodName()).append("();").append(eol); additionCode = "if (!allComponentsCreated) {" + eol + " return;" + eol + "}" + eol + additionCode; - javaFile.addMethod(JavaMethod.newMethod(Modifier.PROTECTED, "void", object.getAdditionMethodName(), additionCode, false)); + javaFile.addMethod(JavaFileGenerator.newMethod(Modifier.PROTECTED, "void", object.getAdditionMethodName(), additionCode, false)); } } - return code.toString(); + String result = code.toString(); + return result; } @Override @@ -119,7 +119,12 @@ public class DefaultCompiledObjectDecorator implements CompiledObjectDecorator { if (object == root) { String rootCode = root.getInitializationCode(compiler); if (rootCode != null && rootCode.length() > 0) { + code.append("// inline creation of " + object.getId()).append(eol); code.append(rootCode); + //TC-20091025 generate client properties at creation time (not at setup time) + // in some case can save to create a setup method (when there is only client properties + // to store) + addClientProperties(object); code.append(eol); } } else { @@ -127,10 +132,8 @@ public class DefaultCompiledObjectDecorator implements CompiledObjectDecorator { if (compiler.inlineCreation(object)) { if (lastWasMethodCall) { lastWasMethodCall = false; - code.append(eol); } code.append(getCreationCode(compiler, object)); - code.append(eol); } else { code.append(object.getCreationMethodName()).append("();"); code.append(eol); @@ -140,4 +143,14 @@ public class DefaultCompiledObjectDecorator implements CompiledObjectDecorator { } return lastWasMethodCall; } + + protected void addClientProperties(CompiledObject object) { + //TC-20090327 generate client properties + if (object.hasClientProperties()) { + // generate putClientProperty invocations + for (Entry<String, String> entry : object.getClientProperties().entrySet()) { + object.appendAdditionCode(object.getJavaCode() + ".putClientProperty(\"" + entry.getKey() + "\", " + entry.getValue() + ");"); + } + } + } } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java index 35e7061..5ffe0c7 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java @@ -3,9 +3,9 @@ package jaxx.compiler.decorators; import jaxx.compiler.CompiledObject; import jaxx.compiler.CompilerConfiguration; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.io.JavaArgument; -import jaxx.compiler.io.JavaFile; -import jaxx.compiler.io.JavaMethod; +import jaxx.compiler.java.JavaArgument; +import jaxx.compiler.java.JavaFile; +import jaxx.compiler.java.JavaFileGenerator; import java.lang.reflect.Modifier; import java.util.Iterator; @@ -54,14 +54,14 @@ public class HelpRootCompiledObjectDecorator extends DefaultCompiledObjectDecora String helpBrokerFQN = getBrokerFQN(compiler); javaFile.addInterface(JAXXCompiler.getCanonicalName(validatorInterface) + "<" + helpBrokerFQN + ">"); - javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", "registerHelpId", - "broker.installUI(component, helpId);",true, + javaFile.addMethod(JavaFileGenerator.newMethod(Modifier.PUBLIC, "void", "registerHelpId", + "broker.installUI(component, helpId);", true, new JavaArgument(helpBrokerFQN, "broker"), new JavaArgument("Component", "component"), new JavaArgument("String", "helpId"))); - javaFile.addMethod(JavaMethod.newMethod(Modifier.PUBLIC, "void", "showHelp", - "getBroker().showHelp(this, helpId);",true, + javaFile.addMethod(JavaFileGenerator.newMethod(Modifier.PUBLIC, "void", "showHelp", + "getBroker().showHelp(this, helpId);", true, new JavaArgument("String", "helpId"))); StringBuilder buffer = new StringBuilder(); @@ -93,6 +93,7 @@ public class HelpRootCompiledObjectDecorator extends DefaultCompiledObjectDecora buffer.append(eol); // add the calls + compiler.appendLateInitializer("// help broker setup" + eol); compiler.appendLateInitializer(extraCode.toString()); compiler.appendLateInitializer(buffer.toString()); } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaArgument.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaArgument.java new file mode 100644 index 0000000..c637da6 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaArgument.java @@ -0,0 +1,56 @@ +package jaxx.compiler.java; + +/** + * Represents an argument to a <code>JavaMethod</code>. + * + * @see JavaMethod + */ +public class JavaArgument extends JavaElement { + + private String type; + private boolean isFinal; + + /** + * Creates a new <code>JavaArgument</code> with the specified name and type. For example, the method <code>main()</code> + * might have a <code>JavaArgument</code> with a name of <code>"arg"</code> and a type of <code>"java.lang.String[]"</code>. + * + * @param type the argument's type, as it would appear in Java source code + * @param name the argument's name + */ + public JavaArgument(String type, String name) { + this(type, name, false); + } + + /** + * Creates a new <code>JavaArgument</code> with the specified name, type, and finality. For example, the method <code>main()</code> + * might have a <code>JavaArgument</code> with a name of <code>"arg"</code> and a type of <code>"java.lang.String[]"</code>. The + * <code>isFinal</code> parameter allows the presence of the <code>final</code> keyword on the argument to be controlled. + * + * @param type the argument's type, as it would appear in Java source code + * @param name the argument's name + * @param isFinal <code>true</code> if the argument should be marked final + */ + public JavaArgument(String type, String name, boolean isFinal) { + super(0, name); + this.type = type; + this.isFinal = isFinal; + } + + /** + * Returns the argument's type as it would be represented in Java source code. + * + * @return the argument's type + */ + public String getType() { + return type; + } + + /** + * Returns <code>true</code> if the <code>final</code> keyword should appear before the argument. + * + * @return <code>true</code> if the argument is final + */ + public boolean isFinal() { + return isFinal; + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaElement.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaElement.java new file mode 100644 index 0000000..0fa92c0 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaElement.java @@ -0,0 +1,77 @@ +package jaxx.compiler.java; + +import java.lang.reflect.Modifier; + +/** + * Base Java element + * @author chemit + * @since 2.0.0 + */ +public abstract class JavaElement { + +// private String lineSeparator; + private String name; + private int modifiers; + + public JavaElement(int modifiers, String name) { + this.modifiers = modifiers; + this.name = name; + } + + public final int getModifiers() { + return modifiers; + } + + public final void setModifiers(int modifiers) { + this.modifiers = modifiers; + } + + public final String getName() { + return name; + } + + public final void setName(String className) { + this.name = className; + } + + public final String getModifiersText() { + if (modifiers == 0) { + return ""; + } else { + return Modifier.toString(modifiers) + ' '; + } + } + +// public final String getLineSeparator() { +// if (lineSeparator == null) { +// lineSeparator = JAXXCompiler.getLineSeparator(); +// } +// return lineSeparator; +// } +// +// public static String addIndentation(String source, int indentation, String lineSeparator) { +// return indent(source, indentation, false, lineSeparator); +// } +// +// public static String setIndentation(String source, int indentation, String lineSeparator) { +// return indent(source, indentation, true, lineSeparator); +// } +// +// public static String indent(String source, int indentation, boolean trim, String lineSeparator) { +// if (trim) { +// source = source.trim(); +// } +// char[] spaces = new char[indentation]; +// Arrays.fill(spaces, ' '); +// StringBuffer result = new StringBuffer(); +// String[] lines = source.split(System.getProperty("line.separator") + "|\n"); +// for (int i = 0; i < lines.length; i++) { +// if (i > 0) { +// result.append(lineSeparator); +// } +// result.append(spaces); +// result.append(trim ? lines[i].trim() : lines[i]); +// } +// return result.toString(); +// } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaField.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaField.java new file mode 100644 index 0000000..f2d9cf0 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaField.java @@ -0,0 +1,154 @@ +package jaxx.compiler.java; + +import java.lang.reflect.Modifier; +import java.util.Comparator; + +/** + * Represents a field in a Java source file being generated for output. <code>JavaFields</code> are created + * and added to a {@link JavaFile}, which can then output Java source code. + */ +public class JavaField extends JavaElement implements Comparable<JavaField> { + + /** + * Field comparator + */ + static final JavaFieldComparator COMPARATOR = new JavaFieldComparator(); + /** + * type of field (fqn) + */ + private String type; + /** + * initializer of field (can be null) + */ + private String initializer; + /** + * flag to known where a field overrides a super-field + */ + private boolean override; + + /** + * Constructs a new <code>JavaField</code>. The <code>modifiers</code> parameter is a bit mask of the + * constants from {@link java.lang.reflect.Modifier}, and the <code>type</code> of the field should be + * represented as it would appear in Java source code. + * + * @param modifiers the modifier keywords that should appear as part of the field's declaration + * @param type the type of the field as it would appear in Java source code + * @param name the field's name + * @param override + */ + public JavaField(int modifiers, String type, String name, boolean override) { + this(modifiers, type, name, override, null); + } + + /** + * Constructs a new <code>JavaField</code>. The <code>modifiers</code> parameter is a bit mask of the + * constants from <code>java.lang.reflect.Modifier</code>, and the <code>type</code> of the field should be + * represented as it would appear in Java source code. The <code>initializer</code> is the initial + * value of the field as it would appear in Java source code, or <code>null</code> to leave it at the + * default value. + * + * @param modifiers the modifier keywords that should appear as part of the field's declaration + * @param type the type of the field as it would appear in Java source code + * @param name the field's name + * @param override + * @param initializer the initial value of the field, as it would appear in Java source code + */ + public JavaField(int modifiers, String type, String name, boolean override, String initializer) { + super(modifiers, name); + this.type = type; + this.initializer = initializer; + this.override = override; + } + + /** + * Returns the field's type, as it would be represented in Java source code. + * + * @return the field's type + */ + public String getType() { + return type; + } + + public boolean isOverride() { + return override; + } + + public void setOverride(boolean override) { + this.override = override; + } + + public String getInitializer() { + return initializer; + } + + @Override + public int compareTo(JavaField o) { + return COMPARATOR.compare(this, o); + } + + static class JavaFieldComparator implements Comparator<JavaField> { + + @Override + public int compare(JavaField o1, JavaField o2) { + int result; + if ((result = compareStatic(o1, o2)) != 0) { + return result; + } + // data sources must be on the last after all other fields + if ((result = compareDataSource(o1, o2)) != 0) { + return result; + } + // same static + if ((result = compareVisibility(o1, o2)) != 0) { + return result; + } + // same visibility, test name + return o1.getName().compareTo(o2.getName()); + } + + public int compareStatic(JavaField o1, JavaField o2) { + // first comparator modifiers : static always before none static + if (Modifier.isStatic(o1.getModifiers()) && !Modifier.isStatic(o2.getModifiers())) { + return -1; + } + if (!Modifier.isStatic(o1.getModifiers()) && Modifier.isStatic(o2.getModifiers())) { + return 1; + } + return 0; + } + + public int compareDataSource(JavaField o1, JavaField o2) { + // first comparator modifiers : static always before none static + if (o1.getName().startsWith("$DataSource") && !o2.getName().startsWith("$DataSource")) { + return 1; + } + if (!o1.getName().startsWith("$DataSource") && o2.getName().startsWith("$DataSource")) { + return -1; + } + return 0; + } + + public int compareVisibility(JavaField o1, JavaField o2) { + // first comparator modifiers : static always before none static + if (!Modifier.isPublic(o1.getModifiers()) && Modifier.isPublic(o2.getModifiers())) { + return 1; + } + if (Modifier.isPublic(o1.getModifiers()) && !Modifier.isPublic(o2.getModifiers())) { + return -1; + } + if (Modifier.isProtected(o1.getModifiers()) && !Modifier.isProtected(o2.getModifiers())) { + return -1; + } + if (!Modifier.isProtected(o1.getModifiers()) && Modifier.isProtected(o2.getModifiers())) { + return 1; + } + if (Modifier.isPrivate(o1.getModifiers()) && !Modifier.isPrivate(o2.getModifiers())) { + return -1; + } + if (!Modifier.isPrivate(o1.getModifiers()) && Modifier.isPrivate(o2.getModifiers())) { + return 1; + } + return 0; + } + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFile.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFile.java new file mode 100644 index 0000000..5d480ed --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFile.java @@ -0,0 +1,181 @@ +package jaxx.compiler.java; + +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.List; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * A Java source file being generated for output. Once the class is completely initialized, use the + * {@link #toString} method to generate source code for it. + */ +public class JavaFile extends JavaElement { + + /** + * Logger + */ + static private final Log log = LogFactory.getLog(JavaFile.class); + protected static final String GETTER_PATTERN = "return %1$s;"; + protected static final String BOOLEAN_GETTER_PATTERN = "return %1$s !=null && %1$s;"; + protected static final String SETTER_PATTERN = "%1$s oldValue = this.%2$s;\nthis.%2$s = newValue;\nfirePropertyChange(\"%2$s\", oldValue, newValue);"; + private List<String> imports = new ArrayList<String>(); + private List<JavaField> fields = new ArrayList<JavaField>(); + private List<JavaMethod> methods = new ArrayList<JavaMethod>(); + private List<JavaFile> innerClasses = new ArrayList<JavaFile>(); + private String superClass; + private List<String> interfaces; + private StringBuffer rawBodyCode = new StringBuffer(); + private boolean superclassIsJAXXObject; + private boolean abstractClass; + private String genericType; + private String superGenericType; + + public JavaFile() { + super(0, ""); + } + + public JavaFile(int modifiers, String className, String superClass) { + this(modifiers, className, superClass, null); + } + + public JavaFile(int modifiers, String className, String superClass, List<String> interfaces) { + super(modifiers, className); + this.superClass = superClass; + this.interfaces = interfaces; + } + + public void addImport(String importString) { + imports.add(importString); + } + + public void addImport(Class<?> importString) { + imports.add(importString.getName()); + } + + public String[] getImports() { + return imports.toArray(new String[imports.size()]); + } + + public String getSuperClass() { + return superClass; + } + + public void setSuperClass(String superClass) { + this.superClass = superClass; + } + + public List<String> getInterfaces() { + if (interfaces == null) { + interfaces = new ArrayList<String>(); + } + return interfaces; + } + + public void setInterfaces(List<String> interfaces) { + this.interfaces = interfaces; + } + + public void setGenericType(String genericType) { + this.genericType = genericType; + } + + public void addMethod(JavaMethod method) { + methods.add(method); + } + + public List<JavaMethod> getMethods() { + return methods; + } + + public void addField(JavaField field) { + addField(field, false); + } + + public void addField(JavaField field, boolean javaBean) { + addSimpleField(field); + String id = field.getName(); + String capitalizedName = org.apache.commons.lang.StringUtils.capitalize(id); + // add getter file + String content = String.format(GETTER_PATTERN, id); + addMethod(new JavaMethod( + Modifier.isProtected(field.getModifiers()) ? Modifier.PUBLIC : Modifier.PROTECTED, + field.getType(), "get" + capitalizedName, null, null, content, field.isOverride())); + + if (javaBean) { + // add full javabean support + if (Boolean.class.getName().equals(field.getType())) { + content = String.format(BOOLEAN_GETTER_PATTERN, id); + addMethod(new JavaMethod(Modifier.PUBLIC, field.getType(), "is" + capitalizedName, null, null, content, field.isOverride())); + } + content = String.format(SETTER_PATTERN, field.getType(), id); + JavaArgument arg = new JavaArgument(field.getType(), "newValue"); + addMethod(new JavaMethod(Modifier.PUBLIC, "void", "set" + capitalizedName, new JavaArgument[]{arg}, null, content, field.isOverride())); + } + } + + public void addSimpleField(JavaField field) { + fields.add(field); + } + + public List<JavaField> getFields() { + return fields; + } + + public void addBodyCode(String bodyCode) { + rawBodyCode.append(bodyCode); + } + + public boolean isAbstractClass() { + return abstractClass; + } + + public String getGenericType() { + return genericType; + } + + public List<JavaFile> getInnerClasses() { + return innerClasses; + } + + public StringBuffer getRawBodyCode() { + return rawBodyCode; + } + + public String getSuperGenericType() { + return superGenericType; + } + + public void addInterface(String canonicalName) { + if (interfaces == null || !interfaces.contains(canonicalName)) { + getInterfaces().add(canonicalName); + } + } + + public void addInterfaces(String[] canonicalNames) { + if (canonicalNames == null) { + return; + } + for (String canonicalName : canonicalNames) { + if (interfaces == null || !interfaces.contains(canonicalName)) { + getInterfaces().add(canonicalName); + } + } + } + + public boolean isSuperclassIsJAXXObject() { + return superclassIsJAXXObject; + } + + public void setSuperclassIsJAXXObject(boolean superclassIsJAXXObject) { + this.superclassIsJAXXObject = superclassIsJAXXObject; + } + + public void setAbstractClass(boolean abstractClass) { + this.abstractClass = abstractClass; + } + + public void setSuperGenericType(String superGenericType) { + this.superGenericType = superGenericType; + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFileGenerator.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFileGenerator.java new file mode 100644 index 0000000..594d529 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFileGenerator.java @@ -0,0 +1,265 @@ +package jaxx.compiler.java; + +import java.io.PrintWriter; +import java.util.Arrays; +import java.util.EnumMap; +import java.util.List; +import java.util.Map.Entry; +import jaxx.compiler.java.JavaMethod.MethodOrder; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Java file generator. + * + * @author chemit + * @since 2.0.0 + */ +public class JavaFileGenerator { + + /** + * Logger + */ + static private final Log log = LogFactory.getLog(JavaFileGenerator.class); + + public static JavaField newField(int modifiers, String returnType, String name, boolean override) { + return newField(modifiers, returnType, name, override, null); + } + + public static JavaField newField(int modifiers, String returnType, String name, boolean override, String initializer) { + return new JavaField(modifiers, returnType, name, override, initializer); + } + + public static JavaMethod newMethod(int modifiers, String returnType, String name, String initializer, boolean override, String[] exceptions, JavaArgument... arguments) { + return new JavaMethod(modifiers, returnType, name, arguments, exceptions, initializer, override); + } + + public static JavaMethod newMethod(int modifiers, String returnType, String name, String initializer, boolean override, JavaArgument... arguments) { + return newMethod(modifiers, returnType, name, initializer, override, new String[0], arguments); + } + /** + * End of line + */ + protected final String eol; + /** + * verbose flag when generates + */ + protected final boolean verbose; + /** + * current prefix indent size + */ + protected int indentationLevel = 0; + + public JavaFileGenerator(String eol, boolean verbose) { + this.eol = eol; + this.verbose = verbose && log.isDebugEnabled(); + } + + public String generateImport(String anImport) { + return "import " + anImport + ';' + eol; + } + + public void generateFile(JavaFile f, PrintWriter result) { + if (verbose) { + log.info(f.getName()); + } + indentationLevel = 0; + if (f.getName().indexOf(".") != -1) { + result.append("package ").append(f.getName().substring(0, f.getName().lastIndexOf("."))).append(";"); + result.append(eol).append(eol); + } + String[] imports = f.getImports(); + + if (imports.length > 0) { + for (String anImport : imports) { + result.append(generateImport(anImport)); + } + result.append(eol); + } + result.append(generateClass(f)); + } + + public String generateClass(JavaFile f) { + + if (verbose) { + log.info(f.getName()); + } + StringBuffer result = new StringBuffer(); + String genericType = f.getGenericType(); + + result.append(f.getModifiersText()); + if (f.isAbstractClass()) { + result.append("abstract "); + } + result.append("class "); + result.append(f.getName().substring(f.getName().lastIndexOf(".") + 1)); + if (genericType != null) { + result.append('<').append(genericType).append('>'); + } + result.append(" extends "); + result.append(f.getSuperClass()); + if (f.getSuperGenericType() != null) { + result.append('<').append(f.getSuperGenericType()).append('>'); + } + List<String> interfaces = f.getInterfaces(); + + if (interfaces != null && !interfaces.isEmpty()) { + result.append(" implements ").append(interfaces.get(0)); + for (int i = 1; i < interfaces.size(); i++) { + result.append(", ").append(interfaces.get(i)); + } + } + result.append(" {").append(eol); + + // generate fields + + List<JavaField> fields = f.getFields(); + + if (!fields.isEmpty()) { + java.util.Collections.sort(fields); // sort fields + + for (JavaField field : fields) { + if (log.isDebugEnabled()) { + log.debug("generate field " + field); + } + String txt = generateField(field); + result.append(addIndentation(txt, 4, eol)).append(eol); + } + result.append(eol); + } + + // generate raw body + + StringBuffer rawBodyCode = f.getRawBodyCode(); + + if (rawBodyCode.length() > 0) { + result.append(addIndentation("/* begin raw body code */\n", 4, eol)); + String s = rawBodyCode.toString(); + if (!s.startsWith(eol)) { + result.append(eol); + } + result.append(addIndentation(s, 4, eol)).append(eol); + result.append(addIndentation("/* end raw body code */", 4, eol)); + result.append(eol); + } + + // generate inner classes + + List<JavaFile> innerClasses = f.getInnerClasses(); + for (JavaFile innerClass : innerClasses) { + indentationLevel += 4; + try { + String txt = generateClass(innerClass); + result.append(addIndentation(txt, 4, eol)); + result.append(eol).append(eol); + } finally { + indentationLevel -= 4; + } + } + + // generate methods + + EnumMap<MethodOrder, List<JavaMethod>> map = JavaMethod.getSortedMethods(f.getMethods()); + for (Entry<MethodOrder, List<JavaMethod>> entry : map.entrySet()) { + List<JavaMethod> list = entry.getValue(); + if (!list.isEmpty()) { + result.append(addIndentation(entry.getKey().getHeader(), 4, eol)); + result.append(eol).append(eol); + for (JavaMethod method : list) { + String txt = generateMethod(method); + result.append(addIndentation(txt, 4, eol)); + result.append(eol).append(eol); + } + } + list.clear(); + } + map.clear(); + result.append("}"); + return result.toString(); + + } + + public String generateField(JavaField f) { + if (verbose) { + log.info(f.getName()); + } + StringBuffer result = new StringBuffer(); + result.append(f.getModifiersText()); + result.append(f.getType()).append(' ').append(f.getName()); + if (f.getInitializer() != null) { + result.append(" = ").append(f.getInitializer()); + } + result.append(';').append(eol); + return result.toString(); + } + + public String generateMethod(JavaMethod m) { + if (verbose) { + log.info(m.getName()); + } + + StringBuffer result = new StringBuffer(); + if (m.isOverride()) { + result.append("@Override").append(eol); + } + result.append(m.getModifiersText()); + if (m.getReturnType() != null) { + result.append(m.getReturnType()); + result.append(' '); + } + result.append(m.getName()); + result.append('('); + JavaArgument[] arguments = m.getArguments(); + + if (arguments != null && arguments.length > 0) { + result.append(generateArgument(arguments[0])); + for (int i = 1; i < arguments.length; i++) { + result.append(", ").append(generateArgument(arguments[i])); + } + } + result.append(") {"); + result.append(eol); + String body = m.getBody(); + + if (body != null) { + String formattedBodyCode = addIndentation(body.trim(), 4, eol); + if (formattedBodyCode.length() > 0) { + result.append(formattedBodyCode).append(eol); + } + } + result.append("}"); + return result.toString(); + + } + + public String generateArgument(JavaArgument argument) { + String result = argument.getType() + ' ' + argument.getName(); + return argument.isFinal() ? "final " + result : result; + } + + public String addIndentation(String source, int indentation, String lineSeparator) { + return indent(source, indentationLevel + indentation, false, lineSeparator); + } + + public String setIndentation(String source, int indentation, String lineSeparator) { + return indent(source, indentationLevel + indentation, true, lineSeparator); + } + + public static String indent(String source, int indentation, boolean trim, String lineSeparator) { + if (trim) { + source = source.trim(); + } + char[] spaces = new char[indentation]; + Arrays.fill(spaces, ' '); + StringBuffer result = new StringBuffer(); + String[] lines = source.split(lineSeparator + "|\n"); + for (int i = 0; i < lines.length; i++) { + if (i > 0) { + result.append(lineSeparator); + } + result.append(spaces); + result.append(trim ? lines[i].trim() : lines[i]); + } + return result.toString(); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaMethod.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaMethod.java new file mode 100644 index 0000000..491649f --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaMethod.java @@ -0,0 +1,375 @@ +package jaxx.compiler.java; + +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.EnumMap; +import java.util.EnumSet; +import java.util.Iterator; +import java.util.List; + +/** + * Represents a method in a Java source file being generated for output. <code>JavaMethods</code> are created + * and added to a {@link JavaFile}, which can then output Java source code. In addition to normal methods, a + * <code>JavaMethod</code> can represent a constructor -- constructors should be named after their containing + * classes and have a return type of <code>null</code>. + */ +public class JavaMethod extends JavaElement implements Comparable<JavaMethod> { + + /** + * Method comparator + */ + static final JavaMethodComparator COMPARATOR = new JavaMethodComparator(); + /** + * return type of the method (null for constructors) + */ + private String returnType; + /** + * arguments of the method (can be empty) + */ + private JavaArgument[] arguments; + /** + * exceptions thrown by the method( can be empty) + */ + private String[] exceptions; + /** + * body of the mehotd (can be empty) + */ + private String body; + /** + * flag to known if the method overrids a super-method + */ + private boolean override; + + /** + * Constructs a new <code>JavaMethod</code> containing the specified body code. The <code>modifiers</code> parameter + * is a bit mask of the constants from {@link java.lang.reflect.Modifier}, and the <code>returnType</code> and + * <code>exceptions</code> of the method should be represented as they would appear in Java source code (<code>null</code> + * for a constructor). The method body is initially empty. + * + * @param modifiers the modifier keywords that should appear as part of the method's declaration + * @param returnType the return type of the method as it would appear in Java source code + * @param name the method's name + * @param arguments the method's arguments + * @param exceptions a list of exceptions the methods can throw, as they would be represented in Java source code + * @param bodyCode Java source code which should appear in the method body + * @param override flag with {@code true} value when the method overrides (or implements) a super class method + */ + public JavaMethod(int modifiers, String returnType, String name, JavaArgument[] arguments, String[] exceptions, String bodyCode, boolean override) { + super(modifiers, name); + this.returnType = returnType; + this.override = override; + this.arguments = arguments; + this.exceptions = exceptions; + this.body = bodyCode == null ? "" : bodyCode; + } + + /** + * Returns the method's return type, as it would be represented in Java source code. + * + * @return the method's return type + */ + public String getReturnType() { + return returnType; + } + + /** + * Returns a list of the method's arguments. + * + * @return the method's arguments + */ + public JavaArgument[] getArguments() { + return arguments; + } + + /** + * Returns a list of exceptions the method can throw. + * + * @return the method's exceptions + */ + public String[] getExceptions() { + return exceptions; + } + + public boolean isOverride() { + return override; + } + + public void setOverride(boolean override) { + this.override = override; + } + + public String getBody() { + return body; + } + + @Override + public int compareTo(JavaMethod o) { + return COMPARATOR.compare(this, o); + } + + public enum MethodOrder { + + statics(Modifier.STATIC, "/*---------------------------------------------------------------------------------*/\n" + + "/*-- Statics methods --------------------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + }, + constructors(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + + "/*-- Constructors -----------------------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + + @Override + public boolean accept(JavaMethod method) { + return method.returnType == null; + } + }, + JAXXObject(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + + "/*-- JAXXObject implementation ----------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + + private List<String> methods = Arrays.asList("applyDataBinding", "firePropertyChange", "getObjectById", "get$objectMap", "processDataBinding", "removeDataBinding"); + + @Override + public boolean accept(JavaMethod method) { + return methods.contains(method.getName()); + } + }, + JAXXContext(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + + "/*-- JAXXContext implementation ---------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + + private List<String> methods = Arrays.asList("getContextValue", "getDelegateContext", "getParentContainer", "removeContextValue", "setContextValue"); + + @Override + public boolean accept(JavaMethod method) { + return methods.contains(method.getName()); + } + }, + JAXXValidation(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + + "/*-- JAXXValidation implementation ------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + + private List<String> methods = Arrays.asList("getValidator", "getValidatorIds"); + + @Override + public boolean accept(JavaMethod method) { + return methods.contains(method.getName()); + } + }, + events(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + + "/*-- Event methods ----------------------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + + @Override + public boolean accept(JavaMethod method) { + return (method.getName().startsWith("do") && method.getName().indexOf("__") > -1); + } + }, + publicGetters(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + + "/*-- public acessor methods -------------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + + @Override + public boolean accept(JavaMethod method) { + return (method.getName().startsWith("get") || method.getName().startsWith("is")); + } + }, + publicSetters(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + + "/*-- public mutator methods -------------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + + @Override + public boolean accept(JavaMethod method) { + return (method.getName().startsWith("set")); + } + }, + otherPublic(Modifier.PUBLIC, "/*---------------------------------------------------------------------------------*/\n" + + "/*-- public mutator methods -------------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + + @Override + public boolean accept(int mod) { + return super.accept(mod) && !Modifier.isStatic(mod); + } + }, + protectedGetters(Modifier.PROTECTED, "/*---------------------------------------------------------------------------------*/\n" + + "/*-- protected acessors methods ---------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + + @Override + public boolean accept(JavaMethod method) { + return (method.getName().startsWith("get") || method.getName().startsWith("is")); + } + }, + createMethod(Modifier.PROTECTED | Modifier.PRIVATE, "/*---------------------------------------------------------------------------------*/\n" + + "/*-- ui creation methods ----------------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + + @Override + public boolean accept(JavaMethod method) { + return method.getName().startsWith("create") || method.getName().startsWith("add") || + method.getName().equals("$completeSetup") || + method.getName().equals("$initialize"); + } + }, + protecteds(Modifier.PROTECTED, "/*---------------------------------------------------------------------------------*/\n" + + "/*-- Other protected methods ------------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + }, + packageLocal(0, "/*---------------------------------------------------------------------------------*/\n" + + "/*-- Package methods --------------------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + + @Override + public boolean accept(int mod) { + return !Modifier.isStatic(mod) && !Modifier.isPublic(mod) && !Modifier.isProtected(mod); + } + }, + privates(Modifier.PRIVATE, "/*---------------------------------------------------------------------------------*/\n" + + "/*-- Private methods --------------------------------------------------------------*/\n" + + "/*---------------------------------------------------------------------------------*/") { + }; + private final String header; + private int modifier; + + MethodOrder(int modifier, String header) { + this.header = header; + this.modifier = modifier; + } + + public String getHeader() { + return header; + } + + public boolean accept(JavaMethod method) { + return true; + } + + public boolean accept(int mod) { + return (mod & modifier) != 0; + } + + public boolean accept(int mod, JavaMethod method) { + return accept(mod) && accept(method); + } + + public static MethodOrder valueOf(JavaMethod method, int scope) { + for (MethodOrder o : values()) { + if (o.accept(scope, method)) { + return o; + } + } + throw new IllegalArgumentException("could not find a " + MethodOrder.class + " for method " + method); + } + } + + public static EnumMap<MethodOrder, List<JavaMethod>> getSortedMethods(List<JavaMethod> methods) { + + EnumMap<MethodOrder, List<JavaMethod>> result = new EnumMap<MethodOrder, List<JavaMethod>>(MethodOrder.class); + for (MethodOrder methodOrder : MethodOrder.values()) { + result.put(methodOrder, new ArrayList<JavaMethod>()); + } + + EnumSet<MethodOrder> allConstants = EnumSet.allOf(MethodOrder.class); + List<JavaMethod> allMethods = new ArrayList<JavaMethod>(methods); + int[] scopes = new int[]{Modifier.STATIC, Modifier.PUBLIC, Modifier.PROTECTED, Modifier.PRIVATE}; + for (int scope : scopes) { + EnumSet<MethodOrder> constants = getMethodOrderScope(allConstants, scope); + + Iterator<JavaMethod> itMethods = allMethods.iterator(); + while (itMethods.hasNext()) { + JavaMethod method = itMethods.next(); + for (MethodOrder constant : constants) { + if (constant.accept(method.getModifiers(), method)) { + result.get(constant).add(method); + itMethods.remove(); + break; + } + } + } + constants.clear(); + } + + if (!allMethods.isEmpty()) { + throw new IllegalArgumentException("could not find a " + MethodOrder.class + " for method " + allMethods); + } + + for (MethodOrder methodOrder : MethodOrder.values()) { + // sort methods + java.util.Collections.sort(result.get(methodOrder)); + } + return result; + } + + public static EnumSet<MethodOrder> getMethodOrderScope(EnumSet<MethodOrder> allConstants, int scope) { + EnumSet<MethodOrder> constants = EnumSet.noneOf(MethodOrder.class); + for (MethodOrder order : allConstants) { + if (order.accept(scope)) { + constants.add(order); + } + } + return constants; + } + + static class JavaMethodComparator implements Comparator<JavaMethod> { + + @Override + public int compare(JavaMethod o1, JavaMethod o2) { + + /*int result; + if ((result = compareStatic(o1, o2)) != 0) { + return result; + } + if ((result = compareConstructor(o1, o2)) != 0) { + return result; + } + if ((result = compareVisibility(o1, o2)) != 0) { + return result; + }*/ + return o1.getName().compareTo(o2.getName()); + } + + public int compareStatic(JavaMethod o1, JavaMethod o2) { + if (Modifier.isStatic(o1.getModifiers()) && !Modifier.isStatic(o2.getModifiers())) { + return -1; + } + if (!Modifier.isStatic(o1.getModifiers()) && Modifier.isStatic(o2.getModifiers())) { + return 1; + } + return 0; + } + + public int compareConstructor(JavaMethod o1, JavaMethod o2) { + if (o1.getReturnType() == null && o2.getReturnType() != null) { + return -1; + } + if (o1.getReturnType() != null && o2.getReturnType() == null) { + return 1; + } + return 0; + } + + public int compareVisibility(JavaMethod o1, JavaMethod o2) { + if (Modifier.isPublic(o1.getModifiers()) && !Modifier.isPublic(o2.getModifiers())) { + return -1; + } + if (!Modifier.isPublic(o1.getModifiers()) && Modifier.isPublic(o2.getModifiers())) { + return 1; + } + if (Modifier.isProtected(o1.getModifiers()) && !Modifier.isProtected(o2.getModifiers())) { + return -1; + } + if (!Modifier.isProtected(o1.getModifiers()) && Modifier.isProtected(o2.getModifiers())) { + return 1; + } + if (Modifier.isPrivate(o1.getModifiers()) && !Modifier.isPrivate(o2.getModifiers())) { + return -1; + } + if (!Modifier.isPrivate(o1.getModifiers()) && Modifier.isPrivate(o2.getModifiers())) { + return 1; + } + return 0; + } + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JJTJavaParserState.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JJTJavaParserState.java new file mode 100644 index 0000000..42f1158 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JJTJavaParserState.java @@ -0,0 +1,123 @@ +/* Generated By:JJTree: Do not edit this line. .\JJTJavaParserState.java */ + +package jaxx.compiler.java.parser; + +class JJTJavaParserState { + private java.util.Stack<Node> nodes; + private java.util.Stack<Integer> marks; + + private int sp; // number of nodes on stack + private int mk; // current mark + private boolean node_created; + + JJTJavaParserState() { + nodes = new java.util.Stack<Node>(); + marks = new java.util.Stack<Integer>(); + sp = 0; + mk = 0; + } + + /* Determines whether the current node was actually closed and + pushed. This should only be called in the final user action of a + node scope. */ + boolean nodeCreated() { + return node_created; + } + + /* Call this to reinitialize the node stack. It is called +automatically by the parser's ReInit() method. */ + void reset() { + nodes.removeAllElements(); + marks.removeAllElements(); + sp = 0; + mk = 0; + } + + /* Returns the root node of the AST. It only makes sense to call +this after a successful parse. */ + Node rootNode() { + return nodes.elementAt(0); + } + + /* Pushes a node on to the stack. */ + void pushNode(Node n) { + nodes.push(n); + ++sp; + } + + /* Returns the node on the top of the stack, and remove it from the + stack. */ + Node popNode() { + if (--sp < mk) { + mk = marks.pop(); + } + return nodes.pop(); + } + + /* Returns the node currently on the top of the stack. */ + Node peekNode() { + return nodes.peek(); + } + + /* Returns the number of children on the stack in the current node + scope. */ + int nodeArity() { + return sp - mk; + } + + + void clearNodeScope(Node n) { + while (sp > mk) { + popNode(); + } + mk = marks.pop(); + } + + + void openNodeScope(Node n) { + marks.push(mk); + mk = sp; + n.jjtOpen(); + } + + + /* A definite node is constructed from a specified number of +children. That number of nodes are popped from the stack and +made the children of the definite node. Then the definite node +is pushed on to the stack. */ + void closeNodeScope(Node n, int num) { + mk = marks.pop(); + while (num-- > 0) { + Node c = popNode(); + c.jjtSetParent(n); + n.jjtAddChild(c, num); + } + n.jjtClose(); + pushNode(n); + node_created = true; + } + + + /* A conditional node is constructed if its condition is true. All +the nodes that have been pushed since the node was opened are +made children of the the conditional node, which is then pushed +on to the stack. If the condition is false the node is not +constructed and they are left on the stack. */ + void closeNodeScope(Node n, boolean condition) { + if (condition) { + int a = nodeArity(); + mk = marks.pop(); + while (a-- > 0) { + Node c = popNode(); + c.jjtSetParent(n); + n.jjtAddChild(c, a); + } + n.jjtClose(); + pushNode(n); + node_created = true; + } else { + mk = marks.pop(); + node_created = false; + } + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Java1.5.jj b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Java1.5.jj new file mode 100644 index 0000000..96d01d3 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Java1.5.jj @@ -0,0 +1,5125 @@ +/*@bgen(jjtree) Generated By:JJTree: Do not edit this line. ./Java1.5.jj */ +/*@egen*/ +/* + * Copyright \u00a9 2002 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * California 95054, U.S.A. All rights reserved. Sun Microsystems, Inc. has + * intellectual property rights relating to technology embodied in the product + * that is described in this document. In particular, and without limitation, + * these intellectual property rights may include one or more of the U.S. + * patents listed at http://www.sun.com/patents and one or more additional + * patents or pending patent applications in the U.S. and in other countries. + * U.S. Government Rights - Commercial software. Government users are subject + * to the Sun Microsystems, Inc. standard license agreement and applicable + * provisions of the FAR and its supplements. Use is subject to license terms. + * Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered + * trademarks of Sun Microsystems, Inc. in the U.S. and other countries. This + * product is covered and controlled by U.S. Export Control laws and may be + * subject to the export or import laws in other countries. Nuclear, missile, + * chemical biological weapons or nuclear maritime end uses or end users, + * whether direct or indirect, are strictly prohibited. Export or reexport + * to countries subject to U.S. embargo or to entities identified on U.S. + * export exclusion lists, including, but not limited to, the denied persons + * and specially designated nationals lists is strictly prohibited. + */ + +// Slightly modified version of javacc's reference 1.5 grammar, tweaked for +// usage with JAXX. There are two main areas of changes: several new +// nonterminals were added to make identifying certain constructs easier, +// and the Line nonterminal was added to support JAXX's script tags. +// Several of the new changes are inefficient and require excess lookahead, +// but at this point I'd rather have inefficiency than risk breaking it during +// attempted optimizations. + +options { + JAVA_UNICODE_ESCAPE = true; + ERROR_REPORTING = false; + STATIC = false; + JDK_VERSION = "1.4"; +} + +PARSER_BEGIN(JavaParser) +package jaxx.parser; + +import java.io.*; + +/** + * Grammar to parse Java version 1.5 + * @author Sreenivasa Viswanadha - Simplified and enhanced for 1.5 + */ +public class JavaParser/*@bgen(jjtree)*/implements JavaParserTreeConstants/*@egen*/ +{/*@bgen(jjtree)*/ + protected JJTJavaParserState jjtree = new JJTJavaParserState(); + +/*@egen*/ + /** + * Class to hold modifiers. + */ + static public final class ModifierSet + { + /* Definitions of the bits in the modifiers field. */ + public static final int PUBLIC = 0x0001; + public static final int PROTECTED = 0x0002; + public static final int PRIVATE = 0x0004; + public static final int ABSTRACT = 0x0008; + public static final int STATIC = 0x0010; + public static final int FINAL = 0x0020; + public static final int SYNCHRONIZED = 0x0040; + public static final int NATIVE = 0x0080; + public static final int TRANSIENT = 0x0100; + public static final int VOLATILE = 0x0200; + public static final int STRICTFP = 0x1000; + + /** A set of accessors that indicate whether the specified modifier + is in the set. */ + + public boolean isPublic(int modifiers) + { + return (modifiers & PUBLIC) != 0; + } + + public boolean isProtected(int modifiers) + { + return (modifiers & PROTECTED) != 0; + } + + public boolean isPrivate(int modifiers) + { + return (modifiers & PRIVATE) != 0; + } + + public boolean isStatic(int modifiers) + { + return (modifiers & STATIC) != 0; + } + + public boolean isAbstract(int modifiers) + { + return (modifiers & ABSTRACT) != 0; + } + + public boolean isFinal(int modifiers) + { + return (modifiers & FINAL) != 0; + } + + public boolean isNative(int modifiers) + { + return (modifiers & NATIVE) != 0; + } + + public boolean isStrictfp(int modifiers) + { + return (modifiers & STRICTFP) != 0; + } + + public boolean isSynchronized(int modifiers) + { + return (modifiers & SYNCHRONIZED) != 0; + } + + public boolean isTransient(int modifiers) + { + return (modifiers & TRANSIENT) != 0; + } + + public boolean isVolatile(int modifiers) + { + return (modifiers & VOLATILE) != 0; + } + + /** + * Removes the given modifier. + */ + static int removeModifier(int modifiers, int mod) + { + return modifiers & ~mod; + } + } + + public JavaParser(String fileName) + { + this(System.in); + try { ReInit(new FileInputStream(new File(fileName))); } + catch(Exception e) { e.printStackTrace(); } + } + + void jjtreeOpenNodeScope(Node n) { + ((SimpleNode) n).firstToken = getToken(1); + } + + void jjtreeCloseNodeScope(Node n) { + ((SimpleNode) n).lastToken = getToken(0); + } + + public SimpleNode popNode() + { + if ( jjtree.nodeArity() > 0) // number of child nodes + return (SimpleNode)jjtree.popNode(); + else + return null; + } + public static void main(String args[]) { + JavaParser parser; + if (args.length == 0) { + System.out.println("Java Parser Version 1.1: Reading from standard input . . ."); + parser = new JavaParser(System.in); + } else if (args.length == 1) { + System.out.println("Java Parser Version 1.1: Reading from file " + args[0] + " . . ."); + try { + parser = new JavaParser(new java.io.FileInputStream(args[0])); + } catch (java.io.FileNotFoundException e) { + System.out.println("Java Parser Version 1.1: File " + args[0] + " not found."); + return; + } + } else { + System.out.println("Java Parser Version 1.1: Usage is one of:"); + System.out.println(" java JavaParser < inputfile"); + System.out.println("OR"); + System.out.println(" java JavaParser inputfile"); + return; + } + try { + parser.CompilationUnit(); + System.out.println("Java Parser Version 1.1: Java program parsed successfully."); + } catch (ParseException e) { + System.out.println(e.getMessage()); + System.out.println("Java Parser Version 1.1: Encountered errors during parse."); + } + } + +} + +PARSER_END(JavaParser) + +/* COMMENTS */ + +MORE : +{ + <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT +| + "/*" : IN_MULTI_LINE_COMMENT +} + +SPECIAL_TOKEN: +{ + <WHITE_SPACE: ([" ", "\n", "\r", "\t", "\f"])+> +} + +SPECIAL_TOKEN : +{ + <SINGLE_LINE_COMMENT: "//" (~["\n", "\r"])* ("\n" | "\r" | "\r\n")?> +} + +<IN_FORMAL_COMMENT> +SPECIAL_TOKEN : +{ + <FORMAL_COMMENT: "*/" > : DEFAULT +} + +<IN_MULTI_LINE_COMMENT> +SPECIAL_TOKEN : +{ + <MULTI_LINE_COMMENT: "*/" > : DEFAULT +} + +<IN_FORMAL_COMMENT,IN_MULTI_LINE_COMMENT> +MORE : +{ + < ~[] > +} + +/* RESERVED WORDS AND LITERALS */ + +TOKEN : +{ + < ABSTRACT: "abstract" > +| < ASSERT: "assert" > +| < BOOLEAN: "boolean" > +| < BREAK: "break" > +| < BYTE: "byte" > +| < CASE: "case" > +| < CATCH: "catch" > +| < CHAR: "char" > +| < CLASS: "class" > +| < CONST: "const" > +| < CONTINUE: "continue" > +| < _DEFAULT: "default" > +| < DO: "do" > +| < DOUBLE: "double" > +| < ELSE: "else" > +| < ENUM: "enum" > +| < EXTENDS: "extends" > +| < FALSE: "false" > +| < FINAL: "final" > +| < FINALLY: "finally" > +| < FLOAT: "float" > +| < FOR: "for" > +| < GOTO: "goto" > +| < IF: "if" > +| < IMPLEMENTS: "implements" > +| < IMPORT: "import" > +| < INSTANCEOF: "instanceof" > +| < INT: "int" > +| < INTERFACE: "interface" > +| < LONG: "long" > +| < NATIVE: "native" > +| < NEW: "new" > +| < NULL: "null" > +| < PACKAGE: "package"> +| < PRIVATE: "private" > +| < PROTECTED: "protected" > +| < PUBLIC: "public" > +| < RETURN: "return" > +| < SHORT: "short" > +| < STATIC: "static" > +| < STRICTFP: "strictfp" > +| < SUPER: "super" > +| < SWITCH: "switch" > +| < SYNCHRONIZED: "synchronized" > +| < THIS: "this" > +| < THROW: "throw" > +| < THROWS: "throws" > +| < TRANSIENT: "transient" > +| < TRUE: "true" > +| < TRY: "try" > +| < VOID: "void" > +| < VOLATILE: "volatile" > +| < WHILE: "while" > +} + +/* LITERALS */ + +TOKEN : +{ + < INTEGER_LITERAL: + <DECIMAL_LITERAL> (["l","L"])? + | <HEX_LITERAL> (["l","L"])? + | <OCTAL_LITERAL> (["l","L"])? + > +| + < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > +| + < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > +| + < #OCTAL_LITERAL: "0" (["0"-"7"])* > +| + < FLOATING_POINT_LITERAL: + <DECIMAL_FLOATING_POINT_LITERAL> + | <HEXADECIMAL_FLOATING_POINT_LITERAL> + > +| + < #DECIMAL_FLOATING_POINT_LITERAL: + (["0"-"9"])+ "." (["0"-"9"])* (<DECIMAL_EXPONENT>)? (["f","F","d","D"])? + | "." (["0"-"9"])+ (<DECIMAL_EXPONENT>)? (["f","F","d","D"])? + | (["0"-"9"])+ <DECIMAL_EXPONENT> (["f","F","d","D"])? + | (["0"-"9"])+ (<DECIMAL_EXPONENT>)? ["f","F","d","D"] + > +| + < #DECIMAL_EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > +| + < #HEXADECIMAL_FLOATING_POINT_LITERAL: + "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])+ (".")? <HEXADECIMAL_EXPONENT> (["f","F","d","D"])? + | "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])* "." (["0"-"9","a"-"f","A"-"F"])+ <HEXADECIMAL_EXPONENT> (["f","F","d","D"])? + > +| + < #HEXADECIMAL_EXPONENT: ["p","P"] (["+","-"])? (["0"-"9"])+ > +| + < CHARACTER_LITERAL: + "'" + ( (~["'","\\","\n","\r"]) + | ("\\" + ( ["n","t","b","r","f","\\","'","\""] + | ["0"-"7"] ( ["0"-"7"] )? + | ["0"-"3"] ["0"-"7"] ["0"-"7"] + ) + ) + ) + "'" + > +| + < STRING_LITERAL: + "\"" + ( (~["\"","\\","\n","\r"]) + | ("\\" + ( ["n","t","b","r","f","\\","'","\""] + | ["0"-"7"] ( ["0"-"7"] )? + | ["0"-"3"] ["0"-"7"] ["0"-"7"] + ) + ) + )* + "\"" + > +} + +/* IDENTIFIERS */ + +TOKEN : +{ + < IDENTIFIER: <LETTER> (<PART_LETTER>)* > +| + < #LETTER: + [ // all chars for which Character.isIdentifierStart is true + "$", + "A"-"Z", + "_", + "a"-"z", + "\u00a2"-"\u00a5", + "\u00aa", + "\u00b5", + "\u00ba", + "\u00c0"-"\u00d6", + "\u00d8"-"\u00f6", + "\u00f8"-"\u021f", + "\u0222"-"\u0233", + "\u0250"-"\u02ad", + "\u02b0"-"\u02b8", + "\u02bb"-"\u02c1", + "\u02d0"-"\u02d1", + "\u02e0"-"\u02e4", + "\u02ee", + "\u037a", + "\u0386", + "\u0388"-"\u038a", + "\u038c", + "\u038e"-"\u03a1", + "\u03a3"-"\u03ce", + "\u03d0"-"\u03d7", + "\u03da"-"\u03f3", + "\u0400"-"\u0481", + "\u048c"-"\u04c4", + "\u04c7"-"\u04c8", + "\u04cb"-"\u04cc", + "\u04d0"-"\u04f5", + "\u04f8"-"\u04f9", + "\u0531"-"\u0556", + "\u0559", + "\u0561"-"\u0587", + "\u05d0"-"\u05ea", + "\u05f0"-"\u05f2", + "\u0621"-"\u063a", + "\u0640"-"\u064a", + "\u0671"-"\u06d3", + "\u06d5", + "\u06e5"-"\u06e6", + "\u06fa"-"\u06fc", + "\u0710", + "\u0712"-"\u072c", + "\u0780"-"\u07a5", + "\u0905"-"\u0939", + "\u093d", + "\u0950", + "\u0958"-"\u0961", + "\u0985"-"\u098c", + "\u098f"-"\u0990", + "\u0993"-"\u09a8", + "\u09aa"-"\u09b0", + "\u09b2", + "\u09b6"-"\u09b9", + "\u09dc"-"\u09dd", + "\u09df"-"\u09e1", + "\u09f0"-"\u09f3", + "\u0a05"-"\u0a0a", + "\u0a0f"-"\u0a10", + "\u0a13"-"\u0a28", + "\u0a2a"-"\u0a30", + "\u0a32"-"\u0a33", + "\u0a35"-"\u0a36", + "\u0a38"-"\u0a39", + "\u0a59"-"\u0a5c", + "\u0a5e", + "\u0a72"-"\u0a74", + "\u0a85"-"\u0a8b", + "\u0a8d", + "\u0a8f"-"\u0a91", + "\u0a93"-"\u0aa8", + "\u0aaa"-"\u0ab0", + "\u0ab2"-"\u0ab3", + "\u0ab5"-"\u0ab9", + "\u0abd", + "\u0ad0", + "\u0ae0", + "\u0b05"-"\u0b0c", + "\u0b0f"-"\u0b10", + "\u0b13"-"\u0b28", + "\u0b2a"-"\u0b30", + "\u0b32"-"\u0b33", + "\u0b36"-"\u0b39", + "\u0b3d", + "\u0b5c"-"\u0b5d", + "\u0b5f"-"\u0b61", + "\u0b85"-"\u0b8a", + "\u0b8e"-"\u0b90", + "\u0b92"-"\u0b95", + "\u0b99"-"\u0b9a", + "\u0b9c", + "\u0b9e"-"\u0b9f", + "\u0ba3"-"\u0ba4", + "\u0ba8"-"\u0baa", + "\u0bae"-"\u0bb5", + "\u0bb7"-"\u0bb9", + "\u0c05"-"\u0c0c", + "\u0c0e"-"\u0c10", + "\u0c12"-"\u0c28", + "\u0c2a"-"\u0c33", + "\u0c35"-"\u0c39", + "\u0c60"-"\u0c61", + "\u0c85"-"\u0c8c", + "\u0c8e"-"\u0c90", + "\u0c92"-"\u0ca8", + "\u0caa"-"\u0cb3", + "\u0cb5"-"\u0cb9", + "\u0cde", + "\u0ce0"-"\u0ce1", + "\u0d05"-"\u0d0c", + "\u0d0e"-"\u0d10", + "\u0d12"-"\u0d28", + "\u0d2a"-"\u0d39", + "\u0d60"-"\u0d61", + "\u0d85"-"\u0d96", + "\u0d9a"-"\u0db1", + "\u0db3"-"\u0dbb", + "\u0dbd", + "\u0dc0"-"\u0dc6", + "\u0e01"-"\u0e30", + "\u0e32"-"\u0e33", + "\u0e3f"-"\u0e46", + "\u0e81"-"\u0e82", + "\u0e84", + "\u0e87"-"\u0e88", + "\u0e8a", + "\u0e8d", + "\u0e94"-"\u0e97", + "\u0e99"-"\u0e9f", + "\u0ea1"-"\u0ea3", + "\u0ea5", + "\u0ea7", + "\u0eaa"-"\u0eab", + "\u0ead"-"\u0eb0", + "\u0eb2"-"\u0eb3", + "\u0ebd", + "\u0ec0"-"\u0ec4", + "\u0ec6", + "\u0edc"-"\u0edd", + "\u0f00", + "\u0f40"-"\u0f47", + "\u0f49"-"\u0f6a", + "\u0f88"-"\u0f8b", + "\u1000"-"\u1021", + "\u1023"-"\u1027", + "\u1029"-"\u102a", + "\u1050"-"\u1055", + "\u10a0"-"\u10c5", + "\u10d0"-"\u10f6", + "\u1100"-"\u1159", + "\u115f"-"\u11a2", + "\u11a8"-"\u11f9", + "\u1200"-"\u1206", + "\u1208"-"\u1246", + "\u1248", + "\u124a"-"\u124d", + "\u1250"-"\u1256", + "\u1258", + "\u125a"-"\u125d", + "\u1260"-"\u1286", + "\u1288", + "\u128a"-"\u128d", + "\u1290"-"\u12ae", + "\u12b0", + "\u12b2"-"\u12b5", + "\u12b8"-"\u12be", + "\u12c0", + "\u12c2"-"\u12c5", + "\u12c8"-"\u12ce", + "\u12d0"-"\u12d6", + "\u12d8"-"\u12ee", + "\u12f0"-"\u130e", + "\u1310", + "\u1312"-"\u1315", + "\u1318"-"\u131e", + "\u1320"-"\u1346", + "\u1348"-"\u135a", + "\u13a0"-"\u13f4", + "\u1401"-"\u166c", + "\u166f"-"\u1676", + "\u1681"-"\u169a", + "\u16a0"-"\u16ea", + "\u1780"-"\u17b3", + "\u17db", + "\u1820"-"\u1877", + "\u1880"-"\u18a8", + "\u1e00"-"\u1e9b", + "\u1ea0"-"\u1ef9", + "\u1f00"-"\u1f15", + "\u1f18"-"\u1f1d", + "\u1f20"-"\u1f45", + "\u1f48"-"\u1f4d", + "\u1f50"-"\u1f57", + "\u1f59", + "\u1f5b", + "\u1f5d", + "\u1f5f"-"\u1f7d", + "\u1f80"-"\u1fb4", + "\u1fb6"-"\u1fbc", + "\u1fbe", + "\u1fc2"-"\u1fc4", + "\u1fc6"-"\u1fcc", + "\u1fd0"-"\u1fd3", + "\u1fd6"-"\u1fdb", + "\u1fe0"-"\u1fec", + "\u1ff2"-"\u1ff4", + "\u1ff6"-"\u1ffc", + "\u203f"-"\u2040", + "\u207f", + "\u20a0"-"\u20af", + "\u2102", + "\u2107", + "\u210a"-"\u2113", + "\u2115", + "\u2119"-"\u211d", + "\u2124", + "\u2126", + "\u2128", + "\u212a"-"\u212d", + "\u212f"-"\u2131", + "\u2133"-"\u2139", + "\u2160"-"\u2183", + "\u3005"-"\u3007", + "\u3021"-"\u3029", + "\u3031"-"\u3035", + "\u3038"-"\u303a", + "\u3041"-"\u3094", + "\u309d"-"\u309e", + "\u30a1"-"\u30fe", + "\u3105"-"\u312c", + "\u3131"-"\u318e", + "\u31a0"-"\u31b7", + "\u3400"-"\u4db5", + "\u4e00"-"\u9fa5", + "\ua000"-"\ua48c", + "\uac00"-"\ud7a3", + "\uf900"-"\ufa2d", + "\ufb00"-"\ufb06", + "\ufb13"-"\ufb17", + "\ufb1d", + "\ufb1f"-"\ufb28", + "\ufb2a"-"\ufb36", + "\ufb38"-"\ufb3c", + "\ufb3e", + "\ufb40"-"\ufb41", + "\ufb43"-"\ufb44", + "\ufb46"-"\ufbb1", + "\ufbd3"-"\ufd3d", + "\ufd50"-"\ufd8f", + "\ufd92"-"\ufdc7", + "\ufdf0"-"\ufdfb", + "\ufe33"-"\ufe34", + "\ufe4d"-"\ufe4f", + "\ufe69", + "\ufe70"-"\ufe72", + "\ufe74", + "\ufe76"-"\ufefc", + "\uff04", + "\uff21"-"\uff3a", + "\uff3f", + "\uff41"-"\uff5a", + "\uff65"-"\uffbe", + "\uffc2"-"\uffc7", + "\uffca"-"\uffcf", + "\uffd2"-"\uffd7", + "\uffda"-"\uffdc", + "\uffe0"-"\uffe1", + "\uffe5"-"\uffe6" + ] + > +| + < #PART_LETTER: + [ // all chars for which Character.isIdentifierPart is true + "\u0000"-"\u0008", + "\u000e"-"\u001b", + "$", + "0"-"9", + "A"-"Z", + "_", + "a"-"z", + "\u007f"-"\u009f", + "\u00a2"-"\u00a5", + "\u00aa", + "\u00b5", + "\u00ba", + "\u00c0"-"\u00d6", + "\u00d8"-"\u00f6", + "\u00f8"-"\u021f", + "\u0222"-"\u0233", + "\u0250"-"\u02ad", + "\u02b0"-"\u02b8", + "\u02bb"-"\u02c1", + "\u02d0"-"\u02d1", + "\u02e0"-"\u02e4", + "\u02ee", + "\u0300"-"\u034e", + "\u0360"-"\u0362", + "\u037a", + "\u0386", + "\u0388"-"\u038a", + "\u038c", + "\u038e"-"\u03a1", + "\u03a3"-"\u03ce", + "\u03d0"-"\u03d7", + "\u03da"-"\u03f3", + "\u0400"-"\u0481", + "\u0483"-"\u0486", + "\u048c"-"\u04c4", + "\u04c7"-"\u04c8", + "\u04cb"-"\u04cc", + "\u04d0"-"\u04f5", + "\u04f8"-"\u04f9", + "\u0531"-"\u0556", + "\u0559", + "\u0561"-"\u0587", + "\u0591"-"\u05a1", + "\u05a3"-"\u05b9", + "\u05bb"-"\u05bd", + "\u05bf", + "\u05c1"-"\u05c2", + "\u05c4", + "\u05d0"-"\u05ea", + "\u05f0"-"\u05f2", + "\u0621"-"\u063a", + "\u0640"-"\u0655", + "\u0660"-"\u0669", + "\u0670"-"\u06d3", + "\u06d5"-"\u06dc", + "\u06df"-"\u06e8", + "\u06ea"-"\u06ed", + "\u06f0"-"\u06fc", + "\u070f"-"\u072c", + "\u0730"-"\u074a", + "\u0780"-"\u07b0", + "\u0901"-"\u0903", + "\u0905"-"\u0939", + "\u093c"-"\u094d", + "\u0950"-"\u0954", + "\u0958"-"\u0963", + "\u0966"-"\u096f", + "\u0981"-"\u0983", + "\u0985"-"\u098c", + "\u098f"-"\u0990", + "\u0993"-"\u09a8", + "\u09aa"-"\u09b0", + "\u09b2", + "\u09b6"-"\u09b9", + "\u09bc", + "\u09be"-"\u09c4", + "\u09c7"-"\u09c8", + "\u09cb"-"\u09cd", + "\u09d7", + "\u09dc"-"\u09dd", + "\u09df"-"\u09e3", + "\u09e6"-"\u09f3", + "\u0a02", + "\u0a05"-"\u0a0a", + "\u0a0f"-"\u0a10", + "\u0a13"-"\u0a28", + "\u0a2a"-"\u0a30", + "\u0a32"-"\u0a33", + "\u0a35"-"\u0a36", + "\u0a38"-"\u0a39", + "\u0a3c", + "\u0a3e"-"\u0a42", + "\u0a47"-"\u0a48", + "\u0a4b"-"\u0a4d", + "\u0a59"-"\u0a5c", + "\u0a5e", + "\u0a66"-"\u0a74", + "\u0a81"-"\u0a83", + "\u0a85"-"\u0a8b", + "\u0a8d", + "\u0a8f"-"\u0a91", + "\u0a93"-"\u0aa8", + "\u0aaa"-"\u0ab0", + "\u0ab2"-"\u0ab3", + "\u0ab5"-"\u0ab9", + "\u0abc"-"\u0ac5", + "\u0ac7"-"\u0ac9", + "\u0acb"-"\u0acd", + "\u0ad0", + "\u0ae0", + "\u0ae6"-"\u0aef", + "\u0b01"-"\u0b03", + "\u0b05"-"\u0b0c", + "\u0b0f"-"\u0b10", + "\u0b13"-"\u0b28", + "\u0b2a"-"\u0b30", + "\u0b32"-"\u0b33", + "\u0b36"-"\u0b39", + "\u0b3c"-"\u0b43", + "\u0b47"-"\u0b48", + "\u0b4b"-"\u0b4d", + "\u0b56"-"\u0b57", + "\u0b5c"-"\u0b5d", + "\u0b5f"-"\u0b61", + "\u0b66"-"\u0b6f", + "\u0b82"-"\u0b83", + "\u0b85"-"\u0b8a", + "\u0b8e"-"\u0b90", + "\u0b92"-"\u0b95", + "\u0b99"-"\u0b9a", + "\u0b9c", + "\u0b9e"-"\u0b9f", + "\u0ba3"-"\u0ba4", + "\u0ba8"-"\u0baa", + "\u0bae"-"\u0bb5", + "\u0bb7"-"\u0bb9", + "\u0bbe"-"\u0bc2", + "\u0bc6"-"\u0bc8", + "\u0bca"-"\u0bcd", + "\u0bd7", + "\u0be7"-"\u0bef", + "\u0c01"-"\u0c03", + "\u0c05"-"\u0c0c", + "\u0c0e"-"\u0c10", + "\u0c12"-"\u0c28", + "\u0c2a"-"\u0c33", + "\u0c35"-"\u0c39", + "\u0c3e"-"\u0c44", + "\u0c46"-"\u0c48", + "\u0c4a"-"\u0c4d", + "\u0c55"-"\u0c56", + "\u0c60"-"\u0c61", + "\u0c66"-"\u0c6f", + "\u0c82"-"\u0c83", + "\u0c85"-"\u0c8c", + "\u0c8e"-"\u0c90", + "\u0c92"-"\u0ca8", + "\u0caa"-"\u0cb3", + "\u0cb5"-"\u0cb9", + "\u0cbe"-"\u0cc4", + "\u0cc6"-"\u0cc8", + "\u0cca"-"\u0ccd", + "\u0cd5"-"\u0cd6", + "\u0cde", + "\u0ce0"-"\u0ce1", + "\u0ce6"-"\u0cef", + "\u0d02"-"\u0d03", + "\u0d05"-"\u0d0c", + "\u0d0e"-"\u0d10", + "\u0d12"-"\u0d28", + "\u0d2a"-"\u0d39", + "\u0d3e"-"\u0d43", + "\u0d46"-"\u0d48", + "\u0d4a"-"\u0d4d", + "\u0d57", + "\u0d60"-"\u0d61", + "\u0d66"-"\u0d6f", + "\u0d82"-"\u0d83", + "\u0d85"-"\u0d96", + "\u0d9a"-"\u0db1", + "\u0db3"-"\u0dbb", + "\u0dbd", + "\u0dc0"-"\u0dc6", + "\u0dca", + "\u0dcf"-"\u0dd4", + "\u0dd6", + "\u0dd8"-"\u0ddf", + "\u0df2"-"\u0df3", + "\u0e01"-"\u0e3a", + "\u0e3f"-"\u0e4e", + "\u0e50"-"\u0e59", + "\u0e81"-"\u0e82", + "\u0e84", + "\u0e87"-"\u0e88", + "\u0e8a", + "\u0e8d", + "\u0e94"-"\u0e97", + "\u0e99"-"\u0e9f", + "\u0ea1"-"\u0ea3", + "\u0ea5", + "\u0ea7", + "\u0eaa"-"\u0eab", + "\u0ead"-"\u0eb9", + "\u0ebb"-"\u0ebd", + "\u0ec0"-"\u0ec4", + "\u0ec6", + "\u0ec8"-"\u0ecd", + "\u0ed0"-"\u0ed9", + "\u0edc"-"\u0edd", + "\u0f00", + "\u0f18"-"\u0f19", + "\u0f20"-"\u0f29", + "\u0f35", + "\u0f37", + "\u0f39", + "\u0f3e"-"\u0f47", + "\u0f49"-"\u0f6a", + "\u0f71"-"\u0f84", + "\u0f86"-"\u0f8b", + "\u0f90"-"\u0f97", + "\u0f99"-"\u0fbc", + "\u0fc6", + "\u1000"-"\u1021", + "\u1023"-"\u1027", + "\u1029"-"\u102a", + "\u102c"-"\u1032", + "\u1036"-"\u1039", + "\u1040"-"\u1049", + "\u1050"-"\u1059", + "\u10a0"-"\u10c5", + "\u10d0"-"\u10f6", + "\u1100"-"\u1159", + "\u115f"-"\u11a2", + "\u11a8"-"\u11f9", + "\u1200"-"\u1206", + "\u1208"-"\u1246", + "\u1248", + "\u124a"-"\u124d", + "\u1250"-"\u1256", + "\u1258", + "\u125a"-"\u125d", + "\u1260"-"\u1286", + "\u1288", + "\u128a"-"\u128d", + "\u1290"-"\u12ae", + "\u12b0", + "\u12b2"-"\u12b5", + "\u12b8"-"\u12be", + "\u12c0", + "\u12c2"-"\u12c5", + "\u12c8"-"\u12ce", + "\u12d0"-"\u12d6", + "\u12d8"-"\u12ee", + "\u12f0"-"\u130e", + "\u1310", + "\u1312"-"\u1315", + "\u1318"-"\u131e", + "\u1320"-"\u1346", + "\u1348"-"\u135a", + "\u1369"-"\u1371", + "\u13a0"-"\u13f4", + "\u1401"-"\u166c", + "\u166f"-"\u1676", + "\u1681"-"\u169a", + "\u16a0"-"\u16ea", + "\u1780"-"\u17d3", + "\u17db", + "\u17e0"-"\u17e9", + "\u180b"-"\u180e", + "\u1810"-"\u1819", + "\u1820"-"\u1877", + "\u1880"-"\u18a9", + "\u1e00"-"\u1e9b", + "\u1ea0"-"\u1ef9", + "\u1f00"-"\u1f15", + "\u1f18"-"\u1f1d", + "\u1f20"-"\u1f45", + "\u1f48"-"\u1f4d", + "\u1f50"-"\u1f57", + "\u1f59", + "\u1f5b", + "\u1f5d", + "\u1f5f"-"\u1f7d", + "\u1f80"-"\u1fb4", + "\u1fb6"-"\u1fbc", + "\u1fbe", + "\u1fc2"-"\u1fc4", + "\u1fc6"-"\u1fcc", + "\u1fd0"-"\u1fd3", + "\u1fd6"-"\u1fdb", + "\u1fe0"-"\u1fec", + "\u1ff2"-"\u1ff4", + "\u1ff6"-"\u1ffc", + "\u200c"-"\u200f", + "\u202a"-"\u202e", + "\u203f"-"\u2040", + "\u206a"-"\u206f", + "\u207f", + "\u20a0"-"\u20af", + "\u20d0"-"\u20dc", + "\u20e1", + "\u2102", + "\u2107", + "\u210a"-"\u2113", + "\u2115", + "\u2119"-"\u211d", + "\u2124", + "\u2126", + "\u2128", + "\u212a"-"\u212d", + "\u212f"-"\u2131", + "\u2133"-"\u2139", + "\u2160"-"\u2183", + "\u3005"-"\u3007", + "\u3021"-"\u302f", + "\u3031"-"\u3035", + "\u3038"-"\u303a", + "\u3041"-"\u3094", + "\u3099"-"\u309a", + "\u309d"-"\u309e", + "\u30a1"-"\u30fe", + "\u3105"-"\u312c", + "\u3131"-"\u318e", + "\u31a0"-"\u31b7", + "\u3400"-"\u4db5", + "\u4e00"-"\u9fa5", + "\ua000"-"\ua48c", + "\uac00"-"\ud7a3", + "\uf900"-"\ufa2d", + "\ufb00"-"\ufb06", + "\ufb13"-"\ufb17", + "\ufb1d"-"\ufb28", + "\ufb2a"-"\ufb36", + "\ufb38"-"\ufb3c", + "\ufb3e", + "\ufb40"-"\ufb41", + "\ufb43"-"\ufb44", + "\ufb46"-"\ufbb1", + "\ufbd3"-"\ufd3d", + "\ufd50"-"\ufd8f", + "\ufd92"-"\ufdc7", + "\ufdf0"-"\ufdfb", + "\ufe20"-"\ufe23", + "\ufe33"-"\ufe34", + "\ufe4d"-"\ufe4f", + "\ufe69", + "\ufe70"-"\ufe72", + "\ufe74", + "\ufe76"-"\ufefc", + "\ufeff", + "\uff04", + "\uff10"-"\uff19", + "\uff21"-"\uff3a", + "\uff3f", + "\uff41"-"\uff5a", + "\uff65"-"\uffbe", + "\uffc2"-"\uffc7", + "\uffca"-"\uffcf", + "\uffd2"-"\uffd7", + "\uffda"-"\uffdc", + "\uffe0"-"\uffe1", + "\uffe5"-"\uffe6", + "\ufff9"-"\ufffb" + ] + > +} + +/* SEPARATORS */ + +TOKEN : +{ + < LPAREN: "(" > +| < RPAREN: ")" > +| < LBRACE: "{" > +| < RBRACE: "}" > +| < LBRACKET: "[" > +| < RBRACKET: "]" > +| < SEMICOLON: ";" > +| < COMMA: "," > +| < DOT: "." > +| < AT: "@" > +} + +/* OPERATORS */ + +TOKEN : +{ + < ASSIGN: "=" > +| < LT: "<" > +| < BANG: "!" > +| < TILDE: "~" > +| < HOOK: "?" > +| < COLON: ":" > +| < EQ: "==" > +| < LE: "<=" > +| < GE: ">=" > +| < NE: "!=" > +| < SC_OR: "||" > +| < SC_AND: "&&" > +| < INCR: "++" > +| < DECR: "--" > +| < PLUS: "+" > +| < MINUS: "-" > +| < STAR: "*" > +| < SLASH: "/" > +| < BIT_AND: "&" > +| < BIT_OR: "|" > +| < XOR: "^" > +| < REM: "%" > +| < LSHIFT: "<<" > +| < PLUSASSIGN: "+=" > +| < MINUSASSIGN: "-=" > +| < STARASSIGN: "*=" > +| < SLASHASSIGN: "/=" > +| < ANDASSIGN: "&=" > +| < ORASSIGN: "|=" > +| < XORASSIGN: "^=" > +| < REMASSIGN: "%=" > +| < LSHIFTASSIGN: "<<=" > +| < RSIGNEDSHIFTASSIGN: ">>=" > +| < RUNSIGNEDSHIFTASSIGN: ">>>=" > +| < ELLIPSIS: "..." > +} + +/* >'s need special attention due to generics syntax. */ +TOKEN : +{ + < RUNSIGNEDSHIFT: ">>>" > + { + matchedToken.kind = GT; + ((Token.GTToken)matchedToken).realKind = RUNSIGNEDSHIFT; + input_stream.backup(2); + matchedToken.image = ">"; + } +| < RSIGNEDSHIFT: ">>" > + { + matchedToken.kind = GT; + ((Token.GTToken)matchedToken).realKind = RSIGNEDSHIFT; + input_stream.backup(1); + matchedToken.image = ">"; + } +| < GT: ">" > +} + +boolean Line() : +{/*@bgen(jjtree) Line */ + SimpleNode jjtn000 = new SimpleNode(JJTLINE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/ + int modifiers; +} +{/*@bgen(jjtree) Line */ + try { +/*@egen*/ + <EOF>/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + } +/*@egen*/ { + return true; + } +| + LOOKAHEAD(BlockStatement()) + BlockStatement()/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + } +/*@egen*/ { + return false; + } +| + LOOKAHEAD(Modifiers() [ TypeParameters() ] [ ResultType() ] <IDENTIFIER> FormalParameters() [ "throws" NameList() ] "{") + ClassOrInterfaceBodyDeclaration(false)/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + } +/*@egen*/ { + return false; + } +| + LOOKAHEAD(ClassOrInterfaceBodyDeclaration(false)) + ClassOrInterfaceBodyDeclaration(false)/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + } +/*@egen*/ { + return false; + } +| + LOOKAHEAD(Expression()) + Expression()/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + } +/*@egen*/ { + return false; + } +| + ImportDeclaration()/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + } +/*@egen*/ { + return false; + }/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +/***************************************** + * THE JAVA LANGUAGE GRAMMAR STARTS HERE * + *****************************************/ + +/* + * Program structuring syntax follows. + */ + +void CompilationUnit(): +{/*@bgen(jjtree) CompilationUnit */ + SimpleNode jjtn000 = new SimpleNode(JJTCOMPILATIONUNIT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) CompilationUnit */ + try { +/*@egen*/ + [ LOOKAHEAD( ( Annotation() )* "package" ) PackageDeclaration() ] + ( ImportDeclaration() )* + ( TypeDeclaration() )* + ( < "\u001a" > )? + ( <STUFF_TO_IGNORE: ~[]> )? + <EOF>/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void PackageDeclaration(): +{/*@bgen(jjtree) PackageDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTPACKAGEDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) PackageDeclaration */ + try { +/*@egen*/ + Modifiers() "package" Name() ";"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ImportDeclaration(): +{/*@bgen(jjtree) ImportDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTIMPORTDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ImportDeclaration */ + try { +/*@egen*/ + "import" [ "static" ] Name() [ "." "*" ] ";"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +/* + * Modifiers. We match all modifiers in a single rule to reduce the chances of + * syntax errors for simple modifier mistakes. It will also enable us to give + * better error messages. + */ + +int Modifiers(): +{/*@bgen(jjtree) Modifiers */ + SimpleNode jjtn000 = new SimpleNode(JJTMODIFIERS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/ + int modifiers = 0; +} +{/*@bgen(jjtree) Modifiers */ + try { +/*@egen*/ + ( + LOOKAHEAD(2) + ( + "public" { modifiers |= ModifierSet.PUBLIC; } + | + "static" { modifiers |= ModifierSet.STATIC; } + | + "protected" { modifiers |= ModifierSet.PROTECTED; } + | + "private" { modifiers |= ModifierSet.PRIVATE; } + | + "final" { modifiers |= ModifierSet.FINAL; } + | + "abstract" { modifiers |= ModifierSet.ABSTRACT; } + | + "synchronized" { modifiers |= ModifierSet.SYNCHRONIZED; } + | + "native" { modifiers |= ModifierSet.NATIVE; } + | + "transient" { modifiers |= ModifierSet.TRANSIENT; } + | + "volatile" { modifiers |= ModifierSet.VOLATILE; } + | + "strictfp" { modifiers |= ModifierSet.STRICTFP; } + | + Annotation() + ) + )*/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + } +/*@egen*/ + + { + return modifiers; + }/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +/* + * Declaration syntax follows. + */ +void TypeDeclaration(): +{/*@bgen(jjtree) TypeDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTTYPEDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/ + int modifiers; +} +{/*@bgen(jjtree) TypeDeclaration */ + try { +/*@egen*/ + ";" +| + modifiers = Modifiers() + ( + ClassOrInterfaceDeclaration(modifiers) + | + EnumDeclaration(modifiers) + | + AnnotationTypeDeclaration(modifiers) + )/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + + +void ClassOrInterfaceDeclaration(int modifiers): +{/*@bgen(jjtree) ClassOrInterfaceDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACEDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/ + boolean isInterface = false; +} +{/*@bgen(jjtree) ClassOrInterfaceDeclaration */ + try { +/*@egen*/ + ( "class" | "interface" { isInterface = true; } ) + <IDENTIFIER> + [ TypeParameters() ] + [ ExtendsList(isInterface) ] + [ ImplementsList(isInterface) ] + ClassOrInterfaceBody(isInterface)/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ExtendsList(boolean isInterface): +{/*@bgen(jjtree) ExtendsList */ + SimpleNode jjtn000 = new SimpleNode(JJTEXTENDSLIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/ + boolean extendsMoreThanOne = false; +} +{/*@bgen(jjtree) ExtendsList */ + try { +/*@egen*/ + "extends" ClassOrInterfaceType() + ( "," ClassOrInterfaceType() { extendsMoreThanOne = true; } )*/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + } +/*@egen*/ + { + if (extendsMoreThanOne && !isInterface) + throw new ParseException("A class cannot extend more than one other class"); + }/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ImplementsList(boolean isInterface): +{/*@bgen(jjtree) ImplementsList */ + SimpleNode jjtn000 = new SimpleNode(JJTIMPLEMENTSLIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ImplementsList */ + try { +/*@egen*/ + "implements" ClassOrInterfaceType() + ( "," ClassOrInterfaceType() )*/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + } +/*@egen*/ + { + if (isInterface) + throw new ParseException("An interface cannot implement other interfaces"); + }/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void EnumDeclaration(int modifiers): +{/*@bgen(jjtree) EnumDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTENUMDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) EnumDeclaration */ + try { +/*@egen*/ + "enum" <IDENTIFIER> + [ ImplementsList(false) ] + EnumBody()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void EnumBody(): +{/*@bgen(jjtree) EnumBody */ + SimpleNode jjtn000 = new SimpleNode(JJTENUMBODY); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) EnumBody */ + try { +/*@egen*/ + "{" + [ EnumConstant() ( LOOKAHEAD(2) "," EnumConstant() )* ] + [ "," ] + [ ";" ( ClassOrInterfaceBodyDeclaration(false) )* ] + "}"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void EnumConstant(): +{/*@bgen(jjtree) EnumConstant */ + SimpleNode jjtn000 = new SimpleNode(JJTENUMCONSTANT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) EnumConstant */ + try { +/*@egen*/ + Modifiers() <IDENTIFIER> [ Arguments() ] [ ClassOrInterfaceBody(false) ]/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void TypeParameters(): +{/*@bgen(jjtree) TypeParameters */ + SimpleNode jjtn000 = new SimpleNode(JJTTYPEPARAMETERS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) TypeParameters */ + try { +/*@egen*/ + "<" TypeParameter() ( "," TypeParameter() )* ">"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void TypeParameter(): +{/*@bgen(jjtree) TypeParameter */ + SimpleNode jjtn000 = new SimpleNode(JJTTYPEPARAMETER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) TypeParameter */ + try { +/*@egen*/ + <IDENTIFIER> [ TypeBound() ]/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void TypeBound(): +{/*@bgen(jjtree) TypeBound */ + SimpleNode jjtn000 = new SimpleNode(JJTTYPEBOUND); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) TypeBound */ + try { +/*@egen*/ + "extends" ClassOrInterfaceType() ( "&" ClassOrInterfaceType() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ClassOrInterfaceBody(boolean isInterface): +{/*@bgen(jjtree) ClassOrInterfaceBody */ + SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACEBODY); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ClassOrInterfaceBody */ + try { +/*@egen*/ + "{" ( ClassOrInterfaceBodyDeclaration(isInterface) )* "}"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ClassOrInterfaceBodyDeclaration(boolean isInterface): +{/*@bgen(jjtree) ClassOrInterfaceBodyDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACEBODYDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/ + boolean isNestedInterface = false; + int modifiers; +} +{/*@bgen(jjtree) ClassOrInterfaceBodyDeclaration */ + try { +/*@egen*/ + LOOKAHEAD(2) + Initializer()/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + } +/*@egen*/ + { + if (isInterface) + throw new ParseException("An interface cannot have initializers"); + } +| + modifiers = Modifiers() // Just get all the modifiers out of the way. If you want to do + // more checks, pass the modifiers down to the member + ( + ClassOrInterfaceDeclaration(modifiers) + | + EnumDeclaration(modifiers) + | + LOOKAHEAD( [ TypeParameters() ] <IDENTIFIER> "(" ) + ConstructorDeclaration() + | + LOOKAHEAD( Type() <IDENTIFIER> ( "[" "]" )* ( "," | "=" | ";" ) ) + FieldDeclaration(modifiers) + | + MethodDeclaration(modifiers) + ) +| + ";"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void FieldDeclaration(int modifiers): +{/*@bgen(jjtree) FieldDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTFIELDDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) FieldDeclaration */ + try { +/*@egen*/ + // Modifiers are already matched in the caller + Type() VariableDeclarator() ( "," VariableDeclarator() )* ";"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void VariableDeclarator(): +{/*@bgen(jjtree) VariableDeclarator */ + SimpleNode jjtn000 = new SimpleNode(JJTVARIABLEDECLARATOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) VariableDeclarator */ + try { +/*@egen*/ + VariableDeclaratorId() [ "=" VariableInitializer() ]/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void VariableDeclaratorId(): +{/*@bgen(jjtree) VariableDeclaratorId */ + SimpleNode jjtn000 = new SimpleNode(JJTVARIABLEDECLARATORID); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) VariableDeclaratorId */ + try { +/*@egen*/ + <IDENTIFIER> ( "[" "]" )*/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void VariableInitializer(): +{/*@bgen(jjtree) VariableInitializer */ + SimpleNode jjtn000 = new SimpleNode(JJTVARIABLEINITIALIZER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) VariableInitializer */ + try { +/*@egen*/ + ArrayInitializer() +| + Expression()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ArrayInitializer(): +{/*@bgen(jjtree) ArrayInitializer */ + SimpleNode jjtn000 = new SimpleNode(JJTARRAYINITIALIZER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ArrayInitializer */ + try { +/*@egen*/ + "{" [ VariableInitializer() ( LOOKAHEAD(2) "," VariableInitializer() )* ] [ "," ] "}"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void MethodDeclaration(int modifiers): +{/*@bgen(jjtree) MethodDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTMETHODDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) MethodDeclaration */ + try { +/*@egen*/ + // Modifiers already matched in the caller! + [ TypeParameters() ] + ResultType() + MethodDeclarator() [ "throws" NameList() ] + ( Block() | ";" )/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void MethodDeclarator(): +{/*@bgen(jjtree) MethodDeclarator */ + SimpleNode jjtn000 = new SimpleNode(JJTMETHODDECLARATOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) MethodDeclarator */ + try { +/*@egen*/ + <IDENTIFIER> FormalParameters() ( "[" "]" )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void FormalParameters(): +{/*@bgen(jjtree) FormalParameters */ + SimpleNode jjtn000 = new SimpleNode(JJTFORMALPARAMETERS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) FormalParameters */ + try { +/*@egen*/ + "(" [ FormalParameter() ( "," FormalParameter() )* ] ")"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void FormalParameter(): +{/*@bgen(jjtree) FormalParameter */ + SimpleNode jjtn000 = new SimpleNode(JJTFORMALPARAMETER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) FormalParameter */ + try { +/*@egen*/ + Modifiers() Type() [ "..." ] VariableDeclaratorId()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ConstructorDeclaration(): +{/*@bgen(jjtree) ConstructorDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTCONSTRUCTORDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ConstructorDeclaration */ + try { +/*@egen*/ + [ TypeParameters() ] + // Modifiers matched in the caller + <IDENTIFIER> FormalParameters() [ "throws" NameList() ] + "{" + [ LOOKAHEAD(ExplicitConstructorInvocation()) + ExplicitConstructorInvocation() + ] + ( BlockStatement() )* + "}"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ExplicitConstructorInvocation(): +{/*@bgen(jjtree) ExplicitConstructorInvocation */ + SimpleNode jjtn000 = new SimpleNode(JJTEXPLICITCONSTRUCTORINVOCATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ExplicitConstructorInvocation */ + try { +/*@egen*/ + ( <IDENTIFIER> "." )* [ LOOKAHEAD(2) "this" "." ] + [ TypeArguments() ] ("this"|"super") Arguments() ";"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void Initializer(): +{/*@bgen(jjtree) Initializer */ + SimpleNode jjtn000 = new SimpleNode(JJTINITIALIZER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) Initializer */ + try { +/*@egen*/ + [ "static" ] Block()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + + +/* + * Type, name and expression syntax follows. + */ + +void Type(): +{/*@bgen(jjtree) Type */ + SimpleNode jjtn000 = new SimpleNode(JJTTYPE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) Type */ + try { +/*@egen*/ + LOOKAHEAD(2) ReferenceType() + | + PrimitiveType()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ReferenceType(): +{/*@bgen(jjtree) ReferenceType */ + SimpleNode jjtn000 = new SimpleNode(JJTREFERENCETYPE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ReferenceType */ + try { +/*@egen*/ + PrimitiveType() ( LOOKAHEAD(2) "[" "]" )+ + | + ( ClassOrInterfaceType() ) ( LOOKAHEAD(2) "[" "]" )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ClassOrInterfaceType(): +{/*@bgen(jjtree) ClassOrInterfaceType */ + SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACETYPE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ClassOrInterfaceType */ + try { +/*@egen*/ + <IDENTIFIER> [ LOOKAHEAD(2) TypeArguments() ] + ( LOOKAHEAD(2) "." <IDENTIFIER> [ LOOKAHEAD(2) TypeArguments() ] )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void TypeArguments(): +{/*@bgen(jjtree) TypeArguments */ + SimpleNode jjtn000 = new SimpleNode(JJTTYPEARGUMENTS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) TypeArguments */ + try { +/*@egen*/ + "<" TypeArgument() ( "," TypeArgument() )* ">"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void TypeArgument(): +{/*@bgen(jjtree) TypeArgument */ + SimpleNode jjtn000 = new SimpleNode(JJTTYPEARGUMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) TypeArgument */ + try { +/*@egen*/ + ReferenceType() + | + "?" [ WildcardBounds() ]/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void WildcardBounds(): +{/*@bgen(jjtree) WildcardBounds */ + SimpleNode jjtn000 = new SimpleNode(JJTWILDCARDBOUNDS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) WildcardBounds */ + try { +/*@egen*/ + "extends" ReferenceType() + | + "super" ReferenceType()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + + +void PrimitiveType(): +{/*@bgen(jjtree) PrimitiveType */ + SimpleNode jjtn000 = new SimpleNode(JJTPRIMITIVETYPE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) PrimitiveType */ + try { +/*@egen*/ + "boolean" +| + "char" +| + "byte" +| + "short" +| + "int" +| + "long" +| + "float" +| + "double"/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ResultType(): +{/*@bgen(jjtree) ResultType */ + SimpleNode jjtn000 = new SimpleNode(JJTRESULTTYPE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ResultType */ + try { +/*@egen*/ + "void" +| + Type()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void Name(): +/* + * A lookahead of 2 is required below since "Name" can be followed + * by a ".*" when used in the context of an "ImportDeclaration". + */ +{/*@bgen(jjtree) Name */ + SimpleNode jjtn000 = new SimpleNode(JJTNAME); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) Name */ + try { +/*@egen*/ + <IDENTIFIER> + ( LOOKAHEAD(2) "." <IDENTIFIER> + )*/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void NameList(): +{/*@bgen(jjtree) NameList */ + SimpleNode jjtn000 = new SimpleNode(JJTNAMELIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) NameList */ + try { +/*@egen*/ + Name() ( "," Name() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + + +/* + * Expression syntax follows. + */ + +void Expression(): +/* + * This expansion has been written this way instead of: + * Assignment() | ConditionalExpression() + * for performance reasons. + * However, it is a weakening of the grammar for it allows the LHS of + * assignments to be any conditional expression whereas it can only be + * a primary expression. Consider adding a semantic predicate to work + * around this. + */ +{/*@bgen(jjtree) Expression */ + SimpleNode jjtn000 = new SimpleNode(JJTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) Expression */ + try { +/*@egen*/ + ConditionalExpression() + [ + LOOKAHEAD(2) + AssignmentOperator() Expression() + ]/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void AssignmentOperator(): +{/*@bgen(jjtree) AssignmentOperator */ + SimpleNode jjtn000 = new SimpleNode(JJTASSIGNMENTOPERATOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) AssignmentOperator */ + try { +/*@egen*/ + "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|="/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void AssignmentExpression(): +{/*@bgen(jjtree) AssignmentExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTASSIGNMENTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) AssignmentExpression */ + try { +/*@egen*/ + PrimaryExpression() AssignmentOperator() Expression()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ConditionalExpression(): +{/*@bgen(jjtree) ConditionalExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTCONDITIONALEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ConditionalExpression */ + try { +/*@egen*/ + ConditionalOrExpression() [ "?" Expression() ":" Expression() ]/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ConditionalOrExpression(): +{/*@bgen(jjtree) ConditionalOrExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTCONDITIONALOREXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ConditionalOrExpression */ + try { +/*@egen*/ + ConditionalAndExpression() ( "||" ConditionalAndExpression() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ConditionalAndExpression(): +{/*@bgen(jjtree) ConditionalAndExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTCONDITIONALANDEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ConditionalAndExpression */ + try { +/*@egen*/ + InclusiveOrExpression() ( "&&" InclusiveOrExpression() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void InclusiveOrExpression(): +{/*@bgen(jjtree) InclusiveOrExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTINCLUSIVEOREXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) InclusiveOrExpression */ + try { +/*@egen*/ + ExclusiveOrExpression() ( "|" ExclusiveOrExpression() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ExclusiveOrExpression(): +{/*@bgen(jjtree) ExclusiveOrExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTEXCLUSIVEOREXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ExclusiveOrExpression */ + try { +/*@egen*/ + AndExpression() ( "^" AndExpression() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void AndExpression(): +{/*@bgen(jjtree) AndExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTANDEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) AndExpression */ + try { +/*@egen*/ + EqualityExpression() ( "&" EqualityExpression() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void EqualityExpression(): +{/*@bgen(jjtree) EqualityExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTEQUALITYEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) EqualityExpression */ + try { +/*@egen*/ + InstanceOfExpression() ( ( "==" | "!=" ) InstanceOfExpression() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void InstanceOfExpression(): +{/*@bgen(jjtree) InstanceOfExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTINSTANCEOFEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) InstanceOfExpression */ + try { +/*@egen*/ + RelationalExpression() [ "instanceof" Type() ]/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void RelationalExpression(): +{/*@bgen(jjtree) RelationalExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTRELATIONALEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) RelationalExpression */ + try { +/*@egen*/ + ShiftExpression() ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ShiftExpression(): +{/*@bgen(jjtree) ShiftExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTSHIFTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ShiftExpression */ + try { +/*@egen*/ + AdditiveExpression() ( ( "<<" | RSIGNEDSHIFT() | RUNSIGNEDSHIFT() ) AdditiveExpression() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void AdditiveExpression(): +{/*@bgen(jjtree) AdditiveExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTADDITIVEEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) AdditiveExpression */ + try { +/*@egen*/ + MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void MultiplicativeExpression(): +{/*@bgen(jjtree) MultiplicativeExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTMULTIPLICATIVEEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) MultiplicativeExpression */ + try { +/*@egen*/ + UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void UnaryExpression(): +{/*@bgen(jjtree) UnaryExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTUNARYEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) UnaryExpression */ + try { +/*@egen*/ + ( "+" | "-" ) UnaryExpression() +| + PreIncrementExpression() +| + PreDecrementExpression() +| + UnaryExpressionNotPlusMinus()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void PreIncrementExpression(): +{/*@bgen(jjtree) PreIncrementExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTPREINCREMENTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) PreIncrementExpression */ + try { +/*@egen*/ + "++" PrimaryExpression()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void PreDecrementExpression(): +{/*@bgen(jjtree) PreDecrementExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTPREDECREMENTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) PreDecrementExpression */ + try { +/*@egen*/ + "--" PrimaryExpression()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void UnaryExpressionNotPlusMinus(): +{/*@bgen(jjtree) UnaryExpressionNotPlusMinus */ + SimpleNode jjtn000 = new SimpleNode(JJTUNARYEXPRESSIONNOTPLUSMINUS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) UnaryExpressionNotPlusMinus */ + try { +/*@egen*/ + ( "~" | "!" ) UnaryExpression() +| + LOOKAHEAD( CastLookahead() ) + CastExpression() +| + PostfixExpression()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +// This production is to determine lookahead only. The LOOKAHEAD specifications +// below are not used, but they are there just to indicate that we know about +// this. +void CastLookahead(): +{/*@bgen(jjtree) CastLookahead */ + SimpleNode jjtn000 = new SimpleNode(JJTCASTLOOKAHEAD); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) CastLookahead */ + try { +/*@egen*/ + LOOKAHEAD(2) + "(" PrimitiveType() +| + LOOKAHEAD("(" Type() "[") + "(" Type() "[" "]" +| + "(" Type() ")" ( "~" | "!" | "(" | <IDENTIFIER> | "this" | "super" | "new" | Literal() )/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void PostfixExpression(): +{/*@bgen(jjtree) PostfixExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTPOSTFIXEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) PostfixExpression */ + try { +/*@egen*/ + PrimaryExpression() [ PostfixOperator() ]/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void PostfixOperator(): +{/*@bgen(jjtree) PostfixOperator */ + SimpleNode jjtn000 = new SimpleNode(JJTPOSTFIXOPERATOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) PostfixOperator */ + try { +/*@egen*/ + "++" | "--"/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void CastExpression(): +{/*@bgen(jjtree) CastExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTCASTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) CastExpression */ + try { +/*@egen*/ + LOOKAHEAD("(" PrimitiveType()) + "(" Type() ")" UnaryExpression() +| + "(" Type() ")" UnaryExpressionNotPlusMinus()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void PrimaryExpression(): +{/*@bgen(jjtree) PrimaryExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTPRIMARYEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) PrimaryExpression */ + try { +/*@egen*/ + PrimaryPrefix() ( LOOKAHEAD(2) PrimarySuffix() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void MemberSelector(): +{/*@bgen(jjtree) MemberSelector */ + SimpleNode jjtn000 = new SimpleNode(JJTMEMBERSELECTOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) MemberSelector */ + try { +/*@egen*/ + "." TypeArguments() <IDENTIFIER>/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void PrimaryPrefix(): +{/*@bgen(jjtree) PrimaryPrefix */ + SimpleNode jjtn000 = new SimpleNode(JJTPRIMARYPREFIX); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) PrimaryPrefix */ + try { +/*@egen*/ + Literal() +| + LOOKAHEAD( ( <IDENTIFIER> "." )* "this" ) + ( <IDENTIFIER> "." )* + "this" +| + "super" "." <IDENTIFIER> +| + "(" Expression() ")" +| + AllocationExpression() +| + LOOKAHEAD( ResultType() "." "class" ) + ResultType() "." "class" +| + Name()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void PrimarySuffix(): +{/*@bgen(jjtree) PrimarySuffix */ + SimpleNode jjtn000 = new SimpleNode(JJTPRIMARYSUFFIX); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) PrimarySuffix */ + try { +/*@egen*/ + LOOKAHEAD("." "super" ".") + "." "super" +| + LOOKAHEAD("." "this") + "." "this" +| + LOOKAHEAD(2) + "." AllocationExpression() +| + LOOKAHEAD(3) + MemberSelector() +| + "[" Expression() "]" +| + "." <IDENTIFIER> +| + Arguments()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void Literal(): +{/*@bgen(jjtree) Literal */ + SimpleNode jjtn000 = new SimpleNode(JJTLITERAL); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) Literal */ + try { +/*@egen*/ + <INTEGER_LITERAL> +| + <FLOATING_POINT_LITERAL> +| + <CHARACTER_LITERAL> +| + <STRING_LITERAL> +| + BooleanLiteral() +| + NullLiteral()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void BooleanLiteral(): +{/*@bgen(jjtree) BooleanLiteral */ + SimpleNode jjtn000 = new SimpleNode(JJTBOOLEANLITERAL); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) BooleanLiteral */ + try { +/*@egen*/ + "true" +| + "false"/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void NullLiteral(): +{/*@bgen(jjtree) NullLiteral */ + SimpleNode jjtn000 = new SimpleNode(JJTNULLLITERAL); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) NullLiteral */ + try { +/*@egen*/ + "null"/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void Arguments(): +{/*@bgen(jjtree) Arguments */ + SimpleNode jjtn000 = new SimpleNode(JJTARGUMENTS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) Arguments */ + try { +/*@egen*/ + "(" [ ArgumentList() ] ")"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ArgumentList(): +{/*@bgen(jjtree) ArgumentList */ + SimpleNode jjtn000 = new SimpleNode(JJTARGUMENTLIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ArgumentList */ + try { +/*@egen*/ + Expression() ( "," Expression() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void AllocationExpression(): +{/*@bgen(jjtree) AllocationExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTALLOCATIONEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) AllocationExpression */ + try { +/*@egen*/ + LOOKAHEAD(2) + "new" PrimitiveType() ArrayDimsAndInits() +| + "new" ClassOrInterfaceType() [ TypeArguments() ] + ( + ArrayDimsAndInits() + | + Arguments() [ ClassOrInterfaceBody(false) ] + )/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +/* + * The third LOOKAHEAD specification below is to parse to PrimarySuffix + * if there is an expression between the "[...]". + */ +void ArrayDimsAndInits(): +{/*@bgen(jjtree) ArrayDimsAndInits */ + SimpleNode jjtn000 = new SimpleNode(JJTARRAYDIMSANDINITS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ArrayDimsAndInits */ + try { +/*@egen*/ + LOOKAHEAD(2) + ( LOOKAHEAD(2) "[" Expression() "]" )+ ( LOOKAHEAD(2) "[" "]" )* +| + ( "[" "]" )+ ArrayInitializer()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + + +/* + * Statement syntax follows. + */ + +void Statement(): +{/*@bgen(jjtree) Statement */ + SimpleNode jjtn000 = new SimpleNode(JJTSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) Statement */ + try { +/*@egen*/ + LOOKAHEAD(2) + LabeledStatement() +| + AssertStatement() +| + Block() +| + EmptyStatement() +| + StatementExpression() ";" +| + SwitchStatement() +| + IfStatement() +| + WhileStatement() +| + DoStatement() +| + ForStatement() +| + BreakStatement() +| + ContinueStatement() +| + ReturnStatement() +| + ThrowStatement() +| + SynchronizedStatement() +| + TryStatement()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void AssertStatement(): +{/*@bgen(jjtree) AssertStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTASSERTSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) AssertStatement */ + try { +/*@egen*/ + "assert" Expression() [ ":" Expression() ] ";"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void LabeledStatement(): +{/*@bgen(jjtree) LabeledStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTLABELEDSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) LabeledStatement */ + try { +/*@egen*/ + <IDENTIFIER> ":" Statement()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void Block(): +{/*@bgen(jjtree) Block */ + SimpleNode jjtn000 = new SimpleNode(JJTBLOCK); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) Block */ + try { +/*@egen*/ + "{" ( BlockStatement() )* "}"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void BlockStatement(): +{/*@bgen(jjtree) BlockStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTBLOCKSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) BlockStatement */ + try { +/*@egen*/ + LOOKAHEAD( Modifiers() Type() <IDENTIFIER> ) + LocalVariableDeclaration() ";" +| + Statement() +| + ClassOrInterfaceDeclaration(0)/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void LocalVariableDeclaration(): +{/*@bgen(jjtree) LocalVariableDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTLOCALVARIABLEDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) LocalVariableDeclaration */ + try { +/*@egen*/ + Modifiers() Type() VariableDeclarator() ( "," VariableDeclarator() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void EmptyStatement(): +{/*@bgen(jjtree) EmptyStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTEMPTYSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) EmptyStatement */ + try { +/*@egen*/ + ";"/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void StatementExpression(): +{/*@bgen(jjtree) StatementExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTSTATEMENTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) StatementExpression */ + try { +/*@egen*/ + PreIncrementExpression() +| + PreDecrementExpression() +| + LOOKAHEAD(PrimaryExpression() AssignmentOperator()) + AssignmentExpression() +| + PostfixExpression()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void SwitchStatement(): +{/*@bgen(jjtree) SwitchStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTSWITCHSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) SwitchStatement */ + try { +/*@egen*/ + "switch" "(" Expression() ")" "{" + ( SwitchLabel() ( BlockStatement() )* )* + "}"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void SwitchLabel(): +{/*@bgen(jjtree) SwitchLabel */ + SimpleNode jjtn000 = new SimpleNode(JJTSWITCHLABEL); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) SwitchLabel */ + try { +/*@egen*/ + "case" Expression() ":" +| + "default" ":"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void IfStatement(): +/* + * The disambiguating algorithm of JavaCC automatically binds dangling + * else's to the innermost if statement. The LOOKAHEAD specification + * is to tell JavaCC that we know what we are doing. + */ +{/*@bgen(jjtree) IfStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTIFSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) IfStatement */ + try { +/*@egen*/ + "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ]/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void WhileStatement(): +{/*@bgen(jjtree) WhileStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTWHILESTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) WhileStatement */ + try { +/*@egen*/ + "while" "(" Expression() ")" Statement()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void DoStatement(): +{/*@bgen(jjtree) DoStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTDOSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) DoStatement */ + try { +/*@egen*/ + "do" Statement() "while" "(" Expression() ")" ";"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ForStatement(): +{/*@bgen(jjtree) ForStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTFORSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ForStatement */ + try { +/*@egen*/ + "for" "(" + + ( + LOOKAHEAD(Modifiers() Type() <IDENTIFIER> ":") + Modifiers() Type() <IDENTIFIER> ":" Expression() + | + [ ForInit() ] ";" [ Expression() ] ";" [ ForUpdate() ] + ) + + ")" Statement()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ForInit(): +{/*@bgen(jjtree) ForInit */ + SimpleNode jjtn000 = new SimpleNode(JJTFORINIT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ForInit */ + try { +/*@egen*/ + LOOKAHEAD( Modifiers() Type() <IDENTIFIER> ) + LocalVariableDeclaration() +| + StatementExpressionList()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void StatementExpressionList(): +{/*@bgen(jjtree) StatementExpressionList */ + SimpleNode jjtn000 = new SimpleNode(JJTSTATEMENTEXPRESSIONLIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) StatementExpressionList */ + try { +/*@egen*/ + StatementExpression() ( "," StatementExpression() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ForUpdate(): +{/*@bgen(jjtree) ForUpdate */ + SimpleNode jjtn000 = new SimpleNode(JJTFORUPDATE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ForUpdate */ + try { +/*@egen*/ + StatementExpressionList()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void BreakStatement(): +{/*@bgen(jjtree) BreakStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTBREAKSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) BreakStatement */ + try { +/*@egen*/ + "break" [ <IDENTIFIER> ] ";"/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ContinueStatement(): +{/*@bgen(jjtree) ContinueStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTCONTINUESTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ContinueStatement */ + try { +/*@egen*/ + "continue" [ <IDENTIFIER> ] ";"/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ReturnStatement(): +{/*@bgen(jjtree) ReturnStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTRETURNSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ReturnStatement */ + try { +/*@egen*/ + "return" [ Expression() ] ";"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void ThrowStatement(): +{/*@bgen(jjtree) ThrowStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTTHROWSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) ThrowStatement */ + try { +/*@egen*/ + "throw" Expression() ";"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void SynchronizedStatement(): +{/*@bgen(jjtree) SynchronizedStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTSYNCHRONIZEDSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) SynchronizedStatement */ + try { +/*@egen*/ + "synchronized" "(" Expression() ")" Block()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void TryStatement(): +/* + * Semantic check required here to make sure that at least one + * finally/catch is present. + */ +{/*@bgen(jjtree) TryStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTTRYSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) TryStatement */ + try { +/*@egen*/ + "try" Block() + ( "catch" "(" FormalParameter() ")" Block() )* + [ "finally" Block() ]/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +/* We use productions to match >>>, >> and > so that we can keep the + * type declaration syntax with generics clean + */ + +void RUNSIGNEDSHIFT(): +{/*@bgen(jjtree) RUNSIGNEDSHIFT */ + SimpleNode jjtn000 = new SimpleNode(JJTRUNSIGNEDSHIFT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) RUNSIGNEDSHIFT */ + try { +/*@egen*/ + ( LOOKAHEAD({ getToken(1).kind == GT && + ((Token.GTToken)getToken(1)).realKind == RUNSIGNEDSHIFT} ) + ">" ">" ">" + )/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void RSIGNEDSHIFT(): +{/*@bgen(jjtree) RSIGNEDSHIFT */ + SimpleNode jjtn000 = new SimpleNode(JJTRSIGNEDSHIFT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) RSIGNEDSHIFT */ + try { +/*@egen*/ + ( LOOKAHEAD({ getToken(1).kind == GT && + ((Token.GTToken)getToken(1)).realKind == RSIGNEDSHIFT} ) + ">" ">" + )/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +/* Annotation syntax follows. */ + +void Annotation(): +{/*@bgen(jjtree) Annotation */ + SimpleNode jjtn000 = new SimpleNode(JJTANNOTATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) Annotation */ + try { +/*@egen*/ + LOOKAHEAD( "@" Name() "(" ( <IDENTIFIER> "=" | ")" )) + NormalAnnotation() + | + LOOKAHEAD( "@" Name() "(" ) + SingleMemberAnnotation() + | + MarkerAnnotation()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void NormalAnnotation(): +{/*@bgen(jjtree) NormalAnnotation */ + SimpleNode jjtn000 = new SimpleNode(JJTNORMALANNOTATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) NormalAnnotation */ + try { +/*@egen*/ + "@" Name() "(" [ MemberValuePairs() ] ")"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void MarkerAnnotation(): +{/*@bgen(jjtree) MarkerAnnotation */ + SimpleNode jjtn000 = new SimpleNode(JJTMARKERANNOTATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) MarkerAnnotation */ + try { +/*@egen*/ + "@" Name()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void SingleMemberAnnotation(): +{/*@bgen(jjtree) SingleMemberAnnotation */ + SimpleNode jjtn000 = new SimpleNode(JJTSINGLEMEMBERANNOTATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) SingleMemberAnnotation */ + try { +/*@egen*/ + "@" Name() "(" MemberValue() ")"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void MemberValuePairs(): +{/*@bgen(jjtree) MemberValuePairs */ + SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUEPAIRS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) MemberValuePairs */ + try { +/*@egen*/ + MemberValuePair() ( "," MemberValuePair() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void MemberValuePair(): +{/*@bgen(jjtree) MemberValuePair */ + SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUEPAIR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) MemberValuePair */ + try { +/*@egen*/ + <IDENTIFIER> "=" MemberValue()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void MemberValue(): +{/*@bgen(jjtree) MemberValue */ + SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) MemberValue */ + try { +/*@egen*/ + Annotation() + | + MemberValueArrayInitializer() + | + ConditionalExpression()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void MemberValueArrayInitializer(): +{/*@bgen(jjtree) MemberValueArrayInitializer */ + SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUEARRAYINITIALIZER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) MemberValueArrayInitializer */ + try { +/*@egen*/ + "{" MemberValue() ( LOOKAHEAD(2) "," MemberValue() )* [ "," ] "}"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + + +/* Annotation Types. */ + +void AnnotationTypeDeclaration(int modifiers): +{/*@bgen(jjtree) AnnotationTypeDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTANNOTATIONTYPEDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) AnnotationTypeDeclaration */ + try { +/*@egen*/ + "@" "interface" <IDENTIFIER> AnnotationTypeBody()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void AnnotationTypeBody(): +{/*@bgen(jjtree) AnnotationTypeBody */ + SimpleNode jjtn000 = new SimpleNode(JJTANNOTATIONTYPEBODY); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) AnnotationTypeBody */ + try { +/*@egen*/ + "{" ( AnnotationTypeMemberDeclaration() )* "}"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void AnnotationTypeMemberDeclaration(): +{/*@bgen(jjtree) AnnotationTypeMemberDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTANNOTATIONTYPEMEMBERDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/ + int modifiers; +} +{/*@bgen(jjtree) AnnotationTypeMemberDeclaration */ + try { +/*@egen*/ + modifiers = Modifiers() + ( + LOOKAHEAD(Type() <IDENTIFIER> "(") + Type() <IDENTIFIER> "(" ")" [ DefaultValue() ] ";" + | + ClassOrInterfaceDeclaration(modifiers) + | + EnumDeclaration(modifiers) + | + AnnotationTypeDeclaration(modifiers) + | + FieldDeclaration(modifiers) + ) + | + ( ";" )/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} + +void DefaultValue(): +{/*@bgen(jjtree) DefaultValue */ + SimpleNode jjtn000 = new SimpleNode(JJTDEFAULTVALUE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); +/*@egen*/} +{/*@bgen(jjtree) DefaultValue */ + try { +/*@egen*/ + "default" MemberValue()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } +/*@egen*/ +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Java1.5.jjt b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Java1.5.jjt new file mode 100644 index 0000000..b47955f --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Java1.5.jjt @@ -0,0 +1,2150 @@ + +/* + * Copyright © 2002 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * California 95054, U.S.A. All rights reserved. Sun Microsystems, Inc. has + * intellectual property rights relating to technology embodied in the product + * that is described in this document. In particular, and without limitation, + * these intellectual property rights may include one or more of the U.S. + * patents listed at http://www.sun.com/patents and one or more additional + * patents or pending patent applications in the U.S. and in other countries. + * U.S. Government Rights - Commercial software. Government users are subject + * to the Sun Microsystems, Inc. standard license agreement and applicable + * provisions of the FAR and its supplements. Use is subject to license terms. + * Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered + * trademarks of Sun Microsystems, Inc. in the U.S. and other countries. This + * product is covered and controlled by U.S. Export Control laws and may be + * subject to the export or import laws in other countries. Nuclear, missile, + * chemical biological weapons or nuclear maritime end uses or end users, + * whether direct or indirect, are strictly prohibited. Export or reexport + * to countries subject to U.S. embargo or to entities identified on U.S. + * export exclusion lists, including, but not limited to, the denied persons + * and specially designated nationals lists is strictly prohibited. + */ + +// Slightly modified version of javacc's reference 1.5 grammar, tweaked for +// usage with JAXX. There are two main areas of changes: several new +// nonterminals were added to make identifying certain constructs easier, +// and the Line nonterminal was added to support JAXX's script tags. +// Several of the new changes are inefficient and require excess lookahead, +// but at this point I'd rather have inefficiency than risk breaking it during +// attempted optimizations. + +options { + JAVA_UNICODE_ESCAPE = true; + ERROR_REPORTING = false; + STATIC = false; + JDK_VERSION = "1.4"; + NODE_SCOPE_HOOK=true; +} + +PARSER_BEGIN(JavaParser) +package jaxx.parser; + +import java.io.*; + +/** + * Grammar to parse Java version 1.5 + * @author Sreenivasa Viswanadha - Simplified and enhanced for 1.5 + */ +public class JavaParser +{ + /** + * Class to hold modifiers. + */ + static public final class ModifierSet + { + /* Definitions of the bits in the modifiers field. */ + public static final int PUBLIC = 0x0001; + public static final int PROTECTED = 0x0002; + public static final int PRIVATE = 0x0004; + public static final int ABSTRACT = 0x0008; + public static final int STATIC = 0x0010; + public static final int FINAL = 0x0020; + public static final int SYNCHRONIZED = 0x0040; + public static final int NATIVE = 0x0080; + public static final int TRANSIENT = 0x0100; + public static final int VOLATILE = 0x0200; + public static final int STRICTFP = 0x1000; + + /** A set of accessors that indicate whether the specified modifier + is in the set. */ + + public boolean isPublic(int modifiers) + { + return (modifiers & PUBLIC) != 0; + } + + public boolean isProtected(int modifiers) + { + return (modifiers & PROTECTED) != 0; + } + + public boolean isPrivate(int modifiers) + { + return (modifiers & PRIVATE) != 0; + } + + public boolean isStatic(int modifiers) + { + return (modifiers & STATIC) != 0; + } + + public boolean isAbstract(int modifiers) + { + return (modifiers & ABSTRACT) != 0; + } + + public boolean isFinal(int modifiers) + { + return (modifiers & FINAL) != 0; + } + + public boolean isNative(int modifiers) + { + return (modifiers & NATIVE) != 0; + } + + public boolean isStrictfp(int modifiers) + { + return (modifiers & STRICTFP) != 0; + } + + public boolean isSynchronized(int modifiers) + { + return (modifiers & SYNCHRONIZED) != 0; + } + + public boolean isTransient(int modifiers) + { + return (modifiers & TRANSIENT) != 0; + } + + public boolean isVolatile(int modifiers) + { + return (modifiers & VOLATILE) != 0; + } + + /** + * Removes the given modifier. + */ + static int removeModifier(int modifiers, int mod) + { + return modifiers & ~mod; + } + } + + public JavaParser(String fileName) + { + this(System.in); + try { ReInit(new FileInputStream(new File(fileName))); } + catch(Exception e) { e.printStackTrace(); } + } + + void jjtreeOpenNodeScope(Node n) { + ((SimpleNode) n).firstToken = getToken(1); + } + + void jjtreeCloseNodeScope(Node n) { + ((SimpleNode) n).lastToken = getToken(0); + } + + public SimpleNode popNode() + { + if ( jjtree.nodeArity() > 0) // number of child nodes + return (SimpleNode)jjtree.popNode(); + else + return null; + } + public static void main(String args[]) { + JavaParser parser; + if (args.length == 0) { + System.out.println("Java Parser Version 1.1: Reading from standard input . . ."); + parser = new JavaParser(System.in); + } else if (args.length == 1) { + System.out.println("Java Parser Version 1.1: Reading from file " + args[0] + " . . ."); + try { + parser = new JavaParser(new java.io.FileInputStream(args[0])); + } catch (java.io.FileNotFoundException e) { + System.out.println("Java Parser Version 1.1: File " + args[0] + " not found."); + return; + } + } else { + System.out.println("Java Parser Version 1.1: Usage is one of:"); + System.out.println(" java JavaParser < inputfile"); + System.out.println("OR"); + System.out.println(" java JavaParser inputfile"); + return; + } + try { + parser.CompilationUnit(); + System.out.println("Java Parser Version 1.1: Java program parsed successfully."); + } catch (ParseException e) { + System.out.println(e.getMessage()); + System.out.println("Java Parser Version 1.1: Encountered errors during parse."); + } + } + +} + +PARSER_END(JavaParser) + +/* COMMENTS */ + +MORE : +{ + <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT +| + "/*" : IN_MULTI_LINE_COMMENT +} + +SPECIAL_TOKEN: +{ + <WHITE_SPACE: ([" ", "\n", "\r", "\t", "\f"])+> +} + +SPECIAL_TOKEN : +{ + <SINGLE_LINE_COMMENT: "//" (~["\n", "\r"])* ("\n" | "\r" | "\r\n")?> +} + +<IN_FORMAL_COMMENT> +SPECIAL_TOKEN : +{ + <FORMAL_COMMENT: "*/" > : DEFAULT +} + +<IN_MULTI_LINE_COMMENT> +SPECIAL_TOKEN : +{ + <MULTI_LINE_COMMENT: "*/" > : DEFAULT +} + +<IN_FORMAL_COMMENT,IN_MULTI_LINE_COMMENT> +MORE : +{ + < ~[] > +} + +/* RESERVED WORDS AND LITERALS */ + +TOKEN : +{ + < ABSTRACT: "abstract" > +| < ASSERT: "assert" > +| < BOOLEAN: "boolean" > +| < BREAK: "break" > +| < BYTE: "byte" > +| < CASE: "case" > +| < CATCH: "catch" > +| < CHAR: "char" > +| < CLASS: "class" > +| < CONST: "const" > +| < CONTINUE: "continue" > +| < _DEFAULT: "default" > +| < DO: "do" > +| < DOUBLE: "double" > +| < ELSE: "else" > +| < ENUM: "enum" > +| < EXTENDS: "extends" > +| < FALSE: "false" > +| < FINAL: "final" > +| < FINALLY: "finally" > +| < FLOAT: "float" > +| < FOR: "for" > +| < GOTO: "goto" > +| < IF: "if" > +| < IMPLEMENTS: "implements" > +| < IMPORT: "import" > +| < INSTANCEOF: "instanceof" > +| < INT: "int" > +| < INTERFACE: "interface" > +| < LONG: "long" > +| < NATIVE: "native" > +| < NEW: "new" > +| < NULL: "null" > +| < PACKAGE: "package"> +| < PRIVATE: "private" > +| < PROTECTED: "protected" > +| < PUBLIC: "public" > +| < RETURN: "return" > +| < SHORT: "short" > +| < STATIC: "static" > +| < STRICTFP: "strictfp" > +| < SUPER: "super" > +| < SWITCH: "switch" > +| < SYNCHRONIZED: "synchronized" > +| < THIS: "this" > +| < THROW: "throw" > +| < THROWS: "throws" > +| < TRANSIENT: "transient" > +| < TRUE: "true" > +| < TRY: "try" > +| < VOID: "void" > +| < VOLATILE: "volatile" > +| < WHILE: "while" > +} + +/* LITERALS */ + +TOKEN : +{ + < INTEGER_LITERAL: + <DECIMAL_LITERAL> (["l","L"])? + | <HEX_LITERAL> (["l","L"])? + | <OCTAL_LITERAL> (["l","L"])? + > +| + < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > +| + < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > +| + < #OCTAL_LITERAL: "0" (["0"-"7"])* > +| + < FLOATING_POINT_LITERAL: + <DECIMAL_FLOATING_POINT_LITERAL> + | <HEXADECIMAL_FLOATING_POINT_LITERAL> + > +| + < #DECIMAL_FLOATING_POINT_LITERAL: + (["0"-"9"])+ "." (["0"-"9"])* (<DECIMAL_EXPONENT>)? (["f","F","d","D"])? + | "." (["0"-"9"])+ (<DECIMAL_EXPONENT>)? (["f","F","d","D"])? + | (["0"-"9"])+ <DECIMAL_EXPONENT> (["f","F","d","D"])? + | (["0"-"9"])+ (<DECIMAL_EXPONENT>)? ["f","F","d","D"] + > +| + < #DECIMAL_EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > +| + < #HEXADECIMAL_FLOATING_POINT_LITERAL: + "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])+ (".")? <HEXADECIMAL_EXPONENT> (["f","F","d","D"])? + | "0" ["x", "X"] (["0"-"9","a"-"f","A"-"F"])* "." (["0"-"9","a"-"f","A"-"F"])+ <HEXADECIMAL_EXPONENT> (["f","F","d","D"])? + > +| + < #HEXADECIMAL_EXPONENT: ["p","P"] (["+","-"])? (["0"-"9"])+ > +| + < CHARACTER_LITERAL: + "'" + ( (~["'","\\","\n","\r"]) + | ("\\" + ( ["n","t","b","r","f","\\","'","\""] + | ["0"-"7"] ( ["0"-"7"] )? + | ["0"-"3"] ["0"-"7"] ["0"-"7"] + ) + ) + ) + "'" + > +| + < STRING_LITERAL: + "\"" + ( (~["\"","\\","\n","\r"]) + | ("\\" + ( ["n","t","b","r","f","\\","'","\""] + | ["0"-"7"] ( ["0"-"7"] )? + | ["0"-"3"] ["0"-"7"] ["0"-"7"] + ) + ) + )* + "\"" + > +} + +/* IDENTIFIERS */ + +TOKEN : +{ + < IDENTIFIER: <LETTER> (<PART_LETTER>)* > +| + < #LETTER: + [ // all chars for which Character.isIdentifierStart is true + "$", + "A"-"Z", + "_", + "a"-"z", + "\u00a2"-"\u00a5", + "\u00aa", + "\u00b5", + "\u00ba", + "\u00c0"-"\u00d6", + "\u00d8"-"\u00f6", + "\u00f8"-"\u021f", + "\u0222"-"\u0233", + "\u0250"-"\u02ad", + "\u02b0"-"\u02b8", + "\u02bb"-"\u02c1", + "\u02d0"-"\u02d1", + "\u02e0"-"\u02e4", + "\u02ee", + "\u037a", + "\u0386", + "\u0388"-"\u038a", + "\u038c", + "\u038e"-"\u03a1", + "\u03a3"-"\u03ce", + "\u03d0"-"\u03d7", + "\u03da"-"\u03f3", + "\u0400"-"\u0481", + "\u048c"-"\u04c4", + "\u04c7"-"\u04c8", + "\u04cb"-"\u04cc", + "\u04d0"-"\u04f5", + "\u04f8"-"\u04f9", + "\u0531"-"\u0556", + "\u0559", + "\u0561"-"\u0587", + "\u05d0"-"\u05ea", + "\u05f0"-"\u05f2", + "\u0621"-"\u063a", + "\u0640"-"\u064a", + "\u0671"-"\u06d3", + "\u06d5", + "\u06e5"-"\u06e6", + "\u06fa"-"\u06fc", + "\u0710", + "\u0712"-"\u072c", + "\u0780"-"\u07a5", + "\u0905"-"\u0939", + "\u093d", + "\u0950", + "\u0958"-"\u0961", + "\u0985"-"\u098c", + "\u098f"-"\u0990", + "\u0993"-"\u09a8", + "\u09aa"-"\u09b0", + "\u09b2", + "\u09b6"-"\u09b9", + "\u09dc"-"\u09dd", + "\u09df"-"\u09e1", + "\u09f0"-"\u09f3", + "\u0a05"-"\u0a0a", + "\u0a0f"-"\u0a10", + "\u0a13"-"\u0a28", + "\u0a2a"-"\u0a30", + "\u0a32"-"\u0a33", + "\u0a35"-"\u0a36", + "\u0a38"-"\u0a39", + "\u0a59"-"\u0a5c", + "\u0a5e", + "\u0a72"-"\u0a74", + "\u0a85"-"\u0a8b", + "\u0a8d", + "\u0a8f"-"\u0a91", + "\u0a93"-"\u0aa8", + "\u0aaa"-"\u0ab0", + "\u0ab2"-"\u0ab3", + "\u0ab5"-"\u0ab9", + "\u0abd", + "\u0ad0", + "\u0ae0", + "\u0b05"-"\u0b0c", + "\u0b0f"-"\u0b10", + "\u0b13"-"\u0b28", + "\u0b2a"-"\u0b30", + "\u0b32"-"\u0b33", + "\u0b36"-"\u0b39", + "\u0b3d", + "\u0b5c"-"\u0b5d", + "\u0b5f"-"\u0b61", + "\u0b85"-"\u0b8a", + "\u0b8e"-"\u0b90", + "\u0b92"-"\u0b95", + "\u0b99"-"\u0b9a", + "\u0b9c", + "\u0b9e"-"\u0b9f", + "\u0ba3"-"\u0ba4", + "\u0ba8"-"\u0baa", + "\u0bae"-"\u0bb5", + "\u0bb7"-"\u0bb9", + "\u0c05"-"\u0c0c", + "\u0c0e"-"\u0c10", + "\u0c12"-"\u0c28", + "\u0c2a"-"\u0c33", + "\u0c35"-"\u0c39", + "\u0c60"-"\u0c61", + "\u0c85"-"\u0c8c", + "\u0c8e"-"\u0c90", + "\u0c92"-"\u0ca8", + "\u0caa"-"\u0cb3", + "\u0cb5"-"\u0cb9", + "\u0cde", + "\u0ce0"-"\u0ce1", + "\u0d05"-"\u0d0c", + "\u0d0e"-"\u0d10", + "\u0d12"-"\u0d28", + "\u0d2a"-"\u0d39", + "\u0d60"-"\u0d61", + "\u0d85"-"\u0d96", + "\u0d9a"-"\u0db1", + "\u0db3"-"\u0dbb", + "\u0dbd", + "\u0dc0"-"\u0dc6", + "\u0e01"-"\u0e30", + "\u0e32"-"\u0e33", + "\u0e3f"-"\u0e46", + "\u0e81"-"\u0e82", + "\u0e84", + "\u0e87"-"\u0e88", + "\u0e8a", + "\u0e8d", + "\u0e94"-"\u0e97", + "\u0e99"-"\u0e9f", + "\u0ea1"-"\u0ea3", + "\u0ea5", + "\u0ea7", + "\u0eaa"-"\u0eab", + "\u0ead"-"\u0eb0", + "\u0eb2"-"\u0eb3", + "\u0ebd", + "\u0ec0"-"\u0ec4", + "\u0ec6", + "\u0edc"-"\u0edd", + "\u0f00", + "\u0f40"-"\u0f47", + "\u0f49"-"\u0f6a", + "\u0f88"-"\u0f8b", + "\u1000"-"\u1021", + "\u1023"-"\u1027", + "\u1029"-"\u102a", + "\u1050"-"\u1055", + "\u10a0"-"\u10c5", + "\u10d0"-"\u10f6", + "\u1100"-"\u1159", + "\u115f"-"\u11a2", + "\u11a8"-"\u11f9", + "\u1200"-"\u1206", + "\u1208"-"\u1246", + "\u1248", + "\u124a"-"\u124d", + "\u1250"-"\u1256", + "\u1258", + "\u125a"-"\u125d", + "\u1260"-"\u1286", + "\u1288", + "\u128a"-"\u128d", + "\u1290"-"\u12ae", + "\u12b0", + "\u12b2"-"\u12b5", + "\u12b8"-"\u12be", + "\u12c0", + "\u12c2"-"\u12c5", + "\u12c8"-"\u12ce", + "\u12d0"-"\u12d6", + "\u12d8"-"\u12ee", + "\u12f0"-"\u130e", + "\u1310", + "\u1312"-"\u1315", + "\u1318"-"\u131e", + "\u1320"-"\u1346", + "\u1348"-"\u135a", + "\u13a0"-"\u13f4", + "\u1401"-"\u166c", + "\u166f"-"\u1676", + "\u1681"-"\u169a", + "\u16a0"-"\u16ea", + "\u1780"-"\u17b3", + "\u17db", + "\u1820"-"\u1877", + "\u1880"-"\u18a8", + "\u1e00"-"\u1e9b", + "\u1ea0"-"\u1ef9", + "\u1f00"-"\u1f15", + "\u1f18"-"\u1f1d", + "\u1f20"-"\u1f45", + "\u1f48"-"\u1f4d", + "\u1f50"-"\u1f57", + "\u1f59", + "\u1f5b", + "\u1f5d", + "\u1f5f"-"\u1f7d", + "\u1f80"-"\u1fb4", + "\u1fb6"-"\u1fbc", + "\u1fbe", + "\u1fc2"-"\u1fc4", + "\u1fc6"-"\u1fcc", + "\u1fd0"-"\u1fd3", + "\u1fd6"-"\u1fdb", + "\u1fe0"-"\u1fec", + "\u1ff2"-"\u1ff4", + "\u1ff6"-"\u1ffc", + "\u203f"-"\u2040", + "\u207f", + "\u20a0"-"\u20af", + "\u2102", + "\u2107", + "\u210a"-"\u2113", + "\u2115", + "\u2119"-"\u211d", + "\u2124", + "\u2126", + "\u2128", + "\u212a"-"\u212d", + "\u212f"-"\u2131", + "\u2133"-"\u2139", + "\u2160"-"\u2183", + "\u3005"-"\u3007", + "\u3021"-"\u3029", + "\u3031"-"\u3035", + "\u3038"-"\u303a", + "\u3041"-"\u3094", + "\u309d"-"\u309e", + "\u30a1"-"\u30fe", + "\u3105"-"\u312c", + "\u3131"-"\u318e", + "\u31a0"-"\u31b7", + "\u3400"-"\u4db5", + "\u4e00"-"\u9fa5", + "\ua000"-"\ua48c", + "\uac00"-"\ud7a3", + "\uf900"-"\ufa2d", + "\ufb00"-"\ufb06", + "\ufb13"-"\ufb17", + "\ufb1d", + "\ufb1f"-"\ufb28", + "\ufb2a"-"\ufb36", + "\ufb38"-"\ufb3c", + "\ufb3e", + "\ufb40"-"\ufb41", + "\ufb43"-"\ufb44", + "\ufb46"-"\ufbb1", + "\ufbd3"-"\ufd3d", + "\ufd50"-"\ufd8f", + "\ufd92"-"\ufdc7", + "\ufdf0"-"\ufdfb", + "\ufe33"-"\ufe34", + "\ufe4d"-"\ufe4f", + "\ufe69", + "\ufe70"-"\ufe72", + "\ufe74", + "\ufe76"-"\ufefc", + "\uff04", + "\uff21"-"\uff3a", + "\uff3f", + "\uff41"-"\uff5a", + "\uff65"-"\uffbe", + "\uffc2"-"\uffc7", + "\uffca"-"\uffcf", + "\uffd2"-"\uffd7", + "\uffda"-"\uffdc", + "\uffe0"-"\uffe1", + "\uffe5"-"\uffe6" + ] + > +| + < #PART_LETTER: + [ // all chars for which Character.isIdentifierPart is true + "\u0000"-"\u0008", + "\u000e"-"\u001b", + "$", + "0"-"9", + "A"-"Z", + "_", + "a"-"z", + "\u007f"-"\u009f", + "\u00a2"-"\u00a5", + "\u00aa", + "\u00b5", + "\u00ba", + "\u00c0"-"\u00d6", + "\u00d8"-"\u00f6", + "\u00f8"-"\u021f", + "\u0222"-"\u0233", + "\u0250"-"\u02ad", + "\u02b0"-"\u02b8", + "\u02bb"-"\u02c1", + "\u02d0"-"\u02d1", + "\u02e0"-"\u02e4", + "\u02ee", + "\u0300"-"\u034e", + "\u0360"-"\u0362", + "\u037a", + "\u0386", + "\u0388"-"\u038a", + "\u038c", + "\u038e"-"\u03a1", + "\u03a3"-"\u03ce", + "\u03d0"-"\u03d7", + "\u03da"-"\u03f3", + "\u0400"-"\u0481", + "\u0483"-"\u0486", + "\u048c"-"\u04c4", + "\u04c7"-"\u04c8", + "\u04cb"-"\u04cc", + "\u04d0"-"\u04f5", + "\u04f8"-"\u04f9", + "\u0531"-"\u0556", + "\u0559", + "\u0561"-"\u0587", + "\u0591"-"\u05a1", + "\u05a3"-"\u05b9", + "\u05bb"-"\u05bd", + "\u05bf", + "\u05c1"-"\u05c2", + "\u05c4", + "\u05d0"-"\u05ea", + "\u05f0"-"\u05f2", + "\u0621"-"\u063a", + "\u0640"-"\u0655", + "\u0660"-"\u0669", + "\u0670"-"\u06d3", + "\u06d5"-"\u06dc", + "\u06df"-"\u06e8", + "\u06ea"-"\u06ed", + "\u06f0"-"\u06fc", + "\u070f"-"\u072c", + "\u0730"-"\u074a", + "\u0780"-"\u07b0", + "\u0901"-"\u0903", + "\u0905"-"\u0939", + "\u093c"-"\u094d", + "\u0950"-"\u0954", + "\u0958"-"\u0963", + "\u0966"-"\u096f", + "\u0981"-"\u0983", + "\u0985"-"\u098c", + "\u098f"-"\u0990", + "\u0993"-"\u09a8", + "\u09aa"-"\u09b0", + "\u09b2", + "\u09b6"-"\u09b9", + "\u09bc", + "\u09be"-"\u09c4", + "\u09c7"-"\u09c8", + "\u09cb"-"\u09cd", + "\u09d7", + "\u09dc"-"\u09dd", + "\u09df"-"\u09e3", + "\u09e6"-"\u09f3", + "\u0a02", + "\u0a05"-"\u0a0a", + "\u0a0f"-"\u0a10", + "\u0a13"-"\u0a28", + "\u0a2a"-"\u0a30", + "\u0a32"-"\u0a33", + "\u0a35"-"\u0a36", + "\u0a38"-"\u0a39", + "\u0a3c", + "\u0a3e"-"\u0a42", + "\u0a47"-"\u0a48", + "\u0a4b"-"\u0a4d", + "\u0a59"-"\u0a5c", + "\u0a5e", + "\u0a66"-"\u0a74", + "\u0a81"-"\u0a83", + "\u0a85"-"\u0a8b", + "\u0a8d", + "\u0a8f"-"\u0a91", + "\u0a93"-"\u0aa8", + "\u0aaa"-"\u0ab0", + "\u0ab2"-"\u0ab3", + "\u0ab5"-"\u0ab9", + "\u0abc"-"\u0ac5", + "\u0ac7"-"\u0ac9", + "\u0acb"-"\u0acd", + "\u0ad0", + "\u0ae0", + "\u0ae6"-"\u0aef", + "\u0b01"-"\u0b03", + "\u0b05"-"\u0b0c", + "\u0b0f"-"\u0b10", + "\u0b13"-"\u0b28", + "\u0b2a"-"\u0b30", + "\u0b32"-"\u0b33", + "\u0b36"-"\u0b39", + "\u0b3c"-"\u0b43", + "\u0b47"-"\u0b48", + "\u0b4b"-"\u0b4d", + "\u0b56"-"\u0b57", + "\u0b5c"-"\u0b5d", + "\u0b5f"-"\u0b61", + "\u0b66"-"\u0b6f", + "\u0b82"-"\u0b83", + "\u0b85"-"\u0b8a", + "\u0b8e"-"\u0b90", + "\u0b92"-"\u0b95", + "\u0b99"-"\u0b9a", + "\u0b9c", + "\u0b9e"-"\u0b9f", + "\u0ba3"-"\u0ba4", + "\u0ba8"-"\u0baa", + "\u0bae"-"\u0bb5", + "\u0bb7"-"\u0bb9", + "\u0bbe"-"\u0bc2", + "\u0bc6"-"\u0bc8", + "\u0bca"-"\u0bcd", + "\u0bd7", + "\u0be7"-"\u0bef", + "\u0c01"-"\u0c03", + "\u0c05"-"\u0c0c", + "\u0c0e"-"\u0c10", + "\u0c12"-"\u0c28", + "\u0c2a"-"\u0c33", + "\u0c35"-"\u0c39", + "\u0c3e"-"\u0c44", + "\u0c46"-"\u0c48", + "\u0c4a"-"\u0c4d", + "\u0c55"-"\u0c56", + "\u0c60"-"\u0c61", + "\u0c66"-"\u0c6f", + "\u0c82"-"\u0c83", + "\u0c85"-"\u0c8c", + "\u0c8e"-"\u0c90", + "\u0c92"-"\u0ca8", + "\u0caa"-"\u0cb3", + "\u0cb5"-"\u0cb9", + "\u0cbe"-"\u0cc4", + "\u0cc6"-"\u0cc8", + "\u0cca"-"\u0ccd", + "\u0cd5"-"\u0cd6", + "\u0cde", + "\u0ce0"-"\u0ce1", + "\u0ce6"-"\u0cef", + "\u0d02"-"\u0d03", + "\u0d05"-"\u0d0c", + "\u0d0e"-"\u0d10", + "\u0d12"-"\u0d28", + "\u0d2a"-"\u0d39", + "\u0d3e"-"\u0d43", + "\u0d46"-"\u0d48", + "\u0d4a"-"\u0d4d", + "\u0d57", + "\u0d60"-"\u0d61", + "\u0d66"-"\u0d6f", + "\u0d82"-"\u0d83", + "\u0d85"-"\u0d96", + "\u0d9a"-"\u0db1", + "\u0db3"-"\u0dbb", + "\u0dbd", + "\u0dc0"-"\u0dc6", + "\u0dca", + "\u0dcf"-"\u0dd4", + "\u0dd6", + "\u0dd8"-"\u0ddf", + "\u0df2"-"\u0df3", + "\u0e01"-"\u0e3a", + "\u0e3f"-"\u0e4e", + "\u0e50"-"\u0e59", + "\u0e81"-"\u0e82", + "\u0e84", + "\u0e87"-"\u0e88", + "\u0e8a", + "\u0e8d", + "\u0e94"-"\u0e97", + "\u0e99"-"\u0e9f", + "\u0ea1"-"\u0ea3", + "\u0ea5", + "\u0ea7", + "\u0eaa"-"\u0eab", + "\u0ead"-"\u0eb9", + "\u0ebb"-"\u0ebd", + "\u0ec0"-"\u0ec4", + "\u0ec6", + "\u0ec8"-"\u0ecd", + "\u0ed0"-"\u0ed9", + "\u0edc"-"\u0edd", + "\u0f00", + "\u0f18"-"\u0f19", + "\u0f20"-"\u0f29", + "\u0f35", + "\u0f37", + "\u0f39", + "\u0f3e"-"\u0f47", + "\u0f49"-"\u0f6a", + "\u0f71"-"\u0f84", + "\u0f86"-"\u0f8b", + "\u0f90"-"\u0f97", + "\u0f99"-"\u0fbc", + "\u0fc6", + "\u1000"-"\u1021", + "\u1023"-"\u1027", + "\u1029"-"\u102a", + "\u102c"-"\u1032", + "\u1036"-"\u1039", + "\u1040"-"\u1049", + "\u1050"-"\u1059", + "\u10a0"-"\u10c5", + "\u10d0"-"\u10f6", + "\u1100"-"\u1159", + "\u115f"-"\u11a2", + "\u11a8"-"\u11f9", + "\u1200"-"\u1206", + "\u1208"-"\u1246", + "\u1248", + "\u124a"-"\u124d", + "\u1250"-"\u1256", + "\u1258", + "\u125a"-"\u125d", + "\u1260"-"\u1286", + "\u1288", + "\u128a"-"\u128d", + "\u1290"-"\u12ae", + "\u12b0", + "\u12b2"-"\u12b5", + "\u12b8"-"\u12be", + "\u12c0", + "\u12c2"-"\u12c5", + "\u12c8"-"\u12ce", + "\u12d0"-"\u12d6", + "\u12d8"-"\u12ee", + "\u12f0"-"\u130e", + "\u1310", + "\u1312"-"\u1315", + "\u1318"-"\u131e", + "\u1320"-"\u1346", + "\u1348"-"\u135a", + "\u1369"-"\u1371", + "\u13a0"-"\u13f4", + "\u1401"-"\u166c", + "\u166f"-"\u1676", + "\u1681"-"\u169a", + "\u16a0"-"\u16ea", + "\u1780"-"\u17d3", + "\u17db", + "\u17e0"-"\u17e9", + "\u180b"-"\u180e", + "\u1810"-"\u1819", + "\u1820"-"\u1877", + "\u1880"-"\u18a9", + "\u1e00"-"\u1e9b", + "\u1ea0"-"\u1ef9", + "\u1f00"-"\u1f15", + "\u1f18"-"\u1f1d", + "\u1f20"-"\u1f45", + "\u1f48"-"\u1f4d", + "\u1f50"-"\u1f57", + "\u1f59", + "\u1f5b", + "\u1f5d", + "\u1f5f"-"\u1f7d", + "\u1f80"-"\u1fb4", + "\u1fb6"-"\u1fbc", + "\u1fbe", + "\u1fc2"-"\u1fc4", + "\u1fc6"-"\u1fcc", + "\u1fd0"-"\u1fd3", + "\u1fd6"-"\u1fdb", + "\u1fe0"-"\u1fec", + "\u1ff2"-"\u1ff4", + "\u1ff6"-"\u1ffc", + "\u200c"-"\u200f", + "\u202a"-"\u202e", + "\u203f"-"\u2040", + "\u206a"-"\u206f", + "\u207f", + "\u20a0"-"\u20af", + "\u20d0"-"\u20dc", + "\u20e1", + "\u2102", + "\u2107", + "\u210a"-"\u2113", + "\u2115", + "\u2119"-"\u211d", + "\u2124", + "\u2126", + "\u2128", + "\u212a"-"\u212d", + "\u212f"-"\u2131", + "\u2133"-"\u2139", + "\u2160"-"\u2183", + "\u3005"-"\u3007", + "\u3021"-"\u302f", + "\u3031"-"\u3035", + "\u3038"-"\u303a", + "\u3041"-"\u3094", + "\u3099"-"\u309a", + "\u309d"-"\u309e", + "\u30a1"-"\u30fe", + "\u3105"-"\u312c", + "\u3131"-"\u318e", + "\u31a0"-"\u31b7", + "\u3400"-"\u4db5", + "\u4e00"-"\u9fa5", + "\ua000"-"\ua48c", + "\uac00"-"\ud7a3", + "\uf900"-"\ufa2d", + "\ufb00"-"\ufb06", + "\ufb13"-"\ufb17", + "\ufb1d"-"\ufb28", + "\ufb2a"-"\ufb36", + "\ufb38"-"\ufb3c", + "\ufb3e", + "\ufb40"-"\ufb41", + "\ufb43"-"\ufb44", + "\ufb46"-"\ufbb1", + "\ufbd3"-"\ufd3d", + "\ufd50"-"\ufd8f", + "\ufd92"-"\ufdc7", + "\ufdf0"-"\ufdfb", + "\ufe20"-"\ufe23", + "\ufe33"-"\ufe34", + "\ufe4d"-"\ufe4f", + "\ufe69", + "\ufe70"-"\ufe72", + "\ufe74", + "\ufe76"-"\ufefc", + "\ufeff", + "\uff04", + "\uff10"-"\uff19", + "\uff21"-"\uff3a", + "\uff3f", + "\uff41"-"\uff5a", + "\uff65"-"\uffbe", + "\uffc2"-"\uffc7", + "\uffca"-"\uffcf", + "\uffd2"-"\uffd7", + "\uffda"-"\uffdc", + "\uffe0"-"\uffe1", + "\uffe5"-"\uffe6", + "\ufff9"-"\ufffb" + ] + > +} + +/* SEPARATORS */ + +TOKEN : +{ + < LPAREN: "(" > +| < RPAREN: ")" > +| < LBRACE: "{" > +| < RBRACE: "}" > +| < LBRACKET: "[" > +| < RBRACKET: "]" > +| < SEMICOLON: ";" > +| < COMMA: "," > +| < DOT: "." > +| < AT: "@" > +} + +/* OPERATORS */ + +TOKEN : +{ + < ASSIGN: "=" > +| < LT: "<" > +| < BANG: "!" > +| < TILDE: "~" > +| < HOOK: "?" > +| < COLON: ":" > +| < EQ: "==" > +| < LE: "<=" > +| < GE: ">=" > +| < NE: "!=" > +| < SC_OR: "||" > +| < SC_AND: "&&" > +| < INCR: "++" > +| < DECR: "--" > +| < PLUS: "+" > +| < MINUS: "-" > +| < STAR: "*" > +| < SLASH: "/" > +| < BIT_AND: "&" > +| < BIT_OR: "|" > +| < XOR: "^" > +| < REM: "%" > +| < LSHIFT: "<<" > +| < PLUSASSIGN: "+=" > +| < MINUSASSIGN: "-=" > +| < STARASSIGN: "*=" > +| < SLASHASSIGN: "/=" > +| < ANDASSIGN: "&=" > +| < ORASSIGN: "|=" > +| < XORASSIGN: "^=" > +| < REMASSIGN: "%=" > +| < LSHIFTASSIGN: "<<=" > +| < RSIGNEDSHIFTASSIGN: ">>=" > +| < RUNSIGNEDSHIFTASSIGN: ">>>=" > +| < ELLIPSIS: "..." > +} + +/* >'s need special attention due to generics syntax. */ +TOKEN : +{ + < RUNSIGNEDSHIFT: ">>>" > + { + matchedToken.kind = GT; + ((Token.GTToken)matchedToken).realKind = RUNSIGNEDSHIFT; + input_stream.backup(2); + matchedToken.image = ">"; + } +| < RSIGNEDSHIFT: ">>" > + { + matchedToken.kind = GT; + ((Token.GTToken)matchedToken).realKind = RSIGNEDSHIFT; + input_stream.backup(1); + matchedToken.image = ">"; + } +| < GT: ">" > +} + +boolean Line() : +{ + int modifiers; +} +{ + <EOF> { + return true; + } +| + LOOKAHEAD(BlockStatement()) + BlockStatement() { + return false; + } +| + LOOKAHEAD(Modifiers() [ TypeParameters() ] [ ResultType() ] <IDENTIFIER> FormalParameters() [ "throws" NameList() ] "{") + ClassOrInterfaceBodyDeclaration(false) { + return false; + } +| + LOOKAHEAD(ClassOrInterfaceBodyDeclaration(false)) + ClassOrInterfaceBodyDeclaration(false) { + return false; + } +| + LOOKAHEAD(Expression()) + Expression() { + return false; + } +| + ImportDeclaration() { + return false; + } +} + +/***************************************** + * THE JAVA LANGUAGE GRAMMAR STARTS HERE * + *****************************************/ + +/* + * Program structuring syntax follows. + */ + +void CompilationUnit(): +{} +{ + [ LOOKAHEAD( ( Annotation() )* "package" ) PackageDeclaration() ] + ( ImportDeclaration() )* + ( TypeDeclaration() )* + ( < "\u001a" > )? + ( <STUFF_TO_IGNORE: ~[]> )? + <EOF> +} + +void PackageDeclaration(): +{} +{ + Modifiers() "package" Name() ";" +} + +void ImportDeclaration(): +{} +{ + "import" [ "static" ] Name() [ "." "*" ] ";" +} + +/* + * Modifiers. We match all modifiers in a single rule to reduce the chances of + * syntax errors for simple modifier mistakes. It will also enable us to give + * better error messages. + */ + +int Modifiers(): +{ + int modifiers = 0; +} +{ + ( + LOOKAHEAD(2) + ( + "public" { modifiers |= ModifierSet.PUBLIC; } + | + "static" { modifiers |= ModifierSet.STATIC; } + | + "protected" { modifiers |= ModifierSet.PROTECTED; } + | + "private" { modifiers |= ModifierSet.PRIVATE; } + | + "final" { modifiers |= ModifierSet.FINAL; } + | + "abstract" { modifiers |= ModifierSet.ABSTRACT; } + | + "synchronized" { modifiers |= ModifierSet.SYNCHRONIZED; } + | + "native" { modifiers |= ModifierSet.NATIVE; } + | + "transient" { modifiers |= ModifierSet.TRANSIENT; } + | + "volatile" { modifiers |= ModifierSet.VOLATILE; } + | + "strictfp" { modifiers |= ModifierSet.STRICTFP; } + | + Annotation() + ) + )* + + { + return modifiers; + } +} + +/* + * Declaration syntax follows. + */ +void TypeDeclaration(): +{ + int modifiers; +} +{ + ";" +| + modifiers = Modifiers() + ( + ClassOrInterfaceDeclaration(modifiers) + | + EnumDeclaration(modifiers) + | + AnnotationTypeDeclaration(modifiers) + ) +} + + +void ClassOrInterfaceDeclaration(int modifiers): +{ + boolean isInterface = false; +} +{ + ( "class" | "interface" { isInterface = true; } ) + <IDENTIFIER> + [ TypeParameters() ] + [ ExtendsList(isInterface) ] + [ ImplementsList(isInterface) ] + ClassOrInterfaceBody(isInterface) +} + +void ExtendsList(boolean isInterface): +{ + boolean extendsMoreThanOne = false; +} +{ + "extends" ClassOrInterfaceType() + ( "," ClassOrInterfaceType() { extendsMoreThanOne = true; } )* + { + if (extendsMoreThanOne && !isInterface) + throw new ParseException("A class cannot extend more than one other class"); + } +} + +void ImplementsList(boolean isInterface): +{} +{ + "implements" ClassOrInterfaceType() + ( "," ClassOrInterfaceType() )* + { + if (isInterface) + throw new ParseException("An interface cannot implement other interfaces"); + } +} + +void EnumDeclaration(int modifiers): +{} +{ + "enum" <IDENTIFIER> + [ ImplementsList(false) ] + EnumBody() +} + +void EnumBody(): +{} +{ + "{" + [ EnumConstant() ( LOOKAHEAD(2) "," EnumConstant() )* ] + [ "," ] + [ ";" ( ClassOrInterfaceBodyDeclaration(false) )* ] + "}" +} + +void EnumConstant(): +{} +{ + Modifiers() <IDENTIFIER> [ Arguments() ] [ ClassOrInterfaceBody(false) ] +} + +void TypeParameters(): +{} +{ + "<" TypeParameter() ( "," TypeParameter() )* ">" +} + +void TypeParameter(): +{} +{ + <IDENTIFIER> [ TypeBound() ] +} + +void TypeBound(): +{} +{ + "extends" ClassOrInterfaceType() ( "&" ClassOrInterfaceType() )* +} + +void ClassOrInterfaceBody(boolean isInterface): +{} +{ + "{" ( ClassOrInterfaceBodyDeclaration(isInterface) )* "}" +} + +void ClassOrInterfaceBodyDeclaration(boolean isInterface): +{ + boolean isNestedInterface = false; + int modifiers; +} +{ + LOOKAHEAD(2) + Initializer() + { + if (isInterface) + throw new ParseException("An interface cannot have initializers"); + } +| + modifiers = Modifiers() // Just get all the modifiers out of the way. If you want to do + // more checks, pass the modifiers down to the member + ( + ClassOrInterfaceDeclaration(modifiers) + | + EnumDeclaration(modifiers) + | + LOOKAHEAD( [ TypeParameters() ] <IDENTIFIER> "(" ) + ConstructorDeclaration() + | + LOOKAHEAD( Type() <IDENTIFIER> ( "[" "]" )* ( "," | "=" | ";" ) ) + FieldDeclaration(modifiers) + | + MethodDeclaration(modifiers) + ) +| + ";" +} + +void FieldDeclaration(int modifiers): +{} +{ + // Modifiers are already matched in the caller + Type() VariableDeclarator() ( "," VariableDeclarator() )* ";" +} + +void VariableDeclarator(): +{} +{ + VariableDeclaratorId() [ "=" VariableInitializer() ] +} + +void VariableDeclaratorId(): +{} +{ + <IDENTIFIER> ( "[" "]" )* +} + +void VariableInitializer(): +{} +{ + ArrayInitializer() +| + Expression() +} + +void ArrayInitializer(): +{} +{ + "{" [ VariableInitializer() ( LOOKAHEAD(2) "," VariableInitializer() )* ] [ "," ] "}" +} + +void MethodDeclaration(int modifiers): +{} +{ + // Modifiers already matched in the caller! + [ TypeParameters() ] + ResultType() + MethodDeclarator() [ "throws" NameList() ] + ( Block() | ";" ) +} + +void MethodDeclarator(): +{} +{ + <IDENTIFIER> FormalParameters() ( "[" "]" )* +} + +void FormalParameters(): +{} +{ + "(" [ FormalParameter() ( "," FormalParameter() )* ] ")" +} + +void FormalParameter(): +{} +{ + Modifiers() Type() [ "..." ] VariableDeclaratorId() +} + +void ConstructorDeclaration(): +{} +{ + [ TypeParameters() ] + // Modifiers matched in the caller + <IDENTIFIER> FormalParameters() [ "throws" NameList() ] + "{" + [ LOOKAHEAD(ExplicitConstructorInvocation()) + ExplicitConstructorInvocation() + ] + ( BlockStatement() )* + "}" +} + +void ExplicitConstructorInvocation(): +{} +{ + ( <IDENTIFIER> "." )* [ LOOKAHEAD(2) "this" "." ] + [ TypeArguments() ] ("this"|"super") Arguments() ";" +} + +void Initializer(): +{} +{ + [ "static" ] Block() +} + + +/* + * Type, name and expression syntax follows. + */ + +void Type(): +{} +{ + LOOKAHEAD(2) ReferenceType() + | + PrimitiveType() +} + +void ReferenceType(): +{} +{ + PrimitiveType() ( LOOKAHEAD(2) "[" "]" )+ + | + ( ClassOrInterfaceType() ) ( LOOKAHEAD(2) "[" "]" )* +} + +void ClassOrInterfaceType(): +{} +{ + <IDENTIFIER> [ LOOKAHEAD(2) TypeArguments() ] + ( LOOKAHEAD(2) "." <IDENTIFIER> [ LOOKAHEAD(2) TypeArguments() ] )* +} + +void TypeArguments(): +{} +{ + "<" TypeArgument() ( "," TypeArgument() )* ">" +} + +void TypeArgument(): +{} +{ + ReferenceType() + | + "?" [ WildcardBounds() ] +} + +void WildcardBounds(): +{} +{ + "extends" ReferenceType() + | + "super" ReferenceType() +} + + +void PrimitiveType(): +{} +{ + "boolean" +| + "char" +| + "byte" +| + "short" +| + "int" +| + "long" +| + "float" +| + "double" +} + +void ResultType(): +{} +{ + "void" +| + Type() +} + +void Name(): +/* + * A lookahead of 2 is required below since "Name" can be followed + * by a ".*" when used in the context of an "ImportDeclaration". + */ +{} +{ + <IDENTIFIER> + ( LOOKAHEAD(2) "." <IDENTIFIER> + )* +} + +void NameList(): +{} +{ + Name() ( "," Name() )* +} + + +/* + * Expression syntax follows. + */ + +void Expression(): +/* + * This expansion has been written this way instead of: + * Assignment() | ConditionalExpression() + * for performance reasons. + * However, it is a weakening of the grammar for it allows the LHS of + * assignments to be any conditional expression whereas it can only be + * a primary expression. Consider adding a semantic predicate to work + * around this. + */ +{} +{ + ConditionalExpression() + [ + LOOKAHEAD(2) + AssignmentOperator() Expression() + ] +} + +void AssignmentOperator(): +{} +{ + "=" | "*=" | "/=" | "%=" | "+=" | "-=" | "<<=" | ">>=" | ">>>=" | "&=" | "^=" | "|=" +} + +void AssignmentExpression(): +{} +{ + PrimaryExpression() AssignmentOperator() Expression() +} + +void ConditionalExpression(): +{} +{ + ConditionalOrExpression() [ "?" Expression() ":" Expression() ] +} + +void ConditionalOrExpression(): +{} +{ + ConditionalAndExpression() ( "||" ConditionalAndExpression() )* +} + +void ConditionalAndExpression(): +{} +{ + InclusiveOrExpression() ( "&&" InclusiveOrExpression() )* +} + +void InclusiveOrExpression(): +{} +{ + ExclusiveOrExpression() ( "|" ExclusiveOrExpression() )* +} + +void ExclusiveOrExpression(): +{} +{ + AndExpression() ( "^" AndExpression() )* +} + +void AndExpression(): +{} +{ + EqualityExpression() ( "&" EqualityExpression() )* +} + +void EqualityExpression(): +{} +{ + InstanceOfExpression() ( ( "==" | "!=" ) InstanceOfExpression() )* +} + +void InstanceOfExpression(): +{} +{ + RelationalExpression() [ "instanceof" Type() ] +} + +void RelationalExpression(): +{} +{ + ShiftExpression() ( ( "<" | ">" | "<=" | ">=" ) ShiftExpression() )* +} + +void ShiftExpression(): +{} +{ + AdditiveExpression() ( ( "<<" | RSIGNEDSHIFT() | RUNSIGNEDSHIFT() ) AdditiveExpression() )* +} + +void AdditiveExpression(): +{} +{ + MultiplicativeExpression() ( ( "+" | "-" ) MultiplicativeExpression() )* +} + +void MultiplicativeExpression(): +{} +{ + UnaryExpression() ( ( "*" | "/" | "%" ) UnaryExpression() )* +} + +void UnaryExpression(): +{} +{ + ( "+" | "-" ) UnaryExpression() +| + PreIncrementExpression() +| + PreDecrementExpression() +| + UnaryExpressionNotPlusMinus() +} + +void PreIncrementExpression(): +{} +{ + "++" PrimaryExpression() +} + +void PreDecrementExpression(): +{} +{ + "--" PrimaryExpression() +} + +void UnaryExpressionNotPlusMinus(): +{} +{ + ( "~" | "!" ) UnaryExpression() +| + LOOKAHEAD( CastLookahead() ) + CastExpression() +| + PostfixExpression() +} + +// This production is to determine lookahead only. The LOOKAHEAD specifications +// below are not used, but they are there just to indicate that we know about +// this. +void CastLookahead(): +{} +{ + LOOKAHEAD(2) + "(" PrimitiveType() +| + LOOKAHEAD("(" Type() "[") + "(" Type() "[" "]" +| + "(" Type() ")" ( "~" | "!" | "(" | <IDENTIFIER> | "this" | "super" | "new" | Literal() ) +} + +void PostfixExpression(): +{} +{ + PrimaryExpression() [ PostfixOperator() ] +} + +void PostfixOperator(): +{} +{ + "++" | "--" +} + +void CastExpression(): +{} +{ + LOOKAHEAD("(" PrimitiveType()) + "(" Type() ")" UnaryExpression() +| + "(" Type() ")" UnaryExpressionNotPlusMinus() +} + +void PrimaryExpression(): +{} +{ + PrimaryPrefix() ( LOOKAHEAD(2) PrimarySuffix() )* +} + +void MemberSelector(): +{} +{ + "." TypeArguments() <IDENTIFIER> +} + +void PrimaryPrefix(): +{} +{ + Literal() +| + LOOKAHEAD( ( <IDENTIFIER> "." )* "this" ) + ( <IDENTIFIER> "." )* + "this" +| + "super" "." <IDENTIFIER> +| + "(" Expression() ")" +| + AllocationExpression() +| + LOOKAHEAD( ResultType() "." "class" ) + ResultType() "." "class" +| + Name() +} + +void PrimarySuffix(): +{} +{ + LOOKAHEAD("." "super" ".") + "." "super" +| + LOOKAHEAD("." "this") + "." "this" +| + LOOKAHEAD(2) + "." AllocationExpression() +| + LOOKAHEAD(3) + MemberSelector() +| + "[" Expression() "]" +| + "." <IDENTIFIER> +| + Arguments() +} + +void Literal(): +{} +{ + <INTEGER_LITERAL> +| + <FLOATING_POINT_LITERAL> +| + <CHARACTER_LITERAL> +| + <STRING_LITERAL> +| + BooleanLiteral() +| + NullLiteral() +} + +void BooleanLiteral(): +{} +{ + "true" +| + "false" +} + +void NullLiteral(): +{} +{ + "null" +} + +void Arguments(): +{} +{ + "(" [ ArgumentList() ] ")" +} + +void ArgumentList(): +{} +{ + Expression() ( "," Expression() )* +} + +void AllocationExpression(): +{} +{ + LOOKAHEAD(2) + "new" PrimitiveType() ArrayDimsAndInits() +| + "new" ClassOrInterfaceType() [ TypeArguments() ] + ( + ArrayDimsAndInits() + | + Arguments() [ ClassOrInterfaceBody(false) ] + ) +} + +/* + * The third LOOKAHEAD specification below is to parse to PrimarySuffix + * if there is an expression between the "[...]". + */ +void ArrayDimsAndInits(): +{} +{ + LOOKAHEAD(2) + ( LOOKAHEAD(2) "[" Expression() "]" )+ ( LOOKAHEAD(2) "[" "]" )* +| + ( "[" "]" )+ ArrayInitializer() +} + + +/* + * Statement syntax follows. + */ + +void Statement(): +{} +{ + LOOKAHEAD(2) + LabeledStatement() +| + AssertStatement() +| + Block() +| + EmptyStatement() +| + StatementExpression() ";" +| + SwitchStatement() +| + IfStatement() +| + WhileStatement() +| + DoStatement() +| + ForStatement() +| + BreakStatement() +| + ContinueStatement() +| + ReturnStatement() +| + ThrowStatement() +| + SynchronizedStatement() +| + TryStatement() +} + +void AssertStatement(): +{} +{ + "assert" Expression() [ ":" Expression() ] ";" +} + +void LabeledStatement(): +{} +{ + <IDENTIFIER> ":" Statement() +} + +void Block(): +{} +{ + "{" ( BlockStatement() )* "}" +} + +void BlockStatement(): +{} +{ + LOOKAHEAD( Modifiers() Type() <IDENTIFIER> ) + LocalVariableDeclaration() ";" +| + Statement() +| + ClassOrInterfaceDeclaration(0) +} + +void LocalVariableDeclaration(): +{} +{ + Modifiers() Type() VariableDeclarator() ( "," VariableDeclarator() )* +} + +void EmptyStatement(): +{} +{ + ";" +} + +void StatementExpression(): +{} +{ + PreIncrementExpression() +| + PreDecrementExpression() +| + LOOKAHEAD(PrimaryExpression() AssignmentOperator()) + AssignmentExpression() +| + PostfixExpression() +} + +void SwitchStatement(): +{} +{ + "switch" "(" Expression() ")" "{" + ( SwitchLabel() ( BlockStatement() )* )* + "}" +} + +void SwitchLabel(): +{} +{ + "case" Expression() ":" +| + "default" ":" +} + +void IfStatement(): +/* + * The disambiguating algorithm of JavaCC automatically binds dangling + * else's to the innermost if statement. The LOOKAHEAD specification + * is to tell JavaCC that we know what we are doing. + */ +{} +{ + "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ] +} + +void WhileStatement(): +{} +{ + "while" "(" Expression() ")" Statement() +} + +void DoStatement(): +{} +{ + "do" Statement() "while" "(" Expression() ")" ";" +} + +void ForStatement(): +{} +{ + "for" "(" + + ( + LOOKAHEAD(Modifiers() Type() <IDENTIFIER> ":") + Modifiers() Type() <IDENTIFIER> ":" Expression() + | + [ ForInit() ] ";" [ Expression() ] ";" [ ForUpdate() ] + ) + + ")" Statement() +} + +void ForInit(): +{} +{ + LOOKAHEAD( Modifiers() Type() <IDENTIFIER> ) + LocalVariableDeclaration() +| + StatementExpressionList() +} + +void StatementExpressionList(): +{} +{ + StatementExpression() ( "," StatementExpression() )* +} + +void ForUpdate(): +{} +{ + StatementExpressionList() +} + +void BreakStatement(): +{} +{ + "break" [ <IDENTIFIER> ] ";" +} + +void ContinueStatement(): +{} +{ + "continue" [ <IDENTIFIER> ] ";" +} + +void ReturnStatement(): +{} +{ + "return" [ Expression() ] ";" +} + +void ThrowStatement(): +{} +{ + "throw" Expression() ";" +} + +void SynchronizedStatement(): +{} +{ + "synchronized" "(" Expression() ")" Block() +} + +void TryStatement(): +/* + * Semantic check required here to make sure that at least one + * finally/catch is present. + */ +{} +{ + "try" Block() + ( "catch" "(" FormalParameter() ")" Block() )* + [ "finally" Block() ] +} + +/* We use productions to match >>>, >> and > so that we can keep the + * type declaration syntax with generics clean + */ + +void RUNSIGNEDSHIFT(): +{} +{ + ( LOOKAHEAD({ getToken(1).kind == GT && + ((Token.GTToken)getToken(1)).realKind == RUNSIGNEDSHIFT} ) + ">" ">" ">" + ) +} + +void RSIGNEDSHIFT(): +{} +{ + ( LOOKAHEAD({ getToken(1).kind == GT && + ((Token.GTToken)getToken(1)).realKind == RSIGNEDSHIFT} ) + ">" ">" + ) +} + +/* Annotation syntax follows. */ + +void Annotation(): +{} +{ + LOOKAHEAD( "@" Name() "(" ( <IDENTIFIER> "=" | ")" )) + NormalAnnotation() + | + LOOKAHEAD( "@" Name() "(" ) + SingleMemberAnnotation() + | + MarkerAnnotation() +} + +void NormalAnnotation(): +{} +{ + "@" Name() "(" [ MemberValuePairs() ] ")" +} + +void MarkerAnnotation(): +{} +{ + "@" Name() +} + +void SingleMemberAnnotation(): +{} +{ + "@" Name() "(" MemberValue() ")" +} + +void MemberValuePairs(): +{} +{ + MemberValuePair() ( "," MemberValuePair() )* +} + +void MemberValuePair(): +{} +{ + <IDENTIFIER> "=" MemberValue() +} + +void MemberValue(): +{} +{ + Annotation() + | + MemberValueArrayInitializer() + | + ConditionalExpression() +} + +void MemberValueArrayInitializer(): +{} +{ + "{" MemberValue() ( LOOKAHEAD(2) "," MemberValue() )* [ "," ] "}" +} + + +/* Annotation Types. */ + +void AnnotationTypeDeclaration(int modifiers): +{} +{ + "@" "interface" <IDENTIFIER> AnnotationTypeBody() +} + +void AnnotationTypeBody(): +{} +{ + "{" ( AnnotationTypeMemberDeclaration() )* "}" +} + +void AnnotationTypeMemberDeclaration(): +{ + int modifiers; +} +{ + modifiers = Modifiers() + ( + LOOKAHEAD(Type() <IDENTIFIER> "(") + Type() <IDENTIFIER> "(" ")" [ DefaultValue() ] ";" + | + ClassOrInterfaceDeclaration(modifiers) + | + EnumDeclaration(modifiers) + | + AnnotationTypeDeclaration(modifiers) + | + FieldDeclaration(modifiers) + ) + | + ( ";" ) +} + +void DefaultValue(): +{} +{ + "default" MemberValue() +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaCharStream.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaCharStream.java new file mode 100644 index 0000000..22153f8 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaCharStream.java @@ -0,0 +1,530 @@ +/* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 4.0 */ +package jaxx.compiler.java.parser; + +/** + * An implementation of interface CharStream, where the stream is assumed to + * contain only ASCII characters (with java-like unicode escape processing). + */ + +public class JavaCharStream { + public static final boolean staticFlag = false; + + static int hexval(char c) throws java.io.IOException { + switch (c) { + case '0': + return 0; + case '1': + return 1; + case '2': + return 2; + case '3': + return 3; + case '4': + return 4; + case '5': + return 5; + case '6': + return 6; + case '7': + return 7; + case '8': + return 8; + case '9': + return 9; + + case 'a': + case 'A': + return 10; + case 'b': + case 'B': + return 11; + case 'c': + case 'C': + return 12; + case 'd': + case 'D': + return 13; + case 'e': + case 'E': + return 14; + case 'f': + case 'F': + return 15; + } + + throw new java.io.IOException(); // Should never come here + } + + public int bufpos = -1; + int bufsize; + int available; + int tokenBegin; + protected int bufline[]; + protected int bufcolumn[]; + + protected int column = 0; + protected int line = 1; + + protected boolean prevCharIsCR = false; + protected boolean prevCharIsLF = false; + + protected java.io.Reader inputStream; + + protected char[] nextCharBuf; + protected char[] buffer; + protected int maxNextCharInd = 0; + protected int nextCharInd = -1; + protected int inBuf = 0; + protected int tabSize = 8; + + protected void setTabSize(int i) { + tabSize = i; + } + + protected int getTabSize(int i) { + return tabSize; + } + + protected void ExpandBuff(boolean wrapAround) { + char[] newbuffer = new char[bufsize + 2048]; + int newbufline[] = new int[bufsize + 2048]; + int newbufcolumn[] = new int[bufsize + 2048]; + + try { + if (wrapAround) { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + System.arraycopy(buffer, 0, newbuffer, + bufsize - tokenBegin, bufpos); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); + bufcolumn = newbufcolumn; + + bufpos += (bufsize - tokenBegin); + } else { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + bufcolumn = newbufcolumn; + + bufpos -= tokenBegin; + } + } + catch (Throwable t) { + throw new Error(t.getMessage()); + } + + available = (bufsize += 2048); + tokenBegin = 0; + } + + protected void FillBuff() throws java.io.IOException { + int i; + if (maxNextCharInd == 4096) + maxNextCharInd = nextCharInd = 0; + + try { + if ((i = inputStream.read(nextCharBuf, maxNextCharInd, + 4096 - maxNextCharInd)) == -1) { + inputStream.close(); + throw new java.io.IOException(); + } else { + maxNextCharInd += i; + } + } + catch (java.io.IOException e) { + if (bufpos != 0) { + --bufpos; + backup(0); + } else { + bufline[bufpos] = line; + bufcolumn[bufpos] = column; + } + throw e; + } + } + + protected char ReadByte() throws java.io.IOException { + if (++nextCharInd >= maxNextCharInd) + FillBuff(); + + return nextCharBuf[nextCharInd]; + } + + public char BeginToken() throws java.io.IOException { + if (inBuf > 0) { + --inBuf; + + if (++bufpos == bufsize) { + bufpos = 0; + } + + tokenBegin = bufpos; + return buffer[bufpos]; + } + + tokenBegin = 0; + bufpos = -1; + + return readChar(); + } + + protected void AdjustBuffSize() { + if (available == bufsize) { + if (tokenBegin > 2048) { + bufpos = 0; + available = tokenBegin; + } else + ExpandBuff(false); + } else if (available > tokenBegin) + available = bufsize; + else if ((tokenBegin - available) < 2048) + ExpandBuff(true); + else + available = tokenBegin; + } + + protected void UpdateLineColumn(char c) { + column++; + + if (prevCharIsLF) { + prevCharIsLF = false; + line += (column = 1); + } else if (prevCharIsCR) { + prevCharIsCR = false; + if (c == '\n') { + prevCharIsLF = true; + } else + line += (column = 1); + } + + switch (c) { + case '\r': + prevCharIsCR = true; + break; + case '\n': + prevCharIsLF = true; + break; + case '\t': + column--; + column += (tabSize - (column % tabSize)); + break; + default: + break; + } + + bufline[bufpos] = line; + bufcolumn[bufpos] = column; + } + + public char readChar() throws java.io.IOException { + if (inBuf > 0) { + --inBuf; + + if (++bufpos == bufsize) + bufpos = 0; + + return buffer[bufpos]; + } + + char c; + + if (++bufpos == available) + AdjustBuffSize(); + + if ((buffer[bufpos] = c = ReadByte()) == '\\') { + UpdateLineColumn(c); + + int backSlashCnt = 1; + + for (; ;) // Read all the backslashes + { + if (++bufpos == available) + AdjustBuffSize(); + + try { + if ((buffer[bufpos] = c = ReadByte()) != '\\') { + UpdateLineColumn(c); + // found a non-backslash char. + if ((c == 'u') && ((backSlashCnt & 1) == 1)) { + if (--bufpos < 0) + bufpos = bufsize - 1; + + break; + } + + backup(backSlashCnt); + return '\\'; + } + } + catch (java.io.IOException e) { + if (backSlashCnt > 1) + backup(backSlashCnt); + + return '\\'; + } + + UpdateLineColumn(c); + backSlashCnt++; + } + + // Here, we have seen an odd number of backslash's followed by a 'u' + try { + while ((c = ReadByte()) == 'u') + ++column; + + buffer[bufpos] = c = (char) (hexval(c) << 12 | + hexval(ReadByte()) << 8 | + hexval(ReadByte()) << 4 | + hexval(ReadByte())); + + column += 4; + } + catch (java.io.IOException e) { + throw new Error("Invalid escape character at line " + line + + " column " + column + "."); + } + + if (backSlashCnt == 1) + return c; + else { + backup(backSlashCnt - 1); + return '\\'; + } + } else { + UpdateLineColumn(c); + return (c); + } + } + + /** + * @return column index + * @see #getEndColumn + * @deprecated + */ + + public int getColumn() { + return bufcolumn[bufpos]; + } + + /** + * @return line type ??? + * @see #getEndLine + * @deprecated + */ + + public int getLine() { + return bufline[bufpos]; + } + + public int getEndColumn() { + return bufcolumn[bufpos]; + } + + public int getEndLine() { + return bufline[bufpos]; + } + + public int getBeginColumn() { + return bufcolumn[tokenBegin]; + } + + public int getBeginLine() { + return bufline[tokenBegin]; + } + + public void backup(int amount) { + + inBuf += amount; + if ((bufpos -= amount) < 0) + bufpos += bufsize; + } + + public JavaCharStream(java.io.Reader dstream, + int startline, int startcolumn, int buffersize) { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + nextCharBuf = new char[4096]; + } + + public JavaCharStream(java.io.Reader dstream, + int startline, int startcolumn) { + this(dstream, startline, startcolumn, 4096); + } + + public JavaCharStream(java.io.Reader dstream) { + this(dstream, 1, 1, 4096); + } + + public void ReInit(java.io.Reader dstream, + int startline, int startcolumn, int buffersize) { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + if (buffer == null || buffersize != buffer.length) { + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + nextCharBuf = new char[4096]; + } + prevCharIsLF = prevCharIsCR = false; + tokenBegin = inBuf = maxNextCharInd = 0; + nextCharInd = bufpos = -1; + } + + public void ReInit(java.io.Reader dstream, + int startline, int startcolumn) { + ReInit(dstream, startline, startcolumn, 4096); + } + + public void ReInit(java.io.Reader dstream) { + ReInit(dstream, 1, 1, 4096); + } + + public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { + this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + + public JavaCharStream(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) { + this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); + } + + public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException { + this(dstream, encoding, startline, startcolumn, 4096); + } + + public JavaCharStream(java.io.InputStream dstream, int startline, + int startcolumn) { + this(dstream, startline, startcolumn, 4096); + } + + public JavaCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { + this(dstream, encoding, 1, 1, 4096); + } + + public JavaCharStream(java.io.InputStream dstream) { + this(dstream, 1, 1, 4096); + } + + public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { + ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + + public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) { + ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); + } + + public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException { + ReInit(dstream, encoding, startline, startcolumn, 4096); + } + + public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn) { + ReInit(dstream, startline, startcolumn, 4096); + } + + public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { + ReInit(dstream, encoding, 1, 1, 4096); + } + + public void ReInit(java.io.InputStream dstream) { + ReInit(dstream, 1, 1, 4096); + } + + public String GetImage() { + if (bufpos >= tokenBegin) + return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); + else + return new String(buffer, tokenBegin, bufsize - tokenBegin) + + new String(buffer, 0, bufpos + 1); + } + + public char[] GetSuffix(int len) { + char[] ret = new char[len]; + + if ((bufpos + 1) >= len) + System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); + else { + System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, + len - bufpos - 1); + System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); + } + + return ret; + } + + public void Done() { + nextCharBuf = null; + buffer = null; + bufline = null; + bufcolumn = null; + } + + /** + * Method to adjust line and column numbers for the start of a token. + * + * @param newLine line number ? + * @param newCol column number ? + */ + public void adjustBeginLineColumn(int newLine, int newCol) { + int start = tokenBegin; + int len; + + if (bufpos >= tokenBegin) { + len = bufpos - tokenBegin + inBuf + 1; + } else { + len = bufsize - tokenBegin + bufpos + 1 + inBuf; + } + + int i = 0, j = 0, k; + int nextColDiff, columnDiff = 0; + + while (i < len && + bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { + bufline[j] = newLine; + nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; + bufcolumn[j] = newCol + columnDiff; + columnDiff = nextColDiff; + i++; + } + + if (i < len) { + bufline[j] = newLine++; + bufcolumn[j] = newCol + columnDiff; + + while (i++ < len) { + if (bufline[j = start % bufsize] != bufline[++start % bufsize]) + bufline[j] = newLine++; + else + bufline[j] = newLine; + } + } + + line = bufline[j]; + column = bufcolumn[j]; + } + +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java new file mode 100644 index 0000000..9c47385 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java @@ -0,0 +1,10048 @@ +/* Generated By:JJTree&JavaCC: Do not edit this line. JavaParser.java */ +package jaxx.compiler.java.parser; + +import java.io.File; +import java.io.FileInputStream; + +/** + * Grammar to parse Java version 1.5 + * + * @author Sreenivasa Viswanadha - Simplified and enhanced for 1.5 + */ +public class JavaParser/*@bgen(jjtree)*/ implements JavaParserTreeConstants, JavaParserConstants {/*@bgen(jjtree)*/ + protected JJTJavaParserState jjtree = new JJTJavaParserState(); + + /** Class to hold modifiers. */ + static public final class ModifierSet { + /* Definitions of the bits in the modifiers field. */ + public static final int PUBLIC = 0x0001; + public static final int PROTECTED = 0x0002; + public static final int PRIVATE = 0x0004; + public static final int ABSTRACT = 0x0008; + public static final int STATIC = 0x0010; + public static final int FINAL = 0x0020; + public static final int SYNCHRONIZED = 0x0040; + public static final int NATIVE = 0x0080; + public static final int TRANSIENT = 0x0100; + public static final int VOLATILE = 0x0200; + public static final int STRICTFP = 0x1000; + + /** + * A set of accessors that indicate whether the specified modifier + * is in the set. + */ + + public boolean isPublic(int modifiers) { + return (modifiers & PUBLIC) != 0; + } + + public boolean isProtected(int modifiers) { + return (modifiers & PROTECTED) != 0; + } + + public boolean isPrivate(int modifiers) { + return (modifiers & PRIVATE) != 0; + } + + public boolean isStatic(int modifiers) { + return (modifiers & STATIC) != 0; + } + + public boolean isAbstract(int modifiers) { + return (modifiers & ABSTRACT) != 0; + } + + public boolean isFinal(int modifiers) { + return (modifiers & FINAL) != 0; + } + + public boolean isNative(int modifiers) { + return (modifiers & NATIVE) != 0; + } + + public boolean isStrictfp(int modifiers) { + return (modifiers & STRICTFP) != 0; + } + + public boolean isSynchronized(int modifiers) { + return (modifiers & SYNCHRONIZED) != 0; + } + + public boolean isTransient(int modifiers) { + return (modifiers & TRANSIENT) != 0; + } + + public boolean isVolatile(int modifiers) { + return (modifiers & VOLATILE) != 0; + } + + /** Removes the given modifier. */ + static int removeModifier(int modifiers, int mod) { + return modifiers & ~mod; + } + } + + public JavaParser(String fileName) { + this(System.in); + try { + ReInit(new FileInputStream(new File(fileName))); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + void jjtreeOpenNodeScope(Node n) { + ((SimpleNode) n).firstToken = getToken(1); + } + + void jjtreeCloseNodeScope(Node n) { + ((SimpleNode) n).lastToken = getToken(0); + } + + public SimpleNode popNode() { + if (jjtree.nodeArity() > 0) // number of child nodes + return (SimpleNode) jjtree.popNode(); + else + return null; + } + + public static void main(String args[]) { + JavaParser parser; + if (args.length == 0) { + System.out.println("Java Parser Version 1.1: Reading from standard input . . ."); + parser = new JavaParser(System.in); + } else if (args.length == 1) { + System.out.println("Java Parser Version 1.1: Reading from file " + args[0] + " . . ."); + try { + parser = new JavaParser(new java.io.FileInputStream(args[0])); + } catch (java.io.FileNotFoundException e) { + System.out.println("Java Parser Version 1.1: File " + args[0] + " not found."); + return; + } + } else { + System.out.println("Java Parser Version 1.1: Usage is one of:"); + System.out.println(" java JavaParser < inputfile"); + System.out.println("OR"); + System.out.println(" java JavaParser inputfile"); + return; + } + try { + parser.CompilationUnit(); + System.out.println("Java Parser Version 1.1: Java program parsed successfully."); + } catch (ParseException e) { + System.out.println(e.getMessage()); + System.out.println("Java Parser Version 1.1: Encountered errors during parse."); + } + } + + final public boolean Line() throws ParseException { + /*@bgen(jjtree) Line */ + SimpleNode jjtn000 = new SimpleNode(JJTLINE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + int modifiers; + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case 0: + jj_consume_token(0); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + { + if (true) return true; + } + break; + default: + if (jj_2_1(2147483647)) { + BlockStatement(); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + { + if (true) return false; + } + } else if (jj_2_2(2147483647)) { + ClassOrInterfaceBodyDeclaration(false); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + { + if (true) return false; + } + } else if (jj_2_3(2147483647)) { + ClassOrInterfaceBodyDeclaration(false); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + { + if (true) return false; + } + } else if (jj_2_4(2147483647)) { + Expression(); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + { + if (true) return false; + } + } else { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case IMPORT: + ImportDeclaration(); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + { + if (true) return false; + } + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + throw new Error("Missing return statement in function"); + } + + /** + * ************************************** + * THE JAVA LANGUAGE GRAMMAR STARTS HERE * + * *************************************** + */ + +/* + * Program structuring syntax follows. + */ + final public void CompilationUnit() throws ParseException { + /*@bgen(jjtree) CompilationUnit */ + SimpleNode jjtn000 = new SimpleNode(JJTCOMPILATIONUNIT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + if (jj_2_5(2147483647)) { + PackageDeclaration(); + } else { + ; + } + label_1: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case IMPORT: + ; + break; + default: + break label_1; + } + ImportDeclaration(); + } + label_2: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case ABSTRACT: + case CLASS: + case ENUM: + case FINAL: + case INTERFACE: + case NATIVE: + case PRIVATE: + case PROTECTED: + case PUBLIC: + case STATIC: + case STRICTFP: + case SYNCHRONIZED: + case TRANSIENT: + case VOLATILE: + case SEMICOLON: + case AT: + ; + break; + default: + break label_2; + } + TypeDeclaration(); + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case 123: + jj_consume_token(123); + break; + default: + ; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case STUFF_TO_IGNORE: + jj_consume_token(STUFF_TO_IGNORE); + break; + default: + ; + } + jj_consume_token(0); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void PackageDeclaration() throws ParseException { + /*@bgen(jjtree) PackageDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTPACKAGEDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + Modifiers(); + jj_consume_token(PACKAGE); + Name(); + jj_consume_token(SEMICOLON); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ImportDeclaration() throws ParseException { + /*@bgen(jjtree) ImportDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTIMPORTDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(IMPORT); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case STATIC: + jj_consume_token(STATIC); + break; + default: + ; + } + Name(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case DOT: + jj_consume_token(DOT); + jj_consume_token(STAR); + break; + default: + ; + } + jj_consume_token(SEMICOLON); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + /* + * Modifiers. We match all modifiers in a single rule to reduce the chances of + * syntax errors for simple modifier mistakes. It will also enable us to give + * better error messages. + */ + final public int Modifiers() throws ParseException { + /*@bgen(jjtree) Modifiers */ + SimpleNode jjtn000 = new SimpleNode(JJTMODIFIERS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + int modifiers = 0; + try { + label_3: + while (true) { + if (jj_2_6(2)) { + ; + } else { + break label_3; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case PUBLIC: + jj_consume_token(PUBLIC); + modifiers |= ModifierSet.PUBLIC; + break; + case STATIC: + jj_consume_token(STATIC); + modifiers |= ModifierSet.STATIC; + break; + case PROTECTED: + jj_consume_token(PROTECTED); + modifiers |= ModifierSet.PROTECTED; + break; + case PRIVATE: + jj_consume_token(PRIVATE); + modifiers |= ModifierSet.PRIVATE; + break; + case FINAL: + jj_consume_token(FINAL); + modifiers |= ModifierSet.FINAL; + break; + case ABSTRACT: + jj_consume_token(ABSTRACT); + modifiers |= ModifierSet.ABSTRACT; + break; + case SYNCHRONIZED: + jj_consume_token(SYNCHRONIZED); + modifiers |= ModifierSet.SYNCHRONIZED; + break; + case NATIVE: + jj_consume_token(NATIVE); + modifiers |= ModifierSet.NATIVE; + break; + case TRANSIENT: + jj_consume_token(TRANSIENT); + modifiers |= ModifierSet.TRANSIENT; + break; + case VOLATILE: + jj_consume_token(VOLATILE); + modifiers |= ModifierSet.VOLATILE; + break; + case STRICTFP: + jj_consume_token(STRICTFP); + modifiers |= ModifierSet.STRICTFP; + break; + case AT: + Annotation(); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + { + if (true) return modifiers; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + throw new Error("Missing return statement in function"); + } + + /* + * Declaration syntax follows. + */ + final public void TypeDeclaration() throws ParseException { + /*@bgen(jjtree) TypeDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTTYPEDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + int modifiers; + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case SEMICOLON: + jj_consume_token(SEMICOLON); + break; + case ABSTRACT: + case CLASS: + case ENUM: + case FINAL: + case INTERFACE: + case NATIVE: + case PRIVATE: + case PROTECTED: + case PUBLIC: + case STATIC: + case STRICTFP: + case SYNCHRONIZED: + case TRANSIENT: + case VOLATILE: + case AT: + modifiers = Modifiers(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case CLASS: + case INTERFACE: + ClassOrInterfaceDeclaration(modifiers); + break; + case ENUM: + EnumDeclaration(modifiers); + break; + case AT: + AnnotationTypeDeclaration(modifiers); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ClassOrInterfaceDeclaration(int modifiers) throws ParseException { + /*@bgen(jjtree) ClassOrInterfaceDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACEDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + boolean isInterface = false; + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case CLASS: + jj_consume_token(CLASS); + break; + case INTERFACE: + jj_consume_token(INTERFACE); + isInterface = true; + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + jj_consume_token(IDENTIFIER); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LT: + TypeParameters(); + break; + default: + ; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case EXTENDS: + ExtendsList(isInterface); + break; + default: + ; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case IMPLEMENTS: + ImplementsList(isInterface); + break; + default: + ; + } + ClassOrInterfaceBody(isInterface); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ExtendsList(boolean isInterface) throws ParseException { + /*@bgen(jjtree) ExtendsList */ + SimpleNode jjtn000 = new SimpleNode(JJTEXTENDSLIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + boolean extendsMoreThanOne = false; + try { + jj_consume_token(EXTENDS); + ClassOrInterfaceType(); + label_4: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case COMMA: + ; + break; + default: + break label_4; + } + jj_consume_token(COMMA); + ClassOrInterfaceType(); + extendsMoreThanOne = true; + } + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + if (extendsMoreThanOne && !isInterface) { + if (true) + throw new ParseException("A class cannot extend more than one other class"); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ImplementsList(boolean isInterface) throws ParseException { + /*@bgen(jjtree) ImplementsList */ + SimpleNode jjtn000 = new SimpleNode(JJTIMPLEMENTSLIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(IMPLEMENTS); + ClassOrInterfaceType(); + label_5: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case COMMA: + ; + break; + default: + break label_5; + } + jj_consume_token(COMMA); + ClassOrInterfaceType(); + } + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + if (isInterface) { + if (true) + throw new ParseException("An interface cannot implement other interfaces"); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void EnumDeclaration(int modifiers) throws ParseException { + /*@bgen(jjtree) EnumDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTENUMDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(ENUM); + jj_consume_token(IDENTIFIER); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case IMPLEMENTS: + ImplementsList(false); + break; + default: + ; + } + EnumBody(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void EnumBody() throws ParseException { + /*@bgen(jjtree) EnumBody */ + SimpleNode jjtn000 = new SimpleNode(JJTENUMBODY); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(LBRACE); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case ABSTRACT: + case FINAL: + case NATIVE: + case PRIVATE: + case PROTECTED: + case PUBLIC: + case STATIC: + case STRICTFP: + case SYNCHRONIZED: + case TRANSIENT: + case VOLATILE: + case IDENTIFIER: + case AT: + EnumConstant(); + label_6: + while (true) { + if (jj_2_7(2)) { + ; + } else { + break label_6; + } + jj_consume_token(COMMA); + EnumConstant(); + } + break; + default: + ; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case COMMA: + jj_consume_token(COMMA); + break; + default: + ; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case SEMICOLON: + jj_consume_token(SEMICOLON); + label_7: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case ABSTRACT: + case BOOLEAN: + case BYTE: + case CHAR: + case CLASS: + case DOUBLE: + case ENUM: + case FINAL: + case FLOAT: + case INT: + case INTERFACE: + case LONG: + case NATIVE: + case PRIVATE: + case PROTECTED: + case PUBLIC: + case SHORT: + case STATIC: + case STRICTFP: + case SYNCHRONIZED: + case TRANSIENT: + case VOID: + case VOLATILE: + case IDENTIFIER: + case LBRACE: + case SEMICOLON: + case AT: + case LT: + ; + break; + default: + break label_7; + } + ClassOrInterfaceBodyDeclaration(false); + } + break; + default: + ; + } + jj_consume_token(RBRACE); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void EnumConstant() throws ParseException { + /*@bgen(jjtree) EnumConstant */ + SimpleNode jjtn000 = new SimpleNode(JJTENUMCONSTANT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + Modifiers(); + jj_consume_token(IDENTIFIER); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LPAREN: + Arguments(); + break; + default: + ; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LBRACE: + ClassOrInterfaceBody(false); + break; + default: + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void TypeParameters() throws ParseException { + /*@bgen(jjtree) TypeParameters */ + SimpleNode jjtn000 = new SimpleNode(JJTTYPEPARAMETERS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(LT); + TypeParameter(); + label_8: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case COMMA: + ; + break; + default: + break label_8; + } + jj_consume_token(COMMA); + TypeParameter(); + } + jj_consume_token(GT); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void TypeParameter() throws ParseException { + /*@bgen(jjtree) TypeParameter */ + SimpleNode jjtn000 = new SimpleNode(JJTTYPEPARAMETER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(IDENTIFIER); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case EXTENDS: + TypeBound(); + break; + default: + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void TypeBound() throws ParseException { + /*@bgen(jjtree) TypeBound */ + SimpleNode jjtn000 = new SimpleNode(JJTTYPEBOUND); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(EXTENDS); + ClassOrInterfaceType(); + label_9: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case BIT_AND: + ; + break; + default: + break label_9; + } + jj_consume_token(BIT_AND); + ClassOrInterfaceType(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ClassOrInterfaceBody(boolean isInterface) throws ParseException { + /*@bgen(jjtree) ClassOrInterfaceBody */ + SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACEBODY); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(LBRACE); + label_10: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case ABSTRACT: + case BOOLEAN: + case BYTE: + case CHAR: + case CLASS: + case DOUBLE: + case ENUM: + case FINAL: + case FLOAT: + case INT: + case INTERFACE: + case LONG: + case NATIVE: + case PRIVATE: + case PROTECTED: + case PUBLIC: + case SHORT: + case STATIC: + case STRICTFP: + case SYNCHRONIZED: + case TRANSIENT: + case VOID: + case VOLATILE: + case IDENTIFIER: + case LBRACE: + case SEMICOLON: + case AT: + case LT: + ; + break; + default: + break label_10; + } + ClassOrInterfaceBodyDeclaration(isInterface); + } + jj_consume_token(RBRACE); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ClassOrInterfaceBodyDeclaration(boolean isInterface) throws ParseException { + /*@bgen(jjtree) ClassOrInterfaceBodyDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACEBODYDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + boolean isNestedInterface = false; + int modifiers; + try { + if (jj_2_10(2)) { + Initializer(); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + if (isInterface) { + if (true) + throw new ParseException("An interface cannot have initializers"); + } + } else { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case ABSTRACT: + case BOOLEAN: + case BYTE: + case CHAR: + case CLASS: + case DOUBLE: + case ENUM: + case FINAL: + case FLOAT: + case INT: + case INTERFACE: + case LONG: + case NATIVE: + case PRIVATE: + case PROTECTED: + case PUBLIC: + case SHORT: + case STATIC: + case STRICTFP: + case SYNCHRONIZED: + case TRANSIENT: + case VOID: + case VOLATILE: + case IDENTIFIER: + case AT: + case LT: + modifiers = Modifiers(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case CLASS: + case INTERFACE: + ClassOrInterfaceDeclaration(modifiers); + break; + case ENUM: + EnumDeclaration(modifiers); + break; + default: + if (jj_2_8(2147483647)) { + ConstructorDeclaration(); + } else if (jj_2_9(2147483647)) { + FieldDeclaration(modifiers); + } else { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FLOAT: + case INT: + case LONG: + case SHORT: + case VOID: + case IDENTIFIER: + case LT: + MethodDeclaration(modifiers); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } + } + break; + case SEMICOLON: + jj_consume_token(SEMICOLON); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void FieldDeclaration(int modifiers) throws ParseException { + /*@bgen(jjtree) FieldDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTFIELDDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + Type(); + VariableDeclarator(); + label_11: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case COMMA: + ; + break; + default: + break label_11; + } + jj_consume_token(COMMA); + VariableDeclarator(); + } + jj_consume_token(SEMICOLON); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void VariableDeclarator() throws ParseException { + /*@bgen(jjtree) VariableDeclarator */ + SimpleNode jjtn000 = new SimpleNode(JJTVARIABLEDECLARATOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + VariableDeclaratorId(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case ASSIGN: + jj_consume_token(ASSIGN); + VariableInitializer(); + break; + default: + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void VariableDeclaratorId() throws ParseException { + /*@bgen(jjtree) VariableDeclaratorId */ + SimpleNode jjtn000 = new SimpleNode(JJTVARIABLEDECLARATORID); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(IDENTIFIER); + label_12: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LBRACKET: + ; + break; + default: + break label_12; + } + jj_consume_token(LBRACKET); + jj_consume_token(RBRACKET); + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void VariableInitializer() throws ParseException { + /*@bgen(jjtree) VariableInitializer */ + SimpleNode jjtn000 = new SimpleNode(JJTVARIABLEINITIALIZER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LBRACE: + ArrayInitializer(); + break; + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FALSE: + case FLOAT: + case INT: + case LONG: + case NEW: + case NULL: + case SHORT: + case SUPER: + case THIS: + case TRUE: + case VOID: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case CHARACTER_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case BANG: + case TILDE: + case INCR: + case DECR: + case PLUS: + case MINUS: + Expression(); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ArrayInitializer() throws ParseException { + /*@bgen(jjtree) ArrayInitializer */ + SimpleNode jjtn000 = new SimpleNode(JJTARRAYINITIALIZER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(LBRACE); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FALSE: + case FLOAT: + case INT: + case LONG: + case NEW: + case NULL: + case SHORT: + case SUPER: + case THIS: + case TRUE: + case VOID: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case CHARACTER_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case LBRACE: + case BANG: + case TILDE: + case INCR: + case DECR: + case PLUS: + case MINUS: + VariableInitializer(); + label_13: + while (true) { + if (jj_2_11(2)) { + ; + } else { + break label_13; + } + jj_consume_token(COMMA); + VariableInitializer(); + } + break; + default: + ; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case COMMA: + jj_consume_token(COMMA); + break; + default: + ; + } + jj_consume_token(RBRACE); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void MethodDeclaration(int modifiers) throws ParseException { + /*@bgen(jjtree) MethodDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTMETHODDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LT: + TypeParameters(); + break; + default: + ; + } + ResultType(); + MethodDeclarator(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case THROWS: + jj_consume_token(THROWS); + NameList(); + break; + default: + ; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LBRACE: + Block(); + break; + case SEMICOLON: + jj_consume_token(SEMICOLON); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void MethodDeclarator() throws ParseException { + /*@bgen(jjtree) MethodDeclarator */ + SimpleNode jjtn000 = new SimpleNode(JJTMETHODDECLARATOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(IDENTIFIER); + FormalParameters(); + label_14: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LBRACKET: + ; + break; + default: + break label_14; + } + jj_consume_token(LBRACKET); + jj_consume_token(RBRACKET); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void FormalParameters() throws ParseException { + /*@bgen(jjtree) FormalParameters */ + SimpleNode jjtn000 = new SimpleNode(JJTFORMALPARAMETERS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(LPAREN); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case ABSTRACT: + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FINAL: + case FLOAT: + case INT: + case LONG: + case NATIVE: + case PRIVATE: + case PROTECTED: + case PUBLIC: + case SHORT: + case STATIC: + case STRICTFP: + case SYNCHRONIZED: + case TRANSIENT: + case VOLATILE: + case IDENTIFIER: + case AT: + FormalParameter(); + label_15: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case COMMA: + ; + break; + default: + break label_15; + } + jj_consume_token(COMMA); + FormalParameter(); + } + break; + default: + ; + } + jj_consume_token(RPAREN); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void FormalParameter() throws ParseException { + /*@bgen(jjtree) FormalParameter */ + SimpleNode jjtn000 = new SimpleNode(JJTFORMALPARAMETER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + Modifiers(); + Type(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case ELLIPSIS: + jj_consume_token(ELLIPSIS); + break; + default: + ; + } + VariableDeclaratorId(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ConstructorDeclaration() throws ParseException { + /*@bgen(jjtree) ConstructorDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTCONSTRUCTORDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LT: + TypeParameters(); + break; + default: + ; + } + jj_consume_token(IDENTIFIER); + FormalParameters(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case THROWS: + jj_consume_token(THROWS); + NameList(); + break; + default: + ; + } + jj_consume_token(LBRACE); + if (jj_2_12(2147483647)) { + ExplicitConstructorInvocation(); + } else { + ; + } + label_16: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case ABSTRACT: + case ASSERT: + case BOOLEAN: + case BREAK: + case BYTE: + case CHAR: + case CLASS: + case CONTINUE: + case DO: + case DOUBLE: + case FALSE: + case FINAL: + case FLOAT: + case FOR: + case IF: + case INT: + case INTERFACE: + case LONG: + case NATIVE: + case NEW: + case NULL: + case PRIVATE: + case PROTECTED: + case PUBLIC: + case RETURN: + case SHORT: + case STATIC: + case STRICTFP: + case SUPER: + case SWITCH: + case SYNCHRONIZED: + case THIS: + case THROW: + case TRANSIENT: + case TRUE: + case TRY: + case VOID: + case VOLATILE: + case WHILE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case CHARACTER_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case LBRACE: + case SEMICOLON: + case AT: + case INCR: + case DECR: + ; + break; + default: + break label_16; + } + BlockStatement(); + } + jj_consume_token(RBRACE); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ExplicitConstructorInvocation() throws ParseException { + /*@bgen(jjtree) ExplicitConstructorInvocation */ + SimpleNode jjtn000 = new SimpleNode(JJTEXPLICITCONSTRUCTORINVOCATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + label_17: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case IDENTIFIER: + ; + break; + default: + break label_17; + } + jj_consume_token(IDENTIFIER); + jj_consume_token(DOT); + } + if (jj_2_13(2)) { + jj_consume_token(THIS); + jj_consume_token(DOT); + } else { + ; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LT: + TypeArguments(); + break; + default: + ; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case THIS: + jj_consume_token(THIS); + break; + case SUPER: + jj_consume_token(SUPER); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + Arguments(); + jj_consume_token(SEMICOLON); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Initializer() throws ParseException { + /*@bgen(jjtree) Initializer */ + SimpleNode jjtn000 = new SimpleNode(JJTINITIALIZER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case STATIC: + jj_consume_token(STATIC); + break; + default: + ; + } + Block(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + /* + * Type, name and expression syntax follows. + */ + final public void Type() throws ParseException { + /*@bgen(jjtree) Type */ + SimpleNode jjtn000 = new SimpleNode(JJTTYPE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + if (jj_2_14(2)) { + ReferenceType(); + } else { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FLOAT: + case INT: + case LONG: + case SHORT: + PrimitiveType(); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ReferenceType() throws ParseException { + /*@bgen(jjtree) ReferenceType */ + SimpleNode jjtn000 = new SimpleNode(JJTREFERENCETYPE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FLOAT: + case INT: + case LONG: + case SHORT: + PrimitiveType(); + label_18: + while (true) { + jj_consume_token(LBRACKET); + jj_consume_token(RBRACKET); + if (jj_2_15(2)) { + ; + } else { + break label_18; + } + } + break; + case IDENTIFIER: + ClassOrInterfaceType(); + label_19: + while (true) { + if (jj_2_16(2)) { + ; + } else { + break label_19; + } + jj_consume_token(LBRACKET); + jj_consume_token(RBRACKET); + } + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ClassOrInterfaceType() throws ParseException { + /*@bgen(jjtree) ClassOrInterfaceType */ + SimpleNode jjtn000 = new SimpleNode(JJTCLASSORINTERFACETYPE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(IDENTIFIER); + if (jj_2_17(2)) { + TypeArguments(); + } else { + ; + } + label_20: + while (true) { + if (jj_2_18(2)) { + ; + } else { + break label_20; + } + jj_consume_token(DOT); + jj_consume_token(IDENTIFIER); + if (jj_2_19(2)) { + TypeArguments(); + } else { + ; + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void TypeArguments() throws ParseException { + /*@bgen(jjtree) TypeArguments */ + SimpleNode jjtn000 = new SimpleNode(JJTTYPEARGUMENTS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(LT); + TypeArgument(); + label_21: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case COMMA: + ; + break; + default: + break label_21; + } + jj_consume_token(COMMA); + TypeArgument(); + } + jj_consume_token(GT); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void TypeArgument() throws ParseException { + /*@bgen(jjtree) TypeArgument */ + SimpleNode jjtn000 = new SimpleNode(JJTTYPEARGUMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FLOAT: + case INT: + case LONG: + case SHORT: + case IDENTIFIER: + ReferenceType(); + break; + case HOOK: + jj_consume_token(HOOK); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case EXTENDS: + case SUPER: + WildcardBounds(); + break; + default: + ; + } + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void WildcardBounds() throws ParseException { + /*@bgen(jjtree) WildcardBounds */ + SimpleNode jjtn000 = new SimpleNode(JJTWILDCARDBOUNDS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case EXTENDS: + jj_consume_token(EXTENDS); + ReferenceType(); + break; + case SUPER: + jj_consume_token(SUPER); + ReferenceType(); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void PrimitiveType() throws ParseException { + /*@bgen(jjtree) PrimitiveType */ + SimpleNode jjtn000 = new SimpleNode(JJTPRIMITIVETYPE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case BOOLEAN: + jj_consume_token(BOOLEAN); + break; + case CHAR: + jj_consume_token(CHAR); + break; + case BYTE: + jj_consume_token(BYTE); + break; + case SHORT: + jj_consume_token(SHORT); + break; + case INT: + jj_consume_token(INT); + break; + case LONG: + jj_consume_token(LONG); + break; + case FLOAT: + jj_consume_token(FLOAT); + break; + case DOUBLE: + jj_consume_token(DOUBLE); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ResultType() throws ParseException { + /*@bgen(jjtree) ResultType */ + SimpleNode jjtn000 = new SimpleNode(JJTRESULTTYPE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case VOID: + jj_consume_token(VOID); + break; + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FLOAT: + case INT: + case LONG: + case SHORT: + case IDENTIFIER: + Type(); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Name() throws ParseException { + /*@bgen(jjtree) Name */ + SimpleNode jjtn000 = new SimpleNode(JJTNAME); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(IDENTIFIER); + label_22: + while (true) { + if (jj_2_20(2)) { + ; + } else { + break label_22; + } + jj_consume_token(DOT); + jj_consume_token(IDENTIFIER); + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void NameList() throws ParseException { + /*@bgen(jjtree) NameList */ + SimpleNode jjtn000 = new SimpleNode(JJTNAMELIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + Name(); + label_23: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case COMMA: + ; + break; + default: + break label_23; + } + jj_consume_token(COMMA); + Name(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + /* + * Expression syntax follows. + */ + final public void Expression() throws ParseException { + /*@bgen(jjtree) Expression */ + SimpleNode jjtn000 = new SimpleNode(JJTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + ConditionalExpression(); + if (jj_2_21(2)) { + AssignmentOperator(); + Expression(); + } else { + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void AssignmentOperator() throws ParseException { + /*@bgen(jjtree) AssignmentOperator */ + SimpleNode jjtn000 = new SimpleNode(JJTASSIGNMENTOPERATOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case ASSIGN: + jj_consume_token(ASSIGN); + break; + case STARASSIGN: + jj_consume_token(STARASSIGN); + break; + case SLASHASSIGN: + jj_consume_token(SLASHASSIGN); + break; + case REMASSIGN: + jj_consume_token(REMASSIGN); + break; + case PLUSASSIGN: + jj_consume_token(PLUSASSIGN); + break; + case MINUSASSIGN: + jj_consume_token(MINUSASSIGN); + break; + case LSHIFTASSIGN: + jj_consume_token(LSHIFTASSIGN); + break; + case RSIGNEDSHIFTASSIGN: + jj_consume_token(RSIGNEDSHIFTASSIGN); + break; + case RUNSIGNEDSHIFTASSIGN: + jj_consume_token(RUNSIGNEDSHIFTASSIGN); + break; + case ANDASSIGN: + jj_consume_token(ANDASSIGN); + break; + case XORASSIGN: + jj_consume_token(XORASSIGN); + break; + case ORASSIGN: + jj_consume_token(ORASSIGN); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void AssignmentExpression() throws ParseException { + /*@bgen(jjtree) AssignmentExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTASSIGNMENTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + PrimaryExpression(); + AssignmentOperator(); + Expression(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ConditionalExpression() throws ParseException { + /*@bgen(jjtree) ConditionalExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTCONDITIONALEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + ConditionalOrExpression(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case HOOK: + jj_consume_token(HOOK); + Expression(); + jj_consume_token(COLON); + Expression(); + break; + default: + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ConditionalOrExpression() throws ParseException { + /*@bgen(jjtree) ConditionalOrExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTCONDITIONALOREXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + ConditionalAndExpression(); + label_24: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case SC_OR: + ; + break; + default: + break label_24; + } + jj_consume_token(SC_OR); + ConditionalAndExpression(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ConditionalAndExpression() throws ParseException { + /*@bgen(jjtree) ConditionalAndExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTCONDITIONALANDEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + InclusiveOrExpression(); + label_25: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case SC_AND: + ; + break; + default: + break label_25; + } + jj_consume_token(SC_AND); + InclusiveOrExpression(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void InclusiveOrExpression() throws ParseException { + /*@bgen(jjtree) InclusiveOrExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTINCLUSIVEOREXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + ExclusiveOrExpression(); + label_26: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case BIT_OR: + ; + break; + default: + break label_26; + } + jj_consume_token(BIT_OR); + ExclusiveOrExpression(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ExclusiveOrExpression() throws ParseException { + /*@bgen(jjtree) ExclusiveOrExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTEXCLUSIVEOREXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + AndExpression(); + label_27: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case XOR: + ; + break; + default: + break label_27; + } + jj_consume_token(XOR); + AndExpression(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void AndExpression() throws ParseException { + /*@bgen(jjtree) AndExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTANDEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + EqualityExpression(); + label_28: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case BIT_AND: + ; + break; + default: + break label_28; + } + jj_consume_token(BIT_AND); + EqualityExpression(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void EqualityExpression() throws ParseException { + /*@bgen(jjtree) EqualityExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTEQUALITYEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + InstanceOfExpression(); + label_29: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case EQ: + case NE: + ; + break; + default: + break label_29; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case EQ: + jj_consume_token(EQ); + break; + case NE: + jj_consume_token(NE); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + InstanceOfExpression(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void InstanceOfExpression() throws ParseException { + /*@bgen(jjtree) InstanceOfExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTINSTANCEOFEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + RelationalExpression(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case INSTANCEOF: + jj_consume_token(INSTANCEOF); + Type(); + break; + default: + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void RelationalExpression() throws ParseException { + /*@bgen(jjtree) RelationalExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTRELATIONALEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + ShiftExpression(); + label_30: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LT: + case LE: + case GE: + case GT: + ; + break; + default: + break label_30; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LT: + jj_consume_token(LT); + break; + case GT: + jj_consume_token(GT); + break; + case LE: + jj_consume_token(LE); + break; + case GE: + jj_consume_token(GE); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + ShiftExpression(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ShiftExpression() throws ParseException { + /*@bgen(jjtree) ShiftExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTSHIFTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + AdditiveExpression(); + label_31: + while (true) { + if (jj_2_22(1)) { + ; + } else { + break label_31; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LSHIFT: + jj_consume_token(LSHIFT); + break; + default: + if (jj_2_23(1)) { + RSIGNEDSHIFT(); + } else if (jj_2_24(1)) { + RUNSIGNEDSHIFT(); + } else { + jj_consume_token(-1); + throw new ParseException(); + } + } + AdditiveExpression(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void AdditiveExpression() throws ParseException { + /*@bgen(jjtree) AdditiveExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTADDITIVEEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + MultiplicativeExpression(); + label_32: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case PLUS: + case MINUS: + ; + break; + default: + break label_32; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case PLUS: + jj_consume_token(PLUS); + break; + case MINUS: + jj_consume_token(MINUS); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + MultiplicativeExpression(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void MultiplicativeExpression() throws ParseException { + /*@bgen(jjtree) MultiplicativeExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTMULTIPLICATIVEEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + UnaryExpression(); + label_33: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case STAR: + case SLASH: + case REM: + ; + break; + default: + break label_33; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case STAR: + jj_consume_token(STAR); + break; + case SLASH: + jj_consume_token(SLASH); + break; + case REM: + jj_consume_token(REM); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + UnaryExpression(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void UnaryExpression() throws ParseException { + /*@bgen(jjtree) UnaryExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTUNARYEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case PLUS: + case MINUS: + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case PLUS: + jj_consume_token(PLUS); + break; + case MINUS: + jj_consume_token(MINUS); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + UnaryExpression(); + break; + case INCR: + PreIncrementExpression(); + break; + case DECR: + PreDecrementExpression(); + break; + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FALSE: + case FLOAT: + case INT: + case LONG: + case NEW: + case NULL: + case SHORT: + case SUPER: + case THIS: + case TRUE: + case VOID: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case CHARACTER_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case BANG: + case TILDE: + UnaryExpressionNotPlusMinus(); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void PreIncrementExpression() throws ParseException { + /*@bgen(jjtree) PreIncrementExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTPREINCREMENTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(INCR); + PrimaryExpression(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void PreDecrementExpression() throws ParseException { + /*@bgen(jjtree) PreDecrementExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTPREDECREMENTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(DECR); + PrimaryExpression(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void UnaryExpressionNotPlusMinus() throws ParseException { + /*@bgen(jjtree) UnaryExpressionNotPlusMinus */ + SimpleNode jjtn000 = new SimpleNode(JJTUNARYEXPRESSIONNOTPLUSMINUS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case BANG: + case TILDE: + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case TILDE: + jj_consume_token(TILDE); + break; + case BANG: + jj_consume_token(BANG); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + UnaryExpression(); + break; + default: + if (jj_2_25(2147483647)) { + CastExpression(); + } else { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FALSE: + case FLOAT: + case INT: + case LONG: + case NEW: + case NULL: + case SHORT: + case SUPER: + case THIS: + case TRUE: + case VOID: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case CHARACTER_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + PostfixExpression(); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + +// This production is to determine lookahead only. The LOOKAHEAD specifications +// below are not used, but they are there just to indicate that we know about + + // this. + final public void CastLookahead() throws ParseException { + /*@bgen(jjtree) CastLookahead */ + SimpleNode jjtn000 = new SimpleNode(JJTCASTLOOKAHEAD); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + if (jj_2_26(2)) { + jj_consume_token(LPAREN); + PrimitiveType(); + } else if (jj_2_27(2147483647)) { + jj_consume_token(LPAREN); + Type(); + jj_consume_token(LBRACKET); + jj_consume_token(RBRACKET); + } else { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LPAREN: + jj_consume_token(LPAREN); + Type(); + jj_consume_token(RPAREN); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case TILDE: + jj_consume_token(TILDE); + break; + case BANG: + jj_consume_token(BANG); + break; + case LPAREN: + jj_consume_token(LPAREN); + break; + case IDENTIFIER: + jj_consume_token(IDENTIFIER); + break; + case THIS: + jj_consume_token(THIS); + break; + case SUPER: + jj_consume_token(SUPER); + break; + case NEW: + jj_consume_token(NEW); + break; + case FALSE: + case NULL: + case TRUE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case CHARACTER_LITERAL: + case STRING_LITERAL: + Literal(); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void PostfixExpression() throws ParseException { + /*@bgen(jjtree) PostfixExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTPOSTFIXEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + PrimaryExpression(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case INCR: + case DECR: + PostfixOperator(); + break; + default: + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void PostfixOperator() throws ParseException { + /*@bgen(jjtree) PostfixOperator */ + SimpleNode jjtn000 = new SimpleNode(JJTPOSTFIXOPERATOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case INCR: + jj_consume_token(INCR); + break; + case DECR: + jj_consume_token(DECR); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void CastExpression() throws ParseException { + /*@bgen(jjtree) CastExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTCASTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + if (jj_2_28(2147483647)) { + jj_consume_token(LPAREN); + Type(); + jj_consume_token(RPAREN); + UnaryExpression(); + } else { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LPAREN: + jj_consume_token(LPAREN); + Type(); + jj_consume_token(RPAREN); + UnaryExpressionNotPlusMinus(); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void PrimaryExpression() throws ParseException { + /*@bgen(jjtree) PrimaryExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTPRIMARYEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + PrimaryPrefix(); + label_34: + while (true) { + if (jj_2_29(2)) { + ; + } else { + break label_34; + } + PrimarySuffix(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void MemberSelector() throws ParseException { + /*@bgen(jjtree) MemberSelector */ + SimpleNode jjtn000 = new SimpleNode(JJTMEMBERSELECTOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(DOT); + TypeArguments(); + jj_consume_token(IDENTIFIER); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void PrimaryPrefix() throws ParseException { + /*@bgen(jjtree) PrimaryPrefix */ + SimpleNode jjtn000 = new SimpleNode(JJTPRIMARYPREFIX); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case FALSE: + case NULL: + case TRUE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case CHARACTER_LITERAL: + case STRING_LITERAL: + Literal(); + break; + default: + if (jj_2_30(2147483647)) { + label_35: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case IDENTIFIER: + ; + break; + default: + break label_35; + } + jj_consume_token(IDENTIFIER); + jj_consume_token(DOT); + } + jj_consume_token(THIS); + } else { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case SUPER: + jj_consume_token(SUPER); + jj_consume_token(DOT); + jj_consume_token(IDENTIFIER); + break; + case LPAREN: + jj_consume_token(LPAREN); + Expression(); + jj_consume_token(RPAREN); + break; + case NEW: + AllocationExpression(); + break; + default: + if (jj_2_31(2147483647)) { + ResultType(); + jj_consume_token(DOT); + jj_consume_token(CLASS); + } else { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case IDENTIFIER: + Name(); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } + } + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void PrimarySuffix() throws ParseException { + /*@bgen(jjtree) PrimarySuffix */ + SimpleNode jjtn000 = new SimpleNode(JJTPRIMARYSUFFIX); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + if (jj_2_32(2147483647)) { + jj_consume_token(DOT); + jj_consume_token(SUPER); + } else if (jj_2_33(2147483647)) { + jj_consume_token(DOT); + jj_consume_token(THIS); + } else if (jj_2_34(2)) { + jj_consume_token(DOT); + AllocationExpression(); + } else if (jj_2_35(3)) { + MemberSelector(); + } else { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LBRACKET: + jj_consume_token(LBRACKET); + Expression(); + jj_consume_token(RBRACKET); + break; + case DOT: + jj_consume_token(DOT); + jj_consume_token(IDENTIFIER); + break; + case LPAREN: + Arguments(); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Literal() throws ParseException { + /*@bgen(jjtree) Literal */ + SimpleNode jjtn000 = new SimpleNode(JJTLITERAL); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case INTEGER_LITERAL: + jj_consume_token(INTEGER_LITERAL); + break; + case FLOATING_POINT_LITERAL: + jj_consume_token(FLOATING_POINT_LITERAL); + break; + case CHARACTER_LITERAL: + jj_consume_token(CHARACTER_LITERAL); + break; + case STRING_LITERAL: + jj_consume_token(STRING_LITERAL); + break; + case FALSE: + case TRUE: + BooleanLiteral(); + break; + case NULL: + NullLiteral(); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void BooleanLiteral() throws ParseException { + /*@bgen(jjtree) BooleanLiteral */ + SimpleNode jjtn000 = new SimpleNode(JJTBOOLEANLITERAL); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case TRUE: + jj_consume_token(TRUE); + break; + case FALSE: + jj_consume_token(FALSE); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void NullLiteral() throws ParseException { + /*@bgen(jjtree) NullLiteral */ + SimpleNode jjtn000 = new SimpleNode(JJTNULLLITERAL); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(NULL); + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Arguments() throws ParseException { + /*@bgen(jjtree) Arguments */ + SimpleNode jjtn000 = new SimpleNode(JJTARGUMENTS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(LPAREN); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FALSE: + case FLOAT: + case INT: + case LONG: + case NEW: + case NULL: + case SHORT: + case SUPER: + case THIS: + case TRUE: + case VOID: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case CHARACTER_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case BANG: + case TILDE: + case INCR: + case DECR: + case PLUS: + case MINUS: + ArgumentList(); + break; + default: + ; + } + jj_consume_token(RPAREN); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ArgumentList() throws ParseException { + /*@bgen(jjtree) ArgumentList */ + SimpleNode jjtn000 = new SimpleNode(JJTARGUMENTLIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + Expression(); + label_36: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case COMMA: + ; + break; + default: + break label_36; + } + jj_consume_token(COMMA); + Expression(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void AllocationExpression() throws ParseException { + /*@bgen(jjtree) AllocationExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTALLOCATIONEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + if (jj_2_36(2)) { + jj_consume_token(NEW); + PrimitiveType(); + ArrayDimsAndInits(); + } else { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case NEW: + jj_consume_token(NEW); + ClassOrInterfaceType(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LT: + TypeArguments(); + break; + default: + ; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LBRACKET: + ArrayDimsAndInits(); + break; + case LPAREN: + Arguments(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LBRACE: + ClassOrInterfaceBody(false); + break; + default: + ; + } + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + /* + * The third LOOKAHEAD specification below is to parse to PrimarySuffix + * if there is an expression between the "[...]". + */ + final public void ArrayDimsAndInits() throws ParseException { + /*@bgen(jjtree) ArrayDimsAndInits */ + SimpleNode jjtn000 = new SimpleNode(JJTARRAYDIMSANDINITS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + if (jj_2_39(2)) { + label_37: + while (true) { + jj_consume_token(LBRACKET); + Expression(); + jj_consume_token(RBRACKET); + if (jj_2_37(2)) { + ; + } else { + break label_37; + } + } + label_38: + while (true) { + if (jj_2_38(2)) { + ; + } else { + break label_38; + } + jj_consume_token(LBRACKET); + jj_consume_token(RBRACKET); + } + } else { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LBRACKET: + label_39: + while (true) { + jj_consume_token(LBRACKET); + jj_consume_token(RBRACKET); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case LBRACKET: + ; + break; + default: + break label_39; + } + } + ArrayInitializer(); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + /* + * Statement syntax follows. + */ + final public void Statement() throws ParseException { + /*@bgen(jjtree) Statement */ + SimpleNode jjtn000 = new SimpleNode(JJTSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + if (jj_2_40(2)) { + LabeledStatement(); + } else { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case ASSERT: + AssertStatement(); + break; + case LBRACE: + Block(); + break; + case SEMICOLON: + EmptyStatement(); + break; + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FALSE: + case FLOAT: + case INT: + case LONG: + case NEW: + case NULL: + case SHORT: + case SUPER: + case THIS: + case TRUE: + case VOID: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case CHARACTER_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case INCR: + case DECR: + StatementExpression(); + jj_consume_token(SEMICOLON); + break; + case SWITCH: + SwitchStatement(); + break; + case IF: + IfStatement(); + break; + case WHILE: + WhileStatement(); + break; + case DO: + DoStatement(); + break; + case FOR: + ForStatement(); + break; + case BREAK: + BreakStatement(); + break; + case CONTINUE: + ContinueStatement(); + break; + case RETURN: + ReturnStatement(); + break; + case THROW: + ThrowStatement(); + break; + case SYNCHRONIZED: + SynchronizedStatement(); + break; + case TRY: + TryStatement(); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void AssertStatement() throws ParseException { + /*@bgen(jjtree) AssertStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTASSERTSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(ASSERT); + Expression(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case COLON: + jj_consume_token(COLON); + Expression(); + break; + default: + ; + } + jj_consume_token(SEMICOLON); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void LabeledStatement() throws ParseException { + /*@bgen(jjtree) LabeledStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTLABELEDSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(IDENTIFIER); + jj_consume_token(COLON); + Statement(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Block() throws ParseException { + /*@bgen(jjtree) Block */ + SimpleNode jjtn000 = new SimpleNode(JJTBLOCK); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(LBRACE); + label_40: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case ABSTRACT: + case ASSERT: + case BOOLEAN: + case BREAK: + case BYTE: + case CHAR: + case CLASS: + case CONTINUE: + case DO: + case DOUBLE: + case FALSE: + case FINAL: + case FLOAT: + case FOR: + case IF: + case INT: + case INTERFACE: + case LONG: + case NATIVE: + case NEW: + case NULL: + case PRIVATE: + case PROTECTED: + case PUBLIC: + case RETURN: + case SHORT: + case STATIC: + case STRICTFP: + case SUPER: + case SWITCH: + case SYNCHRONIZED: + case THIS: + case THROW: + case TRANSIENT: + case TRUE: + case TRY: + case VOID: + case VOLATILE: + case WHILE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case CHARACTER_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case LBRACE: + case SEMICOLON: + case AT: + case INCR: + case DECR: + ; + break; + default: + break label_40; + } + BlockStatement(); + } + jj_consume_token(RBRACE); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void BlockStatement() throws ParseException { + /*@bgen(jjtree) BlockStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTBLOCKSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + if (jj_2_41(2147483647)) { + LocalVariableDeclaration(); + jj_consume_token(SEMICOLON); + } else { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case ASSERT: + case BOOLEAN: + case BREAK: + case BYTE: + case CHAR: + case CONTINUE: + case DO: + case DOUBLE: + case FALSE: + case FLOAT: + case FOR: + case IF: + case INT: + case LONG: + case NEW: + case NULL: + case RETURN: + case SHORT: + case SUPER: + case SWITCH: + case SYNCHRONIZED: + case THIS: + case THROW: + case TRUE: + case TRY: + case VOID: + case WHILE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case CHARACTER_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case LBRACE: + case SEMICOLON: + case INCR: + case DECR: + Statement(); + break; + case CLASS: + case INTERFACE: + ClassOrInterfaceDeclaration(0); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void LocalVariableDeclaration() throws ParseException { + /*@bgen(jjtree) LocalVariableDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTLOCALVARIABLEDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + Modifiers(); + Type(); + VariableDeclarator(); + label_41: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case COMMA: + ; + break; + default: + break label_41; + } + jj_consume_token(COMMA); + VariableDeclarator(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void EmptyStatement() throws ParseException { + /*@bgen(jjtree) EmptyStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTEMPTYSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(SEMICOLON); + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void StatementExpression() throws ParseException { + /*@bgen(jjtree) StatementExpression */ + SimpleNode jjtn000 = new SimpleNode(JJTSTATEMENTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case INCR: + PreIncrementExpression(); + break; + case DECR: + PreDecrementExpression(); + break; + default: + if (jj_2_42(2147483647)) { + AssignmentExpression(); + } else { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FALSE: + case FLOAT: + case INT: + case LONG: + case NEW: + case NULL: + case SHORT: + case SUPER: + case THIS: + case TRUE: + case VOID: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case CHARACTER_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + PostfixExpression(); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void SwitchStatement() throws ParseException { + /*@bgen(jjtree) SwitchStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTSWITCHSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(SWITCH); + jj_consume_token(LPAREN); + Expression(); + jj_consume_token(RPAREN); + jj_consume_token(LBRACE); + label_42: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case CASE: + case _DEFAULT: + ; + break; + default: + break label_42; + } + SwitchLabel(); + label_43: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case ABSTRACT: + case ASSERT: + case BOOLEAN: + case BREAK: + case BYTE: + case CHAR: + case CLASS: + case CONTINUE: + case DO: + case DOUBLE: + case FALSE: + case FINAL: + case FLOAT: + case FOR: + case IF: + case INT: + case INTERFACE: + case LONG: + case NATIVE: + case NEW: + case NULL: + case PRIVATE: + case PROTECTED: + case PUBLIC: + case RETURN: + case SHORT: + case STATIC: + case STRICTFP: + case SUPER: + case SWITCH: + case SYNCHRONIZED: + case THIS: + case THROW: + case TRANSIENT: + case TRUE: + case TRY: + case VOID: + case VOLATILE: + case WHILE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case CHARACTER_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case LBRACE: + case SEMICOLON: + case AT: + case INCR: + case DECR: + ; + break; + default: + break label_43; + } + BlockStatement(); + } + } + jj_consume_token(RBRACE); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void SwitchLabel() throws ParseException { + /*@bgen(jjtree) SwitchLabel */ + SimpleNode jjtn000 = new SimpleNode(JJTSWITCHLABEL); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case CASE: + jj_consume_token(CASE); + Expression(); + jj_consume_token(COLON); + break; + case _DEFAULT: + jj_consume_token(_DEFAULT); + jj_consume_token(COLON); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void IfStatement() throws ParseException { + /*@bgen(jjtree) IfStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTIFSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(IF); + jj_consume_token(LPAREN); + Expression(); + jj_consume_token(RPAREN); + Statement(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case ELSE: + jj_consume_token(ELSE); + Statement(); + break; + default: + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void WhileStatement() throws ParseException { + /*@bgen(jjtree) WhileStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTWHILESTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(WHILE); + jj_consume_token(LPAREN); + Expression(); + jj_consume_token(RPAREN); + Statement(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void DoStatement() throws ParseException { + /*@bgen(jjtree) DoStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTDOSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(DO); + Statement(); + jj_consume_token(WHILE); + jj_consume_token(LPAREN); + Expression(); + jj_consume_token(RPAREN); + jj_consume_token(SEMICOLON); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ForStatement() throws ParseException { + /*@bgen(jjtree) ForStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTFORSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(FOR); + jj_consume_token(LPAREN); + if (jj_2_43(2147483647)) { + Modifiers(); + Type(); + jj_consume_token(IDENTIFIER); + jj_consume_token(COLON); + Expression(); + } else { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case ABSTRACT: + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FALSE: + case FINAL: + case FLOAT: + case INT: + case LONG: + case NATIVE: + case NEW: + case NULL: + case PRIVATE: + case PROTECTED: + case PUBLIC: + case SHORT: + case STATIC: + case STRICTFP: + case SUPER: + case SYNCHRONIZED: + case THIS: + case TRANSIENT: + case TRUE: + case VOID: + case VOLATILE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case CHARACTER_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case SEMICOLON: + case AT: + case INCR: + case DECR: + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case ABSTRACT: + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FALSE: + case FINAL: + case FLOAT: + case INT: + case LONG: + case NATIVE: + case NEW: + case NULL: + case PRIVATE: + case PROTECTED: + case PUBLIC: + case SHORT: + case STATIC: + case STRICTFP: + case SUPER: + case SYNCHRONIZED: + case THIS: + case TRANSIENT: + case TRUE: + case VOID: + case VOLATILE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case CHARACTER_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case AT: + case INCR: + case DECR: + ForInit(); + break; + default: + ; + } + jj_consume_token(SEMICOLON); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FALSE: + case FLOAT: + case INT: + case LONG: + case NEW: + case NULL: + case SHORT: + case SUPER: + case THIS: + case TRUE: + case VOID: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case CHARACTER_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case BANG: + case TILDE: + case INCR: + case DECR: + case PLUS: + case MINUS: + Expression(); + break; + default: + ; + } + jj_consume_token(SEMICOLON); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FALSE: + case FLOAT: + case INT: + case LONG: + case NEW: + case NULL: + case SHORT: + case SUPER: + case THIS: + case TRUE: + case VOID: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case CHARACTER_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case INCR: + case DECR: + ForUpdate(); + break; + default: + ; + } + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } + jj_consume_token(RPAREN); + Statement(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ForInit() throws ParseException { + /*@bgen(jjtree) ForInit */ + SimpleNode jjtn000 = new SimpleNode(JJTFORINIT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + if (jj_2_44(2147483647)) { + LocalVariableDeclaration(); + } else { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FALSE: + case FLOAT: + case INT: + case LONG: + case NEW: + case NULL: + case SHORT: + case SUPER: + case THIS: + case TRUE: + case VOID: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case CHARACTER_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case INCR: + case DECR: + StatementExpressionList(); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void StatementExpressionList() throws ParseException { + /*@bgen(jjtree) StatementExpressionList */ + SimpleNode jjtn000 = new SimpleNode(JJTSTATEMENTEXPRESSIONLIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + StatementExpression(); + label_44: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case COMMA: + ; + break; + default: + break label_44; + } + jj_consume_token(COMMA); + StatementExpression(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ForUpdate() throws ParseException { + /*@bgen(jjtree) ForUpdate */ + SimpleNode jjtn000 = new SimpleNode(JJTFORUPDATE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + StatementExpressionList(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void BreakStatement() throws ParseException { + /*@bgen(jjtree) BreakStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTBREAKSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(BREAK); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case IDENTIFIER: + jj_consume_token(IDENTIFIER); + break; + default: + ; + } + jj_consume_token(SEMICOLON); + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ContinueStatement() throws ParseException { + /*@bgen(jjtree) ContinueStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTCONTINUESTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(CONTINUE); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case IDENTIFIER: + jj_consume_token(IDENTIFIER); + break; + default: + ; + } + jj_consume_token(SEMICOLON); + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ReturnStatement() throws ParseException { + /*@bgen(jjtree) ReturnStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTRETURNSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(RETURN); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FALSE: + case FLOAT: + case INT: + case LONG: + case NEW: + case NULL: + case SHORT: + case SUPER: + case THIS: + case TRUE: + case VOID: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case CHARACTER_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case BANG: + case TILDE: + case INCR: + case DECR: + case PLUS: + case MINUS: + Expression(); + break; + default: + ; + } + jj_consume_token(SEMICOLON); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void ThrowStatement() throws ParseException { + /*@bgen(jjtree) ThrowStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTTHROWSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(THROW); + Expression(); + jj_consume_token(SEMICOLON); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void SynchronizedStatement() throws ParseException { + /*@bgen(jjtree) SynchronizedStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTSYNCHRONIZEDSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(SYNCHRONIZED); + jj_consume_token(LPAREN); + Expression(); + jj_consume_token(RPAREN); + Block(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void TryStatement() throws ParseException { + /*@bgen(jjtree) TryStatement */ + SimpleNode jjtn000 = new SimpleNode(JJTTRYSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(TRY); + Block(); + label_45: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case CATCH: + ; + break; + default: + break label_45; + } + jj_consume_token(CATCH); + jj_consume_token(LPAREN); + FormalParameter(); + jj_consume_token(RPAREN); + Block(); + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case FINALLY: + jj_consume_token(FINALLY); + Block(); + break; + default: + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + /* We use productions to match >>>, >> and > so that we can keep the + * type declaration syntax with generics clean + */ + final public void RUNSIGNEDSHIFT() throws ParseException { + /*@bgen(jjtree) RUNSIGNEDSHIFT */ + SimpleNode jjtn000 = new SimpleNode(JJTRUNSIGNEDSHIFT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + if (getToken(1).kind == GT && + ((Token.GTToken) getToken(1)).realKind == RUNSIGNEDSHIFT) { + + } else { + jj_consume_token(-1); + throw new ParseException(); + } + jj_consume_token(GT); + jj_consume_token(GT); + jj_consume_token(GT); + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void RSIGNEDSHIFT() throws ParseException { + /*@bgen(jjtree) RSIGNEDSHIFT */ + SimpleNode jjtn000 = new SimpleNode(JJTRSIGNEDSHIFT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + if (getToken(1).kind == GT && + ((Token.GTToken) getToken(1)).realKind == RSIGNEDSHIFT) { + + } else { + jj_consume_token(-1); + throw new ParseException(); + } + jj_consume_token(GT); + jj_consume_token(GT); + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + /* Annotation syntax follows. */ + final public void Annotation() throws ParseException { + /*@bgen(jjtree) Annotation */ + SimpleNode jjtn000 = new SimpleNode(JJTANNOTATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + if (jj_2_45(2147483647)) { + NormalAnnotation(); + } else if (jj_2_46(2147483647)) { + SingleMemberAnnotation(); + } else { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case AT: + MarkerAnnotation(); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void NormalAnnotation() throws ParseException { + /*@bgen(jjtree) NormalAnnotation */ + SimpleNode jjtn000 = new SimpleNode(JJTNORMALANNOTATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(AT); + Name(); + jj_consume_token(LPAREN); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case IDENTIFIER: + MemberValuePairs(); + break; + default: + ; + } + jj_consume_token(RPAREN); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void MarkerAnnotation() throws ParseException { + /*@bgen(jjtree) MarkerAnnotation */ + SimpleNode jjtn000 = new SimpleNode(JJTMARKERANNOTATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(AT); + Name(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void SingleMemberAnnotation() throws ParseException { + /*@bgen(jjtree) SingleMemberAnnotation */ + SimpleNode jjtn000 = new SimpleNode(JJTSINGLEMEMBERANNOTATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(AT); + Name(); + jj_consume_token(LPAREN); + MemberValue(); + jj_consume_token(RPAREN); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void MemberValuePairs() throws ParseException { + /*@bgen(jjtree) MemberValuePairs */ + SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUEPAIRS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + MemberValuePair(); + label_46: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case COMMA: + ; + break; + default: + break label_46; + } + jj_consume_token(COMMA); + MemberValuePair(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void MemberValuePair() throws ParseException { + /*@bgen(jjtree) MemberValuePair */ + SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUEPAIR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(IDENTIFIER); + jj_consume_token(ASSIGN); + MemberValue(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void MemberValue() throws ParseException { + /*@bgen(jjtree) MemberValue */ + SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case AT: + Annotation(); + break; + case LBRACE: + MemberValueArrayInitializer(); + break; + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FALSE: + case FLOAT: + case INT: + case LONG: + case NEW: + case NULL: + case SHORT: + case SUPER: + case THIS: + case TRUE: + case VOID: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case CHARACTER_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case BANG: + case TILDE: + case INCR: + case DECR: + case PLUS: + case MINUS: + ConditionalExpression(); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void MemberValueArrayInitializer() throws ParseException { + /*@bgen(jjtree) MemberValueArrayInitializer */ + SimpleNode jjtn000 = new SimpleNode(JJTMEMBERVALUEARRAYINITIALIZER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(LBRACE); + MemberValue(); + label_47: + while (true) { + if (jj_2_47(2)) { + ; + } else { + break label_47; + } + jj_consume_token(COMMA); + MemberValue(); + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case COMMA: + jj_consume_token(COMMA); + break; + default: + ; + } + jj_consume_token(RBRACE); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + /* Annotation Types. */ + final public void AnnotationTypeDeclaration(int modifiers) throws ParseException { + /*@bgen(jjtree) AnnotationTypeDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTANNOTATIONTYPEDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(AT); + jj_consume_token(INTERFACE); + jj_consume_token(IDENTIFIER); + AnnotationTypeBody(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void AnnotationTypeBody() throws ParseException { + /*@bgen(jjtree) AnnotationTypeBody */ + SimpleNode jjtn000 = new SimpleNode(JJTANNOTATIONTYPEBODY); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(LBRACE); + label_48: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case ABSTRACT: + case BOOLEAN: + case BYTE: + case CHAR: + case CLASS: + case DOUBLE: + case ENUM: + case FINAL: + case FLOAT: + case INT: + case INTERFACE: + case LONG: + case NATIVE: + case PRIVATE: + case PROTECTED: + case PUBLIC: + case SHORT: + case STATIC: + case STRICTFP: + case SYNCHRONIZED: + case TRANSIENT: + case VOLATILE: + case IDENTIFIER: + case SEMICOLON: + case AT: + ; + break; + default: + break label_48; + } + AnnotationTypeMemberDeclaration(); + } + jj_consume_token(RBRACE); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void AnnotationTypeMemberDeclaration() throws ParseException { + /*@bgen(jjtree) AnnotationTypeMemberDeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTANNOTATIONTYPEMEMBERDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + int modifiers; + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case ABSTRACT: + case BOOLEAN: + case BYTE: + case CHAR: + case CLASS: + case DOUBLE: + case ENUM: + case FINAL: + case FLOAT: + case INT: + case INTERFACE: + case LONG: + case NATIVE: + case PRIVATE: + case PROTECTED: + case PUBLIC: + case SHORT: + case STATIC: + case STRICTFP: + case SYNCHRONIZED: + case TRANSIENT: + case VOLATILE: + case IDENTIFIER: + case AT: + modifiers = Modifiers(); + if (jj_2_48(2147483647)) { + Type(); + jj_consume_token(IDENTIFIER); + jj_consume_token(LPAREN); + jj_consume_token(RPAREN); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case _DEFAULT: + DefaultValue(); + break; + default: + ; + } + jj_consume_token(SEMICOLON); + } else { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case CLASS: + case INTERFACE: + ClassOrInterfaceDeclaration(modifiers); + break; + case ENUM: + EnumDeclaration(modifiers); + break; + case AT: + AnnotationTypeDeclaration(modifiers); + break; + case BOOLEAN: + case BYTE: + case CHAR: + case DOUBLE: + case FLOAT: + case INT: + case LONG: + case SHORT: + case IDENTIFIER: + FieldDeclaration(modifiers); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } + break; + case SEMICOLON: + jj_consume_token(SEMICOLON); + break; + default: + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void DefaultValue() throws ParseException { + /*@bgen(jjtree) DefaultValue */ + SimpleNode jjtn000 = new SimpleNode(JJTDEFAULTVALUE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(_DEFAULT); + MemberValue(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final private boolean jj_2_1(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_1(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_2(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_2(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_3(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_3(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_4(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_4(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_5(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_5(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_6(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_6(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_7(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_7(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_8(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_8(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_9(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_9(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_10(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_10(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_11(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_11(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_12(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_12(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_13(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_13(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_14(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_14(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_15(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_15(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_16(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_16(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_17(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_17(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_18(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_18(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_19(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_19(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_20(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_20(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_21(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_21(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_22(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_22(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_23(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_23(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_24(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_24(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_25(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_25(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_26(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_26(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_27(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_27(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_28(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_28(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_29(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_29(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_30(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_30(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_31(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_31(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_32(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_32(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_33(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_33(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_34(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_34(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_35(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_35(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_36(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_36(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_37(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_37(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_38(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_38(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_39(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_39(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_40(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_40(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_41(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_41(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_42(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_42(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_43(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_43(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_44(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_44(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_45(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_45(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_46(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_46(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_47(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_47(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_2_48(int xla) { + jj_la = xla; + jj_lastpos = jj_scanpos = token; + try { + return !jj_3_48(); + } + catch (LookaheadSuccess ls) { + return true; + } + } + + final private boolean jj_3R_56() { + if (jj_3R_101()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3_21()) jj_scanpos = xsp; + return false; + } + + final private boolean jj_3R_135() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_91()) return true; + return false; + } + + final private boolean jj_3R_99() { + if (jj_3R_91()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_135()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3_20() { + if (jj_scan_token(DOT)) return true; + if (jj_scan_token(IDENTIFIER)) return true; + return false; + } + + final private boolean jj_3R_91() { + if (jj_scan_token(IDENTIFIER)) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3_20()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_122() { + if (jj_3R_72()) return true; + return false; + } + + final private boolean jj_3R_86() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(58)) { + jj_scanpos = xsp; + if (jj_3R_122()) return true; + } + return false; + } + + final private boolean jj_3_19() { + if (jj_3R_78()) return true; + return false; + } + + final private boolean jj_3R_83() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(10)) { + jj_scanpos = xsp; + if (jj_scan_token(15)) { + jj_scanpos = xsp; + if (jj_scan_token(12)) { + jj_scanpos = xsp; + if (jj_scan_token(46)) { + jj_scanpos = xsp; + if (jj_scan_token(35)) { + jj_scanpos = xsp; + if (jj_scan_token(37)) { + jj_scanpos = xsp; + if (jj_scan_token(28)) { + jj_scanpos = xsp; + if (jj_scan_token(21)) return true; + } + } + } + } + } + } + } + return false; + } + + final private boolean jj_3R_194() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_112()) return true; + return false; + } + + final private boolean jj_3R_290() { + if (jj_scan_token(SUPER)) return true; + if (jj_3R_77()) return true; + return false; + } + + final private boolean jj_3_16() { + if (jj_scan_token(LBRACKET)) return true; + if (jj_scan_token(RBRACKET)) return true; + return false; + } + + final private boolean jj_3R_289() { + if (jj_scan_token(EXTENDS)) return true; + if (jj_3R_77()) return true; + return false; + } + + final private boolean jj_3R_277() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_289()) { + jj_scanpos = xsp; + if (jj_3R_290()) return true; + } + return false; + } + + final private boolean jj_3R_256() { + if (jj_3R_277()) return true; + return false; + } + + final private boolean jj_3R_151() { + if (jj_scan_token(HOOK)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_256()) jj_scanpos = xsp; + return false; + } + + final private boolean jj_3_17() { + if (jj_3R_78()) return true; + return false; + } + + final private boolean jj_3R_112() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_150()) { + jj_scanpos = xsp; + if (jj_3R_151()) return true; + } + return false; + } + + final private boolean jj_3R_150() { + if (jj_3R_77()) return true; + return false; + } + + final private boolean jj_3_15() { + if (jj_scan_token(LBRACKET)) return true; + if (jj_scan_token(RBRACKET)) return true; + return false; + } + + final private boolean jj_3R_78() { + if (jj_scan_token(LT)) return true; + if (jj_3R_112()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_194()) { + jj_scanpos = xsp; + break; + } + } + if (jj_scan_token(GT)) return true; + return false; + } + + final private boolean jj_3_18() { + if (jj_scan_token(DOT)) return true; + if (jj_scan_token(IDENTIFIER)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3_19()) jj_scanpos = xsp; + return false; + } + + final private boolean jj_3R_149() { + if (jj_scan_token(IDENTIFIER)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3_17()) jj_scanpos = xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3_18()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_111() { + if (jj_3R_149()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3_16()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_110() { + if (jj_3R_83()) return true; + Token xsp; + if (jj_3_15()) return true; + while (true) { + xsp = jj_scanpos; + if (jj_3_15()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_77() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_110()) { + jj_scanpos = xsp; + if (jj_3R_111()) return true; + } + return false; + } + + final private boolean jj_3_13() { + if (jj_scan_token(THIS)) return true; + if (jj_scan_token(DOT)) return true; + return false; + } + + final private boolean jj_3R_221() { + if (jj_scan_token(THROWS)) return true; + if (jj_3R_99()) return true; + return false; + } + + final private boolean jj_3R_103() { + if (jj_3R_83()) return true; + return false; + } + + final private boolean jj_3R_72() { + Token xsp; + xsp = jj_scanpos; + if (jj_3_14()) { + jj_scanpos = xsp; + if (jj_3R_103()) return true; + } + return false; + } + + final private boolean jj_3_14() { + if (jj_3R_77()) return true; + return false; + } + + final private boolean jj_3R_74() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(47)) jj_scanpos = xsp; + if (jj_3R_104()) return true; + return false; + } + + final private boolean jj_3_12() { + if (jj_3R_76()) return true; + return false; + } + + final private boolean jj_3R_108() { + if (jj_3R_78()) return true; + return false; + } + + final private boolean jj_3R_107() { + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_scan_token(DOT)) return true; + return false; + } + + final private boolean jj_3R_252() { + if (jj_scan_token(LBRACKET)) return true; + if (jj_scan_token(RBRACKET)) return true; + return false; + } + + final private boolean jj_3R_76() { + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_107()) { + jj_scanpos = xsp; + break; + } + } + xsp = jj_scanpos; + if (jj_3_13()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_108()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_scan_token(52)) { + jj_scanpos = xsp; + if (jj_scan_token(49)) return true; + } + if (jj_3R_109()) return true; + if (jj_scan_token(SEMICOLON)) return true; + return false; + } + + final private boolean jj_3R_134() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_133()) return true; + return false; + } + + final private boolean jj_3R_223() { + if (jj_3R_49()) return true; + return false; + } + + final private boolean jj_3R_222() { + if (jj_3R_76()) return true; + return false; + } + + final private boolean jj_3R_220() { + if (jj_3R_97()) return true; + return false; + } + + final private boolean jj_3R_186() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_220()) jj_scanpos = xsp; + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_3R_53()) return true; + xsp = jj_scanpos; + if (jj_3R_221()) jj_scanpos = xsp; + if (jj_scan_token(LBRACE)) return true; + xsp = jj_scanpos; + if (jj_3R_222()) jj_scanpos = xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_223()) { + jj_scanpos = xsp; + break; + } + } + if (jj_scan_token(RBRACE)) return true; + return false; + } + + final private boolean jj_3_11() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_75()) return true; + return false; + } + + final private boolean jj_3R_227() { + if (jj_scan_token(THROWS)) return true; + if (jj_3R_99()) return true; + return false; + } + + final private boolean jj_3R_98() { + if (jj_3R_133()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_134()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_133() { + if (jj_3R_50()) return true; + if (jj_3R_72()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(119)) jj_scanpos = xsp; + if (jj_3R_184()) return true; + return false; + } + + final private boolean jj_3R_53() { + if (jj_scan_token(LPAREN)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_98()) jj_scanpos = xsp; + if (jj_scan_token(RPAREN)) return true; + return false; + } + + final private boolean jj_3_48() { + if (jj_3R_72()) return true; + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + final private boolean jj_3R_226() { + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_3R_53()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_252()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_228() { + if (jj_3R_104()) return true; + return false; + } + + final private boolean jj_3R_225() { + if (jj_3R_97()) return true; + return false; + } + + final private boolean jj_3R_292() { + if (jj_3R_75()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3_11()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_188() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_225()) jj_scanpos = xsp; + if (jj_3R_86()) return true; + if (jj_3R_226()) return true; + xsp = jj_scanpos; + if (jj_3R_227()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_228()) { + jj_scanpos = xsp; + if (jj_scan_token(81)) return true; + } + return false; + } + + final private boolean jj_3R_198() { + if (jj_scan_token(ASSIGN)) return true; + if (jj_3R_75()) return true; + return false; + } + + final private boolean jj_3R_224() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_161()) return true; + return false; + } + + final private boolean jj_3_47() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_93()) return true; + return false; + } + + final private boolean jj_3R_217() { + if (jj_scan_token(LBRACKET)) return true; + if (jj_scan_token(RBRACKET)) return true; + return false; + } + + final private boolean jj_3R_147() { + if (jj_scan_token(LBRACE)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_292()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_scan_token(82)) jj_scanpos = xsp; + if (jj_scan_token(RBRACE)) return true; + return false; + } + + final private boolean jj_3R_73() { + if (jj_scan_token(LBRACKET)) return true; + if (jj_scan_token(RBRACKET)) return true; + return false; + } + + final private boolean jj_3R_106() { + if (jj_3R_56()) return true; + return false; + } + + final private boolean jj_3R_105() { + if (jj_3R_147()) return true; + return false; + } + + final private boolean jj_3R_75() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_105()) { + jj_scanpos = xsp; + if (jj_3R_106()) return true; + } + return false; + } + + final private boolean jj_3R_184() { + if (jj_scan_token(IDENTIFIER)) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_217()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_160() { + if (jj_scan_token(LBRACE)) return true; + if (jj_3R_93()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3_47()) { + jj_scanpos = xsp; + break; + } + } + xsp = jj_scanpos; + if (jj_scan_token(82)) jj_scanpos = xsp; + if (jj_scan_token(RBRACE)) return true; + return false; + } + + final private boolean jj_3R_276() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_275()) return true; + return false; + } + + final private boolean jj_3R_161() { + if (jj_3R_184()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_198()) jj_scanpos = xsp; + return false; + } + + final private boolean jj_3R_127() { + if (jj_3R_101()) return true; + return false; + } + + final private boolean jj_3_9() { + if (jj_3R_72()) return true; + if (jj_scan_token(IDENTIFIER)) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_73()) { + jj_scanpos = xsp; + break; + } + } + xsp = jj_scanpos; + if (jj_scan_token(82)) { + jj_scanpos = xsp; + if (jj_scan_token(85)) { + jj_scanpos = xsp; + if (jj_scan_token(81)) return true; + } + } + return false; + } + + final private boolean jj_3R_126() { + if (jj_3R_160()) return true; + return false; + } + + final private boolean jj_3R_71() { + if (jj_3R_97()) return true; + return false; + } + + final private boolean jj_3R_93() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_125()) { + jj_scanpos = xsp; + if (jj_3R_126()) { + jj_scanpos = xsp; + if (jj_3R_127()) return true; + } + } + return false; + } + + final private boolean jj_3R_125() { + if (jj_3R_102()) return true; + return false; + } + + final private boolean jj_3_8() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_71()) jj_scanpos = xsp; + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + final private boolean jj_3R_187() { + if (jj_3R_72()) return true; + if (jj_3R_161()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_224()) { + jj_scanpos = xsp; + break; + } + } + if (jj_scan_token(SEMICOLON)) return true; + return false; + } + + final private boolean jj_3R_275() { + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_scan_token(ASSIGN)) return true; + if (jj_3R_93()) return true; + return false; + } + + final private boolean jj_3R_140() { + if (jj_3R_188()) return true; + return false; + } + + final private boolean jj_3R_139() { + if (jj_3R_187()) return true; + return false; + } + + final private boolean jj_3R_249() { + if (jj_scan_token(BIT_AND)) return true; + if (jj_3R_149()) return true; + return false; + } + + final private boolean jj_3R_138() { + if (jj_3R_186()) return true; + return false; + } + + final private boolean jj_3R_255() { + if (jj_3R_275()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_276()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_231() { + if (jj_3R_255()) return true; + return false; + } + + final private boolean jj_3R_137() { + if (jj_3R_185()) return true; + return false; + } + + final private boolean jj_3R_92() { + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_scan_token(ASSIGN)) return true; + return false; + } + + final private boolean jj_3R_136() { + if (jj_3R_130()) return true; + return false; + } + + final private boolean jj_3R_192() { + if (jj_scan_token(AT)) return true; + if (jj_3R_91()) return true; + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_93()) return true; + if (jj_scan_token(RPAREN)) return true; + return false; + } + + final private boolean jj_3R_286() { + if (jj_3R_182()) return true; + return false; + } + + final private boolean jj_3R_100() { + if (jj_3R_50()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_136()) { + jj_scanpos = xsp; + if (jj_3R_137()) { + jj_scanpos = xsp; + if (jj_3R_138()) { + jj_scanpos = xsp; + if (jj_3R_139()) { + jj_scanpos = xsp; + if (jj_3R_140()) return true; + } + } + } + } + return false; + } + + final private boolean jj_3R_193() { + if (jj_scan_token(AT)) return true; + if (jj_3R_91()) return true; + return false; + } + + final private boolean jj_3_46() { + if (jj_scan_token(AT)) return true; + if (jj_3R_91()) return true; + if (jj_scan_token(LPAREN)) return true; + return false; + } + + final private boolean jj_3_10() { + if (jj_3R_74()) return true; + return false; + } + + final private boolean jj_3R_55() { + Token xsp; + xsp = jj_scanpos; + if (jj_3_10()) { + jj_scanpos = xsp; + if (jj_3R_100()) { + jj_scanpos = xsp; + if (jj_scan_token(81)) return true; + } + } + return false; + } + + final private boolean jj_3R_191() { + if (jj_scan_token(AT)) return true; + if (jj_3R_91()) return true; + if (jj_scan_token(LPAREN)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_231()) jj_scanpos = xsp; + if (jj_scan_token(RPAREN)) return true; + return false; + } + + final private boolean jj_3_45() { + if (jj_scan_token(AT)) return true; + if (jj_3R_91()) return true; + if (jj_scan_token(LPAREN)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_92()) { + jj_scanpos = xsp; + if (jj_scan_token(76)) return true; + } + return false; + } + + final private boolean jj_3R_215() { + if (jj_3R_55()) return true; + return false; + } + + final private boolean jj_3R_132() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_131()) return true; + return false; + } + + final private boolean jj_3R_183() { + if (jj_3R_216()) return true; + return false; + } + + final private boolean jj_3R_285() { + if (jj_3R_109()) return true; + return false; + } + + final private boolean jj_3R_145() { + if (jj_3R_193()) return true; + return false; + } + + final private boolean jj_3R_182() { + if (jj_scan_token(LBRACE)) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_215()) { + jj_scanpos = xsp; + break; + } + } + if (jj_scan_token(RBRACE)) return true; + return false; + } + + final private boolean jj_3R_144() { + if (jj_3R_192()) return true; + return false; + } + + final private boolean jj_3R_113() { + return false; + } + + final private boolean jj_3R_102() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_143()) { + jj_scanpos = xsp; + if (jj_3R_144()) { + jj_scanpos = xsp; + if (jj_3R_145()) return true; + } + } + return false; + } + + final private boolean jj_3R_143() { + if (jj_3R_191()) return true; + return false; + } + + final private boolean jj_3R_216() { + if (jj_scan_token(EXTENDS)) return true; + if (jj_3R_149()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_249()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_131() { + if (jj_scan_token(IDENTIFIER)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_183()) jj_scanpos = xsp; + return false; + } + + final private boolean jj_3R_114() { + return false; + } + + final private boolean jj_3_7() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_70()) return true; + return false; + } + + final private boolean jj_3R_80() { + Token xsp; + xsp = jj_scanpos; + lookingAhead = true; + jj_semLA = getToken(1).kind == GT && + ((Token.GTToken) getToken(1)).realKind == RSIGNEDSHIFT; + lookingAhead = false; + if (!jj_semLA || jj_3R_113()) return true; + if (jj_scan_token(GT)) return true; + if (jj_scan_token(GT)) return true; + return false; + } + + final private boolean jj_3R_97() { + if (jj_scan_token(LT)) return true; + if (jj_3R_131()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_132()) { + jj_scanpos = xsp; + break; + } + } + if (jj_scan_token(GT)) return true; + return false; + } + + final private boolean jj_3R_272() { + if (jj_3R_55()) return true; + return false; + } + + final private boolean jj_3R_70() { + if (jj_3R_50()) return true; + if (jj_scan_token(IDENTIFIER)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_285()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_286()) jj_scanpos = xsp; + return false; + } + + final private boolean jj_3R_81() { + Token xsp; + xsp = jj_scanpos; + lookingAhead = true; + jj_semLA = getToken(1).kind == GT && + ((Token.GTToken) getToken(1)).realKind == RUNSIGNEDSHIFT; + lookingAhead = false; + if (!jj_semLA || jj_3R_114()) return true; + if (jj_scan_token(GT)) return true; + if (jj_scan_token(GT)) return true; + if (jj_scan_token(GT)) return true; + return false; + } + + final private boolean jj_3R_251() { + if (jj_scan_token(SEMICOLON)) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_272()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_250() { + if (jj_3R_70()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3_7()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_246() { + if (jj_scan_token(FINALLY)) return true; + if (jj_3R_104()) return true; + return false; + } + + final private boolean jj_3R_219() { + if (jj_scan_token(LBRACE)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_250()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_scan_token(82)) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_251()) jj_scanpos = xsp; + if (jj_scan_token(RBRACE)) return true; + return false; + } + + final private boolean jj_3R_245() { + if (jj_scan_token(CATCH)) return true; + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_133()) return true; + if (jj_scan_token(RPAREN)) return true; + if (jj_3R_104()) return true; + return false; + } + + final private boolean jj_3R_212() { + if (jj_scan_token(TRY)) return true; + if (jj_3R_104()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_245()) { + jj_scanpos = xsp; + break; + } + } + xsp = jj_scanpos; + if (jj_3R_246()) jj_scanpos = xsp; + return false; + } + + final private boolean jj_3R_218() { + if (jj_3R_214()) return true; + return false; + } + + final private boolean jj_3R_185() { + if (jj_scan_token(ENUM)) return true; + if (jj_scan_token(IDENTIFIER)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_218()) jj_scanpos = xsp; + if (jj_3R_219()) return true; + return false; + } + + final private boolean jj_3R_211() { + if (jj_scan_token(SYNCHRONIZED)) return true; + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_56()) return true; + if (jj_scan_token(RPAREN)) return true; + if (jj_3R_104()) return true; + return false; + } + + final private boolean jj_3R_244() { + if (jj_3R_56()) return true; + return false; + } + + final private boolean jj_3R_248() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_149()) return true; + return false; + } + + final private boolean jj_3R_214() { + if (jj_scan_token(IMPLEMENTS)) return true; + if (jj_3R_149()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_248()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_210() { + if (jj_scan_token(THROW)) return true; + if (jj_3R_56()) return true; + if (jj_scan_token(SEMICOLON)) return true; + return false; + } + + final private boolean jj_3R_271() { + if (jj_3R_284()) return true; + return false; + } + + final private boolean jj_3R_299() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_201()) return true; + return false; + } + + final private boolean jj_3R_209() { + if (jj_scan_token(RETURN)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_244()) jj_scanpos = xsp; + if (jj_scan_token(SEMICOLON)) return true; + return false; + } + + final private boolean jj_3R_247() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_149()) return true; + return false; + } + + final private boolean jj_3R_213() { + if (jj_scan_token(EXTENDS)) return true; + if (jj_3R_149()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_247()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_208() { + if (jj_scan_token(CONTINUE)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(72)) jj_scanpos = xsp; + if (jj_scan_token(SEMICOLON)) return true; + return false; + } + + final private boolean jj_3R_178() { + if (jj_scan_token(INTERFACE)) return true; + return false; + } + + final private boolean jj_3R_207() { + if (jj_scan_token(BREAK)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(72)) jj_scanpos = xsp; + if (jj_scan_token(SEMICOLON)) return true; + return false; + } + + final private boolean jj_3R_181() { + if (jj_3R_214()) return true; + return false; + } + + final private boolean jj_3R_180() { + if (jj_3R_213()) return true; + return false; + } + + final private boolean jj_3R_179() { + if (jj_3R_97()) return true; + return false; + } + + final private boolean jj_3R_284() { + if (jj_3R_296()) return true; + return false; + } + + final private boolean jj_3R_270() { + if (jj_3R_56()) return true; + return false; + } + + final private boolean jj_3R_130() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(16)) { + jj_scanpos = xsp; + if (jj_3R_178()) return true; + } + if (jj_scan_token(IDENTIFIER)) return true; + xsp = jj_scanpos; + if (jj_3R_179()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_180()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_181()) jj_scanpos = xsp; + if (jj_3R_182()) return true; + return false; + } + + final private boolean jj_3_44() { + if (jj_3R_50()) return true; + if (jj_3R_72()) return true; + if (jj_scan_token(IDENTIFIER)) return true; + return false; + } + + final private boolean jj_3R_296() { + if (jj_3R_201()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_299()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_241() { + if (jj_scan_token(ELSE)) return true; + if (jj_3R_129()) return true; + return false; + } + + final private boolean jj_3R_295() { + if (jj_3R_296()) return true; + return false; + } + + final private boolean jj_3_43() { + if (jj_3R_50()) return true; + if (jj_3R_72()) return true; + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_scan_token(COLON)) return true; + return false; + } + + final private boolean jj_3R_294() { + if (jj_3R_128()) return true; + return false; + } + + final private boolean jj_3R_283() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_294()) { + jj_scanpos = xsp; + if (jj_3R_295()) return true; + } + return false; + } + + final private boolean jj_3R_269() { + if (jj_3R_283()) return true; + return false; + } + + final private boolean jj_3R_243() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_269()) jj_scanpos = xsp; + if (jj_scan_token(SEMICOLON)) return true; + xsp = jj_scanpos; + if (jj_3R_270()) jj_scanpos = xsp; + if (jj_scan_token(SEMICOLON)) return true; + xsp = jj_scanpos; + if (jj_3R_271()) jj_scanpos = xsp; + return false; + } + + final private boolean jj_3R_242() { + if (jj_3R_50()) return true; + if (jj_3R_72()) return true; + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_scan_token(COLON)) return true; + if (jj_3R_56()) return true; + return false; + } + + final private boolean jj_3R_54() { + if (jj_scan_token(THROWS)) return true; + if (jj_3R_99()) return true; + return false; + } + + final private boolean jj_3R_206() { + if (jj_scan_token(FOR)) return true; + if (jj_scan_token(LPAREN)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_242()) { + jj_scanpos = xsp; + if (jj_3R_243()) return true; + } + if (jj_scan_token(RPAREN)) return true; + if (jj_3R_129()) return true; + return false; + } + + final private boolean jj_3R_69() { + if (jj_3R_102()) return true; + return false; + } + + final private boolean jj_3R_205() { + if (jj_scan_token(DO)) return true; + if (jj_3R_129()) return true; + if (jj_scan_token(WHILE)) return true; + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_56()) return true; + if (jj_scan_token(RPAREN)) return true; + if (jj_scan_token(SEMICOLON)) return true; + return false; + } + + final private boolean jj_3R_68() { + if (jj_scan_token(STRICTFP)) return true; + return false; + } + + final private boolean jj_3R_67() { + if (jj_scan_token(VOLATILE)) return true; + return false; + } + + final private boolean jj_3R_66() { + if (jj_scan_token(TRANSIENT)) return true; + return false; + } + + final private boolean jj_3R_204() { + if (jj_scan_token(WHILE)) return true; + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_56()) return true; + if (jj_scan_token(RPAREN)) return true; + if (jj_3R_129()) return true; + return false; + } + + final private boolean jj_3R_65() { + if (jj_scan_token(NATIVE)) return true; + return false; + } + + final private boolean jj_3R_64() { + if (jj_scan_token(SYNCHRONIZED)) return true; + return false; + } + + final private boolean jj_3R_63() { + if (jj_scan_token(ABSTRACT)) return true; + return false; + } + + final private boolean jj_3R_268() { + if (jj_3R_49()) return true; + return false; + } + + final private boolean jj_3R_203() { + if (jj_scan_token(IF)) return true; + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_56()) return true; + if (jj_scan_token(RPAREN)) return true; + if (jj_3R_129()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_241()) jj_scanpos = xsp; + return false; + } + + final private boolean jj_3R_62() { + if (jj_scan_token(FINAL)) return true; + return false; + } + + final private boolean jj_3R_61() { + if (jj_scan_token(PRIVATE)) return true; + return false; + } + + final private boolean jj_3R_162() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_161()) return true; + return false; + } + + final private boolean jj_3R_60() { + if (jj_scan_token(PROTECTED)) return true; + return false; + } + + final private boolean jj_3R_59() { + if (jj_scan_token(STATIC)) return true; + return false; + } + + final private boolean jj_3R_58() { + if (jj_scan_token(PUBLIC)) return true; + return false; + } + + final private boolean jj_3R_282() { + if (jj_scan_token(_DEFAULT)) return true; + if (jj_scan_token(COLON)) return true; + return false; + } + + final private boolean jj_3_6() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_58()) { + jj_scanpos = xsp; + if (jj_3R_59()) { + jj_scanpos = xsp; + if (jj_3R_60()) { + jj_scanpos = xsp; + if (jj_3R_61()) { + jj_scanpos = xsp; + if (jj_3R_62()) { + jj_scanpos = xsp; + if (jj_3R_63()) { + jj_scanpos = xsp; + if (jj_3R_64()) { + jj_scanpos = xsp; + if (jj_3R_65()) { + jj_scanpos = xsp; + if (jj_3R_66()) { + jj_scanpos = xsp; + if (jj_3R_67()) { + jj_scanpos = xsp; + if (jj_3R_68()) { + jj_scanpos = xsp; + if (jj_3R_69()) return true; + } + } + } + } + } + } + } + } + } + } + } + return false; + } + + final private boolean jj_3R_281() { + if (jj_scan_token(CASE)) return true; + if (jj_3R_56()) return true; + if (jj_scan_token(COLON)) return true; + return false; + } + + final private boolean jj_3R_267() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_281()) { + jj_scanpos = xsp; + if (jj_3R_282()) return true; + } + return false; + } + + final private boolean jj_3R_50() { + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3_6()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_240() { + if (jj_3R_267()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_268()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3_42() { + if (jj_3R_90()) return true; + if (jj_3R_79()) return true; + return false; + } + + final private boolean jj_3R_202() { + if (jj_scan_token(SWITCH)) return true; + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_56()) return true; + if (jj_scan_token(RPAREN)) return true; + if (jj_scan_token(LBRACE)) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_240()) { + jj_scanpos = xsp; + break; + } + } + if (jj_scan_token(RBRACE)) return true; + return false; + } + + final private boolean jj_3R_239() { + if (jj_3R_266()) return true; + return false; + } + + final private boolean jj_3R_57() { + if (jj_3R_102()) return true; + return false; + } + + final private boolean jj_3R_52() { + if (jj_3R_86()) return true; + return false; + } + + final private boolean jj_3R_238() { + if (jj_3R_265()) return true; + return false; + } + + final private boolean jj_3_5() { + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_57()) { + jj_scanpos = xsp; + break; + } + } + if (jj_scan_token(PACKAGE)) return true; + return false; + } + + final private boolean jj_3R_237() { + if (jj_3R_264()) return true; + return false; + } + + final private boolean jj_3R_201() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_236()) { + jj_scanpos = xsp; + if (jj_3R_237()) { + jj_scanpos = xsp; + if (jj_3R_238()) { + jj_scanpos = xsp; + if (jj_3R_239()) return true; + } + } + } + return false; + } + + final private boolean jj_3R_236() { + if (jj_3R_263()) return true; + return false; + } + + final private boolean jj_3R_200() { + if (jj_scan_token(SEMICOLON)) return true; + return false; + } + + final private boolean jj_3_41() { + if (jj_3R_50()) return true; + if (jj_3R_72()) return true; + if (jj_scan_token(IDENTIFIER)) return true; + return false; + } + + final private boolean jj_3R_128() { + if (jj_3R_50()) return true; + if (jj_3R_72()) return true; + if (jj_3R_161()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_162()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_51() { + if (jj_3R_97()) return true; + return false; + } + + final private boolean jj_3R_235() { + if (jj_scan_token(COLON)) return true; + if (jj_3R_56()) return true; + return false; + } + + final private boolean jj_3R_96() { + if (jj_3R_130()) return true; + return false; + } + + final private boolean jj_3R_95() { + if (jj_3R_129()) return true; + return false; + } + + final private boolean jj_3_4() { + if (jj_3R_56()) return true; + return false; + } + + final private boolean jj_3R_94() { + if (jj_3R_128()) return true; + if (jj_scan_token(SEMICOLON)) return true; + return false; + } + + final private boolean jj_3R_49() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_94()) { + jj_scanpos = xsp; + if (jj_3R_95()) { + jj_scanpos = xsp; + if (jj_3R_96()) return true; + } + } + return false; + } + + final private boolean jj_3R_146() { + if (jj_3R_49()) return true; + return false; + } + + final private boolean jj_3_3() { + if (jj_3R_55()) return true; + return false; + } + + final private boolean jj_3R_104() { + if (jj_scan_token(LBRACE)) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_146()) { + jj_scanpos = xsp; + break; + } + } + if (jj_scan_token(RBRACE)) return true; + return false; + } + + final private boolean jj_3_2() { + if (jj_3R_50()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_51()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_52()) jj_scanpos = xsp; + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_3R_53()) return true; + xsp = jj_scanpos; + if (jj_3R_54()) jj_scanpos = xsp; + if (jj_scan_token(LBRACE)) return true; + return false; + } + + final private boolean jj_3R_89() { + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_scan_token(COLON)) return true; + if (jj_3R_129()) return true; + return false; + } + + final private boolean jj_3_1() { + if (jj_3R_49()) return true; + return false; + } + + final private boolean jj_3R_199() { + if (jj_scan_token(ASSERT)) return true; + if (jj_3R_56()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_235()) jj_scanpos = xsp; + if (jj_scan_token(SEMICOLON)) return true; + return false; + } + + final private boolean jj_3R_177() { + if (jj_3R_212()) return true; + return false; + } + + final private boolean jj_3R_176() { + if (jj_3R_211()) return true; + return false; + } + + final private boolean jj_3_38() { + if (jj_scan_token(LBRACKET)) return true; + if (jj_scan_token(RBRACKET)) return true; + return false; + } + + final private boolean jj_3R_175() { + if (jj_3R_210()) return true; + return false; + } + + final private boolean jj_3R_174() { + if (jj_3R_209()) return true; + return false; + } + + final private boolean jj_3R_173() { + if (jj_3R_208()) return true; + return false; + } + + final private boolean jj_3R_172() { + if (jj_3R_207()) return true; + return false; + } + + final private boolean jj_3R_171() { + if (jj_3R_206()) return true; + return false; + } + + final private boolean jj_3R_170() { + if (jj_3R_205()) return true; + return false; + } + + final private boolean jj_3R_169() { + if (jj_3R_204()) return true; + return false; + } + + final private boolean jj_3R_168() { + if (jj_3R_203()) return true; + return false; + } + + final private boolean jj_3R_167() { + if (jj_3R_202()) return true; + return false; + } + + final private boolean jj_3R_166() { + if (jj_3R_201()) return true; + if (jj_scan_token(SEMICOLON)) return true; + return false; + } + + final private boolean jj_3R_165() { + if (jj_3R_200()) return true; + return false; + } + + final private boolean jj_3R_164() { + if (jj_3R_104()) return true; + return false; + } + + final private boolean jj_3R_163() { + if (jj_3R_199()) return true; + return false; + } + + final private boolean jj_3R_260() { + if (jj_3R_78()) return true; + return false; + } + + final private boolean jj_3_40() { + if (jj_3R_89()) return true; + return false; + } + + final private boolean jj_3R_129() { + Token xsp; + xsp = jj_scanpos; + if (jj_3_40()) { + jj_scanpos = xsp; + if (jj_3R_163()) { + jj_scanpos = xsp; + if (jj_3R_164()) { + jj_scanpos = xsp; + if (jj_3R_165()) { + jj_scanpos = xsp; + if (jj_3R_166()) { + jj_scanpos = xsp; + if (jj_3R_167()) { + jj_scanpos = xsp; + if (jj_3R_168()) { + jj_scanpos = xsp; + if (jj_3R_169()) { + jj_scanpos = xsp; + if (jj_3R_170()) { + jj_scanpos = xsp; + if (jj_3R_171()) { + jj_scanpos = xsp; + if (jj_3R_172()) { + jj_scanpos = xsp; + if (jj_3R_173()) { + jj_scanpos = xsp; + if (jj_3R_174()) { + jj_scanpos = xsp; + if (jj_3R_175()) { + jj_scanpos = xsp; + if (jj_3R_176()) { + jj_scanpos = xsp; + if (jj_3R_177()) + return true; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + return false; + } + + final private boolean jj_3R_279() { + if (jj_3R_182()) return true; + return false; + } + + final private boolean jj_3R_291() { + if (jj_scan_token(LBRACKET)) return true; + if (jj_scan_token(RBRACKET)) return true; + return false; + } + + final private boolean jj_3R_278() { + Token xsp; + if (jj_3R_291()) return true; + while (true) { + xsp = jj_scanpos; + if (jj_3R_291()) { + jj_scanpos = xsp; + break; + } + } + if (jj_3R_147()) return true; + return false; + } + + final private boolean jj_3_37() { + if (jj_scan_token(LBRACKET)) return true; + if (jj_3R_56()) return true; + if (jj_scan_token(RBRACKET)) return true; + return false; + } + + final private boolean jj_3_39() { + Token xsp; + if (jj_3_37()) return true; + while (true) { + xsp = jj_scanpos; + if (jj_3_37()) { + jj_scanpos = xsp; + break; + } + } + while (true) { + xsp = jj_scanpos; + if (jj_3_38()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_259() { + Token xsp; + xsp = jj_scanpos; + if (jj_3_39()) { + jj_scanpos = xsp; + if (jj_3R_278()) return true; + } + return false; + } + + final private boolean jj_3R_262() { + if (jj_3R_109()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_279()) jj_scanpos = xsp; + return false; + } + + final private boolean jj_3R_232() { + if (jj_scan_token(COMMA)) return true; + if (jj_3R_56()) return true; + return false; + } + + final private boolean jj_3R_261() { + if (jj_3R_259()) return true; + return false; + } + + final private boolean jj_3R_123() { + if (jj_scan_token(NEW)) return true; + if (jj_3R_149()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_260()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_261()) { + jj_scanpos = xsp; + if (jj_3R_262()) return true; + } + return false; + } + + final private boolean jj_3R_87() { + Token xsp; + xsp = jj_scanpos; + if (jj_3_36()) { + jj_scanpos = xsp; + if (jj_3R_123()) return true; + } + return false; + } + + final private boolean jj_3_36() { + if (jj_scan_token(NEW)) return true; + if (jj_3R_83()) return true; + if (jj_3R_259()) return true; + return false; + } + + final private boolean jj_3R_148() { + if (jj_3R_195()) return true; + return false; + } + + final private boolean jj_3R_195() { + if (jj_3R_56()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_232()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_109() { + if (jj_scan_token(LPAREN)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_148()) jj_scanpos = xsp; + if (jj_scan_token(RPAREN)) return true; + return false; + } + + final private boolean jj_3R_258() { + if (jj_scan_token(NULL)) return true; + return false; + } + + final private boolean jj_3R_257() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(56)) { + jj_scanpos = xsp; + if (jj_scan_token(25)) return true; + } + return false; + } + + final private boolean jj_3R_234() { + if (jj_3R_258()) return true; + return false; + } + + final private boolean jj_3R_233() { + if (jj_3R_257()) return true; + return false; + } + + final private boolean jj_3R_196() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(61)) { + jj_scanpos = xsp; + if (jj_scan_token(65)) { + jj_scanpos = xsp; + if (jj_scan_token(70)) { + jj_scanpos = xsp; + if (jj_scan_token(71)) { + jj_scanpos = xsp; + if (jj_3R_233()) { + jj_scanpos = xsp; + if (jj_3R_234()) return true; + } + } + } + } + } + return false; + } + + final private boolean jj_3R_152() { + if (jj_3R_196()) return true; + return false; + } + + final private boolean jj_3R_121() { + if (jj_3R_109()) return true; + return false; + } + + final private boolean jj_3R_120() { + if (jj_scan_token(DOT)) return true; + if (jj_scan_token(IDENTIFIER)) return true; + return false; + } + + final private boolean jj_3_33() { + if (jj_scan_token(DOT)) return true; + if (jj_scan_token(THIS)) return true; + return false; + } + + final private boolean jj_3R_119() { + if (jj_scan_token(LBRACKET)) return true; + if (jj_3R_56()) return true; + if (jj_scan_token(RBRACKET)) return true; + return false; + } + + final private boolean jj_3_32() { + if (jj_scan_token(DOT)) return true; + if (jj_scan_token(SUPER)) return true; + if (jj_scan_token(DOT)) return true; + return false; + } + + final private boolean jj_3_35() { + if (jj_3R_88()) return true; + return false; + } + + final private boolean jj_3_34() { + if (jj_scan_token(DOT)) return true; + if (jj_3R_87()) return true; + return false; + } + + final private boolean jj_3R_118() { + if (jj_scan_token(DOT)) return true; + if (jj_scan_token(THIS)) return true; + return false; + } + + final private boolean jj_3_31() { + if (jj_3R_86()) return true; + if (jj_scan_token(DOT)) return true; + if (jj_scan_token(CLASS)) return true; + return false; + } + + final private boolean jj_3R_117() { + if (jj_scan_token(DOT)) return true; + if (jj_scan_token(SUPER)) return true; + return false; + } + + final private boolean jj_3R_84() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_117()) { + jj_scanpos = xsp; + if (jj_3R_118()) { + jj_scanpos = xsp; + if (jj_3_34()) { + jj_scanpos = xsp; + if (jj_3_35()) { + jj_scanpos = xsp; + if (jj_3R_119()) { + jj_scanpos = xsp; + if (jj_3R_120()) { + jj_scanpos = xsp; + if (jj_3R_121()) return true; + } + } + } + } + } + } + return false; + } + + final private boolean jj_3R_85() { + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_scan_token(DOT)) return true; + return false; + } + + final private boolean jj_3R_159() { + if (jj_3R_91()) return true; + return false; + } + + final private boolean jj_3_30() { + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_85()) { + jj_scanpos = xsp; + break; + } + } + if (jj_scan_token(THIS)) return true; + return false; + } + + final private boolean jj_3R_158() { + if (jj_3R_86()) return true; + if (jj_scan_token(DOT)) return true; + if (jj_scan_token(CLASS)) return true; + return false; + } + + final private boolean jj_3R_157() { + if (jj_3R_87()) return true; + return false; + } + + final private boolean jj_3R_156() { + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_56()) return true; + if (jj_scan_token(RPAREN)) return true; + return false; + } + + final private boolean jj_3_29() { + if (jj_3R_84()) return true; + return false; + } + + final private boolean jj_3R_155() { + if (jj_scan_token(SUPER)) return true; + if (jj_scan_token(DOT)) return true; + if (jj_scan_token(IDENTIFIER)) return true; + return false; + } + + final private boolean jj_3R_197() { + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_scan_token(DOT)) return true; + return false; + } + + final private boolean jj_3R_154() { + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_197()) { + jj_scanpos = xsp; + break; + } + } + if (jj_scan_token(THIS)) return true; + return false; + } + + final private boolean jj_3R_124() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_153()) { + jj_scanpos = xsp; + if (jj_3R_154()) { + jj_scanpos = xsp; + if (jj_3R_155()) { + jj_scanpos = xsp; + if (jj_3R_156()) { + jj_scanpos = xsp; + if (jj_3R_157()) { + jj_scanpos = xsp; + if (jj_3R_158()) { + jj_scanpos = xsp; + if (jj_3R_159()) return true; + } + } + } + } + } + } + return false; + } + + final private boolean jj_3R_153() { + if (jj_3R_196()) return true; + return false; + } + + final private boolean jj_3R_88() { + if (jj_scan_token(DOT)) return true; + if (jj_3R_78()) return true; + if (jj_scan_token(IDENTIFIER)) return true; + return false; + } + + final private boolean jj_3R_280() { + if (jj_3R_293()) return true; + return false; + } + + final private boolean jj_3_28() { + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_83()) return true; + return false; + } + + final private boolean jj_3R_90() { + if (jj_3R_124()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3_29()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_319() { + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_72()) return true; + if (jj_scan_token(RPAREN)) return true; + if (jj_3R_313()) return true; + return false; + } + + final private boolean jj_3R_318() { + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_72()) return true; + if (jj_scan_token(RPAREN)) return true; + if (jj_3R_307()) return true; + return false; + } + + final private boolean jj_3R_317() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_318()) { + jj_scanpos = xsp; + if (jj_3R_319()) return true; + } + return false; + } + + final private boolean jj_3R_293() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(97)) { + jj_scanpos = xsp; + if (jj_scan_token(98)) return true; + } + return false; + } + + final private boolean jj_3_27() { + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_72()) return true; + if (jj_scan_token(LBRACKET)) return true; + return false; + } + + final private boolean jj_3R_266() { + if (jj_3R_90()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_280()) jj_scanpos = xsp; + return false; + } + + final private boolean jj_3R_116() { + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_72()) return true; + if (jj_scan_token(RPAREN)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(88)) { + jj_scanpos = xsp; + if (jj_scan_token(87)) { + jj_scanpos = xsp; + if (jj_scan_token(75)) { + jj_scanpos = xsp; + if (jj_scan_token(72)) { + jj_scanpos = xsp; + if (jj_scan_token(52)) { + jj_scanpos = xsp; + if (jj_scan_token(49)) { + jj_scanpos = xsp; + if (jj_scan_token(39)) { + jj_scanpos = xsp; + if (jj_3R_152()) return true; + } + } + } + } + } + } + } + return false; + } + + final private boolean jj_3R_115() { + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_72()) return true; + if (jj_scan_token(LBRACKET)) return true; + if (jj_scan_token(RBRACKET)) return true; + return false; + } + + final private boolean jj_3R_82() { + Token xsp; + xsp = jj_scanpos; + if (jj_3_26()) { + jj_scanpos = xsp; + if (jj_3R_115()) { + jj_scanpos = xsp; + if (jj_3R_116()) return true; + } + } + return false; + } + + final private boolean jj_3_26() { + if (jj_scan_token(LPAREN)) return true; + if (jj_3R_83()) return true; + return false; + } + + final private boolean jj_3_25() { + if (jj_3R_82()) return true; + return false; + } + + final private boolean jj_3_24() { + if (jj_3R_81()) return true; + return false; + } + + final private boolean jj_3R_316() { + if (jj_3R_266()) return true; + return false; + } + + final private boolean jj_3R_315() { + if (jj_3R_317()) return true; + return false; + } + + final private boolean jj_3R_314() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(88)) { + jj_scanpos = xsp; + if (jj_scan_token(87)) return true; + } + if (jj_3R_307()) return true; + return false; + } + + final private boolean jj_3R_313() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_314()) { + jj_scanpos = xsp; + if (jj_3R_315()) { + jj_scanpos = xsp; + if (jj_3R_316()) return true; + } + } + return false; + } + + final private boolean jj_3R_264() { + if (jj_scan_token(DECR)) return true; + if (jj_3R_90()) return true; + return false; + } + + final private boolean jj_3R_306() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(99)) { + jj_scanpos = xsp; + if (jj_scan_token(100)) return true; + } + if (jj_3R_305()) return true; + return false; + } + + final private boolean jj_3R_308() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(101)) { + jj_scanpos = xsp; + if (jj_scan_token(102)) { + jj_scanpos = xsp; + if (jj_scan_token(106)) return true; + } + } + if (jj_3R_307()) return true; + return false; + } + + final private boolean jj_3_23() { + if (jj_3R_80()) return true; + return false; + } + + final private boolean jj_3R_263() { + if (jj_scan_token(INCR)) return true; + if (jj_3R_90()) return true; + return false; + } + + final private boolean jj_3R_312() { + if (jj_3R_313()) return true; + return false; + } + + final private boolean jj_3_22() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(107)) { + jj_scanpos = xsp; + if (jj_3_23()) { + jj_scanpos = xsp; + if (jj_3_24()) return true; + } + } + if (jj_3R_304()) return true; + return false; + } + + final private boolean jj_3R_311() { + if (jj_3R_264()) return true; + return false; + } + + final private boolean jj_3R_310() { + if (jj_3R_263()) return true; + return false; + } + + final private boolean jj_3R_309() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(99)) { + jj_scanpos = xsp; + if (jj_scan_token(100)) return true; + } + if (jj_3R_307()) return true; + return false; + } + + final private boolean jj_3R_307() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_309()) { + jj_scanpos = xsp; + if (jj_3R_310()) { + jj_scanpos = xsp; + if (jj_3R_311()) { + jj_scanpos = xsp; + if (jj_3R_312()) return true; + } + } + } + return false; + } + + final private boolean jj_3R_303() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(86)) { + jj_scanpos = xsp; + if (jj_scan_token(122)) { + jj_scanpos = xsp; + if (jj_scan_token(92)) { + jj_scanpos = xsp; + if (jj_scan_token(93)) return true; + } + } + } + if (jj_3R_302()) return true; + return false; + } + + final private boolean jj_3R_301() { + if (jj_scan_token(INSTANCEOF)) return true; + if (jj_3R_72()) return true; + return false; + } + + final private boolean jj_3R_305() { + if (jj_3R_307()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_308()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_298() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(91)) { + jj_scanpos = xsp; + if (jj_scan_token(94)) return true; + } + if (jj_3R_297()) return true; + return false; + } + + final private boolean jj_3R_304() { + if (jj_3R_305()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_306()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_302() { + if (jj_3R_304()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3_22()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_288() { + if (jj_scan_token(BIT_AND)) return true; + if (jj_3R_287()) return true; + return false; + } + + final private boolean jj_3R_300() { + if (jj_3R_302()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_303()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_254() { + if (jj_scan_token(BIT_OR)) return true; + if (jj_3R_253()) return true; + return false; + } + + final private boolean jj_3R_297() { + if (jj_3R_300()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_301()) jj_scanpos = xsp; + return false; + } + + final private boolean jj_3R_274() { + if (jj_scan_token(XOR)) return true; + if (jj_3R_273()) return true; + return false; + } + + final private boolean jj_3R_230() { + if (jj_scan_token(SC_AND)) return true; + if (jj_3R_229()) return true; + return false; + } + + final private boolean jj_3R_287() { + if (jj_3R_297()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_298()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_190() { + if (jj_scan_token(SC_OR)) return true; + if (jj_3R_189()) return true; + return false; + } + + final private boolean jj_3R_273() { + if (jj_3R_287()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_288()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_142() { + if (jj_scan_token(HOOK)) return true; + if (jj_3R_56()) return true; + if (jj_scan_token(COLON)) return true; + if (jj_3R_56()) return true; + return false; + } + + final private boolean jj_3R_253() { + if (jj_3R_273()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_274()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_229() { + if (jj_3R_253()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_254()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_189() { + if (jj_3R_229()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_230()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_141() { + if (jj_3R_189()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_190()) { + jj_scanpos = xsp; + break; + } + } + return false; + } + + final private boolean jj_3R_101() { + if (jj_3R_141()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_142()) jj_scanpos = xsp; + return false; + } + + final private boolean jj_3R_265() { + if (jj_3R_90()) return true; + if (jj_3R_79()) return true; + if (jj_3R_56()) return true; + return false; + } + + final private boolean jj_3R_79() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(85)) { + jj_scanpos = xsp; + if (jj_scan_token(110)) { + jj_scanpos = xsp; + if (jj_scan_token(111)) { + jj_scanpos = xsp; + if (jj_scan_token(115)) { + jj_scanpos = xsp; + if (jj_scan_token(108)) { + jj_scanpos = xsp; + if (jj_scan_token(109)) { + jj_scanpos = xsp; + if (jj_scan_token(116)) { + jj_scanpos = xsp; + if (jj_scan_token(117)) { + jj_scanpos = xsp; + if (jj_scan_token(118)) { + jj_scanpos = xsp; + if (jj_scan_token(112)) { + jj_scanpos = xsp; + if (jj_scan_token(114)) { + jj_scanpos = xsp; + if (jj_scan_token(113)) + return true; + } + } + } + } + } + } + } + } + } + } + } + return false; + } + + final private boolean jj_3_21() { + if (jj_3R_79()) return true; + if (jj_3R_56()) return true; + return false; + } + + public JavaParserTokenManager token_source; + JavaCharStream jj_input_stream; + public Token token, jj_nt; + private int jj_ntk; + private Token jj_scanpos, jj_lastpos; + private int jj_la; + public boolean lookingAhead = false; + private boolean jj_semLA; + + public JavaParser(java.io.InputStream stream) { + this(stream, null); + } + + public JavaParser(java.io.InputStream stream, String encoding) { + try { + jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); + } catch (java.io.UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + token_source = new JavaParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + } + + public void ReInit(java.io.InputStream stream) { + ReInit(stream, null); + } + + public void ReInit(java.io.InputStream stream, String encoding) { + try { + jj_input_stream.ReInit(stream, encoding, 1, 1); + } catch (java.io.UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jjtree.reset(); + } + + public JavaParser(java.io.Reader stream) { + jj_input_stream = new JavaCharStream(stream, 1, 1); + token_source = new JavaParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + } + + public void ReInit(java.io.Reader stream) { + jj_input_stream.ReInit(stream, 1, 1); + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jjtree.reset(); + } + + public JavaParser(JavaParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + } + + public void ReInit(JavaParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jjtree.reset(); + } + + final private Token jj_consume_token(int kind) throws ParseException { + Token oldToken; + if ((oldToken = token).next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + return token; + } + token = oldToken; + throw generateParseException(); + } + + static private final class LookaheadSuccess extends java.lang.Error { + } + + final private LookaheadSuccess jj_ls = new LookaheadSuccess(); + + final private boolean jj_scan_token(int kind) { + if (jj_scanpos == jj_lastpos) { + jj_la--; + if (jj_scanpos.next == null) { + jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); + } else { + jj_lastpos = jj_scanpos = jj_scanpos.next; + } + } else { + jj_scanpos = jj_scanpos.next; + } + if (jj_scanpos.kind != kind) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; + return false; + } + + final public Token getNextToken() { + if (token.next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + return token; + } + + final public Token getToken(int index) { + Token t = lookingAhead ? jj_scanpos : token; + for (int i = 0; i < index; i++) { + if (t.next != null) t = t.next; + else t = t.next = token_source.getNextToken(); + } + return t; + } + + final private int jj_ntk() { + if ((jj_nt = token.next) == null) + return (jj_ntk = (token.next = token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); + } + + public ParseException generateParseException() { + Token errortok = token.next; + int line = errortok.beginLine, column = errortok.beginColumn; + String mess = (errortok.kind == 0) ? tokenImage[0] : errortok.image; + return new ParseException("Unable to parse Java code near token: " + mess, line, column); + } + + final public void enable_tracing() { + } + + final public void disable_tracing() { + } + +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserConstants.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserConstants.java new file mode 100644 index 0000000..e48071f --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserConstants.java @@ -0,0 +1,260 @@ +/* Generated By:JJTree&JavaCC: Do not edit this line. JavaParserConstants.java */ +package jaxx.compiler.java.parser; + +public interface JavaParserConstants { + + int EOF = 0; + int WHITE_SPACE = 3; + int SINGLE_LINE_COMMENT = 4; + int FORMAL_COMMENT = 5; + int MULTI_LINE_COMMENT = 6; + int ABSTRACT = 8; + int ASSERT = 9; + int BOOLEAN = 10; + int BREAK = 11; + int BYTE = 12; + int CASE = 13; + int CATCH = 14; + int CHAR = 15; + int CLASS = 16; + int CONST = 17; + int CONTINUE = 18; + int _DEFAULT = 19; + int DO = 20; + int DOUBLE = 21; + int ELSE = 22; + int ENUM = 23; + int EXTENDS = 24; + int FALSE = 25; + int FINAL = 26; + int FINALLY = 27; + int FLOAT = 28; + int FOR = 29; + int GOTO = 30; + int IF = 31; + int IMPLEMENTS = 32; + int IMPORT = 33; + int INSTANCEOF = 34; + int INT = 35; + int INTERFACE = 36; + int LONG = 37; + int NATIVE = 38; + int NEW = 39; + int NULL = 40; + int PACKAGE = 41; + int PRIVATE = 42; + int PROTECTED = 43; + int PUBLIC = 44; + int RETURN = 45; + int SHORT = 46; + int STATIC = 47; + int STRICTFP = 48; + int SUPER = 49; + int SWITCH = 50; + int SYNCHRONIZED = 51; + int THIS = 52; + int THROW = 53; + int THROWS = 54; + int TRANSIENT = 55; + int TRUE = 56; + int TRY = 57; + int VOID = 58; + int VOLATILE = 59; + int WHILE = 60; + int INTEGER_LITERAL = 61; + int DECIMAL_LITERAL = 62; + int HEX_LITERAL = 63; + int OCTAL_LITERAL = 64; + int FLOATING_POINT_LITERAL = 65; + int DECIMAL_FLOATING_POINT_LITERAL = 66; + int DECIMAL_EXPONENT = 67; + int HEXADECIMAL_FLOATING_POINT_LITERAL = 68; + int HEXADECIMAL_EXPONENT = 69; + int CHARACTER_LITERAL = 70; + int STRING_LITERAL = 71; + int IDENTIFIER = 72; + int LETTER = 73; + int PART_LETTER = 74; + int LPAREN = 75; + int RPAREN = 76; + int LBRACE = 77; + int RBRACE = 78; + int LBRACKET = 79; + int RBRACKET = 80; + int SEMICOLON = 81; + int COMMA = 82; + int DOT = 83; + int AT = 84; + int ASSIGN = 85; + int LT = 86; + int BANG = 87; + int TILDE = 88; + int HOOK = 89; + int COLON = 90; + int EQ = 91; + int LE = 92; + int GE = 93; + int NE = 94; + int SC_OR = 95; + int SC_AND = 96; + int INCR = 97; + int DECR = 98; + int PLUS = 99; + int MINUS = 100; + int STAR = 101; + int SLASH = 102; + int BIT_AND = 103; + int BIT_OR = 104; + int XOR = 105; + int REM = 106; + int LSHIFT = 107; + int PLUSASSIGN = 108; + int MINUSASSIGN = 109; + int STARASSIGN = 110; + int SLASHASSIGN = 111; + int ANDASSIGN = 112; + int ORASSIGN = 113; + int XORASSIGN = 114; + int REMASSIGN = 115; + int LSHIFTASSIGN = 116; + int RSIGNEDSHIFTASSIGN = 117; + int RUNSIGNEDSHIFTASSIGN = 118; + int ELLIPSIS = 119; + int RUNSIGNEDSHIFT = 120; + int RSIGNEDSHIFT = 121; + int GT = 122; + int STUFF_TO_IGNORE = 124; + + int DEFAULT = 0; + int IN_FORMAL_COMMENT = 1; + int IN_MULTI_LINE_COMMENT = 2; + + String[] tokenImage = { + "<EOF>", + "<token of kind 1>", + "\"/*\"", + "<WHITE_SPACE>", + "<SINGLE_LINE_COMMENT>", + "\"*/\"", + "\"*/\"", + "<token of kind 7>", + "\"abstract\"", + "\"assert\"", + "\"boolean\"", + "\"break\"", + "\"byte\"", + "\"case\"", + "\"catch\"", + "\"char\"", + "\"class\"", + "\"const\"", + "\"continue\"", + "\"default\"", + "\"do\"", + "\"double\"", + "\"else\"", + "\"enum\"", + "\"extends\"", + "\"false\"", + "\"final\"", + "\"finally\"", + "\"float\"", + "\"for\"", + "\"goto\"", + "\"if\"", + "\"implements\"", + "\"import\"", + "\"instanceof\"", + "\"int\"", + "\"interface\"", + "\"long\"", + "\"native\"", + "\"new\"", + "\"null\"", + "\"package\"", + "\"private\"", + "\"protected\"", + "\"public\"", + "\"return\"", + "\"short\"", + "\"static\"", + "\"strictfp\"", + "\"super\"", + "\"switch\"", + "\"synchronized\"", + "\"this\"", + "\"throw\"", + "\"throws\"", + "\"transient\"", + "\"true\"", + "\"try\"", + "\"void\"", + "\"volatile\"", + "\"while\"", + "<INTEGER_LITERAL>", + "<DECIMAL_LITERAL>", + "<HEX_LITERAL>", + "<OCTAL_LITERAL>", + "<FLOATING_POINT_LITERAL>", + "<DECIMAL_FLOATING_POINT_LITERAL>", + "<DECIMAL_EXPONENT>", + "<HEXADECIMAL_FLOATING_POINT_LITERAL>", + "<HEXADECIMAL_EXPONENT>", + "<CHARACTER_LITERAL>", + "<STRING_LITERAL>", + "<IDENTIFIER>", + "<LETTER>", + "<PART_LETTER>", + "\"(\"", + "\")\"", + "\"{\"", + "\"}\"", + "\"[\"", + "\"]\"", + "\";\"", + "\",\"", + "\".\"", + "\"@\"", + "\"=\"", + "\"<\"", + "\"!\"", + "\"~\"", + "\"?\"", + "\":\"", + "\"==\"", + "\"<=\"", + "\">=\"", + "\"!=\"", + "\"||\"", + "\"&&\"", + "\"++\"", + "\"--\"", + "\"+\"", + "\"-\"", + "\"*\"", + "\"/\"", + "\"&\"", + "\"|\"", + "\"^\"", + "\"%\"", + "\"<<\"", + "\"+=\"", + "\"-=\"", + "\"*=\"", + "\"/=\"", + "\"&=\"", + "\"|=\"", + "\"^=\"", + "\"%=\"", + "\"<<=\"", + "\">>=\"", + "\">>>=\"", + "\"...\"", + "\">>>\"", + "\">>\"", + "\">\"", + "\"\\u001a\"", + "<STUFF_TO_IGNORE>", + }; + +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTokenManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTokenManager.java new file mode 100644 index 0000000..a53d00b --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTokenManager.java @@ -0,0 +1,2072 @@ +/* Generated By:JJTree&JavaCC: Do not edit this line. JavaParserTokenManager.java */ +package jaxx.compiler.java.parser; + +public class JavaParserTokenManager implements JavaParserConstants { + public java.io.PrintStream debugStream = System.out; + + public void setDebugStream(java.io.PrintStream ds) { + debugStream = ds; + } + + private int jjStopStringLiteralDfa_0(int pos, long active0, long active1) { + switch (pos) { + case 0: + if ((active0 & 0x4L) != 0L || (active1 & 0x804000000000L) != 0L) + return 48; + if ((active1 & 0x80000000080000L) != 0L) + return 5; + if ((active0 & 0x1fffffffffffff00L) != 0L) { + jjmatchedKind = 72; + return 29; + } + return -1; + case 1: + if ((active0 & 0x4L) != 0L) + return 46; + if ((active0 & 0x1fffffff7fcfff00L) != 0L) { + if (jjmatchedPos != 1) { + jjmatchedKind = 72; + jjmatchedPos = 1; + } + return 29; + } + if ((active0 & 0x80300000L) != 0L) + return 29; + return -1; + case 2: + if ((active0 & 0x1dffff675fefff00L) != 0L) { + if (jjmatchedPos != 2) { + jjmatchedKind = 72; + jjmatchedPos = 2; + } + return 29; + } + if ((active0 & 0x200009820000000L) != 0L) + return 29; + return -1; + case 3: + if ((active0 & 0x18effe571f2f4f00L) != 0L) { + jjmatchedKind = 72; + jjmatchedPos = 3; + return 29; + } + if ((active0 & 0x510012040c0b000L) != 0L) + return 29; + return -1; + case 4: + if ((active0 & 0x88dbe57012c0700L) != 0L) { + if (jjmatchedPos != 4) { + jjmatchedKind = 72; + jjmatchedPos = 4; + } + return 29; + } + if ((active0 & 0x106240001e034800L) != 0L) + return 29; + return -1; + case 5: + if ((active0 & 0x8890e15090c0500L) != 0L) { + jjmatchedKind = 72; + jjmatchedPos = 5; + return 29; + } + if ((active0 & 0x44b04200200200L) != 0L) + return 29; + return -1; + case 6: + if ((active0 & 0x889081500040100L) != 0L) { + jjmatchedKind = 72; + jjmatchedPos = 6; + return 29; + } + if ((active0 & 0x60009080400L) != 0L) + return 29; + return -1; + case 7: + if ((active0 & 0x801000000040100L) != 0L) + return 29; + if ((active0 & 0x88081500000000L) != 0L) { + jjmatchedKind = 72; + jjmatchedPos = 7; + return 29; + } + return -1; + case 8: + if ((active0 & 0x8000500000000L) != 0L) { + jjmatchedKind = 72; + jjmatchedPos = 8; + return 29; + } + if ((active0 & 0x80081000000000L) != 0L) + return 29; + return -1; + case 9: + if ((active0 & 0x8000000000000L) != 0L) { + jjmatchedKind = 72; + jjmatchedPos = 9; + return 29; + } + if ((active0 & 0x500000000L) != 0L) + return 29; + return -1; + case 10: + if ((active0 & 0x8000000000000L) != 0L) { + jjmatchedKind = 72; + jjmatchedPos = 10; + return 29; + } + return -1; + default: + return -1; + } + } + + private int jjStartNfa_0(int pos, long active0, long active1) { + return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0, active1), pos + 1); + } + + private int jjStopAtPos(int pos, int kind) { + jjmatchedKind = kind; + jjmatchedPos = pos; + return pos + 1; + } + + private int jjStartNfaWithStates_0(int pos, int kind, int state) { + jjmatchedKind = kind; + jjmatchedPos = pos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return pos + 1; + } + return jjMoveNfa_0(state, pos + 1); + } + + private int jjMoveStringLiteralDfa0_0() { + switch (curChar) { + case 26: + return jjStopAtPos(0, 123); + case 33: + jjmatchedKind = 87; + return jjMoveStringLiteralDfa1_0(0x0L, 0x40000000L); + case 37: + jjmatchedKind = 106; + return jjMoveStringLiteralDfa1_0(0x0L, 0x8000000000000L); + case 38: + jjmatchedKind = 103; + return jjMoveStringLiteralDfa1_0(0x0L, 0x1000100000000L); + case 40: + return jjStopAtPos(0, 75); + case 41: + return jjStopAtPos(0, 76); + case 42: + jjmatchedKind = 101; + return jjMoveStringLiteralDfa1_0(0x0L, 0x400000000000L); + case 43: + jjmatchedKind = 99; + return jjMoveStringLiteralDfa1_0(0x0L, 0x100200000000L); + case 44: + return jjStopAtPos(0, 82); + case 45: + jjmatchedKind = 100; + return jjMoveStringLiteralDfa1_0(0x0L, 0x200400000000L); + case 46: + jjmatchedKind = 83; + return jjMoveStringLiteralDfa1_0(0x0L, 0x80000000000000L); + case 47: + jjmatchedKind = 102; + return jjMoveStringLiteralDfa1_0(0x4L, 0x800000000000L); + case 58: + return jjStopAtPos(0, 90); + case 59: + return jjStopAtPos(0, 81); + case 60: + jjmatchedKind = 86; + return jjMoveStringLiteralDfa1_0(0x0L, 0x10080010000000L); + case 61: + jjmatchedKind = 85; + return jjMoveStringLiteralDfa1_0(0x0L, 0x8000000L); + case 62: + jjmatchedKind = 122; + return jjMoveStringLiteralDfa1_0(0x0L, 0x360000020000000L); + case 63: + return jjStopAtPos(0, 89); + case 64: + return jjStopAtPos(0, 84); + case 91: + return jjStopAtPos(0, 79); + case 93: + return jjStopAtPos(0, 80); + case 94: + jjmatchedKind = 105; + return jjMoveStringLiteralDfa1_0(0x0L, 0x4000000000000L); + case 97: + return jjMoveStringLiteralDfa1_0(0x300L, 0x0L); + case 98: + return jjMoveStringLiteralDfa1_0(0x1c00L, 0x0L); + case 99: + return jjMoveStringLiteralDfa1_0(0x7e000L, 0x0L); + case 100: + return jjMoveStringLiteralDfa1_0(0x380000L, 0x0L); + case 101: + return jjMoveStringLiteralDfa1_0(0x1c00000L, 0x0L); + case 102: + return jjMoveStringLiteralDfa1_0(0x3e000000L, 0x0L); + case 103: + return jjMoveStringLiteralDfa1_0(0x40000000L, 0x0L); + case 105: + return jjMoveStringLiteralDfa1_0(0x1f80000000L, 0x0L); + case 108: + return jjMoveStringLiteralDfa1_0(0x2000000000L, 0x0L); + case 110: + return jjMoveStringLiteralDfa1_0(0x1c000000000L, 0x0L); + case 112: + return jjMoveStringLiteralDfa1_0(0x1e0000000000L, 0x0L); + case 114: + return jjMoveStringLiteralDfa1_0(0x200000000000L, 0x0L); + case 115: + return jjMoveStringLiteralDfa1_0(0xfc00000000000L, 0x0L); + case 116: + return jjMoveStringLiteralDfa1_0(0x3f0000000000000L, 0x0L); + case 118: + return jjMoveStringLiteralDfa1_0(0xc00000000000000L, 0x0L); + case 119: + return jjMoveStringLiteralDfa1_0(0x1000000000000000L, 0x0L); + case 123: + return jjStopAtPos(0, 77); + case 124: + jjmatchedKind = 104; + return jjMoveStringLiteralDfa1_0(0x0L, 0x2000080000000L); + case 125: + return jjStopAtPos(0, 78); + case 126: + return jjStopAtPos(0, 88); + default: + return jjMoveNfa_0(1, 0); + } + } + + private int jjMoveStringLiteralDfa1_0(long active0, long active1) { + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_0(0, active0, active1); + return 1; + } + switch (curChar) { + case 38: + if ((active1 & 0x100000000L) != 0L) + return jjStopAtPos(1, 96); + break; + case 42: + if ((active0 & 0x4L) != 0L) + return jjStartNfaWithStates_0(1, 2, 46); + break; + case 43: + if ((active1 & 0x200000000L) != 0L) + return jjStopAtPos(1, 97); + break; + case 45: + if ((active1 & 0x400000000L) != 0L) + return jjStopAtPos(1, 98); + break; + case 46: + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x80000000000000L); + case 60: + if ((active1 & 0x80000000000L) != 0L) { + jjmatchedKind = 107; + jjmatchedPos = 1; + } + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x10000000000000L); + case 61: + if ((active1 & 0x8000000L) != 0L) + return jjStopAtPos(1, 91); + else if ((active1 & 0x10000000L) != 0L) + return jjStopAtPos(1, 92); + else if ((active1 & 0x20000000L) != 0L) + return jjStopAtPos(1, 93); + else if ((active1 & 0x40000000L) != 0L) + return jjStopAtPos(1, 94); + else if ((active1 & 0x100000000000L) != 0L) + return jjStopAtPos(1, 108); + else if ((active1 & 0x200000000000L) != 0L) + return jjStopAtPos(1, 109); + else if ((active1 & 0x400000000000L) != 0L) + return jjStopAtPos(1, 110); + else if ((active1 & 0x800000000000L) != 0L) + return jjStopAtPos(1, 111); + else if ((active1 & 0x1000000000000L) != 0L) + return jjStopAtPos(1, 112); + else if ((active1 & 0x2000000000000L) != 0L) + return jjStopAtPos(1, 113); + else if ((active1 & 0x4000000000000L) != 0L) + return jjStopAtPos(1, 114); + else if ((active1 & 0x8000000000000L) != 0L) + return jjStopAtPos(1, 115); + break; + case 62: + if ((active1 & 0x200000000000000L) != 0L) { + jjmatchedKind = 121; + jjmatchedPos = 1; + } + return jjMoveStringLiteralDfa2_0(active0, 0L, active1, 0x160000000000000L); + case 97: + return jjMoveStringLiteralDfa2_0(active0, 0x24002006000L, active1, 0L); + case 98: + return jjMoveStringLiteralDfa2_0(active0, 0x100L, active1, 0L); + case 101: + return jjMoveStringLiteralDfa2_0(active0, 0x208000080000L, active1, 0L); + case 102: + if ((active0 & 0x80000000L) != 0L) + return jjStartNfaWithStates_0(1, 31, 29); + break; + case 104: + return jjMoveStringLiteralDfa2_0(active0, 0x1070400000008000L, active1, 0L); + case 105: + return jjMoveStringLiteralDfa2_0(active0, 0xc000000L, active1, 0L); + case 108: + return jjMoveStringLiteralDfa2_0(active0, 0x10410000L, active1, 0L); + case 109: + return jjMoveStringLiteralDfa2_0(active0, 0x300000000L, active1, 0L); + case 110: + return jjMoveStringLiteralDfa2_0(active0, 0x1c00800000L, active1, 0L); + case 111: + if ((active0 & 0x100000L) != 0L) { + jjmatchedKind = 20; + jjmatchedPos = 1; + } + return jjMoveStringLiteralDfa2_0(active0, 0xc00002060260400L, active1, 0L); + case 114: + return jjMoveStringLiteralDfa2_0(active0, 0x3800c0000000800L, active1, 0L); + case 115: + return jjMoveStringLiteralDfa2_0(active0, 0x200L, active1, 0L); + case 116: + return jjMoveStringLiteralDfa2_0(active0, 0x1800000000000L, active1, 0L); + case 117: + return jjMoveStringLiteralDfa2_0(active0, 0x2110000000000L, active1, 0L); + case 119: + return jjMoveStringLiteralDfa2_0(active0, 0x4000000000000L, active1, 0L); + case 120: + return jjMoveStringLiteralDfa2_0(active0, 0x1000000L, active1, 0L); + case 121: + return jjMoveStringLiteralDfa2_0(active0, 0x8000000001000L, active1, 0L); + case 124: + if ((active1 & 0x80000000L) != 0L) + return jjStopAtPos(1, 95); + break; + default: + break; + } + return jjStartNfa_0(0, active0, active1); + } + + private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1) { + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(0, old0, old1); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_0(1, active0, active1); + return 2; + } + switch (curChar) { + case 46: + if ((active1 & 0x80000000000000L) != 0L) + return jjStopAtPos(2, 119); + break; + case 61: + if ((active1 & 0x10000000000000L) != 0L) + return jjStopAtPos(2, 116); + else if ((active1 & 0x20000000000000L) != 0L) + return jjStopAtPos(2, 117); + break; + case 62: + if ((active1 & 0x100000000000000L) != 0L) { + jjmatchedKind = 120; + jjmatchedPos = 2; + } + return jjMoveStringLiteralDfa3_0(active0, 0L, active1, 0x40000000000000L); + case 97: + return jjMoveStringLiteralDfa3_0(active0, 0x80800000018000L, active1, 0L); + case 98: + return jjMoveStringLiteralDfa3_0(active0, 0x100000000000L, active1, 0L); + case 99: + return jjMoveStringLiteralDfa3_0(active0, 0x20000000000L, active1, 0L); + case 101: + return jjMoveStringLiteralDfa3_0(active0, 0x800L, active1, 0L); + case 102: + return jjMoveStringLiteralDfa3_0(active0, 0x80000L, active1, 0L); + case 105: + return jjMoveStringLiteralDfa3_0(active0, 0x1414040000000000L, active1, 0L); + case 108: + return jjMoveStringLiteralDfa3_0(active0, 0x800010002000000L, active1, 0L); + case 110: + return jjMoveStringLiteralDfa3_0(active0, 0x800200c060000L, active1, 0L); + case 111: + return jjMoveStringLiteralDfa3_0(active0, 0x480010000400L, active1, 0L); + case 112: + return jjMoveStringLiteralDfa3_0(active0, 0x2000300000000L, active1, 0L); + case 114: + if ((active0 & 0x20000000L) != 0L) + return jjStartNfaWithStates_0(2, 29, 29); + return jjMoveStringLiteralDfa3_0(active0, 0x61000000000000L, active1, 0L); + case 115: + return jjMoveStringLiteralDfa3_0(active0, 0x400402300L, active1, 0L); + case 116: + if ((active0 & 0x800000000L) != 0L) { + jjmatchedKind = 35; + jjmatchedPos = 2; + } + return jjMoveStringLiteralDfa3_0(active0, 0x205041005000L, active1, 0L); + case 117: + return jjMoveStringLiteralDfa3_0(active0, 0x100000000a00000L, active1, 0L); + case 119: + if ((active0 & 0x8000000000L) != 0L) + return jjStartNfaWithStates_0(2, 39, 29); + break; + case 121: + if ((active0 & 0x200000000000000L) != 0L) + return jjStartNfaWithStates_0(2, 57, 29); + break; + default: + break; + } + return jjStartNfa_0(1, active0, active1); + } + + private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1) { + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(1, old0, old1); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_0(2, active0, active1); + return 3; + } + switch (curChar) { + case 61: + if ((active1 & 0x40000000000000L) != 0L) + return jjStopAtPos(3, 118); + break; + case 97: + return jjMoveStringLiteralDfa4_0(active0, 0x80000001c080800L, active1, 0L); + case 98: + return jjMoveStringLiteralDfa4_0(active0, 0x200000L, active1, 0L); + case 99: + return jjMoveStringLiteralDfa4_0(active0, 0x8000000004000L, active1, 0L); + case 100: + if ((active0 & 0x400000000000000L) != 0L) + return jjStartNfaWithStates_0(3, 58, 29); + break; + case 101: + if ((active0 & 0x1000L) != 0L) + return jjStartNfaWithStates_0(3, 12, 29); + else if ((active0 & 0x2000L) != 0L) + return jjStartNfaWithStates_0(3, 13, 29); + else if ((active0 & 0x400000L) != 0L) + return jjStartNfaWithStates_0(3, 22, 29); + else if ((active0 & 0x100000000000000L) != 0L) + return jjStartNfaWithStates_0(3, 56, 29); + return jjMoveStringLiteralDfa4_0(active0, 0x2001001000200L, active1, 0L); + case 103: + if ((active0 & 0x2000000000L) != 0L) + return jjStartNfaWithStates_0(3, 37, 29); + break; + case 105: + return jjMoveStringLiteralDfa4_0(active0, 0x1004000000000L, active1, 0L); + case 107: + return jjMoveStringLiteralDfa4_0(active0, 0x20000000000L, active1, 0L); + case 108: + if ((active0 & 0x10000000000L) != 0L) + return jjStartNfaWithStates_0(3, 40, 29); + return jjMoveStringLiteralDfa4_0(active0, 0x1000100100000400L, active1, 0L); + case 109: + if ((active0 & 0x800000L) != 0L) + return jjStartNfaWithStates_0(3, 23, 29); + break; + case 110: + return jjMoveStringLiteralDfa4_0(active0, 0x80000000000000L, active1, 0L); + case 111: + if ((active0 & 0x40000000L) != 0L) + return jjStartNfaWithStates_0(3, 30, 29); + return jjMoveStringLiteralDfa4_0(active0, 0x60000200000000L, active1, 0L); + case 114: + if ((active0 & 0x8000L) != 0L) + return jjStartNfaWithStates_0(3, 15, 29); + return jjMoveStringLiteralDfa4_0(active0, 0x400000000000L, active1, 0L); + case 115: + if ((active0 & 0x10000000000000L) != 0L) + return jjStartNfaWithStates_0(3, 52, 29); + return jjMoveStringLiteralDfa4_0(active0, 0x2030000L, active1, 0L); + case 116: + return jjMoveStringLiteralDfa4_0(active0, 0x4880400040100L, active1, 0L); + case 117: + return jjMoveStringLiteralDfa4_0(active0, 0x200000000000L, active1, 0L); + case 118: + return jjMoveStringLiteralDfa4_0(active0, 0x40000000000L, active1, 0L); + default: + break; + } + return jjStartNfa_0(2, active0, active1); + } + + private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1) { + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(2, old0, old1); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_0(3, active0, 0L); + return 4; + } + switch (curChar) { + case 97: + return jjMoveStringLiteralDfa5_0(active0, 0x60400000000L); + case 99: + return jjMoveStringLiteralDfa5_0(active0, 0x5000000000000L); + case 101: + if ((active0 & 0x2000000L) != 0L) + return jjStartNfaWithStates_0(4, 25, 29); + else if ((active0 & 0x1000000000000000L) != 0L) + return jjStartNfaWithStates_0(4, 60, 29); + return jjMoveStringLiteralDfa5_0(active0, 0x80100000400L); + case 104: + if ((active0 & 0x4000L) != 0L) + return jjStartNfaWithStates_0(4, 14, 29); + return jjMoveStringLiteralDfa5_0(active0, 0x8000000000000L); + case 105: + return jjMoveStringLiteralDfa5_0(active0, 0x900000040000L); + case 107: + if ((active0 & 0x800L) != 0L) + return jjStartNfaWithStates_0(4, 11, 29); + break; + case 108: + if ((active0 & 0x4000000L) != 0L) { + jjmatchedKind = 26; + jjmatchedPos = 4; + } + return jjMoveStringLiteralDfa5_0(active0, 0x8200000L); + case 110: + return jjMoveStringLiteralDfa5_0(active0, 0x1000000L); + case 114: + if ((active0 & 0x2000000000000L) != 0L) + return jjStartNfaWithStates_0(4, 49, 29); + return jjMoveStringLiteralDfa5_0(active0, 0x201200000300L); + case 115: + if ((active0 & 0x10000L) != 0L) + return jjStartNfaWithStates_0(4, 16, 29); + return jjMoveStringLiteralDfa5_0(active0, 0x80000000000000L); + case 116: + if ((active0 & 0x20000L) != 0L) + return jjStartNfaWithStates_0(4, 17, 29); + else if ((active0 & 0x10000000L) != 0L) + return jjStartNfaWithStates_0(4, 28, 29); + else if ((active0 & 0x400000000000L) != 0L) + return jjStartNfaWithStates_0(4, 46, 29); + return jjMoveStringLiteralDfa5_0(active0, 0x800000000000000L); + case 117: + return jjMoveStringLiteralDfa5_0(active0, 0x80000L); + case 118: + return jjMoveStringLiteralDfa5_0(active0, 0x4000000000L); + case 119: + if ((active0 & 0x20000000000000L) != 0L) { + jjmatchedKind = 53; + jjmatchedPos = 4; + } + return jjMoveStringLiteralDfa5_0(active0, 0x40000000000000L); + default: + break; + } + return jjStartNfa_0(3, active0, 0L); + } + + private int jjMoveStringLiteralDfa5_0(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(3, old0, 0L); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_0(4, active0, 0L); + return 5; + } + switch (curChar) { + case 97: + return jjMoveStringLiteralDfa6_0(active0, 0x500L); + case 99: + if ((active0 & 0x100000000000L) != 0L) + return jjStartNfaWithStates_0(5, 44, 29); + else if ((active0 & 0x800000000000L) != 0L) + return jjStartNfaWithStates_0(5, 47, 29); + return jjMoveStringLiteralDfa6_0(active0, 0x80000000000L); + case 100: + return jjMoveStringLiteralDfa6_0(active0, 0x1000000L); + case 101: + if ((active0 & 0x200000L) != 0L) + return jjStartNfaWithStates_0(5, 21, 29); + else if ((active0 & 0x4000000000L) != 0L) + return jjStartNfaWithStates_0(5, 38, 29); + break; + case 102: + return jjMoveStringLiteralDfa6_0(active0, 0x1000000000L); + case 103: + return jjMoveStringLiteralDfa6_0(active0, 0x20000000000L); + case 104: + if ((active0 & 0x4000000000000L) != 0L) + return jjStartNfaWithStates_0(5, 50, 29); + break; + case 105: + return jjMoveStringLiteralDfa6_0(active0, 0x880000000000000L); + case 108: + return jjMoveStringLiteralDfa6_0(active0, 0x8080000L); + case 109: + return jjMoveStringLiteralDfa6_0(active0, 0x100000000L); + case 110: + if ((active0 & 0x200000000000L) != 0L) + return jjStartNfaWithStates_0(5, 45, 29); + return jjMoveStringLiteralDfa6_0(active0, 0x400040000L); + case 114: + return jjMoveStringLiteralDfa6_0(active0, 0x8000000000000L); + case 115: + if ((active0 & 0x40000000000000L) != 0L) + return jjStartNfaWithStates_0(5, 54, 29); + break; + case 116: + if ((active0 & 0x200L) != 0L) + return jjStartNfaWithStates_0(5, 9, 29); + else if ((active0 & 0x200000000L) != 0L) + return jjStartNfaWithStates_0(5, 33, 29); + return jjMoveStringLiteralDfa6_0(active0, 0x1040000000000L); + default: + break; + } + return jjStartNfa_0(4, active0, 0L); + } + + private int jjMoveStringLiteralDfa6_0(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(4, old0, 0L); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_0(5, active0, 0L); + return 6; + } + switch (curChar) { + case 97: + return jjMoveStringLiteralDfa7_0(active0, 0x1000000000L); + case 99: + return jjMoveStringLiteralDfa7_0(active0, 0x400000100L); + case 101: + if ((active0 & 0x20000000000L) != 0L) + return jjStartNfaWithStates_0(6, 41, 29); + else if ((active0 & 0x40000000000L) != 0L) + return jjStartNfaWithStates_0(6, 42, 29); + return jjMoveStringLiteralDfa7_0(active0, 0x80000100000000L); + case 102: + return jjMoveStringLiteralDfa7_0(active0, 0x1000000000000L); + case 108: + return jjMoveStringLiteralDfa7_0(active0, 0x800000000000000L); + case 110: + if ((active0 & 0x400L) != 0L) + return jjStartNfaWithStates_0(6, 10, 29); + break; + case 111: + return jjMoveStringLiteralDfa7_0(active0, 0x8000000000000L); + case 115: + if ((active0 & 0x1000000L) != 0L) + return jjStartNfaWithStates_0(6, 24, 29); + break; + case 116: + if ((active0 & 0x80000L) != 0L) + return jjStartNfaWithStates_0(6, 19, 29); + return jjMoveStringLiteralDfa7_0(active0, 0x80000000000L); + case 117: + return jjMoveStringLiteralDfa7_0(active0, 0x40000L); + case 121: + if ((active0 & 0x8000000L) != 0L) + return jjStartNfaWithStates_0(6, 27, 29); + break; + default: + break; + } + return jjStartNfa_0(5, active0, 0L); + } + + private int jjMoveStringLiteralDfa7_0(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(5, old0, 0L); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_0(6, active0, 0L); + return 7; + } + switch (curChar) { + case 99: + return jjMoveStringLiteralDfa8_0(active0, 0x1000000000L); + case 101: + if ((active0 & 0x40000L) != 0L) + return jjStartNfaWithStates_0(7, 18, 29); + else if ((active0 & 0x800000000000000L) != 0L) + return jjStartNfaWithStates_0(7, 59, 29); + return jjMoveStringLiteralDfa8_0(active0, 0x80400000000L); + case 110: + return jjMoveStringLiteralDfa8_0(active0, 0x88000100000000L); + case 112: + if ((active0 & 0x1000000000000L) != 0L) + return jjStartNfaWithStates_0(7, 48, 29); + break; + case 116: + if ((active0 & 0x100L) != 0L) + return jjStartNfaWithStates_0(7, 8, 29); + break; + default: + break; + } + return jjStartNfa_0(6, active0, 0L); + } + + private int jjMoveStringLiteralDfa8_0(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(6, old0, 0L); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_0(7, active0, 0L); + return 8; + } + switch (curChar) { + case 100: + if ((active0 & 0x80000000000L) != 0L) + return jjStartNfaWithStates_0(8, 43, 29); + break; + case 101: + if ((active0 & 0x1000000000L) != 0L) + return jjStartNfaWithStates_0(8, 36, 29); + break; + case 105: + return jjMoveStringLiteralDfa9_0(active0, 0x8000000000000L); + case 111: + return jjMoveStringLiteralDfa9_0(active0, 0x400000000L); + case 116: + if ((active0 & 0x80000000000000L) != 0L) + return jjStartNfaWithStates_0(8, 55, 29); + return jjMoveStringLiteralDfa9_0(active0, 0x100000000L); + default: + break; + } + return jjStartNfa_0(7, active0, 0L); + } + + private int jjMoveStringLiteralDfa9_0(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(7, old0, 0L); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_0(8, active0, 0L); + return 9; + } + switch (curChar) { + case 102: + if ((active0 & 0x400000000L) != 0L) + return jjStartNfaWithStates_0(9, 34, 29); + break; + case 115: + if ((active0 & 0x100000000L) != 0L) + return jjStartNfaWithStates_0(9, 32, 29); + break; + case 122: + return jjMoveStringLiteralDfa10_0(active0, 0x8000000000000L); + default: + break; + } + return jjStartNfa_0(8, active0, 0L); + } + + private int jjMoveStringLiteralDfa10_0(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(8, old0, 0L); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_0(9, active0, 0L); + return 10; + } + switch (curChar) { + case 101: + return jjMoveStringLiteralDfa11_0(active0, 0x8000000000000L); + default: + break; + } + return jjStartNfa_0(9, active0, 0L); + } + + private int jjMoveStringLiteralDfa11_0(long old0, long active0) { + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(9, old0, 0L); + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + jjStopStringLiteralDfa_0(10, active0, 0L); + return 11; + } + switch (curChar) { + case 100: + if ((active0 & 0x8000000000000L) != 0L) + return jjStartNfaWithStates_0(11, 51, 29); + break; + default: + break; + } + return jjStartNfa_0(10, active0, 0L); + } + + private void jjCheckNAdd(int state) { + if (jjrounds[state] != jjround) { + jjstateSet[jjnewStateCnt++] = state; + jjrounds[state] = jjround; + } + } + + private void jjAddStates(int start, int end) { + do { + jjstateSet[jjnewStateCnt++] = jjnextStates[start]; + } while (start++ != end); + } + + private void jjCheckNAddTwoStates(int state1, int state2) { + jjCheckNAdd(state1); + jjCheckNAdd(state2); + } + + private void jjCheckNAddStates(int start, int end) { + do { + jjCheckNAdd(jjnextStates[start]); + } while (start++ != end); + } + + private void jjCheckNAddStates(int start) { + jjCheckNAdd(jjnextStates[start]); + jjCheckNAdd(jjnextStates[start + 1]); + } + + static final long[] jjbitVec0 = { + 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL + }; + static final long[] jjbitVec2 = { + 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL + }; + static final long[] jjbitVec3 = { + 0xfff0000000200002L, 0xffffffffffffdfffL, 0xfffff00f7fffffffL, 0x12000000007fffffL + }; + static final long[] jjbitVec4 = { + 0x0L, 0x0L, 0x420043c00000000L, 0xff7fffffff7fffffL + }; + static final long[] jjbitVec5 = { + 0xffffcffffffffL, 0xffffffffffff0000L, 0xf9ff3fffffffffffL, 0x401f00030003L + }; + static final long[] jjbitVec6 = { + 0x0L, 0x400000000000000L, 0xfffffffbffffd740L, 0xffffffcff7fffL + }; + static final long[] jjbitVec7 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0xfffffffffffff003L, 0x33fffffffff199fL + }; + static final long[] jjbitVec8 = { + 0xfffe000000000000L, 0xfffffffe027fffffL, 0xffL, 0x707ffffff0000L + }; + static final long[] jjbitVec9 = { + 0x7fffffe00000000L, 0xfffe0000000007ffL, 0xffffffffffffffffL, 0x1c000060002fffffL + }; + static final long[] jjbitVec10 = { + 0x1ffffffd0000L, 0x0L, 0x3fffffffffL, 0x0L + }; + static final long[] jjbitVec11 = { + 0x23ffffffffffffe0L, 0x3ff010000L, 0x3c5fdfffff99fe0L, 0xf0003b0000000L + }; + static final long[] jjbitVec12 = { + 0x36dfdfffff987e0L, 0x1c00005e000000L, 0x23edfdfffffbafe0L, 0x100010000L + }; + static final long[] jjbitVec13 = { + 0x23cdfdfffff99fe0L, 0x3b0000000L, 0x3bfc718d63dc7e0L, 0x0L + }; + static final long[] jjbitVec14 = { + 0x3effdfffffddfe0L, 0x300000000L, 0x3effdfffffddfe0L, 0x340000000L + }; + static final long[] jjbitVec15 = { + 0x3fffdfffffddfe0L, 0x300000000L, 0x2ffbfffffc7fffe0L, 0x7fL + }; + static final long[] jjbitVec16 = { + 0x800dfffffffffffeL, 0x7fL, 0x200decaefef02596L, 0x3000005fL + }; + static final long[] jjbitVec17 = { + 0x1L, 0x7fffffffeffL, 0xf00L, 0x0L + }; + static final long[] jjbitVec18 = { + 0x6fbffffffffL, 0x3f0000L, 0xffffffff00000000L, 0x7fffffffff003fL + }; + static final long[] jjbitVec19 = { + 0xffffffffffffffffL, 0xffffffff83ffffffL, 0xffffff07ffffffffL, 0x3ffffffffffffffL + }; + static final long[] jjbitVec20 = { + 0xffffffffffffff7fL, 0xffffffff3d7f3d7fL, 0x7f3d7fffffff3d7fL, 0xffff7fffff7f7f3dL + }; + static final long[] jjbitVec21 = { + 0xffffffff7f3d7fffL, 0x7ffff7fL, 0xffffffff00000000L, 0x1fffffffffffffL + }; + static final long[] jjbitVec22 = { + 0xffffffffffffffffL, 0x7f9fffffffffffL, 0xffffffff07fffffeL, 0x7ffffffffffL + }; + static final long[] jjbitVec23 = { + 0x0L, 0x0L, 0xfffffffffffffL, 0x8000000L + }; + static final long[] jjbitVec24 = { + 0xffffffff00000000L, 0xffffffffffffffL, 0x1ffffffffffL, 0x0L + }; + static final long[] jjbitVec25 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffff0fffffffL, 0x3ffffffffffffffL + }; + static final long[] jjbitVec26 = { + 0xffffffff3f3fffffL, 0x3fffffffaaff3f3fL, 0x5fdfffffffffffffL, 0x1fdc1fff0fcf1fdcL + }; + static final long[] jjbitVec27 = { + 0x8000000000000000L, 0x8000000000000001L, 0xffff00000000L, 0x0L + }; + static final long[] jjbitVec28 = { + 0x3fbbd503e2ffc84L, 0xffffffff00000000L, 0xfL, 0x0L + }; + static final long[] jjbitVec29 = { + 0x73e03fe000000e0L, 0xfffffffffffffffeL, 0xfffffffe601fffffL, 0x7fffffffffffffffL + }; + static final long[] jjbitVec30 = { + 0xfffe1fffffffffe0L, 0xffffffffffffffffL, 0xffffff00007fffL, 0x0L + }; + static final long[] jjbitVec31 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0x3fffffffffffffL, 0x0L + }; + static final long[] jjbitVec32 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0x3fffffffffL, 0x0L + }; + static final long[] jjbitVec33 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0x1fffL, 0x0L + }; + static final long[] jjbitVec34 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0xfffffffffL, 0x0L + }; + static final long[] jjbitVec35 = { + 0x3fffffffffffL, 0x0L, 0x0L, 0x0L + }; + static final long[] jjbitVec36 = { + 0x5f7ffdffa0f8007fL, 0xffffffffffffffdbL, 0x3ffffffffffffL, 0xfffffffffff80000L + }; + static final long[] jjbitVec37 = { + 0x3fffffffffffffffL, 0xffffffffffff0000L, 0xfffffffffffcffffL, 0xfff0000000000ffL + }; + static final long[] jjbitVec38 = { + 0x18000000000000L, 0xffd702000000e000L, 0xffffffffffffffffL, 0x1fffffffffffffffL + }; + static final long[] jjbitVec39 = { + 0x87fffffe00000010L, 0xffffffe007fffffeL, 0x7fffffffffffffffL, 0x631cfcfcfcL + }; + static final long[] jjbitVec40 = { + 0x0L, 0x0L, 0x420043cffffffffL, 0xff7fffffff7fffffL + }; + static final long[] jjbitVec41 = { + 0xffffffffffffffffL, 0x400000700007fffL, 0xfffffffbffffd740L, 0xffffffcff7fffL + }; + static final long[] jjbitVec42 = { + 0xffffffffffffffffL, 0xffffffffffffffffL, 0xfffffffffffff07bL, 0x33fffffffff199fL + }; + static final long[] jjbitVec43 = { + 0xfffe000000000000L, 0xfffffffe027fffffL, 0xbbfffffbfffe00ffL, 0x707ffffff0016L + }; + static final long[] jjbitVec44 = { + 0x7fffffe00000000L, 0xffff03ff003fffffL, 0xffffffffffffffffL, 0x1fff3dff9fefffffL + }; + static final long[] jjbitVec45 = { + 0xffff1fffffff8000L, 0x7ffL, 0x1ffffffffffffL, 0x0L + }; + static final long[] jjbitVec46 = { + 0xf3ffffffffffffeeL, 0xffcfff1f3fffL, 0xd3c5fdfffff99feeL, 0xfffcfb080399fL + }; + static final long[] jjbitVec47 = { + 0xd36dfdfffff987e4L, 0x1fffc05e003987L, 0xf3edfdfffffbafeeL, 0xffc100013bbfL + }; + static final long[] jjbitVec48 = { + 0xf3cdfdfffff99feeL, 0xffc3b0c0398fL, 0xc3bfc718d63dc7ecL, 0xff8000803dc7L + }; + static final long[] jjbitVec49 = { + 0xc3effdfffffddfeeL, 0xffc300603ddfL, 0xc3effdfffffddfecL, 0xffc340603ddfL + }; + static final long[] jjbitVec50 = { + 0xc3fffdfffffddfecL, 0xffc300803dcfL, 0x2ffbfffffc7fffecL, 0xc0000ff5f847fL + }; + static final long[] jjbitVec51 = { + 0x87fffffffffffffeL, 0x3ff7fffL, 0x3bffecaefef02596L, 0x33ff3f5fL + }; + static final long[] jjbitVec52 = { + 0xc2a003ff03000001L, 0xfffe07fffffffeffL, 0x1ffffffffeff0fdfL, 0x40L + }; + static final long[] jjbitVec53 = { + 0x3c7f6fbffffffffL, 0x3ff03ffL, 0xffffffff00000000L, 0x7fffffffff003fL + }; + static final long[] jjbitVec54 = { + 0xffffffff7f3d7fffL, 0x3fe0007ffff7fL, 0xffffffff00000000L, 0x1fffffffffffffL + }; + static final long[] jjbitVec55 = { + 0x0L, 0x0L, 0xffffffffffffffffL, 0x3ff080fffffL + }; + static final long[] jjbitVec56 = { + 0xffffffff03ff7800L, 0xffffffffffffffL, 0x3ffffffffffL, 0x0L + }; + static final long[] jjbitVec57 = { + 0x80007c000000f000L, 0x8000fc0000000001L, 0xffff00000000L, 0x21fff0000L + }; + static final long[] jjbitVec58 = { + 0x73efffe000000e0L, 0xfffffffffffffffeL, 0xfffffffe661fffffL, 0x7fffffffffffffffL + }; + static final long[] jjbitVec59 = { + 0x5f7ffdffe0f8007fL, 0xffffffffffffffdbL, 0x3ffffffffffffL, 0xfffffffffff80000L + }; + static final long[] jjbitVec60 = { + 0x18000f00000000L, 0xffd702000000e000L, 0xffffffffffffffffL, 0x9fffffffffffffffL + }; + static final long[] jjbitVec61 = { + 0x87fffffe03ff0010L, 0xffffffe007fffffeL, 0x7fffffffffffffffL, 0xe0000631cfcfcfcL + }; + + private int jjMoveNfa_0(int startState, int curPos) { + int[] nextStates; + int startsAt = 0; + jjnewStateCnt = 71; + int i = 1; + jjstateSet[0] = startState; + int j, kind = 0x7fffffff; + for (; ;) { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) { + long l = 1L << curChar; + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 1: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(0, 6); + else if ((0x100003600L & l) != 0L) { + if (kind > 3) + kind = 3; + jjCheckNAdd(0); + } else if (curChar == 47) + jjAddStates(7, 8); + else if (curChar == 36) { + if (kind > 72) + kind = 72; + jjCheckNAdd(29); + } else if (curChar == 34) + jjCheckNAddStates(9, 11); + else if (curChar == 39) + jjAddStates(12, 13); + else if (curChar == 46) + jjCheckNAdd(5); + if ((0x3fe000000000000L & l) != 0L) { + if (kind > 61) + kind = 61; + jjCheckNAddTwoStates(2, 3); + } else if (curChar == 48) { + if (kind > 61) + kind = 61; + jjCheckNAddStates(14, 18); + } + break; + case 48: + if (curChar == 47) { + if (kind > 4) + kind = 4; + jjCheckNAddStates(19, 21); + } else if (curChar == 42) + jjstateSet[jjnewStateCnt++] = 46; + break; + case 0: + if ((0x100003600L & l) == 0L) + break; + if (kind > 3) + kind = 3; + jjCheckNAdd(0); + break; + case 2: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 61) + kind = 61; + jjCheckNAddTwoStates(2, 3); + break; + case 4: + if (curChar == 46) + jjCheckNAdd(5); + break; + case 5: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 65) + kind = 65; + jjCheckNAddStates(22, 24); + break; + case 7: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(8); + break; + case 8: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 65) + kind = 65; + jjCheckNAddTwoStates(8, 9); + break; + case 10: + if (curChar == 39) + jjAddStates(12, 13); + break; + case 11: + if ((0xffffff7fffffdbffL & l) != 0L) + jjCheckNAdd(12); + break; + case 12: + if (curChar == 39 && kind > 70) + kind = 70; + break; + case 14: + if ((0x8400000000L & l) != 0L) + jjCheckNAdd(12); + break; + case 15: + if ((0xff000000000000L & l) != 0L) + jjCheckNAddTwoStates(16, 12); + break; + case 16: + if ((0xff000000000000L & l) != 0L) + jjCheckNAdd(12); + break; + case 17: + if ((0xf000000000000L & l) != 0L) + jjstateSet[jjnewStateCnt++] = 18; + break; + case 18: + if ((0xff000000000000L & l) != 0L) + jjCheckNAdd(16); + break; + case 19: + if (curChar == 34) + jjCheckNAddStates(9, 11); + break; + case 20: + if ((0xfffffffbffffdbffL & l) != 0L) + jjCheckNAddStates(9, 11); + break; + case 22: + if ((0x8400000000L & l) != 0L) + jjCheckNAddStates(9, 11); + break; + case 23: + if (curChar == 34 && kind > 71) + kind = 71; + break; + case 24: + if ((0xff000000000000L & l) != 0L) + jjCheckNAddStates(25, 28); + break; + case 25: + if ((0xff000000000000L & l) != 0L) + jjCheckNAddStates(9, 11); + break; + case 26: + if ((0xf000000000000L & l) != 0L) + jjstateSet[jjnewStateCnt++] = 27; + break; + case 27: + if ((0xff000000000000L & l) != 0L) + jjCheckNAdd(25); + break; + case 28: + if (curChar != 36) + break; + if (kind > 72) + kind = 72; + jjCheckNAdd(29); + break; + case 29: + if ((0x3ff00100fffc1ffL & l) == 0L) + break; + if (kind > 72) + kind = 72; + jjCheckNAdd(29); + break; + case 30: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(0, 6); + break; + case 31: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(29, 31); + break; + case 33: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(34); + break; + case 34: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(34, 9); + break; + case 35: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(35, 36); + break; + case 37: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(38); + break; + case 38: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 65) + kind = 65; + jjCheckNAddTwoStates(38, 9); + break; + case 39: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(39, 40); + break; + case 40: + if (curChar != 46) + break; + if (kind > 65) + kind = 65; + jjCheckNAddStates(32, 34); + break; + case 41: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 65) + kind = 65; + jjCheckNAddStates(32, 34); + break; + case 43: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(44); + break; + case 44: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 65) + kind = 65; + jjCheckNAddTwoStates(44, 9); + break; + case 45: + if (curChar == 47) + jjAddStates(7, 8); + break; + case 46: + if (curChar == 42) + jjstateSet[jjnewStateCnt++] = 47; + break; + case 47: + if ((0xffff7fffffffffffL & l) != 0L && kind > 1) + kind = 1; + break; + case 49: + if (curChar != 47) + break; + if (kind > 4) + kind = 4; + jjCheckNAddStates(19, 21); + break; + case 50: + if ((0xffffffffffffdbffL & l) == 0L) + break; + if (kind > 4) + kind = 4; + jjCheckNAddStates(19, 21); + break; + case 51: + if ((0x2400L & l) != 0L && kind > 4) + kind = 4; + break; + case 52: + if (curChar == 10 && kind > 4) + kind = 4; + break; + case 53: + if (curChar == 13) + jjstateSet[jjnewStateCnt++] = 52; + break; + case 54: + if (curChar != 48) + break; + if (kind > 61) + kind = 61; + jjCheckNAddStates(14, 18); + break; + case 56: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 61) + kind = 61; + jjCheckNAddTwoStates(56, 3); + break; + case 57: + if ((0xff000000000000L & l) == 0L) + break; + if (kind > 61) + kind = 61; + jjCheckNAddTwoStates(57, 3); + break; + case 59: + if ((0x3ff000000000000L & l) != 0L) + jjAddStates(35, 36); + break; + case 60: + if (curChar == 46) + jjCheckNAdd(61); + break; + case 61: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(61, 62); + break; + case 63: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(64); + break; + case 64: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 65) + kind = 65; + jjCheckNAddTwoStates(64, 9); + break; + case 66: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(37, 39); + break; + case 67: + if (curChar == 46) + jjCheckNAdd(68); + break; + case 69: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(70); + break; + case 70: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 65) + kind = 65; + jjCheckNAddTwoStates(70, 9); + break; + default: + break; + } + } while (i != startsAt); + } else if (curChar < 128) { + long l = 1L << (curChar & 077); + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 1: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 72) + kind = 72; + jjCheckNAdd(29); + break; + case 3: + if ((0x100000001000L & l) != 0L && kind > 61) + kind = 61; + break; + case 6: + if ((0x2000000020L & l) != 0L) + jjAddStates(40, 41); + break; + case 9: + if ((0x5000000050L & l) != 0L && kind > 65) + kind = 65; + break; + case 11: + if ((0xffffffffefffffffL & l) != 0L) + jjCheckNAdd(12); + break; + case 13: + if (curChar == 92) + jjAddStates(42, 44); + break; + case 14: + if ((0x14404410000000L & l) != 0L) + jjCheckNAdd(12); + break; + case 20: + if ((0xffffffffefffffffL & l) != 0L) + jjCheckNAddStates(9, 11); + break; + case 21: + if (curChar == 92) + jjAddStates(45, 47); + break; + case 22: + if ((0x14404410000000L & l) != 0L) + jjCheckNAddStates(9, 11); + break; + case 29: + if ((0x87fffffe87fffffeL & l) == 0L) + break; + if (kind > 72) + kind = 72; + jjCheckNAdd(29); + break; + case 32: + if ((0x2000000020L & l) != 0L) + jjAddStates(48, 49); + break; + case 36: + if ((0x2000000020L & l) != 0L) + jjAddStates(50, 51); + break; + case 42: + if ((0x2000000020L & l) != 0L) + jjAddStates(52, 53); + break; + case 47: + if (kind > 1) + kind = 1; + break; + case 50: + if (kind > 4) + kind = 4; + jjAddStates(19, 21); + break; + case 55: + if ((0x100000001000000L & l) != 0L) + jjCheckNAdd(56); + break; + case 56: + if ((0x7e0000007eL & l) == 0L) + break; + if (kind > 61) + kind = 61; + jjCheckNAddTwoStates(56, 3); + break; + case 58: + if ((0x100000001000000L & l) != 0L) + jjCheckNAddTwoStates(59, 60); + break; + case 59: + if ((0x7e0000007eL & l) != 0L) + jjCheckNAddTwoStates(59, 60); + break; + case 61: + if ((0x7e0000007eL & l) != 0L) + jjAddStates(54, 55); + break; + case 62: + if ((0x1000000010000L & l) != 0L) + jjAddStates(56, 57); + break; + case 65: + if ((0x100000001000000L & l) != 0L) + jjCheckNAdd(66); + break; + case 66: + if ((0x7e0000007eL & l) != 0L) + jjCheckNAddStates(37, 39); + break; + case 68: + if ((0x1000000010000L & l) != 0L) + jjAddStates(58, 59); + break; + default: + break; + } + } while (i != startsAt); + } else { + int hiByte = (int) (curChar >> 8); + int i1 = hiByte >> 6; + long l1 = 1L << (hiByte & 077); + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 1: + if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) + break; + if (kind > 72) + kind = 72; + jjCheckNAdd(29); + break; + case 11: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjstateSet[jjnewStateCnt++] = 12; + break; + case 20: + if (jjCanMove_0(hiByte, i1, i2, l1, l2)) + jjAddStates(9, 11); + break; + case 29: + if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) + break; + if (kind > 72) + kind = 72; + jjCheckNAdd(29); + break; + case 47: + if (jjCanMove_0(hiByte, i1, i2, l1, l2) && kind > 1) + kind = 1; + break; + case 50: + if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) + break; + if (kind > 4) + kind = 4; + jjAddStates(19, 21); + break; + default: + break; + } + } while (i != startsAt); + } + if (kind != 0x7fffffff) { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 71 - (jjnewStateCnt = startsAt))) + return curPos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return curPos; + } + } + } + + private int jjMoveStringLiteralDfa0_2() { + switch (curChar) { + case 42: + return jjMoveStringLiteralDfa1_2(0x40L); + default: + return 1; + } + } + + private int jjMoveStringLiteralDfa1_2(long active0) { + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return 1; + } + switch (curChar) { + case 47: + if ((active0 & 0x40L) != 0L) + return jjStopAtPos(1, 6); + break; + default: + return 2; + } + return 2; + } + + private int jjMoveStringLiteralDfa0_1() { + switch (curChar) { + case 42: + return jjMoveStringLiteralDfa1_1(0x20L); + default: + return 1; + } + } + + private int jjMoveStringLiteralDfa1_1(long active0) { + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return 1; + } + switch (curChar) { + case 47: + if ((active0 & 0x20L) != 0L) + return jjStopAtPos(1, 5); + break; + default: + return 2; + } + return 2; + } + + static final int[] jjnextStates = { + 31, 32, 9, 35, 36, 39, 40, 48, 49, 20, 21, 23, 11, 13, 55, 57, + 3, 58, 65, 50, 51, 53, 5, 6, 9, 20, 21, 25, 23, 31, 32, 9, + 41, 42, 9, 59, 60, 66, 67, 68, 7, 8, 14, 15, 17, 22, 24, 26, + 33, 34, 37, 38, 43, 44, 61, 62, 63, 64, 69, 70, + }; + + private static boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) { + switch (hiByte) { + case 0: + return ((jjbitVec2[i2] & l2) != 0L); + default: + if ((jjbitVec0[i1] & l1) != 0L) + return true; + return false; + } + } + + private static boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2) { + switch (hiByte) { + case 0: + return ((jjbitVec4[i2] & l2) != 0L); + case 2: + return ((jjbitVec5[i2] & l2) != 0L); + case 3: + return ((jjbitVec6[i2] & l2) != 0L); + case 4: + return ((jjbitVec7[i2] & l2) != 0L); + case 5: + return ((jjbitVec8[i2] & l2) != 0L); + case 6: + return ((jjbitVec9[i2] & l2) != 0L); + case 7: + return ((jjbitVec10[i2] & l2) != 0L); + case 9: + return ((jjbitVec11[i2] & l2) != 0L); + case 10: + return ((jjbitVec12[i2] & l2) != 0L); + case 11: + return ((jjbitVec13[i2] & l2) != 0L); + case 12: + return ((jjbitVec14[i2] & l2) != 0L); + case 13: + return ((jjbitVec15[i2] & l2) != 0L); + case 14: + return ((jjbitVec16[i2] & l2) != 0L); + case 15: + return ((jjbitVec17[i2] & l2) != 0L); + case 16: + return ((jjbitVec18[i2] & l2) != 0L); + case 17: + return ((jjbitVec19[i2] & l2) != 0L); + case 18: + return ((jjbitVec20[i2] & l2) != 0L); + case 19: + return ((jjbitVec21[i2] & l2) != 0L); + case 20: + return ((jjbitVec0[i2] & l2) != 0L); + case 22: + return ((jjbitVec22[i2] & l2) != 0L); + case 23: + return ((jjbitVec23[i2] & l2) != 0L); + case 24: + return ((jjbitVec24[i2] & l2) != 0L); + case 30: + return ((jjbitVec25[i2] & l2) != 0L); + case 31: + return ((jjbitVec26[i2] & l2) != 0L); + case 32: + return ((jjbitVec27[i2] & l2) != 0L); + case 33: + return ((jjbitVec28[i2] & l2) != 0L); + case 48: + return ((jjbitVec29[i2] & l2) != 0L); + case 49: + return ((jjbitVec30[i2] & l2) != 0L); + case 77: + return ((jjbitVec31[i2] & l2) != 0L); + case 159: + return ((jjbitVec32[i2] & l2) != 0L); + case 164: + return ((jjbitVec33[i2] & l2) != 0L); + case 215: + return ((jjbitVec34[i2] & l2) != 0L); + case 250: + return ((jjbitVec35[i2] & l2) != 0L); + case 251: + return ((jjbitVec36[i2] & l2) != 0L); + case 253: + return ((jjbitVec37[i2] & l2) != 0L); + case 254: + return ((jjbitVec38[i2] & l2) != 0L); + case 255: + return ((jjbitVec39[i2] & l2) != 0L); + default: + if ((jjbitVec3[i1] & l1) != 0L) + return true; + return false; + } + } + + private static boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2) { + switch (hiByte) { + case 0: + return ((jjbitVec40[i2] & l2) != 0L); + case 2: + return ((jjbitVec5[i2] & l2) != 0L); + case 3: + return ((jjbitVec41[i2] & l2) != 0L); + case 4: + return ((jjbitVec42[i2] & l2) != 0L); + case 5: + return ((jjbitVec43[i2] & l2) != 0L); + case 6: + return ((jjbitVec44[i2] & l2) != 0L); + case 7: + return ((jjbitVec45[i2] & l2) != 0L); + case 9: + return ((jjbitVec46[i2] & l2) != 0L); + case 10: + return ((jjbitVec47[i2] & l2) != 0L); + case 11: + return ((jjbitVec48[i2] & l2) != 0L); + case 12: + return ((jjbitVec49[i2] & l2) != 0L); + case 13: + return ((jjbitVec50[i2] & l2) != 0L); + case 14: + return ((jjbitVec51[i2] & l2) != 0L); + case 15: + return ((jjbitVec52[i2] & l2) != 0L); + case 16: + return ((jjbitVec53[i2] & l2) != 0L); + case 17: + return ((jjbitVec19[i2] & l2) != 0L); + case 18: + return ((jjbitVec20[i2] & l2) != 0L); + case 19: + return ((jjbitVec54[i2] & l2) != 0L); + case 20: + return ((jjbitVec0[i2] & l2) != 0L); + case 22: + return ((jjbitVec22[i2] & l2) != 0L); + case 23: + return ((jjbitVec55[i2] & l2) != 0L); + case 24: + return ((jjbitVec56[i2] & l2) != 0L); + case 30: + return ((jjbitVec25[i2] & l2) != 0L); + case 31: + return ((jjbitVec26[i2] & l2) != 0L); + case 32: + return ((jjbitVec57[i2] & l2) != 0L); + case 33: + return ((jjbitVec28[i2] & l2) != 0L); + case 48: + return ((jjbitVec58[i2] & l2) != 0L); + case 49: + return ((jjbitVec30[i2] & l2) != 0L); + case 77: + return ((jjbitVec31[i2] & l2) != 0L); + case 159: + return ((jjbitVec32[i2] & l2) != 0L); + case 164: + return ((jjbitVec33[i2] & l2) != 0L); + case 215: + return ((jjbitVec34[i2] & l2) != 0L); + case 250: + return ((jjbitVec35[i2] & l2) != 0L); + case 251: + return ((jjbitVec59[i2] & l2) != 0L); + case 253: + return ((jjbitVec37[i2] & l2) != 0L); + case 254: + return ((jjbitVec60[i2] & l2) != 0L); + case 255: + return ((jjbitVec61[i2] & l2) != 0L); + default: + if ((jjbitVec3[i1] & l1) != 0L) + return true; + return false; + } + } + + public static final String[] jjstrLiteralImages = { + "", null, null, null, null, null, null, null, + "\141\142\163\164\162\141\143\164", "\141\163\163\145\162\164", "\142\157\157\154\145\141\156", + "\142\162\145\141\153", "\142\171\164\145", "\143\141\163\145", "\143\141\164\143\150", + "\143\150\141\162", "\143\154\141\163\163", "\143\157\156\163\164", + "\143\157\156\164\151\156\165\145", "\144\145\146\141\165\154\164", "\144\157", "\144\157\165\142\154\145", + "\145\154\163\145", "\145\156\165\155", "\145\170\164\145\156\144\163", "\146\141\154\163\145", + "\146\151\156\141\154", "\146\151\156\141\154\154\171", "\146\154\157\141\164", "\146\157\162", + "\147\157\164\157", "\151\146", "\151\155\160\154\145\155\145\156\164\163", + "\151\155\160\157\162\164", "\151\156\163\164\141\156\143\145\157\146", "\151\156\164", + "\151\156\164\145\162\146\141\143\145", "\154\157\156\147", "\156\141\164\151\166\145", "\156\145\167", + "\156\165\154\154", "\160\141\143\153\141\147\145", "\160\162\151\166\141\164\145", + "\160\162\157\164\145\143\164\145\144", "\160\165\142\154\151\143", "\162\145\164\165\162\156", + "\163\150\157\162\164", "\163\164\141\164\151\143", "\163\164\162\151\143\164\146\160", + "\163\165\160\145\162", "\163\167\151\164\143\150", + "\163\171\156\143\150\162\157\156\151\172\145\144", "\164\150\151\163", "\164\150\162\157\167", "\164\150\162\157\167\163", + "\164\162\141\156\163\151\145\156\164", "\164\162\165\145", "\164\162\171", "\166\157\151\144", + "\166\157\154\141\164\151\154\145", "\167\150\151\154\145", null, null, null, null, null, null, null, null, null, + null, null, null, null, null, "\50", "\51", "\173", "\175", "\133", "\135", "\73", + "\54", "\56", "\100", "\75", "\74", "\41", "\176", "\77", "\72", "\75\75", "\74\75", + "\76\75", "\41\75", "\174\174", "\46\46", "\53\53", "\55\55", "\53", "\55", "\52", + "\57", "\46", "\174", "\136", "\45", "\74\74", "\53\75", "\55\75", "\52\75", + "\57\75", "\46\75", "\174\75", "\136\75", "\45\75", "\74\74\75", "\76\76\75", + "\76\76\76\75", "\56\56\56", "\76\76\76", "\76\76", "\76", "\32", null,}; + public static final String[] lexStateNames = { + "DEFAULT", + "IN_FORMAL_COMMENT", + "IN_MULTI_LINE_COMMENT", + }; + public static final int[] jjnewLexState = { + -1, 1, 2, -1, -1, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + }; + static final long[] jjtoToken = { + 0x3fffffffffffff01L, 0x1ffffffffffff9c2L, + }; + static final long[] jjtoSkip = { + 0x78L, 0x0L, + }; + static final long[] jjtoSpecial = { + 0x78L, 0x0L, + }; + static final long[] jjtoMore = { + 0x86L, 0x0L, + }; + protected JavaCharStream input_stream; + private final int[] jjrounds = new int[71]; + private final int[] jjstateSet = new int[142]; + StringBuffer image; + int jjimageLen; + int lengthOfMatch; + protected char curChar; + + public JavaParserTokenManager(JavaCharStream stream) { + if (JavaCharStream.staticFlag) + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + input_stream = stream; + } + + public JavaParserTokenManager(JavaCharStream stream, int lexState) { + this(stream); + SwitchTo(lexState); + } + + public void ReInit(JavaCharStream stream) { + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); + } + + private void ReInitRounds() { + int i; + jjround = 0x80000001; + for (i = 71; i-- > 0;) + jjrounds[i] = 0x80000000; + } + + public void ReInit(JavaCharStream stream, int lexState) { + ReInit(stream); + SwitchTo(lexState); + } + + public void SwitchTo(int lexState) { + if (lexState >= 3 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; + } + + protected Token jjFillToken() { + Token t = Token.newToken(jjmatchedKind); + t.kind = jjmatchedKind; + String im = jjstrLiteralImages[jjmatchedKind]; + t.image = (im == null) ? input_stream.GetImage() : im; + t.beginLine = input_stream.getBeginLine(); + t.beginColumn = input_stream.getBeginColumn(); + t.endLine = input_stream.getEndLine(); + t.endColumn = input_stream.getEndColumn(); + return t; + } + + int curLexState = 0; + int defaultLexState = 0; + int jjnewStateCnt; + int jjround; + int jjmatchedPos; + int jjmatchedKind; + + public Token getNextToken() { + int kind; + Token specialToken = null; + Token matchedToken; + int curPos = 0; + + EOFLoop: + for (; ;) { + try { + curChar = input_stream.BeginToken(); + } + catch (java.io.IOException e) { + jjmatchedKind = 0; + matchedToken = jjFillToken(); + matchedToken.specialToken = specialToken; + return matchedToken; + } + image = null; + jjimageLen = 0; + + for (; ;) { + switch (curLexState) { + case 0: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_0(); + if (jjmatchedPos == 0 && jjmatchedKind > 124) { + jjmatchedKind = 124; + } + break; + case 1: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_1(); + if (jjmatchedPos == 0 && jjmatchedKind > 7) { + jjmatchedKind = 7; + } + break; + case 2: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_2(); + if (jjmatchedPos == 0 && jjmatchedKind > 7) { + jjmatchedKind = 7; + } + break; + } + if (jjmatchedKind != 0x7fffffff) { + if (jjmatchedPos + 1 < curPos) + input_stream.backup(curPos - jjmatchedPos - 1); + if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { + matchedToken = jjFillToken(); + matchedToken.specialToken = specialToken; + TokenLexicalActions(matchedToken); + if (jjnewLexState[jjmatchedKind] != -1) + curLexState = jjnewLexState[jjmatchedKind]; + return matchedToken; + } else + if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { + if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { + matchedToken = jjFillToken(); + if (specialToken == null) + specialToken = matchedToken; + else { + matchedToken.specialToken = specialToken; + specialToken = (specialToken.next = matchedToken); + } + SkipLexicalActions(matchedToken); + } else + SkipLexicalActions(null); + if (jjnewLexState[jjmatchedKind] != -1) + curLexState = jjnewLexState[jjmatchedKind]; + continue EOFLoop; + } + MoreLexicalActions(); + if (jjnewLexState[jjmatchedKind] != -1) + curLexState = jjnewLexState[jjmatchedKind]; + curPos = 0; + jjmatchedKind = 0x7fffffff; + try { + curChar = input_stream.readChar(); + continue; + } + catch (java.io.IOException e1) { + } + } + int error_line = input_stream.getEndLine(); + int error_column = input_stream.getEndColumn(); + String error_after = null; + boolean EOFSeen = false; + try { + input_stream.readChar(); + input_stream.backup(1); + } + catch (java.io.IOException e1) { + EOFSeen = true; + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + if (curChar == '\n' || curChar == '\r') { + error_line++; + error_column = 0; + } else + error_column++; + } + if (!EOFSeen) { + input_stream.backup(1); + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + } + throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); + } + } + } + + void SkipLexicalActions(Token matchedToken) { + switch (jjmatchedKind) { + default: + break; + } + } + + void MoreLexicalActions() { + jjimageLen += (lengthOfMatch = jjmatchedPos + 1); + switch (jjmatchedKind) { + case 1: + if (image == null) + image = new StringBuffer(); + image.append(input_stream.GetSuffix(jjimageLen)); + jjimageLen = 0; + input_stream.backup(1); + break; + default: + break; + } + } + + void TokenLexicalActions(Token matchedToken) { + switch (jjmatchedKind) { + case 120: + if (image == null) + image = new StringBuffer(); + image.append(jjstrLiteralImages[120]); + matchedToken.kind = GT; + ((Token.GTToken) matchedToken).realKind = RUNSIGNEDSHIFT; + input_stream.backup(2); + matchedToken.image = ">"; + break; + case 121: + if (image == null) + image = new StringBuffer(); + image.append(jjstrLiteralImages[121]); + matchedToken.kind = GT; + ((Token.GTToken) matchedToken).realKind = RSIGNEDSHIFT; + input_stream.backup(1); + matchedToken.image = ">"; + break; + default: + break; + } + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTreeConstants.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTreeConstants.java new file mode 100644 index 0000000..0ebbf26 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTreeConstants.java @@ -0,0 +1,230 @@ +/* Generated By:JJTree: Do not edit this line. ./JavaParserTreeConstants.java */ + +package jaxx.compiler.java.parser; + +public interface JavaParserTreeConstants { + public int JJTLINE = 0; + public int JJTCOMPILATIONUNIT = 1; + public int JJTPACKAGEDECLARATION = 2; + public int JJTIMPORTDECLARATION = 3; + public int JJTMODIFIERS = 4; + public int JJTTYPEDECLARATION = 5; + public int JJTCLASSORINTERFACEDECLARATION = 6; + public int JJTEXTENDSLIST = 7; + public int JJTIMPLEMENTSLIST = 8; + public int JJTENUMDECLARATION = 9; + public int JJTENUMBODY = 10; + public int JJTENUMCONSTANT = 11; + public int JJTTYPEPARAMETERS = 12; + public int JJTTYPEPARAMETER = 13; + public int JJTTYPEBOUND = 14; + public int JJTCLASSORINTERFACEBODY = 15; + public int JJTCLASSORINTERFACEBODYDECLARATION = 16; + public int JJTFIELDDECLARATION = 17; + public int JJTVARIABLEDECLARATOR = 18; + public int JJTVARIABLEDECLARATORID = 19; + public int JJTVARIABLEINITIALIZER = 20; + public int JJTARRAYINITIALIZER = 21; + public int JJTMETHODDECLARATION = 22; + public int JJTMETHODDECLARATOR = 23; + public int JJTFORMALPARAMETERS = 24; + public int JJTFORMALPARAMETER = 25; + public int JJTCONSTRUCTORDECLARATION = 26; + public int JJTEXPLICITCONSTRUCTORINVOCATION = 27; + public int JJTINITIALIZER = 28; + public int JJTTYPE = 29; + public int JJTREFERENCETYPE = 30; + public int JJTCLASSORINTERFACETYPE = 31; + public int JJTTYPEARGUMENTS = 32; + public int JJTTYPEARGUMENT = 33; + public int JJTWILDCARDBOUNDS = 34; + public int JJTPRIMITIVETYPE = 35; + public int JJTRESULTTYPE = 36; + public int JJTNAME = 37; + public int JJTNAMELIST = 38; + public int JJTEXPRESSION = 39; + public int JJTASSIGNMENTOPERATOR = 40; + public int JJTASSIGNMENTEXPRESSION = 41; + public int JJTCONDITIONALEXPRESSION = 42; + public int JJTCONDITIONALOREXPRESSION = 43; + public int JJTCONDITIONALANDEXPRESSION = 44; + public int JJTINCLUSIVEOREXPRESSION = 45; + public int JJTEXCLUSIVEOREXPRESSION = 46; + public int JJTANDEXPRESSION = 47; + public int JJTEQUALITYEXPRESSION = 48; + public int JJTINSTANCEOFEXPRESSION = 49; + public int JJTRELATIONALEXPRESSION = 50; + public int JJTSHIFTEXPRESSION = 51; + public int JJTADDITIVEEXPRESSION = 52; + public int JJTMULTIPLICATIVEEXPRESSION = 53; + public int JJTUNARYEXPRESSION = 54; + public int JJTPREINCREMENTEXPRESSION = 55; + public int JJTPREDECREMENTEXPRESSION = 56; + public int JJTUNARYEXPRESSIONNOTPLUSMINUS = 57; + public int JJTCASTLOOKAHEAD = 58; + public int JJTPOSTFIXEXPRESSION = 59; + public int JJTPOSTFIXOPERATOR = 60; + public int JJTCASTEXPRESSION = 61; + public int JJTPRIMARYEXPRESSION = 62; + public int JJTMEMBERSELECTOR = 63; + public int JJTPRIMARYPREFIX = 64; + public int JJTPRIMARYSUFFIX = 65; + public int JJTLITERAL = 66; + public int JJTBOOLEANLITERAL = 67; + public int JJTNULLLITERAL = 68; + public int JJTARGUMENTS = 69; + public int JJTARGUMENTLIST = 70; + public int JJTALLOCATIONEXPRESSION = 71; + public int JJTARRAYDIMSANDINITS = 72; + public int JJTSTATEMENT = 73; + public int JJTASSERTSTATEMENT = 74; + public int JJTLABELEDSTATEMENT = 75; + public int JJTBLOCK = 76; + public int JJTBLOCKSTATEMENT = 77; + public int JJTLOCALVARIABLEDECLARATION = 78; + public int JJTEMPTYSTATEMENT = 79; + public int JJTSTATEMENTEXPRESSION = 80; + public int JJTSWITCHSTATEMENT = 81; + public int JJTSWITCHLABEL = 82; + public int JJTIFSTATEMENT = 83; + public int JJTWHILESTATEMENT = 84; + public int JJTDOSTATEMENT = 85; + public int JJTFORSTATEMENT = 86; + public int JJTFORINIT = 87; + public int JJTSTATEMENTEXPRESSIONLIST = 88; + public int JJTFORUPDATE = 89; + public int JJTBREAKSTATEMENT = 90; + public int JJTCONTINUESTATEMENT = 91; + public int JJTRETURNSTATEMENT = 92; + public int JJTTHROWSTATEMENT = 93; + public int JJTSYNCHRONIZEDSTATEMENT = 94; + public int JJTTRYSTATEMENT = 95; + public int JJTRUNSIGNEDSHIFT = 96; + public int JJTRSIGNEDSHIFT = 97; + public int JJTANNOTATION = 98; + public int JJTNORMALANNOTATION = 99; + public int JJTMARKERANNOTATION = 100; + public int JJTSINGLEMEMBERANNOTATION = 101; + public int JJTMEMBERVALUEPAIRS = 102; + public int JJTMEMBERVALUEPAIR = 103; + public int JJTMEMBERVALUE = 104; + public int JJTMEMBERVALUEARRAYINITIALIZER = 105; + public int JJTANNOTATIONTYPEDECLARATION = 106; + public int JJTANNOTATIONTYPEBODY = 107; + public int JJTANNOTATIONTYPEMEMBERDECLARATION = 108; + public int JJTDEFAULTVALUE = 109; + + + public String[] jjtNodeName = { + "Line", + "CompilationUnit", + "PackageDeclaration", + "ImportDeclaration", + "Modifiers", + "TypeDeclaration", + "ClassOrInterfaceDeclaration", + "ExtendsList", + "ImplementsList", + "EnumDeclaration", + "EnumBody", + "EnumConstant", + "TypeParameters", + "TypeParameter", + "TypeBound", + "ClassOrInterfaceBody", + "ClassOrInterfaceBodyDeclaration", + "FieldDeclaration", + "VariableDeclarator", + "VariableDeclaratorId", + "VariableInitializer", + "ArrayInitializer", + "MethodDeclaration", + "MethodDeclarator", + "FormalParameters", + "FormalParameter", + "ConstructorDeclaration", + "ExplicitConstructorInvocation", + "Initializer", + "Type", + "ReferenceType", + "ClassOrInterfaceType", + "TypeArguments", + "TypeArgument", + "WildcardBounds", + "PrimitiveType", + "ResultType", + "Name", + "NameList", + "Expression", + "AssignmentOperator", + "AssignmentExpression", + "ConditionalExpression", + "ConditionalOrExpression", + "ConditionalAndExpression", + "InclusiveOrExpression", + "ExclusiveOrExpression", + "AndExpression", + "EqualityExpression", + "InstanceOfExpression", + "RelationalExpression", + "ShiftExpression", + "AdditiveExpression", + "MultiplicativeExpression", + "UnaryExpression", + "PreIncrementExpression", + "PreDecrementExpression", + "UnaryExpressionNotPlusMinus", + "CastLookahead", + "PostfixExpression", + "PostfixOperator", + "CastExpression", + "PrimaryExpression", + "MemberSelector", + "PrimaryPrefix", + "PrimarySuffix", + "Literal", + "BooleanLiteral", + "NullLiteral", + "Arguments", + "ArgumentList", + "AllocationExpression", + "ArrayDimsAndInits", + "Statement", + "AssertStatement", + "LabeledStatement", + "Block", + "BlockStatement", + "LocalVariableDeclaration", + "EmptyStatement", + "StatementExpression", + "SwitchStatement", + "SwitchLabel", + "IfStatement", + "WhileStatement", + "DoStatement", + "ForStatement", + "ForInit", + "StatementExpressionList", + "ForUpdate", + "BreakStatement", + "ContinueStatement", + "ReturnStatement", + "ThrowStatement", + "SynchronizedStatement", + "TryStatement", + "RUNSIGNEDSHIFT", + "RSIGNEDSHIFT", + "Annotation", + "NormalAnnotation", + "MarkerAnnotation", + "SingleMemberAnnotation", + "MemberValuePairs", + "MemberValuePair", + "MemberValue", + "MemberValueArrayInitializer", + "AnnotationTypeDeclaration", + "AnnotationTypeBody", + "AnnotationTypeMemberDeclaration", + "DefaultValue", + }; +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Node.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Node.java new file mode 100644 index 0000000..8c0f328 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Node.java @@ -0,0 +1,51 @@ +/* Generated By:JJTree: Do not edit this line. Node.java */ + +package jaxx.compiler.java.parser; + +/* All AST nodes must implement this interface. It provides basic + machinery for constructing the parent and child relationships + between nodes. */ + +public interface Node { + + /** + * This method is called after the node has been made the current + * node. It indicates that child nodes can now be added to it. + */ + public void jjtOpen(); + + /** + * This method is called after all the child nodes have been + * added. + */ + public void jjtClose(); + + /** + * This pair of methods are used to inform the node of its + * parent. + * + * @param n node + */ + public void jjtSetParent(Node n); + + public Node jjtGetParent(); + + /** + * This method tells the node to add its argument to the node's + * list of children. + * + * @param n node + * @param i index ? + */ + public void jjtAddChild(Node n, int i); + + /** + * @param i index of child + * @return a child node. The children are numbered + * from zero, left to right. + */ + public Node jjtGetChild(int i); + + /** @return the number of children the node has. */ + public int jjtGetNumChildren(); +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/ParseException.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/ParseException.java new file mode 100644 index 0000000..c445ecc --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/ParseException.java @@ -0,0 +1,214 @@ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */ +package jaxx.compiler.java.parser; + +/** + * This exception is thrown when parse errors are encountered. + * You can explicitly create objects of this exception type by + * calling the method generateParseException in the generated + * parser. + * <p/> + * You can modify this class to customize your error reporting + * mechanisms so long as you retain the public fields. + */ +public class ParseException extends jaxx.compiler.CompilerException { + int line; + int column; + private static final long serialVersionUID = 6179854408401024700L; + + /** + * This constructor is used by the method "generateParseException" + * in the generated parser. Calling this constructor generates + * a new object of this type with the fields "currentToken", + * "expectedTokenSequences", and "tokenImage" set. The boolean + * flag "specialConstructor" is also set to true to indicate that + * this constructor was used to create this object. + * This constructor calls its super class with the empty string + * to force the "toString" method of parent class "Throwable" to + * print the error message in the form: + * ParseException: <result of getMessage> + * + * @param currentTokenVal ? + * @param expectedTokenSequencesVal ? + * @param tokenImageVal ? + */ + public ParseException(Token currentTokenVal, + int[][] expectedTokenSequencesVal, + String[] tokenImageVal + ) { + super(""); + specialConstructor = true; + currentToken = currentTokenVal; + expectedTokenSequences = expectedTokenSequencesVal; + tokenImage = tokenImageVal; + } + + /** + * The following constructors are for use by you for whatever + * purpose you can think of. Constructing the exception in this + * manner makes the exception behave in the normal way - i.e., as + * documented in the class "Throwable". The fields "errorToken", + * "expectedTokenSequences", and "tokenImage" do not contain + * relevant information. The JavaCC generated code does not use + * these constructors. + */ + + public ParseException() { + super(); + specialConstructor = false; + } + + public ParseException(String message) { + super(message); + specialConstructor = false; + } + + public ParseException(String message, int line, int column) { + super(message); + specialConstructor = false; + this.line = line; + this.column = column; + } + + + /** + * This variable determines which constructor was used to create + * this object and thereby affects the semantics of the + * "getMessage" method (see below). + */ + protected boolean specialConstructor; + + /** + * This is the last token that has been consumed successfully. If + * this object has been created due to a parse error, the token + * followng this token will (therefore) be the first error token. + */ + public Token currentToken; + + /** + * Each entry in this array is an array of integers. Each array + * of integers represents a sequence of tokens (by their ordinal + * values) that is expected at this point of the parse. + */ + public int[][] expectedTokenSequences; + + /** + * This is a reference to the "tokenImage" array of the generated + * parser within which the parse error occurred. This array is + * defined in the generated ...Constants interface. + */ + public String[] tokenImage; + + /** + * This method has the standard behavior when this object has been + * created using the standard constructors. Otherwise, it uses + * "currentToken" and "expectedTokenSequences" to generate a parse + * error message and returns it. If this object has been created + * due to a parse error, and you do not catch it (it gets thrown + * from the parser), then this method is called during the printing + * of the final stack trace, and hence the correct error message + * gets displayed. + */ + public String getMessage() { + if (!specialConstructor) { + return super.getMessage(); + } + StringBuffer expected = new StringBuffer(); + int maxSize = 0; + for (int[] expectedTokenSequence : expectedTokenSequences) { + if (maxSize < expectedTokenSequence.length) { + maxSize = expectedTokenSequence.length; + } + for (int anExpectedTokenSequence : expectedTokenSequence) { + expected.append(tokenImage[anExpectedTokenSequence]).append(" "); + } + if (expectedTokenSequence[expectedTokenSequence.length - 1] != 0) { + expected.append("..."); + } + expected.append(eol).append(" "); + } + String retval = "Encountered \""; + Token tok = currentToken.next; + for (int i = 0; i < maxSize; i++) { + if (i != 0) retval += " "; + if (tok.kind == 0) { + retval += tokenImage[0]; + break; + } + retval += add_escapes(tok.image); + tok = tok.next; + } + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; + retval += "." + eol; + if (expectedTokenSequences.length == 1) { + retval += "Was expecting:" + eol + " "; + } else { + retval += "Was expecting one of:" + eol + " "; + } + retval += expected.toString(); + return retval; + } + + + public int getLine() { + return line; + } + + public int getColumn() { + return column; + } + + /** The end of line string for this machine. */ + protected String eol = System.getProperty("line.separator", "\n"); + + /** + * Used to convert raw characters to their escaped version + * when these raw version cannot be used as part of an ASCII + * string literal. + * + * @param str text to treate + * @return the escaped version of text + */ + protected String add_escapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) { + case 0: + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u").append(s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + } + } + return retval.toString(); + } + +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/SimpleNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/SimpleNode.java new file mode 100644 index 0000000..8aa287e --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/SimpleNode.java @@ -0,0 +1,135 @@ +/* Generated By:JJTree: Do not edit this line. SimpleNode.java */ + +package jaxx.compiler.java.parser; + +import jaxx.compiler.reflect.ClassDescriptor; + +public class SimpleNode implements Node { + protected Node parent; + protected Node[] children; + protected int id; + protected JavaParser parser; + public Token firstToken; + public Token lastToken; + private ClassDescriptor javaType; + + + public SimpleNode(int i) { + id = i; + } + + public SimpleNode(JavaParser p, int i) { + this(i); + parser = p; + } + + + public int getId() { + return id; + } + + public void jjtOpen() { + } + + public void jjtClose() { + } + + public void jjtSetParent(Node n) { + parent = n; + } + + public Node jjtGetParent() { + return parent; + } + + public SimpleNode getParent() { + return (SimpleNode) parent; + } + + + public ClassDescriptor getJavaType() { + return javaType; + } + + + public void setJavaType(ClassDescriptor javaType) { + this.javaType = javaType; + } + + public void jjtAddChild(Node n, int i) { + if (children == null) { + children = new Node[i + 1]; + } else if (i >= children.length) { + Node c[] = new Node[i + 1]; + System.arraycopy(children, 0, c, 0, children.length); + children = c; + } + children[i] = n; + } + + public Node jjtGetChild(int i) { + return children[i]; + } + + public SimpleNode getChild(int i) { + return (SimpleNode) children[i]; + } + + public int jjtGetNumChildren() { + return (children == null) ? 0 : children.length; + } + + /* You can override these two methods in subclasses of SimpleNode to +customize the way the node appears when the tree is dumped. If +your output uses more than one line you should override +toString(String), otherwise overriding toString() is probably all +you need to do. */ + + @Override + public String toString() { + return getClass().getName() + "[" + getText() + "]"; + } + + public String toString(String prefix) { + return prefix + toString(); + } + + /* Override this method if you want to customize how the node dumps + out its children. */ + + public void dump(String prefix) { + System.out.println(toString(prefix)); + if (children != null) { + for (Node aChildren : children) { + SimpleNode n = (SimpleNode) aChildren; + if (n != null) { + n.dump(prefix + " "); + } + } + } + } + + private void appendSpecialTokens(StringBuffer s, Token st) { + if (st != null) { + appendSpecialTokens(s, st.specialToken); + s.append(st.image); + } + } + + + /** @return the text of the tokens comprising this node. */ + public String getText() { + StringBuffer text = new StringBuffer(); + Token t = firstToken; + while (t != null) { + appendSpecialTokens(text, t.specialToken); + text.append(t.image); + if (t == lastToken) + break; + t = t.next; + } + + return text.toString(); + } +} + diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Token.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Token.java new file mode 100644 index 0000000..d84b252 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Token.java @@ -0,0 +1,79 @@ +/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */ +package jaxx.compiler.java.parser; + +/** Describes the input token stream. */ + +public class Token { + /** + * An integer that describes the kind of this token. This numbering + * system is determined by JavaCCParser, and a table of these numbers is + * stored in the file ...Constants.java. + */ + public int kind; + + /** + * beginLine and beginColumn describe the position of the first character + * of this token; endLine and endColumn describe the position of the + * last character of this token. + */ + public int beginLine, beginColumn, endLine, endColumn; + + /** The string image of the token. */ + public String image; + + /** + * A reference to the next regular (non-special) token from the input + * stream. If this is the last token from the input stream, or if the + * token manager has not read tokens beyond this one, this field is + * set to null. This is true only if this token is also a regular + * token. Otherwise, see below for a description of the contents of + * this field. + */ + public Token next; + + /** + * This field is used to access special tokens that occur prior to this + * token, but after the immediately preceding regular (non-special) token. + * If there are no such special tokens, this field is set to null. + * When there are more than one such special token, this field refers + * to the last of these special tokens, which in turn refers to the next + * previous special token through its specialToken field, and so on + * until the first special token (whose specialToken field is null). + * The next fields of special tokens refer to other special tokens that + * immediately follow it (without an intervening regular token). If there + * is no such token, this field is null. + */ + public Token specialToken; + + /** Returns the image. */ + public String toString() { + return image; + } + + /** + * Returns a new Token object, by default. However, if you want, you + * can create and return subclass objects based on the value of ofKind. + * Simply add the cases to the switch for all those special cases. + * For example, if you have a subclass of Token called IDToken that + * you want to create if ofKind is ID, simlpy add something like : + * <p/> + * case MyParserConstants.ID : return new IDToken(); + * <p/> + * to the following switch statement. Then you can cast matchedToken + * variable to the appropriate type and use it in your lexical actions. + */ + public static final Token newToken(int ofKind) { + switch (ofKind) { + default: + return new Token(); + case JavaParserConstants.RUNSIGNEDSHIFT: + case JavaParserConstants.RSIGNEDSHIFT: + case JavaParserConstants.GT: + return new GTToken(); + } + } + + public static class GTToken extends Token { + int realKind = JavaParserConstants.GT; + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/TokenMgrError.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/TokenMgrError.java new file mode 100644 index 0000000..ce97582 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/TokenMgrError.java @@ -0,0 +1,126 @@ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */ +package jaxx.compiler.java.parser; + +public class TokenMgrError extends Error { + /* + * Ordinals for various reasons why an Error of this type can be thrown. + */ + + /** Lexical error occured. */ + static final int LEXICAL_ERROR = 0; + + /** An attempt wass made to create a second instance of a static token manager. */ + static final int STATIC_LEXER_ERROR = 1; + + /** Tried to change to an invalid lexical state. */ + static final int INVALID_LEXICAL_STATE = 2; + + /** Detected (and bailed out of) an infinite loop in the token manager. */ + static final int LOOP_DETECTED = 3; + + /** + * Indicates the reason why the exception is thrown. It will have + * one of the above 4 values. + */ + int errorCode; + private static final long serialVersionUID = -9131500865453532454L; + + /** + * Replaces unprintable characters by their espaced (or unicode escaped) + * equivalents in the given string + * + * @param str text to treate + * @return the treated text + */ + protected static String addEscapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) { + case 0: + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u").append(s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + } + } + return retval.toString(); + } + + /** + * @param EOFSeen : indicates if EOF caused the lexicl error + * @param lexState : lexical state in which this error occured + * @param errorLine : line number when the error occured + * @param errorColumn : column number when the error occured + * @param errorAfter : prefix that was seen before this error occured + * @param curChar : the offending character + * Note: You can customize the lexical error message by modifying this method. + * @return a detailed message for the Error when it is thrown by the + * token manager to indicate a lexical error. + */ + protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { + return ("Lexical error at line " + + errorLine + ", column " + + errorColumn + ". Encountered: " + + (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int) curChar + "), ") + + "after : \"" + addEscapes(errorAfter) + "\""); + } + + /** + * You can also modify the body of this method to customize your error messages. + * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not + * of end-users concern, so you can return something like : + * <p/> + * "Internal Error : Please file a bug report .... " + * <p/> + * from this method for such cases in the release version of your parser. + */ + @Override + public String getMessage() { + return super.getMessage(); + } + + /* + * Constructors of various flavors follow. + */ + + public TokenMgrError() { + } + + public TokenMgrError(String message, int reason) { + super(message); + errorCode = reason; + } + + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { + this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java index 73a57b8..f2d890d 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java @@ -3,10 +3,10 @@ package jaxx.compiler.reflect; import jaxx.compiler.CompilerException; import jaxx.compiler.JAXXCompiler; import jaxx.compiler.JAXXEngine; -import jaxx.compiler.parser.java.JavaParser; -import jaxx.compiler.parser.java.JavaParserTreeConstants; -import jaxx.compiler.parser.java.ParseException; -import jaxx.compiler.parser.java.SimpleNode; +import jaxx.compiler.java.parser.JavaParser; +import jaxx.compiler.java.parser.JavaParserTreeConstants; +import jaxx.compiler.java.parser.ParseException; +import jaxx.compiler.java.parser.SimpleNode; import jaxx.compiler.tags.TagManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/ScriptInitializer.java b/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptInitializer.java similarity index 86% rename from jaxx-compiler/src/main/java/jaxx/compiler/ScriptInitializer.java rename to jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptInitializer.java index 7fd6d5b..106c519 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/ScriptInitializer.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptInitializer.java @@ -2,8 +2,10 @@ * Copyright 2006 Ethan Nicholas. All rights reserved. * Use is subject to license terms. */ -package jaxx.compiler; +package jaxx.compiler.script; +import jaxx.compiler.CompiledObject; +import jaxx.compiler.JAXXCompiler; import jaxx.compiler.reflect.ClassDescriptorLoader; /** diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/ScriptManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java similarity index 98% rename from jaxx-compiler/src/main/java/jaxx/compiler/ScriptManager.java rename to jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java index 85fc1cd..0a1697b 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/ScriptManager.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java @@ -1,8 +1,9 @@ -package jaxx.compiler; +package jaxx.compiler.script; -import jaxx.compiler.parser.java.JavaParser; -import jaxx.compiler.parser.java.JavaParserTreeConstants; -import jaxx.compiler.parser.java.SimpleNode; +import jaxx.compiler.*; +import jaxx.compiler.java.parser.JavaParser; +import jaxx.compiler.java.parser.JavaParserTreeConstants; +import jaxx.compiler.java.parser.SimpleNode; import jaxx.compiler.reflect.FieldDescriptor; import jaxx.compiler.reflect.MethodDescriptor; import jaxx.compiler.tags.TagManager; @@ -17,7 +18,7 @@ public class ScriptManager { private JAXXCompiler compiler; - ScriptManager(JAXXCompiler compiler) { + public ScriptManager(JAXXCompiler compiler) { this.compiler = compiler; } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java index 2f02f59..f87c585 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java @@ -23,6 +23,7 @@ import java.awt.event.FocusListener; import java.beans.IntrospectionException; import java.io.IOException; import java.lang.reflect.Field; +import jaxx.runtime.Util; import org.w3c.dom.Attr; import org.w3c.dom.NamedNodeMap; @@ -141,43 +142,43 @@ public class DefaultComponentHandler extends DefaultObjectHandler { return id + ".setLocation(" + id + ".getX(), " + valueCode + ");"; } if (name.equals("width")) { // need to optimize case when both width and height are being assigned - return "jaxx.runtime.Util.setComponentWidth(" + id + "," + valueCode + ");\n"; + return Util.class.getName() + ".setComponentWidth(" + id + "," + valueCode + ");"; } if (name.equals("height")) { - return "jaxx.runtime.Util.setComponentHeight(" + id + "," + valueCode + ");\n"; + return Util.class.getName() + ".setComponentHeight(" + id + "," + valueCode + ");"; } if (name.equals("font-face")) { - return "if (" + id + ".getFont() != null) " + id + ".setFont(new Font(" + valueCode + ", " + id + ".getFont().getStyle(), " + id + ".getFont().getSize()));"; + return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(new Font(" + valueCode + ", " + id + ".getFont().getStyle(), " + id + ".getFont().getSize()));\n}"; } if (name.equals("font-size")) { - return "if (" + id + ".getFont() != null) " + id + ".setFont(" + id + ".getFont().deriveFont((float) " + valueCode + "));"; + return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont((float) " + valueCode + "));\n}"; } if (name.equals("font-weight")) { if (valueCode.equals("\"bold\"")) { - return "if (" + id + ".getFont() != null) " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.BOLD));"; + return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.BOLD));\n}"; } if (valueCode.equals("\"normal\"")) { - return "if (" + id + ".getFont() != null) " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.BOLD));"; + return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.BOLD));\n}"; } if (!valueCode.startsWith("\"")) { - return "if (" + id + ".getFont() != null) { if ((" + valueCode + ").equals(\"bold\")) " + - id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.BOLD)); else " + - id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.BOLD)); }"; + return "if (" + id + ".getFont() != null) {\n if ((" + valueCode + ").equals(\"bold\")) {\n " + + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.BOLD));\n } else {\n " + + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.BOLD));\n }\n}"; } compiler.reportError("font-weight must be either \"normal\" or \"bold\", found " + valueCode); return ""; } if (name.equals("font-style")) { if (valueCode.equals("\"italic\"")) { - return "if (" + id + ".getFont() != null) " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.ITALIC));"; + return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.ITALIC));\n}"; } if (valueCode.equals("\"normal\"")) { - return "if (" + id + ".getFont() != null) " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.ITALIC));"; + return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.ITALIC));\n}"; } if (!valueCode.startsWith("\"")) { - return "if (" + id + ".getFont() != null) { if ((" + valueCode + ").equals(\"italic\")) " + - id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.ITALIC)); else " + - id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.ITALIC)); }"; + return "if (" + id + ".getFont() != null) {\n if ((" + valueCode + ").equals(\"italic\")) {\n " + + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.ITALIC));\n } else {\n " + + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.ITALIC));\n }\n}"; } compiler.reportError("font-style must be either \"normal\" or \"italic\", found " + valueCode); return ""; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java index df12ba3..d40e925 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java @@ -8,14 +8,14 @@ import jaxx.compiler.CompilerException; import jaxx.compiler.UnsupportedAttributeException; import jaxx.compiler.CompiledObject; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.io.JavaArgument; -import jaxx.compiler.io.JavaMethod; -import jaxx.compiler.StylesheetHelper; import jaxx.compiler.beans.JAXXBeanInfo; import jaxx.compiler.beans.JAXXEventSetDescriptor; import jaxx.compiler.beans.JAXXIntrospector; import jaxx.compiler.beans.JAXXPropertyDescriptor; -import jaxx.compiler.decorators.CompiledObjectDecorator; +import jaxx.compiler.css.StylesheetHelper; +import jaxx.compiler.CompiledObjectDecorator; +import jaxx.compiler.java.JavaArgument; +import jaxx.compiler.java.JavaMethod; import jaxx.compiler.reflect.ClassDescriptor; import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.compiler.reflect.FieldDescriptor; @@ -44,6 +44,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.WeakHashMap; +import jaxx.runtime.Util; /** * Default handler for class tags. Class tags are tags which represent instances of Java classes, @@ -290,7 +291,7 @@ public class DefaultObjectHandler implements TagHandler { result.append(code).append('.').append(eventInfo.addMethod).append("((").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(") jaxx.runtime.Util.getEventListener(").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(compiler.getJavaCode(methodName)).append("));\n"); if (eventInfo.modelName != null) { result.append(getAddMemberListenerCode(objectCode, dataBinding, "get" + org.apache.commons.lang.StringUtils.capitalize(eventInfo.modelName), - "jaxx.runtime.Util.getDataBindingUpdateListener(this , \"" + dataBinding + "\")", + Util.class.getName() + ".getDataBindingUpdateListener(this , \"" + dataBinding + "\")", compiler)); } return result.toString(); @@ -346,7 +347,7 @@ public class DefaultObjectHandler implements TagHandler { result.append("((").append(modelClassName).append(") $bindingSources.remove(\"").append(code).append("\")).").append(eventInfo.removeMethod).append("((").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(") jaxx.runtime.Util.getEventListener(").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(compiler.getJavaCode(methodName)).append("));\n"); if (eventInfo.modelName != null) { result.append(getRemoveMemberListenerCode(objectCode, dataBinding, "get" + org.apache.commons.lang.StringUtils.capitalize(eventInfo.modelName), - "jaxx.runtime.Util.getDataBindingUpdateListener(this, \"" + dataBinding + "\")", + Util.class.getName() + ".getDataBindingUpdateListener(this, \"" + dataBinding + "\")", compiler)); } return result.toString(); @@ -775,7 +776,7 @@ public class DefaultObjectHandler implements TagHandler { // check for data binding & remove if found JAXXObjectDescriptor jaxxObjectDescriptor = object.getObjectClass().getJAXXObjectDescriptor(); ComponentDescriptor root = jaxxObjectDescriptor.getComponentDescriptors()[0]; - object.appendInitializationCode(object.getJavaCode() + ".removeDataBinding(" + compiler.getJavaCode(root.getId() + "." + propertyName) + ");" + JAXXCompiler.getLineSeparator()); + object.appendInitializationCode(object.getJavaCode() + ".removeDataBinding(" + compiler.getJavaCode(root.getId() + "." + propertyName) + ");"); } object.addProperty(propertyName, stringValue); ClassDescriptor type = getPropertyType(object, propertyName, compiler); @@ -799,7 +800,8 @@ public class DefaultObjectHandler implements TagHandler { // have to set layout early, before children are added object.appendInitializationCode(getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler)); } - object.registerDataBinding(binding, propertyName, getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler), compiler); +// object.registerDataBinding(binding, propertyName, getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler), compiler); + compiler.registerDataBinding(binding, object.getId() + "." + propertyName, getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler)); } else { // no bindings, convert from string if (inline) { compiler.addInlineStyle(object, propertyName, false); @@ -1056,7 +1058,7 @@ public class DefaultObjectHandler implements TagHandler { * Compiles the child tags of the current tag. The default implementation invokes {@link #compileChildTagFirstPass} * for each child tag. * - * @param tag the tag whose children to compile + * @param tag the tag whose children to run * @param compiler the current <code>JAXXCompiler</code> * @throws CompilerException if a compilation error occurs * @throws IOException if an I/O error occurs @@ -1077,7 +1079,7 @@ public class DefaultObjectHandler implements TagHandler { * Compiles the child tags of the current tag. The default implementation invokes {@link #compileChildTagFirstPass} * for each child tag. * - * @param tag the tag whose children to compile + * @param tag the tag whose children to run * @param compiler the current <code>JAXXCompiler</code> * @throws CompilerException if a compilation error occurs * @throws IOException if an I/O error occurs @@ -1103,7 +1105,7 @@ public class DefaultObjectHandler implements TagHandler { * Compiles a child of the current tag. The default implementation calls {@link JAXXCompiler#compileFirstPass * JAXXCompiler.compileFirstPass}. * - * @param tag the child tag to compile + * @param tag the child tag to run * @param compiler the current <code>JAXXCompiler</code> * @throws CompilerException if a compilation error occurs * @throws IOException if an I/O error occurs @@ -1116,7 +1118,7 @@ public class DefaultObjectHandler implements TagHandler { * Compiles a child of the current tag. The default implementation calls {@link JAXXCompiler#compileFirstPass * JAXXCompiler.compileSecondPass}. * - * @param tag the child tag to compile + * @param tag the child tag to run * @param compiler the current <code>JAXXCompiler</code> * @throws CompilerException if a compilation error occurs * @throws IOException if an I/O error occurs diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java index db8cebc..a9685c4 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java @@ -7,12 +7,12 @@ package jaxx.compiler.tags; import jaxx.compiler.CompilerException; import jaxx.compiler.UnsupportedAttributeException; import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.parser.css.CSSParser; -import jaxx.compiler.parser.css.CSSParserConstants; -import jaxx.compiler.parser.css.CSSParserTreeConstants; +import jaxx.compiler.css.parser.CSSParser; +import jaxx.compiler.css.parser.CSSParserConstants; +import jaxx.compiler.css.parser.CSSParserTreeConstants; +import jaxx.compiler.css.parser.SimpleNode; import jaxx.runtime.css.Rule; import jaxx.runtime.css.Selector; -import jaxx.compiler.parser.css.SimpleNode; import jaxx.runtime.css.Stylesheet; import org.w3c.dom.Attr; import org.w3c.dom.Element; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java index 5d3f008..2b5e8ab 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java @@ -90,7 +90,7 @@ public class TagManager { /** * Maps a class tag to a specific <code>TagHandler</code>. When a tag representing the bean class is * encountered (either the class' simple name, if it is unambiguous, or its fully-qualified name), the specified - * <code>TagHandler</code> will be invoked to compile it. + * <code>TagHandler</code> will be invoked to run it. * * @param <T> * @param beanClass the class to associate with a <code>TagHandler</code> @@ -359,7 +359,7 @@ public class TagManager { * class could be found. * * @param name name to resolve - * @param compiler compile to use + * @param compiler run to use * @return the resolved fqn class name */ public static String resolveClassName(String name, JAXXCompiler compiler) { @@ -397,7 +397,7 @@ public class TagManager { // name uses a dollar sign instead of a dot (javax.swing.JPopupMenu$Separator). And there could be more than // one inner class -- it's possible to have com.mycompany.Outer$Inner$Innerer$Innerest. // - // The basic strategy is to start by treating the part before the last dot as a package name, as that is by far + // The basic strategy is to run by treating the part before the last dot as a package name, as that is by far // the most likely case. If we don't find the class there, change the last dot to a dollar sign and try again. // Suppose we have the tag <com.mycompany.Outer.Inner.Innerer.Innerest/>, matching the class above. Resolution // proceeds like this: diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java index 54a34a6..ade7f78 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java @@ -39,7 +39,9 @@ public class BeanValidatorHandler extends DefaultObjectHandler { public static final String ERROR_TABLE_MODEL_ATTRIBUTE = "errorTableModel"; public static final String ERROR_LIST_ATTRIBUTE = "errorList"; public static final String ERROR_TABLE_ATTRIBUTE = "errorTable"; + //TODO-TC20091024 should change this default value to errorListModel public static final String ERROR_LIST_MODEL_DEFAULT = "errors"; + //TODO-TC20091024 should change this default value to errorTableModel public static final String ERROR_TABLE_MODEL_DEFAULT = "errors2"; public static final String ERROR_LIST_DEFAULT = "errorList"; public static final String ERROR_TABLE_DEFAULT = "errorTable"; @@ -66,8 +68,8 @@ public class BeanValidatorHandler extends DefaultObjectHandler { @Override protected void compileChildTagFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - if (compiler.getConfiguration().isVerbose()) { - log.info(tag); + if (log.isDebugEnabled()) { + log.debug(tag); } if (!tag.getLocalName().equals(FieldValidatorHandler.TAG)) { compiler.reportError("tag '" + tag.getParentNode().getLocalName() + "' may only contain " + FieldValidatorHandler.TAG + " as children, but found : " + tag.getLocalName()); @@ -133,8 +135,8 @@ public class BeanValidatorHandler extends DefaultObjectHandler { @Override public void setAttribute(CompiledObject object, String propertyName, String stringValue, boolean inline, JAXXCompiler compiler) { - if (compiler.getConfiguration().isVerbose()) { - log.info(propertyName + " : " + stringValue + " for " + object); + if (log.isDebugEnabled()) { + log.debug(propertyName + " : " + stringValue + " for " + object); } // delegate to the compiled object with is statefull (but not the tag handler) object.addProperty(propertyName, stringValue); @@ -169,8 +171,8 @@ public class BeanValidatorHandler extends DefaultObjectHandler { super(id, getDescriptor(objectClass, compiler), compiler); fields = new TreeMap<String, String>(); excludeFields = new TreeMap<String, String>(); - if (compiler.getConfiguration().isVerbose()) { - log.info("validator objectClass " + super.getObjectClass()); + if (log.isDebugEnabled()) { + log.debug("validator objectClass " + super.getObjectClass()); } } @@ -394,7 +396,6 @@ public class BeanValidatorHandler extends DefaultObjectHandler { appendAdditionCode(code); return false; - } protected boolean addErrorTableModel(Element tag, BeanValidatorHandler handler, JAXXCompiler compiler) { @@ -597,8 +598,8 @@ public class BeanValidatorHandler extends DefaultObjectHandler { protected void registerAutoFieldBean(Element tag, JAXXCompiler compiler, JAXXBeanInfo beanInfo) { for (JAXXPropertyDescriptor beanProperty : beanInfo.getJAXXPropertyDescriptors()) { String descriptionName = beanProperty.getName(); - if (compiler.getConfiguration().isVerbose()) { - log.info("try to bind on bean " + beanInfo.getJAXXBeanDescriptor().getName() + " property " + descriptionName); + if (log.isDebugEnabled()) { + log.debug("try to bind on bean " + beanInfo.getJAXXBeanDescriptor().getName() + " property " + descriptionName); } if (beanProperty.getWriteMethodDescriptor() == null) { // read-only property @@ -633,8 +634,8 @@ public class BeanValidatorHandler extends DefaultObjectHandler { if (fields.containsKey(id)) { compiler.reportError("duplicate field '" + id + "' for validator " + this); } else { - if (compiler.getConfiguration().isVerbose()) { - log.info("add field <" + id + ":" + component + ">"); + if (log.isDebugEnabled()) { + log.debug("add field <" + id + ":" + component + ">"); } fields.put(id, component); } @@ -644,8 +645,8 @@ public class BeanValidatorHandler extends DefaultObjectHandler { if (excludeFields.containsKey(id)) { compiler.reportError("duplicate field '" + id + "' for validator " + this); } else { - if (compiler.getConfiguration().isVerbose()) { - log.info("add excludeField <" + id + ":" + component + ">"); + if (log.isDebugEnabled()) { + log.debug("add excludeField <" + id + ":" + component + ">"); } excludeFields.put(id, component); } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java index 3a4bf9c..7010970 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java @@ -27,7 +27,7 @@ public class FieldValidatorHandler implements TagHandler { @Override public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { if (compiler.getConfiguration().isVerbose()) { - log.info(tag); + log.debug(tag); } //todo check there is no child } @@ -35,7 +35,7 @@ public class FieldValidatorHandler implements TagHandler { @Override public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { if (compiler.getConfiguration().isVerbose()) { - log.info(tag); + log.debug(tag); } if (!ClassDescriptorLoader.getClassDescriptor(SwingValidator.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/ObjectHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/ObjectHandler.java index 7dbe946..273123c 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/ObjectHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/ObjectHandler.java @@ -1,6 +1,7 @@ package jaxx.compiler.tools.jaxxcapture.handlers; import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.java.JavaFileGenerator; import jaxx.compiler.tools.jaxxcapture.CapturedObject; import jaxx.compiler.tools.jaxxcapture.ContextNode; import jaxx.compiler.tools.jaxxcapture.JAXXCapture; @@ -16,7 +17,6 @@ import java.awt.Container; import java.lang.reflect.Field; import java.util.Map; import java.util.Stack; -import jaxx.compiler.io.JavaElement; public class ObjectHandler { private static int count; @@ -292,7 +292,7 @@ public class ObjectHandler { } result.append(" <script>"); result.append(lineSeparator); - result.append(JavaElement.indent(script, 4, false, lineSeparator)); + result.append(JavaFileGenerator.indent(script, 4, false, lineSeparator)); result.append(lineSeparator); result.append(" </script>"); result.append(lineSeparator); @@ -314,7 +314,7 @@ public class ObjectHandler { String lineSeparator = JAXXCompiler.getLineSeparator(); for (CapturedObject aChildren : children) { if (!aChildren.isInlineable()) { - result.append(JavaElement.indent(aChildren.getXML(capture), 2, false, lineSeparator)); + result.append(JavaFileGenerator.indent(aChildren.getXML(capture), 2, false, lineSeparator)); result.append(lineSeparator); } } diff --git a/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.decorators.CompiledObjectDecorator b/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.CompiledObjectDecorator similarity index 100% rename from jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.decorators.CompiledObjectDecorator rename to jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.CompiledObjectDecorator diff --git a/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.JAXXCompilerFinalizer b/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.JAXXCompilerFinalizer new file mode 100644 index 0000000..abb8df4 --- /dev/null +++ b/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.JAXXCompilerFinalizer @@ -0,0 +1,3 @@ +jaxx.compiler.finalizers.DefaultFinalizer +jaxx.compiler.finalizers.SwingFinalizer +jaxx.compiler.finalizers.ValidatorFinalizer diff --git a/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.generators.Generator b/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.generators.Generator deleted file mode 100644 index 761f3bd..0000000 --- a/jaxx-compiler/src/main/resources/META-INF/services/jaxx.compiler.generators.Generator +++ /dev/null @@ -1,3 +0,0 @@ -jaxx.compiler.generators.JAXXObjectGenerator -jaxx.compiler.generators.SwingGenerator -jaxx.compiler.generators.ValidatorGenerator diff --git a/jaxx-compiler/src/test/java/jaxx/compiler/JavaMethodTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/JavaMethodTest.java index 7d45659..1e25425 100644 --- a/jaxx-compiler/src/test/java/jaxx/compiler/JavaMethodTest.java +++ b/jaxx-compiler/src/test/java/jaxx/compiler/JavaMethodTest.java @@ -1,7 +1,7 @@ package jaxx.compiler; -import jaxx.compiler.io.JavaMethod; -import jaxx.compiler.io.JavaMethod.MethodOrder; +import jaxx.compiler.java.JavaMethod; +import jaxx.compiler.java.JavaMethod.MethodOrder; import org.junit.Assert; import org.junit.Test; diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java index 91e7048..870050b 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java @@ -18,11 +18,12 @@ *##%*/ package org.nuiton.jaxx.plugin; +import java.util.List; import jaxx.compiler.CompilerConfiguration; import jaxx.compiler.JAXXCompiler; import jaxx.compiler.JAXXEngine; import jaxx.compiler.beans.BeanInfoUtil; -import jaxx.compiler.decorators.CompiledObjectDecorator; +import jaxx.compiler.CompiledObjectDecorator; import jaxx.compiler.decorators.HelpRootCompiledObjectDecorator; import jaxx.compiler.tags.TagManager; import jaxx.runtime.JAXXContext; @@ -37,6 +38,7 @@ import java.io.File; import java.io.IOException; import java.util.Map; import java.net.URL; +import java.net.URLClassLoader; import java.util.Arrays; import java.util.HashMap; import java.util.Set; @@ -398,14 +400,12 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat TagManager.reset(verbose); engine = JAXXEngine.newLaunchor(src, files, this); -// JAXXEngine engine; -// engine = JAXXEngine.newLaunchor(src, files, this); - boolean success = engine.compile(); - getLog().info("Generated " + engine.getCompilerCount() + " file(s). "); - + boolean success = engine.run(); + report(engine); if (!success) { throw new MojoExecutionException("Aborting due to errors reported by jaxxc"); } + getLog().info("Generated " + engine.getCompilerCount() + " file(s). "); if (generateHelp) { // generate help @@ -520,7 +520,7 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat public JAXXEngine getEngine() { return engine; } - + @Override public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); @@ -529,7 +529,7 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat protected void fixCompileSourceRoots() { if (project == null) { // no project defined, can not fix anything - // this case could appears if we wanted to do some tests of the plugin + // this case could appear if we wanted to do some tests of the plugin return; } @@ -544,7 +544,7 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat getLog().info(toString()); getLog().info("includes : " + Arrays.toString(includes)); for (String file : files) { - getLog().info("will generate " + file); + getLog().info("will parse " + file); } ClassLoader threadLoader = Thread.currentThread().getContextClassLoader(); @@ -561,6 +561,10 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat } catch (Exception e) { getLog().warn("??? : " + e.getMessage(), e); } + } else if (threadLoader instanceof URLClassLoader) { + for (URL u : ((URLClassLoader) threadLoader).getURLs()) { + getLog().info("url in class loader " + u); + } } } @@ -600,4 +604,25 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat } return txt; } + + protected void report(JAXXEngine engine) { + List<String> warnings = engine.getWarnings(); + if (!warnings.isEmpty()) { + StringBuilder buffer = new StringBuilder("JAXX detects " + (warnings.size() == 1 ? "1 warning" : warnings.size() + " warnings")); + buffer.append(" :"); + for (String s : warnings) { + buffer.append("\n").append(s); + } + getLog().warn(buffer.toString()); + } + List<String> errors = engine.getErrors(); + if (!errors.isEmpty()) { + StringBuilder buffer = new StringBuilder("JAXX detects " + (errors.size() == 1 ? "1 error" : errors.size() + " errors")); + buffer.append(" :"); + for (String s : errors) { + buffer.append("\n").append(s); + } + getLog().error(buffer.toString()); + } + } } diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java index 37f199b..d01c3d5 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java @@ -1,14 +1,10 @@ package org.nuiton.jaxx.plugin; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.JAXXEngine; import jaxx.runtime.context.DefaultJAXXContext; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.SystemStreamLog; import java.io.File; -import java.lang.reflect.Field; -import java.util.Map; import org.junit.Test; import static org.junit.Assert.*; @@ -123,11 +119,6 @@ public class CompilerTest extends JaxxBaseTest { //do nothing } }); - Field fieldCompilers = JAXXEngine.class.getDeclaredField("compilers"); - Field fieldErrorCount = JAXXEngine.class.getDeclaredField("errorCount"); - - fieldCompilers.setAccessible(true); - fieldErrorCount.setAccessible(true); // execute mjo on each jaxx file to produce the error for (String file : mojo.files) { @@ -140,12 +131,7 @@ public class CompilerTest extends JaxxBaseTest { } catch (MojoExecutionException e) { // ok jaxx compiler failed assertTrue(true); - - JAXXEngine launchor = mojo.getEngine(); - Map<String, JAXXCompiler> compilers = (Map<String, JAXXCompiler>) fieldCompilers.get(launchor); - assertEquals(1, compilers.size()); - Integer nberrors = (Integer) fieldErrorCount.get(launchor); - assertTrue(nberrors != null && nberrors > 0); + assertError(mojo.getEngine(), file, 1); } } } diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java index dba524a..12201aa 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java @@ -1,11 +1,8 @@ package org.nuiton.jaxx.plugin; -import jaxx.compiler.JAXXEngine; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.SystemStreamLog; -import java.lang.reflect.Field; -import java.util.Map; import org.junit.Test; @@ -29,6 +26,7 @@ public class CompilerValidatorTest extends JaxxBaseTest { String[] files = mojo.files; assertNumberJaxxFiles(19); mojo.setLog(new SystemStreamLog() { + @Override public boolean isErrorEnabled() { return false; @@ -49,11 +47,6 @@ public class CompilerValidatorTest extends JaxxBaseTest { //do nothing } }); - Field fieldCompilers = JAXXEngine.class.getDeclaredField("compilers"); - Field fieldErrorCount = JAXXEngine.class.getDeclaredField("errorCount"); - - fieldCompilers.setAccessible(true); - fieldErrorCount.setAccessible(true); // execute mjo on each jaxx file to produce the error for (String file : files) { @@ -66,13 +59,8 @@ public class CompilerValidatorTest extends JaxxBaseTest { } catch (MojoExecutionException e) { // ok jaxx compiler failed assertTrue(true); - JAXXEngine launchor = mojo.getEngine(); - Map<String, Compiler> compilers = (Map<String, Compiler>) fieldCompilers.get(launchor); - assertEquals(1, compilers.size()); - Integer nberrors = (Integer) fieldErrorCount.get(launchor); - assertEquals(1, nberrors.intValue()); + assertError(mojo.getEngine(), file, 1); } } } - -} \ No newline at end of file +} diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java index f4e3b9f..9b0e6b5 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java @@ -1,11 +1,7 @@ package org.nuiton.jaxx.plugin; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.JAXXEngine; import org.apache.maven.plugin.MojoExecutionException; -import java.lang.reflect.Field; -import java.util.Map; import org.apache.maven.plugin.logging.SystemStreamLog; import org.junit.Test; @@ -66,12 +62,6 @@ public class Evolution74Test extends JaxxBaseTest { //do nothing } }); - Field fieldCompilers = JAXXEngine.class.getDeclaredField("compilers"); - Field fieldErrorCount = JAXXEngine.class.getDeclaredField("errorCount"); - - fieldCompilers.setAccessible(true); - fieldErrorCount.setAccessible(true); - // execute mjo on each jaxx file to produce the error for (String file : mojo.files) { @@ -84,12 +74,7 @@ public class Evolution74Test extends JaxxBaseTest { } catch (MojoExecutionException e) { // ok jaxx compiler failed assertTrue(true); - - JAXXEngine launchor = mojo.getEngine(); - Map<String, JAXXCompiler> compilers = (Map<String, JAXXCompiler>) fieldCompilers.get(launchor); - assertEquals(1, compilers.size()); - Integer nberrors = (Integer) fieldErrorCount.get(launchor); - assertTrue(nberrors != null && nberrors > 0); + assertError(mojo.getEngine(), file, 1); } } } diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java index 7d03c51..3fd3160 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java @@ -5,6 +5,11 @@ import org.nuiton.util.FileUtil; import java.io.File; import java.io.IOException; +import java.lang.reflect.Field; +import java.util.List; +import java.util.Map; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.JAXXEngine; import org.nuiton.plugin.AbstractMojoTest; import static org.junit.Assert.*; @@ -19,6 +24,8 @@ import static org.junit.Assert.*; */ public abstract class JaxxBaseTest extends AbstractMojoTest<GenerateMojo> { + private Field fieldCompilers; + @Override protected String getGoalName(String methodName) { return "generate"; @@ -59,4 +66,18 @@ public abstract class JaxxBaseTest extends AbstractMojoTest<GenerateMojo> { assertEquals(expectedNbFiles, getMojo().files.length); } } + + @SuppressWarnings("unchecked") + protected void assertError(JAXXEngine engine, String file, int nbCompiler) throws Exception { + if (fieldCompilers == null) { + fieldCompilers = JAXXEngine.class.getDeclaredField("compilers"); + fieldCompilers.setAccessible(true); + } + + Map<String, JAXXCompiler> compilers = (Map<String, JAXXCompiler>) fieldCompilers.get(engine); + assertEquals(nbCompiler, compilers.size()); + List<String> errors = engine.getErrors(); + //Integer nberrors = (Integer) fieldErrorCount.get(launchor); + assertTrue("should have found at least one error for " + file, errors != null && !errors.isEmpty()); + } } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit e142a7a6a1fa7306253dd9bedbd3041908f55833 Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 26 02:36:35 2009 +0000 remove commented unused code --- .../src/main/java/jaxx/compiler/script/ScriptManager.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java index 0a1697b..9db1829 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java @@ -49,7 +49,6 @@ public class ScriptManager { script = trimScript(script); StringBuffer result = new StringBuffer(); JavaParser p = new JavaParser(new StringReader(script)); - //JavaParser p = new JavaParser(new StringReader(script + ";")); while (!p.Line()) { SimpleNode node = p.popNode(); if (node != null) { @@ -186,7 +185,6 @@ public class ScriptManager { } compiler.appendBodyCode(modifiers + " " + node.getText().substring(0, node.getText().length() - 1) + code + "}"); - //compiler.bodyCode.append(";\n"); } private void scanScriptNode(SimpleNode node) throws CompilerException { @@ -239,7 +237,6 @@ public class ScriptManager { } } compiler.appendBodyCode(node.getText()); - //compiler.bodyCode.append(";\n"); compiler.addScriptMethod(new MethodDescriptor(name, Modifier.PUBLIC, returnType, parameterTypes.toArray(new String[parameterTypes.size()]), compiler.getClassLoader())); } else if (nodeType == JavaParserTreeConstants.JJTCLASSORINTERFACEDECLARATION || nodeType == JavaParserTreeConstants.JJTINITIALIZER) { @@ -248,7 +245,6 @@ public class ScriptManager { str += ";"; } compiler.appendBodyCode(str); - //compiler.bodyCode.append(";\n"); } else if (nodeType == JavaParserTreeConstants.JJTCONSTRUCTORDECLARATION) { processConstructor(node.getChild(0).getChild(0).getText(), node.getChild(0).getChild(1)); } else if (nodeType == JavaParserTreeConstants.JJTLOCALVARIABLEDECLARATION || nodeType == JavaParserTreeConstants.JJTFIELDDECLARATION) { @@ -276,7 +272,6 @@ public class ScriptManager { String type = TagManager.resolveClassName(className, compiler); compiler.addScriptField(new FieldDescriptor(name, Modifier.PUBLIC, type, compiler.getClassLoader())); // TODO: determine the actual modifiers if (equals != -1 && !isFinal && !isStatic) { // declare the field in the class body, but wait to actually initialize it - //compiler.bodyCode.append(text.substring(0, equals).trim()); compiler.appendBodyCode(text.substring(0, equals).trim() + ";"); String initializer = text.substring(equals + 1).trim(); if (type.endsWith("[]")) { @@ -294,7 +289,6 @@ public class ScriptManager { compiler.appendBodyCode(text); } compiler.appendBodyCode("\n"); - //compiler.bodyCode.append(";\n"); } else { String text = node.getText().trim(); if (text.length() > 0) { @@ -302,14 +296,12 @@ public class ScriptManager { text += ";"; } compiler.appendInitializerCode(text); - //compiler.initializer.append(";\n"); } } } public void registerScript(String script) throws CompilerException { JavaParser p = new JavaParser(new StringReader(script)); - //JavaParser p = new JavaParser(new StringReader(script + ";")); while (!p.Line()) { SimpleNode node = p.popNode(); if (node != null) { -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit f0c338a9532b1770514a9026245a2790b5a055ad Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 26 02:40:51 2009 +0000 remove commented unused code clean code --- .../java/jaxx/compiler/css/StylesheetHelper.java | 154 ++------------------- 1 file changed, 14 insertions(+), 140 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java index 9a25d46..b460201 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java @@ -158,70 +158,6 @@ public class StylesheetHelper { } catch (NoSuchMethodException e) { compiler.reportError("mouseover pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); } - - /*if (pseudoClass.equals("mouseover")) { - try { - MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); - object.addEventHandler("style." + pseudoClass + ".add", addMouseListener, - ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseEntered", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), - propertyCode, compiler); - } - catch (NoSuchMethodException e) { - compiler.reportError("mouseover pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); - } - } else if (pseudoClass.equals("mouseout")) { - try { - MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); - object.addEventHandler("style." + pseudoClass + ".add", addMouseListener, - ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseExited", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), - propertyCode, compiler); - compiler.appendInitDataBindings("{" + propertyCode + "}"); - } - catch (NoSuchMethodException e) { - compiler.reportError("mouseout pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); - } - } else if (pseudoClass.equals("mousedown")) { - try { - MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); - object.addEventHandler("style." + pseudoClass + ".add", addMouseListener, - ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mousePressed", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), - propertyCode, compiler); - } - catch (NoSuchMethodException e) { - compiler.reportError("mousedown pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); - } - } else if (pseudoClass.equals("mouseup")) { - try { - MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); - object.addEventHandler("style." + pseudoClass + ".add", addMouseListener, - ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseReleased", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), - propertyCode, compiler); - compiler.appendInitDataBindings("{" + propertyCode + "}"); - } - catch (NoSuchMethodException e) { - compiler.reportError("mouseup pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); - } - } else if (pseudoClass.startsWith("{")) { - pseudoClass = pseudoClass.substring(1, pseudoClass.length() - 1).trim(); - pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode()); - String dest = object.getId() + ".style." + pseudoClass + ".add"; - String destCode = TypeManager.getJavaCode(dest); - if (compiler.hasProcessDataBinding()) { - compiler.appendProcessDataBinding("else "); - } - compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + pseudoClass + ") { "+ propertyCode + "} }"); - new DataSource(dest, pseudoClass, compiler).compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + destCode + ")"); - compiler.appendInitDataBindings("applyDataBinding("+ destCode + ");"); - } else - throw new IllegalArgumentException("unrecognized pseudoclass: " + pseudoClass);*/ } public static void compilePseudoClassRemove(String pseudoClass, CompiledObject object, String propertyCode, JAXXCompiler compiler) throws CompilerException { @@ -268,69 +204,6 @@ public class StylesheetHelper { } catch (NoSuchMethodException e) { compiler.reportError("mouseover pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); } - - /*if (pseudoClass.equals("mouseover")) { - try { - MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); - object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener, - ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseExited", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), - propertyCode, compiler); - } - catch (NoSuchMethodException e) { - compiler.reportError("mouseover pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); - } - } else if (pseudoClass.equals("mouseout")) { - try { - MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); - object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener, - ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseEntered", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), - propertyCode, compiler); - } - catch (NoSuchMethodException e) { - compiler.reportError("mouseout pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); - } - } else if (pseudoClass.equals("mousedown")) { - try { - MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); - object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener, - ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mouseReleased", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), - propertyCode, compiler); - } - catch (NoSuchMethodException e) { - compiler.reportError("mousedown pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); - } - } else if (pseudoClass.equals("mouseup")) { - try { - MethodDescriptor addMouseListener = object.getObjectClass().getMethodDescriptor("addMouseListener", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseListener.class)}); - object.addEventHandler("style." + pseudoClass + ".remove", addMouseListener, - ClassDescriptorLoader.getClassDescriptor(MouseListener.class).getMethodDescriptor("mousePressed", - new ClassDescriptor[]{ClassDescriptorLoader.getClassDescriptor(MouseEvent.class)}), - propertyCode, compiler); - } - catch (NoSuchMethodException e) { - compiler.reportError("mouseup pseudoclass cannot be applied to object " + object.getObjectClass().getName() + " (no addMouseListener method)"); - } - } else if (pseudoClass.startsWith("{")) { - pseudoClass = pseudoClass.substring(1, pseudoClass.length() - 1).trim(); - pseudoClass = replaceObjectReferences(pseudoClass, object.getJavaCode()); - String dest = object.getId() + ".style." + pseudoClass + ".remove"; - String destCode = TypeManager.getJavaCode(dest); - if (compiler.hasProcessDataBinding()) { - compiler.appendProcessDataBinding("else "); - } - compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + invert(pseudoClass) + ") { " + propertyCode + "} }"); - new DataSource(dest, pseudoClass, compiler).compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + destCode + ")"); - compiler.appendInitDataBindings("applyDataBinding(" + destCode + ");"); - } else { - throw new IllegalArgumentException("unrecognized pseudoclass: " + pseudoClass); - }*/ } public static String invert(String javaCode) { @@ -366,9 +239,10 @@ public class StylesheetHelper { pseudoClass = pseudoClass.substring(0, pseudoClass.indexOf("[")); } final StringBuffer buffer = new StringBuffer(); - + DefaultObjectHandler handler = TagManager.getTagHandler(object.getObjectClass()); boolean valueDeclared = false; + String eol = JAXXCompiler.getLineSeparator(); for (Map.Entry<String, String> e : properties.entrySet()) { String property = e.getKey(); ClassDescriptor type = handler.getPropertyType(object, property, compiler); @@ -376,8 +250,8 @@ public class StylesheetHelper { String valueCode; if (dataBinding != null) { valueCode = "new jaxx.runtime.css.DataBinding(" + compiler.getJavaCode(object.getId() + "." + property + "." + priority) + ")"; - new DataBinding(dataBinding, object.getId() + "." + property + "." + priority, handler.getSetPropertyCode(object.getJavaCode(), - property, "(" + JAXXCompiler.getCanonicalName(type) + ") " + dataBinding, compiler), compiler).compile(false); + DataBinding dataBinding1 = new DataBinding(dataBinding, object.getId() + "." + property + "." + priority, handler.getSetPropertyCode(object.getJavaCode(), property, "(" + JAXXCompiler.getCanonicalName(type) + ") " + dataBinding, compiler)); + dataBinding1.compile(compiler, false); } else { try { Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null; @@ -391,12 +265,12 @@ public class StylesheetHelper { buffer.append("java.lang.Object "); valueDeclared = true; } - buffer.append("value = jaxx.runtime.css.Pseudoclasses.applyProperty(").append(compiler.getOutputClassName()).append(".this, ").append(object.getJavaCode()).append(", ").append(compiler.getJavaCode(property)).append(", ").append(valueCode).append(", jaxx.runtime.css.Pseudoclasses.wrap(").append(handler.getGetPropertyCode(object.getJavaCode(), property, compiler)).append("), ").append(priority).append(");").append(JAXXCompiler.getLineSeparator()); - buffer.append("if (!(value instanceof jaxx.runtime.css.DataBinding)) {").append(JAXXCompiler.getLineSeparator()); + buffer.append("value = jaxx.runtime.css.Pseudoclasses.applyProperty(").append(compiler.getOutputClassName()).append(".this, ").append(object.getJavaCode()).append(", ").append(compiler.getJavaCode(property)).append(", ").append(valueCode).append(", jaxx.runtime.css.Pseudoclasses.wrap(").append(handler.getGetPropertyCode(object.getJavaCode(), property, compiler)).append("), ").append(priority).append(");").append(eol); + buffer.append("if (!(value instanceof jaxx.runtime.css.DataBinding)) {").append(eol); String unwrappedValue = unwrap(type, "value"); buffer.append(" ").append(handler.getSetPropertyCode(object.getJavaCode(), property, "(" + JAXXCompiler.getCanonicalName(type) + - ") " + unwrappedValue, compiler)).append(JAXXCompiler.getLineSeparator()); - buffer.append("}").append(JAXXCompiler.getLineSeparator()); + ") " + unwrappedValue, compiler)).append(eol); + buffer.append("}").append(eol); } if (pseudoClass.equals("focused")) { @@ -424,8 +298,8 @@ public class StylesheetHelper { String valueCode; if (dataBinding != null) { valueCode = "new jaxx.runtime.css.DataBinding(" + compiler.getJavaCode(object.getId() + "." + property + "." + priority) + ")"; - new DataBinding(dataBinding, object.getId() + "." + property + "." + priority, handler.getSetPropertyCode(object.getJavaCode(), - property, "(" + JAXXCompiler.getCanonicalName(type) + ") " + dataBinding, compiler), compiler).compile(false); + DataBinding dataBinding1 = new DataBinding(dataBinding, object.getId() + "." + property + "." + priority, handler.getSetPropertyCode(object.getJavaCode(), property, "(" + JAXXCompiler.getCanonicalName(type) + ") " + dataBinding, compiler)); + dataBinding1.compile(compiler, false); } else { try { Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null; @@ -439,12 +313,12 @@ public class StylesheetHelper { buffer.append("java.lang.Object "); valueDeclared = true; } - buffer.append("value = jaxx.runtime.css.Pseudoclasses.removeProperty(").append(compiler.getOutputClassName()).append(".this, ").append(object.getJavaCode()).append(", ").append(compiler.getJavaCode(property)).append(", ").append(valueCode).append(", jaxx.runtime.css.Pseudoclasses.wrap(").append(handler.getGetPropertyCode(object.getJavaCode(), property, compiler)).append("), ").append(priority).append(");").append(JAXXCompiler.getLineSeparator()); - buffer.append("if (!(value instanceof jaxx.runtime.css.DataBinding)) {").append(JAXXCompiler.getLineSeparator()); + buffer.append("value = jaxx.runtime.css.Pseudoclasses.removeProperty(").append(compiler.getOutputClassName()).append(".this, ").append(object.getJavaCode()).append(", ").append(compiler.getJavaCode(property)).append(", ").append(valueCode).append(", jaxx.runtime.css.Pseudoclasses.wrap(").append(handler.getGetPropertyCode(object.getJavaCode(), property, compiler)).append("), ").append(priority).append(");").append(eol); + buffer.append("if (!(value instanceof jaxx.runtime.css.DataBinding)) {").append(eol); String unwrappedValue = unwrap(type, "value"); buffer.append(" ").append(handler.getSetPropertyCode(object.getJavaCode(), property, "(" + JAXXCompiler.getCanonicalName(type) + - ") " + unwrappedValue, compiler)).append(JAXXCompiler.getLineSeparator()); - buffer.append("}").append(JAXXCompiler.getLineSeparator()); + ") " + unwrappedValue, compiler)).append(eol); + buffer.append("}").append(eol); } compilePseudoClassRemove(pseudoClass, object, buffer.toString(), compiler); } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 1f08b928326b9be4549c292825db1ae07f0fba3b Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 26 02:45:10 2009 +0000 remove commented unused code clean code add javadoc --- .../jaxx/compiler/finalizers/DefaultFinalizer.java | 102 ++++++++++++++++++--- 1 file changed, 90 insertions(+), 12 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java b/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java index 54b0fd9..2b7af6f 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java @@ -40,77 +40,160 @@ import static jaxx.compiler.java.JavaFileGenerator.*; */ public class DefaultFinalizer implements JAXXCompilerFinalizer { - /** log */ + /** + * Logger + */ protected static final Log log = LogFactory.getLog(DefaultFinalizer.class); + /** + * serialVersionUID field + */ protected static final JavaField SERIAL_VERSION_UID_FIELD = newField(PRIVATE | STATIC | FINAL, "long", "serialVersionUID", false, "1L"); + /** + * $activeBindings field + */ protected static final JavaField ACTIVE_BINDINGS_FIELD = newField(PROTECTED, "java.util.List<Object>", "$activeBindings", false, "new ArrayList<Object>()"); + /** + * + */ protected static final JavaField BINDING_SOURCES_FIELD = newField(PROTECTED, "java.util.Map<String,Object>", "$bindingSources", false, "new HashMap<String,Object>()"); + /** + * + */ protected static final JavaField OBJECT_MAP_FIELD = newField(PROTECTED, "Map<String,Object>", "$objectMap", true, "new HashMap<String,Object>()"); + /** + * + */ protected static final JavaField ALL_COMPONENTS_CREATED_FIELD = newField(PRIVATE, "boolean", "allComponentsCreated", false); + /** + * + */ protected static final JavaField CONTEXT_INITIALIZED = newField(PRIVATE, "boolean", "contextInitialized", false, "true"); + /** + * + */ protected static final JavaField PREVIOUS_VALUES_FIELD = newField(PROTECTED, "java.util.Map<?,?>", "$previousValues", false, "new java.util.HashMap<Object,Object>()"); + /** + * + */ protected static final JavaField DELEGATE_CONTEXT_FIELD = newField(PROTECTED, JAXXContext.class.getName(), "delegateContext", true); + /** + * + */ protected static final JavaField PROPERTY_CHANGE_SUPPORT_FIELD = newField(0, "java.beans.PropertyChangeSupport", "$propertyChangeSupport", false); + /** + * + */ protected static final JavaMethod GET_CONTEXT_VALUE_METHOD = newMethod(PUBLIC, "<T> T", "getContextValue", "return delegateContext.getContextValue(clazz, null);", true, new JavaArgument("Class<T>", "clazz")); + /** + * + */ protected static final JavaMethod GET_CONTEXT_VALUE_NAMED_METHOD = newMethod(PUBLIC, "<T> T", "getContextValue", "return delegateContext.getContextValue(clazz, name);", true, new JavaArgument("Class<T>", "clazz"), new JavaArgument("String", "name")); + /** + * + */ protected static final JavaMethod SET_CONTEXT_VALUE_NAMED_METHOD = newMethod(PUBLIC, "<T> void", "setContextValue", "delegateContext.setContextValue(o, name);", true, new JavaArgument("T", "o"), new JavaArgument("String", "name")); + /** + * + */ protected static final JavaMethod SET_CONTEXT_VALUE_METHOD = newMethod(PUBLIC, "<T> void", "setContextValue", "delegateContext.setContextValue(o, null);", true, new JavaArgument("T", "o")); + /** + * + */ protected static final JavaMethod REMOVE_CONTEXT_VALUE_NAMED_METHOD = newMethod(PUBLIC, "<T> void", "removeContextValue", "delegateContext.removeContextValue(clazz, name);", true, new JavaArgument("Class<T>", "clazz"), new JavaArgument("String", "name")); + /** + * + */ protected static final JavaMethod REMOVE_CONTEXT_VALUE_METHOD = newMethod(PUBLIC, "<T> void", "removeContextValue", "delegateContext.removeContextValue(clazz, null);", true, new JavaArgument("Class<T>", "clazz")); + /** + * + */ protected static final JavaMethod GET_PARENT_CONTAINER_MORE_METHOD = newMethod(PUBLIC, "<O extends Container> O", "getParentContainer", "return delegateContext.getParentContainer(source, clazz);", true, new JavaArgument("Object", "source"), new JavaArgument("Class<O>", "clazz")); + /** + * + */ protected static final JavaMethod GET_PARENT_CONTAINER_METHOD = newMethod(PUBLIC, "<O extends Container> O", "getParentContainer", "return delegateContext.getParentContainer(clazz);", true, new JavaArgument("Class<O>", "clazz")); + /** + * + */ protected static final JavaMethod GET_OBJECT_BY_ID_METHOD = newMethod(PUBLIC, "java.lang.Object", "getObjectById", "return $objectMap.get(id);", true, new JavaArgument("String", "id")); + /** + * + */ protected static final JavaMethod GET_JAXX_OBJECT_DESCRIPTOR_METHOD = newMethod(PUBLIC | STATIC, "jaxx.runtime.JAXXObjectDescriptor", "$getJAXXObjectDescriptor", "return jaxx.runtime.Util.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);", false); + /** + * + */ protected static final JavaMethod PROCESS_DATA_BINDING_METHOD = newMethod(PUBLIC, "void", "processDataBinding", "processDataBinding(dest, false);", true, new JavaArgument("String", "dest")); + /** + * + */ protected static final JavaMethod FIRE_PROPERTY_CHANGE_METHOD = newMethod(PUBLIC, "void", "firePropertyChange", "super.firePropertyChange(propertyName, oldValue, newValue);", true, new JavaArgument("String", "propertyName"), new JavaArgument("Object", "oldValue"), new JavaArgument("Object", "newValue")); + /** + * + */ protected static final JavaMethod FIRE_PROPERTY_CHANGE_NAMED_METHOD = newMethod(PUBLIC, "void", "firePropertyChange", "$getPropertyChangeSupport().firePropertyChange(propertyName, oldValue, newValue);", true, new JavaArgument("String", "propertyName"), new JavaArgument("Object", "oldValue"), new JavaArgument("Object", "newValue")); + /** + * + */ protected static final JavaMethod GET_PROPERTY_CHANGE_SUPPORT_METHOD = newMethod(0, "java.beans.PropertyChangeSupport", "$getPropertyChangeSupport", "if ($propertyChangeSupport == null)\n" + " $propertyChangeSupport = new PropertyChangeSupport(this);\n" + "return $propertyChangeSupport;", false); + /** + * + */ protected static final JavaMethod ADD_PROPERTY_CHANGE_SUPPORT_METHOD = newMethod(PUBLIC, "void", "addPropertyChangeListener", "$getPropertyChangeSupport().addPropertyChangeListener(listener);", true, new JavaArgument("java.beans.PropertyChangeListener", "listener")); + /** + * + */ protected static final JavaMethod ADD_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD = newMethod(PUBLIC, "void", "addPropertyChangeListener", "$getPropertyChangeSupport().addPropertyChangeListener(property, listener);", true, new JavaArgument("String", "property"), new JavaArgument("java.beans.PropertyChangeListener", "listener")); + /** + * + */ protected static final JavaMethod REMOVE_PROPERTY_CHANGE_SUPPORT_METHOD = newMethod(PUBLIC, "void", "removePropertyChangeListener", "$getPropertyChangeSupport().removePropertyChangeListener(listener);", true, new JavaArgument("java.beans.PropertyChangeListener", "listener")); + /** + * + */ protected static final JavaMethod REMOVE_PROPERTY_CHANGE_SUPPORT_NAMED_METHOD = newMethod(PUBLIC, "void", "removePropertyChangeListener", "$getPropertyChangeSupport().removePropertyChangeListener(property, listener);", true, new JavaArgument("String", "property"), new JavaArgument("java.beans.PropertyChangeListener", "listener")); @@ -122,7 +205,6 @@ public class DefaultFinalizer implements JAXXCompilerFinalizer { if (root == null) { throw new CompilerException("root tag must be a class tag"); } - //Map<String, CompiledObject> objects = compiler.getObjects(); ClassDescriptor superclass = root.getObjectClass(); boolean superclassIsJAXXObject = ClassDescriptorLoader.getClassDescriptor(JAXXObject.class).isAssignableFrom(superclass); javaFile.setModifiers(PUBLIC); @@ -144,13 +226,13 @@ public class DefaultFinalizer implements JAXXCompilerFinalizer { // DataBinding for (DataBinding dataBinding : compiler.getDataBindings()) { - if (dataBinding.compile(true)) { - compiler.getInitDataBindings().append("applyDataBinding(").append(compiler.getJavaCode(dataBinding.getId())).append(");").append(eol); + if (dataBinding.compile(compiler, true)) { + String expression = "applyDataBinding(" + compiler.getJavaCode(dataBinding.getId()) + ");" + eol; + compiler.appendInitDataBindings(expression); } } if (superclassIsJAXXObject) { -// boolean hasBind = compiler.getApplyDataBinding().length() > 0; boolean hasBind = compiler.hasApplyDataBinding(); if (hasBind) { compiler.appendApplyDataBinding(" else {"); @@ -167,7 +249,6 @@ public class DefaultFinalizer implements JAXXCompilerFinalizer { } hasBind = compiler.hasRemoveDataBinding(); -// hasBind = compiler.getRemoveDataBinding().length() > 0; if (hasBind) { compiler.appendRemoveDataBinding(" else {"); compiler.appendRemoveDataBinding(eol); @@ -250,7 +331,6 @@ public class DefaultFinalizer implements JAXXCompilerFinalizer { needField = parentCompiler.getStylesheet() == null; } else { try { - superclass.getDeclaredFieldDescriptor(PREVIOUS_VALUES_FIELD.getName()); needField = false; } catch (NoSuchFieldException ex) { @@ -327,19 +407,19 @@ public class DefaultFinalizer implements JAXXCompilerFinalizer { int sizeLimit = 65000; // constant strings are limited to 64K, and I'm not brave enough to push right up to the limit if (data.length() < sizeLimit) { - return newField(PRIVATE | STATIC, "java.lang.String", "$jaxxObjectDescriptor", false, compiler.getJavaCode(data)); + return newField(PRIVATE | STATIC, "String", "$jaxxObjectDescriptor", false, compiler.getJavaCode(data)); } else { StringBuffer initializer = new StringBuffer(); for (int i = 0; i < data.length(); i += sizeLimit) { String name = "$jaxxObjectDescriptor" + i; - javaFile.addField(new JavaField(PRIVATE | STATIC, "java.lang.String", name, false, + javaFile.addField(new JavaField(PRIVATE | STATIC, "String", name, false, compiler.getJavaCode(data.substring(i, Math.min(i + sizeLimit, data.length()))))); if (initializer.length() > 0) { initializer.append(" + "); } initializer.append("String.valueOf(").append(name).append(")"); } - return newField(PRIVATE | STATIC | FINAL, "java.lang.String", "$jaxxObjectDescriptor", false, initializer.toString()); + return newField(PRIVATE | STATIC | FINAL, "String", "$jaxxObjectDescriptor", false, initializer.toString()); } } catch (IOException e) { throw new RuntimeException("Internal error: can't-happen error", e); @@ -464,10 +544,8 @@ public class DefaultFinalizer implements JAXXCompilerFinalizer { lastWasMethodCall = decorator.createInitializer(compiler, root, object, code, lastWasMethodCall); } root.getDecorator().createInitializer(compiler, root, root, code, lastWasMethodCall); -// code.append(eol); if (compiler.getInitializer().length() > 0) { code.append(compiler.getInitializer()); -// code.append(eol); } code.append("$completeSetup();"); code.append(eol); -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit ff7a0b4aa621f2fd21228f200442531c15f2f757 Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 26 02:47:48 2009 +0000 - remove commented unused code, clean code, add javadoc - improve warning and error management in JAXXEngine and plugin - improve databinding generation (do not test nullity on root object) - remove when possible the root object prefix in method invocation --- .../main/java/jaxx/compiler/CompiledObject.java | 178 ++++++++++++-------- .../src/main/java/jaxx/compiler/DataBinding.java | 79 +++++---- .../src/main/java/jaxx/compiler/DataSource.java | 89 ++++++---- .../src/main/java/jaxx/compiler/JAXXCompiler.java | 63 +++---- .../src/main/java/jaxx/compiler/JAXXEngine.java | 137 +++++++++++----- .../decorators/DefaultCompiledObjectDecorator.java | 8 +- .../java/jaxx/compiler/spi/DefaultInitializer.java | 1 - .../compiler/tags/DefaultComponentHandler.java | 82 ++++++---- .../jaxx/compiler/tags/DefaultObjectHandler.java | 182 ++++++++++++++------- .../java/jaxx/compiler/tags/ScriptHandler.java | 7 +- .../main/java/jaxx/compiler/tags/StyleHandler.java | 6 +- .../main/java/jaxx/compiler/tags/TagHandler.java | 2 + .../main/java/jaxx/compiler/tags/TagManager.java | 40 +++-- .../java/org/nuiton/jaxx/plugin/GenerateMojo.java | 42 +---- .../java/org/nuiton/jaxx/plugin/Bug1751Test.java | 2 +- .../java/org/nuiton/jaxx/plugin/DecoratorTest.java | 2 +- .../test/java/org/nuiton/jaxx/plugin/I18nTest.java | 12 +- .../org/nuiton/jaxx/plugin/Bug1751Test/Test1.jaxx | 2 +- .../org/nuiton/jaxx/plugin/Bug1751Test/Test2.jaxx | 2 +- .../org/nuiton/jaxx/plugin/Bug1751Test/Test3.jaxx | 2 +- .../jaxx/plugin/DecoratorTest/BoxedDecorator.jaxx | 2 +- .../nuiton/jaxx/plugin/I18nTest/text/JButton.jaxx | 2 +- .../nuiton/jaxx/plugin/I18nTest/title/JDialog.jaxx | 2 +- .../jaxx/plugin/I18nTest/title/JTabbedPane.jaxx | 2 +- .../jaxx/plugin/I18nTest/title/JTabbedPane2.jaxx | 2 +- .../jaxx/plugin/I18nTest/tooltiptext/JButton.jaxx | 2 +- .../plugin/I18nTest/tooltiptext/JTabbedPane.jaxx | 2 +- .../plugin/I18nTest/tooltiptext/JTabbedPane2.jaxx | 2 +- .../plugin/I18nTest/tooltiptext/JTabbedPane3.jaxx | 2 +- 29 files changed, 588 insertions(+), 368 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java index 5815db6..e58b06c 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java @@ -17,6 +17,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.commons.lang.StringUtils; /** * Represents an object in the <code>.java</code> file being generated during compilation. There is @@ -25,21 +26,34 @@ import java.util.Map; */ public class CompiledObject { - /** The object's id. */ + /** + * The object's id. + */ private String id; - /** Java code referring to the object. */ + /** + * Java code referring to the object. + */ private String javaCode; - /** The object's class. */ + /** + * The object's class. + */ private ClassDescriptor objectClass; - /** The style class. */ + /** + * The style class. + */ private String styleClass; - /** The container containing this CompiledObject. */ + /** + * The container containing this CompiledObject. + */ private CompiledObject parent; - /** true if this object overrides an object of the same id in a superclass of the object being compiled */ + /** + * true if this object overrides an object of the same id in a superclass + * of the object being compiled + */ private boolean override; /** - * Comma-separated Java code snippets representing the parameters that should be passed to the object's - * constructor. + * Comma-separated Java code snippets representing the parameters that + * should be passed to the object's constructor. */ private String constructorParams; /** @@ -54,17 +68,30 @@ public class CompiledObject { * CompiledObjects from initializationCode -- you must refer to them from additionCode instead. */ private StringBuffer additionCode = new StringBuffer(); - /** List of all registered event handlers. */ + /** + * List of all registered event handlers. + */ private List<EventHandler> eventHandlers = new ArrayList<EventHandler>(); - /** All properties that have been applied to this CompiledObject. */ + /** + * All properties that have been applied to this CompiledObject. + */ private Map<String, String> properties = new HashMap<String, String>(); - /** generic types of the compiled object */ + /** + * generic types of the compiled object + */ private String[] genericTypes; - /** a flag to indicate if javaBean full support must be support for this object by root object */ + /** + * a flag to indicate if javaBean full support must be support for this + * object by root object + */ private boolean javaBean; - /** code to initialize the bean (can be null) */ + /** + * code to initialize the bean (can be null) + */ private String javaBeanInitCode; - /** the type of the override object (can be null if no oveeride) */ + /** + * the type of the override object (can be null if no overide) + */ private ClassDescriptor overrideType; /** * the decorator @@ -121,11 +148,20 @@ public class CompiledObject { this.delegateCode = delegateCode; } - public void addToAdditionCode(StringBuffer buffer) { + public void addToAdditionCode(StringBuffer buffer, boolean isRootObject) { + //TC-20091026 do not prefix if on root object + String prefix; + if (isRootObject) { + prefix = ""; + } else { + prefix = javaCode + delegateCode + "."; + } if (constraints != null) { - buffer.append(javaCode).append(delegateCode).append(".add(").append(childJavaCode).append(", ").append(constraints).append(");"); +// buffer.append(javaCode).append(delegateCode).append(".add(").append(childJavaCode).append(", ").append(constraints).append(");"); + buffer.append(prefix).append("add(").append(childJavaCode).append(", ").append(constraints).append(");"); } else { - buffer.append(javaCode).append(delegateCode).append(".add(").append(childJavaCode).append(");"); +// buffer.append(javaCode).append(delegateCode).append(".add(").append(childJavaCode).append(");"); + buffer.append(prefix).append("add(").append(childJavaCode).append(");"); } buffer.append(JAXXCompiler.getLineSeparator()); } @@ -209,8 +245,9 @@ public class CompiledObject { } /** - * True if this object overrides an object in the superclass of the class being compiled. For this to be true, the - * class currently being compiled must be a subclass of another <code>JAXXObject</code> which has an + * True if this object overrides an object in the superclass of the class + * being compiled. For this to be true, the class currently being compiled + * must be a subclass of another <code>JAXXObject</code> which has an * identically-named object. * * @return <code>true</code> if this object is an override @@ -221,7 +258,8 @@ public class CompiledObject { } /** - * Sets whether this class overrides an identically-named object in the parent class. + * Sets whether this class overrides an identically-named object in the + * parent class. * * @param override <code>true</code> if this object is an override * @see #isOverride @@ -249,7 +287,8 @@ public class CompiledObject { } /** - * Returns this object's parent container. Non-visual components (and the root container) return <code>null</code>. + * Returns this object's parent container. Non-visual components (and + * the root container) return <code>null</code>. * * @return the object's parent container */ @@ -261,8 +300,9 @@ public class CompiledObject { * Sets this object's parent container. * * @param parent the parent container + * @throws IllegalArgumentException if parent is not a {@link Container} */ - public void setParent(CompiledObject parent) { + public void setParent(CompiledObject parent) throws IllegalArgumentException { if (!ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(parent.getObjectClass())) { throw new IllegalArgumentException("parent must descend from java.awt.Container"); } @@ -270,23 +310,26 @@ public class CompiledObject { } /** - * Returns the name of the method that should be generated in the compiled <code>.java</code> file - * in order to create this object. This is just a suggestion and may be ignored. + * Returns the name of the method that should be generated in the compiled + * <code>.java</code> file + * in order to create this object. This is just a suggestion and may be + * ignored. * * @return the suggested name of the method which initializes this object */ public String getCreationMethodName() { - return "create" + org.apache.commons.lang.StringUtils.capitalize(getId()); + return "create" + StringUtils.capitalize(getId()); } /** - * Returns the name of the method that should be generated in the compiled <code>.java</code> file - * in order to add children to this object. This is just a suggestion and may be ignored. + * Returns the name of the method that should be generated in the compiled + * <code>.java</code> file in order to add children to this object. This + * is just a suggestion and may be ignored. * * @return the suggested name of the method which completes this object's setup */ public String getAdditionMethodName() { - return "addChildrenTo" + org.apache.commons.lang.StringUtils.capitalize(getId()); + return "addChildrenTo" + StringUtils.capitalize(getId()); } /** @@ -299,7 +342,8 @@ public class CompiledObject { } /** - * Returns this object's id. Generally, a field with this name will be created in the compiled <code>.java</code> + * Returns this object's id. Generally, a field with this name will be + * created in the compiled <code>.java</code> * file in order to represent this object. * * @return the id used to refer to this object @@ -309,8 +353,8 @@ public class CompiledObject { } /** - * Returns Java code used to refer to this object in the compiled Java file. This is usually the same as its - * id. + * Returns Java code used to refer to this object in the compiled Java file. + * This is usually the same as its id. * * @return the Java code for this object */ @@ -329,7 +373,7 @@ public class CompiledObject { } String result = "((" + JAXXCompiler.getCanonicalName(getObjectClass()) + ") " + javaCode + ")"; - String methodName = org.apache.commons.lang.StringUtils.capitalize(property); + String methodName = StringUtils.capitalize(property); try { MethodDescriptor methodDescriptor = overrideType.getMethodDescriptor("get" + methodName); if (methodDescriptor != null) { @@ -345,8 +389,8 @@ public class CompiledObject { } /** - * Returns a list of comma-separated Java code snippets that represent the parameters to pass to this - * object's constructor. + * Returns a list of comma-separated Java code snippets that represent the + * parameters to pass to this object's constructor. * * @return the raw constructor params * @see #setConstructorParams @@ -358,7 +402,8 @@ public class CompiledObject { /** * Sets the parameters to pass to this object's constructor. * - * @param constructorParams comma-separated Java code snippets representing constructor params + * @param constructorParams comma-separated Java code snippets representing + * constructor params * @see #getConstructorParams */ public void setConstructorParams(String constructorParams) { @@ -366,9 +411,10 @@ public class CompiledObject { } /** - * Returns the code that performs basic initialization of this object, after it has already been constructed. - * This basic code should not reference any other <code>CompiledObjects</code> as they may not have - * been created yet. + * Returns the code that performs basic initialization of this object, + * after it has already been constructed. + * This basic code should not reference any other + * <code>CompiledObjects</code> as they may not have been created yet. * * @param compiler compiler to use * @return the code which initializes this object @@ -385,15 +431,18 @@ public class CompiledObject { protected String getInitializationCode(EventHandler handler, JAXXCompiler compiler) { MethodDescriptor addMethod = handler.getAddMethod(); ClassDescriptor listenerClass = addMethod.getParameterTypes()[0]; + //TC-20091026 use 'this' instead of root object javaCode return getJavaCode() + '.' + addMethod.getName() + "((" + JAXXCompiler.getCanonicalName(listenerClass) + ") jaxx.runtime.Util.getEventListener(" + JAXXCompiler.getCanonicalName(listenerClass) + ".class, " + - compiler.getJavaCode(handler.getListenerMethod().getName()) + ", " + compiler.getRootObject().getJavaCode() + ", " + + compiler.getJavaCode(handler.getListenerMethod().getName()) + ", this, " + + // compiler.getJavaCode(handler.getListenerMethod().getName()) + ", " + compiler.getRootObject().getJavaCode() + ", " + compiler.getJavaCode(compiler.getEventHandlerMethodName(handler)) + "));" + JAXXCompiler.getLineSeparator(); } /** - * Returns Java code to complete final setup on this object. This code may reference other - * <code>CompiledObjects</code>, as they are guaranteed to have all been created by this point. + * Returns Java code to complete final setup on this object. This code may + * reference other <code>CompiledObjects</code>, as they are guaranteed to + * have all been created by this point. * * @return code which adds children and performs final setup */ @@ -402,7 +451,8 @@ public class CompiledObject { } /** - * Appends code to the initialization code block. A line separator is automatically appended to the end. + * Appends code to the initialization code block. A line separator is + * automatically appended to the end. * * @param code the code to add to the initialization block * @see #getInitializationCode @@ -415,7 +465,8 @@ public class CompiledObject { } /** - * Appends code to the addition code block. A line separator is automatically appended to the end. + * Appends code to the addition code block. A line separator is + * automatically appended to the end. * * @param code the code to add to the addition block * @see #getAdditionCode @@ -428,8 +479,8 @@ public class CompiledObject { } /** - * Stores a property for this object. The only effect of calling this method is that the property will - * be returned by <code>getProperties()</code>. + * Stores a property for this object. The only effect of calling this + * method is that the property will be returned by {@code getProperties()}. * * @param property the name of the property * @param value the property's value @@ -486,7 +537,8 @@ public class CompiledObject { } /** - * Adds an event listener to this object. The generated code will appear in the initialization block. + * Adds an event listener to this object. The generated code will appear + * in the initialization block. * * @param eventId unique (per CompiledObject) identifier for the event handler * @param addMethod the method which adds the event listener @@ -500,13 +552,15 @@ public class CompiledObject { compiler.registerEventHandler(handler); eventHandlers.add(handler); - if (getJavaCode().indexOf(".") != -1) { // object lives in another JAXX file and consequently its initialization code won't be output + if (getJavaCode().indexOf(".") != -1) { + // object lives in another JAXX file and consequently its initialization code won't be output compiler.appendInitializerCode(getInitializationCode(handler, compiler)); } } /** - * Adds a child component to this container. The child is added without layout constraints. + * Adds a child component to this container. The child is added without + * layout constraints. * * @param child the component to add * @param compiler the current <code>JAXXCompiler</code> @@ -518,8 +572,8 @@ public class CompiledObject { } /** - * Adds a child component to this container. This variant allows the Java code for a layout constraints - * object to be specified. + * Adds a child component to this container. This variant allows the Java + * code for a layout constraints object to be specified. * * @param child the component to add * @param constraints Java code for the layout constraints object @@ -538,7 +592,8 @@ public class CompiledObject { if (!child.isOverride()) { TagHandler tagHandler = TagManager.getTagHandler(getObjectClass()); - if (tagHandler instanceof DefaultComponentHandler && !((DefaultComponentHandler) tagHandler).isContainer()) { + if (tagHandler instanceof DefaultComponentHandler && + !((DefaultComponentHandler) tagHandler).isContainer()) { compiler.reportError("component " + this + " may not have children"); } @@ -556,10 +611,6 @@ public class CompiledObject { return getObjectClass().getName() + "[id='" + id + "']"; } -// public void registerDataBinding(String src, String property, String assignment, JAXXCompiler compiler) throws CompilerException { -// compiler.registerDataBinding(src, getId() + "." + property, assignment); -// } - public String getGenericTypes() { if (getGenericTypesLength() == 0) { // not using it @@ -619,19 +670,18 @@ public class CompiledObject { this.decorator = decorator; } - public void finalizeCompiler() { - StringBuffer buffer = new StringBuffer(); + public void finalizeCompiler(JAXXCompiler compiler) { List<CompiledObject.ChildRef> refList = getChilds(); - if (refList == null || refList.isEmpty()) { + if (refList != null && !refList.isEmpty()) { + // compute additionCode for all childs + StringBuffer buffer = new StringBuffer(); + for (ChildRef childRef : refList) { + childRef.addToAdditionCode(buffer, compiler.getRootObject() == this); + } + additionCode = buffer.append(additionCode); return; } - - for (ChildRef childRef : refList) { - childRef.addToAdditionCode(buffer); - } - - additionCode = buffer.append(additionCode); } public int getGenericTypesLength() { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java b/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java index 97c59e7..f978002 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java @@ -1,27 +1,31 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ package jaxx.compiler; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + /** - * Represents a data binding in a JAXX file. <code>DataBinding</code> uses {@link DataSource} to - * track changes to a source expression and update the destination. + * Represents a data binding in a JAXX file. <code>DataBinding</code> uses + * {@link DataSource} to track changes to a source expression and update the destination. */ public class DataBinding { + /** + * Logger + */ + protected static final Log log = LogFactory.getLog(DataBinding.class); + /** + * Id of the data binding + */ private String id; - /** The DatSource which tracks source expression changes. */ - private DataSource dataSource; - /** The data binding destination in the form <code><id>.<propertyName></code>. */ - private String dest; + /** + * source of the data binding + */ + private String source; /** * A Java snippet which will cause the destination property to be updated with the current value of * the binding. */ private String assignment; - /** The current <code>JAXXCompiler</code>. */ - private JAXXCompiler compiler; /** * Creates a new data binding. @@ -29,14 +33,14 @@ public class DataBinding { * @param source the Java source code for the data binding expression * @param dest the data binding destination in the form <code><id>.<propertyName></code> * @param assignment Java snippet which will cause the destination property to be updated with the current value of the binding - * @param compiler the current <code>JAXXCompiler</code> */ - public DataBinding(String source, String dest, String assignment, JAXXCompiler compiler) { + public DataBinding(String source, String dest, String assignment) { this.id = dest; - this.dataSource = new DataSource(id, source, compiler); - this.dest = dest; + this.source = source; this.assignment = assignment; - this.compiler = compiler; + if (log.isDebugEnabled()) { + log.debug("id=" + id + " assignement=" + assignment + " source=" + source); + } } public String getId() { @@ -44,21 +48,29 @@ public class DataBinding { } /** - * Compiles the data binding expression. This method calls methods in <code>JAXXCompiler</code> - * to add the Java code that performs the data binding setup. + * Compiles the data binding expression. This method calls methods in + * <code>JAXXCompiler</code> to add the Java code that performs the data + * binding setup. * + * @param compiler compiler which includes the data binding * @param quickNoDependencies true to optimize bindings with no dependencies by simply running them at startup time * @return <code>true</code> if the expression has dependencies, <code>false</code> otherwise * @throws CompilerException if a compilation error occurs */ - public boolean compile(boolean quickNoDependencies) throws CompilerException { - // DataSource.compile handles all of the listener additions - boolean result = dataSource.compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + compiler.getJavaCode(id) + ")"); + public boolean compile(JAXXCompiler compiler, boolean quickNoDependencies) throws CompilerException { + + DataSource dataSource = new DataSource(id, source, compiler); + + // handles all of the listener additions + //TC-20091026 use 'this' instead of root object javaCode +// boolean result = dataSource.compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + compiler.getJavaCode(id) + ")"); + boolean result = dataSource.compile("new jaxx.runtime.DataBindingListener(this, " + compiler.getJavaCode(id) + ")"); + String eol = JAXXCompiler.getLineSeparator(); if (!result && quickNoDependencies) { - if (!dest.endsWith(".layout")) // layout is specially handled early in the chain - { - compiler.appendInitDataBindings(assignment + JAXXCompiler.getLineSeparator()); + // layout is specially handled early in the chain + if (!id.endsWith(".layout")) { + compiler.appendInitDataBindings(assignment + eol); } return false; // no dependencies, just a static expression } @@ -67,17 +79,20 @@ public class DataBinding { } else { compiler.appendProcessDataBinding(" "); } - compiler.appendProcessDataBinding("if (" + compiler.getJavaCode(id) + ".equals($dest)) {" + JAXXCompiler.getLineSeparator()); + compiler.appendProcessDataBinding("if (" + compiler.getJavaCode(id) + ".equals($dest)) {" + eol); String objectCode = dataSource.getObjectCode(); - if (objectCode != null) { - compiler.appendProcessDataBinding(" if (" + objectCode + " != null) {" + JAXXCompiler.getLineSeparator()); + //TC-20091026 no need to test objectCode not null if on root object +// boolean needTest = objectCode != null; + boolean needTest = objectCode != null && !compiler.getRootObject().getId().equals(objectCode); + if (needTest) { + compiler.appendProcessDataBinding(" if (" + objectCode + " != null) {" + eol); compiler.appendProcessDataBinding(" "); } - compiler.appendProcessDataBinding(" " + assignment.trim()); - if (objectCode != null) { - compiler.appendProcessDataBinding(JAXXCompiler.getLineSeparator() + " }"); + compiler.appendProcessDataBinding(" " + assignment.trim()); + if (needTest) { + compiler.appendProcessDataBinding(eol + " }"); } - compiler.appendProcessDataBinding(JAXXCompiler.getLineSeparator() + " }"); + compiler.appendProcessDataBinding(eol + " }"); return true; } } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java b/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java index 121906a..291092c 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java @@ -34,19 +34,42 @@ import java.util.List; */ public class DataSource { + /** + * type attached to "null" constants in parsed expressions + */ private class NULL { - } // type attached to "null" constants in parsed expressions + } + /** + * id of data source + */ private String id; - /** The Java source code for the expression. */ + /** + * The Java source code for the expression. + */ private String source; - /** The current <code>JAXXCompiler</code>. */ + /** + * The current <code>JAXXCompiler</code>. + */ private JAXXCompiler compiler; - /** List of symbols which this data source expression depends on. */ + /** + * List of symbols which this data source expression depends on. + */ private List<String> dependencySymbols = new ArrayList<String>(); + /** + * + */ private StringBuffer addListenerCode = new StringBuffer(); + /** + * + */ private StringBuffer removeListenerCode = new StringBuffer(); + /** + * + */ private boolean compiled; - /** the delegate of property to be required */ + /** + * the delegate of property to be required + */ private String objectCode; /** @@ -85,8 +108,9 @@ public class DataSource { * @param propertyChangeListenerCode Java code snippet which evaluates to a <code>PropertyChangeListener</code> * @return <code>true</code> if the expression has dependencies, <code>false</code> otherwise * @throws CompilerException if a compilation error occurs + * @throws IllegalStateException if data source was already compiled */ - public boolean compile(String propertyChangeListenerCode) throws CompilerException { + public boolean compile(String propertyChangeListenerCode) throws CompilerException, IllegalStateException { if (compiled) { throw new IllegalStateException(this + " has already been compiled"); } @@ -100,7 +124,7 @@ public class DataSource { if (dependencySymbols.size() > 0) { //TC 20081108 prefer add a real JavaField instead of raw code //compiler.appendBodyCode("private PropertyChangeListener " + id + " = " + propertyChangeListenerCode + ";\n"); - compiler.addSimpleField(new JavaField(Modifier.PRIVATE, PropertyChangeListener.class.getName(), autoId,false, propertyChangeListenerCode)); + compiler.addSimpleField(new JavaField(Modifier.PRIVATE, PropertyChangeListener.class.getSimpleName(), autoId, false, propertyChangeListenerCode)); } compileListeners(); @@ -287,7 +311,8 @@ public class DataSource { for (int i = 1; i < expression.jjtGetNumChildren(); i++) { SimpleNode suffix = expression.getChild(i); if (suffix.jjtGetNumChildren() == 1 && suffix.getChild(0).getId() == JavaParserTreeConstants.JJTARGUMENTS) { - if (suffix.getChild(0).jjtGetNumChildren() == 0) { // at the moment only no-argument methods are trackable + if (suffix.getChild(0).jjtGetNumChildren() == 0) { + // at the moment only no-argument methods are trackable contextClass = scanCompoundSymbol(lastNode, contextClass, true, listenerId); if (contextClass == null) { return null; @@ -339,9 +364,10 @@ public class DataSource { } private void trackMemberIfPossible(String objectCode, ClassDescriptor objectClass, String memberName, boolean method, String listenerId) { - if (objectClass.isInterface()) // might be technically possible to track in some cases, but for now - { - return; // we can't create a DefaultObjectHandler for interfaces + if (objectClass.isInterface()) { + // might be technically possible to track in some cases, but for now + // we can't create a DefaultObjectHandler for interfaces + return; } DefaultObjectHandler handler = TagManager.getTagHandler(objectClass); @@ -389,25 +415,30 @@ public class DataSource { private void addListener(String dependencySymbol, String objectCode, String addCode, String removeCode) { this.objectCode = objectCode; + //TC-20091026 no need to test objectCode not null if on root object + boolean needTest = objectCode != null && !compiler.getRootObject().getId().equals(objectCode); +// boolean needTest = objectCode != null; if (!dependencySymbols.contains(dependencySymbol)) { dependencySymbols.add(dependencySymbol); String eol = JAXXCompiler.getLineSeparator(); - if (objectCode != null) { - addListenerCode.append("if (").append(objectCode).append(" != null) {").append(eol); + addListenerCode.append(eol); + if (needTest) { + addListenerCode.append(" if (").append(objectCode).append(" != null) {").append(eol); addListenerCode.append(" "); } - addListenerCode.append(" ").append(addCode); - if (objectCode != null) { - addListenerCode.append(" ").append("}"); + addListenerCode.append(" ").append(addCode.trim()); + if (needTest) { + addListenerCode.append(eol).append(" }"); } - if (objectCode != null) { - removeListenerCode.append("if (").append(objectCode).append(" != null) {").append(eol); + removeListenerCode.append(eol); + if (needTest) { + removeListenerCode.append(" if (").append(objectCode).append(" != null) {").append(eol); removeListenerCode.append(" "); } - removeListenerCode.append(" ").append(removeCode); - if (objectCode != null) { - removeListenerCode.append(" }"); + removeListenerCode.append(" ").append(removeCode.trim()); + if (needTest) { + removeListenerCode.append(eol).append(" }"); } } } @@ -419,28 +450,20 @@ public class DataSource { if (compiler.hasApplyDataBinding()) { compiler.appendApplyDataBinding(" else "); } - compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol); +// compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol); + compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {"); compiler.appendApplyDataBinding(" " + addListenerCode + eol); compiler.appendApplyDataBinding("}"); - //if (compiler.applyDataBinding.length() > 0) - // compiler.applyDataBinding.append("else "); - //compiler.applyDataBinding.append("if ($binding.equals(").append(TypeManager.getJavaCode(id)).append(")) {").append(JAXXCompiler.getLineSeparator()); - //compiler.applyDataBinding.append(" ").append(addListenerCode).append(JAXXCompiler.getLineSeparator()); - //compiler.applyDataBinding.append("}").append(JAXXCompiler.getLineSeparator()); } if (removeListenerCode.length() > 0) { if (compiler.hasRemoveDataBinding()) { compiler.appendRemoveDataBinding(" else "); } - compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol); +// compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol); + compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {"); compiler.appendRemoveDataBinding(" " + removeListenerCode + eol); compiler.appendRemoveDataBinding("}"); - //if (compiler.removeDataBinding.length() > 0) - // compiler.removeDataBinding.append("else "); - //compiler.removeDataBinding.append("if ($binding.equals(").append(TypeManager.getJavaCode(id)).append(")) {").append(JAXXCompiler.getLineSeparator()); - //compiler.removeDataBinding.append(" ").append(removeListenerCode).append(JAXXCompiler.getLineSeparator()); - //compiler.removeDataBinding.append("}").append(JAXXCompiler.getLineSeparator()); } } } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java index f76b44a..c979ed7 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java @@ -67,6 +67,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import jaxx.compiler.java.JavaFileGenerator; import jaxx.compiler.types.TypeManager; +import org.apache.commons.lang.StringUtils; /** * Compiles JAXX files into Java classes. @@ -99,6 +100,10 @@ public class JAXXCompiler { */ public static final int INLINE_THRESHOLD = 300; /** + * Line separator cached value + */ + protected static String lineSeparator = System.getProperty("line.separator", "\n"); + /** * The unique object handler used in first pass */ protected final DefaultObjectHandler firstPassClassTagHandler; @@ -107,7 +112,7 @@ public class JAXXCompiler { /*-- compiler fields -----------------------------------------------------*/ /*------------------------------------------------------------------------*/ /** - * flag to detec if an error occurs while compiling jaxx file + * flag to detect if an error occurs while compiling jaxx file */ protected boolean failed; /** @@ -131,7 +136,7 @@ public class JAXXCompiler { */ protected int autogenID = 0; /** - * + * data bindings detected */ protected List<DataBinding> dataBindings = new ArrayList<DataBinding>(); /** @@ -385,10 +390,10 @@ public class JAXXCompiler { if (symbolTable.getSuperclassName() == null) { symbolTable.setSuperclassName(fullClassName); } - String id = tag.getAttribute("id"); + String id = tag.getAttribute(DefaultObjectHandler.ID_ATTRIBUTE); if (id.length() > 0) { symbolTable.getClassTagIds().put(id, fullClassName); - if (tag.getAttributeNode("javaBean") != null) { + if (tag.getAttributeNode(DefaultObjectHandler.JAVA_BEAN_ATTRIBUTE) != null) { // add java bean support for this property String capitalizeName = org.apache.commons.lang.StringUtils.capitalize(id); // add method @@ -582,6 +587,10 @@ public class JAXXCompiler { /*------------------------------------------------------------------------*/ /*-- DataBinding methods -------------------------------------------------*/ /*------------------------------------------------------------------------*/ + public List<DataBinding> getDataBindings() { + return dataBindings; + } + /** * Examine an attribute value for data binding expressions. Returns a 'cooked' expression which * can be used to determine the resulting value. It is expected that this expression will be used @@ -647,7 +656,8 @@ public class JAXXCompiler { // if (log.isDebugEnabled()) { // log.info(getRootObject().getId() + " src=" + src + ", dst=" + dest.trim()); // } - dataBindings.add(new DataBinding(src, dest, assignment, this)); + dataBindings.add(new DataBinding(src, dest, assignment)); +// dataBindings.add(new DataBinding(src, dest, assignment, this)); } catch (CompilerException e) { reportError("While parsing data binding for '" + dest.substring(dest.lastIndexOf(".") + 1) + "': " + e.getMessage()); } @@ -679,8 +689,7 @@ public class JAXXCompiler { // to make possible inheritance String id = handler.getEventId().substring(0, handler.getEventId().indexOf(".")); - result = "do" + org.apache.commons.lang.StringUtils.capitalize(handler.getListenerMethod().getName()) + "__on__" + id; - //result = "do" + org.apache.commons.lang.StringUtils.capitalize(handler.getListenerMethod().getName()) + "__on__" + handler.getObjectCode(); + result = "do" + StringUtils.capitalize(handler.getListenerMethod().getName()) + "__on__" + id; } eventHandlerMethodNames.put(handler, result); } @@ -776,16 +785,12 @@ public class JAXXCompiler { } StringBuilder buffer = new StringBuilder(); buffer.append(srcFile); -// System.err.print(srcFile); if (lineNumber != null) { buffer.append(":" + ((sourceFiles.size() == 1) ? Integer.parseInt(lineNumber) + lineOffset : lineOffset + 1)); -// System.err.print(":" + ((sourceFiles.size() == 1) ? Integer.parseInt(lineNumber) + lineOffset : lineOffset + 1)); } buffer.append(getLineSeparator()).append(warning.trim()); -// System.err.println(": Warning: " + warning); if (engine != null) { engine.addWarning(buffer.toString()); -// engine.warningCount++; } else { System.err.println(buffer.toString()); } @@ -848,16 +853,12 @@ public class JAXXCompiler { } StringBuilder buffer = new StringBuilder(); buffer.append(errorFile != null ? errorFile.getPath() : "<unknown source>"); -// System.err.print(errorFile != null ? errorFile.getPath() : "<unknown source>"); if (lineNumber > 0) { buffer.append(":" + lineNumber); -// System.err.print(":" + lineNumber); } buffer.append(getLineSeparator()).append(": " + error); -// System.err.println(": " + error); if (engine != null) { engine.addError(buffer.toString()); -// engine.errorCount++; } else { System.err.println(buffer.toString()); } @@ -871,10 +872,6 @@ public class JAXXCompiler { return objects; } - public List<DataBinding> getDataBindings() { - return dataBindings; - } - public Map<String, Map<ClassDescriptor, List<EventHandler>>> getEventHandlers() { return eventHandlers; } @@ -1064,47 +1061,43 @@ public class JAXXCompiler { } public void appendInitializerCode(String code) { - getInitializer().append(code); + initializer.append(code); } public void appendBodyCode(String code) { - getBodyCode().append(code); + bodyCode.append(code); } public void appendInitDataBindings(String code) { - getInitDataBindings().append(code); + initDataBindings.append(code); } public void appendProcessDataBinding(String code) { - getProcessDataBinding().append(code); + processDataBinding.append(code); } public void appendApplyDataBinding(String code) { - getApplyDataBinding().append(code); + applyDataBinding.append(code); } public void appendRemoveDataBinding(String code) { - getRemoveDataBinding().append(code); + removeDataBinding.append(code); } public void appendLateInitializer(String code) { - getLateInitializer().append(code); + lateInitializer.append(code); } public boolean hasProcessDataBinding() { - return getProcessDataBinding().length() > 0; + return processDataBinding.length() > 0; } public boolean hasApplyDataBinding() { - return getApplyDataBinding().length() > 0; + return applyDataBinding.length() > 0; } public boolean hasRemoveDataBinding() { - return getRemoveDataBinding().length() > 0; - } - - public void addMethodToJavaFile(JavaMethod method) { - getJavaFile().addMethod(method); + return removeDataBinding.length() > 0; } public boolean hasMethod(String methodName) { @@ -1370,7 +1363,7 @@ public class JAXXCompiler { } for (CompiledObject object : getObjects().values()) { - object.finalizeCompiler(); + object.finalizeCompiler(this); } for (JAXXCompilerFinalizer generator : generatorIterator) { @@ -1404,8 +1397,6 @@ public class JAXXCompiler { } } } - /** line separator cached value */ - protected static String lineSeparator = System.getProperty("line.separator", "\n"); /** * Returns the system line separator string. diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java index 2b88ebd..f48b7f1 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java @@ -134,46 +134,38 @@ public class JAXXEngine { initializer.initialize(); } } - /** + /** * configuration of the launchor and underlines compilers */ protected CompilerConfiguration configuration; - /** + /** * original list of files to run */ protected final File[] files; - /** + /** * original list of classes to run */ protected final String[] classNames; - /** + /** * Files to be treated while compilation. */ private List<File> jaxxFiles = new ArrayList<File>(); - /** + /** * Class names corresponding to the files in the jaxxFiles list. */ private List<String> jaxxFileClassNames = new ArrayList<String>(); - /** + /** * Maps the names of classes being compiled to the compiler instance handling the compilation. */ protected Map<String, JAXXCompiler> compilers = new HashMap<String, JAXXCompiler>(); - /** + /** * Maps the names of classes being compiled to their symbol tables (created after the first compiler pass). */ protected Map<File, SymbolTable> symbolTables = new HashMap<File, SymbolTable>(); /** - * + * current pass of the engine */ private LifeCycle currentPass; -// /** -// * -// */ -// protected int errorCount; -// /** -// * -// */ -// protected int warningCount; /** * Warnings detected while running. */ @@ -183,10 +175,6 @@ public class JAXXEngine { */ protected List<String> errors = new ArrayList<String>(); /** - * number of registred compiler - */ - protected int compilerCount; - /** * profile attached to the engine (can be null) */ protected JAXXProfile profiler; @@ -215,7 +203,6 @@ public class JAXXEngine { @Override public boolean run(JAXXEngine engine) { boolean success = true; - engine.compilerCount = 0; engine.warnings.clear(); engine.errors.clear(); // init decorators @@ -226,7 +213,6 @@ public class JAXXEngine { engine.decorators.put(decorator.getName(), decorator); } } - // init finalizers engine.finalizers = new ArrayList<JAXXCompilerFinalizer>(); for (JAXXCompilerFinalizer finalizer : ServiceLoader.load(JAXXCompilerFinalizer.class)) { @@ -274,8 +260,6 @@ public class JAXXEngine { log.warn("could not create directory " + destDir); continue; } - } else { - //destDir = file.getParentFile(); } JAXXCompiler compiler = engine.newCompiler(file.getParentFile(), file, className); addStartProfileTime(engine, compiler); @@ -393,7 +377,7 @@ public class JAXXEngine { } }, /** - * display profile + * display profile results */ profile_pass { @@ -408,6 +392,13 @@ public class JAXXEngine { } }; + /** + * Run the pass. + * + * @param engine the engine to use + * @return {@code true} if pass was ok, {@ocde false} otherwise + * @throws Exception if any pb + */ public abstract boolean run(JAXXEngine engine) throws Exception; void addStartProfileTime(JAXXEngine engine, JAXXCompiler compiler) { @@ -431,9 +422,10 @@ public class JAXXEngine { } } - /** Resets all state in preparation for a new compilation session. */ + /** + * Resets all state in preparation for a new compilation session. + */ protected void reset() { -// errorCount = warningCount = 0; jaxxFiles.clear(); jaxxFileClassNames.clear(); symbolTables.clear(); @@ -457,7 +449,8 @@ public class JAXXEngine { } /** - * Creates a dummy Compiler for use in unit testing. + * Creates a dummy Compiler for use in unit testing or dettached use of an + * engine. * * @param classLoader class loader to use * @return the compiler @@ -469,6 +462,8 @@ public class JAXXEngine { } /** + * Obtain the jaxx compiler of the given class name. + * * @param className the name of the class to use * @return the compiler instance which is processing the specified JAXX class. Each class is compiled by a * different compiler instance. @@ -478,6 +473,8 @@ public class JAXXEngine { } /** + * Obtain the symbo table for the given class name. + * * @param className the name of the class to use * @return the symbol table for the specified JAXX class. Must be called during the second compiler pass. * Returns <code>null</code> if no such symbol table could be found. @@ -490,14 +487,27 @@ public class JAXXEngine { return compiler.getSymbolTable(); } - public CompiledObjectDecorator getDecorator(String name) { + /** + * Obtain the decorator of the given name. + * + * @param name the name of the decorator + * @return the decorator found. + * @throws IllegalArgumentException if decorator not found for the given name. + */ + public CompiledObjectDecorator getDecorator(String name) throws IllegalArgumentException { CompiledObjectDecorator decorator = decorators.get(name); if (decorator == null) { - throw new IllegalArgumentException("could not find decorator with key " + name + " (known decorators : " + decorators.keySet()); + throw new IllegalArgumentException("could not find decorator with key " + name + " (known decorators : " + decorators.keySet() + ")"); } return decorator; } + /** + * Obtain the decorator of the given type. + * + * @param type the type of the decorator (syas his fqn) + * @return the decorator found + */ public CompiledObjectDecorator getDecorator(Class<?> type) { for (CompiledObjectDecorator decorator : decorators.values()) { if (type == decorator.getClass()) { @@ -507,18 +517,34 @@ public class JAXXEngine { return null; } + /** + * Add a warning to the engine. + * + * @param warning the warning to add + */ public void addWarning(String warning) { warnings.add(warning); } + /** + * Add an error to the engine. + * + * @param error the error to add + */ public void addError(String error) { errors.add(error); } + /** + * @return the errors of the engine + */ public List<String> getErrors() { return errors; } + /** + * @return the warnings of the engine + */ public List<String> getWarnings() { return warnings; } @@ -526,34 +552,35 @@ public class JAXXEngine { /** * Compiled a set of files. * - * @return <code>true</code> if compilation succeeds, <code>false</code> otherwise + * @return {@code -1} if errors appears, the number of generated files + * otherwise. */ - public synchronized boolean run() { + public synchronized int run() { try { boolean success = true; for (LifeCycle state : LifeCycle.values()) { if (!success) { - return false; + // stop as soon as a engine phase failed + break; } currentPass = state; if (configuration.isVerbose()) { - log.info("start " + state + " on " + jaxxFiles.size() + " file(s)"); + log.info("'" + state + "' on " + jaxxFiles.size() + " file(s)"); } success = state.run(this); } - return success; + return success ? compilers.size() : -1; //FIXME : deal better the exception treatment... } catch (CompilerException e) { System.err.println(e.getMessage()); e.printStackTrace(); - return false; + return -1; } catch (Throwable e) { e.printStackTrace(); - return false; + return -1; } finally { - compilerCount = compilers.size(); //TC - 20081018 only reset when no error was detected if (configuration.isResetAfterCompile() && errors.isEmpty()) { reset(); @@ -561,11 +588,15 @@ public class JAXXEngine { } } - public int getCompilerCount() { - return compilerCount; - } - - protected JAXXCompiler getCompiler(String className, String message) { + /** + * Obtain the compiler for the given class name. + * + * @param className the class name of the searched compiler + * @param message the message to throw if compiler not found + * @return the compiler found + * @throws CompilerException if compiler not found + */ + protected JAXXCompiler getCompiler(String className, String message) throws CompilerException { JAXXCompiler compiler = compilers.get(className); if (compiler == null) { throw new CompilerException(message); @@ -573,6 +604,18 @@ public class JAXXEngine { return compiler; } + /** + * Create a new compiler. + * + * @param parentFile + * @param file + * @param className + * @return the new compiler + * @throws InvocationTargetException + * @throws IllegalAccessException + * @throws InstantiationException + * @throws NoSuchMethodException + */ protected JAXXCompiler newCompiler(File parentFile, File file, String className) throws InvocationTargetException, IllegalAccessException, InstantiationException, NoSuchMethodException { Constructor<? extends JAXXCompiler> cons = configuration.getCompilerClass().getConstructor(JAXXEngine.class, File.class, File.class, String.class, CompilerConfiguration.class, List.class); return cons.newInstance(this, parentFile, file, className, configuration, Arrays.asList(new String[]{ @@ -594,6 +637,14 @@ public class JAXXEngine { })); } + /** + * Add a profile time for the given compiler and key. + * + * Note: if {@link #profiler} is {@code null}, do nothing + * + * @param compiler the compiler to profile + * @param key the key of profiling + */ public void addProfileTime(JAXXCompiler compiler, String key) { if (profiler != null) { profiler.addTime(compiler, key); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java index 02f9203..24ac11d 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java @@ -82,7 +82,7 @@ public class DefaultCompiledObjectDecorator implements CompiledObjectDecorator { //TC-20091025 generate client properties at creation time (not at setup time) // in some case can save to create a setup method (when there is only client properties // to store) - addClientProperties(object); + addClientProperties(object, result, eol); return result.toString(); } @@ -124,7 +124,7 @@ public class DefaultCompiledObjectDecorator implements CompiledObjectDecorator { //TC-20091025 generate client properties at creation time (not at setup time) // in some case can save to create a setup method (when there is only client properties // to store) - addClientProperties(object); + addClientProperties(object, code, eol); code.append(eol); } } else { @@ -144,12 +144,12 @@ public class DefaultCompiledObjectDecorator implements CompiledObjectDecorator { return lastWasMethodCall; } - protected void addClientProperties(CompiledObject object) { + protected void addClientProperties(CompiledObject object, StringBuffer code, String eol) { //TC-20090327 generate client properties if (object.hasClientProperties()) { // generate putClientProperty invocations for (Entry<String, String> entry : object.getClientProperties().entrySet()) { - object.appendAdditionCode(object.getJavaCode() + ".putClientProperty(\"" + entry.getKey() + "\", " + entry.getValue() + ");"); + code.append(object.getJavaCode() + ".putClientProperty(\"" + entry.getKey() + "\", " + entry.getValue() + ");").append(eol); } } } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java b/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java index 6518319..8615a8c 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java @@ -129,7 +129,6 @@ public class DefaultInitializer implements Initializer { registerTag(JAXXCompiler.JAXX_NAMESPACE, FieldValidatorHandler.TAG, new FieldValidatorHandler()); registerTag(JAXXCompiler.JAXX_NAMESPACE, ExcludeFieldValidatorHandler.TAG, new FieldValidatorHandler()); - // // Register beans // diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java index f87c585..d976c35 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java @@ -29,8 +29,25 @@ import org.w3c.dom.NamedNodeMap; public class DefaultComponentHandler extends DefaultObjectHandler { - /** log */ + public static final String ACTION_ICON_ATTRIBUTE = "actionIcon"; + public static final String CONTAINER_DELEGATE_ATTRIBUTE = "containerDelegate"; + public static final String FONT_FACE_ATTRIBUTE = "font-face"; + public static final String FONT_SIZE_ATTRIBUTE = "font-size"; + public static final String FONT_STYLE_ATTRIBUTE = "font-style"; + public static final String FONT_WEIGHT_ATTRIBUTE = "font-weight"; + public static final String HEIGHT_ATTRIBUTE = "height"; + public static final String ICON_ATTRIBUTE = "icon"; + public static final String NAME_ATTRIBUTE = "name"; + public static final String WIDTH_ATTRIBUTE = "width"; + public static final String X_ATTRIBUTE = "x"; + public static final String Y_ATTRIBUTE = "y"; + /** + * Logger + */ protected static final Log log = LogFactory.getLog(DefaultComponentHandler.class); + /** + * container delegate (if any) + */ private String containerDelegate; public DefaultComponentHandler(ClassDescriptor beanClass) { @@ -43,7 +60,7 @@ public class DefaultComponentHandler extends DefaultObjectHandler { if (jaxxBeanInfo == null) { super.init(); - containerDelegate = (String) getJAXXBeanInfo().getJAXXBeanDescriptor().getValue("containerDelegate"); + containerDelegate = (String) getJAXXBeanInfo().getJAXXBeanDescriptor().getValue(CONTAINER_DELEGATE_ATTRIBUTE); if (containerDelegate == null && ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass().getSuperclass())) { containerDelegate = ((DefaultComponentHandler) TagManager.getTagHandler(getBeanClass().getSuperclass())).getContainerDelegate(); } @@ -71,7 +88,7 @@ public class DefaultComponentHandler extends DefaultObjectHandler { @Override protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { super.setDefaults(object, tag, compiler); - setAttribute(object, "name", object.getId(), false, compiler); + setAttribute(object, NAME_ATTRIBUTE, object.getId(), false, compiler); openComponent(object, tag, compiler); } @@ -87,7 +104,7 @@ public class DefaultComponentHandler extends DefaultObjectHandler { } protected void openComponent(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { - String constraints = tag.getAttribute("constraints"); + String constraints = tag.getAttribute(CONSTRAINTS_ATTRIBUTE); if (constraints != null && constraints.length() > 0) { compiler.openComponent(object, constraints); } else { @@ -106,11 +123,16 @@ public class DefaultComponentHandler extends DefaultObjectHandler { @Override public ClassDescriptor getPropertyType(CompiledObject object, String propertyName, JAXXCompiler compiler) throws CompilerException { - if (propertyName.equals("x") || propertyName.equals("y") || propertyName.equals("width") || propertyName.equals("height") || - "font-size".equals(propertyName)) { + if (propertyName.equals(X_ATTRIBUTE) || + propertyName.equals(Y_ATTRIBUTE) || + propertyName.equals(WIDTH_ATTRIBUTE) || + propertyName.equals(HEIGHT_ATTRIBUTE) || + FONT_SIZE_ATTRIBUTE.equals(propertyName)) { return ClassDescriptorLoader.getClassDescriptor(Integer.class); } - if (propertyName.equals("font-face") || propertyName.equals("font-style") || propertyName.equals("font-weight")) { + if (propertyName.equals(FONT_FACE_ATTRIBUTE) || + propertyName.equals(FONT_STYLE_ATTRIBUTE) || + propertyName.equals(FONT_WEIGHT_ATTRIBUTE)) { return ClassDescriptorLoader.getClassDescriptor(String.class); } return super.getPropertyType(object, propertyName, compiler); @@ -118,16 +140,16 @@ public class DefaultComponentHandler extends DefaultObjectHandler { @Override public String getGetPropertyCode(String id, String name, JAXXCompiler compiler) throws CompilerException { - if (name.equals("font-face")) { + if (name.equals(FONT_FACE_ATTRIBUTE)) { return id + ".getFont().getFontName()"; } - if (name.equals("font-size")) { + if (name.equals(FONT_SIZE_ATTRIBUTE)) { return id + ".getFont().getSize()"; } - if (name.equals("font-weight")) { + if (name.equals(FONT_WEIGHT_ATTRIBUTE)) { return "(" + id + ".getFont().getStyle() & Font.BOLD) != 0 ? \"bold\" : \"normal\""; } - if (name.equals("font-style")) { + if (name.equals(FONT_STYLE_ATTRIBUTE)) { return "(" + id + ".getFont().getStyle() & Font.ITALIC) != 0 ? \"italic\" : \"normal\""; } return super.getGetPropertyCode(id, name, compiler); @@ -135,25 +157,26 @@ public class DefaultComponentHandler extends DefaultObjectHandler { @Override public String getSetPropertyCode(String id, String name, String valueCode, JAXXCompiler compiler) throws CompilerException { - if (name.equals("x")) { + if (name.equals(X_ATTRIBUTE)) { return id + ".setLocation(" + valueCode + ", " + id + ".getY());"; } - if (name.equals("y")) { + if (name.equals(Y_ATTRIBUTE)) { return id + ".setLocation(" + id + ".getX(), " + valueCode + ");"; } - if (name.equals("width")) { // need to optimize case when both width and height are being assigned + if (name.equals(WIDTH_ATTRIBUTE)) { + // need to optimize case when both width and height are being assigned return Util.class.getName() + ".setComponentWidth(" + id + "," + valueCode + ");"; } - if (name.equals("height")) { + if (name.equals(HEIGHT_ATTRIBUTE)) { return Util.class.getName() + ".setComponentHeight(" + id + "," + valueCode + ");"; } - if (name.equals("font-face")) { + if (name.equals(FONT_FACE_ATTRIBUTE)) { return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(new Font(" + valueCode + ", " + id + ".getFont().getStyle(), " + id + ".getFont().getSize()));\n}"; } - if (name.equals("font-size")) { + if (name.equals(FONT_SIZE_ATTRIBUTE)) { return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont((float) " + valueCode + "));\n}"; } - if (name.equals("font-weight")) { + if (name.equals(FONT_WEIGHT_ATTRIBUTE)) { if (valueCode.equals("\"bold\"")) { return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.BOLD));\n}"; } @@ -168,7 +191,7 @@ public class DefaultComponentHandler extends DefaultObjectHandler { compiler.reportError("font-weight must be either \"normal\" or \"bold\", found " + valueCode); return ""; } - if (name.equals("font-style")) { + if (name.equals(FONT_STYLE_ATTRIBUTE)) { if (valueCode.equals("\"italic\"")) { return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.ITALIC));\n}"; } @@ -183,8 +206,9 @@ public class DefaultComponentHandler extends DefaultObjectHandler { compiler.reportError("font-style must be either \"normal\" or \"italic\", found " + valueCode); return ""; } - if (ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass()) && name.equals("layout")) { // handle containerDelegate (e.g. contentPane on JFrame) - String cDelegate = (String) getJAXXBeanInfo().getJAXXBeanDescriptor().getValue("containerDelegate"); + if (ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass()) && name.equals(LAYOUT_ATTRIBUTE)) { + // handle containerDelegate (e.g. contentPane on JFrame) + String cDelegate = (String) getJAXXBeanInfo().getJAXXBeanDescriptor().getValue(CONTAINER_DELEGATE_ATTRIBUTE); if (cDelegate != null) { return id + '.' + cDelegate + "().setLayout(" + valueCode + ");"; } @@ -210,27 +234,27 @@ public class DefaultComponentHandler extends DefaultObjectHandler { //object.appendAdditionCode(object.getJavaCode() + ".putClientProperty(\"" + propertyName.substring(1) + "\", " + stringValue + ");"); return; } - if ("icon".equals(propertyName)) { + if (ICON_ATTRIBUTE.equals(propertyName)) { if (!(stringValue.startsWith("{") || stringValue.endsWith("}"))) { // this is a customized icon, add the icon creation code if (compiler.getConfiguration().isUseUIManagerForIcon()) { - stringValue = "{" + jaxx.runtime.Util.class.getName() + ".getUIManagerIcon(\"" + stringValue + "\")}"; + stringValue = "{" + Util.class.getName() + ".getUIManagerIcon(\"" + stringValue + "\")}"; } else { - stringValue = "{" + jaxx.runtime.Util.class.getName() + ".createImageIcon(\"" + stringValue + "\")}"; + stringValue = "{" + Util.class.getName() + ".createImageIcon(\"" + stringValue + "\")}"; } } - } else if ("actionIcon".equals(propertyName)) { + } else if (ACTION_ICON_ATTRIBUTE.equals(propertyName)) { // customized actionIcon property if (stringValue.startsWith("{") && stringValue.endsWith("}")) { // there is a script to define the action icon, this is forbidden compiler.reportError("the actionIcon does not support script, remove braces..., fix the file " + compiler.getOutputClassName()); return; } - propertyName = "icon"; + propertyName = ICON_ATTRIBUTE; if (compiler.getConfiguration().isUseUIManagerForIcon()) { - stringValue = "{" + jaxx.runtime.Util.class.getName() + ".getUIManagerActionIcon(\"" + stringValue + "\")}"; + stringValue = "{" + Util.class.getName() + ".getUIManagerActionIcon(\"" + stringValue + "\")}"; } else { - stringValue = "{" + jaxx.runtime.Util.class.getName() + ".createActionIcon(\"" + stringValue + "\")}"; + stringValue = "{" + Util.class.getName() + ".createActionIcon(\"" + stringValue + "\")}"; } } super.setAttribute(object, propertyName, stringValue, inline, compiler); @@ -273,7 +297,7 @@ public class DefaultComponentHandler extends DefaultObjectHandler { */ @Override protected int constantValue(String key, String value) { - if ((key.equals("mnemonic") || key.equals("displayedMnemonic"))) { + if ((key.equals(MNEMONIC_ATTRIBUTE) || key.equals(DISPLAYED_MNEMONIC_ATTRIBUTE))) { if (value.length() == 1) { return value.charAt(0); } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java index d40e925..c17de50 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java @@ -7,13 +7,13 @@ package jaxx.compiler.tags; import jaxx.compiler.CompilerException; import jaxx.compiler.UnsupportedAttributeException; import jaxx.compiler.CompiledObject; +import jaxx.compiler.CompiledObjectDecorator; import jaxx.compiler.JAXXCompiler; import jaxx.compiler.beans.JAXXBeanInfo; import jaxx.compiler.beans.JAXXEventSetDescriptor; import jaxx.compiler.beans.JAXXIntrospector; import jaxx.compiler.beans.JAXXPropertyDescriptor; import jaxx.compiler.css.StylesheetHelper; -import jaxx.compiler.CompiledObjectDecorator; import jaxx.compiler.java.JavaArgument; import jaxx.compiler.java.JavaMethod; import jaxx.compiler.reflect.ClassDescriptor; @@ -24,6 +24,7 @@ import jaxx.compiler.types.TypeManager; import jaxx.runtime.ComponentDescriptor; import jaxx.runtime.JAXXObject; import jaxx.runtime.JAXXObjectDescriptor; +import jaxx.runtime.Util; import jaxx.runtime.css.Stylesheet; import org.w3c.dom.Attr; import org.w3c.dom.Element; @@ -44,7 +45,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.WeakHashMap; -import jaxx.runtime.Util; +import org.apache.commons.lang.StringUtils; /** * Default handler for class tags. Class tags are tags which represent instances of Java classes, @@ -59,17 +60,43 @@ import jaxx.runtime.Util; */ public class DefaultObjectHandler implements TagHandler { - /** The class that this handler provides support for. */ + public static final String ABSTRACT_ATTRIBUTE = "abstract"; + public static final String CONSTRAINTS_ATTRIBUTE = "constraints"; + public static final String CONSTRUCTOR_PARAMS_ATTRIBUTE = "constructorParams"; + public static final String DECORATOR_ATTRIBUTE = "decorator"; + public static final String DISPLAYED_MNEMONIC_ATTRIBUTE = "displayedMnemonic"; + public static final String DISPLAYED_MNEMONIC_INDEX_ATTRIBUTE = "displayedMnemonicIndex"; + public static final String GENERICTYPE_ATTRIBUTE = "genericType"; + public static final String ID_ATTRIBUTE = "id"; + public static final String IMPLEMENTS_ATTRIBUTE = "implements"; + public static final String JAVA_BEAN_ATTRIBUTE = "javaBean"; + public static final String LAYOUT_ATTRIBUTE = "layout"; + public static final String MNEMONIC_ATTRIBUTE = "mnemonic"; + public static final String STYLE_CLASS_ATTRIBUTE = "styleClass"; + public static final String SUPER_GENERIC_TYPE_ATTRIBUTE = "superGenericType"; + /** + * The class that this handler provides support for. + */ private ClassDescriptor beanClass; - /** The JAXXBeanInfo for the beanClass. */ + /** + * The JAXXBeanInfo for the beanClass. + */ protected JAXXBeanInfo jaxxBeanInfo; - /** Maps property names to their respective JAXXPropertyDescriptors. */ + /** + * Maps property names to their respective JAXXPropertyDescriptors. + */ private Map<String, JAXXPropertyDescriptor> properties; - /** Maps event names to their respective JAXXEventSetDescriptors. */ + /** + * Maps event names to their respective JAXXEventSetDescriptors. + */ private Map<String, JAXXEventSetDescriptor> events; - /** Maps property names to their respective ProxyEventInfos. */ + /** + * Maps property names to their respective ProxyEventInfos. + */ private Map<String, ProxyEventInfo> eventInfos; - /** Maps XML tags to the CompiledObjects created from them. */ + /** + * Maps XML tags to the CompiledObjects created from them. + */ protected static Map<Element, CompiledObject> objectMap = new WeakHashMap<Element, CompiledObject>(); /** @@ -80,9 +107,13 @@ public class DefaultObjectHandler implements TagHandler { */ private class ProxyEventInfo { - /** The name of the method or field being proxied, e.g. "getText". */ + /** + * The name of the method or field being proxied, e.g. "getText". + */ String memberName; - /** The "actual" event listener for the property in question, e.g. DocumentListener. */ + /** + * The "actual" event listener for the property in question, e.g. DocumentListener. + */ ClassDescriptor listenerClass; /** * In cases where a different object (such as a model) is more directly responsible for @@ -93,9 +124,13 @@ public class DefaultObjectHandler implements TagHandler { * attached to the new value, and the data binding to be processed. */ String modelName; - /** The name of the method used to add the "native" event listener, e.g. "addDocumentListener". */ + /** + * The name of the method used to add the "native" event listener, e.g. "addDocumentListener". + */ String addMethod; - /** The name of the method used to remove the "native" event listener, e.g. "removeDocumentListener". */ + /** + * The name of the method used to remove the "native" event listener, e.g. "removeDocumentListener". + */ String removeMethod; } @@ -112,8 +147,7 @@ public class DefaultObjectHandler implements TagHandler { /** * Performs introspection on the beanClass and stores the results. * - * @throws java.beans.IntrospectionException - * TODO + * @throws java.beans.IntrospectionException if any pb */ protected void init() throws IntrospectionException { if (jaxxBeanInfo == null) { @@ -164,8 +198,7 @@ public class DefaultObjectHandler implements TagHandler { * * @param beanClass the bean class for which to retrieve <code>JAXXBeanInfo</code> * @return the class' <code>JAXXBeanInfo</code> - * @throws java.beans.IntrospectionException - * ? + * @throws java.beans.IntrospectionException if any pb */ public static JAXXBeanInfo getJAXXBeanInfo(ClassDescriptor beanClass) throws IntrospectionException { return JAXXIntrospector.getJAXXBeanInfo(beanClass); @@ -196,14 +229,13 @@ public class DefaultObjectHandler implements TagHandler { } /** - * @param name ? + * @param name name of the property * @return <code>true</code> if the named member is <i>bound</i> (fires <code>PropertyChangeEvent</code> * when modified). Members are either fields (represented by the simple name of the field) or <code>get/is</code> * methods (represented by the simple name of the method, <b>not</b> the simplified JavaBeans-style name). * Methods which are not actually bound in their native class, but for which proxy events have been * configured (such as <code>JTextField.getText</code>, return <code>true</code>. - * @throws UnsupportedAttributeException - * ? + * @throws UnsupportedAttributeException if attribute is not supported */ public boolean isMemberBound(String name) throws UnsupportedAttributeException { try { @@ -282,15 +314,15 @@ public class DefaultObjectHandler implements TagHandler { boolean methodExists = compiler.hasMethod(methodName); ClassDescriptor eventClass = getEventClass(eventInfo.listenerClass); if (!methodExists) { - compiler.addMethodToJavaFile(new JavaMethod(Modifier.PUBLIC, "void", methodName, + compiler.getJavaFile().addMethod(new JavaMethod(Modifier.PUBLIC, "void", methodName, new JavaArgument[]{new JavaArgument(JAXXCompiler.getCanonicalName(eventClass), "event")}, null, propertyChangeListenerCode + ".propertyChange(null);", false)); } - String code = objectCode + (eventInfo.modelName != null ? ".get" + org.apache.commons.lang.StringUtils.capitalize(eventInfo.modelName) + "()" : ""); + String code = objectCode + (eventInfo.modelName != null ? ".get" + StringUtils.capitalize(eventInfo.modelName) + "()" : ""); result.append("$bindingSources.put(\"").append(code).append("\", ").append(code).append(");").append(JAXXCompiler.getLineSeparator()); result.append(code).append('.').append(eventInfo.addMethod).append("((").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(") jaxx.runtime.Util.getEventListener(").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(compiler.getJavaCode(methodName)).append("));\n"); if (eventInfo.modelName != null) { - result.append(getAddMemberListenerCode(objectCode, dataBinding, "get" + org.apache.commons.lang.StringUtils.capitalize(eventInfo.modelName), + result.append(getAddMemberListenerCode(objectCode, dataBinding, "get" + StringUtils.capitalize(eventInfo.modelName), Util.class.getName() + ".getDataBindingUpdateListener(this , \"" + dataBinding + "\")", compiler)); } @@ -310,14 +342,21 @@ public class DefaultObjectHandler implements TagHandler { } } if (propertyName != null) { + //TC-20091026 when on root object, do not prefix with objectCode + String prefix = objectCode.trim() + "."; + if (objectCode.equals(compiler.getRootObject().getJavaCode())) { + prefix = ""; + } try { // check for property-specific addPropertyChangeListener method getBeanClass().getMethodDescriptor("addPropertyChangeListener", ClassDescriptorLoader.getClassDescriptor(String.class), ClassDescriptorLoader.getClassDescriptor(PropertyChangeListener.class)); - return objectCode + ".addPropertyChangeListener(\"" + propertyName + "\", " + propertyChangeListenerCode + ");\n"; +// return objectCode + ".addPropertyChangeListener(\"" + propertyName + "\", " + propertyChangeListenerCode + ");\n"; + return prefix + "addPropertyChangeListener(\"" + propertyName + "\", " + propertyChangeListenerCode + ");\n"; } catch (NoSuchMethodException e) { // no property-specific method, use general one - return objectCode + ".addPropertyChangeListener(" + propertyChangeListenerCode + ");\n"; +// return objectCode + ".addPropertyChangeListener(" + propertyChangeListenerCode + ");\n"; + return prefix + "addPropertyChangeListener(" + propertyChangeListenerCode + ");\n"; } } return null; @@ -330,23 +369,25 @@ public class DefaultObjectHandler implements TagHandler { } ProxyEventInfo eventInfo = eventInfos != null ? eventInfos.get(memberName) : null; - if (eventInfo != null) { // a "proxied" event is one that doesn't fire PropertyChangeEvent, so we need to convert its native event type into PropertyChangeEvents + if (eventInfo != null) { + // a "proxied" event is one that doesn't fire PropertyChangeEvent, + // so we need to convert its native event type into PropertyChangeEvents StringBuffer result = new StringBuffer(); String methodName = "$pr" + compiler.getUniqueId(propertyChangeListenerCode); boolean methodExists = compiler.hasMethod(methodName); if (!methodExists) { ClassDescriptor eventClass = getEventClass(eventInfo.listenerClass); - compiler.addMethodToJavaFile(new JavaMethod(Modifier.PUBLIC, "void", methodName, + compiler.getJavaFile().addMethod(new JavaMethod(Modifier.PUBLIC, "void", methodName, new JavaArgument[]{new JavaArgument(JAXXCompiler.getCanonicalName(eventClass), "event")}, null, propertyChangeListenerCode + ".propertyChange(null);", false)); } try { - String modelMemberName = eventInfo.modelName != null ? "get" + org.apache.commons.lang.StringUtils.capitalize(eventInfo.modelName) : null; + String modelMemberName = eventInfo.modelName != null ? "get" + StringUtils.capitalize(eventInfo.modelName) : null; String modelClassName = modelMemberName != null ? getBeanClass().getMethodDescriptor(modelMemberName).getReturnType().getName() : JAXXCompiler.getCanonicalName(getBeanClass()); String code = objectCode + (eventInfo.modelName != null ? "." + modelMemberName + "()" : ""); result.append("((").append(modelClassName).append(") $bindingSources.remove(\"").append(code).append("\")).").append(eventInfo.removeMethod).append("((").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(") jaxx.runtime.Util.getEventListener(").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(compiler.getJavaCode(methodName)).append("));\n"); if (eventInfo.modelName != null) { - result.append(getRemoveMemberListenerCode(objectCode, dataBinding, "get" + org.apache.commons.lang.StringUtils.capitalize(eventInfo.modelName), + result.append(getRemoveMemberListenerCode(objectCode, dataBinding, "get" + StringUtils.capitalize(eventInfo.modelName), Util.class.getName() + ".getDataBindingUpdateListener(this, \"" + dataBinding + "\")", compiler)); } @@ -369,14 +410,21 @@ public class DefaultObjectHandler implements TagHandler { } } if (propertyName != null) { + //TC-20091026 when on root object, do not prefix with objectCode + String prefix = objectCode.trim() + "."; + if (objectCode.equals(compiler.getRootObject().getJavaCode())) { + prefix = ""; + } try { // check for property-specific removePropertyChangeListener method getBeanClass().getMethodDescriptor("removePropertyChangeListener", ClassDescriptorLoader.getClassDescriptor(String.class), ClassDescriptorLoader.getClassDescriptor(PropertyChangeListener.class)); - return objectCode + ".removePropertyChangeListener(\"" + propertyName + "\", " + propertyChangeListenerCode + ");\n"; +// return objectCode + ".removePropertyChangeListener(\"" + propertyName + "\", " + propertyChangeListenerCode + ");\n"; + return prefix + "removePropertyChangeListener(\"" + propertyName + "\", " + propertyChangeListenerCode + ");\n"; } catch (NoSuchMethodException e) { // no property-specific method, use general one - return objectCode + ".removePropertyChangeListener(" + propertyChangeListenerCode + ");\n"; +// return objectCode + ".removePropertyChangeListener(" + propertyChangeListenerCode + ");\n"; + return prefix + "removePropertyChangeListener(" + propertyChangeListenerCode + ");\n"; } } return null; @@ -505,7 +553,7 @@ public class DefaultObjectHandler implements TagHandler { throw new IllegalStateException("unable to find CompiledObject associated with tag <" + tag.getTagName() + ">; should have been registered before second pass"); } compiler.checkOverride(object); - String constructorParams = tag.getAttribute("constructorParams"); + String constructorParams = tag.getAttribute(CONSTRUCTOR_PARAMS_ATTRIBUTE); if (constructorParams != null && constructorParams.length() > 0) { object.setConstructorParams(compiler.getScriptManager().trimScript(constructorParams)); } @@ -522,13 +570,13 @@ public class DefaultObjectHandler implements TagHandler { } public void registerCompiledObject(Element tag, JAXXCompiler compiler) { - String id = tag.getAttribute("id"); + String id = tag.getAttribute(ID_ATTRIBUTE); if (id == null || id.length() == 0) { id = compiler.getAutoId(getBeanClass()); } CompiledObject object = createCompiledObject(id, compiler); objectMap.put(tag, object); - String styleClass = tag.getAttribute("styleClass").trim(); + String styleClass = tag.getAttribute(STYLE_CLASS_ATTRIBUTE).trim(); if (styleClass.length() > 0) { object.setStyleClass(styleClass); } @@ -536,7 +584,8 @@ public class DefaultObjectHandler implements TagHandler { } /** - * Creates the <code>CompiledObject</code> which will represent the object created by this <code>TagHandler</code>. + * Creates the <code>CompiledObject</code> which will represent the object + * created by this <code>TagHandler</code>. * * @param id the <code>CompiledObject's</code> ID. * @param compiler compiler to use @@ -547,8 +596,8 @@ public class DefaultObjectHandler implements TagHandler { } /** - * Initializes the default settings of the object, prior to setting its attribute values. The default - * implementation does nothing. + * Initializes the default settings of the object, prior to setting its + * attribute values. The default implementation does nothing. * * @param object the object to initialize * @param tag the tag being compiled @@ -561,8 +610,7 @@ public class DefaultObjectHandler implements TagHandler { * @param property property name to test * @return <code>true</code> if the specified property should be inherited by child components when specified * via CSS. - * @throws UnsupportedAttributeException - * ? + * @throws UnsupportedAttributeException if attribute is not supported */ public boolean isPropertyInherited(String property) throws UnsupportedAttributeException { return false; @@ -596,13 +644,13 @@ public class DefaultObjectHandler implements TagHandler { for (Attr attribute : attributes) { String name = attribute.getName(); String value = attribute.getValue(); - if (name.equals("javaBean")) { + if (name.equals(JAVA_BEAN_ATTRIBUTE)) { //compiler.preprocessScript(value); continue; } - if (name.equals("constraints") || isEventHandlerName(name)) { + if (name.equals(CONSTRAINTS_ATTRIBUTE) || isEventHandlerName(name)) { compiler.preprocessScript(value); // adds dependencies as a side effect - } else if (name.equals("constructorParams")) { + } else if (name.equals(CONSTRUCTOR_PARAMS_ATTRIBUTE)) { for (String param : value.split("\\s*,\\s*")) { compiler.preprocessScript(param); } @@ -633,22 +681,26 @@ public class DefaultObjectHandler implements TagHandler { for (Attr attribute : attributes) { String name = attribute.getName(); String value = attribute.getValue().trim(); - if (name.equals("id") || name.equals("constraints") || name.equals("constructorParams") || name.equals("styleClass") || - name.startsWith("xmlns") || JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { + if (name.equals(ID_ATTRIBUTE) || + name.equals(CONSTRAINTS_ATTRIBUTE) || + name.equals(CONSTRUCTOR_PARAMS_ATTRIBUTE) || + name.equals(STYLE_CLASS_ATTRIBUTE) || + name.startsWith(XMLNS_ATTRIBUTE) || + JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { // ignore, already handled continue; } - if (name.equals("javaBean")) { + if (name.equals(JAVA_BEAN_ATTRIBUTE)) { object.setJavaBean(true); if (!value.isEmpty()) { object.setJavaBeanInitCode(value); } continue; } - if (name.equals("implements")) { + if (name.equals(IMPLEMENTS_ATTRIBUTE)) { if (object != compiler.getRootObject()) { // can ony be apply to root object - compiler.reportError("'implements' attribute can only be found on root tag but was found on tag " + tag); + compiler.reportError("'" + IMPLEMENTS_ATTRIBUTE + "' attribute can only be found on root tag but was found on tag " + tag); return; } String[] interfaces = value.split(","); @@ -656,17 +708,17 @@ public class DefaultObjectHandler implements TagHandler { continue; } - if (name.equals("abstract")) { + if (name.equals(ABSTRACT_ATTRIBUTE)) { if (object != compiler.getRootObject()) { // can ony be apply to root object - compiler.reportError("'abstract' attribute can only be found on root tag but was found on tag " + tag); + compiler.reportError("'" + ABSTRACT_ATTRIBUTE + "' attribute can only be found on root tag but was found on tag " + tag); return; } compiler.setAbstractClass(true); continue; } - if (name.equals("genericType")) { + if (name.equals(GENERICTYPE_ATTRIBUTE)) { //TC-20090313 check after all atributes been processed if (object == compiler.getRootObject()) { compiler.setGenericType(value); @@ -676,17 +728,17 @@ public class DefaultObjectHandler implements TagHandler { continue; } - if (name.equals("superGenericType")) { + if (name.equals(SUPER_GENERIC_TYPE_ATTRIBUTE)) { if (object != compiler.getRootObject()) { // can ony be apply to root object - compiler.reportError("'superGenericType' attribute can only be found on root tag but was found on tag " + tag); + compiler.reportError("'" + SUPER_GENERIC_TYPE_ATTRIBUTE + "' attribute can only be found on root tag but was found on tag " + tag); return; } compiler.setSuperGenericType(value); continue; } - if (name.equals("decorator")) { + if (name.equals(DECORATOR_ATTRIBUTE)) { if (!value.isEmpty()) { CompiledObjectDecorator decorator = compiler.getEngine().getDecorator(value); object.setDecorator(decorator); @@ -734,7 +786,9 @@ public class DefaultObjectHandler implements TagHandler { * @return the attribute's priority */ protected int getAttributeOrdering(Attr attr) { - if (attr.getName().equals("displayedMnemonicIndex") || attr.getName().equals("displayedMnemonic") || attr.getName().equals("mnemonic")) { + if (attr.getName().equals(DISPLAYED_MNEMONIC_INDEX_ATTRIBUTE) || + attr.getName().equals(DISPLAYED_MNEMONIC_ATTRIBUTE) || + attr.getName().equals(MNEMONIC_ATTRIBUTE)) { return 1; } return 0; @@ -776,7 +830,15 @@ public class DefaultObjectHandler implements TagHandler { // check for data binding & remove if found JAXXObjectDescriptor jaxxObjectDescriptor = object.getObjectClass().getJAXXObjectDescriptor(); ComponentDescriptor root = jaxxObjectDescriptor.getComponentDescriptors()[0]; - object.appendInitializationCode(object.getJavaCode() + ".removeDataBinding(" + compiler.getJavaCode(root.getId() + "." + propertyName) + ");"); + //TC-20091026 do not prefix binding by object id if on root object + String prefix; + if (object == compiler.getRootObject()) { + prefix = ""; + } else { + prefix = object.getId() + "."; + } + object.appendInitializationCode(prefix + "removeDataBinding(" + compiler.getJavaCode(root.getId() + "." + propertyName) + ");"); +// object.appendInitializationCode(object.getJavaCode() + ".removeDataBinding(" + compiler.getJavaCode(root.getId() + "." + propertyName) + ");"); } object.addProperty(propertyName, stringValue); ClassDescriptor type = getPropertyType(object, propertyName, compiler); @@ -796,7 +858,7 @@ public class DefaultObjectHandler implements TagHandler { propertyType != ClassDescriptorLoader.getClassDescriptor(Character.class)) { //binding = "((" + propertyType.getName() + ") " + binding + ")"; } - if (propertyName.equals("layout")) { // handle containerDelegate (e.g. contentPane on JFrame) + if (propertyName.equals(LAYOUT_ATTRIBUTE)) { // handle containerDelegate (e.g. contentPane on JFrame) // have to set layout early, before children are added object.appendInitializationCode(getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler)); } @@ -959,7 +1021,15 @@ public class DefaultObjectHandler implements TagHandler { JAXXPropertyDescriptor property = properties.get(name); if (property != null) { if (property.getWriteMethodDescriptor() != null) { - return javaCode + '.' + property.getWriteMethodDescriptor().getName() + '(' + valueCode + ");"; + //TC-20091026 do not prefix by javaCode if on root object + String prefix; + if (compiler.getRootObject().getJavaCode().equals(javaCode)) { + prefix = ""; + } else { + prefix = javaCode + "."; + } + return prefix + property.getWriteMethodDescriptor().getName() + '(' + valueCode + ");"; +// return javaCode + '.' + property.getWriteMethodDescriptor().getName() + '(' + valueCode + ");"; } throw new UnsupportedAttributeException("property '" + name + "' of " + getBeanClass().getName() + " is read-only"); } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/ScriptHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/ScriptHandler.java index 0b57ebc..c628765 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/ScriptHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/ScriptHandler.java @@ -27,6 +27,8 @@ import java.io.StringWriter; */ public class ScriptHandler implements TagHandler { + public static final String SOURCE_ATTRIBUTE = "source"; + @Override public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { File scriptFile = null; @@ -35,7 +37,7 @@ public class ScriptHandler implements TagHandler { Attr attribute = (Attr) attributes.item(i); String name = attribute.getName(); String attrValue = attribute.getValue(); - if (name.equals("source")) { + if (name.equals(SOURCE_ATTRIBUTE)) { scriptFile = new File(compiler.getBaseDir(), attrValue.replace('/', File.separatorChar)); StringWriter scriptBuffer = new StringWriter(); try { @@ -49,7 +51,8 @@ public class ScriptHandler implements TagHandler { compiler.reportError("script file not found: " + scriptFile); } compiler.registerScript(scriptBuffer.toString(), scriptFile); - } else if (!name.startsWith("xmlns") && !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { + } else if (!name.startsWith(XMLNS_ATTRIBUTE) && + !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { throw new UnsupportedAttributeException(name); } } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java index a9685c4..c5d1409 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java @@ -38,6 +38,7 @@ import java.util.Map; * @author Ethan Nicholas */ public class StyleHandler implements TagHandler { + public static final String SOURCE_ATTRIBUTE = "source"; @Override public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { @@ -47,7 +48,7 @@ public class StyleHandler implements TagHandler { Attr attribute = (Attr) attributes.item(i); String name = attribute.getName(); String attrValue = attribute.getValue(); - if (name.equals("source")) { + if (name.equals(SOURCE_ATTRIBUTE)) { source = true; File styleFile = new File(compiler.getBaseDir(), attrValue.replace('/', File.separatorChar)); StringWriter styleBuffer = new StringWriter(); @@ -64,7 +65,8 @@ public class StyleHandler implements TagHandler { compiler.getSourceFiles().push(styleFile); compiler.registerStylesheet(processStylesheet(styleBuffer.toString())); compiler.getSourceFiles().pop(); - } else if (!name.startsWith("xmlns") && !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { + } else if (!name.startsWith(XMLNS_ATTRIBUTE) && + !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { throw new UnsupportedAttributeException(name); } } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagHandler.java index 8867da2..f18c8d2 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagHandler.java @@ -20,6 +20,8 @@ import java.io.IOException; */ public interface TagHandler { + String XMLNS_ATTRIBUTE = "xmlns"; + /** * Performs the first pass of compilation on an XML tag from a JAXX source file. * <code>TagHandler</code> implementations affect the generated <code>.java</code> diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java index 2b5e8ab..c92bf6a 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java @@ -18,21 +18,32 @@ import java.util.HashMap; import java.util.Map; import java.util.Set; -/** Manages TagHandlers, including automatically compiling .jaxx files corresponding to class tags. */ +/** + * Manages TagHandlers, including automatically compiling .jaxx files + * corresponding to class tags. + */ public class TagManager { - /** log */ + /** + * Logger + */ protected static final Log log = LogFactory.getLog(TagManager.class); /** * Namespace for JAXX's non-class tags, such as <script;>. The namespace normally does not * need to be specified but can be used to resolve ambiguities. */ public static final String JAXX_NAMESPACE = "http://www.jaxxframework.org/"; - /** Maps simple tag names to their default namespaces (package names). */ + /** + * Maps simple tag names to their default namespaces (package names). + */ private static Map<String, String> defaultNamespaces = new HashMap<String, String>(); - /** Maps qualified tag names to the TagHandlers responsible for processing them. */ + /** + * Maps qualified tag names to the TagHandlers responsible for processing them. + */ private static Map<QName, TagHandler> registeredTags = new HashMap<QName, TagHandler>(); - /** Keeps track of whether or not named classes exist. */ + /** + * Keeps track of whether or not named classes exist. + */ private static Map<String, Boolean> classExistenceCache = new HashMap<String, Boolean>(); /** * Maps bean classes to their TagHandler classes. The mapping is to TagHandler classes, rather than to @@ -233,21 +244,23 @@ public class TagManager { boolean found = false; ClassLoader classLoader = compiler.getClassLoader(); try { - Class.forName(className, true,classLoader); + Class.forName(className, true, classLoader); found = true; } catch (ClassNotFoundException e) { // ignore ? - } catch (NoClassDefFoundError e) { + } catch (NoClassDefFoundError e) { // we obtain this instead of ClassNotFoundException on case-insensitive file systems when // looking up a class with the wrong case } - if (!found) { // couldn't find .class, check for .java + if (!found) { + // couldn't find .class, check for .java URL javaURL = classLoader.getResource(className.replace('.', '/') + ".java"); found = javaURL != null; } - if (!found) { // couldn't find .java, check for .jaxx + if (!found) { + // couldn't find .java, check for .jaxx URL jaxxURL = classLoader.getResource(className.replace('.', '/') + ".jaxx"); found = jaxxURL != null; } @@ -260,12 +273,14 @@ public class TagManager { private static String determinePackage(String simpleClassName, String defaultPackage, JAXXCompiler compiler) { String namespace = null; Set<String> classes = compiler.getImportedClasses(); - for (String className : classes) { // search class imports (e.g. import java.util.Date;) + for (String className : classes) { + // search class imports (e.g. import java.util.Date;) if (className.equals(simpleClassName) || className.endsWith("." + simpleClassName)) { namespace = className.substring(0, className.lastIndexOf(".") + 1) + "*"; } } - if (namespace == null) { // search package imports (e.g. import java.util.*;) + if (namespace == null) { + // search package imports (e.g. import java.util.*;) Set<String> searchList = compiler.getImportedPackages(); if (defaultPackage != null) { if (!defaultPackage.endsWith("*")) { @@ -278,7 +293,8 @@ public class TagManager { for (String currentPackage : searchList) { String className = currentPackage + simpleClassName; if (classExists(className, compiler)) { - if (namespace != null) { // we've already found the same name in another package + if (namespace != null) { + // we've already found the same name in another package compiler.reportError("symbol '" + simpleClassName + "' is ambiguous, found matching classes " + namespace.substring(0, namespace.length() - 1) + simpleClassName + " and " + currentPackage + simpleClassName + ". Use fully-qualified name to disambiguate."); return null; } diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java index 870050b..daae511 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java @@ -37,8 +37,6 @@ import org.nuiton.io.MirroredFileUpdater; import java.io.File; import java.io.IOException; import java.util.Map; -import java.net.URL; -import java.net.URLClassLoader; import java.util.Arrays; import java.util.HashMap; import java.util.Set; @@ -379,7 +377,11 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat } if (verbose) { - printInit(); + getLog().info(toString()); + getLog().info("includes : " + Arrays.toString(includes)); + for (String file : files) { + getLog().info("will parse " + file); + } } return true; } @@ -400,12 +402,12 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat TagManager.reset(verbose); engine = JAXXEngine.newLaunchor(src, files, this); - boolean success = engine.run(); + int nbFiles = engine.run(); report(engine); - if (!success) { + if (nbFiles == -1) { throw new MojoExecutionException("Aborting due to errors reported by jaxxc"); } - getLog().info("Generated " + engine.getCompilerCount() + " file(s). "); + getLog().info("Generated " + nbFiles + " file(s). "); if (generateHelp) { // generate help @@ -540,34 +542,6 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat } } - protected void printInit() { - getLog().info(toString()); - getLog().info("includes : " + Arrays.toString(includes)); - for (String file : files) { - getLog().info("will parse " + file); - } - - ClassLoader threadLoader = Thread.currentThread().getContextClassLoader(); - getLog().info(threadLoader.toString()); - if (threadLoader.getClass().getSimpleName().equals("RealmClassLoader")) { - try { - java.lang.reflect.Method m = threadLoader.getClass().getDeclaredMethod("getURLs"); - m.setAccessible(true); - URL[] urls = (URL[]) m.invoke(threadLoader); - - for (URL url : urls) { - getLog().info("url in class loader " + url); - } - } catch (Exception e) { - getLog().warn("??? : " + e.getMessage(), e); - } - } else if (threadLoader instanceof URLClassLoader) { - for (URL u : ((URLClassLoader) threadLoader).getURLs()) { - getLog().info("url in class loader " + u); - } - } - } - protected void generateHelp() throws IOException { Set<String> helpIds = HelpRootCompiledObjectDecorator.getHelpIds(); if (helpIds.isEmpty()) { diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1751Test.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1751Test.java index 1ac11fa..7dca837 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1751Test.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1751Test.java @@ -12,7 +12,7 @@ public class Bug1751Test extends JaxxBaseTest { assertNumberJaxxFiles(3); checkPattern(mojo, "implements java.io.Serializable", true); - checkPattern(mojo, "label.setText(_(\"test\"))", true); + checkPattern(mojo, "setText(_(\"test\"))", true); } } \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java index e82f772..0f53d1e 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java @@ -9,7 +9,7 @@ public class DecoratorTest extends JaxxBaseTest { GenerateMojo mojo = getMojo(); mojo.execute(); assertNumberJaxxFiles(1); - checkPattern(mojo, "root.add(jaxx.runtime.SwingUtil.boxComponentWithJxLayer(boxedButton))", true); + checkPattern(mojo, "add(jaxx.runtime.SwingUtil.boxComponentWithJxLayer(boxedButton))", true); } } \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/I18nTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/I18nTest.java index 4a1e183..7d18479 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/I18nTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/I18nTest.java @@ -9,11 +9,11 @@ public class I18nTest extends JaxxBaseTest { GenerateMojo mojo = getMojo(); mojo.i18nable = false; mojo.execute(); - checkPattern(mojo, "testId.setText(_(\"test.text\"));", false); + checkPattern(mojo, "setText(_(\"test.text\"));", false); mojo.i18nable = true; mojo.execute(); - checkPattern(mojo, "testId.setText(_(\"test.text\"));", true); + checkPattern(mojo, "setText(_(\"test.text\"));", true); checkPattern(mojo, "\"_(\\\"test.text\\\")\"", false); } @@ -22,11 +22,11 @@ public class I18nTest extends JaxxBaseTest { GenerateMojo mojo = getMojo(); mojo.i18nable = false; mojo.execute(); - checkPattern(mojo, "testId.setTitle(_(\"test.title\"));", false); + checkPattern(mojo, "setTitle(_(\"test.title\"));", false); mojo.i18nable = true; mojo.execute(); - checkPattern(mojo, "testId.setTitle(_(\"test.title\"));", true); + checkPattern(mojo, "setTitle(_(\"test.title\"));", true); checkPattern(mojo, "\"_(\\\"test.title\\\")\"", false); } @@ -35,11 +35,11 @@ public class I18nTest extends JaxxBaseTest { GenerateMojo mojo = getMojo(); mojo.i18nable = false; mojo.execute(); - checkPattern(mojo, "testId.setToolTipText(_(\"test.toolTipText\"));", false); + checkPattern(mojo, "setToolTipText(_(\"test.toolTipText\"));", false); mojo.i18nable = true; mojo.execute(); - checkPattern(mojo, "testId.setToolTipText(_(\"test.toolTipText\"));", true); + checkPattern(mojo, "setToolTipText(_(\"test.toolTipText\"));", true); checkPattern(mojo, "\"_(\\\"test.toolTipText\\\")\"", false); } } diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test1.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test1.jaxx index 516f523..bd317d4 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test1.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test1.jaxx @@ -1 +1 @@ -<JLabel id='label' implements="java.io.Serializable" text='test'/> \ No newline at end of file +<JLabel implements="java.io.Serializable" text='test'/> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test2.jaxx index ee048c4..c3f561d 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test2.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test2.jaxx @@ -1 +1 @@ -<JLabel id='label' text='test' implements="java.io.Serializable"/> \ No newline at end of file +<JLabel text='test' implements="java.io.Serializable"/> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test3.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test3.jaxx index 47a5c50..bd317d4 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test3.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test3.jaxx @@ -1 +1 @@ -<JLabel implements="java.io.Serializable" text='test' id='label'/> \ No newline at end of file +<JLabel implements="java.io.Serializable" text='test'/> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/BoxedDecorator.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/BoxedDecorator.jaxx index ae341b8..d0703de 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/BoxedDecorator.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/BoxedDecorator.jaxx @@ -1,3 +1,3 @@ -<JPanel id='root'> +<JPanel> <JButton id='boxedButton' decorator='boxed'/> </JPanel> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/text/JButton.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/text/JButton.jaxx index 722fe25..69f8007 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/text/JButton.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/text/JButton.jaxx @@ -1 +1 @@ -<javax.swing.JButton id='testId' text='test.text'/> \ No newline at end of file +<javax.swing.JButton text='test.text'/> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JDialog.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JDialog.jaxx index 46aa29f..001fc2f 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JDialog.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JDialog.jaxx @@ -1 +1 @@ -<JDialog id='testId' title='test.title'/> +<JDialog title='test.title'/> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JTabbedPane.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JTabbedPane.jaxx index afbd648..25ab159 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JTabbedPane.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JTabbedPane.jaxx @@ -1,3 +1,3 @@ <JTabbedPane> - <tab id="testId" title='test.title'/> + <tab title='test.title'/> </JTabbedPane> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JTabbedPane2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JTabbedPane2.jaxx index 97d0f77..759b1b2 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JTabbedPane2.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JTabbedPane2.jaxx @@ -1,5 +1,5 @@ <JTabbedPane> - <tab id="testId" title='test.title'> + <tab title='test.title'> <JLabel text='testLabel'/> </tab> </JTabbedPane> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JButton.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JButton.jaxx index 1bbef52..8e0de32 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JButton.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JButton.jaxx @@ -1 +1 @@ -<javax.swing.JButton id='testId' toolTipText='test.toolTipText'/> \ No newline at end of file +<javax.swing.JButton toolTipText='test.toolTipText'/> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane.jaxx index ae54930..4aa45be 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane.jaxx @@ -1,3 +1,3 @@ - <JTabbedPane id="testId" toolTipText='test.toolTipText'> + <JTabbedPane toolTipText='test.toolTipText'> <tab title="text"/> </JTabbedPane> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane2.jaxx index ed2ae79..a233834 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane2.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane2.jaxx @@ -1,3 +1,3 @@ <JTabbedPane> - <tab id="testId" toolTipText='test.toolTipText'/> + <tab toolTipText='test.toolTipText'/> </JTabbedPane> \ No newline at end of file diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane3.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane3.jaxx index 43dda47..3f3575a 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane3.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane3.jaxx @@ -1,5 +1,5 @@ <JTabbedPane> - <tab id="testId" toolTipText='test.toolTipText'> + <tab toolTipText='test.toolTipText'> <JLabel text='yo'/> </tab> </JTabbedPane> \ No newline at end of file -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 352005675825bde3344d3039683740c7e813170a Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 26 19:08:21 2009 +0000 update license header --- jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java | 2 +- .../src/main/java/jaxx/demo/DemoTreeHelper.java | 2 +- jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java | 2 +- jaxx-demo/src/main/java/jaxx/demo/RunDemo.java | 2 +- .../component/jaxx/editor/NumberEditorDemoModel.java | 2 +- .../jaxx/navigation/FullNavigationTreeHelper.java | 2 +- .../navigation/FullNavigationTreeModelBuilder.java | 20 ++++++++++++++++++++ .../jaxx/demo/component/jaxx/navigation/Movie.java | 2 +- .../jaxx/demo/component/jaxx/navigation/People.java | 2 +- .../jaxx/navigation/content/ContentUIHandler.java | 20 ++++++++++++++++++++ .../item/ExempleItemTreeNavigationAdapter.java | 2 +- .../java/jaxx/demo/feature/validation/Identity.java | 2 +- .../java/jaxx/demo/feature/validation/Model.java | 2 +- .../main/java/jaxx/demo/fun/CalculatorEngine.java | 2 +- .../java/jaxx/demo/BeanValidatorDetectorTest.java | 20 ++++++++++++++++++++ 15 files changed, 72 insertions(+), 12 deletions(-) diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java b/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java index 53efae0..10b6b62 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java @@ -1,6 +1,6 @@ /* * *##% - * jaxx-demo + * JAXX Demo * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java b/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java index be4a442..1f8976f 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoTreeHelper.java @@ -1,6 +1,6 @@ /* * *##% - * jaxx-demo + * JAXX Demo * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java b/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java index 7cd25b6..c7a1e42 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java @@ -1,6 +1,6 @@ /** * *##% - * jaxx-demo + * JAXX Demo * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify diff --git a/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java b/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java index 43ad5b5..7a54fe7 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java +++ b/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java @@ -1,6 +1,6 @@ /* * *##% - * jaxx-demo + * JAXX Demo * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemoModel.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemoModel.java index 85fb9ea..a8daaea 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemoModel.java +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemoModel.java @@ -1,6 +1,6 @@ /* * *##% - * jaxx-demo + * JAXX Demo * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java index 9b8d6f3..e11ddd9 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java @@ -1,6 +1,6 @@ /* * *##% - * jaxx-demo + * JAXX Demo * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeModelBuilder.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeModelBuilder.java index acfeb84..7a80480 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeModelBuilder.java +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeModelBuilder.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Demo + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.demo.component.jaxx.navigation; import jaxx.runtime.JAXXContext; diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/Movie.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/Movie.java index 22e335a..e725b6c 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/Movie.java +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/Movie.java @@ -1,6 +1,6 @@ /* * *##% - * jaxx-demo + * JAXX Demo * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/People.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/People.java index c98f297..4f68dac 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/People.java +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/People.java @@ -1,6 +1,6 @@ /* * *##% - * jaxx-demo + * JAXX Demo * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUIHandler.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUIHandler.java index 87163b2..a767127 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUIHandler.java +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUIHandler.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Demo + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.demo.component.jaxx.navigation.content; import java.util.List; diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ExempleItemTreeNavigationAdapter.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ExempleItemTreeNavigationAdapter.java index cfdee12..c7fce63 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ExempleItemTreeNavigationAdapter.java +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ExempleItemTreeNavigationAdapter.java @@ -1,6 +1,6 @@ /* * *##% - * jaxx-demo + * JAXX Demo * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify diff --git a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Identity.java b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Identity.java index daeeaa0..55b13ed 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Identity.java +++ b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Identity.java @@ -1,6 +1,6 @@ /* * *##% - * jaxx-demo + * JAXX Demo * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify diff --git a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Model.java b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Model.java index 72a1e21..f549a88 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Model.java +++ b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/Model.java @@ -1,6 +1,6 @@ /* * *##% - * jaxx-demo + * JAXX Demo * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify diff --git a/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorEngine.java b/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorEngine.java index 01d4917..d64f479 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorEngine.java +++ b/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorEngine.java @@ -1,6 +1,6 @@ /* * *##% - * jaxx-demo + * JAXX Demo * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify diff --git a/jaxx-demo/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java b/jaxx-demo/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java index 2a3015c..7b4c245 100644 --- a/jaxx-demo/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java +++ b/jaxx-demo/src/test/java/jaxx/demo/BeanValidatorDetectorTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Demo + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.demo; import jaxx.demo.feature.validation.Model; -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit a74f64d5d0b7fed2b39bcbd518330c2430dd1de2 Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 26 19:11:57 2009 +0000 update jaxx files license header --- jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx | 4 +- jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx | 4 +- .../demo/component/jaxx/BoxedDecoratorDemo.jaxx | 184 ++++++++++----------- .../component/jaxx/StatusMessagePanelDemo.jaxx | 24 +-- .../component/jaxx/editor/ComboEditorDemo.jaxx | 72 ++++---- .../demo/component/jaxx/editor/I18nEditorDemo.jaxx | 4 +- .../component/jaxx/editor/NumberEditorDemo.jaxx | 2 +- .../jaxx/navigation/FullNavigationTreeDemo.jaxx | 2 +- .../jaxx/navigation/content/ActorContentUI.jaxx | 4 +- .../jaxx/navigation/content/ActorsContentUI.jaxx | 4 +- .../jaxx/navigation/content/ContentUI.jaxx | 4 +- .../jaxx/navigation/content/MovieContentUI.jaxx | 4 +- .../jaxx/navigation/content/MoviesContentUI.jaxx | 4 +- .../navigation/item/ItemTreeNavigationDemo.jaxx | 4 +- .../jaxx/demo/component/swing/JButtonDemo.jaxx | 60 +++---- .../jaxx/demo/component/swing/JCheckBoxDemo.jaxx | 78 ++++----- .../component/swing/JCheckBoxMenuItemDemo.jaxx | 120 +++++++------- .../jaxx/demo/component/swing/JComboBoxDemo.jaxx | 4 +- .../jaxx/demo/component/swing/JDialogDemo.jaxx | 160 +++++++++--------- .../java/jaxx/demo/component/swing/JListDemo.jaxx | 4 +- .../jaxx/demo/component/swing/JMenuItemDemo.jaxx | 4 +- .../demo/component/swing/JPasswordFieldDemo.jaxx | 22 +-- .../demo/component/swing/JProgressBarDemo.jaxx | 156 ++++++++--------- .../demo/component/swing/JRadioButtonDemo.jaxx | 24 +-- .../component/swing/JRadioButtonMenuItemDemo.jaxx | 30 ++-- .../jaxx/demo/component/swing/JSliderDemo.jaxx | 26 +-- .../jaxx/demo/component/swing/JSpinnerDemo.jaxx | 28 ++-- .../jaxx/demo/component/swing/JSplitPaneDemo.jaxx | 28 ++-- .../jaxx/demo/component/swing/JTextAreaDemo.jaxx | 68 ++++---- .../jaxx/demo/component/swing/JTextFieldDemo.jaxx | 46 +++--- .../demo/component/swing/JToggleButtonDemo.jaxx | 20 +-- .../feature/databinding/BaseBeanDataBinding.jaxx | 2 +- .../feature/databinding/BeanDataBindingDemo.jaxx | 2 +- .../feature/validation/ValidationListDemo.jaxx | 2 +- .../feature/validation/ValidationTableDemo.jaxx | 2 +- .../main/java/jaxx/demo/fun/CalculatorDemo.jaxx | 4 +- .../src/main/java/jaxx/demo/fun/CounterDemo.jaxx | 26 +-- .../main/java/jaxx/demo/fun/LabelStyleDemo.jaxx | 4 +- 38 files changed, 620 insertions(+), 620 deletions(-) diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx b/jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx index 215921e..224b302 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -115,4 +115,4 @@ private void $afterCompleteSetup() { <tab title='Sources'> <JTabbedPane id='sourceTabs' tabPlacement='{JTabbedPane.BOTTOM}'/> </tab> -</JTabbedPane> \ No newline at end of file +</JTabbedPane> diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx index ef5fd8a..7e17d00 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -107,4 +107,4 @@ private void $afterCompleteSetup() { <jaxx.runtime.swing.StatusMessagePanel id='p' constraints='BorderLayout.SOUTH'/> </JPanel> -</JFrame> \ No newline at end of file +</JFrame> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.jaxx index 1343bd6..99ad25f 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -18,94 +18,94 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> - -<jaxx.demo.DemoPanel> - <jaxx.runtime.swing.BlockingLayerUI id='layerUI' - blockIcon='{SwingUtil.createImageIcon("action-block.png")}' - acceptIcon='{SwingUtil.createImageIcon("action-accept.png")}' - useIcon='true' - blockingColor='{new Color(50,50,50)}' - acceptAction='{new AbstractAction() { private static final long serialVersionUID = 1L; - @Override - public void actionPerformed(ActionEvent e) { - accept(e, "from icon of layer"); - } - }}' /> - <jaxx.runtime.swing.BlockingLayerUI2 id='layerUI2' - blockIcon='{SwingUtil.createImageIcon("action-block.png")}' - acceptIcon='{SwingUtil.createImageIcon("action-accept.png")}' - acceptAction='{new AbstractAction() { private static final long serialVersionUID = 1L; - @Override - public void actionPerformed(ActionEvent e) { - accept(e, "from icon of layer"); - } - }}' /> - <script><![CDATA[ -import jaxx.runtime.SwingUtil; - -void $afterCompleteSetup() { - for (JComponent boxed : SwingUtil.getLayeredComponents(this)) { - if (boxed == d) { - SwingUtil.getLayer(boxed).setUI(layerUI2); - continue; - } - - jaxx.runtime.swing.BlockingLayerUI ui = layerUI.clone(); - if ( boxed == c) { - ui.setBlock(true); - } - SwingUtil.getLayer(boxed).setUI(ui); - } -} - -public void setLayer(boolean active) { - for (JComponent boxed : SwingUtil.getLayeredComponents(this)) { - if (boxed == d) { - continue; - } - jaxx.runtime.swing.BlockingLayerUI ui = (jaxx.runtime.swing.BlockingLayerUI)SwingUtil.getLayer(boxed).getUI(); - if ( boxed == c) { - ui.setBlock(active); - } - ui.setUseIcon(active); - } -} - -protected void accept(ActionEvent e, String suffix) { - JButton source = (JButton) e.getSource(); - String clickedMessage = (String) source.getClientProperty("clickedText"); - String msg = "'" + source.getText() + "' clicked - " + suffix + " : " + clickedMessage; - ((DefaultListModel)messages.getModel()).addElement(msg); -}]]> - </script> - <Table id='demoPanel' fill='both' weightx='1'> - <row> - <cell> - <JCheckBox id='toggle' selected='true' - text='{toggle.isSelected() ? "Active layer" : "No layer"}' - onActionPerformed='setLayer(toggle.isSelected());'/> - </cell> - </row> - <row> - <cell weighty='0.5'> - <JPanel layout='{new GridLayout(1,3,3,3)}'> - <JButton text='button A' decorator='boxed' _clickedText='"button A was clicked"' - onActionPerformed='accept(event, "from button (no layer)")'/> - <JButton text='button B' decorator='boxed' _clickedText='"button B was clicked"' - onActionPerformed='accept(event, "from button (no layer)")'/> - <JButton id='c' text='button C (full block)' decorator='boxed' _clickedText='"button C was clicked"' - onActionPerformed='accept(event, "from button (no layer)");'/> - <JButton id='d' text='button D (full block 2)' decorator='boxed' _clickedText='"button D was clicked"' - onActionPerformed='accept(event, "from button (no layer)");'/> - </JPanel> - </cell> - </row> - <row> - <cell weighty='0.5'> - <JScrollPane> - <JList id='messages' model='{new DefaultListModel()}'/> - </JScrollPane> - </cell> - </row> - </Table> -</jaxx.demo.DemoPanel> \ No newline at end of file + +<jaxx.demo.DemoPanel> + <jaxx.runtime.swing.BlockingLayerUI id='layerUI' + blockIcon='{SwingUtil.createImageIcon("action-block.png")}' + acceptIcon='{SwingUtil.createImageIcon("action-accept.png")}' + useIcon='true' + blockingColor='{new Color(50,50,50)}' + acceptAction='{new AbstractAction() { private static final long serialVersionUID = 1L; + @Override + public void actionPerformed(ActionEvent e) { + accept(e, "from icon of layer"); + } + }}' /> + <jaxx.runtime.swing.BlockingLayerUI2 id='layerUI2' + blockIcon='{SwingUtil.createImageIcon("action-block.png")}' + acceptIcon='{SwingUtil.createImageIcon("action-accept.png")}' + acceptAction='{new AbstractAction() { private static final long serialVersionUID = 1L; + @Override + public void actionPerformed(ActionEvent e) { + accept(e, "from icon of layer"); + } + }}' /> + <script><![CDATA[ +import jaxx.runtime.SwingUtil; + +void $afterCompleteSetup() { + for (JComponent boxed : SwingUtil.getLayeredComponents(this)) { + if (boxed == d) { + SwingUtil.getLayer(boxed).setUI(layerUI2); + continue; + } + + jaxx.runtime.swing.BlockingLayerUI ui = layerUI.clone(); + if ( boxed == c) { + ui.setBlock(true); + } + SwingUtil.getLayer(boxed).setUI(ui); + } +} + +public void setLayer(boolean active) { + for (JComponent boxed : SwingUtil.getLayeredComponents(this)) { + if (boxed == d) { + continue; + } + jaxx.runtime.swing.BlockingLayerUI ui = (jaxx.runtime.swing.BlockingLayerUI)SwingUtil.getLayer(boxed).getUI(); + if ( boxed == c) { + ui.setBlock(active); + } + ui.setUseIcon(active); + } +} + +protected void accept(ActionEvent e, String suffix) { + JButton source = (JButton) e.getSource(); + String clickedMessage = (String) source.getClientProperty("clickedText"); + String msg = "'" + source.getText() + "' clicked - " + suffix + " : " + clickedMessage; + ((DefaultListModel)messages.getModel()).addElement(msg); +}]]> + </script> + <Table id='demoPanel' fill='both' weightx='1'> + <row> + <cell> + <JCheckBox id='toggle' selected='true' + text='{toggle.isSelected() ? "Active layer" : "No layer"}' + onActionPerformed='setLayer(toggle.isSelected());'/> + </cell> + </row> + <row> + <cell weighty='0.5'> + <JPanel layout='{new GridLayout(1,3,3,3)}'> + <JButton text='button A' decorator='boxed' _clickedText='"button A was clicked"' + onActionPerformed='accept(event, "from button (no layer)")'/> + <JButton text='button B' decorator='boxed' _clickedText='"button B was clicked"' + onActionPerformed='accept(event, "from button (no layer)")'/> + <JButton id='c' text='button C (full block)' decorator='boxed' _clickedText='"button C was clicked"' + onActionPerformed='accept(event, "from button (no layer)");'/> + <JButton id='d' text='button D (full block 2)' decorator='boxed' _clickedText='"button D was clicked"' + onActionPerformed='accept(event, "from button (no layer)");'/> + </JPanel> + </cell> + </row> + <row> + <cell weighty='0.5'> + <JScrollPane> + <JList id='messages' model='{new DefaultListModel()}'/> + </JScrollPane> + </cell> + </row> + </Table> +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/StatusMessagePanelDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/StatusMessagePanelDemo.jaxx index 89c2879..b06cf61 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/StatusMessagePanelDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/StatusMessagePanelDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -18,14 +18,14 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<jaxx.demo.DemoPanel> - <JPanel id='demoPanel' layout='{new BorderLayout()}'> - <JPanel layout='{new GridLayout(0,1)}' constraints='BorderLayout.CENTER'> - <JButton text='Fool me once' - onActionPerformed='p.setStatus(((JButton)event.getSource()).getText() + " ? shame on you!")'/> - <JButton text='Fool me twice' - onActionPerformed='p.setStatus(((JButton)event.getSource()).getText() + " ? shame on ...")'/> - </JPanel> - <jaxx.runtime.swing.StatusMessagePanel id='p' constraints='BorderLayout.SOUTH'/> - </JPanel> -</jaxx.demo.DemoPanel> \ No newline at end of file +<jaxx.demo.DemoPanel> + <JPanel id='demoPanel' layout='{new BorderLayout()}'> + <JPanel layout='{new GridLayout(0,1)}' constraints='BorderLayout.CENTER'> + <JButton text='Fool me once' + onActionPerformed='p.setStatus(((JButton)event.getSource()).getText() + " ? shame on you!")'/> + <JButton text='Fool me twice' + onActionPerformed='p.setStatus(((JButton)event.getSource()).getText() + " ? shame on ...")'/> + </JPanel> + <jaxx.runtime.swing.StatusMessagePanel id='p' constraints='BorderLayout.SOUTH'/> + </JPanel> +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/ComboEditorDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/ComboEditorDemo.jaxx index 7942049..546a4b2 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/ComboEditorDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/ComboEditorDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -18,38 +18,38 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> - -<jaxx.demo.DemoPanel> - <Table id='demoPanel' fill='both'> - <row> - <cell> - <JLabel text='Locale editor:' labelFor='{localeEditor}'/> - </cell> - - <cell> - <LocaleEditor id='localeEditor'/> - </cell> - </row> - <row> - <cell> - <JLabel text='EnumEditor (language) :' labelFor='{languageEditor}'/> - </cell> - <cell> - <EnumEditor id='languageEditor' constructorParams='org.nuiton.i18n.LanguageEnum.class'/> - </cell> - </row> - <row> - <cell> - <JLabel text='EnumEditor (country) :' labelFor='{countryEditor}'/> - </cell> - <cell> - <EnumEditor id='countryEditor' constructorParams='org.nuiton.i18n.CountryEnum.class'/> - </cell> - </row> - <row> - <cell columns="2"> - <JTextArea text='{"locale : "+ localeEditor.getSelectedItem() + "\nlanguage : "+ languageEditor.getSelectedItem() + "\ncountry : " + countryEditor.getSelectedItem()}'/> - </cell> - </row> - </Table> -</jaxx.demo.DemoPanel> \ No newline at end of file + +<jaxx.demo.DemoPanel> + <Table id='demoPanel' fill='both'> + <row> + <cell> + <JLabel text='Locale editor:' labelFor='{localeEditor}'/> + </cell> + + <cell> + <LocaleEditor id='localeEditor'/> + </cell> + </row> + <row> + <cell> + <JLabel text='EnumEditor (language) :' labelFor='{languageEditor}'/> + </cell> + <cell> + <EnumEditor id='languageEditor' constructorParams='org.nuiton.i18n.LanguageEnum.class'/> + </cell> + </row> + <row> + <cell> + <JLabel text='EnumEditor (country) :' labelFor='{countryEditor}'/> + </cell> + <cell> + <EnumEditor id='countryEditor' constructorParams='org.nuiton.i18n.CountryEnum.class'/> + </cell> + </row> + <row> + <cell columns="2"> + <JTextArea text='{"locale : "+ localeEditor.getSelectedItem() + "\nlanguage : "+ languageEditor.getSelectedItem() + "\ncountry : " + countryEditor.getSelectedItem()}'/> + </cell> + </row> + </Table> +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx index 42ab1d1..3bb2676 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -83,4 +83,4 @@ protected Border getPopupBorder(String text) { </cell> </row> </Table> -</jaxx.demo.DemoPanel> \ No newline at end of file +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemo.jaxx index 1c52244..a7e82f9 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/NumberEditorDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx index 420cd3a..d9fc864 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorContentUI.jaxx index e7b6c02..ea62f3f 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorContentUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorContentUI.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -74,4 +74,4 @@ ImageIcon getImage(People data) { </JScrollPane> </JSplitPane> -</ContentUI> \ No newline at end of file +</ContentUI> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx index e175ba0..dea8369 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -67,4 +67,4 @@ public void closeUI(NavigationTreeNode node) throws Exception { </JPanel> </JToolBar> -</ContentUI> \ No newline at end of file +</ContentUI> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx index 47b70e9..f5f9104 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -49,4 +49,4 @@ public void closeUI(NavigationTreeNode node) throws Exception { } ]]> </script> -</JPanel> \ No newline at end of file +</JPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MovieContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MovieContentUI.jaxx index 921baa4..115711e 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MovieContentUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MovieContentUI.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -74,4 +74,4 @@ ImageIcon getImage(Movie data) { </JScrollPane> </JSplitPane> -</ContentUI> \ No newline at end of file +</ContentUI> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx index aca4933..1dfa5fa 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -67,4 +67,4 @@ public void closeUI(NavigationTreeNode node) throws Exception { </JPanel> </JToolBar> -</ContentUI> \ No newline at end of file +</ContentUI> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ItemTreeNavigationDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ItemTreeNavigationDemo.jaxx index 695890c..84d13fa 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ItemTreeNavigationDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/item/ItemTreeNavigationDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -63,4 +63,4 @@ void $afterCompleteSetup() { </ItemNavigationCardPanel> </JSplitPane> </JPanel> -</jaxx.demo.DemoPanel> \ No newline at end of file +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JButtonDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JButtonDemo.jaxx index a1e8d16..640c32f 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JButtonDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JButtonDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -18,32 +18,32 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<jaxx.demo.DemoPanel> - <style> - JButton.fancy { - foreground: blue; - font-face: Arial; - font-size: 18; - } - - JButton.fancy:mouseover { - foreground: red; - font-style: italic; - } - </style> - - <script> - public void buttonClicked(JButton button) { - JOptionPane.showMessageDialog(this, button.getText() + " clicked!", "onActionPerformed", - JOptionPane.INFORMATION_MESSAGE); - } - </script> - - <javax.swing.ImageIcon id='pencil' constructorParams='getClass().getResource("/jaxx/demo/images/pencil_black.gif")'/> - - <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <JButton text='Simple Button' onActionPerformed='buttonClicked((JButton) event.getSource())'/> - <JButton text='Fancy Button' styleClass='fancy' icon='{pencil}' - onActionPerformed='buttonClicked((JButton) event.getSource())'/> - </VBox> -</jaxx.demo.DemoPanel> \ No newline at end of file +<jaxx.demo.DemoPanel> + <style> + JButton.fancy { + foreground: blue; + font-face: Arial; + font-size: 18; + } + + JButton.fancy:mouseover { + foreground: red; + font-style: italic; + } + </style> + + <script> + public void buttonClicked(JButton button) { + JOptionPane.showMessageDialog(this, button.getText() + " clicked!", "onActionPerformed", + JOptionPane.INFORMATION_MESSAGE); + } + </script> + + <javax.swing.ImageIcon id='pencil' constructorParams='getClass().getResource("/jaxx/demo/images/pencil_black.gif")'/> + + <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> + <JButton text='Simple Button' onActionPerformed='buttonClicked((JButton) event.getSource())'/> + <JButton text='Fancy Button' styleClass='fancy' icon='{pencil}' + onActionPerformed='buttonClicked((JButton) event.getSource())'/> + </VBox> +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxDemo.jaxx index 9ab5279..a852d97 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -18,41 +18,41 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<jaxx.demo.DemoPanel> - <script><![CDATA[ - public String getText(boolean bold, boolean italic, boolean underline) { - String text ="Sample Text"; - if (bold) - text = "<b>" + text + "</b>"; - if (italic) - text = "<i>" + text + "</i>"; - if (underline) - text = "<u>" + text + "</u>"; - return "<html>" + text; - } - ]]></script> - - <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <Table anchor='west'> - <row> - <cell> - <JCheckBox id='bold' text='Bold' mnemonic='B'/> - </cell> - <cell rows='3'> - <JLabel font='{new Font("Arial", 0, 18)}' - text='{getText(bold.isSelected(), italic.isSelected(), underline.isSelected())}'/> - </cell> - </row> - <row> - <cell> - <JCheckBox id='italic' text='Italic' mnemonic='I'/> - </cell> - </row> - <row> - <cell> - <JCheckBox id='underline' text='Underline' mnemonic='U'/> - </cell> - </row> - </Table> - </VBox> -</jaxx.demo.DemoPanel> \ No newline at end of file +<jaxx.demo.DemoPanel> + <script><![CDATA[ + public String getText(boolean bold, boolean italic, boolean underline) { + String text ="Sample Text"; + if (bold) + text = "<b>" + text + "</b>"; + if (italic) + text = "<i>" + text + "</i>"; + if (underline) + text = "<u>" + text + "</u>"; + return "<html>" + text; + } + ]]></script> + + <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> + <Table anchor='west'> + <row> + <cell> + <JCheckBox id='bold' text='Bold' mnemonic='B'/> + </cell> + <cell rows='3'> + <JLabel font='{new Font("Arial", 0, 18)}' + text='{getText(bold.isSelected(), italic.isSelected(), underline.isSelected())}'/> + </cell> + </row> + <row> + <cell> + <JCheckBox id='italic' text='Italic' mnemonic='I'/> + </cell> + </row> + <row> + <cell> + <JCheckBox id='underline' text='Underline' mnemonic='U'/> + </cell> + </row> + </Table> + </VBox> +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxMenuItemDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxMenuItemDemo.jaxx index d63be41..accd8fb 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxMenuItemDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JCheckBoxMenuItemDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -18,62 +18,62 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<JMenuItemDemo> - <style> - .form { - enabled: { enabledCheckBox.isSelected() }; - editable: { editableCheckBox.isSelected() }; - } - </style> - - <JMenuBar id='menuBar'> - <JMenu text='View'> - <JCheckBoxMenuItem id='enabledCheckBox' text='Enabled' selected='true'/> - <JCheckBoxMenuItem id='editableCheckBox' text='Editable' selected='true'/> - </JMenu> - </JMenuBar> - - <Table id='framePanel' anchor='northwest'> - <row> - <cell> - <JLabel text='First Name:' displayedMnemonic='F' labelFor='{firstName}'/> - </cell> - - <cell weightx='1' fill='horizontal'> - <JTextField id='firstName' styleClass="form"/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Last Name:' displayedMnemonic='L' labelFor='{lastName}'/> - </cell> - - <cell fill='horizontal'> - <JTextField id='lastName' styleClass="form"/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Email Address:' displayedMnemonic='E' labelFor='{email}'/> - </cell> - - <cell fill='horizontal'> - <JTextField id='email' styleClass="form"/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Comments:' displayedMnemonic='C' labelFor='{comments}'/> - </cell> - - <cell weightx='1' weighty='1' fill='both'> - <JScrollPane width='150' height='75'> - <JTextArea id='comments' styleClass="form"/> - </JScrollPane> - </cell> - </row> - </Table> -</JMenuItemDemo> \ No newline at end of file +<JMenuItemDemo> + <style> + .form { + enabled: { enabledCheckBox.isSelected() }; + editable: { editableCheckBox.isSelected() }; + } + </style> + + <JMenuBar id='menuBar'> + <JMenu text='View'> + <JCheckBoxMenuItem id='enabledCheckBox' text='Enabled' selected='true'/> + <JCheckBoxMenuItem id='editableCheckBox' text='Editable' selected='true'/> + </JMenu> + </JMenuBar> + + <Table id='framePanel' anchor='northwest'> + <row> + <cell> + <JLabel text='First Name:' displayedMnemonic='F' labelFor='{firstName}'/> + </cell> + + <cell weightx='1' fill='horizontal'> + <JTextField id='firstName' styleClass="form"/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Last Name:' displayedMnemonic='L' labelFor='{lastName}'/> + </cell> + + <cell fill='horizontal'> + <JTextField id='lastName' styleClass="form"/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Email Address:' displayedMnemonic='E' labelFor='{email}'/> + </cell> + + <cell fill='horizontal'> + <JTextField id='email' styleClass="form"/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Comments:' displayedMnemonic='C' labelFor='{comments}'/> + </cell> + + <cell weightx='1' weighty='1' fill='both'> + <JScrollPane width='150' height='75'> + <JTextArea id='comments' styleClass="form"/> + </JScrollPane> + </cell> + </row> + </Table> +</JMenuItemDemo> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JComboBoxDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JComboBoxDemo.jaxx index f2d5141..eec1619 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JComboBoxDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JComboBoxDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -62,4 +62,4 @@ private void $afterCompleteSetup() { </cell> </row> </Table> -</jaxx.demo.DemoPanel> \ No newline at end of file +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JDialogDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JDialogDemo.jaxx index c6a870c..6bd4b8c 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JDialogDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JDialogDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -18,82 +18,82 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<jaxx.demo.DemoPanel> - <script> - String username; - String password; - - private class OKAction extends javax.swing.AbstractAction { - public OKAction() { - putValue(NAME, "OK"); - } - - - public void actionPerformed(ActionEvent e) { - username = usernameField.getText(); - password = new String(passwordField.getPassword()); - dialog.dispose(); - } - } - - - private class CancelAction extends javax.swing.AbstractAction { - public CancelAction() { - putValue(NAME, "Cancel"); - } - - - public void actionPerformed(ActionEvent e) { - dialog.dispose(); - } - } - { - JRootPane rootPane = dialog.getRootPane(); - rootPane.setDefaultButton(ok); - rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "cancel"); - rootPane.getActionMap().put("cancel", new CancelAction()); - } - </script> - - <JDialog title='Sign on' id='dialog' modal='true' onWindowOpened='dialog.setLocationRelativeTo(demoPanel); - passwordField.setText("");'> - <Table> - <row> - <cell> - <JLabel text='Username:' displayedMnemonic='U' labelFor='{usernameField}'/> - </cell> - - <cell> - <JTextField id='usernameField'/> - </cell> - </row> - - <row> - <cell> - <JLabel text='Password:' displayedMnemonic='P' labelFor='{passwordField}'/> - </cell> - - <cell> - <JPasswordField id='passwordField'/> - </cell> - </row> - - <row> - <cell columns='2'> - <JPanel layout='{new GridLayout(1, 0, 6, 6)}'> - <JButton id='ok' text='OK' action='{new OKAction()}'/> - <JButton text='Cancel' action='{new CancelAction()}'/> - </JPanel> - </cell> - </row> - </Table> - </JDialog> - - <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <JButton text='Show password dialog' onActionPerformed='dialog.setVisible(true)'/> - <VBox> - <JLabel text='{username != null ? "Username: " + username : ""}'/> - <JLabel text='{password != null ? "Password: " + password : ""}'/> - </VBox> - </VBox> -</jaxx.demo.DemoPanel> +<jaxx.demo.DemoPanel> + <script> + String username; + String password; + + private class OKAction extends javax.swing.AbstractAction { + public OKAction() { + putValue(NAME, "OK"); + } + + + public void actionPerformed(ActionEvent e) { + username = usernameField.getText(); + password = new String(passwordField.getPassword()); + dialog.dispose(); + } + } + + + private class CancelAction extends javax.swing.AbstractAction { + public CancelAction() { + putValue(NAME, "Cancel"); + } + + + public void actionPerformed(ActionEvent e) { + dialog.dispose(); + } + } + { + JRootPane rootPane = dialog.getRootPane(); + rootPane.setDefaultButton(ok); + rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "cancel"); + rootPane.getActionMap().put("cancel", new CancelAction()); + } + </script> + + <JDialog title='Sign on' id='dialog' modal='true' onWindowOpened='dialog.setLocationRelativeTo(demoPanel); + passwordField.setText("");'> + <Table> + <row> + <cell> + <JLabel text='Username:' displayedMnemonic='U' labelFor='{usernameField}'/> + </cell> + + <cell> + <JTextField id='usernameField'/> + </cell> + </row> + + <row> + <cell> + <JLabel text='Password:' displayedMnemonic='P' labelFor='{passwordField}'/> + </cell> + + <cell> + <JPasswordField id='passwordField'/> + </cell> + </row> + + <row> + <cell columns='2'> + <JPanel layout='{new GridLayout(1, 0, 6, 6)}'> + <JButton id='ok' text='OK' action='{new OKAction()}'/> + <JButton text='Cancel' action='{new CancelAction()}'/> + </JPanel> + </cell> + </row> + </Table> + </JDialog> + + <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> + <JButton text='Show password dialog' onActionPerformed='dialog.setVisible(true)'/> + <VBox> + <JLabel text='{username != null ? "Username: " + username : ""}'/> + <JLabel text='{password != null ? "Password: " + password : ""}'/> + </VBox> + </VBox> +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JListDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JListDemo.jaxx index 56e773f..9f50961 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JListDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JListDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -76,4 +76,4 @@ </cell> </row> </Table> -</jaxx.demo.DemoPanel> \ No newline at end of file +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JMenuItemDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JMenuItemDemo.jaxx index 7849888..9e11563 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JMenuItemDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JMenuItemDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -41,4 +41,4 @@ </JInternalFrame> </JDesktopPane> </JPanel> -</jaxx.demo.DemoPanel> \ No newline at end of file +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JPasswordFieldDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JPasswordFieldDemo.jaxx index f824ede..2b7f0c3 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JPasswordFieldDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JPasswordFieldDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -18,13 +18,13 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<jaxx.demo.DemoPanel> - <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <HBox> - <JLabel text='Password:' displayedMnemonic='P' labelFor='{password}'/> - <JPasswordField id='password'/> - </HBox> - - <JLabel text='You entered: {new String(password.getPassword())}'/> - </VBox> -</jaxx.demo.DemoPanel> \ No newline at end of file +<jaxx.demo.DemoPanel> + <VBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> + <HBox> + <JLabel text='Password:' displayedMnemonic='P' labelFor='{password}'/> + <JPasswordField id='password'/> + </HBox> + + <JLabel text='You entered: {new String(password.getPassword())}'/> + </VBox> +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JProgressBarDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JProgressBarDemo.jaxx index ac8f81e..91d6a24 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JProgressBarDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JProgressBarDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -18,80 +18,80 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<jaxx.demo.DemoPanel> - <script><![CDATA[ - import javax.swing.Timer; - - int red = 0; - int green = 0; - int blue = 0; - int speed = 2; - int redDirection = 1; - int greenDirection = 1; - int blueDirection = 1; - - Timer redTimer = new Timer(5, new ActionListener() { - public void actionPerformed(ActionEvent e) { - red = Math.max(0, Math.min(255, red + speed * redDirection)); - if (red == 0 || red == 255) - redDirection = -redDirection; - } - }); - - Timer greenTimer = new Timer(50, new ActionListener() { - public void actionPerformed(ActionEvent e) { - green = Math.max(0, Math.min(255, green + speed * greenDirection)); - if (green == 0 || green == 255) - greenDirection = -greenDirection; - } - }); - - Timer blueTimer = new Timer(500, new ActionListener() { - public void actionPerformed(ActionEvent e) { - blue = Math.max(0, Math.min(255, blue + speed * blueDirection)); - if (blue == 0 || blue == 255) - blueDirection = -blueDirection; - } - }); - - redTimer.start(); - greenTimer.start(); - blueTimer.start(); - ]]></script> - - <Table insets='6' id='demoPanel'> - <row> - <cell columns='3'> - <JLabel text='Welcome to the JAXX framework!' font='{UIManager.getFont("Label.font").deriveFont(18f)}' - foreground='{new Color(red, green, blue)}'/> - </cell> - </row> - - <row> - <cell columns='3' fill='horizontal'> - <JProgressBar foreground='{new Color(red, 0, 0)}' value='{red}' maximum='255'/> - </cell> - </row> - - <row> - <cell columns='3' fill='horizontal'> - <JProgressBar foreground='{new Color(0, green, 0)}' value='{green}' maximum='255'/> - </cell> - </row> - - <row> - <cell columns='3' fill='horizontal'> - <JProgressBar foreground='{new Color(0, 0, blue)}' value='{blue}' maximum='255'/> - </cell> - </row> - - <row> - <cell weightx='1' anchor='east'> - <JButton text='Start' onActionPerformed='redTimer.start(); greenTimer.start(); blueTimer.start()'/> - </cell> - <cell> - <JButton text='Stop' onActionPerformed='redTimer.stop(); greenTimer.stop(); blueTimer.stop()'/> - </cell> - </row> - </Table> -</jaxx.demo.DemoPanel> \ No newline at end of file +<jaxx.demo.DemoPanel> + <script><![CDATA[ + import javax.swing.Timer; + + int red = 0; + int green = 0; + int blue = 0; + int speed = 2; + int redDirection = 1; + int greenDirection = 1; + int blueDirection = 1; + + Timer redTimer = new Timer(5, new ActionListener() { + public void actionPerformed(ActionEvent e) { + red = Math.max(0, Math.min(255, red + speed * redDirection)); + if (red == 0 || red == 255) + redDirection = -redDirection; + } + }); + + Timer greenTimer = new Timer(50, new ActionListener() { + public void actionPerformed(ActionEvent e) { + green = Math.max(0, Math.min(255, green + speed * greenDirection)); + if (green == 0 || green == 255) + greenDirection = -greenDirection; + } + }); + + Timer blueTimer = new Timer(500, new ActionListener() { + public void actionPerformed(ActionEvent e) { + blue = Math.max(0, Math.min(255, blue + speed * blueDirection)); + if (blue == 0 || blue == 255) + blueDirection = -blueDirection; + } + }); + + redTimer.start(); + greenTimer.start(); + blueTimer.start(); + ]]></script> + + <Table insets='6' id='demoPanel'> + <row> + <cell columns='3'> + <JLabel text='Welcome to the JAXX framework!' font='{UIManager.getFont("Label.font").deriveFont(18f)}' + foreground='{new Color(red, green, blue)}'/> + </cell> + </row> + + <row> + <cell columns='3' fill='horizontal'> + <JProgressBar foreground='{new Color(red, 0, 0)}' value='{red}' maximum='255'/> + </cell> + </row> + + <row> + <cell columns='3' fill='horizontal'> + <JProgressBar foreground='{new Color(0, green, 0)}' value='{green}' maximum='255'/> + </cell> + </row> + + <row> + <cell columns='3' fill='horizontal'> + <JProgressBar foreground='{new Color(0, 0, blue)}' value='{blue}' maximum='255'/> + </cell> + </row> + + <row> + <cell weightx='1' anchor='east'> + <JButton text='Start' onActionPerformed='redTimer.start(); greenTimer.start(); blueTimer.start()'/> + </cell> + <cell> + <JButton text='Stop' onActionPerformed='redTimer.stop(); greenTimer.stop(); blueTimer.stop()'/> + </cell> + </row> + </Table> +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonDemo.jaxx index caf6633..aa3b5a6 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -18,14 +18,14 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<jaxx.demo.DemoPanel> - <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <VBox> - <JRadioButton text='Animal' value='Lynx.jpg' buttonGroup='radioButtons' selected='true'/> - <JRadioButton text='Vegetable' buttonGroup='radioButtons' value='Tomato.jpg'/> - <JRadioButton text='Mineral' buttonGroup='radioButtons' value='Amethyst.jpg'/> - </VBox> - - <JLabel icon='{new ImageIcon(getClass().getResource("/jaxx/demo/images/" + radioButtons.getSelectedValue()))}'/> - </HBox> -</jaxx.demo.DemoPanel> \ No newline at end of file +<jaxx.demo.DemoPanel> + <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> + <VBox> + <JRadioButton text='Animal' value='Lynx.jpg' buttonGroup='radioButtons' selected='true'/> + <JRadioButton text='Vegetable' buttonGroup='radioButtons' value='Tomato.jpg'/> + <JRadioButton text='Mineral' buttonGroup='radioButtons' value='Amethyst.jpg'/> + </VBox> + + <JLabel icon='{new ImageIcon(getClass().getResource("/jaxx/demo/images/" + radioButtons.getSelectedValue()))}'/> + </HBox> +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonMenuItemDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonMenuItemDemo.jaxx index 71f0b0e..e6a5b0a 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonMenuItemDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JRadioButtonMenuItemDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -18,17 +18,17 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<JMenuItemDemo> - <JMenuBar id='menuBar'> - <JMenu text='Font size'> - <JRadioButtonMenuItem text='10' value='{new Integer(10)}' buttonGroup='fontSize'/> - <JRadioButtonMenuItem text='12' value='{new Integer(12)}' buttonGroup='fontSize' selected='true'/> - <JRadioButtonMenuItem text='14' value='{new Integer(14)}' buttonGroup='fontSize'/> - <JRadioButtonMenuItem text='18' value='{new Integer(18)}' buttonGroup='fontSize'/> - <JRadioButtonMenuItem text='24' value='{new Integer(24)}' buttonGroup='fontSize'/> - </JMenu> - </JMenuBar> - - <JLabel id='demoMessage' text='Font size: {fontSize.getSelectedValue()}' horizontalAlignment='center' - font='{UIManager.getFont("Label.font").deriveFont(fontSize.getSelectedValue() != null ? (float) ((Integer) fontSize.getSelectedValue()).intValue() : 12)}'/> -</JMenuItemDemo> \ No newline at end of file +<JMenuItemDemo> + <JMenuBar id='menuBar'> + <JMenu text='Font size'> + <JRadioButtonMenuItem text='10' value='{new Integer(10)}' buttonGroup='fontSize'/> + <JRadioButtonMenuItem text='12' value='{new Integer(12)}' buttonGroup='fontSize' selected='true'/> + <JRadioButtonMenuItem text='14' value='{new Integer(14)}' buttonGroup='fontSize'/> + <JRadioButtonMenuItem text='18' value='{new Integer(18)}' buttonGroup='fontSize'/> + <JRadioButtonMenuItem text='24' value='{new Integer(24)}' buttonGroup='fontSize'/> + </JMenu> + </JMenuBar> + + <JLabel id='demoMessage' text='Font size: {fontSize.getSelectedValue()}' horizontalAlignment='center' + font='{UIManager.getFont("Label.font").deriveFont(fontSize.getSelectedValue() != null ? (float) ((Integer) fontSize.getSelectedValue()).intValue() : 12)}'/> +</JMenuItemDemo> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSliderDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSliderDemo.jaxx index 200f208..bb81db8 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSliderDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSliderDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -18,15 +18,15 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<jaxx.demo.DemoPanel> - <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <VBox> - <JSlider id='red' maximum='255' value='200'/> - <JSlider id='green' maximum='255' value='180'/> - <JSlider id='blue' maximum='255' value='240'/> - </VBox> - - <JPanel border='{BorderFactory.createEtchedBorder()}' width='64' height='64' - background='{new Color(red.getValue(), green.getValue(), blue.getValue())}'/> - </HBox> -</jaxx.demo.DemoPanel> \ No newline at end of file +<jaxx.demo.DemoPanel> + <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> + <VBox> + <JSlider id='red' maximum='255' value='200'/> + <JSlider id='green' maximum='255' value='180'/> + <JSlider id='blue' maximum='255' value='240'/> + </VBox> + + <JPanel border='{BorderFactory.createEtchedBorder()}' width='64' height='64' + background='{new Color(red.getValue(), green.getValue(), blue.getValue())}'/> + </HBox> +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSpinnerDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSpinnerDemo.jaxx index 82e00d3..cc367c9 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSpinnerDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSpinnerDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -18,16 +18,16 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<jaxx.demo.DemoPanel> - <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <JLabel text='Spacing:' displayedMnemonic='S' labelFor='{spinner}'/> - - <JSpinner minimum='0' maximum='50' id='spinner'/> - - <VBox spacing='{((Integer) spinner.getValue()).intValue()}'> - <JLabel text='Use the spinner to'/> - <JLabel text='adjust the spacing'/> - <JLabel text='between these lines'/> - </VBox> - </HBox> -</jaxx.demo.DemoPanel> \ No newline at end of file +<jaxx.demo.DemoPanel> + <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> + <JLabel text='Spacing:' displayedMnemonic='S' labelFor='{spinner}'/> + + <JSpinner minimum='0' maximum='50' id='spinner'/> + + <VBox spacing='{((Integer) spinner.getValue()).intValue()}'> + <JLabel text='Use the spinner to'/> + <JLabel text='adjust the spacing'/> + <JLabel text='between these lines'/> + </VBox> + </HBox> +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSplitPaneDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSplitPaneDemo.jaxx index a14dd2a..8c6133a 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSplitPaneDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JSplitPaneDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -18,16 +18,16 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<jaxx.demo.DemoPanel> - <JPanel id='demoPanel' layout='{new BorderLayout()}'> - <JSplitPane> - <JScrollPane> - <JLabel icon='{new ImageIcon(getClass().getResource("/jaxx/demo/images/Amethyst.jpg"))}'/> - </JScrollPane> - - <JScrollPane> - <JLabel icon='{new ImageIcon(getClass().getResource("/jaxx/demo/images/Lynx.jpg"))}'/> - </JScrollPane> - </JSplitPane> - </JPanel> -</jaxx.demo.DemoPanel> \ No newline at end of file +<jaxx.demo.DemoPanel> + <JPanel id='demoPanel' layout='{new BorderLayout()}'> + <JSplitPane> + <JScrollPane> + <JLabel icon='{new ImageIcon(getClass().getResource("/jaxx/demo/images/Amethyst.jpg"))}'/> + </JScrollPane> + + <JScrollPane> + <JLabel icon='{new ImageIcon(getClass().getResource("/jaxx/demo/images/Lynx.jpg"))}'/> + </JScrollPane> + </JSplitPane> + </JPanel> +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextAreaDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextAreaDemo.jaxx index b24accf..991ff1e 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextAreaDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextAreaDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -18,36 +18,36 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<jaxx.demo.DemoPanel> - <Table id='demoPanel' anchor='northwest'> - <row> - <cell> - <JLabel text='Normal text:' displayedMnemonic='N' labelFor='{textArea}'/> - </cell> - - <cell weightx='1' fill='both'> - <JScrollPane height='120'> - <JTextArea id='textArea' text='Try typing some text here.'/> - </JScrollPane> - </cell> - </row> - - <row> - <cell> - <JLabel text='Upper case text:'/> - </cell> - - <cell weightx='1' fill='both'> - <JScrollPane height='120'> - <JTextArea editable='false' background='{null}' text='{textArea.getText().toUpperCase()}'/> - </JScrollPane> - </cell> - </row> - - <row> - <cell weighty='1'> - <JPanel/> - </cell> - </row> - </Table> -</jaxx.demo.DemoPanel> \ No newline at end of file +<jaxx.demo.DemoPanel> + <Table id='demoPanel' anchor='northwest'> + <row> + <cell> + <JLabel text='Normal text:' displayedMnemonic='N' labelFor='{textArea}'/> + </cell> + + <cell weightx='1' fill='both'> + <JScrollPane height='120'> + <JTextArea id='textArea' text='Try typing some text here.'/> + </JScrollPane> + </cell> + </row> + + <row> + <cell> + <JLabel text='Upper case text:'/> + </cell> + + <cell weightx='1' fill='both'> + <JScrollPane height='120'> + <JTextArea editable='false' background='{null}' text='{textArea.getText().toUpperCase()}'/> + </JScrollPane> + </cell> + </row> + + <row> + <cell weighty='1'> + <JPanel/> + </cell> + </row> + </Table> +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextFieldDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextFieldDemo.jaxx index 20a4eec..b82b8e2 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextFieldDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JTextFieldDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -18,25 +18,25 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<jaxx.demo.DemoPanel> - <JPanel id='demoPanel'> - <Table> - <row> - <cell> - <JLabel text='Your name:' displayedMnemonic='n' labelFor='{textField}'/> - </cell> - - <cell> - <JTextField id='textField'/> - </cell> - </row> - - <row> - <cell columns='2'> - <JButton text='Greet' - onActionPerformed='JOptionPane.showMessageDialog(demoPanel, "Hello, " + textField.getText() + "!")'/> - </cell> - </row> - </Table> - </JPanel> -</jaxx.demo.DemoPanel> \ No newline at end of file +<jaxx.demo.DemoPanel> + <JPanel id='demoPanel'> + <Table> + <row> + <cell> + <JLabel text='Your name:' displayedMnemonic='n' labelFor='{textField}'/> + </cell> + + <cell> + <JTextField id='textField'/> + </cell> + </row> + + <row> + <cell columns='2'> + <JButton text='Greet' + onActionPerformed='JOptionPane.showMessageDialog(demoPanel, "Hello, " + textField.getText() + "!")'/> + </cell> + </row> + </Table> + </JPanel> +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JToggleButtonDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JToggleButtonDemo.jaxx index 8a32208..cb39433 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JToggleButtonDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JToggleButtonDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -18,12 +18,12 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<jaxx.demo.DemoPanel> - <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> - <JToggleButton text='1' id='one'/> - <JToggleButton text='2' id='two'/> - <JToggleButton text='3' id='three'/> - - <JLabel text='Total: {(one.isSelected() ? 1 : 0) + (two.isSelected() ? 2 : 0) + (three.isSelected() ? 3 : 0)}'/> - </HBox> -</jaxx.demo.DemoPanel> \ No newline at end of file +<jaxx.demo.DemoPanel> + <HBox id='demoPanel' horizontalAlignment='center' verticalAlignment='middle'> + <JToggleButton text='1' id='one'/> + <JToggleButton text='2' id='two'/> + <JToggleButton text='3' id='three'/> + + <JLabel text='Total: {(one.isSelected() ? 1 : 0) + (two.isSelected() ? 2 : 0) + (three.isSelected() ? 3 : 0)}'/> + </HBox> +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BaseBeanDataBinding.jaxx b/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BaseBeanDataBinding.jaxx index 12f1096..8da958e 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BaseBeanDataBinding.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BaseBeanDataBinding.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify diff --git a/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BeanDataBindingDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BeanDataBindingDemo.jaxx index fc16673..aab00ad 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BeanDataBindingDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/feature/databinding/BeanDataBindingDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify diff --git a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx index fcfcb1d..cbdafa7 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify diff --git a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx index a68c9c8..6d56abf 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify diff --git a/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorDemo.jaxx index d1d73b5..6584605 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/fun/CalculatorDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -112,4 +112,4 @@ protected String[] getSources() { </cell> </row> </Table> -</jaxx.demo.DemoPanel> \ No newline at end of file +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/fun/CounterDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/fun/CounterDemo.jaxx index eeaa1f3..a2960e9 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/fun/CounterDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/fun/CounterDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -18,15 +18,15 @@ <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* --> -<jaxx.demo.DemoPanel> - <script>int count;</script> - <JPanel id='demoPanel'> - <JTextField text='{count}' constraints='BorderLayout.NORTH'/> - <HBox constraints='BorderLayout.SOUTH'> - <JButton text='Dec (-)' onActionPerformed='count--'/> - <JButton text='Reset' onActionPerformed='count = 0'/> - <JButton text='Inc (+)' onActionPerformed='count++'/> - </HBox> - </JPanel> - -</jaxx.demo.DemoPanel> \ No newline at end of file +<jaxx.demo.DemoPanel> + <script>int count;</script> + <JPanel id='demoPanel'> + <JTextField text='{count}' constraints='BorderLayout.NORTH'/> + <HBox constraints='BorderLayout.SOUTH'> + <JButton text='Dec (-)' onActionPerformed='count--'/> + <JButton text='Reset' onActionPerformed='count = 0'/> + <JButton text='Inc (+)' onActionPerformed='count++'/> + </HBox> + </JPanel> + +</jaxx.demo.DemoPanel> diff --git a/jaxx-demo/src/main/java/jaxx/demo/fun/LabelStyleDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/fun/LabelStyleDemo.jaxx index 88078b2..5118129 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/fun/LabelStyleDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/fun/LabelStyleDemo.jaxx @@ -1,6 +1,6 @@ <!-- *##% - jaxx-demo + JAXX Demo Copyright (C) 2008 - 2009 CodeLutin This program is free software: you can redistribute it and/or modify @@ -109,4 +109,4 @@ protected String[] getSources() { </cell> </row> </Table> -</jaxx.demo.DemoPanel> \ No newline at end of file +</jaxx.demo.DemoPanel> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit ee163961bdd380b7630ed209d619d0b8845b363d Author: Tony Chemit <chemit@codelutin.com> Date: Mon Oct 26 19:13:36 2009 +0000 update java files license header --- .../src/main/java/jaxx/compiler/ClassMap.java | 208 +-- .../main/java/jaxx/compiler/CompiledObject.java | 1396 +++++++++---------- .../jaxx/compiler/CompiledObjectDecorator.java | 20 + .../java/jaxx/compiler/CompilerConfiguration.java | 20 + .../main/java/jaxx/compiler/CompilerException.java | 116 +- .../src/main/java/jaxx/compiler/DataBinding.java | 23 +- .../src/main/java/jaxx/compiler/DataSource.java | 954 ++++++------- .../compiler/DefaultCompilerConfiguration.java | 20 + .../src/main/java/jaxx/compiler/EventHandler.java | 128 +- .../src/main/java/jaxx/compiler/I18nHelper.java | 20 + .../src/main/java/jaxx/compiler/JAXXCompiler.java | 20 +- .../java/jaxx/compiler/JAXXCompilerFinalizer.java | 20 + .../src/main/java/jaxx/compiler/JAXXEngine.java | 20 + .../src/main/java/jaxx/compiler/JAXXProfile.java | 20 + .../src/main/java/jaxx/compiler/SymbolTable.java | 20 + .../compiler/UnsupportedAttributeException.java | 110 +- .../jaxx/compiler/UnsupportedTagException.java | 104 +- .../java/jaxx/compiler/beans/BeanInfoUtil.java | 20 + .../jaxx/compiler/beans/JAXXBeanDescriptor.java | 20 + .../java/jaxx/compiler/beans/JAXXBeanInfo.java | 20 + .../compiler/beans/JAXXEventSetDescriptor.java | 20 + .../jaxx/compiler/beans/JAXXFeatureDescriptor.java | 20 + .../java/jaxx/compiler/beans/JAXXIntrospector.java | 20 + .../compiler/beans/JAXXPropertyDescriptor.java | 20 + .../java/jaxx/compiler/css/StylesheetHelper.java | 20 + .../java/jaxx/compiler/css/parser/CSSParser.java | 20 + .../compiler/css/parser/CSSParserConstants.java | 20 + .../compiler/css/parser/CSSParserTokenManager.java | 20 + .../css/parser/CSSParserTreeConstants.java | 20 + .../compiler/css/parser/JJTCSSParserState.java | 20 + .../main/java/jaxx/compiler/css/parser/Node.java | 20 + .../jaxx/compiler/css/parser/ParseException.java | 20 + .../jaxx/compiler/css/parser/SimpleCharStream.java | 20 + .../java/jaxx/compiler/css/parser/SimpleNode.java | 20 + .../main/java/jaxx/compiler/css/parser/Token.java | 20 + .../jaxx/compiler/css/parser/TokenMgrError.java | 20 + .../decorators/BoxedCompiledObjectDecorator.java | 20 + .../decorators/DefaultCompiledObjectDecorator.java | 20 + .../HelpRootCompiledObjectDecorator.java | 20 + .../jaxx/compiler/finalizers/DefaultFinalizer.java | 20 + .../jaxx/compiler/finalizers/SwingFinalizer.java | 20 + .../compiler/finalizers/ValidatorFinalizer.java | 20 + .../main/java/jaxx/compiler/java/JavaArgument.java | 20 + .../main/java/jaxx/compiler/java/JavaElement.java | 20 + .../main/java/jaxx/compiler/java/JavaField.java | 20 + .../src/main/java/jaxx/compiler/java/JavaFile.java | 20 + .../java/jaxx/compiler/java/JavaFileGenerator.java | 20 + .../main/java/jaxx/compiler/java/JavaMethod.java | 20 + .../compiler/java/parser/JJTJavaParserState.java | 20 + .../jaxx/compiler/java/parser/JavaCharStream.java | 20 + .../java/jaxx/compiler/java/parser/JavaParser.java | 20 + .../compiler/java/parser/JavaParserConstants.java | 20 + .../java/parser/JavaParserTokenManager.java | 20 + .../java/parser/JavaParserTreeConstants.java | 20 + .../main/java/jaxx/compiler/java/parser/Node.java | 20 + .../jaxx/compiler/java/parser/ParseException.java | 20 + .../java/jaxx/compiler/java/parser/SimpleNode.java | 20 + .../main/java/jaxx/compiler/java/parser/Token.java | 20 + .../jaxx/compiler/java/parser/TokenMgrError.java | 20 + .../jaxx/compiler/reflect/ClassDescriptor.java | 20 + .../compiler/reflect/ClassDescriptorLoader.java | 20 + .../jaxx/compiler/reflect/FieldDescriptor.java | 20 + .../java/jaxx/compiler/reflect/JavaFileParser.java | 20 + .../jaxx/compiler/reflect/MemberDescriptor.java | 20 + .../jaxx/compiler/reflect/MethodDescriptor.java | 20 + .../jaxx/compiler/script/ScriptInitializer.java | 62 +- .../java/jaxx/compiler/script/ScriptManager.java | 20 + .../java/jaxx/compiler/spi/DefaultInitializer.java | 422 +++--- .../main/java/jaxx/compiler/spi/Initializer.java | 20 + .../compiler/tags/DefaultComponentHandler.java | 710 +++++----- .../jaxx/compiler/tags/DefaultObjectHandler.java | 20 +- .../java/jaxx/compiler/tags/ScriptHandler.java | 186 +-- .../main/java/jaxx/compiler/tags/StyleHandler.java | 384 +++--- .../main/java/jaxx/compiler/tags/TagHandler.java | 112 +- .../main/java/jaxx/compiler/tags/TagManager.java | 20 +- .../compiler/tags/swing/ApplicationHandler.java | 94 +- .../java/jaxx/compiler/tags/swing/CellHandler.java | 316 +++-- .../compiler/tags/swing/CompiledItemContainer.java | 116 +- .../java/jaxx/compiler/tags/swing/ItemHandler.java | 310 +++-- .../compiler/tags/swing/JAXXComboBoxHandler.java | 20 +- .../jaxx/compiler/tags/swing/JAXXListHandler.java | 20 +- .../jaxx/compiler/tags/swing/JAXXTabHandler.java | 20 + .../jaxx/compiler/tags/swing/JAXXTreeHandler.java | 20 +- .../jaxx/compiler/tags/swing/JCheckBoxHandler.java | 68 +- .../jaxx/compiler/tags/swing/JComboBoxHandler.java | 104 +- .../compiler/tags/swing/JInternalFrameHandler.java | 124 +- .../jaxx/compiler/tags/swing/JListHandler.java | 20 + .../jaxx/compiler/tags/swing/JMenuHandler.java | 68 +- .../compiler/tags/swing/JPasswordFieldHandler.java | 66 +- .../compiler/tags/swing/JPopupMenuHandler.java | 80 +- .../compiler/tags/swing/JProgressBarHandler.java | 68 +- .../compiler/tags/swing/JRadioButtonHandler.java | 176 +-- .../compiler/tags/swing/JScrollPaneHandler.java | 100 +- .../jaxx/compiler/tags/swing/JSliderHandler.java | 112 +- .../jaxx/compiler/tags/swing/JSpinnerHandler.java | 204 +-- .../compiler/tags/swing/JSplitPaneHandler.java | 158 ++- .../compiler/tags/swing/JTabbedPaneHandler.java | 286 ++-- .../compiler/tags/swing/JTextComponentHandler.java | 156 ++- .../jaxx/compiler/tags/swing/JToolBarHandler.java | 94 +- .../jaxx/compiler/tags/swing/JTreeHandler.java | 20 + .../jaxx/compiler/tags/swing/JWindowHandler.java | 140 +- .../java/jaxx/compiler/tags/swing/RowHandler.java | 192 +-- .../java/jaxx/compiler/tags/swing/TabHandler.java | 354 ++--- .../jaxx/compiler/tags/swing/TableHandler.java | 262 ++-- .../tags/validator/BeanValidatorHandler.java | 1446 ++++++++++---------- .../validator/ExcludeFieldValidatorHandler.java | 186 +-- .../tags/validator/FieldValidatorHandler.java | 172 +-- .../java/jaxx/compiler/tools/PrintTagInfo.java | 20 + .../tools/jaxxcapture/AbstractContextNode.java | 20 + .../compiler/tools/jaxxcapture/CapturedObject.java | 20 + .../compiler/tools/jaxxcapture/ContextNode.java | 20 + .../compiler/tools/jaxxcapture/JAXXCapture.java | 20 + .../compiler/tools/jaxxcapture/LiteralNode.java | 20 + .../compiler/tools/jaxxcapture/MethodNode.java | 20 + .../compiler/tools/jaxxcapture/PropertyNode.java | 20 + .../jaxx/compiler/tools/jaxxcapture/ValueNode.java | 20 + .../jaxxcapture/handlers/JTabbedPaneHandler.java | 20 + .../tools/jaxxcapture/handlers/ObjectHandler.java | 20 + .../tools/jaxxcapture/handlers/TableHandler.java | 20 + .../java/jaxx/compiler/types/ColorConverter.java | 100 +- .../types/GridBagConstraintsConverter.java | 76 +- .../java/jaxx/compiler/types/InsetsConverter.java | 102 +- .../jaxx/compiler/types/KeyStrokeConverter.java | 72 +- .../jaxx/compiler/types/PrimitiveConverter.java | 224 +-- .../java/jaxx/compiler/types/TypeConverter.java | 44 +- .../main/java/jaxx/compiler/types/TypeManager.java | 124 +- .../java/jaxx/compiler/JavaFileParserTest.java | 20 + .../test/java/jaxx/compiler/JavaMethodTest.java | 20 + .../java/jaxx/compiler/beans/BeanIntoUtilTest.java | 20 + .../jaxx/compiler/reflect/ClassDescriptorTest.java | 20 + .../java/jaxx/compiler/tags/TagManagerTest.java | 20 + .../jaxx/compiler/types/ColorConverterTest.java | 20 + .../jaxx/compiler/types/InsetsConverterTest.java | 20 + .../compiler/types/PrimitiveConverterTest.java | 20 + .../src/main/java/jaxx/runtime/Base64Coder.java | 20 + .../java/jaxx/runtime/ComponentDescriptor.java | 112 +- .../java/jaxx/runtime/DataBindingListener.java | 108 +- .../jaxx/runtime/DataBindingUpdateListener.java | 108 +- .../src/main/java/jaxx/runtime/JAXXAction.java | 20 + .../src/main/java/jaxx/runtime/JAXXContext.java | 20 + .../src/main/java/jaxx/runtime/JAXXObject.java | 156 ++- .../java/jaxx/runtime/JAXXObjectDescriptor.java | 98 +- .../src/main/java/jaxx/runtime/JAXXValidator.java | 20 + .../src/main/java/jaxx/runtime/SwingUtil.java | 20 + jaxx-runtime/src/main/java/jaxx/runtime/Util.java | 20 + .../java/jaxx/runtime/context/DataContext.java | 20 + .../runtime/context/DefaultApplicationContext.java | 20 + .../jaxx/runtime/context/DefaultJAXXContext.java | 20 + .../jaxx/runtime/context/JAXXContextEntryDef.java | 20 + .../jaxx/runtime/context/JAXXInitialContext.java | 20 + .../main/java/jaxx/runtime/css/DataBinding.java | 80 +- .../main/java/jaxx/runtime/css/Pseudoclasses.java | 20 + .../src/main/java/jaxx/runtime/css/Rule.java | 120 +- .../src/main/java/jaxx/runtime/css/Selector.java | 200 +-- .../src/main/java/jaxx/runtime/css/Stylesheet.java | 106 +- .../java/jaxx/runtime/decorator/Decorator.java | 20 + .../jaxx/runtime/decorator/DecoratorUtils.java | 20 + .../jaxx/runtime/decorator/JXPathDecorator.java | 20 + .../runtime/decorator/MultiJXPathDecorator.java | 20 + .../jaxx/runtime/decorator/PropertyDecorator.java | 20 + .../decorator/swing/DecoratorListCellRenderer.java | 20 + .../swing/DecoratorTableCellRenderer.java | 20 + .../main/java/jaxx/runtime/swing/Application.java | 127 +- .../java/jaxx/runtime/swing/BlockingLayerUI.java | 20 + .../java/jaxx/runtime/swing/BlockingLayerUI2.java | 20 + .../main/java/jaxx/runtime/swing/CardLayout2.java | 20 + .../java/jaxx/runtime/swing/CardLayout2Ext.java | 20 + .../src/main/java/jaxx/runtime/swing/GBC.java | 8 +- .../src/main/java/jaxx/runtime/swing/HBox.java | 204 +-- .../main/java/jaxx/runtime/swing/HBoxBeanInfo.java | 20 +- .../main/java/jaxx/runtime/swing/HBoxLayout.java | 270 ++-- .../src/main/java/jaxx/runtime/swing/Item.java | 462 ++++--- .../java/jaxx/runtime/swing/JAXXButtonGroup.java | 20 +- .../main/java/jaxx/runtime/swing/JAXXComboBox.java | 600 ++++---- .../src/main/java/jaxx/runtime/swing/JAXXList.java | 808 +++++------ .../src/main/java/jaxx/runtime/swing/JAXXTab.java | 26 +- .../java/jaxx/runtime/swing/JAXXToggleButton.java | 20 + .../src/main/java/jaxx/runtime/swing/JAXXTree.java | 20 +- .../runtime/swing/OneClicListSelectionModel.java | 20 + .../src/main/java/jaxx/runtime/swing/Spacer.java | 40 +- .../src/main/java/jaxx/runtime/swing/TabInfo.java | 346 ++--- .../swing/TabInfoPropertyChangeListener.java | 104 +- .../src/main/java/jaxx/runtime/swing/Table.java | 132 +- .../src/main/java/jaxx/runtime/swing/VBox.java | 204 +-- .../main/java/jaxx/runtime/swing/VBoxBeanInfo.java | 20 +- .../main/java/jaxx/runtime/swing/VBoxLayout.java | 270 ++-- .../jaxx/runtime/swing/editor/ClassCellEditor.java | 8 +- .../java/jaxx/runtime/swing/editor/EnumEditor.java | 8 +- .../jaxx/runtime/swing/editor/LocaleEditor.java | 8 +- .../runtime/swing/editor/MyDefaultCellEditor.java | 21 +- .../jaxx/runtime/swing/help/JAXXHelpBroker.java | 20 + .../java/jaxx/runtime/swing/help/JAXXHelpUI.java | 20 + .../jaxx/runtime/swing/help/JAXXHelpUIHandler.java | 20 + .../swing/navigation/ItemNavigationCardPanel.java | 20 + .../swing/navigation/ItemNavigationPanel.java | 20 +- .../navigation/ItemTreeNavigationAdapter.java | 20 + .../swing/navigation/NavigationContentUI.java | 20 + .../navigation/NavigationTreeContextHelper.java | 20 + .../swing/navigation/NavigationTreeHandler.java | 20 + .../NavigationTreeHandlerWithCardLayout.java | 20 + .../swing/navigation/NavigationTreeHelper.java | 20 + .../swing/navigation/NavigationTreeModel.java | 20 + .../navigation/NavigationTreeModelBuilder.java | 20 + .../swing/navigation/NavigationTreeNode.java | 20 + .../navigation/NavigationTreeNodeRenderer.java | 20 + .../NavigationTreeNodeRendererDecoratorImpl.java | 20 + .../NavigationTreeNodeRendererI18nImpl.java | 20 + .../swing/renderer/BooleanCellRenderer.java | 20 + .../renderer/EmptyNumberTableCellRenderer.java | 20 + .../swing/renderer/EnumTableCellRenderer.java | 20 + .../swing/renderer/I18nTableCellRenderer.java | 20 + .../swing/renderer/LocaleListCellRenderer.java | 20 + .../jaxx/runtime/swing/wizard/WizardModel.java | 20 + .../swing/wizard/WizardOperationAction.java | 20 + .../swing/wizard/WizardOperationActionThread.java | 20 + .../runtime/swing/wizard/WizardOperationModel.java | 20 + .../runtime/swing/wizard/WizardOperationState.java | 20 + .../runtime/swing/wizard/WizardOperationStep.java | 20 + .../java/jaxx/runtime/swing/wizard/WizardStep.java | 20 + .../jaxx/runtime/swing/wizard/WizardStepUI.java | 20 + .../java/jaxx/runtime/swing/wizard/WizardUI.java | 20 + .../jaxx/runtime/swing/wizard/WizardUILancher.java | 20 + .../java/jaxx/runtime/swing/wizard/WizardUtil.java | 20 + .../java/jaxx/runtime/validator/BeanValidator.java | 20 + .../runtime/validator/BeanValidatorDetector.java | 20 + .../jaxx/runtime/validator/BeanValidatorEvent.java | 20 + .../jaxx/runtime/validator/BeanValidatorField.java | 20 + .../runtime/validator/BeanValidatorListener.java | 20 + .../runtime/validator/BeanValidatorMessage.java | 20 + .../jaxx/runtime/validator/BeanValidatorScope.java | 20 + .../jaxx/runtime/validator/BeanValidatorUtil.java | 20 + .../jaxx/runtime/validator/XWorkBeanValidator.java | 20 + .../field/CollectionFieldExpressionValidator.java | 20 + .../field/CollectionUniqueKeyValidator.java | 20 + .../field/ExistingDirectoryFieldValidator.java | 20 + .../field/ExistingFileFieldValidator.java | 20 + .../field/FieldExpressionWithParamsValidator.java | 20 + .../field/NotExistingDirectoryFieldValidator.java | 20 + .../field/NotExistingFileFieldValidator.java | 20 + .../field/RequiredFileFieldValidator.java | 20 + .../runtime/validator/swing/SwingValidator.java | 20 + .../validator/swing/SwingValidatorMessage.java | 20 + .../swing/SwingValidatorMessageListModel.java | 20 + .../SwingValidatorMessageListMouseListener.java | 20 + .../swing/SwingValidatorMessageListRenderer.java | 20 + .../swing/SwingValidatorMessageTableModel.java | 20 + .../SwingValidatorMessageTableMouseListener.java | 20 + .../swing/SwingValidatorMessageTableRenderer.java | 20 + .../validator/swing/SwingValidatorUtil.java | 25 +- .../swing/ui/AbstractBeanValidatorUI.java | 20 + .../validator/swing/ui/IconValidationUI.java | 20 + .../validator/swing/ui/ImageValidationUI.java | 20 + .../swing/ui/TranslucentValidationUI.java | 20 + .../src/test/java/jaxx/runtime/UtilTest.java | 20 + .../context/DefaultApplicationContextTest.java | 20 + .../runtime/context/DefaultJAXXContextTest.java | 20 + .../src/test/java/jaxx/runtime/decorator/Data.java | 20 + .../runtime/decorator/JXPathDecoratorTest.java | 20 + .../decorator/MultiJXPathDecoratorTest.java | 20 + .../swing/navigation/NavigationTreeModelTest.java | 20 + .../AbstractBeanValidatorDetectorTest.java | 20 + .../validator/BeanValidatorDetectorTest.java | 20 + .../jaxx/runtime/validator/BeanValidatorTest.java | 20 + .../java/jaxx/runtime/validator/SimpleBean.java | 20 + .../runtime/validator/XWorkBeanValidatorTest.java | 20 + .../field/AbstractFieldValidatorTest.java | 20 + .../AbstractValidatorBeanFieldValidatorTest.java | 20 + .../CollectionFieldExpressionValidatorTest.java | 20 + .../field/CollectionUniqueKeyValidatorTest.java | 20 + .../field/ExistingDirectoryFieldValidatorTest.java | 20 + .../field/ExistingFileFieldValidatorTest.java | 20 + .../validator/field/FieldExpressionBean.java | 20 + .../FieldExpressionWithParamsValidatorTest.java | 20 + .../NotExistingDirectoryFieldValidatorTest.java | 20 + .../field/NotExistingFileFieldValidatorTest.java | 20 + .../field/RequiredFileFieldValidatorTest.java | 20 + .../runtime/validator/field/ValidatorBean.java | 20 + .../AbstractActionConfigurationResolver.java | 20 + .../jaxx/action/ActionAnnotationProcessing.java | 20 + .../java/org/nuiton/jaxx/action/ActionConfig.java | 20 + .../action/ActionConfigConfigurationResolver.java | 20 + .../jaxx/action/ActionConfigurationResolver.java | 20 + .../java/org/nuiton/jaxx/action/ActionFactory.java | 20 + .../jaxx/action/ActionFactoryFromProvider.java | 20 + .../org/nuiton/jaxx/action/ActionNameProvider.java | 20 + .../org/nuiton/jaxx/action/ActionProvider.java | 20 + .../jaxx/action/ActionProviderAnnotation.java | 20 + .../jaxx/action/ActionProviderFromProperties.java | 20 + .../org/nuiton/jaxx/action/MyAbstractAction.java | 20 + .../org/nuiton/jaxx/action/SelectActionConfig.java | 20 + .../SelectActionConfigConfigurationResolver.java | 20 + .../org/nuiton/jaxx/action/ToggleActionConfig.java | 20 + .../ToggleActionConfigConfigurationResolver.java | 20 + .../java/org/nuiton/jaxx/tab/TabContentConfig.java | 20 + .../main/java/org/nuiton/jaxx/tab/TabFactory.java | 20 + .../main/java/org/nuiton/jaxx/tab/TabModel.java | 20 + .../org/nuiton/jaxx/util/AbstractUIAction.java | 20 + .../main/java/org/nuiton/jaxx/util/DialogUI.java | 20 + .../java/org/nuiton/jaxx/util/DialogUIDef.java | 20 + .../java/org/nuiton/jaxx/util/DialogUIHandler.java | 20 + .../java/org/nuiton/jaxx/util/DialogUIModel.java | 20 + .../nuiton/jaxx/util/FactoryWindowListener.java | 20 + .../java/org/nuiton/jaxx/util/FormElement.java | 20 + .../java/org/nuiton/jaxx/util/ShowUIAction.java | 20 + .../main/java/org/nuiton/jaxx/util/UIFactory.java | 20 + .../main/java/org/nuiton/jaxx/util/UIHelper.java | 20 + .../main/java/org/nuiton/jaxx/util/UIProvider.java | 20 + .../org/nuiton/jaxx/util/config/CancelAction.java | 20 + .../nuiton/jaxx/util/config/DialogConfigUI.java | 20 + .../jaxx/util/config/DialogConfigUIHandler.java | 20 + .../jaxx/util/config/DialogConfigUIModel.java | 20 + .../org/nuiton/jaxx/util/config/ResetAction.java | 20 + .../org/nuiton/jaxx/util/config/SaveAction.java | 20 + .../jaxx/runtime/swing/EntityComboBoxHandler.java | 6 +- .../runtime/swing/StatusMessagePanelHandler.java | 6 +- .../runtime/swing/editor/NumberEditorHandler.java | 8 +- .../runtime/swing/editor/TimeEditorHandler.java | 8 +- .../swing/editor/config/ConfigTableEditor.java | 6 +- .../swing/editor/config/ConfigTableRenderer.java | 6 +- .../swing/editor/config/ConfigUIBuilder.java | 6 +- .../swing/editor/config/model/CategoryModel.java | 6 +- .../editor/config/model/ConfigTableModel.java | 6 +- .../swing/editor/config/model/ConfigUIModel.java | 6 +- .../swing/editor/config/model/OptionModel.java | 6 +- .../org/nuiton/jaxx/plugin/AbstractJaxxMojo.java | 24 +- .../org/nuiton/jaxx/plugin/GenerateHelpMojo.java | 24 +- .../java/org/nuiton/jaxx/plugin/GenerateMojo.java | 24 +- .../main/java/org/nuiton/jaxx/plugin/NodeItem.java | 20 + .../java/org/nuiton/jaxx/plugin/XmlHelper.java | 20 + .../java/org/nuiton/jaxx/plugin/Bug1722Test.java | 20 + .../java/org/nuiton/jaxx/plugin/Bug1750Test.java | 20 + .../java/org/nuiton/jaxx/plugin/Bug1751Test.java | 20 + .../java/org/nuiton/jaxx/plugin/CompilerTest.java | 20 + .../nuiton/jaxx/plugin/CompilerValidatorTest.java | 20 + .../java/org/nuiton/jaxx/plugin/DecoratorTest.java | 20 + .../org/nuiton/jaxx/plugin/Evolution74Test.java | 20 + .../test/java/org/nuiton/jaxx/plugin/I18nTest.java | 20 + .../java/org/nuiton/jaxx/plugin/JaxxBaseTest.java | 20 + .../java/org/nuiton/jaxx/plugin/NodeItemTest.java | 20 + 339 files changed, 13562 insertions(+), 7448 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/ClassMap.java b/jaxx-compiler/src/main/java/jaxx/compiler/ClassMap.java index fc0e49a..ec48f7f 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/ClassMap.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/ClassMap.java @@ -1,96 +1,112 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler; - -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -/** - * A Map implementation which uses Classes as keys. <code>ClassMap</code> differs from typical maps - * in that it takes subclasses into account; mapping a class to a value also maps all subclasses of - * that class to the value. - * <p/> - * A <code>get</code> operation will return the value associated with the class itself, or failing - * that, with its nearest ancestor for which there exists a mapping. - * @param <T> type of the class - */ -public class ClassMap<T> extends HashMap<ClassDescriptor, T> { - - private static final long serialVersionUID = 5149779660675529037L; - /** - * Logger - */ - protected static final Log log = LogFactory.getLog(ClassMap.class); - /** - * Keeps track of automatically-added Classes so we can distinguish them from user-added - * Classes. Unknown Classes are automatically added to the map during <code>get</code> - * calls to speed up subsequent requests, but they must be updated when the mappings - * for their superclasses are modified. - */ - private List<ClassDescriptor> autoKeys = new ArrayList<ClassDescriptor>(); - - /** - * Returns the value associated with the key <code>Class</code>. If the class itself does not have - * a mapping, its superclass will be checked, and so on until an ancestor class with a mapping is - * located. If none of the class' ancestors have a mapping, <code>null</code> is returned. - * - * @param key the class to check - * @return the mapping for the class - */ - @Override - public T get(Object key) { - T result = null; - ClassDescriptor c = (ClassDescriptor) key; - while (c != null) { - result = super.get(c); - if (result != null) { - break; - } - c = c.getSuperclass(); - } - - if (result == null && ((ClassDescriptor) key).isInterface()) { - result = get(ClassDescriptorLoader.getClassDescriptor(Object.class)); - } - - if (c != key && result != null) { // no mapping for the class itself, but found one for a superclass - put((ClassDescriptor) key, result); - autoKeys.add((ClassDescriptor) key); - } - return result; - } - - /** - * Associates a value with a class and all of its descendents. - * - * @param key the class to map - * @param value the value to map to the class - * @return the old value associated with the class - */ - @Override - public T put(ClassDescriptor key, T value) { - //if (!(key instanceof ClassDescriptor)) { - // throw new IllegalArgumentException("expected ClassDescriptor, got " + key); - //} - if (autoKeys.size() > 0) { // remove all automatic keys which descend from the class being modified - Iterator<ClassDescriptor> i = autoKeys.iterator(); - while (i.hasNext()) { - ClassDescriptor auto = i.next(); - if (key.isAssignableFrom(auto)) { - i.remove(); - remove(auto); - } - } - } - return super.put(key, value); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler; + +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +/** + * A Map implementation which uses Classes as keys. <code>ClassMap</code> differs from typical maps + * in that it takes subclasses into account; mapping a class to a value also maps all subclasses of + * that class to the value. + * <p/> + * A <code>get</code> operation will return the value associated with the class itself, or failing + * that, with its nearest ancestor for which there exists a mapping. + * @param <T> type of the class + */ +public class ClassMap<T> extends HashMap<ClassDescriptor, T> { + + private static final long serialVersionUID = 5149779660675529037L; + /** + * Logger + */ + protected static final Log log = LogFactory.getLog(ClassMap.class); + /** + * Keeps track of automatically-added Classes so we can distinguish them from user-added + * Classes. Unknown Classes are automatically added to the map during <code>get</code> + * calls to speed up subsequent requests, but they must be updated when the mappings + * for their superclasses are modified. + */ + private List<ClassDescriptor> autoKeys = new ArrayList<ClassDescriptor>(); + + /** + * Returns the value associated with the key <code>Class</code>. If the class itself does not have + * a mapping, its superclass will be checked, and so on until an ancestor class with a mapping is + * located. If none of the class' ancestors have a mapping, <code>null</code> is returned. + * + * @param key the class to check + * @return the mapping for the class + */ + @Override + public T get(Object key) { + T result = null; + ClassDescriptor c = (ClassDescriptor) key; + while (c != null) { + result = super.get(c); + if (result != null) { + break; + } + c = c.getSuperclass(); + } + + if (result == null && ((ClassDescriptor) key).isInterface()) { + result = get(ClassDescriptorLoader.getClassDescriptor(Object.class)); + } + + if (c != key && result != null) { // no mapping for the class itself, but found one for a superclass + put((ClassDescriptor) key, result); + autoKeys.add((ClassDescriptor) key); + } + return result; + } + + /** + * Associates a value with a class and all of its descendents. + * + * @param key the class to map + * @param value the value to map to the class + * @return the old value associated with the class + */ + @Override + public T put(ClassDescriptor key, T value) { + //if (!(key instanceof ClassDescriptor)) { + // throw new IllegalArgumentException("expected ClassDescriptor, got " + key); + //} + if (autoKeys.size() > 0) { // remove all automatic keys which descend from the class being modified + Iterator<ClassDescriptor> i = autoKeys.iterator(); + while (i.hasNext()) { + ClassDescriptor auto = i.next(); + if (key.isAssignableFrom(auto)) { + i.remove(); + remove(auto); + } + } + } + return super.put(key, value); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java index e58b06c..bb1b04a 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java @@ -1,690 +1,706 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler; - -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.reflect.MethodDescriptor; -import jaxx.compiler.tags.DefaultComponentHandler; -import jaxx.compiler.tags.TagHandler; -import jaxx.compiler.tags.TagManager; - -import java.awt.Container; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.apache.commons.lang.StringUtils; - -/** - * Represents an object in the <code>.java</code> file being generated during compilation. There is - * a <code>CompiledObject</code> for each class tag encountered, and certain tags may generate - * additional objects for various reasons. - */ -public class CompiledObject { - - /** - * The object's id. - */ - private String id; - /** - * Java code referring to the object. - */ - private String javaCode; - /** - * The object's class. - */ - private ClassDescriptor objectClass; - /** - * The style class. - */ - private String styleClass; - /** - * The container containing this CompiledObject. - */ - private CompiledObject parent; - /** - * true if this object overrides an object of the same id in a superclass - * of the object being compiled - */ - private boolean override; - /** - * Comma-separated Java code snippets representing the parameters that - * should be passed to the object's constructor. - */ - private String constructorParams; - /** - * Java code snippet which performs basic initialization of the object (after it has already been constructed). - * Because CompiledObject initialization order cannot be guaranteed, it is not safe to refer to other - * CompiledObjects from initializationCode -- you must refer to them from additionCode instead. - */ - private StringBuffer initializationCode = new StringBuffer(); - /** - * Java code snippet which completes setup by adding any child objects, or otherwise manipulates any refererenced - * objects. Because CompiledObject initialization order cannot be guaranteed, it is not safe to refer to other - * CompiledObjects from initializationCode -- you must refer to them from additionCode instead. - */ - private StringBuffer additionCode = new StringBuffer(); - /** - * List of all registered event handlers. - */ - private List<EventHandler> eventHandlers = new ArrayList<EventHandler>(); - /** - * All properties that have been applied to this CompiledObject. - */ - private Map<String, String> properties = new HashMap<String, String>(); - /** - * generic types of the compiled object - */ - private String[] genericTypes; - /** - * a flag to indicate if javaBean full support must be support for this - * object by root object - */ - private boolean javaBean; - /** - * code to initialize the bean (can be null) - */ - private String javaBeanInitCode; - /** - * the type of the override object (can be null if no overide) - */ - private ClassDescriptor overrideType; - /** - * the decorator - */ - private CompiledObjectDecorator decorator; - /** - * client properties - */ - private Map<String, String> clientProperties; - - public class ChildRef { - - CompiledObject child; - String constraints; - String childJavaCode; - String delegateCode; - - public ChildRef(CompiledObject child, String constraints, String childJavaCode, String delegateCode) { - this.child = child; - this.constraints = constraints; - this.childJavaCode = childJavaCode; - this.delegateCode = delegateCode; - } - - public CompiledObject getChild() { - return child; - } - - public void setChild(CompiledObject child) { - this.child = child; - } - - public String getConstraints() { - return constraints; - } - - public void setConstraints(String constraints) { - this.constraints = constraints; - } - - public String getChildJavaCode() { - return childJavaCode; - } - - public void setChildJavaCode(String childJavaCode) { - this.childJavaCode = childJavaCode; - } - - public String getDelegateCode() { - return delegateCode; - } - - public void setDelegateCode(String delegateCode) { - this.delegateCode = delegateCode; - } - - public void addToAdditionCode(StringBuffer buffer, boolean isRootObject) { - //TC-20091026 do not prefix if on root object - String prefix; - if (isRootObject) { - prefix = ""; - } else { - prefix = javaCode + delegateCode + "."; - } - if (constraints != null) { -// buffer.append(javaCode).append(delegateCode).append(".add(").append(childJavaCode).append(", ").append(constraints).append(");"); - buffer.append(prefix).append("add(").append(childJavaCode).append(", ").append(constraints).append(");"); - } else { -// buffer.append(javaCode).append(delegateCode).append(".add(").append(childJavaCode).append(");"); - buffer.append(prefix).append("add(").append(childJavaCode).append(");"); - } - buffer.append(JAXXCompiler.getLineSeparator()); - } - } - private List<ChildRef> childs; - - /** - * Creates a new <code>CompiledObject</code>. To be useful, the object should be registered with a - * <code>JAXXCompiler</code> using {@link JAXXCompiler#registerCompiledObject registerCompiledObject}. - * - * @param id the object's id - * @param objectClass the object's class - * @param compiler the current <code>JAXXCompiler</code> - * @throws NullPointerException if id or class is null - */ - public CompiledObject(String id, ClassDescriptor objectClass, JAXXCompiler compiler) { - this(id, objectClass, compiler, false); - } - - /** - * Creates a new <code>CompiledObject</code>. To be useful, the object should be registered with a - * <code>JAXXCompiler</code> using {@link JAXXCompiler#registerCompiledObject registerCompiledObject}. - * - * @param id the object's id - * @param objectClass the object's class - * @param compiler the current <code>JAXXCompiler</code> - * @param force <code>true</code> to force acceptance of invalid ids - * @throws NullPointerException if id or class is null - */ - public CompiledObject(String id, ClassDescriptor objectClass, JAXXCompiler compiler, boolean force) { - this(id, id, objectClass, compiler, force); - } - - /** - * Creates a new <code>CompiledObject</code>. To be useful, the object should be registered with a - * <code>JAXXCompiler</code> using {@link JAXXCompiler#registerCompiledObject registerCompiledObject}. - * - * @param id the object's id - * @param javaCode Java code referring to the object - * @param objectClass the object's class - * @param force <code>true</code> to force acceptance of invalid ids - * @param compiler the current <code>JAXXCompiler</code> - * @throws CompilerException if the id is not a valid Java identifier - * @throws NullPointerException if id or class is null - */ - public CompiledObject(String id, String javaCode, ClassDescriptor objectClass, JAXXCompiler compiler, boolean force) throws CompilerException { - if (!force) { - if (!isValidID(id)) { - compiler.reportError("the id '" + id + "' is not a valid Java identifier"); - } - } - this.id = id; - this.javaCode = javaCode; - - if (objectClass == null) { - throw new NullPointerException(); - } - this.objectClass = objectClass; - this.childs = new ArrayList<ChildRef>(); - } - - public static boolean isValidID(String id) { - boolean valid = true; - if (id.length() == 0) { - valid = false; - } - if (valid) { - if (!Character.isJavaIdentifierStart(id.charAt(0))) { - valid = false; - } - if (valid) { - for (int i = 1; i < id.length(); i++) { - if (!Character.isJavaIdentifierPart(id.charAt(i))) { - valid = false; - break; - } - } - } - } - return valid; - } - - /** - * True if this object overrides an object in the superclass of the class - * being compiled. For this to be true, the class currently being compiled - * must be a subclass of another <code>JAXXObject</code> which has an - * identically-named object. - * - * @return <code>true</code> if this object is an override - * @see #setOverride - */ - public boolean isOverride() { - return override; - } - - /** - * Sets whether this class overrides an identically-named object in the - * parent class. - * - * @param override <code>true</code> if this object is an override - * @see #isOverride - */ - public void setOverride(boolean override) { - this.override = override; - } - - /** - * Returns this object's CSS style class. - * - * @return the value of the <code>styleClass</code> attribute - */ - public String getStyleClass() { - return styleClass; - } - - /** - * Sets this object's CSS style class. - * - * @param styleClass the new style class - */ - public void setStyleClass(String styleClass) { - this.styleClass = styleClass; - } - - /** - * Returns this object's parent container. Non-visual components (and - * the root container) return <code>null</code>. - * - * @return the object's parent container - */ - public CompiledObject getParent() { - return parent; - } - - /** - * Sets this object's parent container. - * - * @param parent the parent container - * @throws IllegalArgumentException if parent is not a {@link Container} - */ - public void setParent(CompiledObject parent) throws IllegalArgumentException { - if (!ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(parent.getObjectClass())) { - throw new IllegalArgumentException("parent must descend from java.awt.Container"); - } - this.parent = parent; - } - - /** - * Returns the name of the method that should be generated in the compiled - * <code>.java</code> file - * in order to create this object. This is just a suggestion and may be - * ignored. - * - * @return the suggested name of the method which initializes this object - */ - public String getCreationMethodName() { - return "create" + StringUtils.capitalize(getId()); - } - - /** - * Returns the name of the method that should be generated in the compiled - * <code>.java</code> file in order to add children to this object. This - * is just a suggestion and may be ignored. - * - * @return the suggested name of the method which completes this object's setup - */ - public String getAdditionMethodName() { - return "addChildrenTo" + StringUtils.capitalize(getId()); - } - - /** - * Returns the type of this object. - * - * @return the class this <code>CompiledObject</code> represents - */ - public ClassDescriptor getObjectClass() { - return objectClass; - } - - /** - * Returns this object's id. Generally, a field with this name will be - * created in the compiled <code>.java</code> - * file in order to represent this object. - * - * @return the id used to refer to this object - */ - public String getId() { - return id; - } - - /** - * Returns Java code used to refer to this object in the compiled Java file. - * This is usually the same as its id. - * - * @return the Java code for this object - */ - public String getJavaCode() { - String result = javaCode; - if (isOverride()) { - // handle cases where object is overridden to be a different class - result = "((" + JAXXCompiler.getCanonicalName(getObjectClass()) + ") " + javaCode + ")"; - } - return result; - } - - public String getJavaCodeForProperty(String property) { - if (!override) { - return javaCode; - } - String result = "((" + JAXXCompiler.getCanonicalName(getObjectClass()) + ") " + javaCode + ")"; - - String methodName = StringUtils.capitalize(property); - try { - MethodDescriptor methodDescriptor = overrideType.getMethodDescriptor("get" + methodName); - if (methodDescriptor != null) { - if (overrideType.getMethodDescriptor("set" + methodName, methodDescriptor.getReturnType()) != null) { - // handle cases where object is overridden to be a different class - result = javaCode; - } - } - } catch (NoSuchMethodException e) { - // lazy error, do nothing - } - return result; - } - - /** - * Returns a list of comma-separated Java code snippets that represent the - * parameters to pass to this object's constructor. - * - * @return the raw constructor params - * @see #setConstructorParams - */ - public String getConstructorParams() { - return constructorParams; - } - - /** - * Sets the parameters to pass to this object's constructor. - * - * @param constructorParams comma-separated Java code snippets representing - * constructor params - * @see #getConstructorParams - */ - public void setConstructorParams(String constructorParams) { - this.constructorParams = constructorParams; - } - - /** - * Returns the code that performs basic initialization of this object, - * after it has already been constructed. - * This basic code should not reference any other - * <code>CompiledObjects</code> as they may not have been created yet. - * - * @param compiler compiler to use - * @return the code which initializes this object - */ - public String getInitializationCode(JAXXCompiler compiler) { - StringBuffer result = new StringBuffer(initializationCode.toString()); - for (Object eventHandler : eventHandlers) { - EventHandler handler = (EventHandler) eventHandler; - result.append(getInitializationCode(handler, compiler)); - } - return result.toString(); - } - - protected String getInitializationCode(EventHandler handler, JAXXCompiler compiler) { - MethodDescriptor addMethod = handler.getAddMethod(); - ClassDescriptor listenerClass = addMethod.getParameterTypes()[0]; - //TC-20091026 use 'this' instead of root object javaCode - return getJavaCode() + '.' + addMethod.getName() + "((" + JAXXCompiler.getCanonicalName(listenerClass) + - ") jaxx.runtime.Util.getEventListener(" + JAXXCompiler.getCanonicalName(listenerClass) + ".class, " + - compiler.getJavaCode(handler.getListenerMethod().getName()) + ", this, " + - // compiler.getJavaCode(handler.getListenerMethod().getName()) + ", " + compiler.getRootObject().getJavaCode() + ", " + - compiler.getJavaCode(compiler.getEventHandlerMethodName(handler)) + "));" + JAXXCompiler.getLineSeparator(); - } - - /** - * Returns Java code to complete final setup on this object. This code may - * reference other <code>CompiledObjects</code>, as they are guaranteed to - * have all been created by this point. - * - * @return code which adds children and performs final setup - */ - public String getAdditionCode() { - return additionCode.toString(); - } - - /** - * Appends code to the initialization code block. A line separator is - * automatically appended to the end. - * - * @param code the code to add to the initialization block - * @see #getInitializationCode - */ - public void appendInitializationCode(String code) { - if (!code.isEmpty()) { - this.initializationCode.append(code); - this.initializationCode.append(JAXXCompiler.getLineSeparator()); - } - } - - /** - * Appends code to the addition code block. A line separator is - * automatically appended to the end. - * - * @param code the code to add to the addition block - * @see #getAdditionCode - */ - public void appendAdditionCode(String code) { - if (!code.isEmpty()) { - this.additionCode.append(code); - this.additionCode.append(JAXXCompiler.getLineSeparator()); - } - } - - /** - * Stores a property for this object. The only effect of calling this - * method is that the property will be returned by {@code getProperties()}. - * - * @param property the name of the property - * @param value the property's value - * @see #getProperties - */ - public void addProperty(String property, String value) { - properties.put(property, value); - } - - public boolean hasClientProperties() { - return clientProperties != null && !clientProperties.isEmpty(); - } - - public void addClientProperty(String property, String value) { - getClientProperties().put(property, value); - } - - public String getClientProperty(String key) { - if (!hasClientProperties()) { - return null; - } - return clientProperties.get(key); - } - - public Map<String, String> getClientProperties() { - if (clientProperties == null) { - clientProperties = new HashMap<String, String>(); - } - return clientProperties; - } - - /** - * Returns all properties which have been set for this object. - * - * @return a <code>Map</code> containing all properties defined for this object - * @see #addProperty - */ - public Map<?, ?>/*<String, String>*/ getProperties() { - return properties; - } - - // TODO: remove this temporary method and complete switchover to MethodDescriptors - public void addEventHandler(String eventId, Method addMethod, Method listenerMethod, String code, JAXXCompiler compiler) { - try { - ClassDescriptor descriptor = ClassDescriptorLoader.getClassDescriptor(getObjectClass().getName()); - String listenerClassName = addMethod.getParameterTypes()[0].getName(); - ClassDescriptor listenerDescriptor = ClassDescriptorLoader.getClassDescriptor(listenerClassName); - MethodDescriptor addMethodDescriptor = descriptor.getMethodDescriptor(addMethod.getName(), listenerDescriptor); - MethodDescriptor listenerMethodDescriptor = listenerDescriptor.getMethodDescriptor(listenerMethod.getName(), ClassDescriptorLoader.getClassDescriptor(listenerMethod.getParameterTypes()[0].getName())); - addEventHandler(eventId, addMethodDescriptor, listenerMethodDescriptor, code, compiler); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - /** - * Adds an event listener to this object. The generated code will appear - * in the initialization block. - * - * @param eventId unique (per CompiledObject) identifier for the event handler - * @param addMethod the method which adds the event listener - * @param listenerMethod the method (in the listener class) which is called when the event is fired - * @param code the Java code for the listenerMethod's body - * @param compiler the current <code>JAXXCompiler</code> - * @see #getInitializationCode - */ - public void addEventHandler(String eventId, MethodDescriptor addMethod, MethodDescriptor listenerMethod, String code, JAXXCompiler compiler) { - EventHandler handler = new EventHandler(getId() + "." + eventId, getJavaCode(), addMethod, addMethod.getParameterTypes()[0], listenerMethod, code); - compiler.registerEventHandler(handler); - eventHandlers.add(handler); - - if (getJavaCode().indexOf(".") != -1) { - // object lives in another JAXX file and consequently its initialization code won't be output - compiler.appendInitializerCode(getInitializationCode(handler, compiler)); - } - } - - /** - * Adds a child component to this container. The child is added without - * layout constraints. - * - * @param child the component to add - * @param compiler the current <code>JAXXCompiler</code> - * @throws CompilerException if this object is not a container - * @see #addChild(CompiledObject, String, JAXXCompiler) - */ - public void addChild(CompiledObject child, JAXXCompiler compiler) throws CompilerException { - addChild(child, null, compiler); - } - - /** - * Adds a child component to this container. This variant allows the Java - * code for a layout constraints object to be specified. - * - * @param child the component to add - * @param constraints Java code for the layout constraints object - * @param compiler the current <code>JAXXCompiler</code> - * @throws CompilerException if this object is not a container - * @see #addChild(CompiledObject, JAXXCompiler) - */ - public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException { - try { - if (constraints != null) { - constraints = compiler.checkJavaCode(constraints); - } - } catch (CompilerException e) { - compiler.reportError("While parsing 'constraints' attribute: " + e.getMessage()); - } - - if (!child.isOverride()) { - TagHandler tagHandler = TagManager.getTagHandler(getObjectClass()); - if (tagHandler instanceof DefaultComponentHandler && - !((DefaultComponentHandler) tagHandler).isContainer()) { - compiler.reportError("component " + this + " may not have children"); - } - - String containerDelegate = ((DefaultComponentHandler) tagHandler).getContainerDelegate(); - String delegateCode = containerDelegate != null ? "." + containerDelegate + "()" : ""; - - child.setParent(this); - - childs.add(new ChildRef(child, constraints, child.getJavaCode(), delegateCode)); - } - } - - @Override - public String toString() { - return getObjectClass().getName() + "[id='" + id + "']"; - } - - public String getGenericTypes() { - if (getGenericTypesLength() == 0) { - // not using it - return ""; - } - String result = ""; - for (int i = 0, j = getGenericTypesLength(); i < j; i++) { - result += ", " + genericTypes[i]; - } - return "< " + result.substring(2) + " >"; - } - - public void setGenericTypes(String[] genericTypes) { - if (genericTypes == null) { - this.genericTypes = null; - return; - } - this.genericTypes = new String[genericTypes.length]; - for (int i = 0, j = genericTypes.length; i < j; i++) { - this.genericTypes[i] = genericTypes[i].trim(); - } - } - - public boolean isJavaBean() { - return javaBean; - } - - public void setJavaBean(boolean javaBean) { - this.javaBean = javaBean; - } - - public ClassDescriptor getOverrideType() { - return overrideType; - } - - public void setOverrideType(ClassDescriptor overrideType) { - this.overrideType = overrideType; - } - - public String getJavaBeanInitCode() { - return javaBeanInitCode; - } - - public void setJavaBeanInitCode(String javaBeanInitCode) { - this.javaBeanInitCode = javaBeanInitCode; - } - - public List<ChildRef> getChilds() { - return childs; - } - - public CompiledObjectDecorator getDecorator() { - return decorator; - } - - public void setDecorator(CompiledObjectDecorator decorator) { - this.decorator = decorator; - } - - public void finalizeCompiler(JAXXCompiler compiler) { - - List<CompiledObject.ChildRef> refList = getChilds(); - if (refList != null && !refList.isEmpty()) { - // compute additionCode for all childs - StringBuffer buffer = new StringBuffer(); - for (ChildRef childRef : refList) { - childRef.addToAdditionCode(buffer, compiler.getRootObject() == this); - } - additionCode = buffer.append(additionCode); - return; - } - } - - public int getGenericTypesLength() { - return genericTypes == null ? 0 : genericTypes.length; - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler; + +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.MethodDescriptor; +import jaxx.compiler.tags.DefaultComponentHandler; +import jaxx.compiler.tags.TagHandler; +import jaxx.compiler.tags.TagManager; + +import java.awt.Container; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.commons.lang.StringUtils; + +/** + * Represents an object in the <code>.java</code> file being generated during compilation. There is + * a <code>CompiledObject</code> for each class tag encountered, and certain tags may generate + * additional objects for various reasons. + */ +public class CompiledObject { + + /** + * The object's id. + */ + private String id; + /** + * Java code referring to the object. + */ + private String javaCode; + /** + * The object's class. + */ + private ClassDescriptor objectClass; + /** + * The style class. + */ + private String styleClass; + /** + * The container containing this CompiledObject. + */ + private CompiledObject parent; + /** + * true if this object overrides an object of the same id in a superclass + * of the object being compiled + */ + private boolean override; + /** + * Comma-separated Java code snippets representing the parameters that + * should be passed to the object's constructor. + */ + private String constructorParams; + /** + * Java code snippet which performs basic initialization of the object (after it has already been constructed). + * Because CompiledObject initialization order cannot be guaranteed, it is not safe to refer to other + * CompiledObjects from initializationCode -- you must refer to them from additionCode instead. + */ + private StringBuffer initializationCode = new StringBuffer(); + /** + * Java code snippet which completes setup by adding any child objects, or otherwise manipulates any refererenced + * objects. Because CompiledObject initialization order cannot be guaranteed, it is not safe to refer to other + * CompiledObjects from initializationCode -- you must refer to them from additionCode instead. + */ + private StringBuffer additionCode = new StringBuffer(); + /** + * List of all registered event handlers. + */ + private List<EventHandler> eventHandlers = new ArrayList<EventHandler>(); + /** + * All properties that have been applied to this CompiledObject. + */ + private Map<String, String> properties = new HashMap<String, String>(); + /** + * generic types of the compiled object + */ + private String[] genericTypes; + /** + * a flag to indicate if javaBean full support must be support for this + * object by root object + */ + private boolean javaBean; + /** + * code to initialize the bean (can be null) + */ + private String javaBeanInitCode; + /** + * the type of the override object (can be null if no overide) + */ + private ClassDescriptor overrideType; + /** + * the decorator + */ + private CompiledObjectDecorator decorator; + /** + * client properties + */ + private Map<String, String> clientProperties; + + public class ChildRef { + + CompiledObject child; + String constraints; + String childJavaCode; + String delegateCode; + + public ChildRef(CompiledObject child, String constraints, String childJavaCode, String delegateCode) { + this.child = child; + this.constraints = constraints; + this.childJavaCode = childJavaCode; + this.delegateCode = delegateCode; + } + + public CompiledObject getChild() { + return child; + } + + public void setChild(CompiledObject child) { + this.child = child; + } + + public String getConstraints() { + return constraints; + } + + public void setConstraints(String constraints) { + this.constraints = constraints; + } + + public String getChildJavaCode() { + return childJavaCode; + } + + public void setChildJavaCode(String childJavaCode) { + this.childJavaCode = childJavaCode; + } + + public String getDelegateCode() { + return delegateCode; + } + + public void setDelegateCode(String delegateCode) { + this.delegateCode = delegateCode; + } + + public void addToAdditionCode(StringBuffer buffer, boolean isRootObject) { + //TC-20091026 do not prefix if on root object + String prefix; + if (isRootObject) { + prefix = ""; + } else { + prefix = javaCode + delegateCode + "."; + } + if (constraints != null) { +// buffer.append(javaCode).append(delegateCode).append(".add(").append(childJavaCode).append(", ").append(constraints).append(");"); + buffer.append(prefix).append("add(").append(childJavaCode).append(", ").append(constraints).append(");"); + } else { +// buffer.append(javaCode).append(delegateCode).append(".add(").append(childJavaCode).append(");"); + buffer.append(prefix).append("add(").append(childJavaCode).append(");"); + } + buffer.append(JAXXCompiler.getLineSeparator()); + } + } + private List<ChildRef> childs; + + /** + * Creates a new <code>CompiledObject</code>. To be useful, the object should be registered with a + * <code>JAXXCompiler</code> using {@link JAXXCompiler#registerCompiledObject registerCompiledObject}. + * + * @param id the object's id + * @param objectClass the object's class + * @param compiler the current <code>JAXXCompiler</code> + * @throws NullPointerException if id or class is null + */ + public CompiledObject(String id, ClassDescriptor objectClass, JAXXCompiler compiler) { + this(id, objectClass, compiler, false); + } + + /** + * Creates a new <code>CompiledObject</code>. To be useful, the object should be registered with a + * <code>JAXXCompiler</code> using {@link JAXXCompiler#registerCompiledObject registerCompiledObject}. + * + * @param id the object's id + * @param objectClass the object's class + * @param compiler the current <code>JAXXCompiler</code> + * @param force <code>true</code> to force acceptance of invalid ids + * @throws NullPointerException if id or class is null + */ + public CompiledObject(String id, ClassDescriptor objectClass, JAXXCompiler compiler, boolean force) { + this(id, id, objectClass, compiler, force); + } + + /** + * Creates a new <code>CompiledObject</code>. To be useful, the object should be registered with a + * <code>JAXXCompiler</code> using {@link JAXXCompiler#registerCompiledObject registerCompiledObject}. + * + * @param id the object's id + * @param javaCode Java code referring to the object + * @param objectClass the object's class + * @param force <code>true</code> to force acceptance of invalid ids + * @param compiler the current <code>JAXXCompiler</code> + * @throws CompilerException if the id is not a valid Java identifier + * @throws NullPointerException if id or class is null + */ + public CompiledObject(String id, String javaCode, ClassDescriptor objectClass, JAXXCompiler compiler, boolean force) throws CompilerException { + if (!force) { + if (!isValidID(id)) { + compiler.reportError("the id '" + id + "' is not a valid Java identifier"); + } + } + this.id = id; + this.javaCode = javaCode; + + if (objectClass == null) { + throw new NullPointerException(); + } + this.objectClass = objectClass; + this.childs = new ArrayList<ChildRef>(); + } + + public static boolean isValidID(String id) { + boolean valid = true; + if (id.length() == 0) { + valid = false; + } + if (valid) { + if (!Character.isJavaIdentifierStart(id.charAt(0))) { + valid = false; + } + if (valid) { + for (int i = 1; i < id.length(); i++) { + if (!Character.isJavaIdentifierPart(id.charAt(i))) { + valid = false; + break; + } + } + } + } + return valid; + } + + /** + * True if this object overrides an object in the superclass of the class + * being compiled. For this to be true, the class currently being compiled + * must be a subclass of another <code>JAXXObject</code> which has an + * identically-named object. + * + * @return <code>true</code> if this object is an override + * @see #setOverride + */ + public boolean isOverride() { + return override; + } + + /** + * Sets whether this class overrides an identically-named object in the + * parent class. + * + * @param override <code>true</code> if this object is an override + * @see #isOverride + */ + public void setOverride(boolean override) { + this.override = override; + } + + /** + * Returns this object's CSS style class. + * + * @return the value of the <code>styleClass</code> attribute + */ + public String getStyleClass() { + return styleClass; + } + + /** + * Sets this object's CSS style class. + * + * @param styleClass the new style class + */ + public void setStyleClass(String styleClass) { + this.styleClass = styleClass; + } + + /** + * Returns this object's parent container. Non-visual components (and + * the root container) return <code>null</code>. + * + * @return the object's parent container + */ + public CompiledObject getParent() { + return parent; + } + + /** + * Sets this object's parent container. + * + * @param parent the parent container + * @throws IllegalArgumentException if parent is not a {@link Container} + */ + public void setParent(CompiledObject parent) throws IllegalArgumentException { + if (!ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(parent.getObjectClass())) { + throw new IllegalArgumentException("parent must descend from java.awt.Container"); + } + this.parent = parent; + } + + /** + * Returns the name of the method that should be generated in the compiled + * <code>.java</code> file + * in order to create this object. This is just a suggestion and may be + * ignored. + * + * @return the suggested name of the method which initializes this object + */ + public String getCreationMethodName() { + return "create" + StringUtils.capitalize(getId()); + } + + /** + * Returns the name of the method that should be generated in the compiled + * <code>.java</code> file in order to add children to this object. This + * is just a suggestion and may be ignored. + * + * @return the suggested name of the method which completes this object's setup + */ + public String getAdditionMethodName() { + return "addChildrenTo" + StringUtils.capitalize(getId()); + } + + /** + * Returns the type of this object. + * + * @return the class this <code>CompiledObject</code> represents + */ + public ClassDescriptor getObjectClass() { + return objectClass; + } + + /** + * Returns this object's id. Generally, a field with this name will be + * created in the compiled <code>.java</code> + * file in order to represent this object. + * + * @return the id used to refer to this object + */ + public String getId() { + return id; + } + + /** + * Returns Java code used to refer to this object in the compiled Java file. + * This is usually the same as its id. + * + * @return the Java code for this object + */ + public String getJavaCode() { + String result = javaCode; + if (isOverride()) { + // handle cases where object is overridden to be a different class + result = "((" + JAXXCompiler.getCanonicalName(getObjectClass()) + ") " + javaCode + ")"; + } + return result; + } + + public String getJavaCodeForProperty(String property) { + if (!override) { + return javaCode; + } + String result = "((" + JAXXCompiler.getCanonicalName(getObjectClass()) + ") " + javaCode + ")"; + + String methodName = StringUtils.capitalize(property); + try { + MethodDescriptor methodDescriptor = overrideType.getMethodDescriptor("get" + methodName); + if (methodDescriptor != null) { + if (overrideType.getMethodDescriptor("set" + methodName, methodDescriptor.getReturnType()) != null) { + // handle cases where object is overridden to be a different class + result = javaCode; + } + } + } catch (NoSuchMethodException e) { + // lazy error, do nothing + } + return result; + } + + /** + * Returns a list of comma-separated Java code snippets that represent the + * parameters to pass to this object's constructor. + * + * @return the raw constructor params + * @see #setConstructorParams + */ + public String getConstructorParams() { + return constructorParams; + } + + /** + * Sets the parameters to pass to this object's constructor. + * + * @param constructorParams comma-separated Java code snippets representing + * constructor params + * @see #getConstructorParams + */ + public void setConstructorParams(String constructorParams) { + this.constructorParams = constructorParams; + } + + /** + * Returns the code that performs basic initialization of this object, + * after it has already been constructed. + * This basic code should not reference any other + * <code>CompiledObjects</code> as they may not have been created yet. + * + * @param compiler compiler to use + * @return the code which initializes this object + */ + public String getInitializationCode(JAXXCompiler compiler) { + StringBuffer result = new StringBuffer(initializationCode.toString()); + for (Object eventHandler : eventHandlers) { + EventHandler handler = (EventHandler) eventHandler; + result.append(getInitializationCode(handler, compiler)); + } + return result.toString(); + } + + protected String getInitializationCode(EventHandler handler, JAXXCompiler compiler) { + MethodDescriptor addMethod = handler.getAddMethod(); + ClassDescriptor listenerClass = addMethod.getParameterTypes()[0]; + //TC-20091026 use 'this' instead of root object javaCode + return getJavaCode() + '.' + addMethod.getName() + "((" + JAXXCompiler.getCanonicalName(listenerClass) + + ") jaxx.runtime.Util.getEventListener(" + JAXXCompiler.getCanonicalName(listenerClass) + ".class, " + + compiler.getJavaCode(handler.getListenerMethod().getName()) + ", this, " + + // compiler.getJavaCode(handler.getListenerMethod().getName()) + ", " + compiler.getRootObject().getJavaCode() + ", " + + compiler.getJavaCode(compiler.getEventHandlerMethodName(handler)) + "));" + JAXXCompiler.getLineSeparator(); + } + + /** + * Returns Java code to complete final setup on this object. This code may + * reference other <code>CompiledObjects</code>, as they are guaranteed to + * have all been created by this point. + * + * @return code which adds children and performs final setup + */ + public String getAdditionCode() { + return additionCode.toString(); + } + + /** + * Appends code to the initialization code block. A line separator is + * automatically appended to the end. + * + * @param code the code to add to the initialization block + * @see #getInitializationCode + */ + public void appendInitializationCode(String code) { + if (!code.isEmpty()) { + this.initializationCode.append(code); + this.initializationCode.append(JAXXCompiler.getLineSeparator()); + } + } + + /** + * Appends code to the addition code block. A line separator is + * automatically appended to the end. + * + * @param code the code to add to the addition block + * @see #getAdditionCode + */ + public void appendAdditionCode(String code) { + if (!code.isEmpty()) { + this.additionCode.append(code); + this.additionCode.append(JAXXCompiler.getLineSeparator()); + } + } + + /** + * Stores a property for this object. The only effect of calling this + * method is that the property will be returned by {@code getProperties()}. + * + * @param property the name of the property + * @param value the property's value + * @see #getProperties + */ + public void addProperty(String property, String value) { + properties.put(property, value); + } + + public boolean hasClientProperties() { + return clientProperties != null && !clientProperties.isEmpty(); + } + + public void addClientProperty(String property, String value) { + getClientProperties().put(property, value); + } + + public String getClientProperty(String key) { + if (!hasClientProperties()) { + return null; + } + return clientProperties.get(key); + } + + public Map<String, String> getClientProperties() { + if (clientProperties == null) { + clientProperties = new HashMap<String, String>(); + } + return clientProperties; + } + + /** + * Returns all properties which have been set for this object. + * + * @return a <code>Map</code> containing all properties defined for this object + * @see #addProperty + */ + public Map<?, ?>/*<String, String>*/ getProperties() { + return properties; + } + + // TODO: remove this temporary method and complete switchover to MethodDescriptors + public void addEventHandler(String eventId, Method addMethod, Method listenerMethod, String code, JAXXCompiler compiler) { + try { + ClassDescriptor descriptor = ClassDescriptorLoader.getClassDescriptor(getObjectClass().getName()); + String listenerClassName = addMethod.getParameterTypes()[0].getName(); + ClassDescriptor listenerDescriptor = ClassDescriptorLoader.getClassDescriptor(listenerClassName); + MethodDescriptor addMethodDescriptor = descriptor.getMethodDescriptor(addMethod.getName(), listenerDescriptor); + MethodDescriptor listenerMethodDescriptor = listenerDescriptor.getMethodDescriptor(listenerMethod.getName(), ClassDescriptorLoader.getClassDescriptor(listenerMethod.getParameterTypes()[0].getName())); + addEventHandler(eventId, addMethodDescriptor, listenerMethodDescriptor, code, compiler); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * Adds an event listener to this object. The generated code will appear + * in the initialization block. + * + * @param eventId unique (per CompiledObject) identifier for the event handler + * @param addMethod the method which adds the event listener + * @param listenerMethod the method (in the listener class) which is called when the event is fired + * @param code the Java code for the listenerMethod's body + * @param compiler the current <code>JAXXCompiler</code> + * @see #getInitializationCode + */ + public void addEventHandler(String eventId, MethodDescriptor addMethod, MethodDescriptor listenerMethod, String code, JAXXCompiler compiler) { + EventHandler handler = new EventHandler(getId() + "." + eventId, getJavaCode(), addMethod, addMethod.getParameterTypes()[0], listenerMethod, code); + compiler.registerEventHandler(handler); + eventHandlers.add(handler); + + if (getJavaCode().indexOf(".") != -1) { + // object lives in another JAXX file and consequently its initialization code won't be output + compiler.appendInitializerCode(getInitializationCode(handler, compiler)); + } + } + + /** + * Adds a child component to this container. The child is added without + * layout constraints. + * + * @param child the component to add + * @param compiler the current <code>JAXXCompiler</code> + * @throws CompilerException if this object is not a container + * @see #addChild(CompiledObject, String, JAXXCompiler) + */ + public void addChild(CompiledObject child, JAXXCompiler compiler) throws CompilerException { + addChild(child, null, compiler); + } + + /** + * Adds a child component to this container. This variant allows the Java + * code for a layout constraints object to be specified. + * + * @param child the component to add + * @param constraints Java code for the layout constraints object + * @param compiler the current <code>JAXXCompiler</code> + * @throws CompilerException if this object is not a container + * @see #addChild(CompiledObject, JAXXCompiler) + */ + public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException { + try { + if (constraints != null) { + constraints = compiler.checkJavaCode(constraints); + } + } catch (CompilerException e) { + compiler.reportError("While parsing 'constraints' attribute: " + e.getMessage()); + } + + if (!child.isOverride()) { + TagHandler tagHandler = TagManager.getTagHandler(getObjectClass()); + if (tagHandler instanceof DefaultComponentHandler && + !((DefaultComponentHandler) tagHandler).isContainer()) { + compiler.reportError("component " + this + " may not have children"); + } + + String containerDelegate = ((DefaultComponentHandler) tagHandler).getContainerDelegate(); + String delegateCode = containerDelegate != null ? "." + containerDelegate + "()" : ""; + + child.setParent(this); + + childs.add(new ChildRef(child, constraints, child.getJavaCode(), delegateCode)); + } + } + + @Override + public String toString() { + return getObjectClass().getName() + "[id='" + id + "']"; + } + + public String getGenericTypes() { + if (getGenericTypesLength() == 0) { + // not using it + return ""; + } + String result = ""; + for (int i = 0, j = getGenericTypesLength(); i < j; i++) { + result += ", " + genericTypes[i]; + } + return "< " + result.substring(2) + " >"; + } + + public void setGenericTypes(String[] genericTypes) { + if (genericTypes == null) { + this.genericTypes = null; + return; + } + this.genericTypes = new String[genericTypes.length]; + for (int i = 0, j = genericTypes.length; i < j; i++) { + this.genericTypes[i] = genericTypes[i].trim(); + } + } + + public boolean isJavaBean() { + return javaBean; + } + + public void setJavaBean(boolean javaBean) { + this.javaBean = javaBean; + } + + public ClassDescriptor getOverrideType() { + return overrideType; + } + + public void setOverrideType(ClassDescriptor overrideType) { + this.overrideType = overrideType; + } + + public String getJavaBeanInitCode() { + return javaBeanInitCode; + } + + public void setJavaBeanInitCode(String javaBeanInitCode) { + this.javaBeanInitCode = javaBeanInitCode; + } + + public List<ChildRef> getChilds() { + return childs; + } + + public CompiledObjectDecorator getDecorator() { + return decorator; + } + + public void setDecorator(CompiledObjectDecorator decorator) { + this.decorator = decorator; + } + + public void finalizeCompiler(JAXXCompiler compiler) { + + List<CompiledObject.ChildRef> refList = getChilds(); + if (refList != null && !refList.isEmpty()) { + // compute additionCode for all childs + StringBuffer buffer = new StringBuffer(); + for (ChildRef childRef : refList) { + childRef.addToAdditionCode(buffer, compiler.getRootObject() == this); + } + additionCode = buffer.append(additionCode); + return; + } + } + + public int getGenericTypesLength() { + return genericTypes == null ? 0 : genericTypes.length; + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObjectDecorator.java index 5d4ae7f..f0374a5 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObjectDecorator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler; import jaxx.compiler.java.JavaFile; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java index 64b7542..224115d 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerConfiguration.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler; import java.io.File; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/CompilerException.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerException.java index 2da7fa9..1761222 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/CompilerException.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/CompilerException.java @@ -1,50 +1,66 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler; - -/** Thrown by the compiler when an error occurs. */ -public class CompilerException extends RuntimeException { - - private static final long serialVersionUID = -9099889519671482440L; - - /** Creates a new <code>ParseException</code>. */ - public CompilerException() { - } - - /** - * Creates a new <code>ParseException</code> with the specified detail message. - * - * @param msg the exception's detail message - */ - public CompilerException(String msg) { - super(msg); - } - - /** - * Creates a new <code>ParseException</code> with the specified cause. - * - * @param initCause the exception's initCause - */ - public CompilerException(Throwable initCause) { - super(initCause); - } - - /** - * Creates a new <code>ParseException</code> with the specified detail message and cause. - * - * @param msg the exception's detail message - * @param initCause the exception's initCause - */ - public CompilerException(String msg, Throwable initCause) { - super(msg, initCause); - } - - @Override - public void printStackTrace() { - super.printStackTrace(); - System.err.println("CompilerException printed from:"); - Thread.dumpStack(); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler; + +/** Thrown by the compiler when an error occurs. */ +public class CompilerException extends RuntimeException { + + private static final long serialVersionUID = -9099889519671482440L; + + /** Creates a new <code>ParseException</code>. */ + public CompilerException() { + } + + /** + * Creates a new <code>ParseException</code> with the specified detail message. + * + * @param msg the exception's detail message + */ + public CompilerException(String msg) { + super(msg); + } + + /** + * Creates a new <code>ParseException</code> with the specified cause. + * + * @param initCause the exception's initCause + */ + public CompilerException(Throwable initCause) { + super(initCause); + } + + /** + * Creates a new <code>ParseException</code> with the specified detail message and cause. + * + * @param msg the exception's detail message + * @param initCause the exception's initCause + */ + public CompilerException(String msg, Throwable initCause) { + super(msg, initCause); + } + + @Override + public void printStackTrace() { + super.printStackTrace(); + System.err.println("CompilerException printed from:"); + Thread.dumpStack(); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java b/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java index f978002..e55ca04 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler; import org.apache.commons.logging.Log; @@ -5,7 +25,8 @@ import org.apache.commons.logging.LogFactory; /** * Represents a data binding in a JAXX file. <code>DataBinding</code> uses - * {@link DataSource} to track changes to a source expression and update the destination. + * {@link DataSource} to track changes to a source expression and update + * the destination. */ public class DataBinding { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java b/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java index 291092c..9003f2d 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java @@ -1,469 +1,485 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler; - -import jaxx.compiler.java.JavaField; -import jaxx.compiler.java.parser.JavaParser; -import jaxx.compiler.java.parser.JavaParserConstants; -import jaxx.compiler.java.parser.JavaParserTreeConstants; -import jaxx.compiler.java.parser.SimpleNode; -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.reflect.FieldDescriptor; -import jaxx.compiler.reflect.MethodDescriptor; -import jaxx.compiler.tags.DefaultObjectHandler; -import jaxx.compiler.tags.TagManager; -import jaxx.compiler.types.TypeManager; - -import java.beans.Introspector; -import java.beans.PropertyChangeListener; -import java.io.StringReader; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -/** - * Represents a Java expression which fires a <code>PropertyChangeEvent</code> when it can be - * determined that its value may have changed. Events are fired on a "best effort" basis, and events - * may either be fired too often (the value has not actually changed) or not often enough (the value - * changed but no event was fired). - */ -public class DataSource { - - /** - * type attached to "null" constants in parsed expressions - */ - private class NULL { - } - /** - * id of data source - */ - private String id; - /** - * The Java source code for the expression. - */ - private String source; - /** - * The current <code>JAXXCompiler</code>. - */ - private JAXXCompiler compiler; - /** - * List of symbols which this data source expression depends on. - */ - private List<String> dependencySymbols = new ArrayList<String>(); - /** - * - */ - private StringBuffer addListenerCode = new StringBuffer(); - /** - * - */ - private StringBuffer removeListenerCode = new StringBuffer(); - /** - * - */ - private boolean compiled; - /** - * the delegate of property to be required - */ - private String objectCode; - - /** - * Creates a new data source. After creating a <code>DataSource</code>, use {@link #compile} - * to cause it to function at runtime. - * - * @param id the DataSource's id - * @param source the Java source code for the data source expression - * @param compiler the current <code>JAXXCompiler</code> - */ - public DataSource(String id, String source, JAXXCompiler compiler) { - this.id = id; - this.source = source; - this.compiler = compiler; - } - - public String getId() { - return id; - } - - public String getSource() { - return source; - } - - public String getObjectCode() { - return objectCode; - } - - /** - * Compiles the data source expression and listener. This method calls methods in <code>JAXXCompiler</code> - * to add the Java code that performs the data source setup. Adding listeners to <code>DataSource</code> is - * slightly more complicated than with ordinary classes, because <code>DataSource</code> only exists at compile - * time. You must pass in a Java expression which evaluates to a <code>PropertyChangeListener</code>; this - * expression will be compiled and evaluated at runtime to yield the <code>DataSource's</code> listener. - * - * @param propertyChangeListenerCode Java code snippet which evaluates to a <code>PropertyChangeListener</code> - * @return <code>true</code> if the expression has dependencies, <code>false</code> otherwise - * @throws CompilerException if a compilation error occurs - * @throws IllegalStateException if data source was already compiled - */ - public boolean compile(String propertyChangeListenerCode) throws CompilerException, IllegalStateException { - if (compiled) { - throw new IllegalStateException(this + " has already been compiled"); - } - String autoId = compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(getClass())); - JavaParser p = new JavaParser(new StringReader(source + ";")); - while (!p.Line()) { - SimpleNode node = p.popNode(); - scanNode(node, autoId); - } - - if (dependencySymbols.size() > 0) { - //TC 20081108 prefer add a real JavaField instead of raw code - //compiler.appendBodyCode("private PropertyChangeListener " + id + " = " + propertyChangeListenerCode + ";\n"); - compiler.addSimpleField(new JavaField(Modifier.PRIVATE, PropertyChangeListener.class.getSimpleName(), autoId, false, propertyChangeListenerCode)); - } - - compileListeners(); - compiled = true; - - return dependencySymbols.size() > 0; - } - - /** @return a list of symbols on which this data source depends. */ - public Collection<String> getDependencies() { - return Collections.unmodifiableList(dependencySymbols); - } - - /** - * Examines a node to identify any dependencies it contains. - * - * @param node node to scan - * @param listenerId id of listener - * @throws CompilerException ? - */ - private void scanNode(SimpleNode node, String listenerId) throws CompilerException { - switch (node.getId()) { - case JavaParserTreeConstants.JJTMETHODDECLARATION: - break; - case JavaParserTreeConstants.JJTFIELDDECLARATION: - break; - - default: - int count = node.jjtGetNumChildren(); - for (int i = 0; i < count; i++) { - scanNode(node.getChild(i), listenerId); - } - determineNodeType(node, listenerId); - } - } - - private ClassDescriptor determineLiteralType(SimpleNode node) { - assert node.getId() == JavaParserTreeConstants.JJTLITERAL; - if (node.jjtGetNumChildren() == 1) { - int childId = node.getChild(0).getId(); - if (childId == JavaParserTreeConstants.JJTBOOLEANLITERAL) { - return ClassDescriptorLoader.getClassDescriptor(boolean.class); - } - if (childId == JavaParserTreeConstants.JJTNULLLITERAL) { - return ClassDescriptorLoader.getClassDescriptor(NULL.class); - } - throw new RuntimeException("Expected BooleanLiteral or NullLiteral, found " + JavaParserTreeConstants.jjtNodeName[childId]); - } - int nodeId = node.firstToken.kind; - switch (nodeId) { - case JavaParserConstants.INTEGER_LITERAL: - if (node.firstToken.image.toLowerCase().endsWith("l")) { - return ClassDescriptorLoader.getClassDescriptor(long.class); - } - return ClassDescriptorLoader.getClassDescriptor(int.class); - case JavaParserConstants.CHARACTER_LITERAL: - return ClassDescriptorLoader.getClassDescriptor(char.class); - case JavaParserConstants.FLOATING_POINT_LITERAL: - if (node.firstToken.image.toLowerCase().endsWith("f")) { - return ClassDescriptorLoader.getClassDescriptor(float.class); - } - return ClassDescriptorLoader.getClassDescriptor(double.class); - case JavaParserConstants.STRING_LITERAL: - return ClassDescriptorLoader.getClassDescriptor(String.class); - default: - throw new RuntimeException("Expected literal token, found " + JavaParserConstants.tokenImage[nodeId]); - } - } - - /** - * Scans through a compound symbol (foo.bar.baz) to identify and track all trackable pieces of it. - * - * @param symbol symbol to scan - * @param contextClass current class context - * @param isMethod flag to search a method - * @param listenerId id of the listener - * @return the type of the symbol (or null if it could not be determined). - */ - private ClassDescriptor scanCompoundSymbol(String symbol, ClassDescriptor contextClass, boolean isMethod, String listenerId) { - String[] tokens = symbol.split("\\s*\\.\\s*"); - StringBuffer currentSymbol = new StringBuffer(); - StringBuffer tokensSeenSoFar = new StringBuffer(); - boolean accepted; // if this ends up false, it means we weren't able to figure out - // which object the method is being invoked on - boolean recognizeClassNames = true; - for (int j = 0; j < tokens.length - (isMethod ? 1 : 0); j++) { - accepted = false; - - if (tokensSeenSoFar.length() > 0) { - tokensSeenSoFar.append('.'); - } - tokensSeenSoFar.append(tokens[j]); - if (currentSymbol.length() > 0) { - currentSymbol.append('.'); - } - currentSymbol.append(tokens[j]); - - if (currentSymbol.indexOf(".") == -1) { - String memberName = currentSymbol.toString(); - CompiledObject object = compiler.getCompiledObject(memberName); - if (object != null) { - contextClass = object.getObjectClass(); - currentSymbol.setLength(0); - accepted = true; - recognizeClassNames = false; - } else { - try { - FieldDescriptor field = contextClass.getFieldDescriptor(memberName); - trackMemberIfPossible(tokensSeenSoFar.toString(), contextClass, field.getName(), false, listenerId); - contextClass = field.getType(); - currentSymbol.setLength(0); - accepted = true; - recognizeClassNames = false; - } catch (NoSuchFieldException e) { - if (j == 0 || j == 1 && tokens[0].equals(compiler.getRootObject().getId())) { // still in root context - FieldDescriptor[] newFields = compiler.getScriptFields(); - for (FieldDescriptor newField : newFields) { - if (newField.getName().equals(memberName)) { - addListener(tokensSeenSoFar.toString(), - null, - "addPropertyChangeListener(\"" + memberName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator(), - "removePropertyChangeListener(\"" + memberName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator()); - contextClass = newField.getType(); - assert contextClass != null : "script field '" + memberName + "' is defined, but has type null"; - currentSymbol.setLength(0); - accepted = true; - recognizeClassNames = false; - break; - } - } - } - } - } - } - if (currentSymbol.length() > 0 && recognizeClassNames) { - contextClass = TagManager.resolveClass(currentSymbol.toString(), compiler); - if (contextClass != null) { - currentSymbol.setLength(0); - //accepted = true; - //recognizeClassNames = false; - // TODO: for now we don't handle statics - return null; - } - } - if (!accepted) { - return null; - } - } - - return contextClass; - } - - /** - * Adds type information to nodes where possible, and as a side effect adds event listeners to nodes which - * can be tracked. - * - * @param expression the node to scan - * @param listenerId id of the listener - * @return the class descriptor of the return type or null - */ - private ClassDescriptor determineExpressionType(SimpleNode expression, String listenerId) { - assert expression.getId() == JavaParserTreeConstants.JJTPRIMARYEXPRESSION; - SimpleNode prefix = expression.getChild(0); - if (prefix.jjtGetNumChildren() == 1) { - int type = prefix.getChild(0).getId(); - if (type == JavaParserTreeConstants.JJTLITERAL || type == JavaParserTreeConstants.JJTEXPRESSION) { - prefix.setJavaType(prefix.getChild(0).getJavaType()); - } else if (type == JavaParserTreeConstants.JJTNAME && expression.jjtGetNumChildren() == 1) // name with no arguments after it - { - prefix.setJavaType(scanCompoundSymbol(prefix.getText().trim(), compiler.getRootObject().getObjectClass(), false, listenerId)); - } - } - - if (expression.jjtGetNumChildren() == 1) { - return prefix.getJavaType(); - } - - ClassDescriptor contextClass = prefix.getJavaType(); - if (contextClass == null) { - contextClass = compiler.getRootObject().getObjectClass(); - } - String lastNode = prefix.getText().trim(); - - for (int i = 1; i < expression.jjtGetNumChildren(); i++) { - SimpleNode suffix = expression.getChild(i); - if (suffix.jjtGetNumChildren() == 1 && suffix.getChild(0).getId() == JavaParserTreeConstants.JJTARGUMENTS) { - if (suffix.getChild(0).jjtGetNumChildren() == 0) { - // at the moment only no-argument methods are trackable - contextClass = scanCompoundSymbol(lastNode, contextClass, true, listenerId); - if (contextClass == null) { - return null; - } - int dotPos = lastNode.lastIndexOf("."); - String code = dotPos == -1 ? "" : lastNode.substring(0, dotPos); - for (int j = i - 2; j >= 0; j--) { - code = expression.getChild(j).getText() + code; - } - if (code.length() == 0) { - code = compiler.getRootObject().getJavaCode(); - } - String methodName = lastNode.substring(dotPos + 1).trim(); - try { - MethodDescriptor method = contextClass.getMethodDescriptor(methodName); - trackMemberIfPossible(code, contextClass, method.getName(), true, listenerId); - return method.getReturnType(); - } catch (NoSuchMethodException e) { - // happens for methods defined in the current JAXX file via scripts - String propertyName = null; - if (methodName.startsWith("is")) { - propertyName = Introspector.decapitalize(methodName.substring("is".length())); - } else if (methodName.startsWith("get")) { - propertyName = Introspector.decapitalize(methodName.substring("get".length())); - } - if (propertyName != null) { - MethodDescriptor[] newMethods = compiler.getScriptMethods(); - for (MethodDescriptor newMethod : newMethods) { - if (newMethod.getName().equals(methodName)) { - addListener(compiler.getRootObject().getId(), - null, - "addPropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator(), - "removePropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator()); - contextClass = newMethod.getReturnType(); - break; - } - } - } - } - } - } - lastNode = suffix.getText().trim(); - if (lastNode.startsWith(".")) { - lastNode = lastNode.substring(1); - } - } - - return null; - } - - private void trackMemberIfPossible(String objectCode, ClassDescriptor objectClass, String memberName, boolean method, String listenerId) { - if (objectClass.isInterface()) { - // might be technically possible to track in some cases, but for now - // we can't create a DefaultObjectHandler for interfaces - return; - } - - DefaultObjectHandler handler = TagManager.getTagHandler(objectClass); - try { - if (handler.isMemberBound(memberName)) { - addListener(objectCode + "." + memberName + (method ? "()" : ""), - objectCode, - handler.getAddMemberListenerCode(objectCode, id, memberName, listenerId, compiler), - handler.getRemoveMemberListenerCode(objectCode, id, memberName, listenerId, compiler)); - } - } catch (UnsupportedAttributeException e) { - // ignore -- this is thrown for methods like toString(), for which there is no tracking and - // no setting support - } - } - - /** - * Adds type information to nodes where possible, and as a side effect adds event listeners to nodes which - * can be tracked. - * - * @param node node to scan - * @param listenerId the listener id - */ - private void determineNodeType(SimpleNode node, String listenerId) { - ClassDescriptor type = null; - if (node.jjtGetNumChildren() == 1) { - type = node.getChild(0).getJavaType(); - } - switch (node.getId()) { - case JavaParserTreeConstants.JJTCLASSORINTERFACETYPE: - type = ClassDescriptorLoader.getClassDescriptor(Class.class); - break; - case JavaParserTreeConstants.JJTPRIMARYEXPRESSION: - type = determineExpressionType(node, listenerId); - break; - case JavaParserTreeConstants.JJTLITERAL: - type = determineLiteralType(node); - break; - case JavaParserTreeConstants.JJTCASTEXPRESSION: - type = TagManager.resolveClass(node.getChild(0).getText(), compiler); - break; - } - node.setJavaType(type); - } - - private void addListener(String dependencySymbol, String objectCode, String addCode, String removeCode) { - this.objectCode = objectCode; - //TC-20091026 no need to test objectCode not null if on root object - boolean needTest = objectCode != null && !compiler.getRootObject().getId().equals(objectCode); -// boolean needTest = objectCode != null; - if (!dependencySymbols.contains(dependencySymbol)) { - dependencySymbols.add(dependencySymbol); - String eol = JAXXCompiler.getLineSeparator(); - addListenerCode.append(eol); - if (needTest) { - addListenerCode.append(" if (").append(objectCode).append(" != null) {").append(eol); - addListenerCode.append(" "); - } - addListenerCode.append(" ").append(addCode.trim()); - if (needTest) { - addListenerCode.append(eol).append(" }"); - } - - removeListenerCode.append(eol); - if (needTest) { - removeListenerCode.append(" if (").append(objectCode).append(" != null) {").append(eol); - removeListenerCode.append(" "); - } - removeListenerCode.append(" ").append(removeCode.trim()); - if (needTest) { - removeListenerCode.append(eol).append(" }"); - } - } - } - - private void compileListeners() { - String javaCodeId = TypeManager.getJavaCode(id); - String eol = JAXXCompiler.getLineSeparator(); - if (addListenerCode.length() > 0) { - if (compiler.hasApplyDataBinding()) { - compiler.appendApplyDataBinding(" else "); - } -// compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol); - compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {"); - compiler.appendApplyDataBinding(" " + addListenerCode + eol); - compiler.appendApplyDataBinding("}"); - } - - if (removeListenerCode.length() > 0) { - if (compiler.hasRemoveDataBinding()) { - compiler.appendRemoveDataBinding(" else "); - } -// compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol); - compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {"); - compiler.appendRemoveDataBinding(" " + removeListenerCode + eol); - compiler.appendRemoveDataBinding("}"); - } - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler; + +import jaxx.compiler.java.JavaField; +import jaxx.compiler.java.parser.JavaParser; +import jaxx.compiler.java.parser.JavaParserConstants; +import jaxx.compiler.java.parser.JavaParserTreeConstants; +import jaxx.compiler.java.parser.SimpleNode; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.FieldDescriptor; +import jaxx.compiler.reflect.MethodDescriptor; +import jaxx.compiler.tags.DefaultObjectHandler; +import jaxx.compiler.tags.TagManager; +import jaxx.compiler.types.TypeManager; + +import java.beans.Introspector; +import java.beans.PropertyChangeListener; +import java.io.StringReader; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +/** + * Represents a Java expression which fires a <code>PropertyChangeEvent</code> when it can be + * determined that its value may have changed. Events are fired on a "best effort" basis, and events + * may either be fired too often (the value has not actually changed) or not often enough (the value + * changed but no event was fired). + */ +public class DataSource { + + /** + * type attached to "null" constants in parsed expressions + */ + private class NULL { + } + /** + * id of data source + */ + private String id; + /** + * The Java source code for the expression. + */ + private String source; + /** + * The current <code>JAXXCompiler</code>. + */ + private JAXXCompiler compiler; + /** + * List of symbols which this data source expression depends on. + */ + private List<String> dependencySymbols = new ArrayList<String>(); + /** + * + */ + private StringBuffer addListenerCode = new StringBuffer(); + /** + * + */ + private StringBuffer removeListenerCode = new StringBuffer(); + /** + * + */ + private boolean compiled; + /** + * the delegate of property to be required + */ + private String objectCode; + + /** + * Creates a new data source. After creating a <code>DataSource</code>, use {@link #compile} + * to cause it to function at runtime. + * + * @param id the DataSource's id + * @param source the Java source code for the data source expression + * @param compiler the current <code>JAXXCompiler</code> + */ + public DataSource(String id, String source, JAXXCompiler compiler) { + this.id = id; + this.source = source; + this.compiler = compiler; + } + + public String getId() { + return id; + } + + public String getSource() { + return source; + } + + public String getObjectCode() { + return objectCode; + } + + /** + * Compiles the data source expression and listener. This method calls methods in <code>JAXXCompiler</code> + * to add the Java code that performs the data source setup. Adding listeners to <code>DataSource</code> is + * slightly more complicated than with ordinary classes, because <code>DataSource</code> only exists at compile + * time. You must pass in a Java expression which evaluates to a <code>PropertyChangeListener</code>; this + * expression will be compiled and evaluated at runtime to yield the <code>DataSource's</code> listener. + * + * @param propertyChangeListenerCode Java code snippet which evaluates to a <code>PropertyChangeListener</code> + * @return <code>true</code> if the expression has dependencies, <code>false</code> otherwise + * @throws CompilerException if a compilation error occurs + * @throws IllegalStateException if data source was already compiled + */ + public boolean compile(String propertyChangeListenerCode) throws CompilerException, IllegalStateException { + if (compiled) { + throw new IllegalStateException(this + " has already been compiled"); + } + String autoId = compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(getClass())); + JavaParser p = new JavaParser(new StringReader(source + ";")); + while (!p.Line()) { + SimpleNode node = p.popNode(); + scanNode(node, autoId); + } + + if (dependencySymbols.size() > 0) { + //TC 20081108 prefer add a real JavaField instead of raw code + //compiler.appendBodyCode("private PropertyChangeListener " + id + " = " + propertyChangeListenerCode + ";\n"); + compiler.addSimpleField(new JavaField(Modifier.PRIVATE, PropertyChangeListener.class.getSimpleName(), autoId, false, propertyChangeListenerCode)); + } + + compileListeners(); + compiled = true; + + return dependencySymbols.size() > 0; + } + + /** @return a list of symbols on which this data source depends. */ + public Collection<String> getDependencies() { + return Collections.unmodifiableList(dependencySymbols); + } + + /** + * Examines a node to identify any dependencies it contains. + * + * @param node node to scan + * @param listenerId id of listener + * @throws CompilerException ? + */ + private void scanNode(SimpleNode node, String listenerId) throws CompilerException { + switch (node.getId()) { + case JavaParserTreeConstants.JJTMETHODDECLARATION: + break; + case JavaParserTreeConstants.JJTFIELDDECLARATION: + break; + + default: + int count = node.jjtGetNumChildren(); + for (int i = 0; i < count; i++) { + scanNode(node.getChild(i), listenerId); + } + determineNodeType(node, listenerId); + } + } + + private ClassDescriptor determineLiteralType(SimpleNode node) { + assert node.getId() == JavaParserTreeConstants.JJTLITERAL; + if (node.jjtGetNumChildren() == 1) { + int childId = node.getChild(0).getId(); + if (childId == JavaParserTreeConstants.JJTBOOLEANLITERAL) { + return ClassDescriptorLoader.getClassDescriptor(boolean.class); + } + if (childId == JavaParserTreeConstants.JJTNULLLITERAL) { + return ClassDescriptorLoader.getClassDescriptor(NULL.class); + } + throw new RuntimeException("Expected BooleanLiteral or NullLiteral, found " + JavaParserTreeConstants.jjtNodeName[childId]); + } + int nodeId = node.firstToken.kind; + switch (nodeId) { + case JavaParserConstants.INTEGER_LITERAL: + if (node.firstToken.image.toLowerCase().endsWith("l")) { + return ClassDescriptorLoader.getClassDescriptor(long.class); + } + return ClassDescriptorLoader.getClassDescriptor(int.class); + case JavaParserConstants.CHARACTER_LITERAL: + return ClassDescriptorLoader.getClassDescriptor(char.class); + case JavaParserConstants.FLOATING_POINT_LITERAL: + if (node.firstToken.image.toLowerCase().endsWith("f")) { + return ClassDescriptorLoader.getClassDescriptor(float.class); + } + return ClassDescriptorLoader.getClassDescriptor(double.class); + case JavaParserConstants.STRING_LITERAL: + return ClassDescriptorLoader.getClassDescriptor(String.class); + default: + throw new RuntimeException("Expected literal token, found " + JavaParserConstants.tokenImage[nodeId]); + } + } + + /** + * Scans through a compound symbol (foo.bar.baz) to identify and track all trackable pieces of it. + * + * @param symbol symbol to scan + * @param contextClass current class context + * @param isMethod flag to search a method + * @param listenerId id of the listener + * @return the type of the symbol (or null if it could not be determined). + */ + private ClassDescriptor scanCompoundSymbol(String symbol, ClassDescriptor contextClass, boolean isMethod, String listenerId) { + String[] tokens = symbol.split("\\s*\\.\\s*"); + StringBuffer currentSymbol = new StringBuffer(); + StringBuffer tokensSeenSoFar = new StringBuffer(); + boolean accepted; // if this ends up false, it means we weren't able to figure out + // which object the method is being invoked on + boolean recognizeClassNames = true; + for (int j = 0; j < tokens.length - (isMethod ? 1 : 0); j++) { + accepted = false; + + if (tokensSeenSoFar.length() > 0) { + tokensSeenSoFar.append('.'); + } + tokensSeenSoFar.append(tokens[j]); + if (currentSymbol.length() > 0) { + currentSymbol.append('.'); + } + currentSymbol.append(tokens[j]); + + if (currentSymbol.indexOf(".") == -1) { + String memberName = currentSymbol.toString(); + CompiledObject object = compiler.getCompiledObject(memberName); + if (object != null) { + contextClass = object.getObjectClass(); + currentSymbol.setLength(0); + accepted = true; + recognizeClassNames = false; + } else { + try { + FieldDescriptor field = contextClass.getFieldDescriptor(memberName); + trackMemberIfPossible(tokensSeenSoFar.toString(), contextClass, field.getName(), false, listenerId); + contextClass = field.getType(); + currentSymbol.setLength(0); + accepted = true; + recognizeClassNames = false; + } catch (NoSuchFieldException e) { + if (j == 0 || j == 1 && tokens[0].equals(compiler.getRootObject().getId())) { // still in root context + FieldDescriptor[] newFields = compiler.getScriptFields(); + for (FieldDescriptor newField : newFields) { + if (newField.getName().equals(memberName)) { + addListener(tokensSeenSoFar.toString(), + null, + "addPropertyChangeListener(\"" + memberName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator(), + "removePropertyChangeListener(\"" + memberName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator()); + contextClass = newField.getType(); + assert contextClass != null : "script field '" + memberName + "' is defined, but has type null"; + currentSymbol.setLength(0); + accepted = true; + recognizeClassNames = false; + break; + } + } + } + } + } + } + if (currentSymbol.length() > 0 && recognizeClassNames) { + contextClass = TagManager.resolveClass(currentSymbol.toString(), compiler); + if (contextClass != null) { + currentSymbol.setLength(0); + //accepted = true; + //recognizeClassNames = false; + // TODO: for now we don't handle statics + return null; + } + } + if (!accepted) { + return null; + } + } + + return contextClass; + } + + /** + * Adds type information to nodes where possible, and as a side effect adds event listeners to nodes which + * can be tracked. + * + * @param expression the node to scan + * @param listenerId id of the listener + * @return the class descriptor of the return type or null + */ + private ClassDescriptor determineExpressionType(SimpleNode expression, String listenerId) { + assert expression.getId() == JavaParserTreeConstants.JJTPRIMARYEXPRESSION; + SimpleNode prefix = expression.getChild(0); + if (prefix.jjtGetNumChildren() == 1) { + int type = prefix.getChild(0).getId(); + if (type == JavaParserTreeConstants.JJTLITERAL || type == JavaParserTreeConstants.JJTEXPRESSION) { + prefix.setJavaType(prefix.getChild(0).getJavaType()); + } else if (type == JavaParserTreeConstants.JJTNAME && expression.jjtGetNumChildren() == 1) // name with no arguments after it + { + prefix.setJavaType(scanCompoundSymbol(prefix.getText().trim(), compiler.getRootObject().getObjectClass(), false, listenerId)); + } + } + + if (expression.jjtGetNumChildren() == 1) { + return prefix.getJavaType(); + } + + ClassDescriptor contextClass = prefix.getJavaType(); + if (contextClass == null) { + contextClass = compiler.getRootObject().getObjectClass(); + } + String lastNode = prefix.getText().trim(); + + for (int i = 1; i < expression.jjtGetNumChildren(); i++) { + SimpleNode suffix = expression.getChild(i); + if (suffix.jjtGetNumChildren() == 1 && suffix.getChild(0).getId() == JavaParserTreeConstants.JJTARGUMENTS) { + if (suffix.getChild(0).jjtGetNumChildren() == 0) { + // at the moment only no-argument methods are trackable + contextClass = scanCompoundSymbol(lastNode, contextClass, true, listenerId); + if (contextClass == null) { + return null; + } + int dotPos = lastNode.lastIndexOf("."); + String code = dotPos == -1 ? "" : lastNode.substring(0, dotPos); + for (int j = i - 2; j >= 0; j--) { + code = expression.getChild(j).getText() + code; + } + if (code.length() == 0) { + code = compiler.getRootObject().getJavaCode(); + } + String methodName = lastNode.substring(dotPos + 1).trim(); + try { + MethodDescriptor method = contextClass.getMethodDescriptor(methodName); + trackMemberIfPossible(code, contextClass, method.getName(), true, listenerId); + return method.getReturnType(); + } catch (NoSuchMethodException e) { + // happens for methods defined in the current JAXX file via scripts + String propertyName = null; + if (methodName.startsWith("is")) { + propertyName = Introspector.decapitalize(methodName.substring("is".length())); + } else if (methodName.startsWith("get")) { + propertyName = Introspector.decapitalize(methodName.substring("get".length())); + } + if (propertyName != null) { + MethodDescriptor[] newMethods = compiler.getScriptMethods(); + for (MethodDescriptor newMethod : newMethods) { + if (newMethod.getName().equals(methodName)) { + addListener(compiler.getRootObject().getId(), + null, + "addPropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator(), + "removePropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator()); + contextClass = newMethod.getReturnType(); + break; + } + } + } + } + } + } + lastNode = suffix.getText().trim(); + if (lastNode.startsWith(".")) { + lastNode = lastNode.substring(1); + } + } + + return null; + } + + private void trackMemberIfPossible(String objectCode, ClassDescriptor objectClass, String memberName, boolean method, String listenerId) { + if (objectClass.isInterface()) { + // might be technically possible to track in some cases, but for now + // we can't create a DefaultObjectHandler for interfaces + return; + } + + DefaultObjectHandler handler = TagManager.getTagHandler(objectClass); + try { + if (handler.isMemberBound(memberName)) { + addListener(objectCode + "." + memberName + (method ? "()" : ""), + objectCode, + handler.getAddMemberListenerCode(objectCode, id, memberName, listenerId, compiler), + handler.getRemoveMemberListenerCode(objectCode, id, memberName, listenerId, compiler)); + } + } catch (UnsupportedAttributeException e) { + // ignore -- this is thrown for methods like toString(), for which there is no tracking and + // no setting support + } + } + + /** + * Adds type information to nodes where possible, and as a side effect adds event listeners to nodes which + * can be tracked. + * + * @param node node to scan + * @param listenerId the listener id + */ + private void determineNodeType(SimpleNode node, String listenerId) { + ClassDescriptor type = null; + if (node.jjtGetNumChildren() == 1) { + type = node.getChild(0).getJavaType(); + } + switch (node.getId()) { + case JavaParserTreeConstants.JJTCLASSORINTERFACETYPE: + type = ClassDescriptorLoader.getClassDescriptor(Class.class); + break; + case JavaParserTreeConstants.JJTPRIMARYEXPRESSION: + type = determineExpressionType(node, listenerId); + break; + case JavaParserTreeConstants.JJTLITERAL: + type = determineLiteralType(node); + break; + case JavaParserTreeConstants.JJTCASTEXPRESSION: + type = TagManager.resolveClass(node.getChild(0).getText(), compiler); + break; + } + node.setJavaType(type); + } + + private void addListener(String dependencySymbol, String objectCode, String addCode, String removeCode) { + this.objectCode = objectCode; + //TC-20091026 no need to test objectCode not null if on root object + boolean needTest = objectCode != null && !compiler.getRootObject().getId().equals(objectCode); +// boolean needTest = objectCode != null; + if (!dependencySymbols.contains(dependencySymbol)) { + dependencySymbols.add(dependencySymbol); + String eol = JAXXCompiler.getLineSeparator(); + addListenerCode.append(eol); + if (needTest) { + addListenerCode.append(" if (").append(objectCode).append(" != null) {").append(eol); + addListenerCode.append(" "); + } + addListenerCode.append(" ").append(addCode.trim()); + if (needTest) { + addListenerCode.append(eol).append(" }"); + } + + removeListenerCode.append(eol); + if (needTest) { + removeListenerCode.append(" if (").append(objectCode).append(" != null) {").append(eol); + removeListenerCode.append(" "); + } + removeListenerCode.append(" ").append(removeCode.trim()); + if (needTest) { + removeListenerCode.append(eol).append(" }"); + } + } + } + + private void compileListeners() { + String javaCodeId = TypeManager.getJavaCode(id); + String eol = JAXXCompiler.getLineSeparator(); + if (addListenerCode.length() > 0) { + if (compiler.hasApplyDataBinding()) { + compiler.appendApplyDataBinding(" else "); + } +// compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol); + compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {"); + compiler.appendApplyDataBinding(" " + addListenerCode + eol); + compiler.appendApplyDataBinding("}"); + } + + if (removeListenerCode.length() > 0) { + if (compiler.hasRemoveDataBinding()) { + compiler.appendRemoveDataBinding(" else "); + } +// compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol); + compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {"); + compiler.appendRemoveDataBinding(" " + removeListenerCode + eol); + compiler.appendRemoveDataBinding("}"); + } + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java b/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java index 2010df9..fe5f0ee 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/DefaultCompilerConfiguration.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler; import org.apache.commons.lang.builder.ToStringBuilder; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/EventHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/EventHandler.java index 506f269..bded3a9 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/EventHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/EventHandler.java @@ -1,56 +1,72 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler; - -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.MethodDescriptor; - -public class EventHandler { - - private String eventId; - private String objectCode; - private ClassDescriptor listenerClass; - private MethodDescriptor addMethod; - private MethodDescriptor listenerMethod; - private String javaCode; - - public EventHandler(String eventId, String objectCode, MethodDescriptor addMethod, ClassDescriptor listenerClass, MethodDescriptor listenerMethod, String javaCode) { - this.eventId = eventId; - this.objectCode = objectCode; - this.addMethod = addMethod; - this.listenerClass = listenerClass; - this.listenerMethod = listenerMethod; - this.javaCode = javaCode; - } - - public String getEventId() { - return eventId; - } - - public String getObjectCode() { - return objectCode; - } - - public MethodDescriptor getAddMethod() { - return addMethod; - } - - public ClassDescriptor getListenerClass() { - return listenerClass; - } - - public MethodDescriptor getListenerMethod() { - return listenerMethod; - } - - public String getJavaCode() { - return javaCode; - } - - @Override - public String toString() { - return "EventHandler[" + eventId + ", " + listenerClass.getName() + ", " + objectCode + ", " + javaCode + "]"; - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler; + +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.MethodDescriptor; + +public class EventHandler { + + private String eventId; + private String objectCode; + private ClassDescriptor listenerClass; + private MethodDescriptor addMethod; + private MethodDescriptor listenerMethod; + private String javaCode; + + public EventHandler(String eventId, String objectCode, MethodDescriptor addMethod, ClassDescriptor listenerClass, MethodDescriptor listenerMethod, String javaCode) { + this.eventId = eventId; + this.objectCode = objectCode; + this.addMethod = addMethod; + this.listenerClass = listenerClass; + this.listenerMethod = listenerMethod; + this.javaCode = javaCode; + } + + public String getEventId() { + return eventId; + } + + public String getObjectCode() { + return objectCode; + } + + public MethodDescriptor getAddMethod() { + return addMethod; + } + + public ClassDescriptor getListenerClass() { + return listenerClass; + } + + public MethodDescriptor getListenerMethod() { + return listenerMethod; + } + + public String getJavaCode() { + return javaCode; + } + + @Override + public String toString() { + return "EventHandler[" + eventId + ", " + listenerClass.getName() + ", " + objectCode + ", " + javaCode + "]"; + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/I18nHelper.java b/jaxx-compiler/src/main/java/jaxx/compiler/I18nHelper.java index f099142..961a0d8 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/I18nHelper.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/I18nHelper.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler; import org.apache.commons.logging.Log; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java index c979ed7..2c5e870 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java @@ -1,6 +1,22 @@ /* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.compiler; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerFinalizer.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerFinalizer.java index 5f91313..79fd637 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerFinalizer.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompilerFinalizer.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler; import jaxx.compiler.java.JavaFile; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java index f48b7f1..70f137b 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler; import jaxx.compiler.java.JavaFileGenerator; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXProfile.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXProfile.java index c6acddf..2782ce4 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXProfile.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXProfile.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler; import java.util.Arrays; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/SymbolTable.java b/jaxx-compiler/src/main/java/jaxx/compiler/SymbolTable.java index 2fc575f..455d630 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/SymbolTable.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/SymbolTable.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler; import jaxx.compiler.reflect.FieldDescriptor; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/UnsupportedAttributeException.java b/jaxx-compiler/src/main/java/jaxx/compiler/UnsupportedAttributeException.java index 20dc23d..97f84bd 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/UnsupportedAttributeException.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/UnsupportedAttributeException.java @@ -1,47 +1,63 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler; - -/** - * Thrown by <code>TagHandler</code> when an unsupported attribute is encountered. - * - * @see jaxx.compiler.tags.TagHandler - */ -public class UnsupportedAttributeException extends CompilerException { - - private static final long serialVersionUID = -6919583037172920343L; - - /** Creates a new <code>UnsupportedAttributeException</code>. */ - public UnsupportedAttributeException() { - } - - /** - * Creates a new <code>UnsupportedAttributeException</code> with the specified detail message. - * - * @param msg the exception's detail message - */ - public UnsupportedAttributeException(String msg) { - super(msg); - } - - /** - * Creates a new <code>UnsupportedAttributeException</code> with the specified cause. - * - * @param initCause the exception's initCause - */ - public UnsupportedAttributeException(Throwable initCause) { - super(initCause); - } - - /** - * Creates a new <code>UnsupportedAttributeException</code> with the specified detail message and cause. - * - * @param msg the exception's detail message - * @param initCause the exception's initCause - */ - public UnsupportedAttributeException(String msg, Throwable initCause) { - super(msg, initCause); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler; + +/** + * Thrown by <code>TagHandler</code> when an unsupported attribute is encountered. + * + * @see jaxx.compiler.tags.TagHandler + */ +public class UnsupportedAttributeException extends CompilerException { + + private static final long serialVersionUID = -6919583037172920343L; + + /** Creates a new <code>UnsupportedAttributeException</code>. */ + public UnsupportedAttributeException() { + } + + /** + * Creates a new <code>UnsupportedAttributeException</code> with the specified detail message. + * + * @param msg the exception's detail message + */ + public UnsupportedAttributeException(String msg) { + super(msg); + } + + /** + * Creates a new <code>UnsupportedAttributeException</code> with the specified cause. + * + * @param initCause the exception's initCause + */ + public UnsupportedAttributeException(Throwable initCause) { + super(initCause); + } + + /** + * Creates a new <code>UnsupportedAttributeException</code> with the specified detail message and cause. + * + * @param msg the exception's detail message + * @param initCause the exception's initCause + */ + public UnsupportedAttributeException(String msg, Throwable initCause) { + super(msg, initCause); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/UnsupportedTagException.java b/jaxx-compiler/src/main/java/jaxx/compiler/UnsupportedTagException.java index 1c38eaf..3ec4dab 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/UnsupportedTagException.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/UnsupportedTagException.java @@ -1,45 +1,61 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler; - -/** Thrown by the compiler when an unregistered tag is encountered. */ -public class UnsupportedTagException extends CompilerException { - private static final long serialVersionUID = 3199732135804426699L; - - /** Creates a new <code>UnsupportedTagException</code>. */ - public UnsupportedTagException() { - } - - - /** - * Creates a new <code>UnsupportedTagException</code> with the specified detail message. - * - * @param msg the exception's detail message - */ - public UnsupportedTagException(String msg) { - super(msg); - } - - - /** - * Creates a new <code>UnsupportedTagException</code> with the specified cause. - * - * @param initCause the exception's initCause - */ - public UnsupportedTagException(Throwable initCause) { - super(initCause); - } - - - /** - * Creates a new <code>UnsupportedTagException</code> with the specified detail message and cause. - * - * @param msg the exception's detail message - * @param initCause the exception's initCause - */ - public UnsupportedTagException(String msg, Throwable initCause) { - super(msg, initCause); - } +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler; + +/** Thrown by the compiler when an unregistered tag is encountered. */ +public class UnsupportedTagException extends CompilerException { + private static final long serialVersionUID = 3199732135804426699L; + + /** Creates a new <code>UnsupportedTagException</code>. */ + public UnsupportedTagException() { + } + + + /** + * Creates a new <code>UnsupportedTagException</code> with the specified detail message. + * + * @param msg the exception's detail message + */ + public UnsupportedTagException(String msg) { + super(msg); + } + + + /** + * Creates a new <code>UnsupportedTagException</code> with the specified cause. + * + * @param initCause the exception's initCause + */ + public UnsupportedTagException(Throwable initCause) { + super(initCause); + } + + + /** + * Creates a new <code>UnsupportedTagException</code> with the specified detail message and cause. + * + * @param msg the exception's detail message + * @param initCause the exception's initCause + */ + public UnsupportedTagException(String msg, Throwable initCause) { + super(msg, initCause); + } } \ No newline at end of file diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/beans/BeanInfoUtil.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/BeanInfoUtil.java index b998b14..2feea85 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/beans/BeanInfoUtil.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/BeanInfoUtil.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.beans; import java.beans.Introspector; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanDescriptor.java index f1138bf..b235e81 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanDescriptor.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.beans; import jaxx.compiler.reflect.ClassDescriptor; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanInfo.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanInfo.java index e1be786..ea712df 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanInfo.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXBeanInfo.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.beans; import jaxx.compiler.reflect.ClassDescriptor; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXEventSetDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXEventSetDescriptor.java index 5790263..2ff00d2 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXEventSetDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXEventSetDescriptor.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.beans; import jaxx.compiler.reflect.ClassDescriptor; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXFeatureDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXFeatureDescriptor.java index c7723bf..6c31e66 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXFeatureDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXFeatureDescriptor.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.beans; import jaxx.compiler.reflect.ClassDescriptor; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java index 05603be..2076972 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXIntrospector.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.beans; import jaxx.compiler.reflect.ClassDescriptor; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXPropertyDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXPropertyDescriptor.java index 299c523..5b9ba84 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXPropertyDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/beans/JAXXPropertyDescriptor.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.beans; import jaxx.compiler.CompilerException; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java index b460201..9fbf0b7 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.css; import jaxx.compiler.*; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParser.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParser.java index 4f90ef9..91e3f35 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParser.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParser.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JJTree&JavaCC: Do not edit this line. CSSParser.java */ package jaxx.compiler.css.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserConstants.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserConstants.java index be8dba5..5ac6ec9 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserConstants.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserConstants.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JJTree&JavaCC: Do not edit this line. CSSParserConstants.java */ package jaxx.compiler.css.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTokenManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTokenManager.java index 9b67ccb..f1dedbd 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTokenManager.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTokenManager.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JJTree&JavaCC: Do not edit this line. CSSParserTokenManager.java */ package jaxx.compiler.css.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTreeConstants.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTreeConstants.java index e044bdc..b9e6b20 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTreeConstants.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTreeConstants.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JJTree: Do not edit this line. .\CSSParserTreeConstants.java */ package jaxx.compiler.css.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/JJTCSSParserState.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/JJTCSSParserState.java index ef22e6c..4fd91e7 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/JJTCSSParserState.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/JJTCSSParserState.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JJTree: Do not edit this line. .\JJTCSSParserState.java */ package jaxx.compiler.css.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Node.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Node.java index 625c4e6..50f84f4 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Node.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Node.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JJTree: Do not edit this line. Node.java */ package jaxx.compiler.css.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/ParseException.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/ParseException.java index df1572a..fe59f91 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/ParseException.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/ParseException.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */ package jaxx.compiler.css.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleCharStream.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleCharStream.java index 3e401b6..c3de8e5 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleCharStream.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleCharStream.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 4.0 */ package jaxx.compiler.css.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleNode.java index 3e95780..ac63ff5 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleNode.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleNode.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JJTree: Do not edit this line. SimpleNode.java */ package jaxx.compiler.css.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Token.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Token.java index aebb228..b545803 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Token.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Token.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */ package jaxx.compiler.css.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/TokenMgrError.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/TokenMgrError.java index 04be2db..3d97676 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/TokenMgrError.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/TokenMgrError.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */ package jaxx.compiler.css.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java index 5465320..8e47db5 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.decorators; import jaxx.compiler.CompiledObject; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java index 24ac11d..cdcb0be 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.decorators; import jaxx.compiler.CompiledObject; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java index 5ffe0c7..f5840fe 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.decorators; import jaxx.compiler.CompiledObject; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java b/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java index 2b7af6f..90ee171 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.finalizers; import jaxx.compiler.JAXXCompilerFinalizer; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/SwingFinalizer.java b/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/SwingFinalizer.java index a6f11de..e34e206 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/SwingFinalizer.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/SwingFinalizer.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.finalizers; import jaxx.compiler.java.JavaArgument; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorFinalizer.java b/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorFinalizer.java index 6aced22..105acfd 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorFinalizer.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/ValidatorFinalizer.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.finalizers; import jaxx.compiler.java.JavaArgument; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaArgument.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaArgument.java index c637da6..7dde778 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaArgument.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaArgument.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.java; /** diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaElement.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaElement.java index 0fa92c0..4ad3863 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaElement.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaElement.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.java; import java.lang.reflect.Modifier; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaField.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaField.java index f2d9cf0..fb1f7ab 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaField.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaField.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.java; import java.lang.reflect.Modifier; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFile.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFile.java index 5d480ed..1de7de5 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFile.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFile.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.java; import java.lang.reflect.Modifier; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFileGenerator.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFileGenerator.java index 594d529..df107a6 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFileGenerator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaFileGenerator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.java; import java.io.PrintWriter; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaMethod.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaMethod.java index 491649f..94e9d89 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaMethod.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/JavaMethod.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.java; import java.lang.reflect.Modifier; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JJTJavaParserState.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JJTJavaParserState.java index 42f1158..e35b0db 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JJTJavaParserState.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JJTJavaParserState.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JJTree: Do not edit this line. .\JJTJavaParserState.java */ package jaxx.compiler.java.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaCharStream.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaCharStream.java index 22153f8..b3e2ee3 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaCharStream.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaCharStream.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 4.0 */ package jaxx.compiler.java.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java index 9c47385..6a192d3 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JJTree&JavaCC: Do not edit this line. JavaParser.java */ package jaxx.compiler.java.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserConstants.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserConstants.java index e48071f..b553206 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserConstants.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserConstants.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JJTree&JavaCC: Do not edit this line. JavaParserConstants.java */ package jaxx.compiler.java.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTokenManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTokenManager.java index a53d00b..bc1f22d 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTokenManager.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTokenManager.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JJTree&JavaCC: Do not edit this line. JavaParserTokenManager.java */ package jaxx.compiler.java.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTreeConstants.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTreeConstants.java index 0ebbf26..2526e36 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTreeConstants.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTreeConstants.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JJTree: Do not edit this line. ./JavaParserTreeConstants.java */ package jaxx.compiler.java.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Node.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Node.java index 8c0f328..61a5e49 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Node.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Node.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JJTree: Do not edit this line. Node.java */ package jaxx.compiler.java.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/ParseException.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/ParseException.java index c445ecc..467227e 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/ParseException.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/ParseException.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */ package jaxx.compiler.java.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/SimpleNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/SimpleNode.java index 8aa287e..f8ed971 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/SimpleNode.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/SimpleNode.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JJTree: Do not edit this line. SimpleNode.java */ package jaxx.compiler.java.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Token.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Token.java index d84b252..4cfce10 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Token.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Token.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */ package jaxx.compiler.java.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/TokenMgrError.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/TokenMgrError.java index ce97582..7b0546d 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/TokenMgrError.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/TokenMgrError.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */ package jaxx.compiler.java.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptor.java index 32b6d1f..b540254 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptor.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.reflect; import jaxx.runtime.JAXXObjectDescriptor; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorLoader.java b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorLoader.java index f46d3b3..0ed644d 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorLoader.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptorLoader.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.reflect; import jaxx.compiler.CompilerException; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/FieldDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/FieldDescriptor.java index 7091cbe..e066836 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/FieldDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/FieldDescriptor.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.reflect; /** diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java index f2d890d..c5fa9a5 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/JavaFileParser.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.reflect; import jaxx.compiler.CompilerException; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/MemberDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/MemberDescriptor.java index 010e2f3..d4ecd45 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/MemberDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/MemberDescriptor.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.reflect; /** diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/MethodDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/MethodDescriptor.java index 5eb717f..e1eb81d 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/MethodDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/MethodDescriptor.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.reflect; import jaxx.compiler.JAXXCompiler; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptInitializer.java b/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptInitializer.java index 106c519..51c054a 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptInitializer.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptInitializer.java @@ -1,23 +1,39 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.script; - -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptorLoader; - -/** - * A dummy CompiledObject which serves to initialize scripted field. This is handled by - * a CompiledObject rather than (say) simply inlining the initialization code in order to - * ensure that the field is initialized in document order. - */ -public class ScriptInitializer extends CompiledObject { - - public ScriptInitializer(String initializer, JAXXCompiler compiler) { - super(compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(ScriptInitializer.class)), - ClassDescriptorLoader.getClassDescriptor(ScriptInitializer.class), compiler, false); - appendInitializationCode(initializer); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.script; + +import jaxx.compiler.CompiledObject; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptorLoader; + +/** + * A dummy CompiledObject which serves to initialize scripted field. This is handled by + * a CompiledObject rather than (say) simply inlining the initialization code in order to + * ensure that the field is initialized in document order. + */ +public class ScriptInitializer extends CompiledObject { + + public ScriptInitializer(String initializer, JAXXCompiler compiler) { + super(compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(ScriptInitializer.class)), + ClassDescriptorLoader.getClassDescriptor(ScriptInitializer.class), compiler, false); + appendInitializationCode(initializer); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java index 9db1829..12da0e8 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/script/ScriptManager.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.script; import jaxx.compiler.*; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java b/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java index 8615a8c..d1527b4 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/spi/DefaultInitializer.java @@ -1,203 +1,219 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.spi; - -import java.awt.Component; -import javax.swing.JCheckBox; -import javax.swing.JCheckBoxMenuItem; -import javax.swing.JComboBox; -import javax.swing.JDialog; -import javax.swing.JEditorPane; -import javax.swing.JFormattedTextField; -import javax.swing.JFrame; -import javax.swing.JInternalFrame; -import javax.swing.JList; -import javax.swing.JMenu; -import javax.swing.JPasswordField; -import javax.swing.JPopupMenu; -import javax.swing.JProgressBar; -import javax.swing.JRadioButton; -import javax.swing.JRadioButtonMenuItem; -import javax.swing.JScrollPane; -import javax.swing.JSlider; -import javax.swing.JSpinner; -import javax.swing.JSplitPane; -import javax.swing.JTabbedPane; -import javax.swing.JTextArea; -import javax.swing.JTextField; -import javax.swing.JTextPane; -import javax.swing.JToggleButton; -import javax.swing.JToolBar; -import javax.swing.JTree; -import javax.swing.JWindow; -import javax.swing.text.JTextComponent; - -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.beans.BeanInfoUtil; - -import jaxx.compiler.reflect.ClassDescriptorLoader; - -import jaxx.compiler.tags.DefaultComponentHandler; -import jaxx.compiler.tags.DefaultObjectHandler; -import jaxx.compiler.tags.ScriptHandler; -import jaxx.compiler.tags.StyleHandler; -import jaxx.compiler.tags.TagHandler; -import jaxx.compiler.tags.TagManager; -import jaxx.compiler.tags.swing.ApplicationHandler; -import jaxx.compiler.tags.swing.CellHandler; -import jaxx.compiler.tags.swing.ItemHandler; -import jaxx.compiler.tags.swing.JAXXComboBoxHandler; -import jaxx.compiler.tags.swing.JAXXListHandler; -import jaxx.compiler.tags.swing.JAXXTabHandler; -import jaxx.compiler.tags.swing.JAXXTreeHandler; -import jaxx.compiler.tags.swing.JCheckBoxHandler; -import jaxx.compiler.tags.swing.JComboBoxHandler; -import jaxx.compiler.tags.swing.JInternalFrameHandler; -import jaxx.compiler.tags.swing.JListHandler; -import jaxx.compiler.tags.swing.JMenuHandler; -import jaxx.compiler.tags.swing.JPasswordFieldHandler; -import jaxx.compiler.tags.swing.JPopupMenuHandler; -import jaxx.compiler.tags.swing.JProgressBarHandler; -import jaxx.compiler.tags.swing.JRadioButtonHandler; -import jaxx.compiler.tags.swing.JScrollPaneHandler; -import jaxx.compiler.tags.swing.JSliderHandler; -import jaxx.compiler.tags.swing.JSpinnerHandler; -import jaxx.compiler.tags.swing.JSplitPaneHandler; -import jaxx.compiler.tags.swing.JTabbedPaneHandler; -import jaxx.compiler.tags.swing.JTextComponentHandler; -import jaxx.compiler.tags.swing.JToolBarHandler; -import jaxx.compiler.tags.swing.JTreeHandler; -import jaxx.compiler.tags.swing.JWindowHandler; -import jaxx.compiler.tags.swing.RowHandler; -import jaxx.compiler.tags.swing.TabHandler; -import jaxx.compiler.tags.swing.TableHandler; -import jaxx.compiler.tags.validator.BeanValidatorHandler; -import jaxx.compiler.tags.validator.ExcludeFieldValidatorHandler; -import jaxx.compiler.tags.validator.FieldValidatorHandler; - - -import jaxx.runtime.swing.Application; -import jaxx.runtime.swing.JAXXButtonGroup; -import jaxx.runtime.swing.JAXXComboBox; -import jaxx.runtime.swing.JAXXList; -import jaxx.runtime.swing.JAXXTab; -import jaxx.runtime.swing.JAXXTree; -import jaxx.runtime.swing.Table; -import jaxx.runtime.swing.editor.EnumEditor; -import jaxx.runtime.swing.editor.LocaleEditor; -import jaxx.runtime.validator.swing.SwingValidator; - -/** - * Initializes support provided from JAXX (java, swing and validation). - * - */ -public class DefaultInitializer implements Initializer { - - @Override - public void initialize() { - - BeanInfoUtil.addJaxxBeanInfoPath("jaxx.runtime.swing"); - - registerDefaultNamespace("javax.swing.*", - JEditorPane.class, - JFormattedTextField.class, - JPasswordField.class, - JTextArea.class, - JTextField.class, - JTextPane.class); - - // - // Register tags - // - - registerTag(JAXXCompiler.JAXX_NAMESPACE, "script", new ScriptHandler()); - registerTag(JAXXCompiler.JAXX_NAMESPACE, "style", new StyleHandler()); - - //TC-20091005 why the namespace was on awt ? ButtonGroup is from javax.swing - registerTag("javax.swing.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class))); -// TagManager.registerTag("java.awt.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class))); - - registerTag(JAXXCompiler.JAXX_NAMESPACE, "tab", new TabHandler()); - registerTag(JAXXCompiler.JAXX_NAMESPACE, "row", new RowHandler()); - registerTag(JAXXCompiler.JAXX_NAMESPACE, "cell", new CellHandler()); - registerTag(JAXXCompiler.JAXX_NAMESPACE, "item", new ItemHandler()); - - - registerTag(JAXXCompiler.JAXX_NAMESPACE, BeanValidatorHandler.TAG, new BeanValidatorHandler(ClassDescriptorLoader.getClassDescriptor(SwingValidator.class))); - registerTag(JAXXCompiler.JAXX_NAMESPACE, FieldValidatorHandler.TAG, new FieldValidatorHandler()); - registerTag(JAXXCompiler.JAXX_NAMESPACE, ExcludeFieldValidatorHandler.TAG, new FieldValidatorHandler()); - - // - // Register beans - // - - registerBean(Object.class, DefaultObjectHandler.class); - registerBean(Component.class, DefaultComponentHandler.class); - - // check boxes - registerBean(JCheckBox.class, JCheckBoxHandler.class); - registerBean(JCheckBoxMenuItem.class, JCheckBoxHandler.class); - - // combo boxes - registerBean(JComboBox.class, JComboBoxHandler.class); - registerBean(EnumEditor.class, JComboBoxHandler.class); - registerBean(LocaleEditor.class, JComboBoxHandler.class); - registerBean(JAXXComboBox.class, JAXXComboBoxHandler.class); - - // radio boxes - registerBean(JRadioButton.class, JRadioButtonHandler.class); - registerBean(JRadioButtonMenuItem.class, JRadioButtonHandler.class); - registerBean(JToggleButton.class, JRadioButtonHandler.class); - - // Lists - registerBean(JList.class, JListHandler.class); - registerBean(JAXXList.class, JAXXListHandler.class); - - // Trees - registerBean(JTree.class, JTreeHandler.class); - registerBean(JAXXTree.class, JAXXTreeHandler.class); - - // Windows - registerBean(JDialog.class, JWindowHandler.class); - registerBean(JFrame.class, JWindowHandler.class); - registerBean(JWindow.class, JWindowHandler.class); - - registerBean(Application.class, ApplicationHandler.class); - - registerBean(JInternalFrame.class, JInternalFrameHandler.class); - registerBean(JMenu.class, JMenuHandler.class); - registerBean(JPasswordField.class, JPasswordFieldHandler.class); - registerBean(JPopupMenu.class, JPopupMenuHandler.class); - registerBean(JProgressBar.class, JProgressBarHandler.class); - registerBean(JScrollPane.class, JScrollPaneHandler.class); - registerBean(JSlider.class, JSliderHandler.class); - registerBean(JSpinner.class, JSpinnerHandler.class); - registerBean(JSplitPane.class, JSplitPaneHandler.class); - registerBean(JTabbedPane.class, JTabbedPaneHandler.class); - registerBean(JTextComponent.class, JTextComponentHandler.class); - registerBean(JToolBar.class, JToolBarHandler.class); - - registerBean(Table.class, TableHandler.class); - registerBean(JAXXTab.class, JAXXTabHandler.class); - - registerBean(SwingValidator.class, BeanValidatorHandler.class); - - } - - protected void registerBean(Class<?> beanClass, Class<? extends TagHandler> handlerClass) { - TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(beanClass), handlerClass); - } - - protected void registerTag(String namespace, String tagName, TagHandler handler) { - TagManager.registerTag(namespace, tagName, handler); - } - - protected void registerDefaultNamespace(String namespace, Class<?>... beanClass) { - - for (Class<?> c : beanClass) { - TagManager.registerDefaultNamespace(c.getSimpleName(), namespace); - } - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.spi; + +import java.awt.Component; +import javax.swing.JCheckBox; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JComboBox; +import javax.swing.JDialog; +import javax.swing.JEditorPane; +import javax.swing.JFormattedTextField; +import javax.swing.JFrame; +import javax.swing.JInternalFrame; +import javax.swing.JList; +import javax.swing.JMenu; +import javax.swing.JPasswordField; +import javax.swing.JPopupMenu; +import javax.swing.JProgressBar; +import javax.swing.JRadioButton; +import javax.swing.JRadioButtonMenuItem; +import javax.swing.JScrollPane; +import javax.swing.JSlider; +import javax.swing.JSpinner; +import javax.swing.JSplitPane; +import javax.swing.JTabbedPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.JTextPane; +import javax.swing.JToggleButton; +import javax.swing.JToolBar; +import javax.swing.JTree; +import javax.swing.JWindow; +import javax.swing.text.JTextComponent; + +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.beans.BeanInfoUtil; + +import jaxx.compiler.reflect.ClassDescriptorLoader; + +import jaxx.compiler.tags.DefaultComponentHandler; +import jaxx.compiler.tags.DefaultObjectHandler; +import jaxx.compiler.tags.ScriptHandler; +import jaxx.compiler.tags.StyleHandler; +import jaxx.compiler.tags.TagHandler; +import jaxx.compiler.tags.TagManager; +import jaxx.compiler.tags.swing.ApplicationHandler; +import jaxx.compiler.tags.swing.CellHandler; +import jaxx.compiler.tags.swing.ItemHandler; +import jaxx.compiler.tags.swing.JAXXComboBoxHandler; +import jaxx.compiler.tags.swing.JAXXListHandler; +import jaxx.compiler.tags.swing.JAXXTabHandler; +import jaxx.compiler.tags.swing.JAXXTreeHandler; +import jaxx.compiler.tags.swing.JCheckBoxHandler; +import jaxx.compiler.tags.swing.JComboBoxHandler; +import jaxx.compiler.tags.swing.JInternalFrameHandler; +import jaxx.compiler.tags.swing.JListHandler; +import jaxx.compiler.tags.swing.JMenuHandler; +import jaxx.compiler.tags.swing.JPasswordFieldHandler; +import jaxx.compiler.tags.swing.JPopupMenuHandler; +import jaxx.compiler.tags.swing.JProgressBarHandler; +import jaxx.compiler.tags.swing.JRadioButtonHandler; +import jaxx.compiler.tags.swing.JScrollPaneHandler; +import jaxx.compiler.tags.swing.JSliderHandler; +import jaxx.compiler.tags.swing.JSpinnerHandler; +import jaxx.compiler.tags.swing.JSplitPaneHandler; +import jaxx.compiler.tags.swing.JTabbedPaneHandler; +import jaxx.compiler.tags.swing.JTextComponentHandler; +import jaxx.compiler.tags.swing.JToolBarHandler; +import jaxx.compiler.tags.swing.JTreeHandler; +import jaxx.compiler.tags.swing.JWindowHandler; +import jaxx.compiler.tags.swing.RowHandler; +import jaxx.compiler.tags.swing.TabHandler; +import jaxx.compiler.tags.swing.TableHandler; +import jaxx.compiler.tags.validator.BeanValidatorHandler; +import jaxx.compiler.tags.validator.ExcludeFieldValidatorHandler; +import jaxx.compiler.tags.validator.FieldValidatorHandler; + + +import jaxx.runtime.swing.Application; +import jaxx.runtime.swing.JAXXButtonGroup; +import jaxx.runtime.swing.JAXXComboBox; +import jaxx.runtime.swing.JAXXList; +import jaxx.runtime.swing.JAXXTab; +import jaxx.runtime.swing.JAXXTree; +import jaxx.runtime.swing.Table; +import jaxx.runtime.swing.editor.EnumEditor; +import jaxx.runtime.swing.editor.LocaleEditor; +import jaxx.runtime.validator.swing.SwingValidator; + +/** + * Initializes support provided from JAXX (java, swing and validation). + * + */ +public class DefaultInitializer implements Initializer { + + @Override + public void initialize() { + + BeanInfoUtil.addJaxxBeanInfoPath("jaxx.runtime.swing"); + + registerDefaultNamespace("javax.swing.*", + JEditorPane.class, + JFormattedTextField.class, + JPasswordField.class, + JTextArea.class, + JTextField.class, + JTextPane.class); + + // + // Register tags + // + + registerTag(JAXXCompiler.JAXX_NAMESPACE, "script", new ScriptHandler()); + registerTag(JAXXCompiler.JAXX_NAMESPACE, "style", new StyleHandler()); + + //TC-20091005 why the namespace was on awt ? ButtonGroup is from javax.swing + registerTag("javax.swing.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class))); +// TagManager.registerTag("java.awt.*", "ButtonGroup", new DefaultObjectHandler(ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class))); + + registerTag(JAXXCompiler.JAXX_NAMESPACE, "tab", new TabHandler()); + registerTag(JAXXCompiler.JAXX_NAMESPACE, "row", new RowHandler()); + registerTag(JAXXCompiler.JAXX_NAMESPACE, "cell", new CellHandler()); + registerTag(JAXXCompiler.JAXX_NAMESPACE, "item", new ItemHandler()); + + + registerTag(JAXXCompiler.JAXX_NAMESPACE, BeanValidatorHandler.TAG, new BeanValidatorHandler(ClassDescriptorLoader.getClassDescriptor(SwingValidator.class))); + registerTag(JAXXCompiler.JAXX_NAMESPACE, FieldValidatorHandler.TAG, new FieldValidatorHandler()); + registerTag(JAXXCompiler.JAXX_NAMESPACE, ExcludeFieldValidatorHandler.TAG, new FieldValidatorHandler()); + + // + // Register beans + // + + registerBean(Object.class, DefaultObjectHandler.class); + registerBean(Component.class, DefaultComponentHandler.class); + + // check boxes + registerBean(JCheckBox.class, JCheckBoxHandler.class); + registerBean(JCheckBoxMenuItem.class, JCheckBoxHandler.class); + + // combo boxes + registerBean(JComboBox.class, JComboBoxHandler.class); + registerBean(EnumEditor.class, JComboBoxHandler.class); + registerBean(LocaleEditor.class, JComboBoxHandler.class); + registerBean(JAXXComboBox.class, JAXXComboBoxHandler.class); + + // radio boxes + registerBean(JRadioButton.class, JRadioButtonHandler.class); + registerBean(JRadioButtonMenuItem.class, JRadioButtonHandler.class); + registerBean(JToggleButton.class, JRadioButtonHandler.class); + + // Lists + registerBean(JList.class, JListHandler.class); + registerBean(JAXXList.class, JAXXListHandler.class); + + // Trees + registerBean(JTree.class, JTreeHandler.class); + registerBean(JAXXTree.class, JAXXTreeHandler.class); + + // Windows + registerBean(JDialog.class, JWindowHandler.class); + registerBean(JFrame.class, JWindowHandler.class); + registerBean(JWindow.class, JWindowHandler.class); + + registerBean(Application.class, ApplicationHandler.class); + + registerBean(JInternalFrame.class, JInternalFrameHandler.class); + registerBean(JMenu.class, JMenuHandler.class); + registerBean(JPasswordField.class, JPasswordFieldHandler.class); + registerBean(JPopupMenu.class, JPopupMenuHandler.class); + registerBean(JProgressBar.class, JProgressBarHandler.class); + registerBean(JScrollPane.class, JScrollPaneHandler.class); + registerBean(JSlider.class, JSliderHandler.class); + registerBean(JSpinner.class, JSpinnerHandler.class); + registerBean(JSplitPane.class, JSplitPaneHandler.class); + registerBean(JTabbedPane.class, JTabbedPaneHandler.class); + registerBean(JTextComponent.class, JTextComponentHandler.class); + registerBean(JToolBar.class, JToolBarHandler.class); + + registerBean(Table.class, TableHandler.class); + registerBean(JAXXTab.class, JAXXTabHandler.class); + + registerBean(SwingValidator.class, BeanValidatorHandler.class); + + } + + protected void registerBean(Class<?> beanClass, Class<? extends TagHandler> handlerClass) { + TagManager.registerBean(ClassDescriptorLoader.getClassDescriptor(beanClass), handlerClass); + } + + protected void registerTag(String namespace, String tagName, TagHandler handler) { + TagManager.registerTag(namespace, tagName, handler); + } + + protected void registerDefaultNamespace(String namespace, Class<?>... beanClass) { + + for (Class<?> c : beanClass) { + TagManager.registerDefaultNamespace(c.getSimpleName(), namespace); + } + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/spi/Initializer.java b/jaxx-compiler/src/main/java/jaxx/compiler/spi/Initializer.java index 4bf9695..8a07671 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/spi/Initializer.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/spi/Initializer.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.spi; /** diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java index d976c35..a425c35 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java @@ -1,347 +1,363 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.UnsupportedAttributeException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.I18nHelper; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Element; - -import java.awt.Component; -import java.awt.Container; -import java.awt.event.ComponentListener; -import java.awt.event.ContainerListener; -import java.awt.event.FocusListener; -import java.beans.IntrospectionException; -import java.io.IOException; -import java.lang.reflect.Field; -import jaxx.runtime.Util; -import org.w3c.dom.Attr; -import org.w3c.dom.NamedNodeMap; - -public class DefaultComponentHandler extends DefaultObjectHandler { - - public static final String ACTION_ICON_ATTRIBUTE = "actionIcon"; - public static final String CONTAINER_DELEGATE_ATTRIBUTE = "containerDelegate"; - public static final String FONT_FACE_ATTRIBUTE = "font-face"; - public static final String FONT_SIZE_ATTRIBUTE = "font-size"; - public static final String FONT_STYLE_ATTRIBUTE = "font-style"; - public static final String FONT_WEIGHT_ATTRIBUTE = "font-weight"; - public static final String HEIGHT_ATTRIBUTE = "height"; - public static final String ICON_ATTRIBUTE = "icon"; - public static final String NAME_ATTRIBUTE = "name"; - public static final String WIDTH_ATTRIBUTE = "width"; - public static final String X_ATTRIBUTE = "x"; - public static final String Y_ATTRIBUTE = "y"; - /** - * Logger - */ - protected static final Log log = LogFactory.getLog(DefaultComponentHandler.class); - /** - * container delegate (if any) - */ - private String containerDelegate; - - public DefaultComponentHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, Component.class); - } - - @Override - protected void init() throws IntrospectionException { - if (jaxxBeanInfo == null) { - super.init(); - - containerDelegate = (String) getJAXXBeanInfo().getJAXXBeanDescriptor().getValue(CONTAINER_DELEGATE_ATTRIBUTE); - if (containerDelegate == null && ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass().getSuperclass())) { - containerDelegate = ((DefaultComponentHandler) TagManager.getTagHandler(getBeanClass().getSuperclass())).getContainerDelegate(); - } - } - } - - @Override - protected void configureProxyEventInfo() { - super.configureProxyEventInfo(); - addProxyEventInfo("hasFocus", FocusListener.class); - addProxyEventInfo("isVisible", ComponentListener.class); - addProxyEventInfo("getBounds", ComponentListener.class); - addProxyEventInfo("getLocation", ComponentListener.class); - addProxyEventInfo("getLocationOnScreen", ComponentListener.class); - addProxyEventInfo("getSize", ComponentListener.class); - addProxyEventInfo("getX", ComponentListener.class); - addProxyEventInfo("getY", ComponentListener.class); - addProxyEventInfo("getWidth", ComponentListener.class); - addProxyEventInfo("getHeight", ComponentListener.class); - if (ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass())) { - addProxyEventInfo("getComponentCount", ContainerListener.class); - } - } - - @Override - protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { - super.setDefaults(object, tag, compiler); - setAttribute(object, NAME_ATTRIBUTE, object.getId(), false, compiler); - openComponent(object, tag, compiler); - } - - @Override - public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - super.compileFirstPass(tag, compiler); - } - - @Override - public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - super.compileSecondPass(tag, compiler); - closeComponent(compiler.getOpenComponent(), tag, compiler); - } - - protected void openComponent(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { - String constraints = tag.getAttribute(CONSTRAINTS_ATTRIBUTE); - if (constraints != null && constraints.length() > 0) { - compiler.openComponent(object, constraints); - } else { - compiler.openComponent(object); - } - } - - protected void closeComponent(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { - compiler.closeComponent(object); - } - - @Override - public boolean isPropertyInherited(String property) throws UnsupportedAttributeException { - return property.equals("font") || property.startsWith("font-") || property.equals("foreground") || property.equals("enabled"); - } - - @Override - public ClassDescriptor getPropertyType(CompiledObject object, String propertyName, JAXXCompiler compiler) throws CompilerException { - if (propertyName.equals(X_ATTRIBUTE) || - propertyName.equals(Y_ATTRIBUTE) || - propertyName.equals(WIDTH_ATTRIBUTE) || - propertyName.equals(HEIGHT_ATTRIBUTE) || - FONT_SIZE_ATTRIBUTE.equals(propertyName)) { - return ClassDescriptorLoader.getClassDescriptor(Integer.class); - } - if (propertyName.equals(FONT_FACE_ATTRIBUTE) || - propertyName.equals(FONT_STYLE_ATTRIBUTE) || - propertyName.equals(FONT_WEIGHT_ATTRIBUTE)) { - return ClassDescriptorLoader.getClassDescriptor(String.class); - } - return super.getPropertyType(object, propertyName, compiler); - } - - @Override - public String getGetPropertyCode(String id, String name, JAXXCompiler compiler) throws CompilerException { - if (name.equals(FONT_FACE_ATTRIBUTE)) { - return id + ".getFont().getFontName()"; - } - if (name.equals(FONT_SIZE_ATTRIBUTE)) { - return id + ".getFont().getSize()"; - } - if (name.equals(FONT_WEIGHT_ATTRIBUTE)) { - return "(" + id + ".getFont().getStyle() & Font.BOLD) != 0 ? \"bold\" : \"normal\""; - } - if (name.equals(FONT_STYLE_ATTRIBUTE)) { - return "(" + id + ".getFont().getStyle() & Font.ITALIC) != 0 ? \"italic\" : \"normal\""; - } - return super.getGetPropertyCode(id, name, compiler); - } - - @Override - public String getSetPropertyCode(String id, String name, String valueCode, JAXXCompiler compiler) throws CompilerException { - if (name.equals(X_ATTRIBUTE)) { - return id + ".setLocation(" + valueCode + ", " + id + ".getY());"; - } - if (name.equals(Y_ATTRIBUTE)) { - return id + ".setLocation(" + id + ".getX(), " + valueCode + ");"; - } - if (name.equals(WIDTH_ATTRIBUTE)) { - // need to optimize case when both width and height are being assigned - return Util.class.getName() + ".setComponentWidth(" + id + "," + valueCode + ");"; - } - if (name.equals(HEIGHT_ATTRIBUTE)) { - return Util.class.getName() + ".setComponentHeight(" + id + "," + valueCode + ");"; - } - if (name.equals(FONT_FACE_ATTRIBUTE)) { - return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(new Font(" + valueCode + ", " + id + ".getFont().getStyle(), " + id + ".getFont().getSize()));\n}"; - } - if (name.equals(FONT_SIZE_ATTRIBUTE)) { - return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont((float) " + valueCode + "));\n}"; - } - if (name.equals(FONT_WEIGHT_ATTRIBUTE)) { - if (valueCode.equals("\"bold\"")) { - return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.BOLD));\n}"; - } - if (valueCode.equals("\"normal\"")) { - return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.BOLD));\n}"; - } - if (!valueCode.startsWith("\"")) { - return "if (" + id + ".getFont() != null) {\n if ((" + valueCode + ").equals(\"bold\")) {\n " + - id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.BOLD));\n } else {\n " + - id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.BOLD));\n }\n}"; - } - compiler.reportError("font-weight must be either \"normal\" or \"bold\", found " + valueCode); - return ""; - } - if (name.equals(FONT_STYLE_ATTRIBUTE)) { - if (valueCode.equals("\"italic\"")) { - return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.ITALIC));\n}"; - } - if (valueCode.equals("\"normal\"")) { - return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.ITALIC));\n}"; - } - if (!valueCode.startsWith("\"")) { - return "if (" + id + ".getFont() != null) {\n if ((" + valueCode + ").equals(\"italic\")) {\n " + - id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.ITALIC));\n } else {\n " + - id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.ITALIC));\n }\n}"; - } - compiler.reportError("font-style must be either \"normal\" or \"italic\", found " + valueCode); - return ""; - } - if (ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass()) && name.equals(LAYOUT_ATTRIBUTE)) { - // handle containerDelegate (e.g. contentPane on JFrame) - String cDelegate = (String) getJAXXBeanInfo().getJAXXBeanDescriptor().getValue(CONTAINER_DELEGATE_ATTRIBUTE); - if (cDelegate != null) { - return id + '.' + cDelegate + "().setLayout(" + valueCode + ");"; - } - } - // ajout du support i18n - if (I18nHelper.isI18nableAttribute(name, compiler)) { - valueCode = I18nHelper.addI18nInvocation(id, name, valueCode, compiler); - } - - return super.getSetPropertyCode(id, name, valueCode, compiler); - } - - @Override - public void setAttribute(CompiledObject object, String propertyName, String stringValue, boolean inline, JAXXCompiler compiler) { - - if (propertyName.startsWith("_")) { - // client property - if (stringValue.startsWith("{")) { - stringValue = stringValue.substring(1, stringValue.length() - 1); - } - object.addClientProperty(propertyName.substring(1), stringValue); - //TC-20090327 rather not generating code here - //object.appendAdditionCode(object.getJavaCode() + ".putClientProperty(\"" + propertyName.substring(1) + "\", " + stringValue + ");"); - return; - } - if (ICON_ATTRIBUTE.equals(propertyName)) { - if (!(stringValue.startsWith("{") || stringValue.endsWith("}"))) { - // this is a customized icon, add the icon creation code - if (compiler.getConfiguration().isUseUIManagerForIcon()) { - stringValue = "{" + Util.class.getName() + ".getUIManagerIcon(\"" + stringValue + "\")}"; - } else { - stringValue = "{" + Util.class.getName() + ".createImageIcon(\"" + stringValue + "\")}"; - } - } - } else if (ACTION_ICON_ATTRIBUTE.equals(propertyName)) { - // customized actionIcon property - if (stringValue.startsWith("{") && stringValue.endsWith("}")) { - // there is a script to define the action icon, this is forbidden - compiler.reportError("the actionIcon does not support script, remove braces..., fix the file " + compiler.getOutputClassName()); - return; - } - propertyName = ICON_ATTRIBUTE; - if (compiler.getConfiguration().isUseUIManagerForIcon()) { - stringValue = "{" + Util.class.getName() + ".getUIManagerActionIcon(\"" + stringValue + "\")}"; - } else { - stringValue = "{" + Util.class.getName() + ".createActionIcon(\"" + stringValue + "\")}"; - } - } - super.setAttribute(object, propertyName, stringValue, inline, compiler); - } - - @Override - protected void scanAttributesForDependencies(Element tag, JAXXCompiler compiler) { - super.scanAttributesForDependencies(tag, compiler); - // check for clientProperty attributes - //FIXME make this works,... it seems jaxx compiler does not come here ? - //FIXME see the the firstPassHandler in JAXXCompiler ? - NamedNodeMap children = tag.getAttributes(); - for (int i = 0, max = children.getLength(); i < max; i++) { - Attr attr = (Attr) children.item(i); - String name = attr.getName(); - if (!name.startsWith("_")) { - continue; - } - String value = attr.getValue(); - if (value.startsWith("{")) { - compiler.reportWarning(tag, "an clientProperty attribute " + name.substring(1) + " does not required curly value but was : " + value, 0); - } - } - - } - - /** - * Maps string values onto integers, so that int-valued enumeration properties can be specified by strings. For - * example, when passed a key of 'alignment', this method should normally map the values 'left', 'center', and - * 'right' onto SwingConstants.LEFT, SwingConstants.CENTER, and SwingConstants.RIGHT respectively. - * <p/> - * You do not normally need to call this method yourself; it is invoked by {@link #convertFromString} when an - * int-valued property has a value which is not a valid number. By default, this method looks at the - * <code>enumerationValues</code> value of the <code>JAXXPropertyDescriptor</code>. - * - * @param key the name of the int-typed property - * @param value the non-numeric value that was specified for the property - * @throws IllegalArgumentException if the property is an enumeration, but the value is not valid - * @throws NumberFormatException if the property is not an enumeration - */ - @Override - protected int constantValue(String key, String value) { - if ((key.equals(MNEMONIC_ATTRIBUTE) || key.equals(DISPLAYED_MNEMONIC_ATTRIBUTE))) { - if (value.length() == 1) { - return value.charAt(0); - } - try { - Field vk = java.awt.event.KeyEvent.class.getField(value); - return (Integer) vk.get(null); - } catch (NoSuchFieldException e) { - throw new IllegalArgumentException("mnemonics must be either a single character or the name of a field in KeyEvent (found: '" + value + "')"); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } - } - return super.constantValue(key, value); - } - - /** - * Returns <code>true</code> if this component can contain other components. For children to be - * allowed, the component must be a subclass of <code>Container</code> and its <code>JAXXBeanInfo</code> - * must not have the value <code>false</code> for its <code>isContainer</code> value. - * - * @return <code>true</code> if children are allowed - */ - public boolean isContainer() { - boolean container = ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass()); - if (container) { - try { - init(); - if (Boolean.FALSE.equals(getJAXXBeanInfo().getJAXXBeanDescriptor().getValue("isContainer"))) { - container = false; - } - } catch (IntrospectionException e) { - throw new RuntimeException(e); - } - } - return container; - } - - public String getContainerDelegate() { - try { - init(); - return containerDelegate; - } catch (IntrospectionException e) { - throw new RuntimeException(e); - } - - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.UnsupportedAttributeException; +import jaxx.compiler.CompiledObject; +import jaxx.compiler.I18nHelper; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.w3c.dom.Element; + +import java.awt.Component; +import java.awt.Container; +import java.awt.event.ComponentListener; +import java.awt.event.ContainerListener; +import java.awt.event.FocusListener; +import java.beans.IntrospectionException; +import java.io.IOException; +import java.lang.reflect.Field; +import jaxx.runtime.Util; +import org.w3c.dom.Attr; +import org.w3c.dom.NamedNodeMap; + +public class DefaultComponentHandler extends DefaultObjectHandler { + + public static final String ACTION_ICON_ATTRIBUTE = "actionIcon"; + public static final String CONTAINER_DELEGATE_ATTRIBUTE = "containerDelegate"; + public static final String FONT_FACE_ATTRIBUTE = "font-face"; + public static final String FONT_SIZE_ATTRIBUTE = "font-size"; + public static final String FONT_STYLE_ATTRIBUTE = "font-style"; + public static final String FONT_WEIGHT_ATTRIBUTE = "font-weight"; + public static final String HEIGHT_ATTRIBUTE = "height"; + public static final String ICON_ATTRIBUTE = "icon"; + public static final String NAME_ATTRIBUTE = "name"; + public static final String WIDTH_ATTRIBUTE = "width"; + public static final String X_ATTRIBUTE = "x"; + public static final String Y_ATTRIBUTE = "y"; + /** + * Logger + */ + protected static final Log log = LogFactory.getLog(DefaultComponentHandler.class); + /** + * container delegate (if any) + */ + private String containerDelegate; + + public DefaultComponentHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, Component.class); + } + + @Override + protected void init() throws IntrospectionException { + if (jaxxBeanInfo == null) { + super.init(); + + containerDelegate = (String) getJAXXBeanInfo().getJAXXBeanDescriptor().getValue(CONTAINER_DELEGATE_ATTRIBUTE); + if (containerDelegate == null && ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass().getSuperclass())) { + containerDelegate = ((DefaultComponentHandler) TagManager.getTagHandler(getBeanClass().getSuperclass())).getContainerDelegate(); + } + } + } + + @Override + protected void configureProxyEventInfo() { + super.configureProxyEventInfo(); + addProxyEventInfo("hasFocus", FocusListener.class); + addProxyEventInfo("isVisible", ComponentListener.class); + addProxyEventInfo("getBounds", ComponentListener.class); + addProxyEventInfo("getLocation", ComponentListener.class); + addProxyEventInfo("getLocationOnScreen", ComponentListener.class); + addProxyEventInfo("getSize", ComponentListener.class); + addProxyEventInfo("getX", ComponentListener.class); + addProxyEventInfo("getY", ComponentListener.class); + addProxyEventInfo("getWidth", ComponentListener.class); + addProxyEventInfo("getHeight", ComponentListener.class); + if (ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass())) { + addProxyEventInfo("getComponentCount", ContainerListener.class); + } + } + + @Override + protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { + super.setDefaults(object, tag, compiler); + setAttribute(object, NAME_ATTRIBUTE, object.getId(), false, compiler); + openComponent(object, tag, compiler); + } + + @Override + public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + super.compileFirstPass(tag, compiler); + } + + @Override + public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + super.compileSecondPass(tag, compiler); + closeComponent(compiler.getOpenComponent(), tag, compiler); + } + + protected void openComponent(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { + String constraints = tag.getAttribute(CONSTRAINTS_ATTRIBUTE); + if (constraints != null && constraints.length() > 0) { + compiler.openComponent(object, constraints); + } else { + compiler.openComponent(object); + } + } + + protected void closeComponent(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { + compiler.closeComponent(object); + } + + @Override + public boolean isPropertyInherited(String property) throws UnsupportedAttributeException { + return property.equals("font") || property.startsWith("font-") || property.equals("foreground") || property.equals("enabled"); + } + + @Override + public ClassDescriptor getPropertyType(CompiledObject object, String propertyName, JAXXCompiler compiler) throws CompilerException { + if (propertyName.equals(X_ATTRIBUTE) || + propertyName.equals(Y_ATTRIBUTE) || + propertyName.equals(WIDTH_ATTRIBUTE) || + propertyName.equals(HEIGHT_ATTRIBUTE) || + FONT_SIZE_ATTRIBUTE.equals(propertyName)) { + return ClassDescriptorLoader.getClassDescriptor(Integer.class); + } + if (propertyName.equals(FONT_FACE_ATTRIBUTE) || + propertyName.equals(FONT_STYLE_ATTRIBUTE) || + propertyName.equals(FONT_WEIGHT_ATTRIBUTE)) { + return ClassDescriptorLoader.getClassDescriptor(String.class); + } + return super.getPropertyType(object, propertyName, compiler); + } + + @Override + public String getGetPropertyCode(String id, String name, JAXXCompiler compiler) throws CompilerException { + if (name.equals(FONT_FACE_ATTRIBUTE)) { + return id + ".getFont().getFontName()"; + } + if (name.equals(FONT_SIZE_ATTRIBUTE)) { + return id + ".getFont().getSize()"; + } + if (name.equals(FONT_WEIGHT_ATTRIBUTE)) { + return "(" + id + ".getFont().getStyle() & Font.BOLD) != 0 ? \"bold\" : \"normal\""; + } + if (name.equals(FONT_STYLE_ATTRIBUTE)) { + return "(" + id + ".getFont().getStyle() & Font.ITALIC) != 0 ? \"italic\" : \"normal\""; + } + return super.getGetPropertyCode(id, name, compiler); + } + + @Override + public String getSetPropertyCode(String id, String name, String valueCode, JAXXCompiler compiler) throws CompilerException { + if (name.equals(X_ATTRIBUTE)) { + return id + ".setLocation(" + valueCode + ", " + id + ".getY());"; + } + if (name.equals(Y_ATTRIBUTE)) { + return id + ".setLocation(" + id + ".getX(), " + valueCode + ");"; + } + if (name.equals(WIDTH_ATTRIBUTE)) { + // need to optimize case when both width and height are being assigned + return Util.class.getName() + ".setComponentWidth(" + id + "," + valueCode + ");"; + } + if (name.equals(HEIGHT_ATTRIBUTE)) { + return Util.class.getName() + ".setComponentHeight(" + id + "," + valueCode + ");"; + } + if (name.equals(FONT_FACE_ATTRIBUTE)) { + return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(new Font(" + valueCode + ", " + id + ".getFont().getStyle(), " + id + ".getFont().getSize()));\n}"; + } + if (name.equals(FONT_SIZE_ATTRIBUTE)) { + return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont((float) " + valueCode + "));\n}"; + } + if (name.equals(FONT_WEIGHT_ATTRIBUTE)) { + if (valueCode.equals("\"bold\"")) { + return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.BOLD));\n}"; + } + if (valueCode.equals("\"normal\"")) { + return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.BOLD));\n}"; + } + if (!valueCode.startsWith("\"")) { + return "if (" + id + ".getFont() != null) {\n if ((" + valueCode + ").equals(\"bold\")) {\n " + + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.BOLD));\n } else {\n " + + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.BOLD));\n }\n}"; + } + compiler.reportError("font-weight must be either \"normal\" or \"bold\", found " + valueCode); + return ""; + } + if (name.equals(FONT_STYLE_ATTRIBUTE)) { + if (valueCode.equals("\"italic\"")) { + return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.ITALIC));\n}"; + } + if (valueCode.equals("\"normal\"")) { + return "if (" + id + ".getFont() != null) {\n " + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.ITALIC));\n}"; + } + if (!valueCode.startsWith("\"")) { + return "if (" + id + ".getFont() != null) {\n if ((" + valueCode + ").equals(\"italic\")) {\n " + + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() | Font.ITALIC));\n } else {\n " + + id + ".setFont(" + id + ".getFont().deriveFont(" + id + ".getFont().getStyle() & ~Font.ITALIC));\n }\n}"; + } + compiler.reportError("font-style must be either \"normal\" or \"italic\", found " + valueCode); + return ""; + } + if (ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass()) && name.equals(LAYOUT_ATTRIBUTE)) { + // handle containerDelegate (e.g. contentPane on JFrame) + String cDelegate = (String) getJAXXBeanInfo().getJAXXBeanDescriptor().getValue(CONTAINER_DELEGATE_ATTRIBUTE); + if (cDelegate != null) { + return id + '.' + cDelegate + "().setLayout(" + valueCode + ");"; + } + } + // ajout du support i18n + if (I18nHelper.isI18nableAttribute(name, compiler)) { + valueCode = I18nHelper.addI18nInvocation(id, name, valueCode, compiler); + } + + return super.getSetPropertyCode(id, name, valueCode, compiler); + } + + @Override + public void setAttribute(CompiledObject object, String propertyName, String stringValue, boolean inline, JAXXCompiler compiler) { + + if (propertyName.startsWith("_")) { + // client property + if (stringValue.startsWith("{")) { + stringValue = stringValue.substring(1, stringValue.length() - 1); + } + object.addClientProperty(propertyName.substring(1), stringValue); + //TC-20090327 rather not generating code here + //object.appendAdditionCode(object.getJavaCode() + ".putClientProperty(\"" + propertyName.substring(1) + "\", " + stringValue + ");"); + return; + } + if (ICON_ATTRIBUTE.equals(propertyName)) { + if (!(stringValue.startsWith("{") || stringValue.endsWith("}"))) { + // this is a customized icon, add the icon creation code + if (compiler.getConfiguration().isUseUIManagerForIcon()) { + stringValue = "{" + Util.class.getName() + ".getUIManagerIcon(\"" + stringValue + "\")}"; + } else { + stringValue = "{" + Util.class.getName() + ".createImageIcon(\"" + stringValue + "\")}"; + } + } + } else if (ACTION_ICON_ATTRIBUTE.equals(propertyName)) { + // customized actionIcon property + if (stringValue.startsWith("{") && stringValue.endsWith("}")) { + // there is a script to define the action icon, this is forbidden + compiler.reportError("the actionIcon does not support script, remove braces..., fix the file " + compiler.getOutputClassName()); + return; + } + propertyName = ICON_ATTRIBUTE; + if (compiler.getConfiguration().isUseUIManagerForIcon()) { + stringValue = "{" + Util.class.getName() + ".getUIManagerActionIcon(\"" + stringValue + "\")}"; + } else { + stringValue = "{" + Util.class.getName() + ".createActionIcon(\"" + stringValue + "\")}"; + } + } + super.setAttribute(object, propertyName, stringValue, inline, compiler); + } + + @Override + protected void scanAttributesForDependencies(Element tag, JAXXCompiler compiler) { + super.scanAttributesForDependencies(tag, compiler); + // check for clientProperty attributes + //FIXME make this works,... it seems jaxx compiler does not come here ? + //FIXME see the the firstPassHandler in JAXXCompiler ? + NamedNodeMap children = tag.getAttributes(); + for (int i = 0, max = children.getLength(); i < max; i++) { + Attr attr = (Attr) children.item(i); + String name = attr.getName(); + if (!name.startsWith("_")) { + continue; + } + String value = attr.getValue(); + if (value.startsWith("{")) { + compiler.reportWarning(tag, "an clientProperty attribute " + name.substring(1) + " does not required curly value but was : " + value, 0); + } + } + + } + + /** + * Maps string values onto integers, so that int-valued enumeration properties can be specified by strings. For + * example, when passed a key of 'alignment', this method should normally map the values 'left', 'center', and + * 'right' onto SwingConstants.LEFT, SwingConstants.CENTER, and SwingConstants.RIGHT respectively. + * <p/> + * You do not normally need to call this method yourself; it is invoked by {@link #convertFromString} when an + * int-valued property has a value which is not a valid number. By default, this method looks at the + * <code>enumerationValues</code> value of the <code>JAXXPropertyDescriptor</code>. + * + * @param key the name of the int-typed property + * @param value the non-numeric value that was specified for the property + * @throws IllegalArgumentException if the property is an enumeration, but the value is not valid + * @throws NumberFormatException if the property is not an enumeration + */ + @Override + protected int constantValue(String key, String value) { + if ((key.equals(MNEMONIC_ATTRIBUTE) || key.equals(DISPLAYED_MNEMONIC_ATTRIBUTE))) { + if (value.length() == 1) { + return value.charAt(0); + } + try { + Field vk = java.awt.event.KeyEvent.class.getField(value); + return (Integer) vk.get(null); + } catch (NoSuchFieldException e) { + throw new IllegalArgumentException("mnemonics must be either a single character or the name of a field in KeyEvent (found: '" + value + "')"); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + } + return super.constantValue(key, value); + } + + /** + * Returns <code>true</code> if this component can contain other components. For children to be + * allowed, the component must be a subclass of <code>Container</code> and its <code>JAXXBeanInfo</code> + * must not have the value <code>false</code> for its <code>isContainer</code> value. + * + * @return <code>true</code> if children are allowed + */ + public boolean isContainer() { + boolean container = ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass()); + if (container) { + try { + init(); + if (Boolean.FALSE.equals(getJAXXBeanInfo().getJAXXBeanDescriptor().getValue("isContainer"))) { + container = false; + } + } catch (IntrospectionException e) { + throw new RuntimeException(e); + } + } + return container; + } + + public String getContainerDelegate() { + try { + init(); + return containerDelegate; + } catch (IntrospectionException e) { + throw new RuntimeException(e); + } + + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java index c17de50..7c92a75 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java @@ -1,6 +1,22 @@ /* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.compiler.tags; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/ScriptHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/ScriptHandler.java index c628765..3bdc767 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/ScriptHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/ScriptHandler.java @@ -1,85 +1,101 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.UnsupportedAttributeException; -import jaxx.compiler.JAXXCompiler; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.Text; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.io.StringWriter; - -/** - * Handles the <code><script></code> tag. - * - * @author Ethan Nicholas - */ -public class ScriptHandler implements TagHandler { - - public static final String SOURCE_ATTRIBUTE = "source"; - - @Override - public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - File scriptFile = null; - NamedNodeMap attributes = tag.getAttributes(); - for (int i = 0; i < attributes.getLength(); i++) { - Attr attribute = (Attr) attributes.item(i); - String name = attribute.getName(); - String attrValue = attribute.getValue(); - if (name.equals(SOURCE_ATTRIBUTE)) { - scriptFile = new File(compiler.getBaseDir(), attrValue.replace('/', File.separatorChar)); - StringWriter scriptBuffer = new StringWriter(); - try { - FileReader in = new FileReader(scriptFile); - char[] readBuffer = new char[2048]; - int c; - while ((c = in.read(readBuffer)) > 0) { - scriptBuffer.write(readBuffer, 0, c); - } - } catch (FileNotFoundException e) { - compiler.reportError("script file not found: " + scriptFile); - } - compiler.registerScript(scriptBuffer.toString(), scriptFile); - } else if (!name.startsWith(XMLNS_ATTRIBUTE) && - !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { - throw new UnsupportedAttributeException(name); - } - } - - StringBuffer script = new StringBuffer(); - NodeList children = tag.getChildNodes(); - for (int i = 0; i < children.getLength(); i++) { - Node child = children.item(i); - switch (child.getNodeType()) { - case Node.ELEMENT_NODE: - compiler.reportError("<script> tag may not contain child elements: " + tag); - case Node.TEXT_NODE: // fall through - case Node.CDATA_SECTION_NODE: - script.append(((Text) child).getData()); - } - } - - String scriptString = script.toString().trim(); - if (scriptString.length() > 0) { - if (scriptFile != null) { - compiler.reportError("<script> tag has both a source attribute and an inline script"); - } - compiler.registerScript(script.toString()); - } - } - - @Override - public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.UnsupportedAttributeException; +import jaxx.compiler.JAXXCompiler; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.Text; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.io.StringWriter; + +/** + * Handles the <code><script></code> tag. + * + * @author Ethan Nicholas + */ +public class ScriptHandler implements TagHandler { + + public static final String SOURCE_ATTRIBUTE = "source"; + + @Override + public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + File scriptFile = null; + NamedNodeMap attributes = tag.getAttributes(); + for (int i = 0; i < attributes.getLength(); i++) { + Attr attribute = (Attr) attributes.item(i); + String name = attribute.getName(); + String attrValue = attribute.getValue(); + if (name.equals(SOURCE_ATTRIBUTE)) { + scriptFile = new File(compiler.getBaseDir(), attrValue.replace('/', File.separatorChar)); + StringWriter scriptBuffer = new StringWriter(); + try { + FileReader in = new FileReader(scriptFile); + char[] readBuffer = new char[2048]; + int c; + while ((c = in.read(readBuffer)) > 0) { + scriptBuffer.write(readBuffer, 0, c); + } + } catch (FileNotFoundException e) { + compiler.reportError("script file not found: " + scriptFile); + } + compiler.registerScript(scriptBuffer.toString(), scriptFile); + } else if (!name.startsWith(XMLNS_ATTRIBUTE) && + !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { + throw new UnsupportedAttributeException(name); + } + } + + StringBuffer script = new StringBuffer(); + NodeList children = tag.getChildNodes(); + for (int i = 0; i < children.getLength(); i++) { + Node child = children.item(i); + switch (child.getNodeType()) { + case Node.ELEMENT_NODE: + compiler.reportError("<script> tag may not contain child elements: " + tag); + case Node.TEXT_NODE: // fall through + case Node.CDATA_SECTION_NODE: + script.append(((Text) child).getData()); + } + } + + String scriptString = script.toString().trim(); + if (scriptString.length() > 0) { + if (scriptFile != null) { + compiler.reportError("<script> tag has both a source attribute and an inline script"); + } + compiler.registerScript(script.toString()); + } + } + + @Override + public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java index c5d1409..57de087 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/StyleHandler.java @@ -1,184 +1,200 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.UnsupportedAttributeException; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.css.parser.CSSParser; -import jaxx.compiler.css.parser.CSSParserConstants; -import jaxx.compiler.css.parser.CSSParserTreeConstants; -import jaxx.compiler.css.parser.SimpleNode; -import jaxx.runtime.css.Rule; -import jaxx.runtime.css.Selector; -import jaxx.runtime.css.Stylesheet; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.Text; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.io.StringReader; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Handles the <code><style></code> tag. - * - * @author Ethan Nicholas - */ -public class StyleHandler implements TagHandler { - public static final String SOURCE_ATTRIBUTE = "source"; - - @Override - public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - boolean source = false; - NamedNodeMap attributes = tag.getAttributes(); - for (int i = 0; i < attributes.getLength(); i++) { - Attr attribute = (Attr) attributes.item(i); - String name = attribute.getName(); - String attrValue = attribute.getValue(); - if (name.equals(SOURCE_ATTRIBUTE)) { - source = true; - File styleFile = new File(compiler.getBaseDir(), attrValue.replace('/', File.separatorChar)); - StringWriter styleBuffer = new StringWriter(); - try { - FileReader in = new FileReader(styleFile); - char[] readBuffer = new char[2048]; - int c; - while ((c = in.read(readBuffer)) > 0) { - styleBuffer.write(readBuffer, 0, c); - } - } catch (FileNotFoundException e) { - compiler.reportError("stylesheet file not found: " + styleFile); - } - compiler.getSourceFiles().push(styleFile); - compiler.registerStylesheet(processStylesheet(styleBuffer.toString())); - compiler.getSourceFiles().pop(); - } else if (!name.startsWith(XMLNS_ATTRIBUTE) && - !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { - throw new UnsupportedAttributeException(name); - } - } - - StringBuffer style = new StringBuffer(); - NodeList children = tag.getChildNodes(); - for (int i = 0; i < children.getLength(); i++) { - Node child = children.item(i); - switch (child.getNodeType()) { - case Node.ELEMENT_NODE: - compiler.reportError("<style> tag may not contain child elements: " + tag); - case Node.TEXT_NODE: // fall through - case Node.CDATA_SECTION_NODE: - style.append(((Text) child).getData()); - } - } - - String styleString = style.toString().trim(); - if (styleString.length() > 0) { - if (source) { - compiler.reportError("<style> tag has both a source attribute and an inline stylesheet"); - } - compiler.registerStylesheet(processStylesheet(style.toString())); - } - } - - @Override - public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - } - - protected Selector processSelector(SimpleNode selector) { - if (selector.getId() != CSSParserTreeConstants.JJTSELECTOR) { - throw new IllegalArgumentException("argument node is not a Selector"); - } - String javaClassName = null; - String styleClass = null; - String pseudoClass = null; - String id = null; - - for (int i = 0; i < selector.jjtGetNumChildren(); i++) { - SimpleNode child = selector.getChild(i); - switch (child.getId()) { - case CSSParserTreeConstants.JJTJAVACLASS: - if (!child.getText().trim().equals("*")) { - javaClassName = child.getText(); - } - break; - case CSSParserTreeConstants.JJTCLASS: - styleClass = child.getText().substring(1); - break; - case CSSParserTreeConstants.JJTPSEUDOCLASS: - pseudoClass = child.getText().substring(1); - break; - case CSSParserTreeConstants.JJTID: - id = child.getText().substring(1); - break; - - default: - throw new IllegalStateException("unexpected child of Selector node, type=" + child.getId()); - } - } - - return new Selector(javaClassName, styleClass, pseudoClass, id); - } - - protected Rule processRule(SimpleNode ruleNode) { - if (ruleNode.getId() != CSSParserTreeConstants.JJTRULE) { - throw new IllegalArgumentException("argument node is not a Rule"); - } - SimpleNode selectorsNode = ruleNode.getChild(0); - assert selectorsNode.getId() == CSSParserTreeConstants.JJTSELECTORS : "expected node to be of type Selectors"; - - List<Selector> selectors = new ArrayList<Selector>(); - for (int i = 0; i < selectorsNode.jjtGetNumChildren(); i++) { - SimpleNode selectorNode = selectorsNode.getChild(i); - selectors.add(processSelector(selectorNode)); - } - - Map<String, String> properties = new HashMap<String, String>(); - for (int i = 1; i < ruleNode.jjtGetNumChildren(); i++) { - SimpleNode declarationNode = ruleNode.getChild(i); - if (declarationNode.getId() == CSSParserTreeConstants.JJTDECLARATION) { - String key = declarationNode.getChild(0).getText(); - SimpleNode valueNode = declarationNode.getChild(1); - String value = valueNode.getText(); - if (valueNode.firstToken.kind == CSSParserConstants.STRING) { - value = value.substring(1, value.length() - 1); - } - properties.put(key, value); - } - } - Rule rule; - rule = new Rule(selectors.toArray(new Selector[selectors.size()]), properties); - return rule; - } - - protected Stylesheet processStylesheet(String stylesheetText) throws CompilerException { - CSSParser p = new CSSParser(new StringReader(stylesheetText)); - SimpleNode node; - try { - node = p.Stylesheet(); - } catch (Error e) { - throw new CompilerException(e); - } - List<Rule> rules = new ArrayList<Rule>(); - for (int i = 0; i < node.jjtGetNumChildren(); i++) { - SimpleNode ruleNode = node.getChild(i); - Rule rule = processRule(ruleNode); - rules.add(rule); - } - Stylesheet stylesheet; - stylesheet = new Stylesheet(rules.toArray(new Rule[rules.size()])); - return stylesheet; - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.UnsupportedAttributeException; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.css.parser.CSSParser; +import jaxx.compiler.css.parser.CSSParserConstants; +import jaxx.compiler.css.parser.CSSParserTreeConstants; +import jaxx.compiler.css.parser.SimpleNode; +import jaxx.runtime.css.Rule; +import jaxx.runtime.css.Selector; +import jaxx.runtime.css.Stylesheet; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.Text; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.io.StringReader; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Handles the <code><style></code> tag. + * + * @author Ethan Nicholas + */ +public class StyleHandler implements TagHandler { + public static final String SOURCE_ATTRIBUTE = "source"; + + @Override + public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + boolean source = false; + NamedNodeMap attributes = tag.getAttributes(); + for (int i = 0; i < attributes.getLength(); i++) { + Attr attribute = (Attr) attributes.item(i); + String name = attribute.getName(); + String attrValue = attribute.getValue(); + if (name.equals(SOURCE_ATTRIBUTE)) { + source = true; + File styleFile = new File(compiler.getBaseDir(), attrValue.replace('/', File.separatorChar)); + StringWriter styleBuffer = new StringWriter(); + try { + FileReader in = new FileReader(styleFile); + char[] readBuffer = new char[2048]; + int c; + while ((c = in.read(readBuffer)) > 0) { + styleBuffer.write(readBuffer, 0, c); + } + } catch (FileNotFoundException e) { + compiler.reportError("stylesheet file not found: " + styleFile); + } + compiler.getSourceFiles().push(styleFile); + compiler.registerStylesheet(processStylesheet(styleBuffer.toString())); + compiler.getSourceFiles().pop(); + } else if (!name.startsWith(XMLNS_ATTRIBUTE) && + !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { + throw new UnsupportedAttributeException(name); + } + } + + StringBuffer style = new StringBuffer(); + NodeList children = tag.getChildNodes(); + for (int i = 0; i < children.getLength(); i++) { + Node child = children.item(i); + switch (child.getNodeType()) { + case Node.ELEMENT_NODE: + compiler.reportError("<style> tag may not contain child elements: " + tag); + case Node.TEXT_NODE: // fall through + case Node.CDATA_SECTION_NODE: + style.append(((Text) child).getData()); + } + } + + String styleString = style.toString().trim(); + if (styleString.length() > 0) { + if (source) { + compiler.reportError("<style> tag has both a source attribute and an inline stylesheet"); + } + compiler.registerStylesheet(processStylesheet(style.toString())); + } + } + + @Override + public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + } + + protected Selector processSelector(SimpleNode selector) { + if (selector.getId() != CSSParserTreeConstants.JJTSELECTOR) { + throw new IllegalArgumentException("argument node is not a Selector"); + } + String javaClassName = null; + String styleClass = null; + String pseudoClass = null; + String id = null; + + for (int i = 0; i < selector.jjtGetNumChildren(); i++) { + SimpleNode child = selector.getChild(i); + switch (child.getId()) { + case CSSParserTreeConstants.JJTJAVACLASS: + if (!child.getText().trim().equals("*")) { + javaClassName = child.getText(); + } + break; + case CSSParserTreeConstants.JJTCLASS: + styleClass = child.getText().substring(1); + break; + case CSSParserTreeConstants.JJTPSEUDOCLASS: + pseudoClass = child.getText().substring(1); + break; + case CSSParserTreeConstants.JJTID: + id = child.getText().substring(1); + break; + + default: + throw new IllegalStateException("unexpected child of Selector node, type=" + child.getId()); + } + } + + return new Selector(javaClassName, styleClass, pseudoClass, id); + } + + protected Rule processRule(SimpleNode ruleNode) { + if (ruleNode.getId() != CSSParserTreeConstants.JJTRULE) { + throw new IllegalArgumentException("argument node is not a Rule"); + } + SimpleNode selectorsNode = ruleNode.getChild(0); + assert selectorsNode.getId() == CSSParserTreeConstants.JJTSELECTORS : "expected node to be of type Selectors"; + + List<Selector> selectors = new ArrayList<Selector>(); + for (int i = 0; i < selectorsNode.jjtGetNumChildren(); i++) { + SimpleNode selectorNode = selectorsNode.getChild(i); + selectors.add(processSelector(selectorNode)); + } + + Map<String, String> properties = new HashMap<String, String>(); + for (int i = 1; i < ruleNode.jjtGetNumChildren(); i++) { + SimpleNode declarationNode = ruleNode.getChild(i); + if (declarationNode.getId() == CSSParserTreeConstants.JJTDECLARATION) { + String key = declarationNode.getChild(0).getText(); + SimpleNode valueNode = declarationNode.getChild(1); + String value = valueNode.getText(); + if (valueNode.firstToken.kind == CSSParserConstants.STRING) { + value = value.substring(1, value.length() - 1); + } + properties.put(key, value); + } + } + Rule rule; + rule = new Rule(selectors.toArray(new Selector[selectors.size()]), properties); + return rule; + } + + protected Stylesheet processStylesheet(String stylesheetText) throws CompilerException { + CSSParser p = new CSSParser(new StringReader(stylesheetText)); + SimpleNode node; + try { + node = p.Stylesheet(); + } catch (Error e) { + throw new CompilerException(e); + } + List<Rule> rules = new ArrayList<Rule>(); + for (int i = 0; i < node.jjtGetNumChildren(); i++) { + SimpleNode ruleNode = node.getChild(i); + Rule rule = processRule(ruleNode); + rules.add(rule); + } + Stylesheet stylesheet; + stylesheet = new Stylesheet(rules.toArray(new Rule[rules.size()])); + return stylesheet; + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagHandler.java index f18c8d2..d59d1f4 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagHandler.java @@ -1,48 +1,64 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.JAXXCompiler; -import org.w3c.dom.Element; - -import java.io.IOException; - -/** - * Implementations of <code>TagHandler</code> produce Java source code from XML tags. - * <code>TagHandlers</code> are mapped to particular XML tags (such as <JFrame>) in {@link JAXXCompiler}. - * There is only one <code>TagHandler</code> for any given XML tag, and therefore implementations must be - * stateless. - * - * @author Ethan Nicholas - */ -public interface TagHandler { - - String XMLNS_ATTRIBUTE = "xmlns"; - - /** - * Performs the first pass of compilation on an XML tag from a JAXX source file. - * <code>TagHandler</code> implementations affect the generated <code>.java</code> - * file by calling methods in the <code>JAXXCompiler</code>. - * - * @param tag the XML tag to compile - * @param compiler the active JAXXCompiler - * @throws CompilerException if a compilation error occurs - * @throws IOException if an I/O error occurs - */ - void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException; - - /** - * Performs the second pass of compilation on an XML tag from a JAXX source file. - * <code>TagHandler</code> implementations affect the generated <code>.java</code> - * file by calling methods in the <code>JAXXCompiler</code>. - * - * @param tag the XML tag to compile - * @param compiler the active JAXXCompiler - * @throws CompilerException if a compilation error occurs - * @throws IOException if an I/O error occurs - */ - void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException; -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.JAXXCompiler; +import org.w3c.dom.Element; + +import java.io.IOException; + +/** + * Implementations of <code>TagHandler</code> produce Java source code from XML tags. + * <code>TagHandlers</code> are mapped to particular XML tags (such as <JFrame>) in {@link JAXXCompiler}. + * There is only one <code>TagHandler</code> for any given XML tag, and therefore implementations must be + * stateless. + * + * @author Ethan Nicholas + */ +public interface TagHandler { + + String XMLNS_ATTRIBUTE = "xmlns"; + + /** + * Performs the first pass of compilation on an XML tag from a JAXX source file. + * <code>TagHandler</code> implementations affect the generated <code>.java</code> + * file by calling methods in the <code>JAXXCompiler</code>. + * + * @param tag the XML tag to compile + * @param compiler the active JAXXCompiler + * @throws CompilerException if a compilation error occurs + * @throws IOException if an I/O error occurs + */ + void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException; + + /** + * Performs the second pass of compilation on an XML tag from a JAXX source file. + * <code>TagHandler</code> implementations affect the generated <code>.java</code> + * file by calling methods in the <code>JAXXCompiler</code>. + * + * @param tag the XML tag to compile + * @param compiler the active JAXXCompiler + * @throws CompilerException if a compilation error occurs + * @throws IOException if an I/O error occurs + */ + void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException; +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java index c92bf6a..8452d35 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java @@ -1,6 +1,22 @@ /* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.compiler.tags; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ApplicationHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ApplicationHandler.java index c95ea13..a3f7a95 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ApplicationHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ApplicationHandler.java @@ -1,39 +1,55 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.runtime.swing.Application; -import jaxx.compiler.types.TypeManager; -import org.w3c.dom.Element; - -import javax.swing.WindowConstants; - -public class ApplicationHandler extends JWindowHandler { - - public ApplicationHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, Application.class); - } - - @Override - public void setAttribute(CompiledObject object, String propertyName, String stringValue, boolean inline, JAXXCompiler compiler) throws CompilerException { - if (propertyName.equals("lookAndFeel") && stringValue != null && !stringValue.trim().startsWith("{")) { - compiler.appendBodyCode("{ " + object.getJavaCode() + ".setLookAndFeel(" + compiler.getJavaCode(stringValue) + "); }" + JAXXCompiler.getLineSeparator()); - } else { - super.setAttribute(object, propertyName, stringValue, inline, compiler); - } - } - - @Override - protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { - super.setDefaults(object, tag, compiler); - setAttribute(object, "defaultCloseOperation", String.valueOf(WindowConstants.EXIT_ON_CLOSE), false, compiler); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.CompiledObject; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.runtime.swing.Application; +import jaxx.compiler.types.TypeManager; +import org.w3c.dom.Element; + +import javax.swing.WindowConstants; + +public class ApplicationHandler extends JWindowHandler { + + public ApplicationHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, Application.class); + } + + @Override + public void setAttribute(CompiledObject object, String propertyName, String stringValue, boolean inline, JAXXCompiler compiler) throws CompilerException { + if (propertyName.equals("lookAndFeel") && stringValue != null && !stringValue.trim().startsWith("{")) { + compiler.appendBodyCode("{ " + object.getJavaCode() + ".setLookAndFeel(" + compiler.getJavaCode(stringValue) + "); }" + JAXXCompiler.getLineSeparator()); + } else { + super.setAttribute(object, propertyName, stringValue, inline, compiler); + } + } + + @Override + protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { + super.setDefaults(object, tag, compiler); + setAttribute(object, "defaultCloseOperation", String.valueOf(WindowConstants.EXIT_ON_CLOSE), false, compiler); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CellHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CellHandler.java index ef1c5b4..7421d83 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CellHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CellHandler.java @@ -1,150 +1,166 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.UnsupportedAttributeException; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.tags.TagHandler; -import jaxx.compiler.types.TypeManager; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.Text; - -import java.awt.GridBagConstraints; -import java.awt.Insets; -import java.io.IOException; - -public class CellHandler implements TagHandler { - - @Override - public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - compileChildrenFirstPass(tag, compiler); - } - - @Override - public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - Node parent = tag.getParentNode(); - if (parent.getNodeType() != Node.ELEMENT_NODE || !parent.getLocalName().equals("row")) { - compiler.reportError("cell tag may only appear within row tag"); - return; - } - - TableHandler.CompiledTable table = (TableHandler.CompiledTable) compiler.getOpenComponent(); - table.newCell(); - GridBagConstraints c = table.getCellConstraints(); - setAttributes(c, tag); - compileChildrenSecondPass(tag, compiler); - } - - public static void setAttribute(GridBagConstraints c, String name, String value) throws CompilerException { - value = value.trim(); - if (name.equals("insets")) { - c.insets = (Insets) TypeManager.convertFromString(value, Insets.class); - } else if (name.equals("weightx")) { - c.weightx = Double.parseDouble(value); - } else if (name.equals("weighty")) { - c.weighty = Double.parseDouble(value); - } else if (name.equals("columns")) { - c.gridwidth = Integer.parseInt(value); - } else if (name.equals("rows")) { - c.gridheight = Integer.parseInt(value); - } else if (name.equals("fill")) { - if (value.equals("none")) { - c.fill = GridBagConstraints.NONE; - } else if (value.equals("horizontal")) { - c.fill = GridBagConstraints.HORIZONTAL; - } else if (value.equals("vertical")) { - c.fill = GridBagConstraints.VERTICAL; - } else if (value.equals("both")) { - c.fill = GridBagConstraints.BOTH; - } else { - throw new IllegalArgumentException("invalid value for fill attribute: '" + value + "'"); - } - } else if (name.equals("anchor")) { - //todo use a converter - if (value.equals("north")) { - c.anchor = GridBagConstraints.NORTH; - } else if (value.equals("northeast")) { - c.anchor = GridBagConstraints.NORTHEAST; - } else if (value.equals("east")) { - c.anchor = GridBagConstraints.EAST; - } else if (value.equals("southeast")) { - c.anchor = GridBagConstraints.SOUTHEAST; - } else if (value.equals("south")) { - c.anchor = GridBagConstraints.SOUTH; - } else if (value.equals("southwest")) { - c.anchor = GridBagConstraints.SOUTHWEST; - } else if (value.equals("west")) { - c.anchor = GridBagConstraints.WEST; - } else if (value.equals("northwest")) { - c.anchor = GridBagConstraints.NORTHWEST; - } else if (value.equals("center")) { - c.anchor = GridBagConstraints.CENTER; - } else { - throw new IllegalArgumentException("invalid value for anchor attribute: '" + value + "'"); - } - } else { - throw new UnsupportedAttributeException(name); - } - } - - public static void setAttributes(GridBagConstraints c, Element tag) throws CompilerException { - NamedNodeMap children = tag.getAttributes(); - for (int i = 0; i < children.getLength(); i++) { - Attr attribute = (Attr) children.item(i); - String name = attribute.getName(); - String value = attribute.getValue(); - if (!name.startsWith("xmlns") && !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { - setAttribute(c, name, value); - } - } - } - - protected void compileChildrenFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - NodeList children = tag.getChildNodes(); - for (int i = 0; i < children.getLength(); i++) { - Node node = children.item(i); - int nodeType = node.getNodeType(); - if (nodeType == Node.ELEMENT_NODE) { - Element child = (Element) node; - compileChildTagFirstPass(child, compiler); - } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { - String text = ((Text) node).getData().trim(); - if (text.length() > 0) { - compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); - } - } - } - } - - protected void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - NodeList children = tag.getChildNodes(); - for (int i = 0; i < children.getLength(); i++) { - Node node = children.item(i); - int nodeType = node.getNodeType(); - if (nodeType == Node.ELEMENT_NODE) { - Element child = (Element) node; - compileChildTagSecondPass(child, compiler); - } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { - String text = ((Text) node).getData().trim(); - if (text.length() > 0) { - compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); - } - } - } - } - - protected void compileChildTagFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - compiler.compileFirstPass(tag); - } - - protected void compileChildTagSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - compiler.compileSecondPass(tag); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.UnsupportedAttributeException; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.tags.TagHandler; +import jaxx.compiler.types.TypeManager; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.Text; + +import java.awt.GridBagConstraints; +import java.awt.Insets; +import java.io.IOException; + +public class CellHandler implements TagHandler { + + @Override + public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + compileChildrenFirstPass(tag, compiler); + } + + @Override + public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + Node parent = tag.getParentNode(); + if (parent.getNodeType() != Node.ELEMENT_NODE || !parent.getLocalName().equals("row")) { + compiler.reportError("cell tag may only appear within row tag"); + return; + } + + TableHandler.CompiledTable table = (TableHandler.CompiledTable) compiler.getOpenComponent(); + table.newCell(); + GridBagConstraints c = table.getCellConstraints(); + setAttributes(c, tag); + compileChildrenSecondPass(tag, compiler); + } + + public static void setAttribute(GridBagConstraints c, String name, String value) throws CompilerException { + value = value.trim(); + if (name.equals("insets")) { + c.insets = (Insets) TypeManager.convertFromString(value, Insets.class); + } else if (name.equals("weightx")) { + c.weightx = Double.parseDouble(value); + } else if (name.equals("weighty")) { + c.weighty = Double.parseDouble(value); + } else if (name.equals("columns")) { + c.gridwidth = Integer.parseInt(value); + } else if (name.equals("rows")) { + c.gridheight = Integer.parseInt(value); + } else if (name.equals("fill")) { + if (value.equals("none")) { + c.fill = GridBagConstraints.NONE; + } else if (value.equals("horizontal")) { + c.fill = GridBagConstraints.HORIZONTAL; + } else if (value.equals("vertical")) { + c.fill = GridBagConstraints.VERTICAL; + } else if (value.equals("both")) { + c.fill = GridBagConstraints.BOTH; + } else { + throw new IllegalArgumentException("invalid value for fill attribute: '" + value + "'"); + } + } else if (name.equals("anchor")) { + //todo use a converter + if (value.equals("north")) { + c.anchor = GridBagConstraints.NORTH; + } else if (value.equals("northeast")) { + c.anchor = GridBagConstraints.NORTHEAST; + } else if (value.equals("east")) { + c.anchor = GridBagConstraints.EAST; + } else if (value.equals("southeast")) { + c.anchor = GridBagConstraints.SOUTHEAST; + } else if (value.equals("south")) { + c.anchor = GridBagConstraints.SOUTH; + } else if (value.equals("southwest")) { + c.anchor = GridBagConstraints.SOUTHWEST; + } else if (value.equals("west")) { + c.anchor = GridBagConstraints.WEST; + } else if (value.equals("northwest")) { + c.anchor = GridBagConstraints.NORTHWEST; + } else if (value.equals("center")) { + c.anchor = GridBagConstraints.CENTER; + } else { + throw new IllegalArgumentException("invalid value for anchor attribute: '" + value + "'"); + } + } else { + throw new UnsupportedAttributeException(name); + } + } + + public static void setAttributes(GridBagConstraints c, Element tag) throws CompilerException { + NamedNodeMap children = tag.getAttributes(); + for (int i = 0; i < children.getLength(); i++) { + Attr attribute = (Attr) children.item(i); + String name = attribute.getName(); + String value = attribute.getValue(); + if (!name.startsWith("xmlns") && !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { + setAttribute(c, name, value); + } + } + } + + protected void compileChildrenFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + NodeList children = tag.getChildNodes(); + for (int i = 0; i < children.getLength(); i++) { + Node node = children.item(i); + int nodeType = node.getNodeType(); + if (nodeType == Node.ELEMENT_NODE) { + Element child = (Element) node; + compileChildTagFirstPass(child, compiler); + } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { + String text = ((Text) node).getData().trim(); + if (text.length() > 0) { + compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); + } + } + } + } + + protected void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + NodeList children = tag.getChildNodes(); + for (int i = 0; i < children.getLength(); i++) { + Node node = children.item(i); + int nodeType = node.getNodeType(); + if (nodeType == Node.ELEMENT_NODE) { + Element child = (Element) node; + compileChildTagSecondPass(child, compiler); + } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { + String text = ((Text) node).getData().trim(); + if (text.length() > 0) { + compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); + } + } + } + } + + protected void compileChildTagFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + compiler.compileFirstPass(tag); + } + + protected void compileChildTagSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + compiler.compileSecondPass(tag); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CompiledItemContainer.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CompiledItemContainer.java index ea3ee60c..d02ae87 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CompiledItemContainer.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/CompiledItemContainer.java @@ -1,50 +1,66 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.runtime.swing.Item; - -import java.util.ArrayList; -import java.util.List; -import java.util.Stack; - -/** Compiled representation of a class that contains Items arranged in a list or tree structure (JComboBox, JList, JTree). */ -class CompiledItemContainer extends CompiledObject { - - private List<Item> items = new ArrayList<Item>(); - private Stack<Item> openNodes = new Stack<Item>(); - - public CompiledItemContainer(String id, ClassDescriptor objectClass, JAXXCompiler compiler) throws CompilerException { - super(id, objectClass, compiler); - } - - public void openItem(Item item) { - if (openNodes.isEmpty()) { - items.add(item); - } else { - Item openNode = openNodes.peek(); - openNode.addChild(item); - } - openNodes.add(item); - } - - public void closeItem(Item item) { - if (openNodes.pop() != item) { - throw new IllegalArgumentException(item + " was not at the top of the item stack"); - } - } - - public List<Item> getItems() { - return items; - } - - public void setItems(List<Item> items) { - this.items = items; - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.CompiledObject; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.runtime.swing.Item; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + +/** Compiled representation of a class that contains Items arranged in a list or tree structure (JComboBox, JList, JTree). */ +class CompiledItemContainer extends CompiledObject { + + private List<Item> items = new ArrayList<Item>(); + private Stack<Item> openNodes = new Stack<Item>(); + + public CompiledItemContainer(String id, ClassDescriptor objectClass, JAXXCompiler compiler) throws CompilerException { + super(id, objectClass, compiler); + } + + public void openItem(Item item) { + if (openNodes.isEmpty()) { + items.add(item); + } else { + Item openNode = openNodes.peek(); + openNode.addChild(item); + } + openNodes.add(item); + } + + public void closeItem(Item item) { + if (openNodes.pop() != item) { + throw new IllegalArgumentException(item + " was not at the top of the item stack"); + } + } + + public List<Item> getItems() { + return items; + } + + public void setItems(List<Item> items) { + this.items = items; + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ItemHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ItemHandler.java index f31d808..f343046 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ItemHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ItemHandler.java @@ -1,147 +1,163 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.UnsupportedAttributeException; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.TagHandler; -import jaxx.compiler.types.TypeManager; -import jaxx.runtime.swing.Item; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.Text; - -import java.io.IOException; -import java.util.List; - -public class ItemHandler implements TagHandler { - - private String DATA_BINDING = "<data binding has not been processed yet>"; - - @Override - public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - compileChildrenFirstPass(tag, compiler); - } - - @Override - public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - String id = tag.getAttribute("id"); - if (id == null || id.length() == 0) { - id = compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(Item.class)); - } - String label = null; - String value = null; - boolean selected = false; - NamedNodeMap children = tag.getAttributes(); - - for (int i = 0; i < children.getLength(); i++) { - Attr attribute = (Attr) children.item(i); - String name = attribute.getName(); - String attrValue = attribute.getValue(); - if (name.equals("id")) { - // already handled - continue; - } - if (name.equals(Item.LABEL_PROPERTY)) { - String labelBinding = compiler.processDataBindings(attrValue, ClassDescriptorLoader.getClassDescriptor(String.class)); - if (labelBinding != null) { - compiler.registerDataBinding(labelBinding, id + ".label", id + ".setLabel(" + labelBinding + ");"); - } else { - label = attrValue; - } - continue; - } - if (name.equals(Item.VALUE_PROPERTY)) { - String valueBinding = compiler.processDataBindings(attrValue, ClassDescriptorLoader.getClassDescriptor(Object.class)); - if (valueBinding != null) { - value = DATA_BINDING; - compiler.registerDataBinding(valueBinding, id + ".value", id + ".setValue(" + valueBinding + ");"); - } else { - value = attrValue; - } - continue; - } - if (name.equals(Item.SELECTED_PROPERTY)) { - String selectedBinding = compiler.processDataBindings(attrValue, ClassDescriptorLoader.getClassDescriptor(Boolean.class)); - if (selectedBinding != null) { - compiler.registerDataBinding(selectedBinding, id + ".selected", id + ".setSelected(" + selectedBinding + ");"); - } else { - selected = (Boolean) TypeManager.convertFromString(attrValue, Boolean.class); - } - continue; - } - - if (!name.startsWith("xmlns") && !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { - throw new UnsupportedAttributeException(name); - } - } - - Item item = new Item(id, label, value, selected); - CompiledItemContainer list = (CompiledItemContainer) compiler.getOpenComponent(); - if (value == null) { - compiler.reportError("<item> tag is missing required 'value' attribute"); - } else { - if (!value.equals(DATA_BINDING)) { - List<Item> items = list.getItems(); - for (Item item1 : items) { - if (item1.getValue().equals(value)) { - compiler.reportError("This container already has an <item> tag with the value '" + value + "'"); - break; - } - } - } - list.openItem(item); - compileChildrenSecondPass(tag, compiler); - list.closeItem(item); - } - } - - protected void compileChildrenFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - NodeList children = tag.getChildNodes(); - for (int i = 0; i < children.getLength(); i++) { - Node node = children.item(i); - int nodeType = node.getNodeType(); - if (nodeType == Node.ELEMENT_NODE) { - Element child = (Element) node; - compileChildTagFirstPass(child, compiler); - } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { - String text = ((Text) node).getData().trim(); - if (text.length() > 0) { - compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); - } - } - } - } - - protected void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - NodeList children = tag.getChildNodes(); - for (int i = 0; i < children.getLength(); i++) { - Node node = children.item(i); - int nodeType = node.getNodeType(); - if (nodeType == Node.ELEMENT_NODE) { - Element child = (Element) node; - compileChildTagSecondPass(child, compiler); - } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { - String text = ((Text) node).getData().trim(); - if (text.length() > 0) { - compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); - } - } - } - } - - protected void compileChildTagFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - compiler.compileFirstPass(tag); - } - - protected void compileChildTagSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - compiler.compileSecondPass(tag); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.UnsupportedAttributeException; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.TagHandler; +import jaxx.compiler.types.TypeManager; +import jaxx.runtime.swing.Item; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.Text; + +import java.io.IOException; +import java.util.List; + +public class ItemHandler implements TagHandler { + + private String DATA_BINDING = "<data binding has not been processed yet>"; + + @Override + public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + compileChildrenFirstPass(tag, compiler); + } + + @Override + public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + String id = tag.getAttribute("id"); + if (id == null || id.length() == 0) { + id = compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(Item.class)); + } + String label = null; + String value = null; + boolean selected = false; + NamedNodeMap children = tag.getAttributes(); + + for (int i = 0; i < children.getLength(); i++) { + Attr attribute = (Attr) children.item(i); + String name = attribute.getName(); + String attrValue = attribute.getValue(); + if (name.equals("id")) { + // already handled + continue; + } + if (name.equals(Item.LABEL_PROPERTY)) { + String labelBinding = compiler.processDataBindings(attrValue, ClassDescriptorLoader.getClassDescriptor(String.class)); + if (labelBinding != null) { + compiler.registerDataBinding(labelBinding, id + ".label", id + ".setLabel(" + labelBinding + ");"); + } else { + label = attrValue; + } + continue; + } + if (name.equals(Item.VALUE_PROPERTY)) { + String valueBinding = compiler.processDataBindings(attrValue, ClassDescriptorLoader.getClassDescriptor(Object.class)); + if (valueBinding != null) { + value = DATA_BINDING; + compiler.registerDataBinding(valueBinding, id + ".value", id + ".setValue(" + valueBinding + ");"); + } else { + value = attrValue; + } + continue; + } + if (name.equals(Item.SELECTED_PROPERTY)) { + String selectedBinding = compiler.processDataBindings(attrValue, ClassDescriptorLoader.getClassDescriptor(Boolean.class)); + if (selectedBinding != null) { + compiler.registerDataBinding(selectedBinding, id + ".selected", id + ".setSelected(" + selectedBinding + ");"); + } else { + selected = (Boolean) TypeManager.convertFromString(attrValue, Boolean.class); + } + continue; + } + + if (!name.startsWith("xmlns") && !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { + throw new UnsupportedAttributeException(name); + } + } + + Item item = new Item(id, label, value, selected); + CompiledItemContainer list = (CompiledItemContainer) compiler.getOpenComponent(); + if (value == null) { + compiler.reportError("<item> tag is missing required 'value' attribute"); + } else { + if (!value.equals(DATA_BINDING)) { + List<Item> items = list.getItems(); + for (Item item1 : items) { + if (item1.getValue().equals(value)) { + compiler.reportError("This container already has an <item> tag with the value '" + value + "'"); + break; + } + } + } + list.openItem(item); + compileChildrenSecondPass(tag, compiler); + list.closeItem(item); + } + } + + protected void compileChildrenFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + NodeList children = tag.getChildNodes(); + for (int i = 0; i < children.getLength(); i++) { + Node node = children.item(i); + int nodeType = node.getNodeType(); + if (nodeType == Node.ELEMENT_NODE) { + Element child = (Element) node; + compileChildTagFirstPass(child, compiler); + } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { + String text = ((Text) node).getData().trim(); + if (text.length() > 0) { + compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); + } + } + } + } + + protected void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + NodeList children = tag.getChildNodes(); + for (int i = 0; i < children.getLength(); i++) { + Node node = children.item(i); + int nodeType = node.getNodeType(); + if (nodeType == Node.ELEMENT_NODE) { + Element child = (Element) node; + compileChildTagSecondPass(child, compiler); + } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { + String text = ((Text) node).getData().trim(); + if (text.length() > 0) { + compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); + } + } + } + } + + protected void compileChildTagFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + compiler.compileFirstPass(tag); + } + + protected void compileChildTagSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + compiler.compileSecondPass(tag); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXComboBoxHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXComboBoxHandler.java index 30e26ed..0824766 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXComboBoxHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXComboBoxHandler.java @@ -1,6 +1,22 @@ /* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.compiler.tags.swing; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXListHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXListHandler.java index 2bc7559..f8d4417 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXListHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXListHandler.java @@ -1,6 +1,22 @@ /* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.compiler.tags.swing; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTabHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTabHandler.java index e3de954..f311b46 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTabHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTabHandler.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.tags.swing; import jaxx.compiler.reflect.ClassDescriptor; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTreeHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTreeHandler.java index d1366e3..cade15b 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTreeHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JAXXTreeHandler.java @@ -1,6 +1,22 @@ /* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.compiler.tags.swing; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JCheckBoxHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JCheckBoxHandler.java index aafc0f3..12ac98f 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JCheckBoxHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JCheckBoxHandler.java @@ -1,26 +1,42 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.DefaultComponentHandler; - -import javax.swing.AbstractButton; -import javax.swing.event.ChangeListener; - -public class JCheckBoxHandler extends DefaultComponentHandler { - - public JCheckBoxHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, AbstractButton.class); - } - - @Override - protected void configureProxyEventInfo() { - super.configureProxyEventInfo(); - addProxyEventInfo("isSelected", ChangeListener.class, "model"); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; + +import javax.swing.AbstractButton; +import javax.swing.event.ChangeListener; + +public class JCheckBoxHandler extends DefaultComponentHandler { + + public JCheckBoxHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, AbstractButton.class); + } + + @Override + protected void configureProxyEventInfo() { + super.configureProxyEventInfo(); + addProxyEventInfo("isSelected", ChangeListener.class, "model"); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JComboBoxHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JComboBoxHandler.java index 7ffb583..699f273 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JComboBoxHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JComboBoxHandler.java @@ -1,44 +1,60 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.DefaultComponentHandler; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; - -import java.io.IOException; -import java.awt.event.ItemListener; -import javax.swing.JComboBox; - -public class JComboBoxHandler extends DefaultComponentHandler { - - public JComboBoxHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JComboBox.class); - } - - @Override - protected void configureProxyEventInfo() { - super.configureProxyEventInfo(); - addProxyEventInfo("getSelectedIndex", ItemListener.class); - addProxyEventInfo("getSelectedItem", ItemListener.class); - } - - @Override - public void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - NodeList children = tag.getChildNodes(); - if (children.getLength() > 0) { - compiler.reportError("JComboBox does not accept childs"); - throw new CompilerException("JComboBox does not accept childs"); - } - } -} - - - +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +import java.io.IOException; +import java.awt.event.ItemListener; +import javax.swing.JComboBox; + +public class JComboBoxHandler extends DefaultComponentHandler { + + public JComboBoxHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JComboBox.class); + } + + @Override + protected void configureProxyEventInfo() { + super.configureProxyEventInfo(); + addProxyEventInfo("getSelectedIndex", ItemListener.class); + addProxyEventInfo("getSelectedItem", ItemListener.class); + } + + @Override + public void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + NodeList children = tag.getChildNodes(); + if (children.getLength() > 0) { + compiler.reportError("JComboBox does not accept childs"); + throw new CompilerException("JComboBox does not accept childs"); + } + } +} + + + diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JInternalFrameHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JInternalFrameHandler.java index 1111fea..e5b8606 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JInternalFrameHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JInternalFrameHandler.java @@ -1,54 +1,70 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.DefaultComponentHandler; -import org.w3c.dom.Element; - -import javax.swing.JInternalFrame; -import javax.swing.JMenuBar; -import javax.swing.WindowConstants; - -public class JInternalFrameHandler extends DefaultComponentHandler { - - public JInternalFrameHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JInternalFrame.class); - } - - @Override - public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { - return new CompiledObject(id, getBeanClass(), compiler) { - - @Override - public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException { - if (ClassDescriptorLoader.getClassDescriptor(JMenuBar.class).isAssignableFrom(child.getObjectClass())) { - appendAdditionCode(getId() + ".setJMenuBar(" + child.getId() + ");"); - } else { - super.addChild(child, constraints, compiler); - } - } - }; - } - - @Override - protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { - super.setDefaults(object, tag, compiler); - setAttribute(object, "visible", "true", false, compiler); - setAttribute(object, "closable", "true", false, compiler); - setAttribute(object, "defaultCloseOperation", String.valueOf(WindowConstants.DISPOSE_ON_CLOSE), false, compiler); - } - - @Override - public void setAttributes(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { - super.setAttributes(object, tag, compiler); - compiler.appendInitializerCode(object.getId() + ".pack();\n"); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.CompiledObject; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; +import org.w3c.dom.Element; + +import javax.swing.JInternalFrame; +import javax.swing.JMenuBar; +import javax.swing.WindowConstants; + +public class JInternalFrameHandler extends DefaultComponentHandler { + + public JInternalFrameHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JInternalFrame.class); + } + + @Override + public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { + return new CompiledObject(id, getBeanClass(), compiler) { + + @Override + public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException { + if (ClassDescriptorLoader.getClassDescriptor(JMenuBar.class).isAssignableFrom(child.getObjectClass())) { + appendAdditionCode(getId() + ".setJMenuBar(" + child.getId() + ");"); + } else { + super.addChild(child, constraints, compiler); + } + } + }; + } + + @Override + protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { + super.setDefaults(object, tag, compiler); + setAttribute(object, "visible", "true", false, compiler); + setAttribute(object, "closable", "true", false, compiler); + setAttribute(object, "defaultCloseOperation", String.valueOf(WindowConstants.DISPOSE_ON_CLOSE), false, compiler); + } + + @Override + public void setAttributes(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { + super.setAttributes(object, tag, compiler); + compiler.appendInitializerCode(object.getId() + ".pack();\n"); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JListHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JListHandler.java index 6abf30a..7d8bc64 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JListHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JListHandler.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.tags.swing; import jaxx.compiler.CompilerException; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JMenuHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JMenuHandler.java index 4e4529f..ed9766c 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JMenuHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JMenuHandler.java @@ -1,26 +1,42 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.DefaultComponentHandler; - -import javax.swing.JMenu; -import javax.swing.event.MenuListener; - -public class JMenuHandler extends DefaultComponentHandler { - - public JMenuHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JMenu.class); - } - - @Override - protected void configureProxyEventInfo() { - super.configureProxyEventInfo(); - addProxyEventInfo("isSelected", MenuListener.class); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; + +import javax.swing.JMenu; +import javax.swing.event.MenuListener; + +public class JMenuHandler extends DefaultComponentHandler { + + public JMenuHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JMenu.class); + } + + @Override + protected void configureProxyEventInfo() { + super.configureProxyEventInfo(); + addProxyEventInfo("isSelected", MenuListener.class); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPasswordFieldHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPasswordFieldHandler.java index 6fef48b..07ea928 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPasswordFieldHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPasswordFieldHandler.java @@ -1,25 +1,41 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; - -import javax.swing.JPasswordField; -import javax.swing.event.DocumentListener; - -public class JPasswordFieldHandler extends JTextComponentHandler { - - public JPasswordFieldHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JPasswordField.class); - } - - @Override - protected void configureProxyEventInfo() { - super.configureProxyEventInfo(); - addProxyEventInfo("getPassword", DocumentListener.class, "document"); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; + +import javax.swing.JPasswordField; +import javax.swing.event.DocumentListener; + +public class JPasswordFieldHandler extends JTextComponentHandler { + + public JPasswordFieldHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JPasswordField.class); + } + + @Override + protected void configureProxyEventInfo() { + super.configureProxyEventInfo(); + addProxyEventInfo("getPassword", DocumentListener.class, "document"); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPopupMenuHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPopupMenuHandler.java index 346a95a..7e3e492 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPopupMenuHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JPopupMenuHandler.java @@ -1,32 +1,48 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.DefaultComponentHandler; -import org.w3c.dom.Element; - -import javax.swing.JPopupMenu; - -public class JPopupMenuHandler extends DefaultComponentHandler { - - public JPopupMenuHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JPopupMenu.class); - } - - @Override - public boolean isContainer() { - return true; - } - - @Override - protected void openComponent(CompiledObject object, Element tag, JAXXCompiler compiler) { - compiler.openInvisibleComponent(object); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.CompiledObject; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; +import org.w3c.dom.Element; + +import javax.swing.JPopupMenu; + +public class JPopupMenuHandler extends DefaultComponentHandler { + + public JPopupMenuHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JPopupMenu.class); + } + + @Override + public boolean isContainer() { + return true; + } + + @Override + protected void openComponent(CompiledObject object, Element tag, JAXXCompiler compiler) { + compiler.openInvisibleComponent(object); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JProgressBarHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JProgressBarHandler.java index 9de5b52..0b4a97d 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JProgressBarHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JProgressBarHandler.java @@ -1,26 +1,42 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.DefaultComponentHandler; - -import javax.swing.JProgressBar; -import javax.swing.event.ChangeListener; - -public class JProgressBarHandler extends DefaultComponentHandler { - - public JProgressBarHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JProgressBar.class); - } - - @Override - protected void configureProxyEventInfo() { - super.configureProxyEventInfo(); - addProxyEventInfo("getValue", ChangeListener.class, "change"); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; + +import javax.swing.JProgressBar; +import javax.swing.event.ChangeListener; + +public class JProgressBarHandler extends DefaultComponentHandler { + + public JProgressBarHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JProgressBar.class); + } + + @Override + protected void configureProxyEventInfo() { + super.configureProxyEventInfo(); + addProxyEventInfo("getValue", ChangeListener.class, "change"); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JRadioButtonHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JRadioButtonHandler.java index 04c69b9..531773a 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JRadioButtonHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JRadioButtonHandler.java @@ -1,80 +1,96 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.UnsupportedAttributeException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.DefaultComponentHandler; -import jaxx.runtime.swing.JAXXButtonGroup; - -import javax.swing.AbstractButton; -import javax.swing.event.ChangeListener; - -public class JRadioButtonHandler extends DefaultComponentHandler { - - private static final String VALUE_PROPERTY = JAXXButtonGroup.VALUE_CLIENT_PROPERTY.substring(1); - private static final String BUTTON_GROUP_PROPERTY = JAXXButtonGroup.BUTTON8GROUP_CLIENT_PROPERTY.substring(1); - - public JRadioButtonHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, AbstractButton.class); - } - - @Override - protected void configureProxyEventInfo() { - super.configureProxyEventInfo(); - addProxyEventInfo("isSelected", ChangeListener.class, "model"); - } - - @Override - public ClassDescriptor getPropertyType(CompiledObject object, String name, JAXXCompiler compiler) throws CompilerException { - if (name.equals(BUTTON_GROUP_PROPERTY)) { - return null; // accepts either a String or a ButtonGroup - } else if (name.equals(VALUE_PROPERTY)) { - return ClassDescriptorLoader.getClassDescriptor(Object.class); - } else { - return super.getPropertyType(object, name, compiler); - } - } - - @Override - public boolean isMemberBound(String name) throws UnsupportedAttributeException { - return !(name.equals(BUTTON_GROUP_PROPERTY) || name.equals(VALUE_PROPERTY)) && super.isMemberBound(name); - } - - // handle buttonGroup assignment in addition block rather than initialization block - @Override - public void setProperty(CompiledObject object, String name, Object value, JAXXCompiler compiler) { - if (name.equals(BUTTON_GROUP_PROPERTY)) { - object.appendAdditionCode(getSetPropertyCode(object.getJavaCode(), name, compiler.getJavaCode(value), compiler)); - } else { - super.setProperty(object, name, value, compiler); - } - } - - @Override - public String getSetPropertyCode(String id, String name, String valueCode, JAXXCompiler compiler) throws CompilerException { - if (name.equals(BUTTON_GROUP_PROPERTY)) { - if (valueCode.startsWith("\"") && valueCode.endsWith("\"")) { - valueCode = valueCode.substring(1, valueCode.length() - 1); - CompiledObject buttonGroup = compiler.getCompiledObject(valueCode); - if (buttonGroup == null) { - buttonGroup = new CompiledObject(valueCode, ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class), compiler); - compiler.registerCompiledObject(buttonGroup); - } - } - return "{ javax.swing.ButtonGroup $buttonGroup = " + valueCode + "; " + id + ".putClientProperty(\"$buttonGroup\", $buttonGroup); $buttonGroup.add(" + id + "); }\n"; - } else if (name.equals(VALUE_PROPERTY)) { - return "{ " + id + ".putClientProperty(\"" + JAXXButtonGroup.VALUE_CLIENT_PROPERTY + "\", " + valueCode + "); Object $buttonGroup = " + id + ".getClientProperty(\"" + JAXXButtonGroup.BUTTON8GROUP_CLIENT_PROPERTY + "\");" + - " if ($buttonGroup instanceof jaxx.runtime.swing.JAXXButtonGroup) { ((jaxx.runtime.swing.JAXXButtonGroup) $buttonGroup).updateSelectedValue(); } }\n"; - } else { - return super.getSetPropertyCode(id, name, valueCode, compiler); - } - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.UnsupportedAttributeException; +import jaxx.compiler.CompiledObject; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; +import jaxx.runtime.swing.JAXXButtonGroup; + +import javax.swing.AbstractButton; +import javax.swing.event.ChangeListener; + +public class JRadioButtonHandler extends DefaultComponentHandler { + + private static final String VALUE_PROPERTY = JAXXButtonGroup.VALUE_CLIENT_PROPERTY.substring(1); + private static final String BUTTON_GROUP_PROPERTY = JAXXButtonGroup.BUTTON8GROUP_CLIENT_PROPERTY.substring(1); + + public JRadioButtonHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, AbstractButton.class); + } + + @Override + protected void configureProxyEventInfo() { + super.configureProxyEventInfo(); + addProxyEventInfo("isSelected", ChangeListener.class, "model"); + } + + @Override + public ClassDescriptor getPropertyType(CompiledObject object, String name, JAXXCompiler compiler) throws CompilerException { + if (name.equals(BUTTON_GROUP_PROPERTY)) { + return null; // accepts either a String or a ButtonGroup + } else if (name.equals(VALUE_PROPERTY)) { + return ClassDescriptorLoader.getClassDescriptor(Object.class); + } else { + return super.getPropertyType(object, name, compiler); + } + } + + @Override + public boolean isMemberBound(String name) throws UnsupportedAttributeException { + return !(name.equals(BUTTON_GROUP_PROPERTY) || name.equals(VALUE_PROPERTY)) && super.isMemberBound(name); + } + + // handle buttonGroup assignment in addition block rather than initialization block + @Override + public void setProperty(CompiledObject object, String name, Object value, JAXXCompiler compiler) { + if (name.equals(BUTTON_GROUP_PROPERTY)) { + object.appendAdditionCode(getSetPropertyCode(object.getJavaCode(), name, compiler.getJavaCode(value), compiler)); + } else { + super.setProperty(object, name, value, compiler); + } + } + + @Override + public String getSetPropertyCode(String id, String name, String valueCode, JAXXCompiler compiler) throws CompilerException { + if (name.equals(BUTTON_GROUP_PROPERTY)) { + if (valueCode.startsWith("\"") && valueCode.endsWith("\"")) { + valueCode = valueCode.substring(1, valueCode.length() - 1); + CompiledObject buttonGroup = compiler.getCompiledObject(valueCode); + if (buttonGroup == null) { + buttonGroup = new CompiledObject(valueCode, ClassDescriptorLoader.getClassDescriptor(JAXXButtonGroup.class), compiler); + compiler.registerCompiledObject(buttonGroup); + } + } + return "{ javax.swing.ButtonGroup $buttonGroup = " + valueCode + "; " + id + ".putClientProperty(\"$buttonGroup\", $buttonGroup); $buttonGroup.add(" + id + "); }\n"; + } else if (name.equals(VALUE_PROPERTY)) { + return "{ " + id + ".putClientProperty(\"" + JAXXButtonGroup.VALUE_CLIENT_PROPERTY + "\", " + valueCode + "); Object $buttonGroup = " + id + ".getClientProperty(\"" + JAXXButtonGroup.BUTTON8GROUP_CLIENT_PROPERTY + "\");" + + " if ($buttonGroup instanceof jaxx.runtime.swing.JAXXButtonGroup) { ((jaxx.runtime.swing.JAXXButtonGroup) $buttonGroup).updateSelectedValue(); } }\n"; + } else { + return super.getSetPropertyCode(id, name, valueCode, compiler); + } + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JScrollPaneHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JScrollPaneHandler.java index d8439a3..29d2f74 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JScrollPaneHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JScrollPaneHandler.java @@ -1,42 +1,58 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.DefaultComponentHandler; - -import javax.swing.JScrollPane; - -public class JScrollPaneHandler extends DefaultComponentHandler { - - public JScrollPaneHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JScrollPane.class); - } - - @Override - public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { - return new CompiledObject(id, getBeanClass(), compiler) { - - boolean hasChild; - - @Override - public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException { - if (constraints != null) { - compiler.reportError("JScrollPane does not accept constraints"); - } - if (hasChild) { - compiler.reportError("JScrollPane may only have one child"); - } - super.addChild(child, constraints, compiler); - hasChild = true; - } - }; - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.CompiledObject; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; + +import javax.swing.JScrollPane; + +public class JScrollPaneHandler extends DefaultComponentHandler { + + public JScrollPaneHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JScrollPane.class); + } + + @Override + public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { + return new CompiledObject(id, getBeanClass(), compiler) { + + boolean hasChild; + + @Override + public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException { + if (constraints != null) { + compiler.reportError("JScrollPane does not accept constraints"); + } + if (hasChild) { + compiler.reportError("JScrollPane may only have one child"); + } + super.addChild(child, constraints, compiler); + hasChild = true; + } + }; + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSliderHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSliderHandler.java index 320b8f8..718bff4 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSliderHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSliderHandler.java @@ -1,48 +1,64 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.DefaultComponentHandler; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; - -import javax.swing.JSlider; -import javax.swing.event.ChangeListener; - -public class JSliderHandler extends DefaultComponentHandler { - - public JSliderHandler(ClassDescriptor beanClass) { - super(beanClass); - if (!ClassDescriptorLoader.getClassDescriptor(JSlider.class).isAssignableFrom(beanClass)) { - throw new IllegalArgumentException(getClass().getName() + " does not support the class " + beanClass.getName()); - } - } - - @Override - protected int getAttributeOrdering(Attr attr) { - if (attr.getName().equals("value")) { - return 1; - } else { - return super.getAttributeOrdering(attr); - } - } - - @Override - protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { - super.setDefaults(object, tag, compiler); - setAttribute(object, "value", "0", false, compiler); - } - - @Override - protected void configureProxyEventInfo() { - super.configureProxyEventInfo(); - addProxyEventInfo("getValue", ChangeListener.class, "model"); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.CompiledObject; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; + +import javax.swing.JSlider; +import javax.swing.event.ChangeListener; + +public class JSliderHandler extends DefaultComponentHandler { + + public JSliderHandler(ClassDescriptor beanClass) { + super(beanClass); + if (!ClassDescriptorLoader.getClassDescriptor(JSlider.class).isAssignableFrom(beanClass)) { + throw new IllegalArgumentException(getClass().getName() + " does not support the class " + beanClass.getName()); + } + } + + @Override + protected int getAttributeOrdering(Attr attr) { + if (attr.getName().equals("value")) { + return 1; + } else { + return super.getAttributeOrdering(attr); + } + } + + @Override + protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { + super.setDefaults(object, tag, compiler); + setAttribute(object, "value", "0", false, compiler); + } + + @Override + protected void configureProxyEventInfo() { + super.configureProxyEventInfo(); + addProxyEventInfo("getValue", ChangeListener.class, "model"); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSpinnerHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSpinnerHandler.java index a14c75b..48af8cc 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSpinnerHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSpinnerHandler.java @@ -1,94 +1,110 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.DefaultComponentHandler; -import org.w3c.dom.Element; - -import javax.swing.JSpinner; -import javax.swing.event.ChangeListener; - -public class JSpinnerHandler extends DefaultComponentHandler { - - public static String MINIMUM_PROPERTY = "minimum"; - public static String MAXIMUM_PROPERTY = "maximum"; - public static String VALUE_PROPERTY = "value"; - - public JSpinnerHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JSpinner.class); - } - - public static class CompiledSpinner extends CompiledObject { - - Integer minimum = null; - Integer maximum = null; - Integer value = null; - - public CompiledSpinner(String id, ClassDescriptor objectClass, JAXXCompiler compiler) throws CompilerException { - super(id, objectClass, compiler); - } - } - - @Override - public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { - return new CompiledSpinner(id, getBeanClass(), compiler); - } - - @Override - protected void configureProxyEventInfo() { - super.configureProxyEventInfo(); - addProxyEventInfo("getValue", ChangeListener.class, "model"); - } - - @Override - public ClassDescriptor getPropertyType(CompiledObject object, String propertyName, JAXXCompiler compiler) throws CompilerException { - if (propertyName.equals(MINIMUM_PROPERTY) || propertyName.equals(MAXIMUM_PROPERTY) || - propertyName.equals(VALUE_PROPERTY)) { - return ClassDescriptorLoader.getClassDescriptor(Integer.class); - } - return super.getPropertyType(object, propertyName, compiler); - } - - @Override - public void setProperty(CompiledObject object, String name, Object value, JAXXCompiler compiler) throws CompilerException { - if (name.equals(MINIMUM_PROPERTY)) { - ((CompiledSpinner) object).minimum = (Integer) value; - } else if (name.equals(MAXIMUM_PROPERTY)) { - ((CompiledSpinner) object).maximum = (Integer) value; - } else if (name.equals(VALUE_PROPERTY)) { - ((CompiledSpinner) object).value = (Integer) value; - } else { - super.setProperty(object, name, value, compiler); - } - } - - @Override - protected void closeComponent(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { - CompiledSpinner spinner = (CompiledSpinner) object; - if (spinner.minimum != null || spinner.maximum != null || spinner.value != null) { - if (spinner.getConstructorParams() != null) { - compiler.reportError("constructorParams and minimum/maximum may not both be specified for the same JSpinner"); - } - if (spinner.minimum == null) { - spinner.minimum = Math.min(0, spinner.maximum != null ? spinner.maximum.intValue() : 0); - } - if (spinner.maximum == null) { - spinner.maximum = Math.max(100, spinner.minimum.intValue()); - } - if (spinner.value == null) { - spinner.value = spinner.minimum; - } - spinner.setConstructorParams("new SpinnerNumberModel(" + spinner.value + ", " + spinner.minimum + ", " + spinner.maximum + ", 1)"); - } - - super.closeComponent(object, tag, compiler); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.CompiledObject; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; +import org.w3c.dom.Element; + +import javax.swing.JSpinner; +import javax.swing.event.ChangeListener; + +public class JSpinnerHandler extends DefaultComponentHandler { + + public static String MINIMUM_PROPERTY = "minimum"; + public static String MAXIMUM_PROPERTY = "maximum"; + public static String VALUE_PROPERTY = "value"; + + public JSpinnerHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JSpinner.class); + } + + public static class CompiledSpinner extends CompiledObject { + + Integer minimum = null; + Integer maximum = null; + Integer value = null; + + public CompiledSpinner(String id, ClassDescriptor objectClass, JAXXCompiler compiler) throws CompilerException { + super(id, objectClass, compiler); + } + } + + @Override + public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { + return new CompiledSpinner(id, getBeanClass(), compiler); + } + + @Override + protected void configureProxyEventInfo() { + super.configureProxyEventInfo(); + addProxyEventInfo("getValue", ChangeListener.class, "model"); + } + + @Override + public ClassDescriptor getPropertyType(CompiledObject object, String propertyName, JAXXCompiler compiler) throws CompilerException { + if (propertyName.equals(MINIMUM_PROPERTY) || propertyName.equals(MAXIMUM_PROPERTY) || + propertyName.equals(VALUE_PROPERTY)) { + return ClassDescriptorLoader.getClassDescriptor(Integer.class); + } + return super.getPropertyType(object, propertyName, compiler); + } + + @Override + public void setProperty(CompiledObject object, String name, Object value, JAXXCompiler compiler) throws CompilerException { + if (name.equals(MINIMUM_PROPERTY)) { + ((CompiledSpinner) object).minimum = (Integer) value; + } else if (name.equals(MAXIMUM_PROPERTY)) { + ((CompiledSpinner) object).maximum = (Integer) value; + } else if (name.equals(VALUE_PROPERTY)) { + ((CompiledSpinner) object).value = (Integer) value; + } else { + super.setProperty(object, name, value, compiler); + } + } + + @Override + protected void closeComponent(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { + CompiledSpinner spinner = (CompiledSpinner) object; + if (spinner.minimum != null || spinner.maximum != null || spinner.value != null) { + if (spinner.getConstructorParams() != null) { + compiler.reportError("constructorParams and minimum/maximum may not both be specified for the same JSpinner"); + } + if (spinner.minimum == null) { + spinner.minimum = Math.min(0, spinner.maximum != null ? spinner.maximum.intValue() : 0); + } + if (spinner.maximum == null) { + spinner.maximum = Math.max(100, spinner.minimum.intValue()); + } + if (spinner.value == null) { + spinner.value = spinner.minimum; + } + spinner.setConstructorParams("new SpinnerNumberModel(" + spinner.value + ", " + spinner.minimum + ", " + spinner.maximum + ", 1)"); + } + + super.closeComponent(object, tag, compiler); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSplitPaneHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSplitPaneHandler.java index 3459b67..e12bbfc 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSplitPaneHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JSplitPaneHandler.java @@ -1,71 +1,87 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.DefaultComponentHandler; -import org.w3c.dom.Element; - -import javax.swing.JSplitPane; -import java.awt.Component; - -public class JSplitPaneHandler extends DefaultComponentHandler { - - public JSplitPaneHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JSplitPane.class); - } - - protected Component createRawComponent(Element tag) { - return new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); - } - - /** - * Add support for <code>orientation="vertical"</code> and <code>orientation="horizontal"</code>. The - * values required by the JAXXBeanInfo are the unwieldy <code>vertical_split</code> and <code>horizontal_split</code> - * (which are also recognized). - */ - @Override - protected int constantValue(String key, String value) { - if (key.equals("orientation")) { - value = value.trim().toLowerCase(); - if (value.equals("horizontal") || value.equals("horizontal_split")) { - return JSplitPane.HORIZONTAL_SPLIT; - } - if (value.equals("vertical") || value.equals("vertical_split")) { - return JSplitPane.VERTICAL_SPLIT; - } - throw new IllegalArgumentException("orientation must be 'horizontal' or 'vertical', found '" + value + "'"); - } - return super.constantValue(key, value); - } - - @Override - public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { - return new CompiledObject(id, getBeanClass(), compiler) { - - private int count; - - @Override - public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException { - if (constraints != null) { - compiler.reportError("JSplitPane does not accept constraints"); - } - if (count == 0) { - super.addChild(child, "JSplitPane.LEFT", compiler); - } else if (count == 1) { - super.addChild(child, "JSplitPane.RIGHT", compiler); - } else { - compiler.reportError("JSplitPane is limited to two children"); - } - count++; - } - }; - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.CompiledObject; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; +import org.w3c.dom.Element; + +import javax.swing.JSplitPane; +import java.awt.Component; + +public class JSplitPaneHandler extends DefaultComponentHandler { + + public JSplitPaneHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JSplitPane.class); + } + + protected Component createRawComponent(Element tag) { + return new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); + } + + /** + * Add support for <code>orientation="vertical"</code> and <code>orientation="horizontal"</code>. The + * values required by the JAXXBeanInfo are the unwieldy <code>vertical_split</code> and <code>horizontal_split</code> + * (which are also recognized). + */ + @Override + protected int constantValue(String key, String value) { + if (key.equals("orientation")) { + value = value.trim().toLowerCase(); + if (value.equals("horizontal") || value.equals("horizontal_split")) { + return JSplitPane.HORIZONTAL_SPLIT; + } + if (value.equals("vertical") || value.equals("vertical_split")) { + return JSplitPane.VERTICAL_SPLIT; + } + throw new IllegalArgumentException("orientation must be 'horizontal' or 'vertical', found '" + value + "'"); + } + return super.constantValue(key, value); + } + + @Override + public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { + return new CompiledObject(id, getBeanClass(), compiler) { + + private int count; + + @Override + public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException { + if (constraints != null) { + compiler.reportError("JSplitPane does not accept constraints"); + } + if (count == 0) { + super.addChild(child, "JSplitPane.LEFT", compiler); + } else if (count == 1) { + super.addChild(child, "JSplitPane.RIGHT", compiler); + } else { + compiler.reportError("JSplitPane is limited to two children"); + } + count++; + } + }; + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTabbedPaneHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTabbedPaneHandler.java index 0caa927..1c572ee 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTabbedPaneHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTabbedPaneHandler.java @@ -1,135 +1,151 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.I18nHelper; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.DefaultComponentHandler; -import jaxx.runtime.swing.TabInfo; - -import javax.swing.Icon; -import javax.swing.JTabbedPane; -import javax.swing.event.ChangeListener; -import java.awt.Color; -import java.awt.event.ContainerListener; - -public class JTabbedPaneHandler extends DefaultComponentHandler { - - public JTabbedPaneHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JTabbedPane.class); - } - - public static class CompiledTabbedPane extends CompiledObject { - - private static final TabInfo USED = new TabInfo("ALREADY USED"); - int tabCount; - TabInfo tabInfo; - - public CompiledTabbedPane(String id, ClassDescriptor objectClass, JAXXCompiler compiler) throws CompilerException { - super(id, objectClass, compiler); - } - - @Override - public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException { - if (constraints != null) { - compiler.reportError("JTabbedPane tabs may not have constraints"); - } - - super.addChild(child, constraints, compiler); - - if (tabInfo == null) { - compiler.reportError("JTabbedPaneHandler may only have 'tab' tags as children (found " + child.getObjectClass() + ")"); - return; - } else if (tabInfo == USED) { - compiler.reportError("<tab> tags may only have one child component"); - return; - } - - int tabIndex = ++tabCount - 1; - appendAdditionCode(tabInfo.getId() + ".addPropertyChangeListener(new jaxx.runtime.swing.TabInfoPropertyChangeListener(" + getId() + ", " + tabIndex + "));"); - - String title = tabInfo.getTitle(); - if (title != null) { - if (I18nHelper.isI18nAttribute("title")) { - if (!title.startsWith("_(\"")) { - // we did not have the invocation code, add it - title = I18nHelper.addI18nInvocation(getId(), "title", compiler.getJavaCode(title), compiler); - } - } else { - title = compiler.getJavaCode(title); - } - appendAdditionCode(getId() + ".setTitleAt(" + tabIndex + ", " + title + ");"); - } - - String toolTipText = tabInfo.getToolTipText(); - if (toolTipText != null) { - if (I18nHelper.isI18nAttribute("toolTipText")) { - if (!toolTipText.startsWith("_(\"")) { - // we did not have the invocation code, add it - toolTipText = I18nHelper.addI18nInvocation(getId(), "toolTipText", compiler.getJavaCode(toolTipText), compiler); - } - } else { - toolTipText = compiler.getJavaCode(toolTipText); - } - appendAdditionCode(getId() + ".setToolTipTextAt(" + tabIndex + ", " + toolTipText + ");"); - } - - boolean enabled = tabInfo.isEnabled(); - if (!enabled) { - appendAdditionCode(getId() + ".setEnabledAt(" + tabIndex + ", false);"); - } - - Color foreground = tabInfo.getForeground(); - if (foreground != null) { - appendAdditionCode(getId() + ".setForegroundAt(" + tabIndex + ", " + compiler.getJavaCode(foreground) + ");"); - } - - Color background = tabInfo.getBackground(); - if (background != null) { - appendAdditionCode(getId() + ".setBackgroundAt(" + tabIndex + ", " + compiler.getJavaCode(background) + ");"); - } - - int mnemonic = tabInfo.getMnemonic(); - if (mnemonic != -1) { - appendAdditionCode(getId() + ".setMnemonicAt(" + tabIndex + ", " + mnemonic + ");"); - } - - int displayedMnemonicIndex = tabInfo.getDisplayedMnemonicIndex(); - if (displayedMnemonicIndex != -1) { - appendAdditionCode(getId() + ".setDisplayedMnemonicIndexAt(" + tabIndex + ", " + displayedMnemonicIndex + ");"); - } - - Icon icon = tabInfo.getIcon(); - if (icon != null) { - appendAdditionCode(getId() + ".setIconAt(" + tabIndex + ", " + icon + ");"); - } - - Icon disabledIcon = tabInfo.getDisabledIcon(); - if (disabledIcon != null) { - appendAdditionCode(getId() + ".setDisabledIconAt(" + tabIndex + ", " + disabledIcon + ");"); - } - - tabInfo = USED; - } - } - - @Override - public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { - return new CompiledTabbedPane(id, getBeanClass(), compiler); - } - - @Override - protected void configureProxyEventInfo() { - super.configureProxyEventInfo(); - addProxyEventInfo("getSelectedIndex", ChangeListener.class); - addProxyEventInfo("getSelectedComponent", ChangeListener.class); - addProxyEventInfo("getTabCount", ContainerListener.class); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.CompiledObject; +import jaxx.compiler.I18nHelper; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; +import jaxx.runtime.swing.TabInfo; + +import javax.swing.Icon; +import javax.swing.JTabbedPane; +import javax.swing.event.ChangeListener; +import java.awt.Color; +import java.awt.event.ContainerListener; + +public class JTabbedPaneHandler extends DefaultComponentHandler { + + public JTabbedPaneHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JTabbedPane.class); + } + + public static class CompiledTabbedPane extends CompiledObject { + + private static final TabInfo USED = new TabInfo("ALREADY USED"); + int tabCount; + TabInfo tabInfo; + + public CompiledTabbedPane(String id, ClassDescriptor objectClass, JAXXCompiler compiler) throws CompilerException { + super(id, objectClass, compiler); + } + + @Override + public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException { + if (constraints != null) { + compiler.reportError("JTabbedPane tabs may not have constraints"); + } + + super.addChild(child, constraints, compiler); + + if (tabInfo == null) { + compiler.reportError("JTabbedPaneHandler may only have 'tab' tags as children (found " + child.getObjectClass() + ")"); + return; + } else if (tabInfo == USED) { + compiler.reportError("<tab> tags may only have one child component"); + return; + } + + int tabIndex = ++tabCount - 1; + appendAdditionCode(tabInfo.getId() + ".addPropertyChangeListener(new jaxx.runtime.swing.TabInfoPropertyChangeListener(" + getId() + ", " + tabIndex + "));"); + + String title = tabInfo.getTitle(); + if (title != null) { + if (I18nHelper.isI18nAttribute("title")) { + if (!title.startsWith("_(\"")) { + // we did not have the invocation code, add it + title = I18nHelper.addI18nInvocation(getId(), "title", compiler.getJavaCode(title), compiler); + } + } else { + title = compiler.getJavaCode(title); + } + appendAdditionCode(getId() + ".setTitleAt(" + tabIndex + ", " + title + ");"); + } + + String toolTipText = tabInfo.getToolTipText(); + if (toolTipText != null) { + if (I18nHelper.isI18nAttribute("toolTipText")) { + if (!toolTipText.startsWith("_(\"")) { + // we did not have the invocation code, add it + toolTipText = I18nHelper.addI18nInvocation(getId(), "toolTipText", compiler.getJavaCode(toolTipText), compiler); + } + } else { + toolTipText = compiler.getJavaCode(toolTipText); + } + appendAdditionCode(getId() + ".setToolTipTextAt(" + tabIndex + ", " + toolTipText + ");"); + } + + boolean enabled = tabInfo.isEnabled(); + if (!enabled) { + appendAdditionCode(getId() + ".setEnabledAt(" + tabIndex + ", false);"); + } + + Color foreground = tabInfo.getForeground(); + if (foreground != null) { + appendAdditionCode(getId() + ".setForegroundAt(" + tabIndex + ", " + compiler.getJavaCode(foreground) + ");"); + } + + Color background = tabInfo.getBackground(); + if (background != null) { + appendAdditionCode(getId() + ".setBackgroundAt(" + tabIndex + ", " + compiler.getJavaCode(background) + ");"); + } + + int mnemonic = tabInfo.getMnemonic(); + if (mnemonic != -1) { + appendAdditionCode(getId() + ".setMnemonicAt(" + tabIndex + ", " + mnemonic + ");"); + } + + int displayedMnemonicIndex = tabInfo.getDisplayedMnemonicIndex(); + if (displayedMnemonicIndex != -1) { + appendAdditionCode(getId() + ".setDisplayedMnemonicIndexAt(" + tabIndex + ", " + displayedMnemonicIndex + ");"); + } + + Icon icon = tabInfo.getIcon(); + if (icon != null) { + appendAdditionCode(getId() + ".setIconAt(" + tabIndex + ", " + icon + ");"); + } + + Icon disabledIcon = tabInfo.getDisabledIcon(); + if (disabledIcon != null) { + appendAdditionCode(getId() + ".setDisabledIconAt(" + tabIndex + ", " + disabledIcon + ");"); + } + + tabInfo = USED; + } + } + + @Override + public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { + return new CompiledTabbedPane(id, getBeanClass(), compiler); + } + + @Override + protected void configureProxyEventInfo() { + super.configureProxyEventInfo(); + addProxyEventInfo("getSelectedIndex", ChangeListener.class); + addProxyEventInfo("getSelectedComponent", ChangeListener.class); + addProxyEventInfo("getTabCount", ContainerListener.class); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTextComponentHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTextComponentHandler.java index 7ded1c6..ca67c58 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTextComponentHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTextComponentHandler.java @@ -1,70 +1,86 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.DefaultComponentHandler; -import jaxx.runtime.SwingUtil; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; - -import javax.swing.JTextArea; -import javax.swing.event.DocumentListener; -import javax.swing.text.JTextComponent; - -public class JTextComponentHandler extends DefaultComponentHandler { - - private static final int DEFAULT_COLUMNS = 15; - - public JTextComponentHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JTextComponent.class); - } - - @Override - protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { - super.setDefaults(object, tag, compiler); - try { - object.getObjectClass().getMethodDescriptor("setColumns", ClassDescriptorLoader.getClassDescriptor(int.class)); - setAttribute(object, "columns", String.valueOf(DEFAULT_COLUMNS), false, compiler); - } catch (NoSuchMethodException e) { - // ignore ? - } - - if (ClassDescriptorLoader.getClassDescriptor(JTextArea.class).isAssignableFrom(object.getObjectClass())) { - setAttribute(object, "lineWrap", "true", false, compiler); - setAttribute(object, "wrapStyleWord", "true", false, compiler); - } - } - - @Override - public String getSetPropertyCode(String id, String name, String valueCode, JAXXCompiler compiler) throws CompilerException { - if (name.equals("text")) { - return SwingUtil.class.getName() + ".setText(" + id + ", " + valueCode + ");\n"; - //return "jaxx.runtime.swing.Utils.setText(" + id + ", " + valueCode + ");\n"; - } - return super.getSetPropertyCode(id, name, valueCode, compiler); - } - - @Override - protected int getAttributeOrdering(Attr attr) { - // delay text in case other attributes affect how it's processed, as is the case - // with JEditorPane's contentType - if (attr.getName().equals("text")) { - return 1; - } - return super.getAttributeOrdering(attr); - } - - @Override - protected void configureProxyEventInfo() { - super.configureProxyEventInfo(); - addProxyEventInfo("getText", DocumentListener.class, "document"); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.CompiledObject; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; +import jaxx.runtime.SwingUtil; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; + +import javax.swing.JTextArea; +import javax.swing.event.DocumentListener; +import javax.swing.text.JTextComponent; + +public class JTextComponentHandler extends DefaultComponentHandler { + + private static final int DEFAULT_COLUMNS = 15; + + public JTextComponentHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JTextComponent.class); + } + + @Override + protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { + super.setDefaults(object, tag, compiler); + try { + object.getObjectClass().getMethodDescriptor("setColumns", ClassDescriptorLoader.getClassDescriptor(int.class)); + setAttribute(object, "columns", String.valueOf(DEFAULT_COLUMNS), false, compiler); + } catch (NoSuchMethodException e) { + // ignore ? + } + + if (ClassDescriptorLoader.getClassDescriptor(JTextArea.class).isAssignableFrom(object.getObjectClass())) { + setAttribute(object, "lineWrap", "true", false, compiler); + setAttribute(object, "wrapStyleWord", "true", false, compiler); + } + } + + @Override + public String getSetPropertyCode(String id, String name, String valueCode, JAXXCompiler compiler) throws CompilerException { + if (name.equals("text")) { + return SwingUtil.class.getName() + ".setText(" + id + ", " + valueCode + ");\n"; + //return "jaxx.runtime.swing.Utils.setText(" + id + ", " + valueCode + ");\n"; + } + return super.getSetPropertyCode(id, name, valueCode, compiler); + } + + @Override + protected int getAttributeOrdering(Attr attr) { + // delay text in case other attributes affect how it's processed, as is the case + // with JEditorPane's contentType + if (attr.getName().equals("text")) { + return 1; + } + return super.getAttributeOrdering(attr); + } + + @Override + protected void configureProxyEventInfo() { + super.configureProxyEventInfo(); + addProxyEventInfo("getText", DocumentListener.class, "document"); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JToolBarHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JToolBarHandler.java index 3c67a91..2d61e0a 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JToolBarHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JToolBarHandler.java @@ -1,39 +1,55 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.DefaultComponentHandler; - -import javax.swing.JToolBar; - -public class JToolBarHandler extends DefaultComponentHandler { - - public JToolBarHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JToolBar.class); - } - - /** - * Add support for <code>orientation="vertical"</code> and <code>orientation="horizontal"</code>. These values should - * have been supported without any special effort on my part, but JToolBar's BeanInfo doesn't contain the enum attribute - * for the orientation property. - */ - @Override - protected int constantValue(String key, String value) { - if (key.equals("orientation")) { - value = value.trim().toLowerCase(); - if (value.equals("horizontal")) { - return JToolBar.HORIZONTAL; - } - if (value.equals("vertical")) { - return JToolBar.VERTICAL; - } - throw new IllegalArgumentException("orientation must be 'horizontal' or 'vertical', found '" + value + "'"); - } - return super.constantValue(key, value); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; + +import javax.swing.JToolBar; + +public class JToolBarHandler extends DefaultComponentHandler { + + public JToolBarHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JToolBar.class); + } + + /** + * Add support for <code>orientation="vertical"</code> and <code>orientation="horizontal"</code>. These values should + * have been supported without any special effort on my part, but JToolBar's BeanInfo doesn't contain the enum attribute + * for the orientation property. + */ + @Override + protected int constantValue(String key, String value) { + if (key.equals("orientation")) { + value = value.trim().toLowerCase(); + if (value.equals("horizontal")) { + return JToolBar.HORIZONTAL; + } + if (value.equals("vertical")) { + return JToolBar.VERTICAL; + } + throw new IllegalArgumentException("orientation must be 'horizontal' or 'vertical', found '" + value + "'"); + } + return super.constantValue(key, value); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTreeHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTreeHandler.java index 02b3b42..f3d9a3f 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTreeHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JTreeHandler.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.tags.swing; import jaxx.compiler.CompilerException; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JWindowHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JWindowHandler.java index ef936cf..1cbe425 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JWindowHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/JWindowHandler.java @@ -1,62 +1,78 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.DefaultComponentHandler; -import org.w3c.dom.Element; - -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JMenuBar; -import javax.swing.JWindow; -import java.io.IOException; -import java.util.Map; - -public class JWindowHandler extends DefaultComponentHandler { - - public JWindowHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JWindow.class, JFrame.class, JDialog.class); - } - - @Override - public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { - return new CompiledObject(id, getBeanClass(), compiler) { - - @Override - public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException { - if (ClassDescriptorLoader.getClassDescriptor(JMenuBar.class).isAssignableFrom(child.getObjectClass())) { - appendAdditionCode(getId() + ".setJMenuBar(" + child.getId() + ");"); - } else { - super.addChild(child, constraints, compiler); - } - } - }; - } - - @Override - protected void openComponent(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { - if (compiler.getOpenComponent() != null) { - compiler.openInvisibleComponent(object); - } else { - super.openComponent(object, tag, compiler); - } - } - - @Override - public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - super.compileSecondPass(tag, compiler); - CompiledObject object = objectMap.get(tag); - Map<?, ?> properties = object.getProperties(); - if (!properties.containsKey("width") && !properties.containsKey("height")) { - compiler.appendLateInitializer(object.getId() + ".pack();\n"); - } - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.CompiledObject; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; +import org.w3c.dom.Element; + +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JMenuBar; +import javax.swing.JWindow; +import java.io.IOException; +import java.util.Map; + +public class JWindowHandler extends DefaultComponentHandler { + + public JWindowHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, JWindow.class, JFrame.class, JDialog.class); + } + + @Override + public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { + return new CompiledObject(id, getBeanClass(), compiler) { + + @Override + public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException { + if (ClassDescriptorLoader.getClassDescriptor(JMenuBar.class).isAssignableFrom(child.getObjectClass())) { + appendAdditionCode(getId() + ".setJMenuBar(" + child.getId() + ");"); + } else { + super.addChild(child, constraints, compiler); + } + } + }; + } + + @Override + protected void openComponent(CompiledObject object, Element tag, JAXXCompiler compiler) throws CompilerException { + if (compiler.getOpenComponent() != null) { + compiler.openInvisibleComponent(object); + } else { + super.openComponent(object, tag, compiler); + } + } + + @Override + public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + super.compileSecondPass(tag, compiler); + CompiledObject object = objectMap.get(tag); + Map<?, ?> properties = object.getProperties(); + if (!properties.containsKey("width") && !properties.containsKey("height")) { + compiler.appendLateInitializer(object.getId() + ".pack();\n"); + } + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/RowHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/RowHandler.java index d35d696..a286f76 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/RowHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/RowHandler.java @@ -1,88 +1,104 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.TagHandler; -import jaxx.runtime.swing.Table; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.Text; - -import java.awt.GridBagConstraints; -import java.io.IOException; - -public class RowHandler implements TagHandler { - - @Override - public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - compileChildrenFirstPass(tag, compiler); - } - - @Override - public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - if (!ClassDescriptorLoader.getClassDescriptor(Table.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) { - compiler.reportError("row tag may only appear within Table tag"); - return; - } - - TableHandler.CompiledTable table = (TableHandler.CompiledTable) compiler.getOpenComponent(); - table.newRow(); - GridBagConstraints c = table.getRowConstraints(); - CellHandler.setAttributes(c, tag); - compileChildrenSecondPass(tag, compiler); - } - - public void compileChildrenFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - NodeList children = tag.getChildNodes(); - for (int i = 0; i < children.getLength(); i++) { - Node node = children.item(i); - int nodeType = node.getNodeType(); - if (nodeType == Node.ELEMENT_NODE) { - Element child = (Element) node; - if (!child.getLocalName().equals("cell")) { - compiler.reportError("tag '" + tag.getLocalName() + "' may only contain cell tags as children"); - } - compileChildTagFirstPass(child, compiler); - } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { - String text = ((Text) node).getData().trim(); - if (text.length() > 0) { - compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); - } - } - } - } - - public void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - NodeList children = tag.getChildNodes(); - for (int i = 0; i < children.getLength(); i++) { - Node node = children.item(i); - int nodeType = node.getNodeType(); - if (nodeType == Node.ELEMENT_NODE) { - Element child = (Element) node; - if (!child.getLocalName().equals("cell")) { - compiler.reportError("tag '" + tag.getLocalName() + "' may only contain cell tags as children"); - } - compileChildTagSecondPass(child, compiler); - } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { - String text = ((Text) node).getData().trim(); - if (text.length() > 0) { - compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); - } - } - } - } - - protected void compileChildTagFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - compiler.compileFirstPass(tag); - } - - protected void compileChildTagSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - compiler.compileSecondPass(tag); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.TagHandler; +import jaxx.runtime.swing.Table; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.Text; + +import java.awt.GridBagConstraints; +import java.io.IOException; + +public class RowHandler implements TagHandler { + + @Override + public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + compileChildrenFirstPass(tag, compiler); + } + + @Override + public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + if (!ClassDescriptorLoader.getClassDescriptor(Table.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) { + compiler.reportError("row tag may only appear within Table tag"); + return; + } + + TableHandler.CompiledTable table = (TableHandler.CompiledTable) compiler.getOpenComponent(); + table.newRow(); + GridBagConstraints c = table.getRowConstraints(); + CellHandler.setAttributes(c, tag); + compileChildrenSecondPass(tag, compiler); + } + + public void compileChildrenFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + NodeList children = tag.getChildNodes(); + for (int i = 0; i < children.getLength(); i++) { + Node node = children.item(i); + int nodeType = node.getNodeType(); + if (nodeType == Node.ELEMENT_NODE) { + Element child = (Element) node; + if (!child.getLocalName().equals("cell")) { + compiler.reportError("tag '" + tag.getLocalName() + "' may only contain cell tags as children"); + } + compileChildTagFirstPass(child, compiler); + } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { + String text = ((Text) node).getData().trim(); + if (text.length() > 0) { + compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); + } + } + } + } + + public void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + NodeList children = tag.getChildNodes(); + for (int i = 0; i < children.getLength(); i++) { + Node node = children.item(i); + int nodeType = node.getNodeType(); + if (nodeType == Node.ELEMENT_NODE) { + Element child = (Element) node; + if (!child.getLocalName().equals("cell")) { + compiler.reportError("tag '" + tag.getLocalName() + "' may only contain cell tags as children"); + } + compileChildTagSecondPass(child, compiler); + } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { + String text = ((Text) node).getData().trim(); + if (text.length() > 0) { + compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); + } + } + } + } + + protected void compileChildTagFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + compiler.compileFirstPass(tag); + } + + protected void compileChildTagSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + compiler.compileSecondPass(tag); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java index 7045341..5d39daa 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java @@ -1,169 +1,185 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.I18nHelper; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.TagHandler; -import jaxx.runtime.swing.TabInfo; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.Text; - -import javax.swing.Icon; -import javax.swing.JTabbedPane; -import java.awt.Color; -import java.io.IOException; - -public class TabHandler implements TagHandler { - - @Override - public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - compileChildrenFirstPass(tag, compiler); - } - - @Override - public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - if (!ClassDescriptorLoader.getClassDescriptor(JTabbedPane.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) { - compiler.reportError("tab tag may only appear within JTabbedPane tag"); - return; - } - - JTabbedPaneHandler.CompiledTabbedPane tabs = (JTabbedPaneHandler.CompiledTabbedPane) compiler.getOpenComponent(); - - String id = tag.getAttribute("id"); - if (id == null || id.length() == 0) { - id = compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(TabInfo.class)); - } - TabInfo tabInfo = new TabInfo(id); - CompiledObject compiledTabInfo = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(TabInfo.class), compiler); - compiler.registerCompiledObject(compiledTabInfo); - //id = tabInfo.getId(); - tabs.tabInfo = tabInfo; - setAttributes(compiledTabInfo, tabs, tag, compiler); - compileChildrenSecondPass(tag, compiler); - tabs.tabInfo = null; - } - - public static void setAttribute(CompiledObject compiledTabInfo, JTabbedPaneHandler.CompiledTabbedPane tabs, String name, String value, JAXXCompiler compiler) throws CompilerException { - value = value.trim(); - TabInfo tabInfo = tabs.tabInfo; - String id = tabInfo.getId(); - String binding = compiler.processDataBindings(value, ClassDescriptorLoader.getClassDescriptor(Object.class)); - if (binding != null) { - compiler.registerDataBinding(binding, id + "." + name, id + ".set" + org.apache.commons.lang.StringUtils.capitalize(name) + "(" + binding + ");"); - return; - } - - String valueCode = compiler.getJavaCode(value); - - // add i18n support - if (I18nHelper.isI18nableAttribute(name, compiler)) { - value = valueCode = I18nHelper.addI18nInvocation(id, name, valueCode, compiler); - } - - if (name.equals("title")) { - tabInfo.setTitle(value); - compiledTabInfo.appendInitializationCode(id + ".setTitle(" + valueCode + ");"); - //compiledTabInfo.appendInitializationCode(id + ".setTitle(" + TypeManager.getJavaCode(value) + ");"); - } else if (name.equals("toolTipText")) { - tabInfo.setToolTipText(value); - compiledTabInfo.appendInitializationCode(id + ".setToolTipText(" + valueCode + ");"); - //compiledTabInfo.appendInitializationCode(id + ".setToolTipText(" + TypeManager.getJavaCode(value) + ");"); - } else if (name.equals("icon")) { - Icon icon = (Icon) compiler.convertFromString(value, Icon.class); - tabInfo.setIcon(icon); - compiledTabInfo.appendInitializationCode(id + ".setIcon(" + compiler.getJavaCode(icon) + ");"); - } else if (name.equals("enabled")) { - boolean enabled = (Boolean) compiler.convertFromString(value, Boolean.class); - tabInfo.setEnabled(enabled); - compiledTabInfo.appendInitializationCode(id + ".setEnabled(" + enabled + ");"); - } else if (name.equals("disabledIcon")) { - Icon disabledIcon = (Icon) compiler.convertFromString(value, Icon.class); - tabInfo.setDisabledIcon(disabledIcon); - compiledTabInfo.appendInitializationCode(id + ".setDisabledIcon(" + compiler.getJavaCode(disabledIcon) + ");"); - } else if (name.equals("mnemonic")) { - int mnemonic = (Character) compiler.convertFromString(value, char.class); - tabInfo.setMnemonic(mnemonic); - compiledTabInfo.appendInitializationCode(id + ".setMnemonic(" + mnemonic + ");"); - } else if (name.equals("displayedMnemonicIndex")) { - int displayedMnemonicIndex = (Integer) compiler.convertFromString(value, int.class); - tabInfo.setDisplayedMnemonicIndex(displayedMnemonicIndex); - compiledTabInfo.appendInitializationCode(id + ".setDisplayedMnemonicIndex(" + displayedMnemonicIndex + ");"); - } else if (name.equals("foreground")) { - Color foreground = (Color) compiler.convertFromString(value, Color.class); - tabInfo.setForeground(foreground); - compiledTabInfo.appendInitializationCode(id + ".setForeground(" + compiler.getJavaCode(foreground) + ");"); - } else if (name.equals("background")) { - Color background = (Color) compiler.convertFromString(value, Color.class); - tabInfo.setBackground(background); - compiledTabInfo.appendInitializationCode(id + ".setBackground(" + compiler.getJavaCode(background) + ");"); - } else if (name.equals("id")) { - // ignore, already handled - } else { - compiler.reportError("The <tab> tag does not support the attribute '" + name + "'"); - } - } - - public void setAttributes(CompiledObject compiledTabInfo, JTabbedPaneHandler.CompiledTabbedPane tabs, Element tag, JAXXCompiler compiler) throws CompilerException { - NamedNodeMap children = tag.getAttributes(); - for (int i = 0; i < children.getLength(); i++) { - Attr attribute = (Attr) children.item(i); - String name = attribute.getName(); - String value = attribute.getValue(); - if (!name.startsWith("xmlns") && !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { - setAttribute(compiledTabInfo, tabs, name, value, compiler); - } - } - } - - protected void compileChildrenFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - NodeList children = tag.getChildNodes(); - for (int i = 0; i < children.getLength(); i++) { - Node node = children.item(i); - int nodeType = node.getNodeType(); - if (nodeType == Node.ELEMENT_NODE) { - Element child = (Element) node; - compileChildTagFirstPass(child, compiler); - } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { - String text = ((Text) node).getData().trim(); - if (text.length() > 0) { - compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); - } - } - } - } - - protected void compileChildTagFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - compiler.compileFirstPass(tag); - } - - protected void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - NodeList children = tag.getChildNodes(); - for (int i = 0; i < children.getLength(); i++) { - Node node = children.item(i); - int nodeType = node.getNodeType(); - if (nodeType == Node.ELEMENT_NODE) { - Element child = (Element) node; - compileChildTagSecondPass(child, compiler); - } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { - String text = ((Text) node).getData().trim(); - if (text.length() > 0) { - compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); - } - } - } - } - - protected void compileChildTagSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - compiler.compileSecondPass(tag); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.CompiledObject; +import jaxx.compiler.I18nHelper; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.TagHandler; +import jaxx.runtime.swing.TabInfo; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.Text; + +import javax.swing.Icon; +import javax.swing.JTabbedPane; +import java.awt.Color; +import java.io.IOException; + +public class TabHandler implements TagHandler { + + @Override + public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + compileChildrenFirstPass(tag, compiler); + } + + @Override + public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + if (!ClassDescriptorLoader.getClassDescriptor(JTabbedPane.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) { + compiler.reportError("tab tag may only appear within JTabbedPane tag"); + return; + } + + JTabbedPaneHandler.CompiledTabbedPane tabs = (JTabbedPaneHandler.CompiledTabbedPane) compiler.getOpenComponent(); + + String id = tag.getAttribute("id"); + if (id == null || id.length() == 0) { + id = compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(TabInfo.class)); + } + TabInfo tabInfo = new TabInfo(id); + CompiledObject compiledTabInfo = new CompiledObject(id, ClassDescriptorLoader.getClassDescriptor(TabInfo.class), compiler); + compiler.registerCompiledObject(compiledTabInfo); + //id = tabInfo.getId(); + tabs.tabInfo = tabInfo; + setAttributes(compiledTabInfo, tabs, tag, compiler); + compileChildrenSecondPass(tag, compiler); + tabs.tabInfo = null; + } + + public static void setAttribute(CompiledObject compiledTabInfo, JTabbedPaneHandler.CompiledTabbedPane tabs, String name, String value, JAXXCompiler compiler) throws CompilerException { + value = value.trim(); + TabInfo tabInfo = tabs.tabInfo; + String id = tabInfo.getId(); + String binding = compiler.processDataBindings(value, ClassDescriptorLoader.getClassDescriptor(Object.class)); + if (binding != null) { + compiler.registerDataBinding(binding, id + "." + name, id + ".set" + org.apache.commons.lang.StringUtils.capitalize(name) + "(" + binding + ");"); + return; + } + + String valueCode = compiler.getJavaCode(value); + + // add i18n support + if (I18nHelper.isI18nableAttribute(name, compiler)) { + value = valueCode = I18nHelper.addI18nInvocation(id, name, valueCode, compiler); + } + + if (name.equals("title")) { + tabInfo.setTitle(value); + compiledTabInfo.appendInitializationCode(id + ".setTitle(" + valueCode + ");"); + //compiledTabInfo.appendInitializationCode(id + ".setTitle(" + TypeManager.getJavaCode(value) + ");"); + } else if (name.equals("toolTipText")) { + tabInfo.setToolTipText(value); + compiledTabInfo.appendInitializationCode(id + ".setToolTipText(" + valueCode + ");"); + //compiledTabInfo.appendInitializationCode(id + ".setToolTipText(" + TypeManager.getJavaCode(value) + ");"); + } else if (name.equals("icon")) { + Icon icon = (Icon) compiler.convertFromString(value, Icon.class); + tabInfo.setIcon(icon); + compiledTabInfo.appendInitializationCode(id + ".setIcon(" + compiler.getJavaCode(icon) + ");"); + } else if (name.equals("enabled")) { + boolean enabled = (Boolean) compiler.convertFromString(value, Boolean.class); + tabInfo.setEnabled(enabled); + compiledTabInfo.appendInitializationCode(id + ".setEnabled(" + enabled + ");"); + } else if (name.equals("disabledIcon")) { + Icon disabledIcon = (Icon) compiler.convertFromString(value, Icon.class); + tabInfo.setDisabledIcon(disabledIcon); + compiledTabInfo.appendInitializationCode(id + ".setDisabledIcon(" + compiler.getJavaCode(disabledIcon) + ");"); + } else if (name.equals("mnemonic")) { + int mnemonic = (Character) compiler.convertFromString(value, char.class); + tabInfo.setMnemonic(mnemonic); + compiledTabInfo.appendInitializationCode(id + ".setMnemonic(" + mnemonic + ");"); + } else if (name.equals("displayedMnemonicIndex")) { + int displayedMnemonicIndex = (Integer) compiler.convertFromString(value, int.class); + tabInfo.setDisplayedMnemonicIndex(displayedMnemonicIndex); + compiledTabInfo.appendInitializationCode(id + ".setDisplayedMnemonicIndex(" + displayedMnemonicIndex + ");"); + } else if (name.equals("foreground")) { + Color foreground = (Color) compiler.convertFromString(value, Color.class); + tabInfo.setForeground(foreground); + compiledTabInfo.appendInitializationCode(id + ".setForeground(" + compiler.getJavaCode(foreground) + ");"); + } else if (name.equals("background")) { + Color background = (Color) compiler.convertFromString(value, Color.class); + tabInfo.setBackground(background); + compiledTabInfo.appendInitializationCode(id + ".setBackground(" + compiler.getJavaCode(background) + ");"); + } else if (name.equals("id")) { + // ignore, already handled + } else { + compiler.reportError("The <tab> tag does not support the attribute '" + name + "'"); + } + } + + public void setAttributes(CompiledObject compiledTabInfo, JTabbedPaneHandler.CompiledTabbedPane tabs, Element tag, JAXXCompiler compiler) throws CompilerException { + NamedNodeMap children = tag.getAttributes(); + for (int i = 0; i < children.getLength(); i++) { + Attr attribute = (Attr) children.item(i); + String name = attribute.getName(); + String value = attribute.getValue(); + if (!name.startsWith("xmlns") && !JAXXCompiler.JAXX_INTERNAL_NAMESPACE.equals(attribute.getNamespaceURI())) { + setAttribute(compiledTabInfo, tabs, name, value, compiler); + } + } + } + + protected void compileChildrenFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + NodeList children = tag.getChildNodes(); + for (int i = 0; i < children.getLength(); i++) { + Node node = children.item(i); + int nodeType = node.getNodeType(); + if (nodeType == Node.ELEMENT_NODE) { + Element child = (Element) node; + compileChildTagFirstPass(child, compiler); + } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { + String text = ((Text) node).getData().trim(); + if (text.length() > 0) { + compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); + } + } + } + } + + protected void compileChildTagFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + compiler.compileFirstPass(tag); + } + + protected void compileChildrenSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + NodeList children = tag.getChildNodes(); + for (int i = 0; i < children.getLength(); i++) { + Node node = children.item(i); + int nodeType = node.getNodeType(); + if (nodeType == Node.ELEMENT_NODE) { + Element child = (Element) node; + compileChildTagSecondPass(child, compiler); + } else if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) { + String text = ((Text) node).getData().trim(); + if (text.length() > 0) { + compiler.reportError("tag '" + tag.getLocalName() + "' may not contain text ('" + ((Text) node).getData().trim() + "')"); + } + } + } + } + + protected void compileChildTagSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + compiler.compileSecondPass(tag); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TableHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TableHandler.java index 5211116..3fe1373 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TableHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TableHandler.java @@ -1,123 +1,139 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.swing; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.UnsupportedAttributeException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.DefaultComponentHandler; -import jaxx.runtime.swing.Table; - -import java.awt.GridBagConstraints; -import java.awt.Insets; -import java.util.ArrayList; -import java.util.List; - -public class TableHandler extends DefaultComponentHandler { - - public static final Insets DEFAULT_INSETS = new Insets(3, 3, 3, 3); - - public TableHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, Table.class); - } - - @Override - public void setAttribute(CompiledObject object, String propertyName, String stringValue, boolean inline, JAXXCompiler compiler) throws CompilerException { - try { - if (object instanceof CompiledTable) { - CellHandler.setAttribute(((CompiledTable) object).getTableConstraints(), propertyName, stringValue); - } else { - super.setAttribute(object, propertyName, stringValue, inline, compiler); - } - } catch (UnsupportedAttributeException e) { - super.setAttribute(object, propertyName, stringValue, inline, compiler); - } - } - - class CompiledTable extends CompiledObject { - - private List<Integer> rowSpans = new ArrayList<Integer>(); - private GridBagConstraints tableConstraints; - private GridBagConstraints rowConstraints = null; - private GridBagConstraints cellConstraints = null; - private boolean emptyCell; - - public CompiledTable(String id, ClassDescriptor objectClass, JAXXCompiler compiler) throws CompilerException { - super(id, objectClass, compiler); - tableConstraints = new GridBagConstraints(); - tableConstraints.gridx = -1; - tableConstraints.gridy = -1; - tableConstraints.insets = DEFAULT_INSETS; - } - - @Override - public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException { - if (constraints != null) { - compiler.reportError("Table does not accept constraints"); - } - GridBagConstraints c = getCellConstraints(); - if (c == null) { - compiler.reportError("Table tag may only contain row tags"); - return; - } - if (!emptyCell) { - compiler.reportError("Table cells may only have one child component"); - } - while (rowSpans.size() < c.gridx + c.gridwidth) { - rowSpans.add(null); - } - for (int x = c.gridx; x < c.gridx + c.gridwidth; x++) { - rowSpans.set(x, c.gridheight); - } - - super.addChild(child, compiler.getJavaCode(c), compiler); - - emptyCell = false; - } - - public GridBagConstraints getTableConstraints() { - return tableConstraints; - } - - public GridBagConstraints getRowConstraints() { - return rowConstraints; - } - - public GridBagConstraints getCellConstraints() { - return cellConstraints; - } - - public void newRow() { - tableConstraints.gridy++; - tableConstraints.gridx = -1; - rowConstraints = (GridBagConstraints) tableConstraints.clone(); - - for (int x = 0; x < rowSpans.size(); x++) { - int rowSpan = rowSpans.get(x); - if (rowSpan > 0) { - rowSpans.set(x, rowSpan - 1); - } - } - } - - public void newCell() { - emptyCell = true; - rowConstraints.gridx++; - while (rowConstraints.gridx < rowSpans.size() && rowSpans.get(rowConstraints.gridx) > 0) { - rowConstraints.gridx++; - } - cellConstraints = (GridBagConstraints) rowConstraints.clone(); - } - } - - @Override - public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { - return new CompiledTable(id, getBeanClass(), compiler); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.swing; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.UnsupportedAttributeException; +import jaxx.compiler.CompiledObject; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultComponentHandler; +import jaxx.runtime.swing.Table; + +import java.awt.GridBagConstraints; +import java.awt.Insets; +import java.util.ArrayList; +import java.util.List; + +public class TableHandler extends DefaultComponentHandler { + + public static final Insets DEFAULT_INSETS = new Insets(3, 3, 3, 3); + + public TableHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, Table.class); + } + + @Override + public void setAttribute(CompiledObject object, String propertyName, String stringValue, boolean inline, JAXXCompiler compiler) throws CompilerException { + try { + if (object instanceof CompiledTable) { + CellHandler.setAttribute(((CompiledTable) object).getTableConstraints(), propertyName, stringValue); + } else { + super.setAttribute(object, propertyName, stringValue, inline, compiler); + } + } catch (UnsupportedAttributeException e) { + super.setAttribute(object, propertyName, stringValue, inline, compiler); + } + } + + class CompiledTable extends CompiledObject { + + private List<Integer> rowSpans = new ArrayList<Integer>(); + private GridBagConstraints tableConstraints; + private GridBagConstraints rowConstraints = null; + private GridBagConstraints cellConstraints = null; + private boolean emptyCell; + + public CompiledTable(String id, ClassDescriptor objectClass, JAXXCompiler compiler) throws CompilerException { + super(id, objectClass, compiler); + tableConstraints = new GridBagConstraints(); + tableConstraints.gridx = -1; + tableConstraints.gridy = -1; + tableConstraints.insets = DEFAULT_INSETS; + } + + @Override + public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException { + if (constraints != null) { + compiler.reportError("Table does not accept constraints"); + } + GridBagConstraints c = getCellConstraints(); + if (c == null) { + compiler.reportError("Table tag may only contain row tags"); + return; + } + if (!emptyCell) { + compiler.reportError("Table cells may only have one child component"); + } + while (rowSpans.size() < c.gridx + c.gridwidth) { + rowSpans.add(null); + } + for (int x = c.gridx; x < c.gridx + c.gridwidth; x++) { + rowSpans.set(x, c.gridheight); + } + + super.addChild(child, compiler.getJavaCode(c), compiler); + + emptyCell = false; + } + + public GridBagConstraints getTableConstraints() { + return tableConstraints; + } + + public GridBagConstraints getRowConstraints() { + return rowConstraints; + } + + public GridBagConstraints getCellConstraints() { + return cellConstraints; + } + + public void newRow() { + tableConstraints.gridy++; + tableConstraints.gridx = -1; + rowConstraints = (GridBagConstraints) tableConstraints.clone(); + + for (int x = 0; x < rowSpans.size(); x++) { + int rowSpan = rowSpans.get(x); + if (rowSpan > 0) { + rowSpans.set(x, rowSpan - 1); + } + } + } + + public void newCell() { + emptyCell = true; + rowConstraints.gridx++; + while (rowConstraints.gridx < rowSpans.size() && rowSpans.get(rowConstraints.gridx) > 0) { + rowConstraints.gridx++; + } + cellConstraints = (GridBagConstraints) rowConstraints.clone(); + } + } + + @Override + public CompiledObject createCompiledObject(String id, JAXXCompiler compiler) throws CompilerException { + return new CompiledTable(id, getBeanClass(), compiler); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java index ade7f78..f61d589 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/BeanValidatorHandler.java @@ -1,715 +1,731 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.validator; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.CompiledObject; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.beans.JAXXBeanInfo; -import jaxx.compiler.beans.JAXXPropertyDescriptor; -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.DefaultObjectHandler; -import jaxx.compiler.types.TypeManager; -import jaxx.runtime.validator.swing.SwingValidatorUtil; -import jaxx.runtime.validator.swing.SwingValidator; -import jaxx.runtime.validator.swing.ui.AbstractBeanValidatorUI; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Element; - -import java.beans.IntrospectionException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.TreeMap; - -public class BeanValidatorHandler extends DefaultObjectHandler { - - public static final String TAG = "BeanValidator"; - public static final String BEAN_ATTRIBUTE = "bean"; - public static final String BEAN_CLASS_ATTRIBUTE = "beanClass"; - public static final String BEAN_INITIALIZER_ATTRIBUTE = "beanInitializer"; - public static final String ERROR_LIST_MODEL_ATTRIBUTE = "errorListModel"; - public static final String ERROR_TABLE_MODEL_ATTRIBUTE = "errorTableModel"; - public static final String ERROR_LIST_ATTRIBUTE = "errorList"; - public static final String ERROR_TABLE_ATTRIBUTE = "errorTable"; - //TODO-TC20091024 should change this default value to errorListModel - public static final String ERROR_LIST_MODEL_DEFAULT = "errors"; - //TODO-TC20091024 should change this default value to errorTableModel - public static final String ERROR_TABLE_MODEL_DEFAULT = "errors2"; - public static final String ERROR_LIST_DEFAULT = "errorList"; - public static final String ERROR_TABLE_DEFAULT = "errorTable"; - public static final String AUTOFIELD_ATTRIBUTE = "autoField"; - public static final String UI_CLASS_ATTRIBUTE = "uiClass"; - public static final String STRICT_MODE_ATTRIBUTE = "strictMode"; - public static final String CONTEXT_NAME_ATTRIBUTE = "contextName"; - //public static final String SCOPE_ATTRIBUTE = "scope"; - public static final String PARENT_VALIDATOR_ATTRIBUTE = "parentValidator"; - /** to use log facility, just put in your code: log.info(\"...\"); */ - static Log log = LogFactory.getLog(BeanValidatorHandler.class); - protected static Map<JAXXCompiler, List<CompiledBeanValidator>> validators = new HashMap<JAXXCompiler, List<CompiledBeanValidator>>(); - protected static Map<JAXXCompiler, List<String>> validatedComponents = new HashMap<JAXXCompiler, List<String>>(); - - public BeanValidatorHandler(ClassDescriptor beanClass) { - super(beanClass); - ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, SwingValidator.class); - } - - @Override - protected CompiledObject createCompiledObject(String id, JAXXCompiler compiler) { - return new CompiledBeanValidator(id, getBeanClass(), compiler); - } - - @Override - protected void compileChildTagFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - if (log.isDebugEnabled()) { - log.debug(tag); - } - if (!tag.getLocalName().equals(FieldValidatorHandler.TAG)) { - compiler.reportError("tag '" + tag.getParentNode().getLocalName() + "' may only contain " + FieldValidatorHandler.TAG + " as children, but found : " + tag.getLocalName()); - } else { - compiler.compileFirstPass(tag); - } - } - - @Override - public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - - super.compileSecondPass(tag, compiler); - - CompiledBeanValidator info = (CompiledBeanValidator) objectMap.get(tag); - - boolean error = info.addErrorListModel(tag, this, compiler); - - if (!error) { - error = info.addErrorList(tag, compiler); - } - - if (!error) { - error = info.addErrorTableModel(tag, this, compiler); - } - - if (!error) { - error = info.addErrorTable(tag, compiler); - } - - if (!error) { - error = info.addUiClass(this, compiler); - } - - if (!error) { - error = info.addBean(tag, this, compiler); - } - - /*if (!error) { - error = info.addContextName(this, compiler); - }*/ - - /*if (!error) { - error = info.addScope(this, compiler); - }*/ - - if (!error) { - error = info.addParentValidator(tag, this, compiler); - } - - if (error) { - log.warn("error were detected in second compile pass of CompiledObject [" + info + "]"); - } - - // close the compiled object - compiler.closeComponent(info); - } - - @Override - protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) { - // open the compiled object - compiler.openInvisibleComponent(object); - } - - @Override - public void setAttribute(CompiledObject object, String propertyName, String stringValue, boolean inline, JAXXCompiler compiler) { - if (log.isDebugEnabled()) { - log.debug(propertyName + " : " + stringValue + " for " + object); - } - // delegate to the compiled object with is statefull (but not the tag handler) - object.addProperty(propertyName, stringValue); - } - - /** - * The compiled objet representing a BeanValidator to be generated in JAXXObject - * - * @author chemit - */ - public static class CompiledBeanValidator extends CompiledObject { - - protected Map<String, String> fields; - protected Map<String, String> excludeFields; - protected String bean; - protected String beanClass; - protected String contextName; - protected String uiClass; - protected String errorListModel; - protected String errorList; - protected Boolean autoField; - protected Boolean strictMode; - protected JAXXBeanInfo beanDescriptor; - protected String errorTableModel; - protected String errorTable; - protected String parentValidator; - - public CompiledBeanValidator(String id, ClassDescriptor objectClass, JAXXCompiler compiler) { - //TC-20090524 Use the real class descriptor, not the one by default, - //TC-20090524 otherwise can not override the validator class while generation - //super(id, objectClass, compiler); - super(id, getDescriptor(objectClass, compiler), compiler); - fields = new TreeMap<String, String>(); - excludeFields = new TreeMap<String, String>(); - if (log.isDebugEnabled()) { - log.debug("validator objectClass " + super.getObjectClass()); - } - } - - protected static ClassDescriptor getDescriptor(ClassDescriptor objectClass, JAXXCompiler compiler) { - ClassDescriptor result = objectClass; - Class<?> validatorClass = compiler.getConfiguration().getValidatorClass(); - result = ClassDescriptorLoader.getClassDescriptor(validatorClass); - return result; - } - - public Map<String, String> getFields() { - return fields; - } - - public Map<String, String> getExcludeFields() { - return excludeFields; - } - - public void setFields(Map<String, String> fields) { - this.fields = fields; - } - - public void setExcludeFields(Map<String, String> excludeFields) { - this.excludeFields = excludeFields; - } - - @Override - public void addProperty(String property, String value) { - - if (BEAN_ATTRIBUTE.equals(property)) { - if (value != null && !value.trim().isEmpty()) { - bean = value.trim(); - } - return; - } - - if (CONTEXT_NAME_ATTRIBUTE.equals(property)) { - if (value != null && !value.trim().isEmpty()) { - contextName = value.trim(); - } - return; - } - - if (BEAN_CLASS_ATTRIBUTE.equals(property)) { - if (value != null && !value.trim().isEmpty()) { - beanClass = value.trim(); - } - return; - } - - if (ERROR_LIST_MODEL_ATTRIBUTE.equals(property)) { - if (value != null && !value.trim().isEmpty()) { - errorListModel = value.trim(); - } - return; - } - - if (ERROR_LIST_ATTRIBUTE.equals(property)) { - if (value != null && !value.trim().isEmpty()) { - errorList = value.trim(); - } - return; - } - - if (ERROR_TABLE_MODEL_ATTRIBUTE.equals(property)) { - if (value != null && !value.trim().isEmpty()) { - errorTableModel = value.trim(); - } - return; - } - - if (ERROR_TABLE_ATTRIBUTE.equals(property)) { - if (value != null && !value.trim().isEmpty()) { - errorTable = value.trim(); - } - return; - } - - if (UI_CLASS_ATTRIBUTE.equals(property)) { - if (value != null && !value.trim().isEmpty()) { - uiClass = value.trim(); - } - return; - } - - if (AUTOFIELD_ATTRIBUTE.equals(property)) { - if (value != null && !value.trim().isEmpty()) { - autoField = (Boolean) TypeManager.convertFromString(value.trim(), Boolean.class); - } - return; - } - - if (STRICT_MODE_ATTRIBUTE.equals(property)) { - if (value != null && !value.trim().isEmpty()) { - strictMode = (Boolean) TypeManager.convertFromString(value.trim(), Boolean.class); - } - return; - } - - if (PARENT_VALIDATOR_ATTRIBUTE.equals(property)) { - if (value != null && !value.trim().isEmpty()) { - parentValidator = value.trim(); - } - return; - } - - throw new CompilerException("property " + property + " is not allowed on object " + this); - } - - public String getBean() { - return bean; - } - - public String getErrorListModel() { - return errorListModel; - } - - public boolean getAutoField() { - return autoField != null && autoField; - } - - public boolean getStrictMode() { - return strictMode != null && strictMode; - } - - public String getUiClass() { - return uiClass; - } - - public String getBeanClass() { - return beanClass; - } - - public String getContextName() { - return contextName; - } - - public String getParentValidator() { - return parentValidator; - } - - public JAXXBeanInfo getBeanDescriptor(JAXXCompiler compiler) { - if (beanDescriptor == null && foundBean()) { - - String beanClassName = null; - try { - //TC-20090111 beanClass is mandatory - // get the real bean class name (from bean or beanClass) - /*if (beanClass != null) { - beanClassName = beanClass; - } else { - beanClassName = compiler.getSymbolTable().getClassTagIds().get(bean); - if (beanClassName == null) { - compiler.reportError("could not find class of the bean '" + bean + "'"); - return null; - } - }*/ - ClassDescriptor beanClassDescriptor = ClassDescriptorLoader.getClassDescriptor(beanClass); - beanDescriptor = DefaultObjectHandler.getJAXXBeanInfo(beanClassDescriptor); - } catch (ClassNotFoundException e) { - compiler.reportError("could not load class " + beanClassName); - } catch (IntrospectionException e) { - compiler.reportError("could not load class " + beanClassName); - } - } - return beanDescriptor; - } - - @Override - public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException { - // do nothing - compiler.reportError("can not add CompiledObject in the tag '" + TAG + " (only field tags)"); - } - - public boolean foundBean() { - return !(beanClass == null || beanClass.isEmpty()); - } - - protected boolean addUiClass(BeanValidatorHandler handler, JAXXCompiler compiler) { - boolean withError = false; - if (uiClass == null && compiler.getConfiguration().getDefaultErrorUI() != null) { - uiClass = compiler.getConfiguration().getDefaultErrorUI().getName(); - } - if (uiClass != null) { - try { - ClassDescriptor uiClazz = ClassDescriptorLoader.getClassDescriptor(uiClass); - if (!ClassDescriptorLoader.getClassDescriptor(AbstractBeanValidatorUI.class).isAssignableFrom(uiClazz)) { - compiler.reportError("attribute 'ui' :'" + uiClass + "' is not assignable from class " + AbstractBeanValidatorUI.class); - withError = true; - } else { - String code = handler.getSetPropertyCode(getJavaCode(), UI_CLASS_ATTRIBUTE, uiClazz.getName() + ".class", compiler); - appendAdditionCode(code); - } - } catch (ClassNotFoundException e) { - compiler.reportError("class not found '" + uiClass + "'"); - withError = true; - } - } - - return withError; - } - - protected boolean addErrorListModel(Element tag, BeanValidatorHandler handler, JAXXCompiler compiler) { - if (errorListModel == null) { - // try with the default "errors" - if (!compiler.checkReference(tag, ERROR_LIST_MODEL_DEFAULT, false, ERROR_LIST_MODEL_ATTRIBUTE)) { - return false; - } - errorListModel = ERROR_LIST_MODEL_DEFAULT; - } else { - if (errorListModel.startsWith("{") && errorListModel.endsWith("}")) { - // this is a script, no check here - errorListModel = errorListModel.substring(1, errorListModel.length() - 1).trim(); - } else if (!compiler.checkReference(tag, errorListModel, true, ERROR_LIST_MODEL_ATTRIBUTE)) { - // errorListModel is not defined - return true; - } - } - - String code = handler.getSetPropertyCode(getJavaCode(), ERROR_LIST_MODEL_ATTRIBUTE, errorListModel, compiler); - appendAdditionCode(code); - - return false; - } - - protected boolean addErrorTableModel(Element tag, BeanValidatorHandler handler, JAXXCompiler compiler) { - if (errorTableModel == null) { - // try with the default "errors" - if (!compiler.checkReference(tag, ERROR_TABLE_MODEL_DEFAULT, false, ERROR_LIST_MODEL_ATTRIBUTE)) { - return false; - } - errorTableModel = ERROR_TABLE_MODEL_DEFAULT; - } else { - if (errorTableModel.startsWith("{") && errorTableModel.endsWith("}")) { - // this is a script, no check here - errorTableModel = errorTableModel.substring(1, errorTableModel.length() - 1).trim(); - } else if (!compiler.checkReference(tag, errorTableModel, true, ERROR_TABLE_MODEL_ATTRIBUTE)) { - // errorListModel is not defined - return true; - } - } - - String code = handler.getSetPropertyCode(getJavaCode(), ERROR_TABLE_MODEL_ATTRIBUTE, errorTableModel, compiler); - appendAdditionCode(code); - - return false; - - } - - protected boolean addParentValidator(Element tag, BeanValidatorHandler handler, JAXXCompiler compiler) { - if (parentValidator != null) { - String initializer; - if (parentValidator.startsWith("{") && parentValidator.endsWith("}")) { - - // todo : should be able to bind - initializer = parentValidator.substring(1, parentValidator.length() - 1); - - } else { - // the attribute referes an existing widget - if (!compiler.checkReference(tag, parentValidator, true, PARENT_VALIDATOR_ATTRIBUTE)) { - // parentValidator is not defined - return true; - } - initializer = parentValidator; - } - String code = handler.getSetPropertyCode(getJavaCode(), PARENT_VALIDATOR_ATTRIBUTE, initializer, compiler); - appendAdditionCode(code); - } - return false; - } - - protected boolean addErrorList(Element tag, JAXXCompiler compiler) { - - if (errorList == null) { - // try with the default "errorList" - if (!compiler.checkReference(tag, ERROR_LIST_DEFAULT, false, ERROR_LIST_ATTRIBUTE)) { - return false; - } - errorList = ERROR_LIST_DEFAULT; - } else { - if (!compiler.checkReference(tag, errorList, true, ERROR_LIST_ATTRIBUTE)) { - return true; - } - } - - String code = SwingValidatorUtil.class.getName() + ".registerErrorListMouseListener(" + errorList + ");"; - appendAdditionCode(code); - - return false; - } - - protected boolean addErrorTable(Element tag, JAXXCompiler compiler) { - - if (errorTable == null) { - // try with the default "errorList" - if (!compiler.checkReference(tag, ERROR_TABLE_DEFAULT, false, ERROR_TABLE_ATTRIBUTE)) { - return false; - } - errorTable = ERROR_TABLE_DEFAULT; - } else { - if (!compiler.checkReference(tag, errorTable, true, ERROR_TABLE_ATTRIBUTE)) { - return true; - } - } - - String code = SwingValidatorUtil.class.getName() + ".registerErrorTableMouseListener(" + errorTable + ");"; - appendAdditionCode(code); - - return false; - } - - protected boolean addBean(Element tag, BeanValidatorHandler handler, JAXXCompiler compiler) { - - if (beanClass == null || beanClass.isEmpty()) { - // try to guest beanClass from bean attribute - if (bean != null && !bean.isEmpty()) { - beanClass = compiler.getSymbolTable().getClassTagIds().get(bean); - if (beanClass == null) { - compiler.reportError("could not find class of the bean '" + bean + "', and no beanClass was setted"); - return true; - } - } - } - if (beanClass == null) { - compiler.reportError("tag '" + tag + "' requires a 'beanClass' attribute, and could not guest it from 'bean' attribute (no bean attribute setted...)"); - return true; - } - - JAXXBeanInfo beanInfo = getBeanDescriptor(compiler); - if (beanInfo == null) { - compiler.reportError(tag, "could not find descriptor of class " + beanClass); - return true; - } - - String beanInitializer = null; - if (bean != null) { - - if (bean.startsWith("{") && bean.endsWith("}")) { - - // just has an intializer - beanInitializer = bean.substring(1, bean.length() - 1); - // this is not a real bean, so delete it - bean = null; - } else { - - if (!compiler.checkReference(tag, bean, true, BEAN_ATTRIBUTE)) { - // could not find bean in compiled object - return true; - } - - if (isBeanUsedByValidator(compiler, bean)) { - compiler.reportError("the bean '" + bean + "' is already used in another the validator, can not used it in '" + tag + "'"); - return true; - } - - /*if (beanInitializer != null) { - compiler.reportWarning("tag '" + tag + "' found a 'bean' and a 'beanInitializer' attributes, 'beanInitializer' is skipped"); - }*/ - beanInitializer = bean; - } - } - - if (beanInitializer != null) { - String code = handler.getSetPropertyCode(getJavaCode(), BEAN_ATTRIBUTE, compiler.checkJavaCode(beanInitializer), compiler); - appendAdditionCode(code); - } - - String beanClassName = beanInfo.getJAXXBeanDescriptor().getClassDescriptor().getName(); - // contextName must be in constructor to able to init validator with his correct contextName - setConstructorParams(beanClassName + ".class, " + compiler.getJavaCode(contextName)); - // add generic type to validator - setGenericTypes(new String[]{beanClassName}); - - if (getAutoField()) { - registerAutoFieldBean(tag, compiler, beanInfo); - } - - if (getBeanDescriptor(compiler) != null) { - - // add fieldrepresentation invocations - addFieldRepresentations(tag, compiler); - - // register the validator in compiler - registerValidator(compiler, this); - - } - - return false; - } - - private void registerValidator(JAXXCompiler compiler, CompiledBeanValidator compiledBeanValidator) { - List<CompiledBeanValidator> vals = validators.get(compiler); - if (vals == null) { - vals = new ArrayList<CompiledBeanValidator>(); - validators.put(compiler, vals); - } - vals.add(compiledBeanValidator); - List<String> ids = validatedComponents.get(compiler); - if (ids == null) { - ids = new ArrayList<String>(); - validatedComponents.put(compiler, ids); - } - ids.addAll(compiledBeanValidator.getFields().values()); - } - - protected void addFieldRepresentations(Element tag, JAXXCompiler compiler) { - for (Entry<String, String> entry : fields.entrySet()) { - String propertyName = entry.getKey(); - String component = entry.getValue(); - if (!checkBeanProperty(compiler, propertyName)) { - // property not find on bean - continue; - } - if (!compiler.checkReference(tag, component, true, null)) { - // editor component not find on ui - continue; - } - String keyCode = compiler.getJavaCode(propertyName); - appendAdditionCode(getJavaCode() + ".setFieldRepresentation(" + keyCode + ", " + component + ");"); - } - } - - protected void registerAutoFieldBean(Element tag, JAXXCompiler compiler, JAXXBeanInfo beanInfo) { - for (JAXXPropertyDescriptor beanProperty : beanInfo.getJAXXPropertyDescriptors()) { - String descriptionName = beanProperty.getName(); - if (log.isDebugEnabled()) { - log.debug("try to bind on bean " + beanInfo.getJAXXBeanDescriptor().getName() + " property " + descriptionName); - } - if (beanProperty.getWriteMethodDescriptor() == null) { - // read-only property - continue; - } - if (fields.containsKey(descriptionName)) { - // already defined in field - continue; - } - if (excludeFields.containsKey(descriptionName)) { - // exclude field - continue; - } - if (!compiler.checkReference(tag, descriptionName, getStrictMode(), null)) { - // no editor component found - continue; - } - // ok add the field mapping - registerField(descriptionName, descriptionName, compiler); - } - - for (Entry<String, String> entry : excludeFields.entrySet()) { - String key = entry.getKey(); - if (fields.containsKey(key)) { - compiler.reportWarning("field '" + key + "' can not be used and excluded at same time ! (field is skipped) for validator " + this); - fields.remove(key); - } - } - } - - public void registerField(String id, String component, JAXXCompiler compiler) { - if (fields.containsKey(id)) { - compiler.reportError("duplicate field '" + id + "' for validator " + this); - } else { - if (log.isDebugEnabled()) { - log.debug("add field <" + id + ":" + component + ">"); - } - fields.put(id, component); - } - } - - public void registerExcludeField(String id, String component, JAXXCompiler compiler) { - if (excludeFields.containsKey(id)) { - compiler.reportError("duplicate field '" + id + "' for validator " + this); - } else { - if (log.isDebugEnabled()) { - log.debug("add excludeField <" + id + ":" + component + ">"); - } - excludeFields.put(id, component); - } - } - - protected boolean checkBeanProperty(JAXXCompiler compiler, String propertyName) { - - for (JAXXPropertyDescriptor beanProperty : getBeanDescriptor(compiler).getJAXXPropertyDescriptors()) { - if (beanProperty.getName().equals(propertyName)) { - if (beanProperty.getWriteMethodDescriptor() == null) { - // read-onlyproperty - compiler.reportError("could not bind the readonly property '" + propertyName + "' on bean [" + getBean() + "] "); - return false; - } - return true; - } - } - compiler.reportError("could not find the property '" + propertyName + "' on bean [" + getBean() + "] "); - return false; - } - } - - /** - * Test if a given bean is attached to a validator. - * - * @param compiler current compiler to use - * @param beanId the bean to test - * @return <code>true</code> if the given bean is attached to a validator, <code>false</code> otherwise - */ - public static boolean isBeanUsedByValidator(JAXXCompiler compiler, String beanId) { - List<CompiledBeanValidator> beanValidatorList = validators.get(compiler); - if (beanValidatorList != null) { - for (CompiledBeanValidator validator : beanValidatorList) { - if (beanId.equals(validator.getBean())) { - return true; - } - } - } - return false; - } - - /** - * @param compiler compiler to use - * @return <code>true</code> if some validators were detected, <code>false</code> otherwise - */ - public static boolean hasValidator(JAXXCompiler compiler) { - List<CompiledBeanValidator> beanValidatorList = validators.get(compiler); - return beanValidatorList != null && !beanValidatorList.isEmpty(); - } - - /** - * Test if a given CompiledObject is attached to a validator. - * - * @param compiler compiler to use - * @param componentId the compiled object to test - * @return <code>true</code> if the given compiled object is attached to a validator, <code>false</code> otherwise - */ - public static boolean isComponentUsedByValidator(JAXXCompiler compiler, String componentId) { - List<String> ids = validatedComponents.get(compiler); - return ids != null && ids.contains(componentId); - } - - public static List<CompiledBeanValidator> getValidators(JAXXCompiler compiler) { - return validators.get(compiler); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.validator; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.CompiledObject; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.beans.JAXXBeanInfo; +import jaxx.compiler.beans.JAXXPropertyDescriptor; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.DefaultObjectHandler; +import jaxx.compiler.types.TypeManager; +import jaxx.runtime.validator.swing.SwingValidatorUtil; +import jaxx.runtime.validator.swing.SwingValidator; +import jaxx.runtime.validator.swing.ui.AbstractBeanValidatorUI; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.w3c.dom.Element; + +import java.beans.IntrospectionException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TreeMap; + +public class BeanValidatorHandler extends DefaultObjectHandler { + + public static final String TAG = "BeanValidator"; + public static final String BEAN_ATTRIBUTE = "bean"; + public static final String BEAN_CLASS_ATTRIBUTE = "beanClass"; + public static final String BEAN_INITIALIZER_ATTRIBUTE = "beanInitializer"; + public static final String ERROR_LIST_MODEL_ATTRIBUTE = "errorListModel"; + public static final String ERROR_TABLE_MODEL_ATTRIBUTE = "errorTableModel"; + public static final String ERROR_LIST_ATTRIBUTE = "errorList"; + public static final String ERROR_TABLE_ATTRIBUTE = "errorTable"; + //TODO-TC20091024 should change this default value to errorListModel + public static final String ERROR_LIST_MODEL_DEFAULT = "errors"; + //TODO-TC20091024 should change this default value to errorTableModel + public static final String ERROR_TABLE_MODEL_DEFAULT = "errors2"; + public static final String ERROR_LIST_DEFAULT = "errorList"; + public static final String ERROR_TABLE_DEFAULT = "errorTable"; + public static final String AUTOFIELD_ATTRIBUTE = "autoField"; + public static final String UI_CLASS_ATTRIBUTE = "uiClass"; + public static final String STRICT_MODE_ATTRIBUTE = "strictMode"; + public static final String CONTEXT_NAME_ATTRIBUTE = "contextName"; + //public static final String SCOPE_ATTRIBUTE = "scope"; + public static final String PARENT_VALIDATOR_ATTRIBUTE = "parentValidator"; + /** to use log facility, just put in your code: log.info(\"...\"); */ + static Log log = LogFactory.getLog(BeanValidatorHandler.class); + protected static Map<JAXXCompiler, List<CompiledBeanValidator>> validators = new HashMap<JAXXCompiler, List<CompiledBeanValidator>>(); + protected static Map<JAXXCompiler, List<String>> validatedComponents = new HashMap<JAXXCompiler, List<String>>(); + + public BeanValidatorHandler(ClassDescriptor beanClass) { + super(beanClass); + ClassDescriptorLoader.checkSupportClass(getClass(), beanClass, SwingValidator.class); + } + + @Override + protected CompiledObject createCompiledObject(String id, JAXXCompiler compiler) { + return new CompiledBeanValidator(id, getBeanClass(), compiler); + } + + @Override + protected void compileChildTagFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + if (log.isDebugEnabled()) { + log.debug(tag); + } + if (!tag.getLocalName().equals(FieldValidatorHandler.TAG)) { + compiler.reportError("tag '" + tag.getParentNode().getLocalName() + "' may only contain " + FieldValidatorHandler.TAG + " as children, but found : " + tag.getLocalName()); + } else { + compiler.compileFirstPass(tag); + } + } + + @Override + public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + + super.compileSecondPass(tag, compiler); + + CompiledBeanValidator info = (CompiledBeanValidator) objectMap.get(tag); + + boolean error = info.addErrorListModel(tag, this, compiler); + + if (!error) { + error = info.addErrorList(tag, compiler); + } + + if (!error) { + error = info.addErrorTableModel(tag, this, compiler); + } + + if (!error) { + error = info.addErrorTable(tag, compiler); + } + + if (!error) { + error = info.addUiClass(this, compiler); + } + + if (!error) { + error = info.addBean(tag, this, compiler); + } + + /*if (!error) { + error = info.addContextName(this, compiler); + }*/ + + /*if (!error) { + error = info.addScope(this, compiler); + }*/ + + if (!error) { + error = info.addParentValidator(tag, this, compiler); + } + + if (error) { + log.warn("error were detected in second compile pass of CompiledObject [" + info + "]"); + } + + // close the compiled object + compiler.closeComponent(info); + } + + @Override + protected void setDefaults(CompiledObject object, Element tag, JAXXCompiler compiler) { + // open the compiled object + compiler.openInvisibleComponent(object); + } + + @Override + public void setAttribute(CompiledObject object, String propertyName, String stringValue, boolean inline, JAXXCompiler compiler) { + if (log.isDebugEnabled()) { + log.debug(propertyName + " : " + stringValue + " for " + object); + } + // delegate to the compiled object with is statefull (but not the tag handler) + object.addProperty(propertyName, stringValue); + } + + /** + * The compiled objet representing a BeanValidator to be generated in JAXXObject + * + * @author chemit + */ + public static class CompiledBeanValidator extends CompiledObject { + + protected Map<String, String> fields; + protected Map<String, String> excludeFields; + protected String bean; + protected String beanClass; + protected String contextName; + protected String uiClass; + protected String errorListModel; + protected String errorList; + protected Boolean autoField; + protected Boolean strictMode; + protected JAXXBeanInfo beanDescriptor; + protected String errorTableModel; + protected String errorTable; + protected String parentValidator; + + public CompiledBeanValidator(String id, ClassDescriptor objectClass, JAXXCompiler compiler) { + //TC-20090524 Use the real class descriptor, not the one by default, + //TC-20090524 otherwise can not override the validator class while generation + //super(id, objectClass, compiler); + super(id, getDescriptor(objectClass, compiler), compiler); + fields = new TreeMap<String, String>(); + excludeFields = new TreeMap<String, String>(); + if (log.isDebugEnabled()) { + log.debug("validator objectClass " + super.getObjectClass()); + } + } + + protected static ClassDescriptor getDescriptor(ClassDescriptor objectClass, JAXXCompiler compiler) { + ClassDescriptor result = objectClass; + Class<?> validatorClass = compiler.getConfiguration().getValidatorClass(); + result = ClassDescriptorLoader.getClassDescriptor(validatorClass); + return result; + } + + public Map<String, String> getFields() { + return fields; + } + + public Map<String, String> getExcludeFields() { + return excludeFields; + } + + public void setFields(Map<String, String> fields) { + this.fields = fields; + } + + public void setExcludeFields(Map<String, String> excludeFields) { + this.excludeFields = excludeFields; + } + + @Override + public void addProperty(String property, String value) { + + if (BEAN_ATTRIBUTE.equals(property)) { + if (value != null && !value.trim().isEmpty()) { + bean = value.trim(); + } + return; + } + + if (CONTEXT_NAME_ATTRIBUTE.equals(property)) { + if (value != null && !value.trim().isEmpty()) { + contextName = value.trim(); + } + return; + } + + if (BEAN_CLASS_ATTRIBUTE.equals(property)) { + if (value != null && !value.trim().isEmpty()) { + beanClass = value.trim(); + } + return; + } + + if (ERROR_LIST_MODEL_ATTRIBUTE.equals(property)) { + if (value != null && !value.trim().isEmpty()) { + errorListModel = value.trim(); + } + return; + } + + if (ERROR_LIST_ATTRIBUTE.equals(property)) { + if (value != null && !value.trim().isEmpty()) { + errorList = value.trim(); + } + return; + } + + if (ERROR_TABLE_MODEL_ATTRIBUTE.equals(property)) { + if (value != null && !value.trim().isEmpty()) { + errorTableModel = value.trim(); + } + return; + } + + if (ERROR_TABLE_ATTRIBUTE.equals(property)) { + if (value != null && !value.trim().isEmpty()) { + errorTable = value.trim(); + } + return; + } + + if (UI_CLASS_ATTRIBUTE.equals(property)) { + if (value != null && !value.trim().isEmpty()) { + uiClass = value.trim(); + } + return; + } + + if (AUTOFIELD_ATTRIBUTE.equals(property)) { + if (value != null && !value.trim().isEmpty()) { + autoField = (Boolean) TypeManager.convertFromString(value.trim(), Boolean.class); + } + return; + } + + if (STRICT_MODE_ATTRIBUTE.equals(property)) { + if (value != null && !value.trim().isEmpty()) { + strictMode = (Boolean) TypeManager.convertFromString(value.trim(), Boolean.class); + } + return; + } + + if (PARENT_VALIDATOR_ATTRIBUTE.equals(property)) { + if (value != null && !value.trim().isEmpty()) { + parentValidator = value.trim(); + } + return; + } + + throw new CompilerException("property " + property + " is not allowed on object " + this); + } + + public String getBean() { + return bean; + } + + public String getErrorListModel() { + return errorListModel; + } + + public boolean getAutoField() { + return autoField != null && autoField; + } + + public boolean getStrictMode() { + return strictMode != null && strictMode; + } + + public String getUiClass() { + return uiClass; + } + + public String getBeanClass() { + return beanClass; + } + + public String getContextName() { + return contextName; + } + + public String getParentValidator() { + return parentValidator; + } + + public JAXXBeanInfo getBeanDescriptor(JAXXCompiler compiler) { + if (beanDescriptor == null && foundBean()) { + + String beanClassName = null; + try { + //TC-20090111 beanClass is mandatory + // get the real bean class name (from bean or beanClass) + /*if (beanClass != null) { + beanClassName = beanClass; + } else { + beanClassName = compiler.getSymbolTable().getClassTagIds().get(bean); + if (beanClassName == null) { + compiler.reportError("could not find class of the bean '" + bean + "'"); + return null; + } + }*/ + ClassDescriptor beanClassDescriptor = ClassDescriptorLoader.getClassDescriptor(beanClass); + beanDescriptor = DefaultObjectHandler.getJAXXBeanInfo(beanClassDescriptor); + } catch (ClassNotFoundException e) { + compiler.reportError("could not load class " + beanClassName); + } catch (IntrospectionException e) { + compiler.reportError("could not load class " + beanClassName); + } + } + return beanDescriptor; + } + + @Override + public void addChild(CompiledObject child, String constraints, JAXXCompiler compiler) throws CompilerException { + // do nothing + compiler.reportError("can not add CompiledObject in the tag '" + TAG + " (only field tags)"); + } + + public boolean foundBean() { + return !(beanClass == null || beanClass.isEmpty()); + } + + protected boolean addUiClass(BeanValidatorHandler handler, JAXXCompiler compiler) { + boolean withError = false; + if (uiClass == null && compiler.getConfiguration().getDefaultErrorUI() != null) { + uiClass = compiler.getConfiguration().getDefaultErrorUI().getName(); + } + if (uiClass != null) { + try { + ClassDescriptor uiClazz = ClassDescriptorLoader.getClassDescriptor(uiClass); + if (!ClassDescriptorLoader.getClassDescriptor(AbstractBeanValidatorUI.class).isAssignableFrom(uiClazz)) { + compiler.reportError("attribute 'ui' :'" + uiClass + "' is not assignable from class " + AbstractBeanValidatorUI.class); + withError = true; + } else { + String code = handler.getSetPropertyCode(getJavaCode(), UI_CLASS_ATTRIBUTE, uiClazz.getName() + ".class", compiler); + appendAdditionCode(code); + } + } catch (ClassNotFoundException e) { + compiler.reportError("class not found '" + uiClass + "'"); + withError = true; + } + } + + return withError; + } + + protected boolean addErrorListModel(Element tag, BeanValidatorHandler handler, JAXXCompiler compiler) { + if (errorListModel == null) { + // try with the default "errors" + if (!compiler.checkReference(tag, ERROR_LIST_MODEL_DEFAULT, false, ERROR_LIST_MODEL_ATTRIBUTE)) { + return false; + } + errorListModel = ERROR_LIST_MODEL_DEFAULT; + } else { + if (errorListModel.startsWith("{") && errorListModel.endsWith("}")) { + // this is a script, no check here + errorListModel = errorListModel.substring(1, errorListModel.length() - 1).trim(); + } else if (!compiler.checkReference(tag, errorListModel, true, ERROR_LIST_MODEL_ATTRIBUTE)) { + // errorListModel is not defined + return true; + } + } + + String code = handler.getSetPropertyCode(getJavaCode(), ERROR_LIST_MODEL_ATTRIBUTE, errorListModel, compiler); + appendAdditionCode(code); + + return false; + } + + protected boolean addErrorTableModel(Element tag, BeanValidatorHandler handler, JAXXCompiler compiler) { + if (errorTableModel == null) { + // try with the default "errors" + if (!compiler.checkReference(tag, ERROR_TABLE_MODEL_DEFAULT, false, ERROR_LIST_MODEL_ATTRIBUTE)) { + return false; + } + errorTableModel = ERROR_TABLE_MODEL_DEFAULT; + } else { + if (errorTableModel.startsWith("{") && errorTableModel.endsWith("}")) { + // this is a script, no check here + errorTableModel = errorTableModel.substring(1, errorTableModel.length() - 1).trim(); + } else if (!compiler.checkReference(tag, errorTableModel, true, ERROR_TABLE_MODEL_ATTRIBUTE)) { + // errorListModel is not defined + return true; + } + } + + String code = handler.getSetPropertyCode(getJavaCode(), ERROR_TABLE_MODEL_ATTRIBUTE, errorTableModel, compiler); + appendAdditionCode(code); + + return false; + + } + + protected boolean addParentValidator(Element tag, BeanValidatorHandler handler, JAXXCompiler compiler) { + if (parentValidator != null) { + String initializer; + if (parentValidator.startsWith("{") && parentValidator.endsWith("}")) { + + // todo : should be able to bind + initializer = parentValidator.substring(1, parentValidator.length() - 1); + + } else { + // the attribute referes an existing widget + if (!compiler.checkReference(tag, parentValidator, true, PARENT_VALIDATOR_ATTRIBUTE)) { + // parentValidator is not defined + return true; + } + initializer = parentValidator; + } + String code = handler.getSetPropertyCode(getJavaCode(), PARENT_VALIDATOR_ATTRIBUTE, initializer, compiler); + appendAdditionCode(code); + } + return false; + } + + protected boolean addErrorList(Element tag, JAXXCompiler compiler) { + + if (errorList == null) { + // try with the default "errorList" + if (!compiler.checkReference(tag, ERROR_LIST_DEFAULT, false, ERROR_LIST_ATTRIBUTE)) { + return false; + } + errorList = ERROR_LIST_DEFAULT; + } else { + if (!compiler.checkReference(tag, errorList, true, ERROR_LIST_ATTRIBUTE)) { + return true; + } + } + + String code = SwingValidatorUtil.class.getName() + ".registerErrorListMouseListener(" + errorList + ");"; + appendAdditionCode(code); + + return false; + } + + protected boolean addErrorTable(Element tag, JAXXCompiler compiler) { + + if (errorTable == null) { + // try with the default "errorList" + if (!compiler.checkReference(tag, ERROR_TABLE_DEFAULT, false, ERROR_TABLE_ATTRIBUTE)) { + return false; + } + errorTable = ERROR_TABLE_DEFAULT; + } else { + if (!compiler.checkReference(tag, errorTable, true, ERROR_TABLE_ATTRIBUTE)) { + return true; + } + } + + String code = SwingValidatorUtil.class.getName() + ".registerErrorTableMouseListener(" + errorTable + ");"; + appendAdditionCode(code); + + return false; + } + + protected boolean addBean(Element tag, BeanValidatorHandler handler, JAXXCompiler compiler) { + + if (beanClass == null || beanClass.isEmpty()) { + // try to guest beanClass from bean attribute + if (bean != null && !bean.isEmpty()) { + beanClass = compiler.getSymbolTable().getClassTagIds().get(bean); + if (beanClass == null) { + compiler.reportError("could not find class of the bean '" + bean + "', and no beanClass was setted"); + return true; + } + } + } + if (beanClass == null) { + compiler.reportError("tag '" + tag + "' requires a 'beanClass' attribute, and could not guest it from 'bean' attribute (no bean attribute setted...)"); + return true; + } + + JAXXBeanInfo beanInfo = getBeanDescriptor(compiler); + if (beanInfo == null) { + compiler.reportError(tag, "could not find descriptor of class " + beanClass); + return true; + } + + String beanInitializer = null; + if (bean != null) { + + if (bean.startsWith("{") && bean.endsWith("}")) { + + // just has an intializer + beanInitializer = bean.substring(1, bean.length() - 1); + // this is not a real bean, so delete it + bean = null; + } else { + + if (!compiler.checkReference(tag, bean, true, BEAN_ATTRIBUTE)) { + // could not find bean in compiled object + return true; + } + + if (isBeanUsedByValidator(compiler, bean)) { + compiler.reportError("the bean '" + bean + "' is already used in another the validator, can not used it in '" + tag + "'"); + return true; + } + + /*if (beanInitializer != null) { + compiler.reportWarning("tag '" + tag + "' found a 'bean' and a 'beanInitializer' attributes, 'beanInitializer' is skipped"); + }*/ + beanInitializer = bean; + } + } + + if (beanInitializer != null) { + String code = handler.getSetPropertyCode(getJavaCode(), BEAN_ATTRIBUTE, compiler.checkJavaCode(beanInitializer), compiler); + appendAdditionCode(code); + } + + String beanClassName = beanInfo.getJAXXBeanDescriptor().getClassDescriptor().getName(); + // contextName must be in constructor to able to init validator with his correct contextName + setConstructorParams(beanClassName + ".class, " + compiler.getJavaCode(contextName)); + // add generic type to validator + setGenericTypes(new String[]{beanClassName}); + + if (getAutoField()) { + registerAutoFieldBean(tag, compiler, beanInfo); + } + + if (getBeanDescriptor(compiler) != null) { + + // add fieldrepresentation invocations + addFieldRepresentations(tag, compiler); + + // register the validator in compiler + registerValidator(compiler, this); + + } + + return false; + } + + private void registerValidator(JAXXCompiler compiler, CompiledBeanValidator compiledBeanValidator) { + List<CompiledBeanValidator> vals = validators.get(compiler); + if (vals == null) { + vals = new ArrayList<CompiledBeanValidator>(); + validators.put(compiler, vals); + } + vals.add(compiledBeanValidator); + List<String> ids = validatedComponents.get(compiler); + if (ids == null) { + ids = new ArrayList<String>(); + validatedComponents.put(compiler, ids); + } + ids.addAll(compiledBeanValidator.getFields().values()); + } + + protected void addFieldRepresentations(Element tag, JAXXCompiler compiler) { + for (Entry<String, String> entry : fields.entrySet()) { + String propertyName = entry.getKey(); + String component = entry.getValue(); + if (!checkBeanProperty(compiler, propertyName)) { + // property not find on bean + continue; + } + if (!compiler.checkReference(tag, component, true, null)) { + // editor component not find on ui + continue; + } + String keyCode = compiler.getJavaCode(propertyName); + appendAdditionCode(getJavaCode() + ".setFieldRepresentation(" + keyCode + ", " + component + ");"); + } + } + + protected void registerAutoFieldBean(Element tag, JAXXCompiler compiler, JAXXBeanInfo beanInfo) { + for (JAXXPropertyDescriptor beanProperty : beanInfo.getJAXXPropertyDescriptors()) { + String descriptionName = beanProperty.getName(); + if (log.isDebugEnabled()) { + log.debug("try to bind on bean " + beanInfo.getJAXXBeanDescriptor().getName() + " property " + descriptionName); + } + if (beanProperty.getWriteMethodDescriptor() == null) { + // read-only property + continue; + } + if (fields.containsKey(descriptionName)) { + // already defined in field + continue; + } + if (excludeFields.containsKey(descriptionName)) { + // exclude field + continue; + } + if (!compiler.checkReference(tag, descriptionName, getStrictMode(), null)) { + // no editor component found + continue; + } + // ok add the field mapping + registerField(descriptionName, descriptionName, compiler); + } + + for (Entry<String, String> entry : excludeFields.entrySet()) { + String key = entry.getKey(); + if (fields.containsKey(key)) { + compiler.reportWarning("field '" + key + "' can not be used and excluded at same time ! (field is skipped) for validator " + this); + fields.remove(key); + } + } + } + + public void registerField(String id, String component, JAXXCompiler compiler) { + if (fields.containsKey(id)) { + compiler.reportError("duplicate field '" + id + "' for validator " + this); + } else { + if (log.isDebugEnabled()) { + log.debug("add field <" + id + ":" + component + ">"); + } + fields.put(id, component); + } + } + + public void registerExcludeField(String id, String component, JAXXCompiler compiler) { + if (excludeFields.containsKey(id)) { + compiler.reportError("duplicate field '" + id + "' for validator " + this); + } else { + if (log.isDebugEnabled()) { + log.debug("add excludeField <" + id + ":" + component + ">"); + } + excludeFields.put(id, component); + } + } + + protected boolean checkBeanProperty(JAXXCompiler compiler, String propertyName) { + + for (JAXXPropertyDescriptor beanProperty : getBeanDescriptor(compiler).getJAXXPropertyDescriptors()) { + if (beanProperty.getName().equals(propertyName)) { + if (beanProperty.getWriteMethodDescriptor() == null) { + // read-onlyproperty + compiler.reportError("could not bind the readonly property '" + propertyName + "' on bean [" + getBean() + "] "); + return false; + } + return true; + } + } + compiler.reportError("could not find the property '" + propertyName + "' on bean [" + getBean() + "] "); + return false; + } + } + + /** + * Test if a given bean is attached to a validator. + * + * @param compiler current compiler to use + * @param beanId the bean to test + * @return <code>true</code> if the given bean is attached to a validator, <code>false</code> otherwise + */ + public static boolean isBeanUsedByValidator(JAXXCompiler compiler, String beanId) { + List<CompiledBeanValidator> beanValidatorList = validators.get(compiler); + if (beanValidatorList != null) { + for (CompiledBeanValidator validator : beanValidatorList) { + if (beanId.equals(validator.getBean())) { + return true; + } + } + } + return false; + } + + /** + * @param compiler compiler to use + * @return <code>true</code> if some validators were detected, <code>false</code> otherwise + */ + public static boolean hasValidator(JAXXCompiler compiler) { + List<CompiledBeanValidator> beanValidatorList = validators.get(compiler); + return beanValidatorList != null && !beanValidatorList.isEmpty(); + } + + /** + * Test if a given CompiledObject is attached to a validator. + * + * @param compiler compiler to use + * @param componentId the compiled object to test + * @return <code>true</code> if the given compiled object is attached to a validator, <code>false</code> otherwise + */ + public static boolean isComponentUsedByValidator(JAXXCompiler compiler, String componentId) { + List<String> ids = validatedComponents.get(compiler); + return ids != null && ids.contains(componentId); + } + + public static List<CompiledBeanValidator> getValidators(JAXXCompiler compiler) { + return validators.get(compiler); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/ExcludeFieldValidatorHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/ExcludeFieldValidatorHandler.java index b5dd409..6b2fccc 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/ExcludeFieldValidatorHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/ExcludeFieldValidatorHandler.java @@ -1,85 +1,101 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.validator; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.TagHandler; -import jaxx.compiler.tags.validator.BeanValidatorHandler.CompiledBeanValidator; -import jaxx.runtime.validator.swing.SwingValidator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Element; - -import java.io.IOException; - -public class ExcludeFieldValidatorHandler implements TagHandler { - - public static final String TAG = "excludeField"; - public static final String NAME_ATTRIBUTE = "name"; - public static final String COMPONENT_ATTRIBUTE = "component"; - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private Log log = LogFactory.getLog(ExcludeFieldValidatorHandler.class); - - @Override - public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - if (compiler.getConfiguration().isVerbose()) { - log.info(tag); - } - //todo check there is no child - } - - @Override - public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - if (compiler.getConfiguration().isVerbose()) { - log.debug(tag); - } - - if (!ClassDescriptorLoader.getClassDescriptor(SwingValidator.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) { - compiler.reportError(TAG + " tag may only appear within " + BeanValidatorHandler.TAG + " tag but was " + tag); - return; - } - - CompiledBeanValidator info = (CompiledBeanValidator) compiler.getOpenComponent(); - if (!info.getAutoField()) { - compiler.reportError(TAG + " tag can not be used without an 'autoField' validator : " + tag); - return; - } - String name = tag.getAttribute(NAME_ATTRIBUTE); - String component = tag.getAttribute(COMPONENT_ATTRIBUTE); - if (name == null || name.trim().isEmpty()) { - compiler.reportError(TAG + " tag requires a " + NAME_ATTRIBUTE + " attribute"); - return; - } - name = name.trim(); - if (component == null || component.trim().isEmpty()) { - // try to use the name as component - if (!compiler.checkReference(tag, name, false, name)) { - compiler.reportError(TAG + " tag requires a " + COMPONENT_ATTRIBUTE + " attribute, try to use the name attribute [" + name + "] for the component, but no such component found"); - return; - } - component = name; - } - component = component.trim(); - - // check component is not already used by this compiled object - if (info.getFields().containsValue(component)) { - compiler.reportError(TAG + " tag found a attribute " + COMPONENT_ATTRIBUTE + " [" + component + "] already used in this validator"); - return; - } - if (info.getExcludeFields().containsValue(component)) { - compiler.reportError(TAG + " tag found a attribute " + COMPONENT_ATTRIBUTE + " [" + component + "] already used in this validator"); - return; - } - // check component exist (again perharps, but let the error knows exactly which tag failed...) - if (compiler.checkReference(tag, component, true, COMPONENT_ATTRIBUTE)) { - // add a field - info.registerField(name, component, compiler); - } - - - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.validator; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.TagHandler; +import jaxx.compiler.tags.validator.BeanValidatorHandler.CompiledBeanValidator; +import jaxx.runtime.validator.swing.SwingValidator; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.w3c.dom.Element; + +import java.io.IOException; + +public class ExcludeFieldValidatorHandler implements TagHandler { + + public static final String TAG = "excludeField"; + public static final String NAME_ATTRIBUTE = "name"; + public static final String COMPONENT_ATTRIBUTE = "component"; + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private Log log = LogFactory.getLog(ExcludeFieldValidatorHandler.class); + + @Override + public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + if (compiler.getConfiguration().isVerbose()) { + log.info(tag); + } + //todo check there is no child + } + + @Override + public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + if (compiler.getConfiguration().isVerbose()) { + log.debug(tag); + } + + if (!ClassDescriptorLoader.getClassDescriptor(SwingValidator.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) { + compiler.reportError(TAG + " tag may only appear within " + BeanValidatorHandler.TAG + " tag but was " + tag); + return; + } + + CompiledBeanValidator info = (CompiledBeanValidator) compiler.getOpenComponent(); + if (!info.getAutoField()) { + compiler.reportError(TAG + " tag can not be used without an 'autoField' validator : " + tag); + return; + } + String name = tag.getAttribute(NAME_ATTRIBUTE); + String component = tag.getAttribute(COMPONENT_ATTRIBUTE); + if (name == null || name.trim().isEmpty()) { + compiler.reportError(TAG + " tag requires a " + NAME_ATTRIBUTE + " attribute"); + return; + } + name = name.trim(); + if (component == null || component.trim().isEmpty()) { + // try to use the name as component + if (!compiler.checkReference(tag, name, false, name)) { + compiler.reportError(TAG + " tag requires a " + COMPONENT_ATTRIBUTE + " attribute, try to use the name attribute [" + name + "] for the component, but no such component found"); + return; + } + component = name; + } + component = component.trim(); + + // check component is not already used by this compiled object + if (info.getFields().containsValue(component)) { + compiler.reportError(TAG + " tag found a attribute " + COMPONENT_ATTRIBUTE + " [" + component + "] already used in this validator"); + return; + } + if (info.getExcludeFields().containsValue(component)) { + compiler.reportError(TAG + " tag found a attribute " + COMPONENT_ATTRIBUTE + " [" + component + "] already used in this validator"); + return; + } + // check component exist (again perharps, but let the error knows exactly which tag failed...) + if (compiler.checkReference(tag, component, true, COMPONENT_ATTRIBUTE)) { + // add a field + info.registerField(name, component, compiler); + } + + + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java index 7010970..329c76b 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java @@ -1,78 +1,94 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.tags.validator; - -import jaxx.compiler.CompilerException; -import jaxx.compiler.JAXXCompiler; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.tags.TagHandler; -import jaxx.compiler.tags.validator.BeanValidatorHandler.CompiledBeanValidator; -import jaxx.runtime.validator.swing.SwingValidator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Element; - -import java.io.IOException; - -public class FieldValidatorHandler implements TagHandler { - - public static final String TAG = "field"; - public static final String NAME_ATTRIBUTE = "name"; - public static final String COMPONENT_ATTRIBUTE = "component"; - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private Log log = LogFactory.getLog(FieldValidatorHandler.class); - - @Override - public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - if (compiler.getConfiguration().isVerbose()) { - log.debug(tag); - } - //todo check there is no child - } - - @Override - public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - if (compiler.getConfiguration().isVerbose()) { - log.debug(tag); - } - - if (!ClassDescriptorLoader.getClassDescriptor(SwingValidator.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) { - compiler.reportError(TAG + " tag may only appear within " + BeanValidatorHandler.TAG + " tag but was " + tag); - return; - } - - CompiledBeanValidator info = (CompiledBeanValidator) compiler.getOpenComponent(); - - String name = tag.getAttribute(NAME_ATTRIBUTE); - String component = tag.getAttribute(COMPONENT_ATTRIBUTE); - if (name == null || name.trim().isEmpty()) { - compiler.reportError(TAG + " tag requires a " + NAME_ATTRIBUTE + " attribute"); - return; - } - name = name.trim(); - if (component == null || component.trim().isEmpty()) { - // try to use the name as component - if (!compiler.checkReference(tag, name, false, name)) { - compiler.reportError(TAG + " tag requires a " + COMPONENT_ATTRIBUTE + " attribute, try to use the name attribute [" + name + "] for the component, but no such component found"); - return; - } - component = name; - } - component = component.trim(); - - // check component is not already used by this compiled object - if (info.getFields().containsValue(component)) { - compiler.reportError(TAG + " tag found a attribute " + COMPONENT_ATTRIBUTE + " [" + component + "] already used in this validator"); - return; - } - // check component exist (again perharps, but let the error knows exactly which tag failed...) - if (compiler.checkReference(tag, component, true, COMPONENT_ATTRIBUTE)) { - // add a field - info.registerField(name, component, compiler); - } - - - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.tags.validator; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.tags.TagHandler; +import jaxx.compiler.tags.validator.BeanValidatorHandler.CompiledBeanValidator; +import jaxx.runtime.validator.swing.SwingValidator; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.w3c.dom.Element; + +import java.io.IOException; + +public class FieldValidatorHandler implements TagHandler { + + public static final String TAG = "field"; + public static final String NAME_ATTRIBUTE = "name"; + public static final String COMPONENT_ATTRIBUTE = "component"; + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private Log log = LogFactory.getLog(FieldValidatorHandler.class); + + @Override + public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + if (compiler.getConfiguration().isVerbose()) { + log.debug(tag); + } + //todo check there is no child + } + + @Override + public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { + if (compiler.getConfiguration().isVerbose()) { + log.debug(tag); + } + + if (!ClassDescriptorLoader.getClassDescriptor(SwingValidator.class).isAssignableFrom(compiler.getOpenComponent().getObjectClass())) { + compiler.reportError(TAG + " tag may only appear within " + BeanValidatorHandler.TAG + " tag but was " + tag); + return; + } + + CompiledBeanValidator info = (CompiledBeanValidator) compiler.getOpenComponent(); + + String name = tag.getAttribute(NAME_ATTRIBUTE); + String component = tag.getAttribute(COMPONENT_ATTRIBUTE); + if (name == null || name.trim().isEmpty()) { + compiler.reportError(TAG + " tag requires a " + NAME_ATTRIBUTE + " attribute"); + return; + } + name = name.trim(); + if (component == null || component.trim().isEmpty()) { + // try to use the name as component + if (!compiler.checkReference(tag, name, false, name)) { + compiler.reportError(TAG + " tag requires a " + COMPONENT_ATTRIBUTE + " attribute, try to use the name attribute [" + name + "] for the component, but no such component found"); + return; + } + component = name; + } + component = component.trim(); + + // check component is not already used by this compiled object + if (info.getFields().containsValue(component)) { + compiler.reportError(TAG + " tag found a attribute " + COMPONENT_ATTRIBUTE + " [" + component + "] already used in this validator"); + return; + } + // check component exist (again perharps, but let the error knows exactly which tag failed...) + if (compiler.checkReference(tag, component, true, COMPONENT_ATTRIBUTE)) { + // add a field + info.registerField(name, component, compiler); + } + + + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tools/PrintTagInfo.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/PrintTagInfo.java index 13973e7..6670d52 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tools/PrintTagInfo.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/PrintTagInfo.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.tools; import jaxx.compiler.tags.*; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/AbstractContextNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/AbstractContextNode.java index 6840434..7fd9991 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/AbstractContextNode.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/AbstractContextNode.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.tools.jaxxcapture; import java.util.ArrayList; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/CapturedObject.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/CapturedObject.java index ccdda36..5047916 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/CapturedObject.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/CapturedObject.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.tools.jaxxcapture; import jaxx.compiler.JAXXCompiler; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/ContextNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/ContextNode.java index 5e34599..10180f8 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/ContextNode.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/ContextNode.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.tools.jaxxcapture; public interface ContextNode { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/JAXXCapture.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/JAXXCapture.java index cbc7d26..10574c8 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/JAXXCapture.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/JAXXCapture.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.tools.jaxxcapture; import jaxx.compiler.ClassMap; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/LiteralNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/LiteralNode.java index 6db634d..376b063 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/LiteralNode.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/LiteralNode.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.tools.jaxxcapture; public class LiteralNode extends AbstractContextNode { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/MethodNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/MethodNode.java index 4eb8f6b..e1b52f2 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/MethodNode.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/MethodNode.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.tools.jaxxcapture; public class MethodNode extends AbstractContextNode { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/PropertyNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/PropertyNode.java index fa9472b..c2768e2 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/PropertyNode.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/PropertyNode.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.tools.jaxxcapture; public class PropertyNode extends AbstractContextNode { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/ValueNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/ValueNode.java index 45eda1e..6208b1f 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/ValueNode.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/ValueNode.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.tools.jaxxcapture; public class ValueNode extends AbstractContextNode { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/JTabbedPaneHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/JTabbedPaneHandler.java index 9b5596a..30f1c2f 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/JTabbedPaneHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/JTabbedPaneHandler.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.tools.jaxxcapture.handlers; import jaxx.compiler.tools.jaxxcapture.ContextNode; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/ObjectHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/ObjectHandler.java index 273123c..601d78d 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/ObjectHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/ObjectHandler.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.tools.jaxxcapture.handlers; import jaxx.compiler.JAXXCompiler; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/TableHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/TableHandler.java index 852a738..b4749e6 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/TableHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tools/jaxxcapture/handlers/TableHandler.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.tools.jaxxcapture.handlers; import jaxx.compiler.tools.jaxxcapture.CapturedObject; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/types/ColorConverter.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/ColorConverter.java index f902e8d..bc28e11 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/types/ColorConverter.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/ColorConverter.java @@ -1,42 +1,58 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.types; - -import java.awt.Color; -import java.lang.reflect.Field; - -public class ColorConverter implements TypeConverter { - - @Override - public Class<?>[] getSupportedTypes() { - return new Class<?>[]{ - Color.class - }; - } - - @Override - public String getJavaCode(Object object) { - Color color = (Color) object; - return "new Color(" + color.getRed() + ", " + color.getGreen() + ", " + color.getBlue() + ")"; - } - - @Override - public Object convertFromString(String string, Class<?> type) { - if (type != Color.class) { - throw new IllegalArgumentException("unsupported type: " + type); - } - if (string.length() == 7 && string.charAt(0) == '#') { - return new Color(Integer.parseInt(string.substring(1), 16)); - } - try { - Field color = Color.class.getField(string); - return color.get(null); - } catch (NoSuchFieldException e) { - throw new IllegalArgumentException("colors must be of the form #xxxxxx ('#' followed by six hexadecimal digits), or the name of a constant field in java.awt.Color (found: '" + string + "')"); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.types; + +import java.awt.Color; +import java.lang.reflect.Field; + +public class ColorConverter implements TypeConverter { + + @Override + public Class<?>[] getSupportedTypes() { + return new Class<?>[]{ + Color.class + }; + } + + @Override + public String getJavaCode(Object object) { + Color color = (Color) object; + return "new Color(" + color.getRed() + ", " + color.getGreen() + ", " + color.getBlue() + ")"; + } + + @Override + public Object convertFromString(String string, Class<?> type) { + if (type != Color.class) { + throw new IllegalArgumentException("unsupported type: " + type); + } + if (string.length() == 7 && string.charAt(0) == '#') { + return new Color(Integer.parseInt(string.substring(1), 16)); + } + try { + Field color = Color.class.getField(string); + return color.get(null); + } catch (NoSuchFieldException e) { + throw new IllegalArgumentException("colors must be of the form #xxxxxx ('#' followed by six hexadecimal digits), or the name of a constant field in java.awt.Color (found: '" + string + "')"); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/types/GridBagConstraintsConverter.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/GridBagConstraintsConverter.java index 5ddff7a..ad190bb 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/types/GridBagConstraintsConverter.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/GridBagConstraintsConverter.java @@ -1,30 +1,46 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.types; - -import java.awt.GridBagConstraints; - -public class GridBagConstraintsConverter implements TypeConverter { - - @Override - public Class<?>[] getSupportedTypes() { - return new Class<?>[] { - GridBagConstraints.class - }; - } - - @Override - public String getJavaCode(Object object) { - GridBagConstraints g = (GridBagConstraints) object; - return "new GridBagConstraints(" + g.gridx + ", " + g.gridy + ", " + g.gridwidth + ", " + g.gridheight + ", " + - g.weightx + ", " + g.weighty + ", " + g.anchor + ", " + g.fill + ", " + - TypeManager.getJavaCode(g.insets) + ", " + g.ipadx + ", " + g.ipady + ")"; - } - - @Override - public Object convertFromString(String string, Class<?> type) { - throw new UnsupportedOperationException("GridBagConstraints must be represented using Java code"); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.types; + +import java.awt.GridBagConstraints; + +public class GridBagConstraintsConverter implements TypeConverter { + + @Override + public Class<?>[] getSupportedTypes() { + return new Class<?>[] { + GridBagConstraints.class + }; + } + + @Override + public String getJavaCode(Object object) { + GridBagConstraints g = (GridBagConstraints) object; + return "new GridBagConstraints(" + g.gridx + ", " + g.gridy + ", " + g.gridwidth + ", " + g.gridheight + ", " + + g.weightx + ", " + g.weighty + ", " + g.anchor + ", " + g.fill + ", " + + TypeManager.getJavaCode(g.insets) + ", " + g.ipadx + ", " + g.ipady + ")"; + } + + @Override + public Object convertFromString(String string, Class<?> type) { + throw new UnsupportedOperationException("GridBagConstraints must be represented using Java code"); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/types/InsetsConverter.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/InsetsConverter.java index 5d387c4..cb9a841 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/types/InsetsConverter.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/InsetsConverter.java @@ -1,43 +1,59 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.types; - -import java.awt.Insets; -import java.util.StringTokenizer; - -public class InsetsConverter implements TypeConverter { - - @Override - public Class<?>[] getSupportedTypes() { - return new Class<?>[]{Insets.class}; - } - - @Override - public String getJavaCode(Object object) { - Insets insets = (Insets) object; - return "new Insets(" + insets.top + ", " + insets.left + ", " + insets.bottom + ", " + insets.right + ")"; - } - - @Override - public Object convertFromString(String string, Class<?> type) { - if (type != Insets.class) { - throw new IllegalArgumentException("unsupported type: " + type); - } - StringTokenizer tokenizer = new StringTokenizer(string, ","); - int count = tokenizer.countTokens(); - if (count == 1) { - int i = Integer.parseInt(tokenizer.nextToken().trim()); - return new Insets(i, i, i, i); - } - if (count == 4) { - int[] insets = new int[count]; - for (int i = 0; tokenizer.hasMoreTokens(); i++) { - insets[i] = Integer.parseInt(tokenizer.nextToken().trim()); - } - return new Insets(insets[0], insets[1], insets[2], insets[3]); - } - throw new IllegalArgumentException("unable to convert string '" + string + "' to Insets"); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.types; + +import java.awt.Insets; +import java.util.StringTokenizer; + +public class InsetsConverter implements TypeConverter { + + @Override + public Class<?>[] getSupportedTypes() { + return new Class<?>[]{Insets.class}; + } + + @Override + public String getJavaCode(Object object) { + Insets insets = (Insets) object; + return "new Insets(" + insets.top + ", " + insets.left + ", " + insets.bottom + ", " + insets.right + ")"; + } + + @Override + public Object convertFromString(String string, Class<?> type) { + if (type != Insets.class) { + throw new IllegalArgumentException("unsupported type: " + type); + } + StringTokenizer tokenizer = new StringTokenizer(string, ","); + int count = tokenizer.countTokens(); + if (count == 1) { + int i = Integer.parseInt(tokenizer.nextToken().trim()); + return new Insets(i, i, i, i); + } + if (count == 4) { + int[] insets = new int[count]; + for (int i = 0; tokenizer.hasMoreTokens(); i++) { + insets[i] = Integer.parseInt(tokenizer.nextToken().trim()); + } + return new Insets(insets[0], insets[1], insets[2], insets[3]); + } + throw new IllegalArgumentException("unable to convert string '" + string + "' to Insets"); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/types/KeyStrokeConverter.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/KeyStrokeConverter.java index 4dec0a2..fa4271b 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/types/KeyStrokeConverter.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/KeyStrokeConverter.java @@ -1,28 +1,44 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.types; - -import javax.swing.KeyStroke; - -public class KeyStrokeConverter implements TypeConverter { - - @Override - public Class<?>[] getSupportedTypes() { - return new Class<?>[]{KeyStroke.class}; - } - - @Override - public String getJavaCode(Object object) { - return "KeyStroke.getKeyStroke(\"" + object.toString() + "\")"; - } - - @Override - public Object convertFromString(String string, Class<?> type) { - if (type != KeyStroke.class) { - throw new IllegalArgumentException("unsupported type: " + type); - } - return KeyStroke.getKeyStroke(string); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.types; + +import javax.swing.KeyStroke; + +public class KeyStrokeConverter implements TypeConverter { + + @Override + public Class<?>[] getSupportedTypes() { + return new Class<?>[]{KeyStroke.class}; + } + + @Override + public String getJavaCode(Object object) { + return "KeyStroke.getKeyStroke(\"" + object.toString() + "\")"; + } + + @Override + public Object convertFromString(String string, Class<?> type) { + if (type != KeyStroke.class) { + throw new IllegalArgumentException("unsupported type: " + type); + } + return KeyStroke.getKeyStroke(string); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/types/PrimitiveConverter.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/PrimitiveConverter.java index 2c6c84b..f7d2ddd 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/types/PrimitiveConverter.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/PrimitiveConverter.java @@ -1,104 +1,120 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.types; - -import jaxx.compiler.JAXXCompiler; - -public class PrimitiveConverter implements TypeConverter { - - @Override - public Class<?>[] getSupportedTypes() { - - return new Class<?>[]{ - boolean.class, - Boolean.class, - byte.class, - Byte.class, - short.class, - Short.class, - int.class, - Integer.class, - long.class, - Long.class, - float.class, - Float.class, - double.class, - Double.class, - char.class, - Character.class, - String.class - }; - } - - @Override - public String getJavaCode(Object object) { - if (object instanceof Boolean) { - return String.valueOf(((Boolean) object).booleanValue()); - } - if (object instanceof Byte) { - return String.valueOf(((Byte) object).byteValue()); - } - if (object instanceof Short) { - return String.valueOf(((Short) object).shortValue()); - } - if (object instanceof Integer) { - return String.valueOf(((Integer) object).intValue()); - } - if (object instanceof Long) { - return String.valueOf(((Long) object).longValue()) + "L"; - } - if (object instanceof Float) { - return String.valueOf(((Float) object).floatValue()) + "F"; - } - if (object instanceof Double) { - return String.valueOf(((Double) object).doubleValue()); - } - if (object instanceof String) { - return '"' + JAXXCompiler.escapeJavaString((String) object) + '"'; - } - throw new IllegalArgumentException("unsupported object: " + object); - } - - @Override - public Object convertFromString(String string, Class<?> type) { - if (type == String.class || type == Object.class || type == null) { - return string; - } - if (type == int.class || type == Integer.class) { - return Integer.valueOf(string); - } - if (type == boolean.class || type == Boolean.class) { - if (string.toLowerCase().equals("true")) { - return Boolean.TRUE; - } - if (string.toLowerCase().equals("false")) { - return Boolean.FALSE; - } - throw new IllegalArgumentException("expected 'true' or 'false', found '" + string + "'"); - } - if (type == byte.class || type == Byte.class) { - return Byte.valueOf(string); - } - if (type == short.class || type == Short.class) { - return Short.valueOf(string); - } - if (type == long.class || type == Long.class) { - return Long.valueOf(string); - } - if (type == float.class || type == Float.class) { - return Float.valueOf(string); - } - if (type == double.class || type == Double.class) { - return Double.valueOf(string); - } - if (type == char.class || type == Character.class) { - if (string.length() == 1) { - return string.charAt(0); - } - throw new IllegalArgumentException("expected a single character, found '" + string + "'"); - } - throw new IllegalArgumentException("unsupported type: " + type); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.types; + +import jaxx.compiler.JAXXCompiler; + +public class PrimitiveConverter implements TypeConverter { + + @Override + public Class<?>[] getSupportedTypes() { + + return new Class<?>[]{ + boolean.class, + Boolean.class, + byte.class, + Byte.class, + short.class, + Short.class, + int.class, + Integer.class, + long.class, + Long.class, + float.class, + Float.class, + double.class, + Double.class, + char.class, + Character.class, + String.class + }; + } + + @Override + public String getJavaCode(Object object) { + if (object instanceof Boolean) { + return String.valueOf(((Boolean) object).booleanValue()); + } + if (object instanceof Byte) { + return String.valueOf(((Byte) object).byteValue()); + } + if (object instanceof Short) { + return String.valueOf(((Short) object).shortValue()); + } + if (object instanceof Integer) { + return String.valueOf(((Integer) object).intValue()); + } + if (object instanceof Long) { + return String.valueOf(((Long) object).longValue()) + "L"; + } + if (object instanceof Float) { + return String.valueOf(((Float) object).floatValue()) + "F"; + } + if (object instanceof Double) { + return String.valueOf(((Double) object).doubleValue()); + } + if (object instanceof String) { + return '"' + JAXXCompiler.escapeJavaString((String) object) + '"'; + } + throw new IllegalArgumentException("unsupported object: " + object); + } + + @Override + public Object convertFromString(String string, Class<?> type) { + if (type == String.class || type == Object.class || type == null) { + return string; + } + if (type == int.class || type == Integer.class) { + return Integer.valueOf(string); + } + if (type == boolean.class || type == Boolean.class) { + if (string.toLowerCase().equals("true")) { + return Boolean.TRUE; + } + if (string.toLowerCase().equals("false")) { + return Boolean.FALSE; + } + throw new IllegalArgumentException("expected 'true' or 'false', found '" + string + "'"); + } + if (type == byte.class || type == Byte.class) { + return Byte.valueOf(string); + } + if (type == short.class || type == Short.class) { + return Short.valueOf(string); + } + if (type == long.class || type == Long.class) { + return Long.valueOf(string); + } + if (type == float.class || type == Float.class) { + return Float.valueOf(string); + } + if (type == double.class || type == Double.class) { + return Double.valueOf(string); + } + if (type == char.class || type == Character.class) { + if (string.length() == 1) { + return string.charAt(0); + } + throw new IllegalArgumentException("expected a single character, found '" + string + "'"); + } + throw new IllegalArgumentException("unsupported type: " + type); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/types/TypeConverter.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/TypeConverter.java index 46c6376..61a6f7b 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/types/TypeConverter.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/TypeConverter.java @@ -1,14 +1,30 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.types; - -public interface TypeConverter { - - Class<?>[] getSupportedTypes(); - - String getJavaCode(Object object); - - Object convertFromString(String string, Class<?> type); -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.types; + +public interface TypeConverter { + + Class<?>[] getSupportedTypes(); + + String getJavaCode(Object object); + + Object convertFromString(String string, Class<?> type); +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/types/TypeManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/types/TypeManager.java index 6f3d26b..d9b28a6 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/types/TypeManager.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/types/TypeManager.java @@ -1,54 +1,70 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.compiler.types; - -import java.util.HashMap; -import java.util.Map; -import java.util.ServiceLoader; - -public class TypeManager { - - private static Map<Class<?>, TypeConverter> converters; - - public static Map<Class<?>, TypeConverter> getConverters() { - if (converters == null) { - converters = new HashMap<Class<?>, TypeConverter>(); - // load converters - ServiceLoader<TypeConverter> loader = ServiceLoader.load(TypeConverter.class); - for (TypeConverter c : loader) { - // for each supported type, register the converter - for (Class<?> type : c.getSupportedTypes()) { - converters.put(type, c); - } - } - } - return converters; - } - - private TypeManager() { /* not instantiable */ } - - public static TypeConverter getTypeConverter(Class<?> type) { - return getConverters().get(type); - } - - public static String getJavaCode(Object object) { - if (object == null) { - return "null"; - } - TypeConverter converter = getTypeConverter(object.getClass()); - if (converter == null) { - throw new IllegalArgumentException("unsupported type: " + object.getClass()); - } - return converter.getJavaCode(object); - } - - public static Object convertFromString(String string, Class<?> type) { - TypeConverter converter = getTypeConverter(type); - if (converter == null) { - throw new IllegalArgumentException("unsupported type: " + type); - } - return converter.convertFromString(string, type); - } -} +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.types; + +import java.util.HashMap; +import java.util.Map; +import java.util.ServiceLoader; + +public class TypeManager { + + private static Map<Class<?>, TypeConverter> converters; + + public static Map<Class<?>, TypeConverter> getConverters() { + if (converters == null) { + converters = new HashMap<Class<?>, TypeConverter>(); + // load converters + ServiceLoader<TypeConverter> loader = ServiceLoader.load(TypeConverter.class); + for (TypeConverter c : loader) { + // for each supported type, register the converter + for (Class<?> type : c.getSupportedTypes()) { + converters.put(type, c); + } + } + } + return converters; + } + + private TypeManager() { /* not instantiable */ } + + public static TypeConverter getTypeConverter(Class<?> type) { + return getConverters().get(type); + } + + public static String getJavaCode(Object object) { + if (object == null) { + return "null"; + } + TypeConverter converter = getTypeConverter(object.getClass()); + if (converter == null) { + throw new IllegalArgumentException("unsupported type: " + object.getClass()); + } + return converter.getJavaCode(object); + } + + public static Object convertFromString(String string, Class<?> type) { + TypeConverter converter = getTypeConverter(type); + if (converter == null) { + throw new IllegalArgumentException("unsupported type: " + type); + } + return converter.convertFromString(string, type); + } +} diff --git a/jaxx-compiler/src/test/java/jaxx/compiler/JavaFileParserTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/JavaFileParserTest.java index 9d188d0..6c6954a 100644 --- a/jaxx-compiler/src/test/java/jaxx/compiler/JavaFileParserTest.java +++ b/jaxx-compiler/src/test/java/jaxx/compiler/JavaFileParserTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler; import jaxx.compiler.CompilerException; diff --git a/jaxx-compiler/src/test/java/jaxx/compiler/JavaMethodTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/JavaMethodTest.java index 1e25425..722a1a8 100644 --- a/jaxx-compiler/src/test/java/jaxx/compiler/JavaMethodTest.java +++ b/jaxx-compiler/src/test/java/jaxx/compiler/JavaMethodTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler; import jaxx.compiler.java.JavaMethod; diff --git a/jaxx-compiler/src/test/java/jaxx/compiler/beans/BeanIntoUtilTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/beans/BeanIntoUtilTest.java index d52a48e..d58fa47 100644 --- a/jaxx-compiler/src/test/java/jaxx/compiler/beans/BeanIntoUtilTest.java +++ b/jaxx-compiler/src/test/java/jaxx/compiler/beans/BeanIntoUtilTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.beans; import org.junit.Assert; diff --git a/jaxx-compiler/src/test/java/jaxx/compiler/reflect/ClassDescriptorTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/reflect/ClassDescriptorTest.java index 02bc606..4ffb6a8 100644 --- a/jaxx-compiler/src/test/java/jaxx/compiler/reflect/ClassDescriptorTest.java +++ b/jaxx-compiler/src/test/java/jaxx/compiler/reflect/ClassDescriptorTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.reflect; import static org.junit.Assert.assertEquals; diff --git a/jaxx-compiler/src/test/java/jaxx/compiler/tags/TagManagerTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/tags/TagManagerTest.java index 878f1fe..93d151b 100644 --- a/jaxx-compiler/src/test/java/jaxx/compiler/tags/TagManagerTest.java +++ b/jaxx-compiler/src/test/java/jaxx/compiler/tags/TagManagerTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.tags; import jaxx.compiler.JAXXCompiler; diff --git a/jaxx-compiler/src/test/java/jaxx/compiler/types/ColorConverterTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/types/ColorConverterTest.java index d879c76..97226fc 100644 --- a/jaxx-compiler/src/test/java/jaxx/compiler/types/ColorConverterTest.java +++ b/jaxx-compiler/src/test/java/jaxx/compiler/types/ColorConverterTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.types; import jaxx.compiler.types.ColorConverter; diff --git a/jaxx-compiler/src/test/java/jaxx/compiler/types/InsetsConverterTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/types/InsetsConverterTest.java index 9df9691..015cc3a 100644 --- a/jaxx-compiler/src/test/java/jaxx/compiler/types/InsetsConverterTest.java +++ b/jaxx-compiler/src/test/java/jaxx/compiler/types/InsetsConverterTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.types; import jaxx.compiler.types.InsetsConverter; diff --git a/jaxx-compiler/src/test/java/jaxx/compiler/types/PrimitiveConverterTest.java b/jaxx-compiler/src/test/java/jaxx/compiler/types/PrimitiveConverterTest.java index 3b343a8..fd2bcfc 100644 --- a/jaxx-compiler/src/test/java/jaxx/compiler/types/PrimitiveConverterTest.java +++ b/jaxx-compiler/src/test/java/jaxx/compiler/types/PrimitiveConverterTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.types; import jaxx.compiler.types.PrimitiveConverter; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/Base64Coder.java b/jaxx-runtime/src/main/java/jaxx/runtime/Base64Coder.java index 654826b..87a3c5a 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/Base64Coder.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/Base64Coder.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime; import java.io.ByteArrayInputStream; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/ComponentDescriptor.java b/jaxx-runtime/src/main/java/jaxx/runtime/ComponentDescriptor.java index 57e22ca..c3ffe69 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/ComponentDescriptor.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/ComponentDescriptor.java @@ -1,49 +1,65 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime; - -import java.io.Serializable; - -public class ComponentDescriptor implements Serializable { - String id; - String javaClassName; - String styleClass; - ComponentDescriptor parent; - private static final long serialVersionUID = 1L; - - - public ComponentDescriptor(String id, String javaClassName, String styleClass, ComponentDescriptor parent) { - this.id = id; - this.javaClassName = javaClassName; - this.styleClass = styleClass; - this.parent = parent; - } - - - public String getId() { - return id; - } - - - public String getJavaClassName() { - return javaClassName; - } - - - public String getStyleClass() { - return styleClass; - } - - - public ComponentDescriptor getParent() { - return parent; - } - - - @Override - public String toString() { - return "ComponentDescriptor[" + id + ", " + javaClassName + ", " + styleClass + "]"; - } +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime; + +import java.io.Serializable; + +public class ComponentDescriptor implements Serializable { + String id; + String javaClassName; + String styleClass; + ComponentDescriptor parent; + private static final long serialVersionUID = 1L; + + + public ComponentDescriptor(String id, String javaClassName, String styleClass, ComponentDescriptor parent) { + this.id = id; + this.javaClassName = javaClassName; + this.styleClass = styleClass; + this.parent = parent; + } + + + public String getId() { + return id; + } + + + public String getJavaClassName() { + return javaClassName; + } + + + public String getStyleClass() { + return styleClass; + } + + + public ComponentDescriptor getParent() { + return parent; + } + + + @Override + public String toString() { + return "ComponentDescriptor[" + id + ", " + javaClassName + ", " + styleClass + "]"; + } } \ No newline at end of file diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/DataBindingListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/DataBindingListener.java index da4c600..988d26f 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/DataBindingListener.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/DataBindingListener.java @@ -1,47 +1,63 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; - - -/** - * A <code>PropertyChangeListener</code> which processes a data binding when it receives a - * <code>PropertyChangeEvent</code>. - */ -public class DataBindingListener implements PropertyChangeListener { - private JAXXObject object; - private String dest; - - /** - * Creates a new <code>DataBindingListener</code> which will run the given data binding - * when it receives a <code>PropertyChangeEvent</code>. - * - * @param object the object in which the data binding exists - * @param dest the name of the data binding to run - */ - public DataBindingListener(JAXXObject object, String dest) { - this.object = object; - this.dest = dest; - } - - - /** - * Processes the data binding in response to a <code>PropertyChangeEvent</code>. - * - * @param e the event which triggered the binding - */ - @Override - public void propertyChange(PropertyChangeEvent e) { - object.processDataBinding(dest); - - // for now, handle dependency changes by always removing & reapplying - // the binding. We should be more efficient and only do this when it's - // actually necessary - object.removeDataBinding(dest); - object.applyDataBinding(dest); - } +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; + + +/** + * A <code>PropertyChangeListener</code> which processes a data binding when it receives a + * <code>PropertyChangeEvent</code>. + */ +public class DataBindingListener implements PropertyChangeListener { + private JAXXObject object; + private String dest; + + /** + * Creates a new <code>DataBindingListener</code> which will run the given data binding + * when it receives a <code>PropertyChangeEvent</code>. + * + * @param object the object in which the data binding exists + * @param dest the name of the data binding to run + */ + public DataBindingListener(JAXXObject object, String dest) { + this.object = object; + this.dest = dest; + } + + + /** + * Processes the data binding in response to a <code>PropertyChangeEvent</code>. + * + * @param e the event which triggered the binding + */ + @Override + public void propertyChange(PropertyChangeEvent e) { + object.processDataBinding(dest); + + // for now, handle dependency changes by always removing & reapplying + // the binding. We should be more efficient and only do this when it's + // actually necessary + object.removeDataBinding(dest); + object.applyDataBinding(dest); + } } \ No newline at end of file diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/DataBindingUpdateListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/DataBindingUpdateListener.java index 030dd4c..2599d4c 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/DataBindingUpdateListener.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/DataBindingUpdateListener.java @@ -1,47 +1,63 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; - - -/** - * A <code>PropertyChangeListener</code> which removes and re-applies a data binding - * when it receives a <code>PropertyChangeEvent</code>. - */ -public class DataBindingUpdateListener implements PropertyChangeListener { - private JAXXObject object; - private String dest; - - /** - * Creates a new <code>DataBindingUpdateListener</code> which will remove and re-apply a - * data binding when it receives a <code>PropertyChangeEvent</code>. - * - * @param object the object in which the data binding exists - * @param dest the name of the data binding to reapply - */ - public DataBindingUpdateListener(JAXXObject object, String dest) { - this.object = object; - this.dest = dest; - } - - - public String getBindingName() { - return dest; - } - - - /** - * Updates the data binding in response to a <code>PropertyChangeEvent</code>. - * - * @param e the event which triggered the binding - */ - @Override - public void propertyChange(PropertyChangeEvent e) { - object.removeDataBinding(dest); - object.applyDataBinding(dest); - } +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; + + +/** + * A <code>PropertyChangeListener</code> which removes and re-applies a data binding + * when it receives a <code>PropertyChangeEvent</code>. + */ +public class DataBindingUpdateListener implements PropertyChangeListener { + private JAXXObject object; + private String dest; + + /** + * Creates a new <code>DataBindingUpdateListener</code> which will remove and re-apply a + * data binding when it receives a <code>PropertyChangeEvent</code>. + * + * @param object the object in which the data binding exists + * @param dest the name of the data binding to reapply + */ + public DataBindingUpdateListener(JAXXObject object, String dest) { + this.object = object; + this.dest = dest; + } + + + public String getBindingName() { + return dest; + } + + + /** + * Updates the data binding in response to a <code>PropertyChangeEvent</code>. + * + * @param e the event which triggered the binding + */ + @Override + public void propertyChange(PropertyChangeEvent e) { + object.removeDataBinding(dest); + object.applyDataBinding(dest); + } } \ No newline at end of file diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXAction.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXAction.java index 0c3df04..6afff01 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXAction.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXAction.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime; import jaxx.runtime.context.JAXXInitialContext; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java index 6609d60..d731cf3 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime; import java.awt.Container; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java index 250067b..dbb12ee 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java @@ -1,70 +1,86 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime; - -import java.io.Serializable; -import java.util.Map; - -/** - * The <code>JAXXObject</code> interface is implemented by all classes - * produced by the JAXX compiler. - */ -public interface JAXXObject extends JAXXContext, Serializable { - - /** - * Retrieves an object defined in an XML tag by its ID. - * - * @param id the id of the component to retrieve - * @return the object - */ - Object getObjectById(String id); - - /** - * Pretrieves the dictonary of knwon objects indexed by their ids. - * - * @return the dictonary of objects. - */ - Map<String, Object> get$objectMap(); - - /** - * - * @return the {@link JAXXContext} attached to the object - */ - JAXXContext getDelegateContext(); - - /** - * Apply the data bind by name and then process it. - * @param id the id of the databinding - */ - void applyDataBinding(String id); - - /** - * Processes a data binding by name. Data binding names are comprised of an object ID and a property name: - * for example, the data binding in the tag <code><JLabel id='label' text='{foo.getText()}'/></code> is - * named <code>"label.text"</code>. Processing a data binding causes it to reevaluate its expression, in this - * case <code>foo.getText()</code>. - * - * @param dest the name of the data binding to run - */ - void processDataBinding(String dest); - - /** - * Remove a databinding by name. - * - * @param id the name of databinding to remove - */ - void removeDataBinding(String id); - - /** - * All <code>JAXXObject</code> implements are capable of broadcasting <code>PropertyChangeEvent</code>, and - * furthermore (for technical reasons) must allow code in outside packages, specifically the JAXX runtime, - * to trigger these events. - * - * @param name the name of the property which changed - * @param oldValue the old value of the property - * @param newValue the new value of the property - */ - void firePropertyChange(String name, Object oldValue, Object newValue); -} +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime; + +import java.io.Serializable; +import java.util.Map; + +/** + * The <code>JAXXObject</code> interface is implemented by all classes + * produced by the JAXX compiler. + */ +public interface JAXXObject extends JAXXContext, Serializable { + + /** + * Retrieves an object defined in an XML tag by its ID. + * + * @param id the id of the component to retrieve + * @return the object + */ + Object getObjectById(String id); + + /** + * Pretrieves the dictonary of knwon objects indexed by their ids. + * + * @return the dictonary of objects. + */ + Map<String, Object> get$objectMap(); + + /** + * + * @return the {@link JAXXContext} attached to the object + */ + JAXXContext getDelegateContext(); + + /** + * Apply the data bind by name and then process it. + * @param id the id of the databinding + */ + void applyDataBinding(String id); + + /** + * Processes a data binding by name. Data binding names are comprised of an object ID and a property name: + * for example, the data binding in the tag <code><JLabel id='label' text='{foo.getText()}'/></code> is + * named <code>"label.text"</code>. Processing a data binding causes it to reevaluate its expression, in this + * case <code>foo.getText()</code>. + * + * @param dest the name of the data binding to run + */ + void processDataBinding(String dest); + + /** + * Remove a databinding by name. + * + * @param id the name of databinding to remove + */ + void removeDataBinding(String id); + + /** + * All <code>JAXXObject</code> implements are capable of broadcasting <code>PropertyChangeEvent</code>, and + * furthermore (for technical reasons) must allow code in outside packages, specifically the JAXX runtime, + * to trigger these events. + * + * @param name the name of the property which changed + * @param oldValue the old value of the property + * @param newValue the new value of the property + */ + void firePropertyChange(String name, Object oldValue, Object newValue); +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java index 9315365..e2ff75e 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObjectDescriptor.java @@ -1,42 +1,58 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime; - -import jaxx.runtime.css.Stylesheet; - -import java.io.Serializable; - -public class JAXXObjectDescriptor implements Serializable { - private ComponentDescriptor[] descriptors; - private Stylesheet stylesheet; - private static final long serialVersionUID = 1L; - - - public JAXXObjectDescriptor(ComponentDescriptor[] descriptors, - Stylesheet stylesheet) { - this.descriptors = descriptors; - this.stylesheet = stylesheet; - } - - - public ComponentDescriptor[] getComponentDescriptors() { - return descriptors; - } - - - public Stylesheet getStylesheet() { - return stylesheet; - } - - @Override - public String toString() { - StringBuilder buffer = new StringBuilder(); - for (ComponentDescriptor descriptor : descriptors) { - buffer.append("\n").append(descriptor); - } - buffer.append("\n").append(stylesheet); - return buffer.toString(); - } +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime; + +import jaxx.runtime.css.Stylesheet; + +import java.io.Serializable; + +public class JAXXObjectDescriptor implements Serializable { + private ComponentDescriptor[] descriptors; + private Stylesheet stylesheet; + private static final long serialVersionUID = 1L; + + + public JAXXObjectDescriptor(ComponentDescriptor[] descriptors, + Stylesheet stylesheet) { + this.descriptors = descriptors; + this.stylesheet = stylesheet; + } + + + public ComponentDescriptor[] getComponentDescriptors() { + return descriptors; + } + + + public Stylesheet getStylesheet() { + return stylesheet; + } + + @Override + public String toString() { + StringBuilder buffer = new StringBuilder(); + for (ComponentDescriptor descriptor : descriptors) { + buffer.append("\n").append(descriptor); + } + buffer.append("\n").append(stylesheet); + return buffer.toString(); + } } \ No newline at end of file diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXValidator.java index c504292..cb2c73b 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXValidator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java b/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java index 1b61147..e6ea4d9 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime; import java.awt.Color; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/Util.java b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java index 2ada2ef..d3ddceb 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/Util.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime; import jaxx.runtime.context.JAXXContextEntryDef; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java index f272292..c8de9fc 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.context; import jaxx.runtime.JAXXContext; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultApplicationContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultApplicationContext.java index 502da7a..cb20060 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultApplicationContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultApplicationContext.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.context; import jaxx.runtime.*; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java index 170187d..17b36e2 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.context; import jaxx.runtime.*; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContextEntryDef.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContextEntryDef.java index e08fd03..1ad1cad 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContextEntryDef.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXContextEntryDef.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.context; import java.util.List; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXInitialContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXInitialContext.java index bc3c1fe..2b1aaed 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXInitialContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXInitialContext.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.context; import jaxx.runtime.JAXXContext; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/css/DataBinding.java b/jaxx-runtime/src/main/java/jaxx/runtime/css/DataBinding.java index 0bd5fa1..533aa3b 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/css/DataBinding.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/css/DataBinding.java @@ -1,32 +1,48 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime.css; - -/** - * Represents a data binding bound to an attribute at runtime. Used by {@link Pseudoclasses} to keep - * track of which data bindings are in effect. - */ -public class DataBinding { - - private String id; - - public DataBinding(String id) { - this.id = id; - } - - public String getId() { - return id; - } - - @Override - public boolean equals(Object o) { - return o instanceof DataBinding && ((DataBinding) o).getId().equals(getId()); - } - - @Override - public int hashCode() { - return id.hashCode(); - } -} +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime.css; + +/** + * Represents a data binding bound to an attribute at runtime. Used by {@link Pseudoclasses} to keep + * track of which data bindings are in effect. + */ +public class DataBinding { + + private String id; + + public DataBinding(String id) { + this.id = id; + } + + public String getId() { + return id; + } + + @Override + public boolean equals(Object o) { + return o instanceof DataBinding && ((DataBinding) o).getId().equals(getId()); + } + + @Override + public int hashCode() { + return id.hashCode(); + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/css/Pseudoclasses.java b/jaxx-runtime/src/main/java/jaxx/runtime/css/Pseudoclasses.java index f87316c..83c3726 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/css/Pseudoclasses.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/css/Pseudoclasses.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.css; import jaxx.runtime.JAXXObject; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/css/Rule.java b/jaxx-runtime/src/main/java/jaxx/runtime/css/Rule.java index 138f5bd..65343f2 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/css/Rule.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/css/Rule.java @@ -1,52 +1,68 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime.css; - -import java.util.Map; - -public class Rule implements java.io.Serializable, Comparable<Rule> { - - public static final String INLINE_ATTRIBUTE = "<inline attribute>"; - public static final String DATA_BINDING = "<data binding>"; - private Selector[] selectors; - private Map<String, String> properties; - private static final long serialVersionUID = 1L; - - public Rule(Selector[] selectors, Map<String, String> properties) { - this.selectors = selectors; - java.util.Arrays.sort(selectors); - this.properties = properties; - } - - public Rule(Selector[] selectors, String[] keys, String[] values) { - this.selectors = selectors; - java.util.Arrays.sort(selectors); - this.properties = new java.util.HashMap<String, String>(); - if (keys.length != values.length) { - throw new IllegalArgumentException("keys and values must have the same number of entries"); - } - for (int i = 0; i < keys.length; i++) { - properties.put(keys[i], values[i]); - } - } - - public Selector[] getSelectors() { - return selectors; - } - - public Map<String, String> getProperties() { - return properties; - } - - @Override - public int compareTo(Rule o) { - return selectors[0].compareTo(o.selectors[0]); // they are already sorted so we only need to compare the highest-ranked from each one - } - - @Override - public String toString() { - return "Rule[" + java.util.Arrays.asList(selectors) + ", " + properties + "]"; - } -} +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime.css; + +import java.util.Map; + +public class Rule implements java.io.Serializable, Comparable<Rule> { + + public static final String INLINE_ATTRIBUTE = "<inline attribute>"; + public static final String DATA_BINDING = "<data binding>"; + private Selector[] selectors; + private Map<String, String> properties; + private static final long serialVersionUID = 1L; + + public Rule(Selector[] selectors, Map<String, String> properties) { + this.selectors = selectors; + java.util.Arrays.sort(selectors); + this.properties = properties; + } + + public Rule(Selector[] selectors, String[] keys, String[] values) { + this.selectors = selectors; + java.util.Arrays.sort(selectors); + this.properties = new java.util.HashMap<String, String>(); + if (keys.length != values.length) { + throw new IllegalArgumentException("keys and values must have the same number of entries"); + } + for (int i = 0; i < keys.length; i++) { + properties.put(keys[i], values[i]); + } + } + + public Selector[] getSelectors() { + return selectors; + } + + public Map<String, String> getProperties() { + return properties; + } + + @Override + public int compareTo(Rule o) { + return selectors[0].compareTo(o.selectors[0]); // they are already sorted so we only need to compare the highest-ranked from each one + } + + @Override + public String toString() { + return "Rule[" + java.util.Arrays.asList(selectors) + ", " + properties + "]"; + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/css/Selector.java b/jaxx-runtime/src/main/java/jaxx/runtime/css/Selector.java index ccf82ff..b2f92ee 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/css/Selector.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/css/Selector.java @@ -1,92 +1,108 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime.css; - -public class Selector implements java.io.Serializable, Comparable<Selector> { - - public static final int NEVER_APPLIES = 0; - public static final int PSEUDOCLASS_APPLIES_INHERIT_ONLY = 1; - public static final int PSEUDOCLASS_APPLIES = 2; - public static final int ALWAYS_APPLIES_INHERIT_ONLY = 3; - public static final int ALWAYS_APPLIES = 4; - private String javaClassName; - private String styleClass; - private String pseudoClass; - private String id; - private boolean inline; - private static final long serialVersionUID = 1L; - - public Selector(String javaClassName, String styleClass, String pseudoClass, String id) { - this(javaClassName, styleClass, pseudoClass, id, false); - } - - public Selector(String javaClassName, String styleClass, String pseudoClass, String id, boolean inline) { - this.javaClassName = javaClassName; - this.styleClass = styleClass; - this.pseudoClass = pseudoClass; - this.id = id; - this.inline = inline; - } - - public String getJavaClassName() { - return javaClassName; - } - - public String getStyleClass() { - return styleClass; - } - - public String getPseudoClass() { - return pseudoClass; - } - - public String getId() { - return id; - } - - public boolean isInline() { - return inline; - } - - @Override - public int compareTo(Selector selector) { - if (inline && !selector.inline) { - return 1; - } - if (!inline && selector.inline) { - return -1; - } - if (pseudoClass != null && selector.pseudoClass == null) { - return 1; - } - if (pseudoClass == null && selector.pseudoClass != null) { - return -1; - } - if (id != null && selector.id == null) { - return 1; - } - if (id == null && selector.id != null) { - return -1; - } - if (styleClass != null && selector.styleClass == null) { - return 1; - } - if (styleClass == null && selector.styleClass != null) { - return -1; - } - if (javaClassName != null && selector.javaClassName == null) { - return 1; - } - if (javaClassName == null && selector.javaClassName != null) { - return -1; - } - return 0; - } - - @Override - public String toString() { - return "Selector[" + javaClassName + ", " + styleClass + ", " + pseudoClass + ", " + id + "]"; - } -} +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime.css; + +public class Selector implements java.io.Serializable, Comparable<Selector> { + + public static final int NEVER_APPLIES = 0; + public static final int PSEUDOCLASS_APPLIES_INHERIT_ONLY = 1; + public static final int PSEUDOCLASS_APPLIES = 2; + public static final int ALWAYS_APPLIES_INHERIT_ONLY = 3; + public static final int ALWAYS_APPLIES = 4; + private String javaClassName; + private String styleClass; + private String pseudoClass; + private String id; + private boolean inline; + private static final long serialVersionUID = 1L; + + public Selector(String javaClassName, String styleClass, String pseudoClass, String id) { + this(javaClassName, styleClass, pseudoClass, id, false); + } + + public Selector(String javaClassName, String styleClass, String pseudoClass, String id, boolean inline) { + this.javaClassName = javaClassName; + this.styleClass = styleClass; + this.pseudoClass = pseudoClass; + this.id = id; + this.inline = inline; + } + + public String getJavaClassName() { + return javaClassName; + } + + public String getStyleClass() { + return styleClass; + } + + public String getPseudoClass() { + return pseudoClass; + } + + public String getId() { + return id; + } + + public boolean isInline() { + return inline; + } + + @Override + public int compareTo(Selector selector) { + if (inline && !selector.inline) { + return 1; + } + if (!inline && selector.inline) { + return -1; + } + if (pseudoClass != null && selector.pseudoClass == null) { + return 1; + } + if (pseudoClass == null && selector.pseudoClass != null) { + return -1; + } + if (id != null && selector.id == null) { + return 1; + } + if (id == null && selector.id != null) { + return -1; + } + if (styleClass != null && selector.styleClass == null) { + return 1; + } + if (styleClass == null && selector.styleClass != null) { + return -1; + } + if (javaClassName != null && selector.javaClassName == null) { + return 1; + } + if (javaClassName == null && selector.javaClassName != null) { + return -1; + } + return 0; + } + + @Override + public String toString() { + return "Selector[" + javaClassName + ", " + styleClass + ", " + pseudoClass + ", " + id + "]"; + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/css/Stylesheet.java b/jaxx-runtime/src/main/java/jaxx/runtime/css/Stylesheet.java index ae68c0a..a4dedcb 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/css/Stylesheet.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/css/Stylesheet.java @@ -1,45 +1,61 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime.css; - -public class Stylesheet implements java.io.Serializable { - - private Rule[] rules; - private static final long serialVersionUID = 1L; - - public Stylesheet() { - rules = new Rule[0]; - } - - public Stylesheet(Rule[] rules) { - this.rules = rules; - java.util.Arrays.sort(rules); - } - - public Rule[] getRules() { - return rules; - } - - public void add(Rule newRule) { - Rule[] oldRules = rules; - rules = new Rule[oldRules.length + 1]; - System.arraycopy(oldRules, 0, rules, 0, oldRules.length); - rules[rules.length - 1] = newRule; - java.util.Arrays.sort(rules); - } - - public void add(Rule[] newRules) { - Rule[] oldRules = rules; - rules = new Rule[oldRules.length + newRules.length]; - System.arraycopy(oldRules, 0, rules, 0, oldRules.length); - System.arraycopy(newRules, 0, rules, oldRules.length, newRules.length); - java.util.Arrays.sort(rules); - } - - @Override - public String toString() { - return "Stylesheet" + java.util.Arrays.asList(rules); - } -} +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime.css; + +public class Stylesheet implements java.io.Serializable { + + private Rule[] rules; + private static final long serialVersionUID = 1L; + + public Stylesheet() { + rules = new Rule[0]; + } + + public Stylesheet(Rule[] rules) { + this.rules = rules; + java.util.Arrays.sort(rules); + } + + public Rule[] getRules() { + return rules; + } + + public void add(Rule newRule) { + Rule[] oldRules = rules; + rules = new Rule[oldRules.length + 1]; + System.arraycopy(oldRules, 0, rules, 0, oldRules.length); + rules[rules.length - 1] = newRule; + java.util.Arrays.sort(rules); + } + + public void add(Rule[] newRules) { + Rule[] oldRules = rules; + rules = new Rule[oldRules.length + newRules.length]; + System.arraycopy(oldRules, 0, rules, 0, oldRules.length); + System.arraycopy(newRules, 0, rules, oldRules.length, newRules.length); + java.util.Arrays.sort(rules); + } + + @Override + public String toString() { + return "Stylesheet" + java.util.Arrays.asList(rules); + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/Decorator.java b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/Decorator.java index 45b48e8..be7aa5c 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/Decorator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/Decorator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.decorator; /** diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java index 779e0a5..a32cb02 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.decorator; import java.util.ArrayList; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java index 2d46e19..3e99922 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.decorator; import org.apache.commons.jxpath.JXPathContext; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/MultiJXPathDecorator.java b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/MultiJXPathDecorator.java index 714bf3b..a36633b 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/MultiJXPathDecorator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/MultiJXPathDecorator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.decorator; import org.apache.commons.logging.Log; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/PropertyDecorator.java b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/PropertyDecorator.java index 4394fb2..67c58b0 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/PropertyDecorator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/PropertyDecorator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.decorator; import org.apache.commons.beanutils.PropertyUtils; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorListCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorListCellRenderer.java index 39bdb8c..99d82b8 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorListCellRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorListCellRenderer.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.decorator.swing; import jaxx.runtime.decorator.*; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorTableCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorTableCellRenderer.java index aed8ab3..f5a9d58 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorTableCellRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorTableCellRenderer.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.decorator.swing; import jaxx.runtime.decorator.*; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/Application.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/Application.java index 5d9cc65..95c7ec8 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/Application.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/Application.java @@ -1,56 +1,71 @@ -package jaxx.runtime.swing; - -import javax.swing.JFrame; -import javax.swing.SwingUtilities; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import java.awt.GraphicsConfiguration; - -public class Application extends JFrame { - // Special: jaxxc will automatically add a main() method to any components which - // extend <Application> - - - public Application() { - } - - - public Application(GraphicsConfiguration gc) { - super(gc); - } - - - public Application(String title) { - super(title); - } - - - public Application(String title, GraphicsConfiguration gc) { - super(title, gc); - } - - - public void setLookAndFeel(String lookAndFeel) { - if (lookAndFeel.equals("system")) - lookAndFeel = UIManager.getSystemLookAndFeelClassName(); - else if (lookAndFeel.equals("cross_platform")) - lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); - try { - UIManager.setLookAndFeel(lookAndFeel); - if (isDisplayable()) - SwingUtilities.updateComponentTreeUI(this); - } - catch (ClassNotFoundException e) { - throw new RuntimeException(e); - } - catch (InstantiationException e) { - throw new RuntimeException(e); - } - catch (IllegalAccessException e) { - throw new RuntimeException(e); - } - catch (UnsupportedLookAndFeelException e) { - throw new RuntimeException(e); - } - } -} \ No newline at end of file +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime.swing; + +import javax.swing.JFrame; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import java.awt.GraphicsConfiguration; + +public class Application extends JFrame { + + private static final long serialVersionUID = 1L; + // Special: jaxxc will automatically add a main() method to any components which + // extend <Application> + + public Application() { + } + + public Application(GraphicsConfiguration gc) { + super(gc); + } + + public Application(String title) { + super(title); + } + + public Application(String title, GraphicsConfiguration gc) { + super(title, gc); + } + + public void setLookAndFeel(String lookAndFeel) { + if (lookAndFeel.equals("system")) { + lookAndFeel = UIManager.getSystemLookAndFeelClassName(); + } else if (lookAndFeel.equals("cross_platform")) { + lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); + } + try { + UIManager.setLookAndFeel(lookAndFeel); + if (isDisplayable()) { + SwingUtilities.updateComponentTreeUI(this); + } + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } catch (InstantiationException e) { + throw new RuntimeException(e); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } catch (UnsupportedLookAndFeelException e) { + throw new RuntimeException(e); + } + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java index 96e16ce..e476506 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing; import java.awt.AlphaComposite; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI2.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI2.java index 271071f..643cf9b 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI2.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/BlockingLayerUI2.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing; import java.awt.AlphaComposite; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2.java index 66fb367..0e9dc3e 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing; import org.apache.commons.logging.Log; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2Ext.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2Ext.java index 859d4a1..53b527b 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2Ext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/CardLayout2Ext.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing; import java.awt.Container; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/GBC.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/GBC.java index 0a530a4..12409df 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/GBC.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/GBC.java @@ -1,6 +1,7 @@ /** - * *##% Lutin I18n Editor - * Copyright (C) 2008 CodeLutin + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -14,7 +15,8 @@ * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ /* GBC - A convenience class to tame the GridBagLayout diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/HBox.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/HBox.java index 813abcc..4d8733a 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/HBox.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/HBox.java @@ -1,94 +1,110 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime.swing; - -import javax.swing.JPanel; -import java.awt.Insets; - -/** - * Panel which uses an {@link HBoxLayout} by default. - * - * @author Ethan Nicholas - */ -public class HBox extends JPanel { - - private static final long serialVersionUID = 1L; - public static final String SPACING_PROPERTY = "spacing"; - public static final String MARGIN_PROPERTY = "margin"; - public static final String HORIZONTAL_ALIGNMENT_PROPERTY = "horizontalAlignment"; - public static final String VERTICAL_ALIGNMENT_PROPERTY = "verticalAlignment"; - private Insets margin; - - public HBox() { - super(new HBoxLayout()); - } - - /** - * Returns the spacing between components, in pixels. Spacing is applied between components only, - * not to the top or bottom of the container. - * - * @return spacing between components - */ - public int getSpacing() { - return ((HBoxLayout) getLayout()).getSpacing(); - } - - /** - * Sets the spacing between components. Spacing is applied between components only, - * not to the top or bottom of the container. - * - * @param spacing new spacing value - */ - public void setSpacing(int spacing) { - int oldValue = getSpacing(); - ((HBoxLayout) getLayout()).setSpacing(spacing); - firePropertyChange(SPACING_PROPERTY, oldValue, spacing); - revalidate(); - } - - public int getHorizontalAlignment() { - return ((HBoxLayout) getLayout()).getHorizontalAlignment(); - } - - public void setHorizontalAlignment(int horizontalAlignment) { - int oldValue = getHorizontalAlignment(); - ((HBoxLayout) getLayout()).setHorizontalAlignment(horizontalAlignment); - firePropertyChange(HORIZONTAL_ALIGNMENT_PROPERTY, oldValue, horizontalAlignment); - revalidate(); - } - - public int getVerticalAlignment() { - return ((HBoxLayout) getLayout()).getVerticalAlignment(); - } - - public void setVerticalAlignment(int verticalAlignment) { - int oldValue = getVerticalAlignment(); - ((HBoxLayout) getLayout()).setVerticalAlignment(verticalAlignment); - firePropertyChange(VERTICAL_ALIGNMENT_PROPERTY, oldValue, verticalAlignment); - revalidate(); - } - - public Insets getMargin() { - return margin; - } - - public void setMargin(Insets margin) { - Insets oldValue = this.margin; - this.margin = (Insets) margin.clone(); - firePropertyChange(MARGIN_PROPERTY, oldValue, margin); - } - - @Override - public Insets getInsets() { - Insets result = super.getInsets(); - if (margin != null) { - result.top += margin.top; - result.left += margin.left; - result.right += margin.right; - result.bottom += margin.bottom; - } - return result; - } -} +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime.swing; + +import javax.swing.JPanel; +import java.awt.Insets; + +/** + * Panel which uses an {@link HBoxLayout} by default. + * + * @author Ethan Nicholas + */ +public class HBox extends JPanel { + + private static final long serialVersionUID = 1L; + public static final String SPACING_PROPERTY = "spacing"; + public static final String MARGIN_PROPERTY = "margin"; + public static final String HORIZONTAL_ALIGNMENT_PROPERTY = "horizontalAlignment"; + public static final String VERTICAL_ALIGNMENT_PROPERTY = "verticalAlignment"; + private Insets margin; + + public HBox() { + super(new HBoxLayout()); + } + + /** + * Returns the spacing between components, in pixels. Spacing is applied between components only, + * not to the top or bottom of the container. + * + * @return spacing between components + */ + public int getSpacing() { + return ((HBoxLayout) getLayout()).getSpacing(); + } + + /** + * Sets the spacing between components. Spacing is applied between components only, + * not to the top or bottom of the container. + * + * @param spacing new spacing value + */ + public void setSpacing(int spacing) { + int oldValue = getSpacing(); + ((HBoxLayout) getLayout()).setSpacing(spacing); + firePropertyChange(SPACING_PROPERTY, oldValue, spacing); + revalidate(); + } + + public int getHorizontalAlignment() { + return ((HBoxLayout) getLayout()).getHorizontalAlignment(); + } + + public void setHorizontalAlignment(int horizontalAlignment) { + int oldValue = getHorizontalAlignment(); + ((HBoxLayout) getLayout()).setHorizontalAlignment(horizontalAlignment); + firePropertyChange(HORIZONTAL_ALIGNMENT_PROPERTY, oldValue, horizontalAlignment); + revalidate(); + } + + public int getVerticalAlignment() { + return ((HBoxLayout) getLayout()).getVerticalAlignment(); + } + + public void setVerticalAlignment(int verticalAlignment) { + int oldValue = getVerticalAlignment(); + ((HBoxLayout) getLayout()).setVerticalAlignment(verticalAlignment); + firePropertyChange(VERTICAL_ALIGNMENT_PROPERTY, oldValue, verticalAlignment); + revalidate(); + } + + public Insets getMargin() { + return margin; + } + + public void setMargin(Insets margin) { + Insets oldValue = this.margin; + this.margin = (Insets) margin.clone(); + firePropertyChange(MARGIN_PROPERTY, oldValue, margin); + } + + @Override + public Insets getInsets() { + Insets result = super.getInsets(); + if (margin != null) { + result.top += margin.top; + result.left += margin.left; + result.right += margin.right; + result.bottom += margin.bottom; + } + return result; + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/HBoxBeanInfo.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/HBoxBeanInfo.java index 8423d7d..ee09a8b 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/HBoxBeanInfo.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/HBoxBeanInfo.java @@ -1,6 +1,22 @@ /* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.runtime.swing; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/HBoxLayout.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/HBoxLayout.java index ac22f6e..3abe437 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/HBoxLayout.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/HBoxLayout.java @@ -1,127 +1,143 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime.swing; - -import javax.swing.SwingConstants; -import java.awt.Component; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.Insets; -import java.awt.LayoutManager; - -/** - * Horizontal box layout. The layout rules followed by this class are quite different than the core BoxLayout class, - * and in general represent a more useful algorithm. - * - * @author Ethan Nicholas - */ -public class HBoxLayout implements LayoutManager { - - private int spacing = 6; - private int horizontalAlignment = SwingConstants.LEFT; - private int verticalAlignment = SwingConstants.TOP; - - public int getSpacing() { - return spacing; - } - - public void setSpacing(int spacing) { - this.spacing = spacing; - } - - public int getHorizontalAlignment() { - return horizontalAlignment; - } - - public void setHorizontalAlignment(int horizontalAlignment) { - this.horizontalAlignment = horizontalAlignment; - } - - public int getVerticalAlignment() { - return verticalAlignment; - } - - public void setVerticalAlignment(int verticalAlignment) { - this.verticalAlignment = verticalAlignment; - } - - @Override - public void addLayoutComponent(String name, Component comp) { - } - - @Override - public void layoutContainer(Container parent) { - Insets insets = parent.getInsets(); - int parentHeight = parent.getSize().height - insets.top - insets.bottom; - int count = parent.getComponentCount(); - Dimension preferredSize = parent.getPreferredSize(); - int x; - switch (horizontalAlignment) { - case SwingConstants.LEFT: - x = insets.left; - break; - case SwingConstants.CENTER: - x = insets.left + (parent.getWidth() - preferredSize.width) / 2; - break; - case SwingConstants.RIGHT: - x = insets.left + (parent.getWidth() - preferredSize.width); - break; - default: - throw new IllegalArgumentException("invalid horizontal alignment: " + horizontalAlignment); - } - - for (int i = 0; i < count; i++) { - Component component = parent.getComponent(i); - Dimension childPreferredSize = component.getPreferredSize(); - int height = Math.min(childPreferredSize.height, parentHeight); - int y; - switch (verticalAlignment) { - case SwingConstants.TOP: - y = insets.top; - break; - case SwingConstants.CENTER: - y = insets.top + (parentHeight - childPreferredSize.height) / 2; - break; - case SwingConstants.BOTTOM: - y = insets.top + (parentHeight - childPreferredSize.height); - break; - default: - throw new IllegalArgumentException("invalid vertical alignment: " + verticalAlignment); - } - component.setBounds(x, y, childPreferredSize.width, height); - x += childPreferredSize.width + spacing; - } - } - - @Override - public Dimension minimumLayoutSize(Container parent) { - int width = (parent.getComponentCount() - 1) * spacing; - int height = 0; - for (int i = parent.getComponentCount() - 1; i >= 0; i--) { - Dimension minimumSize = parent.getComponent(i).getMinimumSize(); - width += minimumSize.width; - height = Math.max(height, minimumSize.height); - } - Insets insets = parent.getInsets(); - return new Dimension(width + insets.left + insets.right, height + insets.top + insets.bottom); - } - - @Override - public Dimension preferredLayoutSize(Container parent) { - int width = (parent.getComponentCount() - 1) * spacing; - int height = 0; - for (int i = parent.getComponentCount() - 1; i >= 0; i--) { - Dimension preferredSize = parent.getComponent(i).getPreferredSize(); - width += preferredSize.width; - height = Math.max(height, preferredSize.height); - } - Insets insets = parent.getInsets(); - return new Dimension(width + insets.left + insets.right, height + insets.top + insets.bottom); - } - - @Override - public void removeLayoutComponent(Component comp) { - } -} +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime.swing; + +import javax.swing.SwingConstants; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Insets; +import java.awt.LayoutManager; + +/** + * Horizontal box layout. The layout rules followed by this class are quite different than the core BoxLayout class, + * and in general represent a more useful algorithm. + * + * @author Ethan Nicholas + */ +public class HBoxLayout implements LayoutManager { + + private int spacing = 6; + private int horizontalAlignment = SwingConstants.LEFT; + private int verticalAlignment = SwingConstants.TOP; + + public int getSpacing() { + return spacing; + } + + public void setSpacing(int spacing) { + this.spacing = spacing; + } + + public int getHorizontalAlignment() { + return horizontalAlignment; + } + + public void setHorizontalAlignment(int horizontalAlignment) { + this.horizontalAlignment = horizontalAlignment; + } + + public int getVerticalAlignment() { + return verticalAlignment; + } + + public void setVerticalAlignment(int verticalAlignment) { + this.verticalAlignment = verticalAlignment; + } + + @Override + public void addLayoutComponent(String name, Component comp) { + } + + @Override + public void layoutContainer(Container parent) { + Insets insets = parent.getInsets(); + int parentHeight = parent.getSize().height - insets.top - insets.bottom; + int count = parent.getComponentCount(); + Dimension preferredSize = parent.getPreferredSize(); + int x; + switch (horizontalAlignment) { + case SwingConstants.LEFT: + x = insets.left; + break; + case SwingConstants.CENTER: + x = insets.left + (parent.getWidth() - preferredSize.width) / 2; + break; + case SwingConstants.RIGHT: + x = insets.left + (parent.getWidth() - preferredSize.width); + break; + default: + throw new IllegalArgumentException("invalid horizontal alignment: " + horizontalAlignment); + } + + for (int i = 0; i < count; i++) { + Component component = parent.getComponent(i); + Dimension childPreferredSize = component.getPreferredSize(); + int height = Math.min(childPreferredSize.height, parentHeight); + int y; + switch (verticalAlignment) { + case SwingConstants.TOP: + y = insets.top; + break; + case SwingConstants.CENTER: + y = insets.top + (parentHeight - childPreferredSize.height) / 2; + break; + case SwingConstants.BOTTOM: + y = insets.top + (parentHeight - childPreferredSize.height); + break; + default: + throw new IllegalArgumentException("invalid vertical alignment: " + verticalAlignment); + } + component.setBounds(x, y, childPreferredSize.width, height); + x += childPreferredSize.width + spacing; + } + } + + @Override + public Dimension minimumLayoutSize(Container parent) { + int width = (parent.getComponentCount() - 1) * spacing; + int height = 0; + for (int i = parent.getComponentCount() - 1; i >= 0; i--) { + Dimension minimumSize = parent.getComponent(i).getMinimumSize(); + width += minimumSize.width; + height = Math.max(height, minimumSize.height); + } + Insets insets = parent.getInsets(); + return new Dimension(width + insets.left + insets.right, height + insets.top + insets.bottom); + } + + @Override + public Dimension preferredLayoutSize(Container parent) { + int width = (parent.getComponentCount() - 1) * spacing; + int height = 0; + for (int i = parent.getComponentCount() - 1; i >= 0; i--) { + Dimension preferredSize = parent.getComponent(i).getPreferredSize(); + width += preferredSize.width; + height = Math.max(height, preferredSize.height); + } + Insets insets = parent.getInsets(); + return new Dimension(width + insets.left + insets.right, height + insets.top + insets.bottom); + } + + @Override + public void removeLayoutComponent(Component comp) { + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/Item.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/Item.java index 960ac67..dc92860 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/Item.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/Item.java @@ -1,223 +1,239 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime.swing; - -import javax.swing.event.SwingPropertyChangeSupport; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.util.ArrayList; -import java.util.List; - -// This needs to be split into two classes, Item and TreeItem -/** - * An item in a component such as <code>JComboBox</code> or <code>JTree</code>. The <code>Item</code> - * class corresponds to the <code><item></code> tag in JAXX source files. - */ -public class Item { - - public static final String LABEL_PROPERTY = "label"; - public static final String VALUE_PROPERTY = "value"; - public static final String SELECTED_PROPERTY = "selected"; - private String id; - private String label; - private Object value; - private boolean selected; - private List<Item> children; - private Item parent; - private PropertyChangeSupport propertyChangeSupport; - - /** - * Creates a new Item. This should only be called from compiled JAXX files. - * - * @param id the item's ID - * @param label the string that should be used to represent the item visually - * @param value the item's actual value - * @param selected <code>true</code> if the item should be selected by default - */ - public Item(String id, String label, Object value, boolean selected) { - this.id = id; - this.label = label; - this.value = value; - this.selected = selected; - } - - /** - * Returns this item's ID. - * - * @return the JAXX ID attribute - */ - public String getId() { - return id; - } - - /** - * Returns the string that should be used to represent the item at display time. If <code>null</code>, - * <code>String.valueOf(getValue())</code> will be used instead. - * - * @return this item's display string - * @see #setLabel - */ - public String getLabel() { - return label; - } - - /** - * Sets the item's display string. If <code>null, String.valueOf(getValue())</code> will be used instead. - * - * @param label the new display string - * @see #getLabel - */ - public void setLabel(String label) { - String oldLabel = this.label; - this.label = label; - firePropertyChange(LABEL_PROPERTY, oldLabel, label); - } - - /** - * Returns the item's actual value as it appears in the component's model. The <code>Item</code> itself is not - * visible from the model, only the value. - * - * @return the item's value - * @see #setValue - */ - public Object getValue() { - return value; - } - - /** - * Sets the item's value as it appears in the component's model. The <code>Item</code> itself is not - * visible from the model, only the value. - * - * @param value the new value - * @see #getValue - */ - public void setValue(Object value) { - Object oldValue = this.value; - this.value = value; - firePropertyChange(VALUE_PROPERTY, oldValue, value); - } - - /** - * Returns <code>true</code> if this item is currently selected. This is a bound property. - * - * @return <code>true</code> if item is selected - * @see #setSelected - */ - public boolean isSelected() { - return selected; - } - - /** - * Sets the item's selection state. This is a bound property. - * - * @param selected the new selection state - * @see #isSelected - */ - public void setSelected(boolean selected) { - boolean oldSelected = this.selected; - this.selected = selected; - firePropertyChange(SELECTED_PROPERTY, oldSelected, selected); - } - - /** - * Adds a new child node (Items can be nested in trees). - * - * @param item the new child item - */ - public void addChild(Item item) { - if (children == null) { - children = new ArrayList<Item>(); - } - children.add(item); - item.parent = this; - } - - /** - * Remove child node a new child node - * - * @param item to remove - */ - public void removeChild(Item item) { - if (children != null) { - children.remove(item); - } - } - - /** - * Remove all childs nodes - * - * @param items list of items to remove - */ - public void removeChilds(List<Item> items) { - if (children != null) { - children.removeAll(items); - } - } - - /** - * Returns a list of this item's children. - * - * @return a list of all nested child nodes - */ - public List<Item> getChildren() { - if (children == null) { - children = new ArrayList<Item>(); - } - return children; - } - - /** - * Returns the <code>Item</code> containing this <code>Item</code>, or <code>null</code> for a top-level - * <code>Item</code>. - * - * @return the item parent (or null) - */ - public Item getParent() { - return parent; - } - - /** - * Set the parent of this item - * - * @param parent the item parent (or null) - */ - public void setParent(Item parent) { - this.parent = parent; - } - - private PropertyChangeSupport getPropertyChangeSupport() { - if (propertyChangeSupport == null) { - propertyChangeSupport = new SwingPropertyChangeSupport(this); - } - return propertyChangeSupport; - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - getPropertyChangeSupport().addPropertyChangeListener(listener); - } - - public void addPropertyChangeListener(String property, PropertyChangeListener listener) { - getPropertyChangeSupport().addPropertyChangeListener(property, listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - getPropertyChangeSupport().removePropertyChangeListener(listener); - } - - public void removePropertyChangeListener(String property, PropertyChangeListener listener) { - getPropertyChangeSupport().removePropertyChangeListener(property, listener); - } - - protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { - if (propertyChangeSupport != null) { - getPropertyChangeSupport().firePropertyChange(propertyName, oldValue, newValue); - } - } - - @Override - public String toString() { - return getClass().getName() + "[" + value + "]"; - } -} +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime.swing; + +import javax.swing.event.SwingPropertyChangeSupport; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.util.ArrayList; +import java.util.List; + +// This needs to be split into two classes, Item and TreeItem +/** + * An item in a component such as <code>JComboBox</code> or <code>JTree</code>. The <code>Item</code> + * class corresponds to the <code><item></code> tag in JAXX source files. + */ +public class Item { + + public static final String LABEL_PROPERTY = "label"; + public static final String VALUE_PROPERTY = "value"; + public static final String SELECTED_PROPERTY = "selected"; + private String id; + private String label; + private Object value; + private boolean selected; + private List<Item> children; + private Item parent; + private PropertyChangeSupport propertyChangeSupport; + + /** + * Creates a new Item. This should only be called from compiled JAXX files. + * + * @param id the item's ID + * @param label the string that should be used to represent the item visually + * @param value the item's actual value + * @param selected <code>true</code> if the item should be selected by default + */ + public Item(String id, String label, Object value, boolean selected) { + this.id = id; + this.label = label; + this.value = value; + this.selected = selected; + } + + /** + * Returns this item's ID. + * + * @return the JAXX ID attribute + */ + public String getId() { + return id; + } + + /** + * Returns the string that should be used to represent the item at display time. If <code>null</code>, + * <code>String.valueOf(getValue())</code> will be used instead. + * + * @return this item's display string + * @see #setLabel + */ + public String getLabel() { + return label; + } + + /** + * Sets the item's display string. If <code>null, String.valueOf(getValue())</code> will be used instead. + * + * @param label the new display string + * @see #getLabel + */ + public void setLabel(String label) { + String oldLabel = this.label; + this.label = label; + firePropertyChange(LABEL_PROPERTY, oldLabel, label); + } + + /** + * Returns the item's actual value as it appears in the component's model. The <code>Item</code> itself is not + * visible from the model, only the value. + * + * @return the item's value + * @see #setValue + */ + public Object getValue() { + return value; + } + + /** + * Sets the item's value as it appears in the component's model. The <code>Item</code> itself is not + * visible from the model, only the value. + * + * @param value the new value + * @see #getValue + */ + public void setValue(Object value) { + Object oldValue = this.value; + this.value = value; + firePropertyChange(VALUE_PROPERTY, oldValue, value); + } + + /** + * Returns <code>true</code> if this item is currently selected. This is a bound property. + * + * @return <code>true</code> if item is selected + * @see #setSelected + */ + public boolean isSelected() { + return selected; + } + + /** + * Sets the item's selection state. This is a bound property. + * + * @param selected the new selection state + * @see #isSelected + */ + public void setSelected(boolean selected) { + boolean oldSelected = this.selected; + this.selected = selected; + firePropertyChange(SELECTED_PROPERTY, oldSelected, selected); + } + + /** + * Adds a new child node (Items can be nested in trees). + * + * @param item the new child item + */ + public void addChild(Item item) { + if (children == null) { + children = new ArrayList<Item>(); + } + children.add(item); + item.parent = this; + } + + /** + * Remove child node a new child node + * + * @param item to remove + */ + public void removeChild(Item item) { + if (children != null) { + children.remove(item); + } + } + + /** + * Remove all childs nodes + * + * @param items list of items to remove + */ + public void removeChilds(List<Item> items) { + if (children != null) { + children.removeAll(items); + } + } + + /** + * Returns a list of this item's children. + * + * @return a list of all nested child nodes + */ + public List<Item> getChildren() { + if (children == null) { + children = new ArrayList<Item>(); + } + return children; + } + + /** + * Returns the <code>Item</code> containing this <code>Item</code>, or <code>null</code> for a top-level + * <code>Item</code>. + * + * @return the item parent (or null) + */ + public Item getParent() { + return parent; + } + + /** + * Set the parent of this item + * + * @param parent the item parent (or null) + */ + public void setParent(Item parent) { + this.parent = parent; + } + + private PropertyChangeSupport getPropertyChangeSupport() { + if (propertyChangeSupport == null) { + propertyChangeSupport = new SwingPropertyChangeSupport(this); + } + return propertyChangeSupport; + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + getPropertyChangeSupport().addPropertyChangeListener(listener); + } + + public void addPropertyChangeListener(String property, PropertyChangeListener listener) { + getPropertyChangeSupport().addPropertyChangeListener(property, listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + getPropertyChangeSupport().removePropertyChangeListener(listener); + } + + public void removePropertyChangeListener(String property, PropertyChangeListener listener) { + getPropertyChangeSupport().removePropertyChangeListener(property, listener); + } + + protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { + if (propertyChangeSupport != null) { + getPropertyChangeSupport().firePropertyChange(propertyName, oldValue, newValue); + } + } + + @Override + public String toString() { + return getClass().getName() + "[" + value + "]"; + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXButtonGroup.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXButtonGroup.java index bb36243..ce20a1e 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXButtonGroup.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXButtonGroup.java @@ -1,6 +1,22 @@ /* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.runtime.swing; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXComboBox.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXComboBox.java index d956569..48a4e8a 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXComboBox.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXComboBox.java @@ -1,292 +1,308 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime.swing; - -import javax.swing.AbstractListModel; -import javax.swing.ComboBoxModel; -import javax.swing.DefaultListCellRenderer; -import javax.swing.JComboBox; -import javax.swing.JList; -import javax.swing.ListModel; -import java.awt.Component; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class JAXXComboBox extends JComboBox { - - private static final long serialVersionUID = 1L; - - public class JAXXComboBoxModel extends AbstractListModel implements ComboBoxModel { - - private List<Item> items; - private Object selectedItem; - private static final long serialVersionUID = -8940733376638766414L; - - public JAXXComboBoxModel(List<Item> items) { - this.items = items; - - PropertyChangeListener listener = new PropertyChangeListener() { - - @Override - public void propertyChange(PropertyChangeEvent e) { - if (e.getPropertyName().equals(Item.SELECTED_PROPERTY)) { - Item item = (Item) e.getSource(); - int itemIndex = JAXXComboBoxModel.this.items.indexOf(item); - // TODO: fix cut-and-pasting badness - int[] oldSelection = new int[]{getSelectedIndex()}; - int[] newSelection; - int index = -1; - for (int i = 0; i < oldSelection.length; i++) { - if (oldSelection[i] == itemIndex) { - index = i; - break; - } - } - if (item.isSelected()) { - if (index != -1) // it was already selected - { - return; - } - newSelection = new int[oldSelection.length + 1]; - System.arraycopy(oldSelection, 0, newSelection, 0, oldSelection.length); - newSelection[newSelection.length - 1] = itemIndex; - } else { - if (index == -1) // it already wasn't selected - { - return; - } - newSelection = new int[oldSelection.length - 1]; - System.arraycopy(oldSelection, 0, newSelection, 0, index); - System.arraycopy(oldSelection, index + 1, newSelection, index, oldSelection.length - 1 - index); - } - if (newSelection.length > 0) { - setSelectedIndex(newSelection[0]); - } - } else { - // TODO: more cut-and-pasting badness - for (int i = 0; i < getSize(); i++) { - if (getElementAt(i) == ((Item) e.getSource()).getValue()) { - fireContentsChanged(JAXXComboBoxModel.this, i, i); - if (getSelectedIndex() == i) { - fireItemStateChanged(new ItemEvent(JAXXComboBox.this, ItemEvent.ITEM_STATE_CHANGED, getElementAt(i), ItemEvent.DESELECTED)); - } - return; - } - } - } - } - }; - for (Item item : items) { - item.addPropertyChangeListener(listener); - } - } - - public List<Item> getItems() { - return items; - } - - @Override - public Object getElementAt(int i) { - return items.get(i).getValue(); - } - - @Override - public int getSize() { - return items.size(); - } - - @Override - public Object getSelectedItem() { - return selectedItem; - } - - @Override - public void setSelectedItem(Object selectedItem) { - if ((this.selectedItem != null && !this.selectedItem.equals(selectedItem)) || - this.selectedItem == null && selectedItem != null) { - this.selectedItem = selectedItem; - fireContentsChanged(this, -1, -1); - } - } - } - - public JAXXComboBox() { - setRenderer(new DefaultListCellRenderer() { - - private static final long serialVersionUID = 1L; - - @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - ListModel model = list.getModel(); - if (model instanceof JAXXComboBoxModel) { - List/*<Item>*/ items = ((JAXXComboBoxModel) model).items; - Item item = null; - if (index == -1) { - for (Object item1 : items) { - Item testItem = (Item) item1; - if (testItem.getValue() == value) { - item = testItem; - break; - } - } - } else { - item = (Item) items.get(index); - } - - if (item != null) { - String label = item.getLabel(); - if (label != null) { - value = label; - } - } - } - return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - } - }); - - addItemListener(new ItemListener() { - - @Override - public void itemStateChanged(ItemEvent e) { - ListModel model = getModel(); - if (model instanceof JAXXComboBoxModel) { - List<Item> items = ((JAXXComboBoxModel) model).items; - for (int i = items.size() - 1; i >= 0; i--) { - boolean selected = getSelectedIndex() == i; - Item item = items.get(i); - if (selected != item.isSelected()) { - item.setSelected(selected); - } - } - } - } - }); - } - - /** - * Fill a combo box model with some datas, and select after all the given object - * - * @param data data ot inject in combo - * @param select the object to select in combo after reflling his model - * @param methodName method to invoke to display data's name - */ - public void fillComboBox(Collection<?> data, Object select, String methodName) { - // prepare method to use - Method m; - try { - m = select.getClass().getMethod(methodName); - m.setAccessible(true); - } catch (NoSuchMethodException e) { - throw new IllegalArgumentException("could not find method " + methodName + " on " + select.getClass()); - } - - List<Item> items = new ArrayList<Item>(); - for (Object o : data) { - boolean selected = o.equals(select); - try { - items.add(new Item(o.toString(), (String) m.invoke(o), o, selected)); - } catch (IllegalAccessException e) { - // shoudl never happen ? - throw new RuntimeException(e); - } catch (InvocationTargetException e) { - // shoudl never happen ? - throw new RuntimeException(e); - } - } - setItems(items); - } - - // this way we can keep it marked protected and still allow code in this file to call it - @Override - protected void fireItemStateChanged(ItemEvent e) { - super.fireItemStateChanged(e); - } - - public void setItems(List<Item> items) { - setModel(new JAXXComboBoxModel(items)); - List<Integer> selectedIndexList = new ArrayList<Integer>(); - for (int i = 0; i < items.size(); i++) { - if (items.get(i).isSelected()) { - selectedIndexList.add(i); - } - } - int[] selectedIndices = new int[selectedIndexList.size()]; - for (int i = 0; i < selectedIndexList.size(); i++) { - selectedIndices[i] = selectedIndexList.get(i); - } - if (selectedIndices.length > 0) { - setSelectedIndex(selectedIndices[0]); - } - } - - public List<Item> getItems() { - if (getModel() instanceof JAXXComboBoxModel) { - return ((JAXXComboBoxModel) getModel()).getItems(); - } - return null; - } - - public void setSelectedItem(Item item) { - //TC-20092004 Anomalie #73 fix npe when want to call with a null - // value - super.setSelectedItem(item == null ? null : item.getValue()); - } - - public Item getSelectedJaxxItem() { - Object selected = super.getSelectedItem(); - return findItem(selected); - } - - public Item findItem(Object value) { - List<Item> items = getItems(); - if (items != null) { - for (Item i : items) { - if (i.getValue().equals(value)) { - return i; - } - } - } - return null; - } - - public void addItem(Item item) { - List<Item> items = getItems(); - if (items != null) { - items.add(item); - setItems(items); - } - } - - public void addAllItems(Collection<Item> itemsToAdd) { - List<Item> items = getItems(); - if (items != null) { - items.addAll(itemsToAdd); - setItems(items); - } - } - - public void removeItem(Item item) { - List<Item> items = getItems(); - if (items != null) { - items.remove(item); - setItems(items); - } - } - - public void removeAllItems(Collection<Item> itemsToRemove) { - List<Item> items = getItems(); - if (items != null) { - items.removeAll(itemsToRemove); - setItems(items); - } - } -} +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime.swing; + +import javax.swing.AbstractListModel; +import javax.swing.ComboBoxModel; +import javax.swing.DefaultListCellRenderer; +import javax.swing.JComboBox; +import javax.swing.JList; +import javax.swing.ListModel; +import java.awt.Component; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +public class JAXXComboBox extends JComboBox { + + private static final long serialVersionUID = 1L; + + public class JAXXComboBoxModel extends AbstractListModel implements ComboBoxModel { + + private List<Item> items; + private Object selectedItem; + private static final long serialVersionUID = -8940733376638766414L; + + public JAXXComboBoxModel(List<Item> items) { + this.items = items; + + PropertyChangeListener listener = new PropertyChangeListener() { + + @Override + public void propertyChange(PropertyChangeEvent e) { + if (e.getPropertyName().equals(Item.SELECTED_PROPERTY)) { + Item item = (Item) e.getSource(); + int itemIndex = JAXXComboBoxModel.this.items.indexOf(item); + // TODO: fix cut-and-pasting badness + int[] oldSelection = new int[]{getSelectedIndex()}; + int[] newSelection; + int index = -1; + for (int i = 0; i < oldSelection.length; i++) { + if (oldSelection[i] == itemIndex) { + index = i; + break; + } + } + if (item.isSelected()) { + if (index != -1) // it was already selected + { + return; + } + newSelection = new int[oldSelection.length + 1]; + System.arraycopy(oldSelection, 0, newSelection, 0, oldSelection.length); + newSelection[newSelection.length - 1] = itemIndex; + } else { + if (index == -1) // it already wasn't selected + { + return; + } + newSelection = new int[oldSelection.length - 1]; + System.arraycopy(oldSelection, 0, newSelection, 0, index); + System.arraycopy(oldSelection, index + 1, newSelection, index, oldSelection.length - 1 - index); + } + if (newSelection.length > 0) { + setSelectedIndex(newSelection[0]); + } + } else { + // TODO: more cut-and-pasting badness + for (int i = 0; i < getSize(); i++) { + if (getElementAt(i) == ((Item) e.getSource()).getValue()) { + fireContentsChanged(JAXXComboBoxModel.this, i, i); + if (getSelectedIndex() == i) { + fireItemStateChanged(new ItemEvent(JAXXComboBox.this, ItemEvent.ITEM_STATE_CHANGED, getElementAt(i), ItemEvent.DESELECTED)); + } + return; + } + } + } + } + }; + for (Item item : items) { + item.addPropertyChangeListener(listener); + } + } + + public List<Item> getItems() { + return items; + } + + @Override + public Object getElementAt(int i) { + return items.get(i).getValue(); + } + + @Override + public int getSize() { + return items.size(); + } + + @Override + public Object getSelectedItem() { + return selectedItem; + } + + @Override + public void setSelectedItem(Object selectedItem) { + if ((this.selectedItem != null && !this.selectedItem.equals(selectedItem)) || + this.selectedItem == null && selectedItem != null) { + this.selectedItem = selectedItem; + fireContentsChanged(this, -1, -1); + } + } + } + + public JAXXComboBox() { + setRenderer(new DefaultListCellRenderer() { + + private static final long serialVersionUID = 1L; + + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + ListModel model = list.getModel(); + if (model instanceof JAXXComboBoxModel) { + List/*<Item>*/ items = ((JAXXComboBoxModel) model).items; + Item item = null; + if (index == -1) { + for (Object item1 : items) { + Item testItem = (Item) item1; + if (testItem.getValue() == value) { + item = testItem; + break; + } + } + } else { + item = (Item) items.get(index); + } + + if (item != null) { + String label = item.getLabel(); + if (label != null) { + value = label; + } + } + } + return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + } + }); + + addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + ListModel model = getModel(); + if (model instanceof JAXXComboBoxModel) { + List<Item> items = ((JAXXComboBoxModel) model).items; + for (int i = items.size() - 1; i >= 0; i--) { + boolean selected = getSelectedIndex() == i; + Item item = items.get(i); + if (selected != item.isSelected()) { + item.setSelected(selected); + } + } + } + } + }); + } + + /** + * Fill a combo box model with some datas, and select after all the given object + * + * @param data data ot inject in combo + * @param select the object to select in combo after reflling his model + * @param methodName method to invoke to display data's name + */ + public void fillComboBox(Collection<?> data, Object select, String methodName) { + // prepare method to use + Method m; + try { + m = select.getClass().getMethod(methodName); + m.setAccessible(true); + } catch (NoSuchMethodException e) { + throw new IllegalArgumentException("could not find method " + methodName + " on " + select.getClass()); + } + + List<Item> items = new ArrayList<Item>(); + for (Object o : data) { + boolean selected = o.equals(select); + try { + items.add(new Item(o.toString(), (String) m.invoke(o), o, selected)); + } catch (IllegalAccessException e) { + // shoudl never happen ? + throw new RuntimeException(e); + } catch (InvocationTargetException e) { + // shoudl never happen ? + throw new RuntimeException(e); + } + } + setItems(items); + } + + // this way we can keep it marked protected and still allow code in this file to call it + @Override + protected void fireItemStateChanged(ItemEvent e) { + super.fireItemStateChanged(e); + } + + public void setItems(List<Item> items) { + setModel(new JAXXComboBoxModel(items)); + List<Integer> selectedIndexList = new ArrayList<Integer>(); + for (int i = 0; i < items.size(); i++) { + if (items.get(i).isSelected()) { + selectedIndexList.add(i); + } + } + int[] selectedIndices = new int[selectedIndexList.size()]; + for (int i = 0; i < selectedIndexList.size(); i++) { + selectedIndices[i] = selectedIndexList.get(i); + } + if (selectedIndices.length > 0) { + setSelectedIndex(selectedIndices[0]); + } + } + + public List<Item> getItems() { + if (getModel() instanceof JAXXComboBoxModel) { + return ((JAXXComboBoxModel) getModel()).getItems(); + } + return null; + } + + public void setSelectedItem(Item item) { + //TC-20092004 Anomalie #73 fix npe when want to call with a null + // value + super.setSelectedItem(item == null ? null : item.getValue()); + } + + public Item getSelectedJaxxItem() { + Object selected = super.getSelectedItem(); + return findItem(selected); + } + + public Item findItem(Object value) { + List<Item> items = getItems(); + if (items != null) { + for (Item i : items) { + if (i.getValue().equals(value)) { + return i; + } + } + } + return null; + } + + public void addItem(Item item) { + List<Item> items = getItems(); + if (items != null) { + items.add(item); + setItems(items); + } + } + + public void addAllItems(Collection<Item> itemsToAdd) { + List<Item> items = getItems(); + if (items != null) { + items.addAll(itemsToAdd); + setItems(items); + } + } + + public void removeItem(Item item) { + List<Item> items = getItems(); + if (items != null) { + items.remove(item); + setItems(items); + } + } + + public void removeAllItems(Collection<Item> itemsToRemove) { + List<Item> items = getItems(); + if (items != null) { + items.removeAll(itemsToRemove); + setItems(items); + } + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXList.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXList.java index dd3b0a8..b99fcd1 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXList.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXList.java @@ -1,396 +1,412 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime.swing; - -import javax.swing.AbstractListModel; -import javax.swing.DefaultListCellRenderer; -import javax.swing.JList; -import javax.swing.ListModel; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import java.awt.Component; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class JAXXList extends JList { - - private static final long serialVersionUID = 1L; - - public class JAXXListModel extends AbstractListModel { - - private List<Item> items; - private static final long serialVersionUID = -1598924187490122036L; - - public JAXXListModel(List<Item> items) { - this.items = items; - - PropertyChangeListener listener = new PropertyChangeListener() { - - @Override - public void propertyChange(PropertyChangeEvent e) { - if (e.getPropertyName().equals(Item.SELECTED_PROPERTY)) { - Item item = (Item) e.getSource(); - int itemIndex = JAXXListModel.this.items.indexOf(item); - int[] oldSelection = getSelectedIndices(); - int[] newSelection; - int index = -1; - for (int i = 0; i < oldSelection.length; i++) { - if (oldSelection[i] == itemIndex) { - index = i; - break; - } - } - if (item.isSelected()) { - if (index != -1) // it was already selected - { - return; - } - newSelection = new int[oldSelection.length + 1]; - System.arraycopy(oldSelection, 0, newSelection, 0, oldSelection.length); - newSelection[newSelection.length - 1] = itemIndex; - } else { - if (index == -1) // it already wasn't selected - { - return; - } - newSelection = new int[oldSelection.length - 1]; - System.arraycopy(oldSelection, 0, newSelection, 0, index); - System.arraycopy(oldSelection, index + 1, newSelection, index, oldSelection.length - 1 - index); - } - setSelectedIndices(newSelection); - } else { - for (int i = 0; i < getSize(); i++) { - if (getElementAt(i) == ((Item) e.getSource()).getValue()) { - fireContentsChanged(JAXXListModel.this, i, i); - if (isSelectedIndex(i)) { - fireSelectionValueChanged(i, i, false); - } - return; - } - } - } - } - }; - for (Item item : items) { - item.addPropertyChangeListener(listener); - } - } - - public List<Item> getItems(){ - return items; - } - - @Override - public Object getElementAt(int i) { - return items.get(i).getValue(); - } - - @Override - public int getSize() { - return items.size(); - } - } - - public JAXXList() { - setCellRenderer(new DefaultListCellRenderer() { - - private static final long serialVersionUID = 1L; - - @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - ListModel model = list.getModel(); - if (model instanceof JAXXListModel) { - Item item = ((JAXXListModel) model).items.get(index); - String label = item.getLabel(); - if (label != null) { - value = label; - } - } - return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - } - }); - - addListSelectionListener(new ListSelectionListener() { - - @Override - public void valueChanged(ListSelectionEvent e) { - ListModel model = getModel(); - if (model instanceof JAXXListModel) { - List<Item> items = ((JAXXListModel) model).items; - for (int i = items.size() - 1; i >= 0; i--) { - boolean selected = isSelectedIndex(i); - Item item = items.get(i); - if (selected != item.isSelected()) { - item.setSelected(selected); - } - } - } - } - }); - } - - // this way we can keep it marked protected and still allow code in this file to call it - @Override - protected void fireSelectionValueChanged(int firstIndex, int lastIndex, boolean isAdjusting) { - super.fireSelectionValueChanged(firstIndex, lastIndex, isAdjusting); - } - - public void setItems(List<Item> items) { - setModel(new JAXXListModel(items)); - List<Integer> selectedIndexList = new ArrayList<Integer>(); - for (int i = 0; i < items.size(); i++) { - if (items.get(i).isSelected()) { - selectedIndexList.add(i); - } - } - int[] selectedIndices = new int[selectedIndexList.size()]; - for (int i = 0; i < selectedIndexList.size(); i++) { - selectedIndices[i] = selectedIndexList.get(i); - } - setSelectedIndices(selectedIndices); - } - - public List<Item> getItems(){ - if (getModel() instanceof JAXXListModel){ - return ((JAXXListModel)getModel()).getItems(); - } - return null; - } - - public void setSelectedValue(Object value) { - super.setSelectedValue(value, true); - } - - /** - * Set the selected Objects - * - * @param values Objects must be selected in the list - */ - public void setSelectedValues(Object[] values) { - if (values != null){ - List<Integer> selectedIndices = new ArrayList<Integer>(); - ListModel model = getModel(); - for (int i = 0; i < model.getSize(); i++) { - Object o = model.getElementAt(i); - for (Object value : values) { - if (o.equals(value)) { - selectedIndices.add(i); - break; - } - } - } - int[] ints = new int[selectedIndices.size()]; - for (int i = 0; i < ints.length; i++) { - ints[i] = selectedIndices.get(i).intValue(); - } - setSelectedIndices(ints); - } - else{ - // No selection if values is null - setSelectedIndex(-1); - } - } - - public void setSelectedItem(Item item) { - super.setSelectedValue(item.getValue(), true); - } - - public void setSelectedItems(List<Item> itemsToSelect) { - if (itemsToSelect != null){ - List<Item> items = getItems(); - int[] indices = new int[itemsToSelect.size()]; - int i = 0; - for (Item item : itemsToSelect){ - indices[i] = items.indexOf(item); - i++; - } - super.setSelectedIndices(indices); - } - } - - public Item getSelectedItem(){ - Object selected = super.getSelectedValue(); - return findItem(selected); - } - - public List<Item> getSelectedItems(){ - Object[] selected = super.getSelectedValues(); - java.util.List<Item> itemsSelected = new ArrayList<Item>(); - for (Object s : selected){ - itemsSelected.add(findItem(s)); - } - return itemsSelected; - } - - public Item findItem(Object value){ - List<Item> items = getItems(); - if (items != null){ - for (Item i : items){ - if (i.getValue().equals(value)){ - return i; - } - } - } - return null; - } - - public void addItem(Item item){ - List<Item> items = getItems(); - if (items != null){ - items.add(item); - setItems(items); - } - } - - public void addAllItems(Collection<Item> itemsToAdd){ - List<Item> items = getItems(); - if (items != null){ - items.addAll(itemsToAdd); - setItems(items); - } - } - - public void removeItem(Item item){ - List<Item> items = getItems(); - if (items != null){ - items.remove(item); - setItems(items); - } - } - - public void removeAllItems(Collection<Item> itemsToRemove){ - List<Item> items = getItems(); - if (items != null){ - items.removeAll(itemsToRemove); - setItems(items); - } - } - - /** - * Fill a list model with some datas, and select after all the given object - * - * @param data data ot inject in combo - * @param selects the objects to select in list after reflling his model - */ - public void fillList(Collection<?> data, Collection<?> selects) { - if (selects == null) { - selects = java.util.Collections.EMPTY_LIST; - } - List<Item> items = new ArrayList<Item>(); - for (Object o : data) { - boolean selected = false; - for (Object select : selects) { - if (selected = o.equals(select)) { - break; - } - } - items.add(new Item(o.toString(), o.toString(), o, selected)); - } - setItems(items); - } - - /** - * Fill a list model with some datas, and select after all the given object - * - * @param data data ot inject in combo - * @param select object to select in list after reflling his model - */ - public void fillList(Collection<?> data, Object select) { - List<Item> items = new ArrayList<Item>(); - for (Object o : data) { - boolean selected = o.equals(select); - items.add(new Item(o.toString(), o.toString(), o, selected)); - } - setItems(items); - } - - /** - * Fill a list model with some datas, and select after all the given object - * - * @param data data ot inject in combo - * @param select object to select in list after reflling his model - * @param methodName method to invoke to display data's name - */ - public void fillList(Collection<?> data, Object select, String methodName) { - // prepare method to use - Method m = null; - - List<Item> items = new ArrayList<Item>(); - for (Object o : data) { - boolean selected = o.equals(select); - if (m == null) { - try { - m = o.getClass().getMethod(methodName); - m.setAccessible(true); - } catch (NoSuchMethodException e) { - throw new IllegalArgumentException("could not find method " + methodName + " on " + o.getClass()); - } - } - try { - items.add(new Item(o.toString(), (String) m.invoke(o), o, selected)); - } catch (SecurityException e) { - // shoudl never happen ? - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - // shoudl never happen ? - throw new RuntimeException(e); - } catch (IllegalArgumentException e) { - // shoudl never happen ? - throw new RuntimeException(e); - } catch (InvocationTargetException e) { - // shoudl never happen ? - throw new RuntimeException(e); - } - } - setItems(items); - } - - /** - * Fill a list model with some datas, and select after all the given object - * - * @param data data ot inject in combo - * @param selects the objects to select in list after reflling his model - * @param methodName method to invoke to display data's name - */ - public void fillList(Collection<?> data, Collection<?> selects, String methodName) { - // prepare method to use - Method m = null; - - List<Item> items = new ArrayList<Item>(); - for (Object o : data) { - boolean selected = selects.contains(o); - if (m == null) { - try { - m = o.getClass().getMethod(methodName); - m.setAccessible(true); - } catch (NoSuchMethodException e) { - throw new IllegalArgumentException("could not find method " + methodName + " on " + o.getClass()); - } - } - try { - items.add(new Item(o.toString(), (String) m.invoke(o), o, selected)); - } catch (SecurityException e) { - // shoudl never happen ? - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - // shoudl never happen ? - throw new RuntimeException(e); - } catch (IllegalArgumentException e) { - // shoudl never happen ? - throw new RuntimeException(e); - } catch (InvocationTargetException e) { - // shoudl never happen ? - throw new RuntimeException(e); - } - } - setItems(items); - } - -} +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime.swing; + +import javax.swing.AbstractListModel; +import javax.swing.DefaultListCellRenderer; +import javax.swing.JList; +import javax.swing.ListModel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import java.awt.Component; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +public class JAXXList extends JList { + + private static final long serialVersionUID = 1L; + + public class JAXXListModel extends AbstractListModel { + + private List<Item> items; + private static final long serialVersionUID = -1598924187490122036L; + + public JAXXListModel(List<Item> items) { + this.items = items; + + PropertyChangeListener listener = new PropertyChangeListener() { + + @Override + public void propertyChange(PropertyChangeEvent e) { + if (e.getPropertyName().equals(Item.SELECTED_PROPERTY)) { + Item item = (Item) e.getSource(); + int itemIndex = JAXXListModel.this.items.indexOf(item); + int[] oldSelection = getSelectedIndices(); + int[] newSelection; + int index = -1; + for (int i = 0; i < oldSelection.length; i++) { + if (oldSelection[i] == itemIndex) { + index = i; + break; + } + } + if (item.isSelected()) { + if (index != -1) // it was already selected + { + return; + } + newSelection = new int[oldSelection.length + 1]; + System.arraycopy(oldSelection, 0, newSelection, 0, oldSelection.length); + newSelection[newSelection.length - 1] = itemIndex; + } else { + if (index == -1) // it already wasn't selected + { + return; + } + newSelection = new int[oldSelection.length - 1]; + System.arraycopy(oldSelection, 0, newSelection, 0, index); + System.arraycopy(oldSelection, index + 1, newSelection, index, oldSelection.length - 1 - index); + } + setSelectedIndices(newSelection); + } else { + for (int i = 0; i < getSize(); i++) { + if (getElementAt(i) == ((Item) e.getSource()).getValue()) { + fireContentsChanged(JAXXListModel.this, i, i); + if (isSelectedIndex(i)) { + fireSelectionValueChanged(i, i, false); + } + return; + } + } + } + } + }; + for (Item item : items) { + item.addPropertyChangeListener(listener); + } + } + + public List<Item> getItems(){ + return items; + } + + @Override + public Object getElementAt(int i) { + return items.get(i).getValue(); + } + + @Override + public int getSize() { + return items.size(); + } + } + + public JAXXList() { + setCellRenderer(new DefaultListCellRenderer() { + + private static final long serialVersionUID = 1L; + + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + ListModel model = list.getModel(); + if (model instanceof JAXXListModel) { + Item item = ((JAXXListModel) model).items.get(index); + String label = item.getLabel(); + if (label != null) { + value = label; + } + } + return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + } + }); + + addListSelectionListener(new ListSelectionListener() { + + @Override + public void valueChanged(ListSelectionEvent e) { + ListModel model = getModel(); + if (model instanceof JAXXListModel) { + List<Item> items = ((JAXXListModel) model).items; + for (int i = items.size() - 1; i >= 0; i--) { + boolean selected = isSelectedIndex(i); + Item item = items.get(i); + if (selected != item.isSelected()) { + item.setSelected(selected); + } + } + } + } + }); + } + + // this way we can keep it marked protected and still allow code in this file to call it + @Override + protected void fireSelectionValueChanged(int firstIndex, int lastIndex, boolean isAdjusting) { + super.fireSelectionValueChanged(firstIndex, lastIndex, isAdjusting); + } + + public void setItems(List<Item> items) { + setModel(new JAXXListModel(items)); + List<Integer> selectedIndexList = new ArrayList<Integer>(); + for (int i = 0; i < items.size(); i++) { + if (items.get(i).isSelected()) { + selectedIndexList.add(i); + } + } + int[] selectedIndices = new int[selectedIndexList.size()]; + for (int i = 0; i < selectedIndexList.size(); i++) { + selectedIndices[i] = selectedIndexList.get(i); + } + setSelectedIndices(selectedIndices); + } + + public List<Item> getItems(){ + if (getModel() instanceof JAXXListModel){ + return ((JAXXListModel)getModel()).getItems(); + } + return null; + } + + public void setSelectedValue(Object value) { + super.setSelectedValue(value, true); + } + + /** + * Set the selected Objects + * + * @param values Objects must be selected in the list + */ + public void setSelectedValues(Object[] values) { + if (values != null){ + List<Integer> selectedIndices = new ArrayList<Integer>(); + ListModel model = getModel(); + for (int i = 0; i < model.getSize(); i++) { + Object o = model.getElementAt(i); + for (Object value : values) { + if (o.equals(value)) { + selectedIndices.add(i); + break; + } + } + } + int[] ints = new int[selectedIndices.size()]; + for (int i = 0; i < ints.length; i++) { + ints[i] = selectedIndices.get(i).intValue(); + } + setSelectedIndices(ints); + } + else{ + // No selection if values is null + setSelectedIndex(-1); + } + } + + public void setSelectedItem(Item item) { + super.setSelectedValue(item.getValue(), true); + } + + public void setSelectedItems(List<Item> itemsToSelect) { + if (itemsToSelect != null){ + List<Item> items = getItems(); + int[] indices = new int[itemsToSelect.size()]; + int i = 0; + for (Item item : itemsToSelect){ + indices[i] = items.indexOf(item); + i++; + } + super.setSelectedIndices(indices); + } + } + + public Item getSelectedItem(){ + Object selected = super.getSelectedValue(); + return findItem(selected); + } + + public List<Item> getSelectedItems(){ + Object[] selected = super.getSelectedValues(); + java.util.List<Item> itemsSelected = new ArrayList<Item>(); + for (Object s : selected){ + itemsSelected.add(findItem(s)); + } + return itemsSelected; + } + + public Item findItem(Object value){ + List<Item> items = getItems(); + if (items != null){ + for (Item i : items){ + if (i.getValue().equals(value)){ + return i; + } + } + } + return null; + } + + public void addItem(Item item){ + List<Item> items = getItems(); + if (items != null){ + items.add(item); + setItems(items); + } + } + + public void addAllItems(Collection<Item> itemsToAdd){ + List<Item> items = getItems(); + if (items != null){ + items.addAll(itemsToAdd); + setItems(items); + } + } + + public void removeItem(Item item){ + List<Item> items = getItems(); + if (items != null){ + items.remove(item); + setItems(items); + } + } + + public void removeAllItems(Collection<Item> itemsToRemove){ + List<Item> items = getItems(); + if (items != null){ + items.removeAll(itemsToRemove); + setItems(items); + } + } + + /** + * Fill a list model with some datas, and select after all the given object + * + * @param data data ot inject in combo + * @param selects the objects to select in list after reflling his model + */ + public void fillList(Collection<?> data, Collection<?> selects) { + if (selects == null) { + selects = java.util.Collections.EMPTY_LIST; + } + List<Item> items = new ArrayList<Item>(); + for (Object o : data) { + boolean selected = false; + for (Object select : selects) { + if (selected = o.equals(select)) { + break; + } + } + items.add(new Item(o.toString(), o.toString(), o, selected)); + } + setItems(items); + } + + /** + * Fill a list model with some datas, and select after all the given object + * + * @param data data ot inject in combo + * @param select object to select in list after reflling his model + */ + public void fillList(Collection<?> data, Object select) { + List<Item> items = new ArrayList<Item>(); + for (Object o : data) { + boolean selected = o.equals(select); + items.add(new Item(o.toString(), o.toString(), o, selected)); + } + setItems(items); + } + + /** + * Fill a list model with some datas, and select after all the given object + * + * @param data data ot inject in combo + * @param select object to select in list after reflling his model + * @param methodName method to invoke to display data's name + */ + public void fillList(Collection<?> data, Object select, String methodName) { + // prepare method to use + Method m = null; + + List<Item> items = new ArrayList<Item>(); + for (Object o : data) { + boolean selected = o.equals(select); + if (m == null) { + try { + m = o.getClass().getMethod(methodName); + m.setAccessible(true); + } catch (NoSuchMethodException e) { + throw new IllegalArgumentException("could not find method " + methodName + " on " + o.getClass()); + } + } + try { + items.add(new Item(o.toString(), (String) m.invoke(o), o, selected)); + } catch (SecurityException e) { + // shoudl never happen ? + throw new RuntimeException(e); + } catch (IllegalAccessException e) { + // shoudl never happen ? + throw new RuntimeException(e); + } catch (IllegalArgumentException e) { + // shoudl never happen ? + throw new RuntimeException(e); + } catch (InvocationTargetException e) { + // shoudl never happen ? + throw new RuntimeException(e); + } + } + setItems(items); + } + + /** + * Fill a list model with some datas, and select after all the given object + * + * @param data data ot inject in combo + * @param selects the objects to select in list after reflling his model + * @param methodName method to invoke to display data's name + */ + public void fillList(Collection<?> data, Collection<?> selects, String methodName) { + // prepare method to use + Method m = null; + + List<Item> items = new ArrayList<Item>(); + for (Object o : data) { + boolean selected = selects.contains(o); + if (m == null) { + try { + m = o.getClass().getMethod(methodName); + m.setAccessible(true); + } catch (NoSuchMethodException e) { + throw new IllegalArgumentException("could not find method " + methodName + " on " + o.getClass()); + } + } + try { + items.add(new Item(o.toString(), (String) m.invoke(o), o, selected)); + } catch (SecurityException e) { + // shoudl never happen ? + throw new RuntimeException(e); + } catch (IllegalAccessException e) { + // shoudl never happen ? + throw new RuntimeException(e); + } catch (IllegalArgumentException e) { + // shoudl never happen ? + throw new RuntimeException(e); + } catch (InvocationTargetException e) { + // shoudl never happen ? + throw new RuntimeException(e); + } + } + setItems(items); + } + +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXTab.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXTab.java index 803e8d3..101e2ea 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXTab.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXTab.java @@ -1,21 +1,23 @@ -/* - * ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, - * Tony Chemit +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU General Lesser Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * ##% */ + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing; /** @author chemit */ diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXToggleButton.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXToggleButton.java index 13c14c6..d3dd7ac 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXToggleButton.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXToggleButton.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing; public class JAXXToggleButton extends javax.swing.JToggleButton { diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXTree.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXTree.java index cdeda7f..42cd406 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXTree.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXTree.java @@ -1,6 +1,22 @@ /* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.runtime.swing; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/OneClicListSelectionModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/OneClicListSelectionModel.java index ef35d99..7334c22 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/OneClicListSelectionModel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/OneClicListSelectionModel.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing; import org.apache.commons.logging.Log; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/Spacer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/Spacer.java index 45f9d25..acabdb1 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/Spacer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/Spacer.java @@ -1,12 +1,28 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime.swing; - -import javax.swing.JComponent; - -public class Spacer extends JComponent { - - private static final long serialVersionUID = 1L; -} +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime.swing; + +import javax.swing.JComponent; + +public class Spacer extends JComponent { + + private static final long serialVersionUID = 1L; +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/TabInfo.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/TabInfo.java index 6cacc5a..7551c4f 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/TabInfo.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/TabInfo.java @@ -1,165 +1,181 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime.swing; - -import javax.swing.Icon; -import javax.swing.event.SwingPropertyChangeSupport; -import java.awt.Color; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; - -public class TabInfo { - - public static String BACKGROUND_PROPERTY = "background"; - public static String DISABLED_ICON_PROPERTY = "disabledIcon"; - public static String DISPLAYED_MNEMONIC_INDEX_PROPERTY = "displayedMnemonicIndex"; - public static String ENABLED_PROPERTY = "enabled"; - public static String FOREGROUND_PROPERTY = "foreground"; - public static String ICON_PROPERTY = "icon"; - public static String MNEMONIC_PROPERTY = "mnemonic"; - public static String TITLE_PROPERTY = "title"; - public static String TOOL_TIP_TEXT_PROPERTY = "toolTipText"; - private String id; - private Color background; - private Icon disabledIcon; - private int displayedMnemonicIndex = -1; - private boolean enabled = true; - private Color foreground; - private Icon icon; - private int mnemonic = -1; - private String title; - private String toolTipText; - private PropertyChangeSupport propertyChangeSupport; - - public TabInfo() { - } - - public TabInfo(String id) { - this.id = id; - } - - public String getId() { - return id; - } - - public Color getBackground() { - return background; - } - - public void setBackground(Color background) { - Color oldValue = this.background; - this.background = background; - firePropertyChange(BACKGROUND_PROPERTY, oldValue, background); - } - - public Icon getDisabledIcon() { - return disabledIcon; - } - - public void setDisabledIcon(Icon disabledIcon) { - Icon oldValue = this.disabledIcon; - this.disabledIcon = disabledIcon; - firePropertyChange(DISABLED_ICON_PROPERTY, oldValue, disabledIcon); - } - - public int getDisplayedMnemonicIndex() { - return displayedMnemonicIndex; - } - - public void setDisplayedMnemonicIndex(int displayedMnemonicIndex) { - int oldValue = this.displayedMnemonicIndex; - this.displayedMnemonicIndex = displayedMnemonicIndex; - firePropertyChange(DISPLAYED_MNEMONIC_INDEX_PROPERTY, oldValue, displayedMnemonicIndex); - } - - public boolean isEnabled() { - return enabled; - } - - public void setEnabled(boolean enabled) { - boolean oldValue = this.enabled; - this.enabled = enabled; - firePropertyChange(ENABLED_PROPERTY, oldValue, enabled); - } - - public Color getForeground() { - return foreground; - } - - public void setForeground(Color foreground) { - Color oldValue = this.foreground; - this.foreground = foreground; - firePropertyChange(FOREGROUND_PROPERTY, oldValue, foreground); - } - - public Icon getIcon() { - return icon; - } - - public void setIcon(Icon icon) { - Icon oldValue = this.icon; - this.icon = icon; - firePropertyChange(ICON_PROPERTY, oldValue, icon); - } - - public int getMnemonic() { - return mnemonic; - } - - public void setMnemonic(int mnemonic) { - int oldValue = this.mnemonic; - this.mnemonic = mnemonic; - firePropertyChange(MNEMONIC_PROPERTY, oldValue, mnemonic); - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - String oldValue = this.title; - this.title = title; - firePropertyChange(TITLE_PROPERTY, oldValue, title); - } - - public String getToolTipText() { - return toolTipText; - } - - public void setToolTipText(String toolTipText) { - String oldValue = this.toolTipText; - this.toolTipText = toolTipText; - firePropertyChange(TOOL_TIP_TEXT_PROPERTY, oldValue, toolTipText); - } - - private PropertyChangeSupport getPropertyChangeSupport() { - if (propertyChangeSupport == null) { - propertyChangeSupport = new SwingPropertyChangeSupport(this); - } - return propertyChangeSupport; - } - - public void addPropertyChangeListener(PropertyChangeListener listener) { - getPropertyChangeSupport().addPropertyChangeListener(listener); - } - - public void addPropertyChangeListener(String property, PropertyChangeListener listener) { - getPropertyChangeSupport().addPropertyChangeListener(property, listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - getPropertyChangeSupport().removePropertyChangeListener(listener); - } - - public void removePropertyChangeListener(String property, PropertyChangeListener listener) { - getPropertyChangeSupport().removePropertyChangeListener(property, listener); - } - - protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { - if (propertyChangeSupport != null) { - getPropertyChangeSupport().firePropertyChange(propertyName, oldValue, newValue); - } - } -} +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime.swing; + +import javax.swing.Icon; +import javax.swing.event.SwingPropertyChangeSupport; +import java.awt.Color; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; + +public class TabInfo { + + public static String BACKGROUND_PROPERTY = "background"; + public static String DISABLED_ICON_PROPERTY = "disabledIcon"; + public static String DISPLAYED_MNEMONIC_INDEX_PROPERTY = "displayedMnemonicIndex"; + public static String ENABLED_PROPERTY = "enabled"; + public static String FOREGROUND_PROPERTY = "foreground"; + public static String ICON_PROPERTY = "icon"; + public static String MNEMONIC_PROPERTY = "mnemonic"; + public static String TITLE_PROPERTY = "title"; + public static String TOOL_TIP_TEXT_PROPERTY = "toolTipText"; + private String id; + private Color background; + private Icon disabledIcon; + private int displayedMnemonicIndex = -1; + private boolean enabled = true; + private Color foreground; + private Icon icon; + private int mnemonic = -1; + private String title; + private String toolTipText; + private PropertyChangeSupport propertyChangeSupport; + + public TabInfo() { + } + + public TabInfo(String id) { + this.id = id; + } + + public String getId() { + return id; + } + + public Color getBackground() { + return background; + } + + public void setBackground(Color background) { + Color oldValue = this.background; + this.background = background; + firePropertyChange(BACKGROUND_PROPERTY, oldValue, background); + } + + public Icon getDisabledIcon() { + return disabledIcon; + } + + public void setDisabledIcon(Icon disabledIcon) { + Icon oldValue = this.disabledIcon; + this.disabledIcon = disabledIcon; + firePropertyChange(DISABLED_ICON_PROPERTY, oldValue, disabledIcon); + } + + public int getDisplayedMnemonicIndex() { + return displayedMnemonicIndex; + } + + public void setDisplayedMnemonicIndex(int displayedMnemonicIndex) { + int oldValue = this.displayedMnemonicIndex; + this.displayedMnemonicIndex = displayedMnemonicIndex; + firePropertyChange(DISPLAYED_MNEMONIC_INDEX_PROPERTY, oldValue, displayedMnemonicIndex); + } + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + boolean oldValue = this.enabled; + this.enabled = enabled; + firePropertyChange(ENABLED_PROPERTY, oldValue, enabled); + } + + public Color getForeground() { + return foreground; + } + + public void setForeground(Color foreground) { + Color oldValue = this.foreground; + this.foreground = foreground; + firePropertyChange(FOREGROUND_PROPERTY, oldValue, foreground); + } + + public Icon getIcon() { + return icon; + } + + public void setIcon(Icon icon) { + Icon oldValue = this.icon; + this.icon = icon; + firePropertyChange(ICON_PROPERTY, oldValue, icon); + } + + public int getMnemonic() { + return mnemonic; + } + + public void setMnemonic(int mnemonic) { + int oldValue = this.mnemonic; + this.mnemonic = mnemonic; + firePropertyChange(MNEMONIC_PROPERTY, oldValue, mnemonic); + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + String oldValue = this.title; + this.title = title; + firePropertyChange(TITLE_PROPERTY, oldValue, title); + } + + public String getToolTipText() { + return toolTipText; + } + + public void setToolTipText(String toolTipText) { + String oldValue = this.toolTipText; + this.toolTipText = toolTipText; + firePropertyChange(TOOL_TIP_TEXT_PROPERTY, oldValue, toolTipText); + } + + private PropertyChangeSupport getPropertyChangeSupport() { + if (propertyChangeSupport == null) { + propertyChangeSupport = new SwingPropertyChangeSupport(this); + } + return propertyChangeSupport; + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + getPropertyChangeSupport().addPropertyChangeListener(listener); + } + + public void addPropertyChangeListener(String property, PropertyChangeListener listener) { + getPropertyChangeSupport().addPropertyChangeListener(property, listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + getPropertyChangeSupport().removePropertyChangeListener(listener); + } + + public void removePropertyChangeListener(String property, PropertyChangeListener listener) { + getPropertyChangeSupport().removePropertyChangeListener(property, listener); + } + + protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { + if (propertyChangeSupport != null) { + getPropertyChangeSupport().firePropertyChange(propertyName, oldValue, newValue); + } + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/TabInfoPropertyChangeListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/TabInfoPropertyChangeListener.java index 9c0aee2..7e03f3f 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/TabInfoPropertyChangeListener.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/TabInfoPropertyChangeListener.java @@ -1,44 +1,60 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime.swing; - -import javax.swing.Icon; -import javax.swing.JTabbedPane; -import java.awt.Color; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; - -public class TabInfoPropertyChangeListener implements PropertyChangeListener { - - private JTabbedPane tabs; - private int tabIndex; - - public TabInfoPropertyChangeListener(JTabbedPane tabs, int tabIndex) { - this.tabs = tabs; - this.tabIndex = tabIndex; - } - - @Override - public void propertyChange(PropertyChangeEvent e) { - String name = e.getPropertyName(); - if (name.equals(TabInfo.TITLE_PROPERTY)) { - tabs.setTitleAt(tabIndex, (String) e.getNewValue()); - } else if (name.equals(TabInfo.TOOL_TIP_TEXT_PROPERTY)) { - tabs.setToolTipTextAt(tabIndex, (String) e.getNewValue()); - } else if (name.equals(TabInfo.FOREGROUND_PROPERTY)) { - tabs.setForegroundAt(tabIndex, (Color) e.getNewValue()); - } else if (name.equals(TabInfo.BACKGROUND_PROPERTY)) { - tabs.setBackgroundAt(tabIndex, (Color) e.getNewValue()); - } else if (name.equals(TabInfo.MNEMONIC_PROPERTY)) { - tabs.setMnemonicAt(tabIndex, (Integer) e.getNewValue()); - } else if (name.equals(TabInfo.DISPLAYED_MNEMONIC_INDEX_PROPERTY)) { - tabs.setDisplayedMnemonicIndexAt(tabIndex, (Integer) e.getNewValue()); - } else if (name.equals(TabInfo.ICON_PROPERTY)) { - tabs.setIconAt(tabIndex, (Icon) e.getNewValue()); - } else if (name.equals(TabInfo.DISABLED_ICON_PROPERTY)) { - tabs.setDisabledIconAt(tabIndex, (Icon) e.getNewValue()); - } - } -} +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime.swing; + +import javax.swing.Icon; +import javax.swing.JTabbedPane; +import java.awt.Color; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; + +public class TabInfoPropertyChangeListener implements PropertyChangeListener { + + private JTabbedPane tabs; + private int tabIndex; + + public TabInfoPropertyChangeListener(JTabbedPane tabs, int tabIndex) { + this.tabs = tabs; + this.tabIndex = tabIndex; + } + + @Override + public void propertyChange(PropertyChangeEvent e) { + String name = e.getPropertyName(); + if (name.equals(TabInfo.TITLE_PROPERTY)) { + tabs.setTitleAt(tabIndex, (String) e.getNewValue()); + } else if (name.equals(TabInfo.TOOL_TIP_TEXT_PROPERTY)) { + tabs.setToolTipTextAt(tabIndex, (String) e.getNewValue()); + } else if (name.equals(TabInfo.FOREGROUND_PROPERTY)) { + tabs.setForegroundAt(tabIndex, (Color) e.getNewValue()); + } else if (name.equals(TabInfo.BACKGROUND_PROPERTY)) { + tabs.setBackgroundAt(tabIndex, (Color) e.getNewValue()); + } else if (name.equals(TabInfo.MNEMONIC_PROPERTY)) { + tabs.setMnemonicAt(tabIndex, (Integer) e.getNewValue()); + } else if (name.equals(TabInfo.DISPLAYED_MNEMONIC_INDEX_PROPERTY)) { + tabs.setDisplayedMnemonicIndexAt(tabIndex, (Integer) e.getNewValue()); + } else if (name.equals(TabInfo.ICON_PROPERTY)) { + tabs.setIconAt(tabIndex, (Icon) e.getNewValue()); + } else if (name.equals(TabInfo.DISABLED_ICON_PROPERTY)) { + tabs.setDisabledIconAt(tabIndex, (Icon) e.getNewValue()); + } + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/Table.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/Table.java index dcaf0a9..d834b37 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/Table.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/Table.java @@ -1,58 +1,74 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime.swing; - -import javax.swing.JPanel; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.LayoutManager; - -/** - * Panel which uses a {@link GridBagLayout} by default. - * - * @author Ethan Nicholas - */ -public class Table extends JPanel { - - private static final long serialVersionUID = 1L; - public static final Insets DEFAULT_INSETS = new Insets(3, 3, 3, 3); - private GridBagConstraints tableConstraints = new GridBagConstraints(); - private GridBagConstraints rowConstraints = null; - private GridBagConstraints cellConstraints = null; - - public Table() { - super.setLayout(new GridBagLayout()); - - tableConstraints.insets = DEFAULT_INSETS; - } - - @Override - public void setLayout(LayoutManager layout) { - // do nothing - } - - public GridBagConstraints getTableConstraints() { - return tableConstraints; - } - - public GridBagConstraints getRowConstraints() { - return rowConstraints; - } - - public GridBagConstraints getCellConstraints() { - return cellConstraints; - } - - public void newRow() { - tableConstraints.gridy++; - rowConstraints = (GridBagConstraints) tableConstraints.clone(); - } - - public void newCell() { - rowConstraints.gridx++; - cellConstraints = (GridBagConstraints) rowConstraints.clone(); - } -} +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime.swing; + +import javax.swing.JPanel; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.LayoutManager; + +/** + * Panel which uses a {@link GridBagLayout} by default. + * + * @author Ethan Nicholas + */ +public class Table extends JPanel { + + private static final long serialVersionUID = 1L; + public static final Insets DEFAULT_INSETS = new Insets(3, 3, 3, 3); + private GridBagConstraints tableConstraints = new GridBagConstraints(); + private GridBagConstraints rowConstraints = null; + private GridBagConstraints cellConstraints = null; + + public Table() { + super.setLayout(new GridBagLayout()); + + tableConstraints.insets = DEFAULT_INSETS; + } + + @Override + public void setLayout(LayoutManager layout) { + // do nothing + } + + public GridBagConstraints getTableConstraints() { + return tableConstraints; + } + + public GridBagConstraints getRowConstraints() { + return rowConstraints; + } + + public GridBagConstraints getCellConstraints() { + return cellConstraints; + } + + public void newRow() { + tableConstraints.gridy++; + rowConstraints = (GridBagConstraints) tableConstraints.clone(); + } + + public void newCell() { + rowConstraints.gridx++; + cellConstraints = (GridBagConstraints) rowConstraints.clone(); + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/VBox.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/VBox.java index 7321e19..f6b7254 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/VBox.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/VBox.java @@ -1,94 +1,110 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime.swing; - -import javax.swing.JPanel; -import java.awt.Insets; - -/** - * Panel which uses a {@link VBoxLayout} by default. - * - * @author Ethan Nicholas - */ -public class VBox extends JPanel { - - private static final long serialVersionUID = 1L; - public static final String SPACING_PROPERTY = "spacing"; - public static final String MARGIN_PROPERTY = "margin"; - public static final String HORIZONTAL_ALIGNMENT_PROPERTY = "horizontalAlignment"; - public static final String VERTICAL_ALIGNMENT_PROPERTY = "verticalAlignment"; - private Insets margin; - - public VBox() { - super(new VBoxLayout()); - } - - /** - * Returns the spacing between components, in pixels. Spacing is applied between components only, - * not to the top or bottom of the container. - * - * @return spacing between components - */ - public int getSpacing() { - return ((VBoxLayout) getLayout()).getSpacing(); - } - - /** - * Sets the spacing between components. Spacing is applied between components only, - * not to the top or bottom of the container. - * - * @param spacing new spacing value - */ - public void setSpacing(int spacing) { - int oldValue = getSpacing(); - ((VBoxLayout) getLayout()).setSpacing(spacing); - firePropertyChange(SPACING_PROPERTY, oldValue, spacing); - revalidate(); - } - - public int getHorizontalAlignment() { - return ((VBoxLayout) getLayout()).getHorizontalAlignment(); - } - - public void setHorizontalAlignment(int horizontalAlignment) { - int oldValue = getHorizontalAlignment(); - ((VBoxLayout) getLayout()).setHorizontalAlignment(horizontalAlignment); - firePropertyChange(HORIZONTAL_ALIGNMENT_PROPERTY, oldValue, horizontalAlignment); - revalidate(); - } - - public int getVerticalAlignment() { - return ((VBoxLayout) getLayout()).getVerticalAlignment(); - } - - public void setVerticalAlignment(int verticalAlignment) { - int oldValue = getVerticalAlignment(); - ((VBoxLayout) getLayout()).setVerticalAlignment(verticalAlignment); - firePropertyChange(VERTICAL_ALIGNMENT_PROPERTY, oldValue, verticalAlignment); - revalidate(); - } - - public Insets getMargin() { - return margin; - } - - public void setMargin(Insets margin) { - Insets oldValue = this.margin; - this.margin = (Insets) margin.clone(); - firePropertyChange(MARGIN_PROPERTY, oldValue, margin); - } - - @Override - public Insets getInsets() { - Insets result = super.getInsets(); - if (margin != null) { - result.top += margin.top; - result.left += margin.left; - result.right += margin.right; - result.bottom += margin.bottom; - } - return result; - } -} +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime.swing; + +import javax.swing.JPanel; +import java.awt.Insets; + +/** + * Panel which uses a {@link VBoxLayout} by default. + * + * @author Ethan Nicholas + */ +public class VBox extends JPanel { + + private static final long serialVersionUID = 1L; + public static final String SPACING_PROPERTY = "spacing"; + public static final String MARGIN_PROPERTY = "margin"; + public static final String HORIZONTAL_ALIGNMENT_PROPERTY = "horizontalAlignment"; + public static final String VERTICAL_ALIGNMENT_PROPERTY = "verticalAlignment"; + private Insets margin; + + public VBox() { + super(new VBoxLayout()); + } + + /** + * Returns the spacing between components, in pixels. Spacing is applied between components only, + * not to the top or bottom of the container. + * + * @return spacing between components + */ + public int getSpacing() { + return ((VBoxLayout) getLayout()).getSpacing(); + } + + /** + * Sets the spacing between components. Spacing is applied between components only, + * not to the top or bottom of the container. + * + * @param spacing new spacing value + */ + public void setSpacing(int spacing) { + int oldValue = getSpacing(); + ((VBoxLayout) getLayout()).setSpacing(spacing); + firePropertyChange(SPACING_PROPERTY, oldValue, spacing); + revalidate(); + } + + public int getHorizontalAlignment() { + return ((VBoxLayout) getLayout()).getHorizontalAlignment(); + } + + public void setHorizontalAlignment(int horizontalAlignment) { + int oldValue = getHorizontalAlignment(); + ((VBoxLayout) getLayout()).setHorizontalAlignment(horizontalAlignment); + firePropertyChange(HORIZONTAL_ALIGNMENT_PROPERTY, oldValue, horizontalAlignment); + revalidate(); + } + + public int getVerticalAlignment() { + return ((VBoxLayout) getLayout()).getVerticalAlignment(); + } + + public void setVerticalAlignment(int verticalAlignment) { + int oldValue = getVerticalAlignment(); + ((VBoxLayout) getLayout()).setVerticalAlignment(verticalAlignment); + firePropertyChange(VERTICAL_ALIGNMENT_PROPERTY, oldValue, verticalAlignment); + revalidate(); + } + + public Insets getMargin() { + return margin; + } + + public void setMargin(Insets margin) { + Insets oldValue = this.margin; + this.margin = (Insets) margin.clone(); + firePropertyChange(MARGIN_PROPERTY, oldValue, margin); + } + + @Override + public Insets getInsets() { + Insets result = super.getInsets(); + if (margin != null) { + result.top += margin.top; + result.left += margin.left; + result.right += margin.right; + result.bottom += margin.bottom; + } + return result; + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/VBoxBeanInfo.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/VBoxBeanInfo.java index 3534309..8c65b12 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/VBoxBeanInfo.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/VBoxBeanInfo.java @@ -1,6 +1,22 @@ /* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.runtime.swing; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/VBoxLayout.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/VBoxLayout.java index 4f1b46c..945b01d 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/VBoxLayout.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/VBoxLayout.java @@ -1,127 +1,143 @@ -/* - * Copyright 2006 Ethan Nicholas. All rights reserved. - * Use is subject to license terms. - */ -package jaxx.runtime.swing; - -import javax.swing.SwingConstants; -import java.awt.Component; -import java.awt.Container; -import java.awt.Dimension; -import java.awt.Insets; -import java.awt.LayoutManager; - -/** - * Vertical box layout. The layout rules followed by this class are quite different than the core BoxLayout class, - * and in general represent a more useful algorithm. - * - * @author Ethan Nicholas - */ -public class VBoxLayout implements LayoutManager { - - private int spacing = 6; - private int horizontalAlignment = SwingConstants.LEFT; - private int verticalAlignment = SwingConstants.TOP; - - public int getSpacing() { - return spacing; - } - - public void setSpacing(int spacing) { - this.spacing = spacing; - } - - public int getHorizontalAlignment() { - return horizontalAlignment; - } - - public void setHorizontalAlignment(int horizontalAlignment) { - this.horizontalAlignment = horizontalAlignment; - } - - public int getVerticalAlignment() { - return verticalAlignment; - } - - public void setVerticalAlignment(int verticalAlignment) { - this.verticalAlignment = verticalAlignment; - } - - @Override - public void addLayoutComponent(String name, Component comp) { - } - - @Override - public void layoutContainer(Container parent) { - Insets insets = parent.getInsets(); - int parentWidth = parent.getSize().width - insets.left - insets.right; - int count = parent.getComponentCount(); - Dimension preferredSize = parent.getPreferredSize(); - int y; - switch (verticalAlignment) { - case SwingConstants.TOP: - y = insets.top; - break; - case SwingConstants.CENTER: - y = insets.top + (parent.getHeight() - preferredSize.height) / 2; - break; - case SwingConstants.BOTTOM: - y = insets.top + (parent.getHeight() - preferredSize.height); - break; - default: - throw new IllegalArgumentException("invalid vertical alignment: " + verticalAlignment); - } - - for (int i = 0; i < count; i++) { - Component component = parent.getComponent(i); - Dimension childPreferredSize = component.getPreferredSize(); - int width = Math.min(childPreferredSize.width, parentWidth); - int x; - switch (horizontalAlignment) { - case SwingConstants.LEFT: - x = insets.left; - break; - case SwingConstants.CENTER: - x = insets.left + (parentWidth - childPreferredSize.width) / 2; - break; - case SwingConstants.RIGHT: - x = insets.left + (parentWidth - childPreferredSize.width); - break; - default: - throw new IllegalArgumentException("invalid horizontal alignment: " + horizontalAlignment); - } - component.setBounds(x, y, width, childPreferredSize.height); - y += childPreferredSize.height + spacing; - } - } - - @Override - public Dimension minimumLayoutSize(Container parent) { - int width = 0; - int height = (parent.getComponentCount() - 1) * spacing; - for (int i = parent.getComponentCount() - 1; i >= 0; i--) { - Dimension minimumSize = parent.getComponent(i).getMinimumSize(); - width = Math.max(width, minimumSize.width); - height += minimumSize.height; - } - Insets insets = parent.getInsets(); - return new Dimension(width + insets.left + insets.right, height + insets.top + insets.bottom); - } - - @Override - public Dimension preferredLayoutSize(Container parent) { - int width = 0; - int height = (parent.getComponentCount() - 1) * spacing; - for (int i = parent.getComponentCount() - 1; i >= 0; i--) { - Dimension preferredSize = parent.getComponent(i).getPreferredSize(); - width = Math.max(width, preferredSize.width); - height += preferredSize.height; - } - Insets insets = parent.getInsets(); - return new Dimension(width + insets.left + insets.right, height + insets.top + insets.bottom); - } - - @Override - public void removeLayoutComponent(Component comp) { - } -} +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime.swing; + +import javax.swing.SwingConstants; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Insets; +import java.awt.LayoutManager; + +/** + * Vertical box layout. The layout rules followed by this class are quite different than the core BoxLayout class, + * and in general represent a more useful algorithm. + * + * @author Ethan Nicholas + */ +public class VBoxLayout implements LayoutManager { + + private int spacing = 6; + private int horizontalAlignment = SwingConstants.LEFT; + private int verticalAlignment = SwingConstants.TOP; + + public int getSpacing() { + return spacing; + } + + public void setSpacing(int spacing) { + this.spacing = spacing; + } + + public int getHorizontalAlignment() { + return horizontalAlignment; + } + + public void setHorizontalAlignment(int horizontalAlignment) { + this.horizontalAlignment = horizontalAlignment; + } + + public int getVerticalAlignment() { + return verticalAlignment; + } + + public void setVerticalAlignment(int verticalAlignment) { + this.verticalAlignment = verticalAlignment; + } + + @Override + public void addLayoutComponent(String name, Component comp) { + } + + @Override + public void layoutContainer(Container parent) { + Insets insets = parent.getInsets(); + int parentWidth = parent.getSize().width - insets.left - insets.right; + int count = parent.getComponentCount(); + Dimension preferredSize = parent.getPreferredSize(); + int y; + switch (verticalAlignment) { + case SwingConstants.TOP: + y = insets.top; + break; + case SwingConstants.CENTER: + y = insets.top + (parent.getHeight() - preferredSize.height) / 2; + break; + case SwingConstants.BOTTOM: + y = insets.top + (parent.getHeight() - preferredSize.height); + break; + default: + throw new IllegalArgumentException("invalid vertical alignment: " + verticalAlignment); + } + + for (int i = 0; i < count; i++) { + Component component = parent.getComponent(i); + Dimension childPreferredSize = component.getPreferredSize(); + int width = Math.min(childPreferredSize.width, parentWidth); + int x; + switch (horizontalAlignment) { + case SwingConstants.LEFT: + x = insets.left; + break; + case SwingConstants.CENTER: + x = insets.left + (parentWidth - childPreferredSize.width) / 2; + break; + case SwingConstants.RIGHT: + x = insets.left + (parentWidth - childPreferredSize.width); + break; + default: + throw new IllegalArgumentException("invalid horizontal alignment: " + horizontalAlignment); + } + component.setBounds(x, y, width, childPreferredSize.height); + y += childPreferredSize.height + spacing; + } + } + + @Override + public Dimension minimumLayoutSize(Container parent) { + int width = 0; + int height = (parent.getComponentCount() - 1) * spacing; + for (int i = parent.getComponentCount() - 1; i >= 0; i--) { + Dimension minimumSize = parent.getComponent(i).getMinimumSize(); + width = Math.max(width, minimumSize.width); + height += minimumSize.height; + } + Insets insets = parent.getInsets(); + return new Dimension(width + insets.left + insets.right, height + insets.top + insets.bottom); + } + + @Override + public Dimension preferredLayoutSize(Container parent) { + int width = 0; + int height = (parent.getComponentCount() - 1) * spacing; + for (int i = parent.getComponentCount() - 1; i >= 0; i--) { + Dimension preferredSize = parent.getComponent(i).getPreferredSize(); + width = Math.max(width, preferredSize.width); + height += preferredSize.height; + } + Insets insets = parent.getInsets(); + return new Dimension(width + insets.left + insets.right, height + insets.top + insets.bottom); + } + + @Override + public void removeLayoutComponent(Component comp) { + } +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/ClassCellEditor.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/ClassCellEditor.java index 8c5e68b..55de9e7 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/ClassCellEditor.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/ClassCellEditor.java @@ -1,6 +1,7 @@ /* -* *##% ui - * Copyright (C) 2008 CodeLutin +* *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -14,7 +15,8 @@ * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.runtime.swing.editor; import org.apache.commons.beanutils.Converter; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/EnumEditor.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/EnumEditor.java index 0bd0b1f..c6936a1 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/EnumEditor.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/EnumEditor.java @@ -1,6 +1,7 @@ /* - * *##% Lutin utilities library - * Copyright (C) 2004 - 2008 CodeLutin + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -14,7 +15,8 @@ * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.runtime.swing.editor; import javax.swing.JComboBox; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/LocaleEditor.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/LocaleEditor.java index e6a37da..4cccc4b 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/LocaleEditor.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/LocaleEditor.java @@ -1,6 +1,7 @@ /* -* *##% Lutin utilities library - * Copyright (C) 2004 - 2008 CodeLutin +* *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -14,7 +15,8 @@ * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.runtime.swing.editor; import javax.swing.JComboBox; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/MyDefaultCellEditor.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/MyDefaultCellEditor.java index a7faef9..b3c3964 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/MyDefaultCellEditor.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/editor/MyDefaultCellEditor.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.editor; import javax.swing.DefaultCellEditor; @@ -8,7 +28,6 @@ import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.table.TableCellEditor; import java.awt.Component; -import jaxx.runtime.swing.editor.EnumEditor; /** * @author chemit diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpBroker.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpBroker.java index b964937..648d562 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpBroker.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpBroker.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.help; import java.applet.Applet; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUI.java index 9af8afa..3a4b0cf 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUI.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUI.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.help; import java.awt.Component; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUIHandler.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUIHandler.java index d8077c7..b586872 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUIHandler.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/help/JAXXHelpUIHandler.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.help; import jaxx.runtime.JAXXContext; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java index 9dfad76..6036902 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationCardPanel.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.navigation; import java.awt.CardLayout; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationPanel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationPanel.java index 7c5bf42..7a58794 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationPanel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemNavigationPanel.java @@ -1,6 +1,22 @@ /* - * To change this template, choose Tools | Templates - * and open the template in the editor. + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.runtime.swing.navigation; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemTreeNavigationAdapter.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemTreeNavigationAdapter.java index 7f14cb3..0131005 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemTreeNavigationAdapter.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/ItemTreeNavigationAdapter.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.navigation; import javax.swing.event.TreeSelectionEvent; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationContentUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationContentUI.java index a4a02e2..3337f6a 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationContentUI.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationContentUI.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.navigation; /** diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java index 5da00d9..1b69acc 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.navigation; import javax.swing.JTree; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java index 89afc9c..05ba83c 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.navigation; import java.awt.Component; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java index 5e96f5d..f9cde9d 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandlerWithCardLayout.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.navigation; import jaxx.runtime.JAXXContext; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java index 87072a2..48f2cbe 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.navigation; import java.lang.reflect.InvocationTargetException; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java index f975dd1..8b4a8a2 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.navigation; import jaxx.runtime.JAXXContext; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java index 6937e91..68beb8c 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModelBuilder.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.navigation; import java.util.Enumeration; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNode.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNode.java index 9e07697..d3b41bd 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNode.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNode.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.navigation; import java.util.Enumeration; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRenderer.java index 310db18..bec5ed9 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRenderer.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.navigation; import javax.swing.tree.TreeCellRenderer; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRendererDecoratorImpl.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRendererDecoratorImpl.java index 11904d3..8a3dc3f 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRendererDecoratorImpl.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRendererDecoratorImpl.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.navigation; import jaxx.runtime.decorator.Decorator; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRendererI18nImpl.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRendererI18nImpl.java index 8c39baf..1d3fdb5 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRendererI18nImpl.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeNodeRendererI18nImpl.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.navigation; import static org.nuiton.i18n.I18n._; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/BooleanCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/BooleanCellRenderer.java index 5760d7a..f61fe34 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/BooleanCellRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/BooleanCellRenderer.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.renderer; import javax.swing.Icon; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/EmptyNumberTableCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/EmptyNumberTableCellRenderer.java index 9cc4a68..0841f04 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/EmptyNumberTableCellRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/EmptyNumberTableCellRenderer.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.renderer; import javax.swing.JTable; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/EnumTableCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/EnumTableCellRenderer.java index 9c88e56..647b5f4 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/EnumTableCellRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/EnumTableCellRenderer.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.renderer; import javax.swing.JTable; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/I18nTableCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/I18nTableCellRenderer.java index 9b8100e..5a387d3 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/I18nTableCellRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/I18nTableCellRenderer.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.renderer; import static org.nuiton.i18n.I18n._; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/LocaleListCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/LocaleListCellRenderer.java index d0bad56..a804389 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/LocaleListCellRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/LocaleListCellRenderer.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.renderer; import java.awt.Component; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java index f5e9ac7..dbc6140 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardModel.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.wizard; import java.beans.PropertyChangeListener; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java index 52d26e7..9d8ff79 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationAction.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.wizard; import javax.swing.SwingWorker; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java index b5e2e0b..87d52cf 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationActionThread.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.wizard; import java.beans.PropertyChangeEvent; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationModel.java index c71e942..b2eac32 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationModel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationModel.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.wizard; import java.util.Arrays; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationState.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationState.java index 9e6f9f2..23249fd 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationState.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationState.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.wizard; /** diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationStep.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationStep.java index 220447f..0397597 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationStep.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardOperationStep.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.wizard; /** diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStep.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStep.java index e5b7478..e3f3975 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStep.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStep.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.wizard; import java.io.Serializable; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStepUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStepUI.java index f57388a..d8f11f0 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStepUI.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardStepUI.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.wizard; /** diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUI.java index 3a62b0e..4574a12 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUI.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUI.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.wizard; import javax.swing.JTabbedPane; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java index 0769eac..3397527 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUILancher.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.wizard; import java.awt.Window; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUtil.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUtil.java index 4a30ba2..1dac81c 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUtil.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/wizard/WizardUtil.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.wizard; import java.awt.Component; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidator.java index abd7448..63f6a38 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator; import java.beans.EventSetDescriptor; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorDetector.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorDetector.java index 4a7fbae..af275b4 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorDetector.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorDetector.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator; import java.io.File; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorEvent.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorEvent.java index 7e212d2..315f850 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorEvent.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorEvent.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator; /** diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorField.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorField.java index f4ab4c6..806ce0f 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorField.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorField.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator; import static org.nuiton.i18n.I18n._; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorListener.java index 4024427..8895e22 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorListener.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorListener.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator; /** diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorMessage.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorMessage.java index 4577f20..c039b52 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorMessage.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorMessage.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator; /** diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorScope.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorScope.java index 12ecafb..f72d3a1 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorScope.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorScope.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator; import static org.nuiton.i18n.I18n.n_; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorUtil.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorUtil.java index aa4d9b6..d817c6b 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorUtil.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/BeanValidatorUtil.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator; import jaxx.runtime.*; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/XWorkBeanValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/XWorkBeanValidator.java index 007df28..698b9ed 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/XWorkBeanValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/XWorkBeanValidator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator; import com.opensymphony.xwork2.ActionContext; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidator.java index 87abf3c..c20dc53 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.field; import com.opensymphony.xwork2.util.ValueStack; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidator.java index 4d1e9b4..f77d6fe 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.field; import com.opensymphony.xwork2.validator.ValidationException; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidator.java index d37aa1d..574343a 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.field; import com.opensymphony.xwork2.validator.ValidationException; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/ExistingFileFieldValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/ExistingFileFieldValidator.java index b7ef20a..f41178e 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/ExistingFileFieldValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/ExistingFileFieldValidator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.field; import com.opensymphony.xwork2.validator.ValidationException; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidator.java index 1ab01cf..dd5e496 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.field; import com.opensymphony.xwork2.util.ValueStack; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidator.java index 7d38e41..789dd85 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.field; import com.opensymphony.xwork2.validator.ValidationException; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/NotExistingFileFieldValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/NotExistingFileFieldValidator.java index 1ef8788..5d65011 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/NotExistingFileFieldValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/NotExistingFileFieldValidator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.field; import com.opensymphony.xwork2.validator.ValidationException; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/RequiredFileFieldValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/RequiredFileFieldValidator.java index 23f5f03..9d508c5 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/RequiredFileFieldValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/field/RequiredFileFieldValidator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.field; import com.opensymphony.xwork2.validator.ValidationException; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java index 72c1f77..6fb4a24 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidator.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.swing; import jaxx.runtime.validator.swing.ui.AbstractBeanValidatorUI; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessage.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessage.java index 286a4d7..65537ed 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessage.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessage.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.swing; import javax.swing.JComponent; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListModel.java index 07d2d60..e7b1285 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListModel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListModel.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.swing; import jaxx.runtime.validator.BeanValidatorEvent; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListMouseListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListMouseListener.java index 7505620..1f25bdc 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListMouseListener.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListMouseListener.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.swing; import org.apache.commons.logging.Log; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListRenderer.java index 5514f6e..a86b277 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageListRenderer.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.swing; import javax.swing.ImageIcon; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableModel.java index 3821695..d51c56d 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableModel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableModel.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.swing; import jaxx.runtime.validator.BeanValidatorEvent; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableMouseListener.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableMouseListener.java index 8bb068c..0a99fc2 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableMouseListener.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableMouseListener.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.swing; import org.apache.commons.logging.Log; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableRenderer.java index e770f42..613ce89 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorMessageTableRenderer.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.swing; import javax.swing.ImageIcon; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorUtil.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorUtil.java index fa7b4cd..2ece754 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorUtil.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/SwingValidatorUtil.java @@ -1,7 +1,26 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.swing; import jaxx.runtime.*; -import jaxx.runtime.validator.BeanValidatorUtil; import jaxx.runtime.validator.*; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -13,10 +32,6 @@ import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.RowSorter; import javax.swing.SortOrder; -import jaxx.runtime.validator.swing.SwingValidatorMessageTableMouseListener; -import jaxx.runtime.validator.swing.SwingValidatorMessageListMouseListener; -import jaxx.runtime.validator.swing.SwingValidatorMessage; -import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer; import static org.nuiton.i18n.I18n.n_; /** diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java index b8c0af9..2c4a897 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/AbstractBeanValidatorUI.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.swing.ui; import jaxx.runtime.validator.BeanValidatorEvent; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/IconValidationUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/IconValidationUI.java index a4045b6..03bff48 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/IconValidationUI.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/IconValidationUI.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.swing.ui; import org.jdesktop.jxlayer.JXLayer; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/ImageValidationUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/ImageValidationUI.java index adc7fb9..7df3e78 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/ImageValidationUI.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/ImageValidationUI.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.swing.ui; import org.jdesktop.jxlayer.JXLayer; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/TranslucentValidationUI.java b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/TranslucentValidationUI.java index 5057054..88b85cc 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/TranslucentValidationUI.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/validator/swing/ui/TranslucentValidationUI.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.swing.ui; import jaxx.runtime.validator.BeanValidatorScope; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java index dc0327e..1ef5d87 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/UtilTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime; import org.junit.Assert; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultApplicationContextTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultApplicationContextTest.java index d3908f2..b2e18d7 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultApplicationContextTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultApplicationContextTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.context; import jaxx.runtime.context.DefaultApplicationContext.AutoLoad; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultJAXXContextTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultJAXXContextTest.java index 3c22bb1..3e9012f 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultJAXXContextTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultJAXXContextTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.context; import jaxx.runtime.JAXXContext; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/decorator/Data.java b/jaxx-runtime/src/test/java/jaxx/runtime/decorator/Data.java index 3c87037..61d4eb0 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/decorator/Data.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/decorator/Data.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.decorator; import java.util.ArrayList; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/decorator/JXPathDecoratorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/decorator/JXPathDecoratorTest.java index 370868c..937759f 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/decorator/JXPathDecoratorTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/decorator/JXPathDecoratorTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.decorator; import jaxx.runtime.decorator.JXPathDecorator.Context; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/decorator/MultiJXPathDecoratorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/decorator/MultiJXPathDecoratorTest.java index 4185b41..766f9e6 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/decorator/MultiJXPathDecoratorTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/decorator/MultiJXPathDecoratorTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.decorator; import org.junit.After; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java index 0144afd..675520c 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/swing/navigation/NavigationTreeModelTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.navigation; import jaxx.runtime.context.DefaultJAXXContext; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/validator/AbstractBeanValidatorDetectorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/AbstractBeanValidatorDetectorTest.java index 1a6892f..98c73b0 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/validator/AbstractBeanValidatorDetectorTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/validator/AbstractBeanValidatorDetectorTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator; import java.io.File; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/validator/BeanValidatorDetectorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/BeanValidatorDetectorTest.java index 0337559..9905925 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/validator/BeanValidatorDetectorTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/validator/BeanValidatorDetectorTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator; import java.io.File; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/validator/BeanValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/BeanValidatorTest.java index 782935f..f256acb 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/validator/BeanValidatorTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/validator/BeanValidatorTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator; import java.util.List; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/validator/SimpleBean.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/SimpleBean.java index 00c7961..31f33b3 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/validator/SimpleBean.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/validator/SimpleBean.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator; import java.beans.PropertyChangeListener; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/validator/XWorkBeanValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/XWorkBeanValidatorTest.java index b470273..d1bc986 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/validator/XWorkBeanValidatorTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/validator/XWorkBeanValidatorTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator; import java.util.List; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/AbstractFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/AbstractFieldValidatorTest.java index e5fd9ba..fd1bc15 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/AbstractFieldValidatorTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/AbstractFieldValidatorTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.field; import java.io.File; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/AbstractValidatorBeanFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/AbstractValidatorBeanFieldValidatorTest.java index 1238dfe..65d1004 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/AbstractValidatorBeanFieldValidatorTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/AbstractValidatorBeanFieldValidatorTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.field; /** diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidatorTest.java index 587d59c..ad21b9c 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidatorTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/CollectionFieldExpressionValidatorTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.field; import jaxx.runtime.validator.field.ValidatorBean.ValidatorBeanEntry; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidatorTest.java index 6569a4f..a70fb4d 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidatorTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/CollectionUniqueKeyValidatorTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.field; import jaxx.runtime.validator.field.ValidatorBean.ValidatorBeanEntry; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidatorTest.java index 4bb372d..c6aff52 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidatorTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ExistingDirectoryFieldValidatorTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.field; import java.io.File; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ExistingFileFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ExistingFileFieldValidatorTest.java index f08b8f1..a836644 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ExistingFileFieldValidatorTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ExistingFileFieldValidatorTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.field; import java.io.File; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/FieldExpressionBean.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/FieldExpressionBean.java index 79e0a8e..e585115 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/FieldExpressionBean.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/FieldExpressionBean.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.field; import java.beans.PropertyChangeListener; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidatorTest.java index 94f6d73..80dbe41 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidatorTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/FieldExpressionWithParamsValidatorTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.field; /** @author chemit */ diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidatorTest.java index 631e502..b62df93 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidatorTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/NotExistingDirectoryFieldValidatorTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.field; import java.io.File; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/NotExistingFileFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/NotExistingFileFieldValidatorTest.java index 8ac7ef2..869e90c 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/NotExistingFileFieldValidatorTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/NotExistingFileFieldValidatorTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.field; import java.io.File; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/RequiredFileFieldValidatorTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/RequiredFileFieldValidatorTest.java index aee45a7..bd53b46 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/RequiredFileFieldValidatorTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/RequiredFileFieldValidatorTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.field; import java.io.File; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ValidatorBean.java b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ValidatorBean.java index aa1b765..9f6a978 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ValidatorBean.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/validator/field/ValidatorBean.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.validator.field; import java.beans.PropertyChangeListener; diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/AbstractActionConfigurationResolver.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/AbstractActionConfigurationResolver.java index 14ac574..e2d05f1 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/AbstractActionConfigurationResolver.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/AbstractActionConfigurationResolver.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionAnnotationProcessing.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionAnnotationProcessing.java index 343ce49..7a765e4 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionAnnotationProcessing.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionAnnotationProcessing.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfig.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfig.java index 40b15bd..9fd7ef9 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfig.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfig.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* * ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, * Tony Chemit, Gabriel Landais diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigConfigurationResolver.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigConfigurationResolver.java index 828eef4..adddd55 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigConfigurationResolver.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigConfigurationResolver.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigurationResolver.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigurationResolver.java index 552b59b..a2c2994 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigurationResolver.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionConfigurationResolver.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactory.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactory.java index 22c1f5c..24b940b 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactory.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactory.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactoryFromProvider.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactoryFromProvider.java index d5a386c..017a539 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactoryFromProvider.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionFactoryFromProvider.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* * ##% Copyright (C) 2007, 2008 Code Lutin, Tony Chemit * diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionNameProvider.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionNameProvider.java index ec1745a..30ddb3c 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionNameProvider.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionNameProvider.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProvider.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProvider.java index cca7195..2c0e9bb 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProvider.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProvider.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProviderAnnotation.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProviderAnnotation.java index a881fe3..d49addc 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProviderAnnotation.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProviderAnnotation.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProviderFromProperties.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProviderFromProperties.java index 7cf9179..cab38eb 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProviderFromProperties.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ActionProviderFromProperties.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/MyAbstractAction.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/MyAbstractAction.java index 1440ca4..6077325 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/MyAbstractAction.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/MyAbstractAction.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/SelectActionConfig.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/SelectActionConfig.java index ca0ad0c..6123939 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/SelectActionConfig.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/SelectActionConfig.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* * ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, * Tony Chemit, Gabriel Landais diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/SelectActionConfigConfigurationResolver.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/SelectActionConfigConfigurationResolver.java index d50803c..3ed1d7e 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/SelectActionConfigConfigurationResolver.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/SelectActionConfigConfigurationResolver.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ToggleActionConfig.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ToggleActionConfig.java index 339d2fe..0f1a568 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ToggleActionConfig.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ToggleActionConfig.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* * ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, * Tony Chemit, Gabriel Landais diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ToggleActionConfigConfigurationResolver.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ToggleActionConfigConfigurationResolver.java index 6351b3c..ef8d222 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ToggleActionConfigConfigurationResolver.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/action/ToggleActionConfigConfigurationResolver.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabContentConfig.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabContentConfig.java index 1fada8e..55b4d33 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabContentConfig.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabContentConfig.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* * ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, * Tony Chemit, Gabriel Landais diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabFactory.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabFactory.java index 16e45cb..b19c3fa 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabFactory.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabFactory.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* * \#\#% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, * Tony Chemit diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabModel.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabModel.java index 5c762b2..3804fb4 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabModel.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/tab/TabModel.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* * ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, * Tony Chemit diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/AbstractUIAction.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/AbstractUIAction.java index ab18764..73421a6 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/AbstractUIAction.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/AbstractUIAction.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUI.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUI.java index 5ec07ea..6ec9bae 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUI.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUI.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIDef.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIDef.java index cd92124..05baa88 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIDef.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIDef.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIHandler.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIHandler.java index cb5fdf8..980b1b3 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIHandler.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIHandler.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIModel.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIModel.java index 96a06f5..34b4fae 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIModel.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/DialogUIModel.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FactoryWindowListener.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FactoryWindowListener.java index 8ffe6e2..6658dd2 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FactoryWindowListener.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FactoryWindowListener.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FormElement.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FormElement.java index ff54c85..79749fa 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FormElement.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/FormElement.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/ShowUIAction.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/ShowUIAction.java index d659e36..2c458d4 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/ShowUIAction.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/ShowUIAction.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIFactory.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIFactory.java index a5001ac..636b7ab 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIFactory.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIFactory.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIHelper.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIHelper.java index 9cb2136..a929c6c 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIHelper.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIHelper.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /* * ##% Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Code Lutin, * Tony Chemit diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIProvider.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIProvider.java index 629bc87..5695dd2 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIProvider.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/UIProvider.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/CancelAction.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/CancelAction.java index 6e58346..538f208 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/CancelAction.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/CancelAction.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUI.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUI.java index d39efa3..5b2a0ca 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUI.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUI.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIHandler.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIHandler.java index b91baed..b1b0660 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIHandler.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIHandler.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIModel.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIModel.java index fe9b373..72fb8f1 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIModel.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/DialogConfigUIModel.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/ResetAction.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/ResetAction.java index 8a9d30c..89ed6d1 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/ResetAction.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/ResetAction.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/SaveAction.java b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/SaveAction.java index b4f994c..75a44a3 100644 --- a/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/SaveAction.java +++ b/jaxx-swing-action/src/main/java/org/nuiton/jaxx/util/config/SaveAction.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Action + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ /** * ##% Copyright (C) 2008 Code Lutin, Tony Chemit * This program is free software; you diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java index 6c63f28..1e73438 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java @@ -1,5 +1,6 @@ /** - * *##% jaxx-runtime-swing-widget + * *##% + * JAXX Widgets * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify @@ -14,7 +15,8 @@ * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.runtime.swing; diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/StatusMessagePanelHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/StatusMessagePanelHandler.java index ad45863..6d4600e 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/StatusMessagePanelHandler.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/StatusMessagePanelHandler.java @@ -1,5 +1,6 @@ /** - * *##% jaxx-runtime-swing-widget + * *##% + * JAXX Widgets * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify @@ -14,7 +15,8 @@ * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.runtime.swing; diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java index 276c3d2..a00f95a 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/NumberEditorHandler.java @@ -1,5 +1,6 @@ /** - * *##% jaxx-runtime-swing-widget + * *##% + * JAXX Widgets * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify @@ -14,7 +15,8 @@ * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.runtime.swing.editor; @@ -465,4 +467,4 @@ public class NumberEditorHandler { } return acceptNull; } -} \ No newline at end of file +} diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/TimeEditorHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/TimeEditorHandler.java index 48f00f5..ec6ae15 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/TimeEditorHandler.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/TimeEditorHandler.java @@ -1,5 +1,6 @@ /** - * *##% jaxx-runtime-swing-widget + * *##% + * JAXX Widgets * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify @@ -14,7 +15,8 @@ * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.runtime.swing.editor; @@ -219,4 +221,4 @@ public class TimeEditorHandler { } return mutator; } -} \ No newline at end of file +} diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableEditor.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableEditor.java index 609440b..f3717eb 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableEditor.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableEditor.java @@ -1,5 +1,6 @@ /* -* *##% jaxx-runtime-swing-widget +* *##% + * JAXX Widgets * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify @@ -14,7 +15,8 @@ * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.runtime.swing.editor.config; import jaxx.runtime.swing.editor.config.model.ConfigTableModel; diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableRenderer.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableRenderer.java index d0dd247..d60c30a 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableRenderer.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigTableRenderer.java @@ -1,5 +1,6 @@ /* - * *##% jaxx-runtime-swing-widget + * *##% + * JAXX Widgets * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify @@ -14,7 +15,8 @@ * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.runtime.swing.editor.config; import static org.nuiton.i18n.I18n._; diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java index d1cc9f0..b0345ae 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigUIBuilder.java @@ -1,5 +1,6 @@ /** - * *##% jaxx-runtime-swing-widget + * *##% + * JAXX Widgets * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify @@ -14,7 +15,8 @@ * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.runtime.swing.editor.config; diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java index 76919c3..7ddc700 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/CategoryModel.java @@ -1,5 +1,6 @@ /** - * *##% jaxx-runtime-swing-widget + * *##% + * JAXX Widgets * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify @@ -14,7 +15,8 @@ * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.runtime.swing.editor.config.model; diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigTableModel.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigTableModel.java index c44a999..077a06e 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigTableModel.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigTableModel.java @@ -1,5 +1,6 @@ /** - * *##% jaxx-runtime-swing-widget + * *##% + * JAXX Widgets * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify @@ -14,7 +15,8 @@ * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.runtime.swing.editor.config.model; diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java index 554f00b..c8ff53c 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/ConfigUIModel.java @@ -1,5 +1,6 @@ /** - * *##% jaxx-runtime-swing-widget + * *##% + * JAXX Widgets * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify @@ -14,7 +15,8 @@ * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.runtime.swing.editor.config.model; diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java index 9990127..fadb1e1 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/model/OptionModel.java @@ -1,5 +1,6 @@ /** - * *##% jaxx-runtime-swing-widget + * *##% + * JAXX Widgets * Copyright (C) 2008 - 2009 CodeLutin * * This program is free software: you can redistribute it and/or modify @@ -14,7 +15,8 @@ * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* */ package jaxx.runtime.swing.editor.config.model; diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java index 3d96a38..e499fcc 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/AbstractJaxxMojo.java @@ -1,21 +1,21 @@ -/* *##% - * Copyright (C) 2007 - * JaxxPlugin, Code Lutin +/* *##% + * JAXX Maven plugin + * Copyright (C) 2008 - 2009 CodeLutin * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU General Lesser Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - *##%*/ + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%*/ package org.nuiton.jaxx.plugin; import org.apache.maven.project.MavenProject; diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java index e6a9f0c..c90d5cf 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateHelpMojo.java @@ -1,21 +1,21 @@ -/* *##% - * Copyright (C) 2007 - * JaxxPlugin, Code Lutin +/* *##% + * JAXX Maven plugin + * Copyright (C) 2008 - 2009 CodeLutin * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU General Lesser Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - *##%*/ + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%*/ package org.nuiton.jaxx.plugin; import com.sun.java.help.search.Indexer; diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java index daae511..516e243 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java @@ -1,21 +1,21 @@ -/* *##% - * Copyright (C) 2007 - * JaxxPlugin, Code Lutin +/* *##% + * JAXX Maven plugin + * Copyright (C) 2008 - 2009 CodeLutin * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU General Lesser Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - *##%*/ + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%*/ package org.nuiton.jaxx.plugin; import java.util.List; diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/NodeItem.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/NodeItem.java index 3f4a8e6..345fa26 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/NodeItem.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/NodeItem.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Maven plugin + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package org.nuiton.jaxx.plugin; import java.util.ArrayList; diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java index 631f831..3040ac8 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/XmlHelper.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Maven plugin + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package org.nuiton.jaxx.plugin; import java.io.File; diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1722Test.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1722Test.java index d5624c5..b8fe952 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1722Test.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1722Test.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Maven plugin + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package org.nuiton.jaxx.plugin; import org.junit.Test; diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java index a8139e5..b9ca7fc 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Maven plugin + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package org.nuiton.jaxx.plugin; import jaxx.runtime.Base64Coder; diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1751Test.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1751Test.java index 7dca837..c93c4ca 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1751Test.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1751Test.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Maven plugin + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package org.nuiton.jaxx.plugin; import org.junit.Test; diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java index d01c3d5..ddd4524 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Maven plugin + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package org.nuiton.jaxx.plugin; import jaxx.runtime.context.DefaultJAXXContext; diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java index 12201aa..2455cde 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/CompilerValidatorTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Maven plugin + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package org.nuiton.jaxx.plugin; import org.apache.maven.plugin.MojoExecutionException; diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java index 0f53d1e..9dc5aab 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DecoratorTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Maven plugin + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package org.nuiton.jaxx.plugin; import org.junit.Test; diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java index 9b0e6b5..ad57e6b 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Maven plugin + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package org.nuiton.jaxx.plugin; import org.apache.maven.plugin.MojoExecutionException; diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/I18nTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/I18nTest.java index 7d18479..71b5048 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/I18nTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/I18nTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Maven plugin + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package org.nuiton.jaxx.plugin; import org.junit.Test; diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java index 3fd3160..2b071af 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/JaxxBaseTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Maven plugin + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package org.nuiton.jaxx.plugin; import jaxx.runtime.context.DefaultJAXXContext; diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/NodeItemTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/NodeItemTest.java index e057412..61893a6 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/NodeItemTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/NodeItemTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Maven plugin + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package org.nuiton.jaxx.plugin; import org.junit.Assert; -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 667ba30e052c7b08c15d32db3097784895523aac Author: Tony Chemit <chemit@codelutin.com> Date: Tue Oct 27 00:40:30 2009 +0000 put the Generated By JavaCC comment line at top of file --- .../java/jaxx/compiler/css/parser/CSSParser.java | 1598 +++++++------- .../compiler/css/parser/CSSParserConstants.java | 144 +- .../compiler/css/parser/CSSParserTokenManager.java | 2304 ++++++++++---------- .../css/parser/CSSParserTreeConstants.java | 80 +- .../compiler/css/parser/JJTCSSParserState.java | 246 +-- .../main/java/jaxx/compiler/css/parser/Node.java | 102 +- .../jaxx/compiler/css/parser/ParseException.java | 40 +- .../jaxx/compiler/css/parser/SimpleCharStream.java | 796 +++---- .../java/jaxx/compiler/css/parser/SimpleNode.java | 244 +-- .../main/java/jaxx/compiler/css/parser/Token.java | 152 +- .../jaxx/compiler/css/parser/TokenMgrError.java | 252 +-- .../compiler/java/parser/JJTJavaParserState.java | 246 +-- .../jaxx/compiler/java/parser/JavaCharStream.java | 1060 ++++----- .../java/jaxx/compiler/java/parser/JavaParser.java | 2 +- .../compiler/java/parser/JavaParserConstants.java | 2 +- .../java/parser/JavaParserTokenManager.java | 2 +- .../java/parser/JavaParserTreeConstants.java | 2 +- .../main/java/jaxx/compiler/java/parser/Node.java | 102 +- .../jaxx/compiler/java/parser/ParseException.java | 428 ++-- .../java/jaxx/compiler/java/parser/SimpleNode.java | 270 +-- .../main/java/jaxx/compiler/java/parser/Token.java | 2 +- .../jaxx/compiler/java/parser/TokenMgrError.java | 252 +-- 22 files changed, 4163 insertions(+), 4163 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParser.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParser.java index 91e3f35..8417275 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParser.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParser.java @@ -1,3 +1,4 @@ +/* Generated By:JJTree&JavaCC: Do not edit this line. CSSParser.java */ /* * *##% * JAXX Compiler @@ -18,802 +19,801 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JJTree&JavaCC: Do not edit this line. CSSParser.java */ -package jaxx.compiler.css.parser; - -public class CSSParser/*@bgen(jjtree)*/ implements CSSParserTreeConstants, CSSParserConstants {/*@bgen(jjtree)*/ - protected JJTCSSParserState jjtree = new JJTCSSParserState(); - - public SimpleNode popNode() { - if (jjtree.nodeArity() > 0) // number of child nodes - return (SimpleNode) jjtree.popNode(); - else - return null; - } - - void jjtreeOpenNodeScope(Node n) { - ((SimpleNode) n).firstToken = getToken(1); - } - - void jjtreeCloseNodeScope(Node n) { - ((SimpleNode) n).lastToken = getToken(0); - } - - public static void main(String args[]) { - System.out.println("Reading from standard input..."); - CSSParser css = new CSSParser(System.in); - try { - SimpleNode n = css.Stylesheet(); - n.dump(""); - System.out.println("Thank you."); - } catch (Exception e) { - System.out.println("Oops."); - System.out.println(e.getMessage()); - e.printStackTrace(); - } - } - - final public SimpleNode Stylesheet() throws ParseException { - /*@bgen(jjtree) Stylesheet */ - SimpleNode jjtn000 = new SimpleNode(JJTSTYLESHEET); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - label_1: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IDENTIFIER: - case PSEUDOCLASS_COLON: - case 29: - case 30: - case 31: - ; - break; - default: - jj_la1[0] = jj_gen; - break label_1; - } - Rule(); - } - jjtree.closeNodeScope(jjtn000, true); - jjtc000 = false; - jjtreeCloseNodeScope(jjtn000); - { - if (true) return jjtn000; - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - throw new Error("Missing return statement in function"); - } - - final public void Rule() throws ParseException { - /*@bgen(jjtree) Rule */ - SimpleNode jjtn000 = new SimpleNode(JJTRULE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - Selectors(); - jj_consume_token(LEFT_BRACE); - Declaration(); - label_2: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case SEMICOLON: - ; - break; - default: - jj_la1[1] = jj_gen; - break label_2; - } - jj_consume_token(SEMICOLON); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IDENTIFIER: - Declaration(); - break; - default: - jj_la1[2] = jj_gen; - ; - } - } - jj_consume_token(RIGHT_BRACE); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Selectors() throws ParseException { - /*@bgen(jjtree) Selectors */ - SimpleNode jjtn000 = new SimpleNode(JJTSELECTORS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - Selector(); - label_3: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case 28: - ; - break; - default: - jj_la1[3] = jj_gen; - break label_3; - } - jj_consume_token(28); - Selector(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Selector() throws ParseException { - /*@bgen(jjtree) Selector */ - SimpleNode jjtn000 = new SimpleNode(JJTSELECTOR); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IDENTIFIER: - case 29: - JavaClass(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case 30: - Id(); - break; - default: - jj_la1[4] = jj_gen; - ; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case 31: - Class(); - break; - default: - jj_la1[5] = jj_gen; - ; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PSEUDOCLASS_COLON: - PseudoClass(); - break; - default: - jj_la1[6] = jj_gen; - ; - } - break; - case 30: - Id(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case 31: - Class(); - break; - default: - jj_la1[7] = jj_gen; - ; - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PSEUDOCLASS_COLON: - PseudoClass(); - break; - default: - jj_la1[8] = jj_gen; - ; - } - break; - case 31: - Class(); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PSEUDOCLASS_COLON: - PseudoClass(); - break; - default: - jj_la1[9] = jj_gen; - ; - } - break; - case PSEUDOCLASS_COLON: - PseudoClass(); - break; - default: - jj_la1[10] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void JavaClass() throws ParseException { - /*@bgen(jjtree) JavaClass */ - SimpleNode jjtn000 = new SimpleNode(JJTJAVACLASS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IDENTIFIER: - jj_consume_token(IDENTIFIER); - break; - case 29: - jj_consume_token(29); - break; - default: - jj_la1[11] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Id() throws ParseException { - /*@bgen(jjtree) Id */ - SimpleNode jjtn000 = new SimpleNode(JJTID); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(30); - jj_consume_token(IDENTIFIER); - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Class() throws ParseException { - /*@bgen(jjtree) Class */ - SimpleNode jjtn000 = new SimpleNode(JJTCLASS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(31); - jj_consume_token(IDENTIFIER); - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void PseudoClass() throws ParseException { - /*@bgen(jjtree) PseudoClass */ - SimpleNode jjtn000 = new SimpleNode(JJTPSEUDOCLASS); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(PSEUDOCLASS_COLON); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case PSEUDOCLASS_IDENTIFIER: - jj_consume_token(PSEUDOCLASS_IDENTIFIER); - break; - case PROGRAMMATIC_PSEUDOCLASS: - jj_consume_token(PROGRAMMATIC_PSEUDOCLASS); - break; - default: - jj_la1[12] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case 32: - AnimationProperties(); - break; - default: - jj_la1[13] = jj_gen; - ; - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void AnimationProperties() throws ParseException { - /*@bgen(jjtree) AnimationProperties */ - SimpleNode jjtn000 = new SimpleNode(JJTANIMATIONPROPERTIES); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(32); - AnimationProperty(); - label_4: - while (true) { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case 28: - ; - break; - default: - jj_la1[14] = jj_gen; - break label_4; - } - jj_consume_token(28); - AnimationProperty(); - } - jj_consume_token(33); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void AnimationProperty() throws ParseException { - /*@bgen(jjtree) AnimationProperty */ - SimpleNode jjtn000 = new SimpleNode(JJTANIMATIONPROPERTY); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(IDENTIFIER); - jj_consume_token(34); - jj_consume_token(DECIMAL_LITERAL); - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case IDENTIFIER: - jj_consume_token(IDENTIFIER); - break; - default: - jj_la1[15] = jj_gen; - ; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Declaration() throws ParseException { - /*@bgen(jjtree) Declaration */ - SimpleNode jjtn000 = new SimpleNode(JJTDECLARATION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - Property(); - jj_consume_token(COLON); - Expression(); - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Property() throws ParseException { - /*@bgen(jjtree) Property */ - SimpleNode jjtn000 = new SimpleNode(JJTPROPERTY); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(IDENTIFIER); - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Expression() throws ParseException { - /*@bgen(jjtree) Expression */ - SimpleNode jjtn000 = new SimpleNode(JJTEXPRESSION); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { - case DECIMAL_LITERAL: - jj_consume_token(DECIMAL_LITERAL); - break; - case STRING: - jj_consume_token(STRING); - break; - case IDENTIFIER: - jj_consume_token(IDENTIFIER); - break; - case HEXCOLOR: - jj_consume_token(HEXCOLOR); - break; - case EMS: - jj_consume_token(EMS); - break; - case EXS: - jj_consume_token(EXS); - break; - case LENGTH: - jj_consume_token(LENGTH); - break; - case JAVA_CODE_START: - JavaCode(); - break; - default: - jj_la1[16] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } catch (Throwable jjte000) { - if (jjtc000) { - jjtree.clearNodeScope(jjtn000); - jjtc000 = false; - } else { - jjtree.popNode(); - } - if (jjte000 instanceof RuntimeException) { - { - if (true) throw (RuntimeException) jjte000; - } - } - if (jjte000 instanceof ParseException) { - { - if (true) throw (ParseException) jjte000; - } - } - { - if (true) throw (Error) jjte000; - } - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void JavaCode() throws ParseException { - /*@bgen(jjtree) JavaCode */ - SimpleNode jjtn000 = new SimpleNode(JJTJAVACODE); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(JAVA_CODE_START); - jj_consume_token(JAVA_CODE); - jj_consume_token(JAVA_CODE_END); - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - final public void Identifier() throws ParseException { - /*@bgen(jjtree) Identifier */ - SimpleNode jjtn000 = new SimpleNode(JJTIDENTIFIER); - boolean jjtc000 = true; - jjtree.openNodeScope(jjtn000); - jjtreeOpenNodeScope(jjtn000); - try { - jj_consume_token(IDENTIFIER); - } finally { - if (jjtc000) { - jjtree.closeNodeScope(jjtn000, true); - jjtreeCloseNodeScope(jjtn000); - } - } - } - - public CSSParserTokenManager token_source; - SimpleCharStream jj_input_stream; - public Token token, jj_nt; - private int jj_ntk; - private int jj_gen; - final private int[] jj_la1 = new int[17]; - static private int[] jj_la1_0; - static private int[] jj_la1_1; - - static { - jj_la1_0(); - jj_la1_1(); - } - - private static void jj_la1_0() { - jj_la1_0 = new int[]{0xe0002200, 0x8000, 0x200, 0x10000000, 0x40000000, 0x80000000, 0x2000, 0x80000000, 0x2000, 0x2000, 0xe0002200, 0x20000200, 0x201000, 0x0, 0x10000000, 0x200, 0xec40280,}; - } - - private static void jj_la1_1() { - jj_la1_1 = new int[]{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,}; - } - - public CSSParser(java.io.InputStream stream) { - this(stream, null); - } - - public CSSParser(java.io.InputStream stream, String encoding) { - try { - jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); - } catch (java.io.UnsupportedEncodingException e) { - throw new RuntimeException(e); - } - token_source = new CSSParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 17; i++) jj_la1[i] = -1; - } - - public void ReInit(java.io.InputStream stream) { - ReInit(stream, null); - } - - public void ReInit(java.io.InputStream stream, String encoding) { - try { - jj_input_stream.ReInit(stream, encoding, 1, 1); - } catch (java.io.UnsupportedEncodingException e) { - throw new RuntimeException(e); - } - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jjtree.reset(); - jj_gen = 0; - for (int i = 0; i < 17; i++) jj_la1[i] = -1; - } - - public CSSParser(java.io.Reader stream) { - jj_input_stream = new SimpleCharStream(stream, 1, 1); - token_source = new CSSParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 17; i++) jj_la1[i] = -1; - } - - public void ReInit(java.io.Reader stream) { - jj_input_stream.ReInit(stream, 1, 1); - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jjtree.reset(); - jj_gen = 0; - for (int i = 0; i < 17; i++) jj_la1[i] = -1; - } - - public CSSParser(CSSParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 17; i++) jj_la1[i] = -1; - } - - public void ReInit(CSSParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jjtree.reset(); - jj_gen = 0; - for (int i = 0; i < 17; i++) jj_la1[i] = -1; - } - - final private Token jj_consume_token(int kind) throws ParseException { - Token oldToken; - if ((oldToken = token).next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - if (token.kind == kind) { - jj_gen++; - return token; - } - token = oldToken; - jj_kind = kind; - throw generateParseException(); - } - - final public Token getNextToken() { - if (token.next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - jj_gen++; - return token; - } - - final public Token getToken(int index) { - Token t = token; - for (int i = 0; i < index; i++) { - if (t.next != null) t = t.next; - else t = t.next = token_source.getNextToken(); - } - return t; - } - - final private int jj_ntk() { - if ((jj_nt = token.next) == null) - return (jj_ntk = (token.next = token_source.getNextToken()).kind); - else - return (jj_ntk = jj_nt.kind); - } - - private java.util.Vector jj_expentries = new java.util.Vector(); - private int[] jj_expentry; - private int jj_kind = -1; - - public ParseException generateParseException() { - Token errortok = token.next; - int line = errortok.beginLine, column = errortok.beginColumn; - String mess = (errortok.kind == 0) ? tokenImage[0] : errortok.image; - return new ParseException("Parse error. Encountered: " + mess, line, column); - } - - final public void enable_tracing() { - } - - final public void disable_tracing() { - } - -} +package jaxx.compiler.css.parser; + +public class CSSParser/*@bgen(jjtree)*/ implements CSSParserTreeConstants, CSSParserConstants {/*@bgen(jjtree)*/ + protected JJTCSSParserState jjtree = new JJTCSSParserState(); + + public SimpleNode popNode() { + if (jjtree.nodeArity() > 0) // number of child nodes + return (SimpleNode) jjtree.popNode(); + else + return null; + } + + void jjtreeOpenNodeScope(Node n) { + ((SimpleNode) n).firstToken = getToken(1); + } + + void jjtreeCloseNodeScope(Node n) { + ((SimpleNode) n).lastToken = getToken(0); + } + + public static void main(String args[]) { + System.out.println("Reading from standard input..."); + CSSParser css = new CSSParser(System.in); + try { + SimpleNode n = css.Stylesheet(); + n.dump(""); + System.out.println("Thank you."); + } catch (Exception e) { + System.out.println("Oops."); + System.out.println(e.getMessage()); + e.printStackTrace(); + } + } + + final public SimpleNode Stylesheet() throws ParseException { + /*@bgen(jjtree) Stylesheet */ + SimpleNode jjtn000 = new SimpleNode(JJTSTYLESHEET); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + label_1: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case IDENTIFIER: + case PSEUDOCLASS_COLON: + case 29: + case 30: + case 31: + ; + break; + default: + jj_la1[0] = jj_gen; + break label_1; + } + Rule(); + } + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtreeCloseNodeScope(jjtn000); + { + if (true) return jjtn000; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + throw new Error("Missing return statement in function"); + } + + final public void Rule() throws ParseException { + /*@bgen(jjtree) Rule */ + SimpleNode jjtn000 = new SimpleNode(JJTRULE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + Selectors(); + jj_consume_token(LEFT_BRACE); + Declaration(); + label_2: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case SEMICOLON: + ; + break; + default: + jj_la1[1] = jj_gen; + break label_2; + } + jj_consume_token(SEMICOLON); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case IDENTIFIER: + Declaration(); + break; + default: + jj_la1[2] = jj_gen; + ; + } + } + jj_consume_token(RIGHT_BRACE); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Selectors() throws ParseException { + /*@bgen(jjtree) Selectors */ + SimpleNode jjtn000 = new SimpleNode(JJTSELECTORS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + Selector(); + label_3: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case 28: + ; + break; + default: + jj_la1[3] = jj_gen; + break label_3; + } + jj_consume_token(28); + Selector(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Selector() throws ParseException { + /*@bgen(jjtree) Selector */ + SimpleNode jjtn000 = new SimpleNode(JJTSELECTOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case IDENTIFIER: + case 29: + JavaClass(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case 30: + Id(); + break; + default: + jj_la1[4] = jj_gen; + ; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case 31: + Class(); + break; + default: + jj_la1[5] = jj_gen; + ; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case PSEUDOCLASS_COLON: + PseudoClass(); + break; + default: + jj_la1[6] = jj_gen; + ; + } + break; + case 30: + Id(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case 31: + Class(); + break; + default: + jj_la1[7] = jj_gen; + ; + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case PSEUDOCLASS_COLON: + PseudoClass(); + break; + default: + jj_la1[8] = jj_gen; + ; + } + break; + case 31: + Class(); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case PSEUDOCLASS_COLON: + PseudoClass(); + break; + default: + jj_la1[9] = jj_gen; + ; + } + break; + case PSEUDOCLASS_COLON: + PseudoClass(); + break; + default: + jj_la1[10] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void JavaClass() throws ParseException { + /*@bgen(jjtree) JavaClass */ + SimpleNode jjtn000 = new SimpleNode(JJTJAVACLASS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case IDENTIFIER: + jj_consume_token(IDENTIFIER); + break; + case 29: + jj_consume_token(29); + break; + default: + jj_la1[11] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Id() throws ParseException { + /*@bgen(jjtree) Id */ + SimpleNode jjtn000 = new SimpleNode(JJTID); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(30); + jj_consume_token(IDENTIFIER); + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Class() throws ParseException { + /*@bgen(jjtree) Class */ + SimpleNode jjtn000 = new SimpleNode(JJTCLASS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(31); + jj_consume_token(IDENTIFIER); + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void PseudoClass() throws ParseException { + /*@bgen(jjtree) PseudoClass */ + SimpleNode jjtn000 = new SimpleNode(JJTPSEUDOCLASS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(PSEUDOCLASS_COLON); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case PSEUDOCLASS_IDENTIFIER: + jj_consume_token(PSEUDOCLASS_IDENTIFIER); + break; + case PROGRAMMATIC_PSEUDOCLASS: + jj_consume_token(PROGRAMMATIC_PSEUDOCLASS); + break; + default: + jj_la1[12] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case 32: + AnimationProperties(); + break; + default: + jj_la1[13] = jj_gen; + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void AnimationProperties() throws ParseException { + /*@bgen(jjtree) AnimationProperties */ + SimpleNode jjtn000 = new SimpleNode(JJTANIMATIONPROPERTIES); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(32); + AnimationProperty(); + label_4: + while (true) { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case 28: + ; + break; + default: + jj_la1[14] = jj_gen; + break label_4; + } + jj_consume_token(28); + AnimationProperty(); + } + jj_consume_token(33); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void AnimationProperty() throws ParseException { + /*@bgen(jjtree) AnimationProperty */ + SimpleNode jjtn000 = new SimpleNode(JJTANIMATIONPROPERTY); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(IDENTIFIER); + jj_consume_token(34); + jj_consume_token(DECIMAL_LITERAL); + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case IDENTIFIER: + jj_consume_token(IDENTIFIER); + break; + default: + jj_la1[15] = jj_gen; + ; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Declaration() throws ParseException { + /*@bgen(jjtree) Declaration */ + SimpleNode jjtn000 = new SimpleNode(JJTDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + Property(); + jj_consume_token(COLON); + Expression(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Property() throws ParseException { + /*@bgen(jjtree) Property */ + SimpleNode jjtn000 = new SimpleNode(JJTPROPERTY); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(IDENTIFIER); + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Expression() throws ParseException { + /*@bgen(jjtree) Expression */ + SimpleNode jjtn000 = new SimpleNode(JJTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { + case DECIMAL_LITERAL: + jj_consume_token(DECIMAL_LITERAL); + break; + case STRING: + jj_consume_token(STRING); + break; + case IDENTIFIER: + jj_consume_token(IDENTIFIER); + break; + case HEXCOLOR: + jj_consume_token(HEXCOLOR); + break; + case EMS: + jj_consume_token(EMS); + break; + case EXS: + jj_consume_token(EXS); + break; + case LENGTH: + jj_consume_token(LENGTH); + break; + case JAVA_CODE_START: + JavaCode(); + break; + default: + jj_la1[16] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + { + if (true) throw (RuntimeException) jjte000; + } + } + if (jjte000 instanceof ParseException) { + { + if (true) throw (ParseException) jjte000; + } + } + { + if (true) throw (Error) jjte000; + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void JavaCode() throws ParseException { + /*@bgen(jjtree) JavaCode */ + SimpleNode jjtn000 = new SimpleNode(JJTJAVACODE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(JAVA_CODE_START); + jj_consume_token(JAVA_CODE); + jj_consume_token(JAVA_CODE_END); + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + final public void Identifier() throws ParseException { + /*@bgen(jjtree) Identifier */ + SimpleNode jjtn000 = new SimpleNode(JJTIDENTIFIER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + jjtreeOpenNodeScope(jjtn000); + try { + jj_consume_token(IDENTIFIER); + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + jjtreeCloseNodeScope(jjtn000); + } + } + } + + public CSSParserTokenManager token_source; + SimpleCharStream jj_input_stream; + public Token token, jj_nt; + private int jj_ntk; + private int jj_gen; + final private int[] jj_la1 = new int[17]; + static private int[] jj_la1_0; + static private int[] jj_la1_1; + + static { + jj_la1_0(); + jj_la1_1(); + } + + private static void jj_la1_0() { + jj_la1_0 = new int[]{0xe0002200, 0x8000, 0x200, 0x10000000, 0x40000000, 0x80000000, 0x2000, 0x80000000, 0x2000, 0x2000, 0xe0002200, 0x20000200, 0x201000, 0x0, 0x10000000, 0x200, 0xec40280,}; + } + + private static void jj_la1_1() { + jj_la1_1 = new int[]{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,}; + } + + public CSSParser(java.io.InputStream stream) { + this(stream, null); + } + + public CSSParser(java.io.InputStream stream, String encoding) { + try { + jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); + } catch (java.io.UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + token_source = new CSSParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 17; i++) jj_la1[i] = -1; + } + + public void ReInit(java.io.InputStream stream) { + ReInit(stream, null); + } + + public void ReInit(java.io.InputStream stream, String encoding) { + try { + jj_input_stream.ReInit(stream, encoding, 1, 1); + } catch (java.io.UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jjtree.reset(); + jj_gen = 0; + for (int i = 0; i < 17; i++) jj_la1[i] = -1; + } + + public CSSParser(java.io.Reader stream) { + jj_input_stream = new SimpleCharStream(stream, 1, 1); + token_source = new CSSParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 17; i++) jj_la1[i] = -1; + } + + public void ReInit(java.io.Reader stream) { + jj_input_stream.ReInit(stream, 1, 1); + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jjtree.reset(); + jj_gen = 0; + for (int i = 0; i < 17; i++) jj_la1[i] = -1; + } + + public CSSParser(CSSParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 17; i++) jj_la1[i] = -1; + } + + public void ReInit(CSSParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jjtree.reset(); + jj_gen = 0; + for (int i = 0; i < 17; i++) jj_la1[i] = -1; + } + + final private Token jj_consume_token(int kind) throws ParseException { + Token oldToken; + if ((oldToken = token).next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + jj_gen++; + return token; + } + token = oldToken; + jj_kind = kind; + throw generateParseException(); + } + + final public Token getNextToken() { + if (token.next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + jj_gen++; + return token; + } + + final public Token getToken(int index) { + Token t = token; + for (int i = 0; i < index; i++) { + if (t.next != null) t = t.next; + else t = t.next = token_source.getNextToken(); + } + return t; + } + + final private int jj_ntk() { + if ((jj_nt = token.next) == null) + return (jj_ntk = (token.next = token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); + } + + private java.util.Vector jj_expentries = new java.util.Vector(); + private int[] jj_expentry; + private int jj_kind = -1; + + public ParseException generateParseException() { + Token errortok = token.next; + int line = errortok.beginLine, column = errortok.beginColumn; + String mess = (errortok.kind == 0) ? tokenImage[0] : errortok.image; + return new ParseException("Parse error. Encountered: " + mess, line, column); + } + + final public void enable_tracing() { + } + + final public void disable_tracing() { + } + +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserConstants.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserConstants.java index 5ac6ec9..dc18d5b 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserConstants.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserConstants.java @@ -1,3 +1,4 @@ +/* Generated By:JJTree&JavaCC: Do not edit this line. CSSParserConstants.java */ /* * *##% * JAXX Compiler @@ -18,75 +19,74 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JJTree&JavaCC: Do not edit this line. CSSParserConstants.java */ -package jaxx.compiler.css.parser; - -public interface CSSParserConstants { - - int EOF = 0; - int DECIMAL_LITERAL = 7; - int INTEGER_LITERAL = 8; - int IDENTIFIER = 9; - int LETTER = 10; - int DIGIT = 11; - int PSEUDOCLASS_IDENTIFIER = 12; - int PSEUDOCLASS_COLON = 13; - int COLON = 14; - int SEMICOLON = 15; - int LEFT_BRACE = 16; - int RIGHT_BRACE = 17; - int JAVA_CODE_START = 18; - int JAVA_CODE = 19; - int JAVA_CODE_END = 20; - int PROGRAMMATIC_PSEUDOCLASS = 21; - int STRING = 22; - int HEXCOLOR = 23; - int HEXDIGIT = 24; - int EMS = 25; - int EXS = 26; - int LENGTH = 27; - - int DEFAULT = 0; - int IN_RULE = 1; - int JAVA_CODE_RULE = 2; - int IN_PSEUDOCLASS = 3; - - String[] tokenImage = { - "<EOF>", - "\" \"", - "\"\\t\"", - "\"\\n\"", - "\"\\r\"", - "<token of kind 5>", - "<token of kind 6>", - "<DECIMAL_LITERAL>", - "<INTEGER_LITERAL>", - "<IDENTIFIER>", - "<LETTER>", - "<DIGIT>", - "<PSEUDOCLASS_IDENTIFIER>", - "\":\"", - "\":\"", - "\";\"", - "\"{\"", - "\"}\"", - "<JAVA_CODE_START>", - "<JAVA_CODE>", - "<JAVA_CODE_END>", - "<PROGRAMMATIC_PSEUDOCLASS>", - "<STRING>", - "<HEXCOLOR>", - "<HEXDIGIT>", - "<EMS>", - "<EXS>", - "<LENGTH>", - "\",\"", - "\"*\"", - "\"#\"", - "\".\"", - "\"[\"", - "\"]\"", - "\"=\"", - }; - -} +package jaxx.compiler.css.parser; + +public interface CSSParserConstants { + + int EOF = 0; + int DECIMAL_LITERAL = 7; + int INTEGER_LITERAL = 8; + int IDENTIFIER = 9; + int LETTER = 10; + int DIGIT = 11; + int PSEUDOCLASS_IDENTIFIER = 12; + int PSEUDOCLASS_COLON = 13; + int COLON = 14; + int SEMICOLON = 15; + int LEFT_BRACE = 16; + int RIGHT_BRACE = 17; + int JAVA_CODE_START = 18; + int JAVA_CODE = 19; + int JAVA_CODE_END = 20; + int PROGRAMMATIC_PSEUDOCLASS = 21; + int STRING = 22; + int HEXCOLOR = 23; + int HEXDIGIT = 24; + int EMS = 25; + int EXS = 26; + int LENGTH = 27; + + int DEFAULT = 0; + int IN_RULE = 1; + int JAVA_CODE_RULE = 2; + int IN_PSEUDOCLASS = 3; + + String[] tokenImage = { + "<EOF>", + "\" \"", + "\"\\t\"", + "\"\\n\"", + "\"\\r\"", + "<token of kind 5>", + "<token of kind 6>", + "<DECIMAL_LITERAL>", + "<INTEGER_LITERAL>", + "<IDENTIFIER>", + "<LETTER>", + "<DIGIT>", + "<PSEUDOCLASS_IDENTIFIER>", + "\":\"", + "\":\"", + "\";\"", + "\"{\"", + "\"}\"", + "<JAVA_CODE_START>", + "<JAVA_CODE>", + "<JAVA_CODE_END>", + "<PROGRAMMATIC_PSEUDOCLASS>", + "<STRING>", + "<HEXCOLOR>", + "<HEXDIGIT>", + "<EMS>", + "<EXS>", + "<LENGTH>", + "\",\"", + "\"*\"", + "\"#\"", + "\".\"", + "\"[\"", + "\"]\"", + "\"=\"", + }; + +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTokenManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTokenManager.java index f1dedbd..fdd767a 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTokenManager.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTokenManager.java @@ -1,3 +1,4 @@ +/* Generated By:JJTree&JavaCC: Do not edit this line. CSSParserTokenManager.java */ /* * *##% * JAXX Compiler @@ -18,1155 +19,1154 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JJTree&JavaCC: Do not edit this line. CSSParserTokenManager.java */ -package jaxx.compiler.css.parser; - -public class CSSParserTokenManager implements CSSParserConstants { - public java.io.PrintStream debugStream = System.out; - - public void setDebugStream(java.io.PrintStream ds) { - debugStream = ds; - } - - private int jjStopStringLiteralDfa_0(int pos, long active0) { - switch (pos) { - default: - return -1; - } - } - - private int jjStartNfa_0(int pos, long active0) { - return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); - } - - private int jjStopAtPos(int pos, int kind) { - jjmatchedKind = kind; - jjmatchedPos = pos; - return pos + 1; - } - - private int jjStartNfaWithStates_0(int pos, int kind, int state) { - jjmatchedKind = kind; - jjmatchedPos = pos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return pos + 1; - } - return jjMoveNfa_0(state, pos + 1); - } - - private int jjMoveStringLiteralDfa0_0() { - switch (curChar) { - case 35: - return jjStopAtPos(0, 30); - case 42: - return jjStopAtPos(0, 29); - case 44: - return jjStopAtPos(0, 28); - case 46: - return jjStopAtPos(0, 31); - case 58: - return jjStopAtPos(0, 13); - case 59: - return jjStopAtPos(0, 15); - case 61: - return jjStopAtPos(0, 34); - case 91: - return jjStopAtPos(0, 32); - case 93: - return jjStopAtPos(0, 33); - case 123: - return jjStopAtPos(0, 16); - default: - return jjMoveNfa_0(3, 0); - } - } - - private void jjCheckNAdd(int state) { - if (jjrounds[state] != jjround) { - jjstateSet[jjnewStateCnt++] = state; - jjrounds[state] = jjround; - } - } - - private void jjAddStates(int start, int end) { - do { - jjstateSet[jjnewStateCnt++] = jjnextStates[start]; - } while (start++ != end); - } - - private void jjCheckNAddTwoStates(int state1, int state2) { - jjCheckNAdd(state1); - jjCheckNAdd(state2); - } - - private void jjCheckNAddStates(int start, int end) { - do { - jjCheckNAdd(jjnextStates[start]); - } while (start++ != end); - } - - private void jjCheckNAddStates(int start) { - jjCheckNAdd(jjnextStates[start]); - jjCheckNAdd(jjnextStates[start + 1]); - } - - static final long[] jjbitVec0 = { - 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL - }; - - private int jjMoveNfa_0(int startState, int curPos) { - int[] nextStates; - int startsAt = 0; - jjnewStateCnt = 17; - int i = 1; - jjstateSet[0] = startState; - int j, kind = 0x7fffffff; - for (; ;) { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) { - long l = 1L << curChar; - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 3: - if ((0x3ff000000000000L & l) != 0L) { - if (kind > 7) - kind = 7; - jjCheckNAddTwoStates(0, 1); - } else if (curChar == 47) - jjAddStates(0, 1); - else if (curChar == 45) { - if (kind > 9) - kind = 9; - jjCheckNAdd(4); - } - break; - case 0: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 7) - kind = 7; - jjCheckNAddTwoStates(0, 1); - break; - case 1: - if (curChar == 46) - jjCheckNAdd(2); - break; - case 2: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 7) - kind = 7; - jjCheckNAdd(2); - break; - case 4: - if ((0x3ff200000000000L & l) == 0L) - break; - if (kind > 9) - kind = 9; - jjCheckNAdd(4); - break; - case 5: - if (curChar == 47) - jjAddStates(0, 1); - break; - case 6: - if (curChar == 47) - jjCheckNAddStates(2, 4); - break; - case 7: - if ((0xffffffffffffdbffL & l) != 0L) - jjCheckNAddStates(2, 4); - break; - case 8: - if ((0x2400L & l) != 0L && kind > 5) - kind = 5; - break; - case 9: - if (curChar == 10 && kind > 5) - kind = 5; - break; - case 10: - if (curChar == 13) - jjstateSet[jjnewStateCnt++] = 9; - break; - case 11: - if (curChar == 42) - jjCheckNAddTwoStates(12, 13); - break; - case 12: - if ((0xfffffbffffffffffL & l) != 0L) - jjCheckNAddTwoStates(12, 13); - break; - case 13: - if (curChar == 42) - jjAddStates(5, 6); - break; - case 14: - if ((0xffff7fffffffffffL & l) != 0L) - jjCheckNAddTwoStates(15, 13); - break; - case 15: - if ((0xfffffbffffffffffL & l) != 0L) - jjCheckNAddTwoStates(15, 13); - break; - case 16: - if (curChar == 47 && kind > 6) - kind = 6; - break; - default: - break; - } - } while (i != startsAt); - } else if (curChar < 128) { - long l = 1L << (curChar & 077); - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 3: - case 4: - if ((0x7fffffe87fffffeL & l) == 0L) - break; - if (kind > 9) - kind = 9; - jjCheckNAdd(4); - break; - case 7: - jjAddStates(2, 4); - break; - case 12: - jjCheckNAddTwoStates(12, 13); - break; - case 14: - case 15: - jjCheckNAddTwoStates(15, 13); - break; - default: - break; - } - } while (i != startsAt); - } else { - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 7: - if ((jjbitVec0[i2] & l2) != 0L) - jjAddStates(2, 4); - break; - case 12: - if ((jjbitVec0[i2] & l2) != 0L) - jjCheckNAddTwoStates(12, 13); - break; - case 14: - case 15: - if ((jjbitVec0[i2] & l2) != 0L) - jjCheckNAddTwoStates(15, 13); - break; - default: - break; - } - } while (i != startsAt); - } - if (kind != 0x7fffffff) { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 17 - (jjnewStateCnt = startsAt))) - return curPos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return curPos; - } - } - } - - private int jjStopStringLiteralDfa_3(int pos, long active0) { - switch (pos) { - default: - return -1; - } - } - - private int jjStartNfa_3(int pos, long active0) { - return jjMoveNfa_3(jjStopStringLiteralDfa_3(pos, active0), pos + 1); - } - - private int jjStartNfaWithStates_3(int pos, int kind, int state) { - jjmatchedKind = kind; - jjmatchedPos = pos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return pos + 1; - } - return jjMoveNfa_3(state, pos + 1); - } - - private int jjMoveStringLiteralDfa0_3() { - switch (curChar) { - case 59: - return jjStopAtPos(0, 15); - default: - return jjMoveNfa_3(3, 0); - } - } - - private int jjMoveNfa_3(int startState, int curPos) { - int[] nextStates; - int startsAt = 0; - jjnewStateCnt = 8; - int i = 1; - jjstateSet[0] = startState; - int j, kind = 0x7fffffff; - for (; ;) { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) { - long l = 1L << curChar; - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 3: - if ((0x3ff000000000000L & l) != 0L) { - if (kind > 7) - kind = 7; - jjCheckNAddTwoStates(0, 1); - } else if (curChar == 45) { - if (kind > 12) - kind = 12; - jjCheckNAdd(4); - } - break; - case 0: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 7) - kind = 7; - jjCheckNAddTwoStates(0, 1); - break; - case 1: - if (curChar == 46) - jjCheckNAdd(2); - break; - case 2: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 7) - kind = 7; - jjCheckNAdd(2); - break; - case 4: - if ((0x3ff200000000000L & l) == 0L) - break; - if (kind > 12) - kind = 12; - jjCheckNAdd(4); - break; - case 6: - jjAddStates(7, 8); - break; - default: - break; - } - } while (i != startsAt); - } else if (curChar < 128) { - long l = 1L << (curChar & 077); - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 3: - if ((0x7fffffe87fffffeL & l) != 0L) { - if (kind > 12) - kind = 12; - jjCheckNAdd(4); - } else if (curChar == 123) - jjCheckNAdd(6); - break; - case 4: - if ((0x7fffffe87fffffeL & l) == 0L) - break; - if (kind > 12) - kind = 12; - jjCheckNAdd(4); - break; - case 5: - if (curChar == 123) - jjCheckNAdd(6); - break; - case 6: - if ((0xdfffffffffffffffL & l) != 0L) - jjCheckNAddTwoStates(6, 7); - break; - case 7: - if (curChar == 125) - kind = 21; - break; - default: - break; - } - } while (i != startsAt); - } else { - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 6: - if ((jjbitVec0[i2] & l2) != 0L) - jjAddStates(7, 8); - break; - default: - break; - } - } while (i != startsAt); - } - if (kind != 0x7fffffff) { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 8 - (jjnewStateCnt = startsAt))) - return curPos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return curPos; - } - } - } - - private int jjStopStringLiteralDfa_1(int pos, long active0) { - switch (pos) { - default: - return -1; - } - } - - private int jjStartNfa_1(int pos, long active0) { - return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0), pos + 1); - } - - private int jjStartNfaWithStates_1(int pos, int kind, int state) { - jjmatchedKind = kind; - jjmatchedPos = pos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return pos + 1; - } - return jjMoveNfa_1(state, pos + 1); - } - - private int jjMoveStringLiteralDfa0_1() { - switch (curChar) { - case 58: - return jjStopAtPos(0, 14); - case 59: - return jjStopAtPos(0, 15); - case 125: - return jjStopAtPos(0, 17); - default: - return jjMoveNfa_1(0, 0); - } - } - - private int jjMoveNfa_1(int startState, int curPos) { - int[] nextStates; - int startsAt = 0; - jjnewStateCnt = 50; - int i = 1; - jjstateSet[0] = startState; - int j, kind = 0x7fffffff; - for (; ;) { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) { - long l = 1L << curChar; - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 0: - if ((0x3ff000000000000L & l) != 0L) { - if (kind > 7) - kind = 7; - jjCheckNAddStates(9, 22); - } else if (curChar == 47) - jjAddStates(23, 24); - else if (curChar == 35) - jjstateSet[jjnewStateCnt++] = 7; - else if (curChar == 34) - jjCheckNAddTwoStates(4, 5); - else if (curChar == 45) { - if (kind > 9) - kind = 9; - jjCheckNAdd(1); - } - break; - case 1: - if ((0x3ff200000000000L & l) == 0L) - break; - if (kind > 9) - kind = 9; - jjCheckNAdd(1); - break; - case 3: - if (curChar == 34) - jjCheckNAddTwoStates(4, 5); - break; - case 4: - if ((0xfffffffbffffdbffL & l) != 0L) - jjCheckNAddTwoStates(4, 5); - break; - case 5: - if (curChar == 34 && kind > 22) - kind = 22; - break; - case 6: - if (curChar == 35) - jjstateSet[jjnewStateCnt++] = 7; - break; - case 7: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 8; - break; - case 8: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 9; - break; - case 9: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 23) - kind = 23; - jjstateSet[jjnewStateCnt++] = 10; - break; - case 10: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 11; - break; - case 11: - if ((0x3ff000000000000L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 12; - break; - case 12: - if ((0x3ff000000000000L & l) != 0L && kind > 23) - kind = 23; - break; - case 13: - if (curChar == 47) - jjAddStates(23, 24); - break; - case 14: - if (curChar == 47) - jjCheckNAddStates(25, 27); - break; - case 15: - if ((0xffffffffffffdbffL & l) != 0L) - jjCheckNAddStates(25, 27); - break; - case 16: - if ((0x2400L & l) != 0L && kind > 5) - kind = 5; - break; - case 17: - if (curChar == 10 && kind > 5) - kind = 5; - break; - case 18: - if (curChar == 13) - jjstateSet[jjnewStateCnt++] = 17; - break; - case 19: - if (curChar == 42) - jjCheckNAddTwoStates(20, 21); - break; - case 20: - if ((0xfffffbffffffffffL & l) != 0L) - jjCheckNAddTwoStates(20, 21); - break; - case 21: - if (curChar == 42) - jjAddStates(28, 29); - break; - case 22: - if ((0xffff7fffffffffffL & l) != 0L) - jjCheckNAddTwoStates(23, 21); - break; - case 23: - if ((0xfffffbffffffffffL & l) != 0L) - jjCheckNAddTwoStates(23, 21); - break; - case 24: - if (curChar == 47 && kind > 6) - kind = 6; - break; - case 25: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 7) - kind = 7; - jjCheckNAddStates(9, 22); - break; - case 26: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 7) - kind = 7; - jjCheckNAddTwoStates(26, 27); - break; - case 27: - if (curChar == 46) - jjCheckNAdd(28); - break; - case 28: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 7) - kind = 7; - jjCheckNAdd(28); - break; - case 29: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(30, 32); - break; - case 30: - if (curChar == 46) - jjCheckNAdd(31); - break; - case 31: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(31, 33); - break; - case 34: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(33, 35); - break; - case 35: - if (curChar == 46) - jjCheckNAdd(36); - break; - case 36: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(36, 38); - break; - case 39: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(36, 41); - break; - case 40: - if (curChar == 46) - jjCheckNAdd(41); - break; - case 41: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(42, 46); - break; - default: - break; - } - } while (i != startsAt); - } else if (curChar < 128) { - long l = 1L << (curChar & 077); - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 0: - if ((0x7fffffe87fffffeL & l) != 0L) { - if (kind > 9) - kind = 9; - jjCheckNAdd(1); - } else if (curChar == 123) { - if (kind > 18) - kind = 18; - } - break; - case 1: - if ((0x7fffffe87fffffeL & l) == 0L) - break; - if (kind > 9) - kind = 9; - jjCheckNAdd(1); - break; - case 2: - if (curChar == 123 && kind > 18) - kind = 18; - break; - case 4: - if ((0xffffffffefffffffL & l) != 0L) - jjAddStates(47, 48); - break; - case 7: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 8; - break; - case 8: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 9; - break; - case 9: - if ((0x7e0000007eL & l) == 0L) - break; - if (kind > 23) - kind = 23; - jjstateSet[jjnewStateCnt++] = 10; - break; - case 10: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 11; - break; - case 11: - if ((0x7e0000007eL & l) != 0L) - jjstateSet[jjnewStateCnt++] = 12; - break; - case 12: - if ((0x7e0000007eL & l) != 0L && kind > 23) - kind = 23; - break; - case 15: - jjAddStates(25, 27); - break; - case 20: - jjCheckNAddTwoStates(20, 21); - break; - case 22: - case 23: - jjCheckNAddTwoStates(23, 21); - break; - case 32: - if (curChar == 109 && kind > 25) - kind = 25; - break; - case 33: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 32; - break; - case 37: - if (curChar == 120 && kind > 26) - kind = 26; - break; - case 38: - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 37; - break; - case 42: - if (curChar == 109 && kind > 27) - kind = 27; - break; - case 43: - if (curChar == 109) - jjCheckNAdd(42); - break; - case 44: - if (curChar == 99) - jjCheckNAdd(42); - break; - case 45: - if (curChar == 110 && kind > 27) - kind = 27; - break; - case 46: - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 45; - break; - case 47: - if (curChar == 112) - jjAddStates(49, 50); - break; - case 48: - if (curChar == 116 && kind > 27) - kind = 27; - break; - case 49: - if (curChar == 99 && kind > 27) - kind = 27; - break; - default: - break; - } - } while (i != startsAt); - } else { - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 4: - if ((jjbitVec0[i2] & l2) != 0L) - jjAddStates(47, 48); - break; - case 15: - if ((jjbitVec0[i2] & l2) != 0L) - jjAddStates(25, 27); - break; - case 20: - if ((jjbitVec0[i2] & l2) != 0L) - jjCheckNAddTwoStates(20, 21); - break; - case 22: - case 23: - if ((jjbitVec0[i2] & l2) != 0L) - jjCheckNAddTwoStates(23, 21); - break; - default: - break; - } - } while (i != startsAt); - } - if (kind != 0x7fffffff) { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 50 - (jjnewStateCnt = startsAt))) - return curPos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return curPos; - } - } - } - - private int jjStopStringLiteralDfa_2(int pos, long active0) { - switch (pos) { - default: - return -1; - } - } - - private int jjStartNfa_2(int pos, long active0) { - return jjMoveNfa_2(jjStopStringLiteralDfa_2(pos, active0), pos + 1); - } - - private int jjStartNfaWithStates_2(int pos, int kind, int state) { - jjmatchedKind = kind; - jjmatchedPos = pos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return pos + 1; - } - return jjMoveNfa_2(state, pos + 1); - } - - private int jjMoveStringLiteralDfa0_2() { - switch (curChar) { - case 59: - return jjStartNfaWithStates_2(0, 15, 3); - default: - return jjMoveNfa_2(4, 0); - } - } - - private int jjMoveNfa_2(int startState, int curPos) { - int[] nextStates; - int startsAt = 0; - jjnewStateCnt = 5; - int i = 1; - jjstateSet[0] = startState; - int j, kind = 0x7fffffff; - for (; ;) { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) { - long l = 1L << curChar; - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 4: - if (kind > 19) - kind = 19; - jjCheckNAdd(3); - if ((0x3ff000000000000L & l) != 0L) { - if (kind > 7) - kind = 7; - jjCheckNAddTwoStates(0, 1); - } - break; - case 0: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 7) - kind = 7; - jjCheckNAddTwoStates(0, 1); - break; - case 1: - if (curChar == 46) - jjCheckNAdd(2); - break; - case 2: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 7) - kind = 7; - jjCheckNAdd(2); - break; - case 3: - if (kind > 19) - kind = 19; - jjCheckNAdd(3); - break; - default: - break; - } - } while (i != startsAt); - } else if (curChar < 128) { - long l = 1L << (curChar & 077); - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 4: - if ((0xdfffffffffffffffL & l) != 0L) { - if (kind > 19) - kind = 19; - jjCheckNAdd(3); - } else if (curChar == 125) { - if (kind > 20) - kind = 20; - } - break; - case 3: - if ((0xdfffffffffffffffL & l) == 0L) - break; - kind = 19; - jjCheckNAdd(3); - break; - default: - break; - } - } while (i != startsAt); - } else { - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - MatchLoop: - do { - switch (jjstateSet[--i]) { - case 4: - case 3: - if ((jjbitVec0[i2] & l2) == 0L) - break; - if (kind > 19) - kind = 19; - jjCheckNAdd(3); - break; - default: - break; - } - } while (i != startsAt); - } - if (kind != 0x7fffffff) { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 5 - (jjnewStateCnt = startsAt))) - return curPos; - try { - curChar = input_stream.readChar(); - } - catch (java.io.IOException e) { - return curPos; - } - } - } - - static final int[] jjnextStates = { - 6, 11, 7, 8, 10, 14, 16, 6, 7, 26, 27, 29, 30, 33, 34, 35, - 38, 39, 40, 43, 44, 46, 47, 14, 19, 15, 16, 18, 22, 24, 29, 30, - 33, 34, 35, 38, 39, 40, 43, 44, 46, 47, 41, 43, 44, 46, 47, 4, - 5, 48, 49, - }; - public static final String[] jjstrLiteralImages = { - "", null, null, null, null, null, null, null, null, null, null, null, null, - "\72", "\72", "\73", "\173", "\175", null, null, null, null, null, null, null, null, - null, null, "\54", "\52", "\43", "\56", "\133", "\135", "\75",}; - public static final String[] lexStateNames = { - "DEFAULT", - "IN_RULE", - "JAVA_CODE_RULE", - "IN_PSEUDOCLASS", - }; - public static final int[] jjnewLexState = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 3, -1, -1, 1, 0, 2, -1, 1, 0, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - }; - static final long[] jjtoToken = { - 0x7fefff281L, - }; - static final long[] jjtoSkip = { - 0x7eL, - }; - protected SimpleCharStream input_stream; - private final int[] jjrounds = new int[50]; - private final int[] jjstateSet = new int[100]; - protected char curChar; - - public CSSParserTokenManager(SimpleCharStream stream) { - if (SimpleCharStream.staticFlag) - throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); - input_stream = stream; - } - - public CSSParserTokenManager(SimpleCharStream stream, int lexState) { - this(stream); - SwitchTo(lexState); - } - - public void ReInit(SimpleCharStream stream) { - jjmatchedPos = jjnewStateCnt = 0; - curLexState = defaultLexState; - input_stream = stream; - ReInitRounds(); - } - - private void ReInitRounds() { - int i; - jjround = 0x80000001; - for (i = 50; i-- > 0;) - jjrounds[i] = 0x80000000; - } - - public void ReInit(SimpleCharStream stream, int lexState) { - ReInit(stream); - SwitchTo(lexState); - } - - public void SwitchTo(int lexState) { - if (lexState >= 4 || lexState < 0) - throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - else - curLexState = lexState; - } - - protected Token jjFillToken() { - Token t = Token.newToken(jjmatchedKind); - t.kind = jjmatchedKind; - String im = jjstrLiteralImages[jjmatchedKind]; - t.image = (im == null) ? input_stream.GetImage() : im; - t.beginLine = input_stream.getBeginLine(); - t.beginColumn = input_stream.getBeginColumn(); - t.endLine = input_stream.getEndLine(); - t.endColumn = input_stream.getEndColumn(); - return t; - } - - int curLexState = 0; - int defaultLexState = 0; - int jjnewStateCnt; - int jjround; - int jjmatchedPos; - int jjmatchedKind; - - public Token getNextToken() { - int kind; - Token specialToken = null; - Token matchedToken; - int curPos = 0; - - EOFLoop: - for (; ;) { - try { - curChar = input_stream.BeginToken(); - } - catch (java.io.IOException e) { - jjmatchedKind = 0; - matchedToken = jjFillToken(); - return matchedToken; - } - - switch (curLexState) { - case 0: - try { - input_stream.backup(0); - while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L) - curChar = input_stream.BeginToken(); - } - catch (java.io.IOException e1) { - continue EOFLoop; - } - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_0(); - break; - case 1: - try { - input_stream.backup(0); - while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L) - curChar = input_stream.BeginToken(); - } - catch (java.io.IOException e1) { - continue EOFLoop; - } - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_1(); - break; - case 2: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_2(); - break; - case 3: - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_3(); - break; - } - if (jjmatchedKind != 0x7fffffff) { - if (jjmatchedPos + 1 < curPos) - input_stream.backup(curPos - jjmatchedPos - 1); - if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { - matchedToken = jjFillToken(); - if (jjnewLexState[jjmatchedKind] != -1) - curLexState = jjnewLexState[jjmatchedKind]; - return matchedToken; - } else { - if (jjnewLexState[jjmatchedKind] != -1) - curLexState = jjnewLexState[jjmatchedKind]; - continue EOFLoop; - } - } - int error_line = input_stream.getEndLine(); - int error_column = input_stream.getEndColumn(); - String error_after = null; - boolean EOFSeen = false; - try { - input_stream.readChar(); - input_stream.backup(1); - } - catch (java.io.IOException e1) { - EOFSeen = true; - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - if (curChar == '\n' || curChar == '\r') { - error_line++; - error_column = 0; - } else - error_column++; - } - if (!EOFSeen) { - input_stream.backup(1); - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - } - throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); - } - } - -} +package jaxx.compiler.css.parser; + +public class CSSParserTokenManager implements CSSParserConstants { + public java.io.PrintStream debugStream = System.out; + + public void setDebugStream(java.io.PrintStream ds) { + debugStream = ds; + } + + private int jjStopStringLiteralDfa_0(int pos, long active0) { + switch (pos) { + default: + return -1; + } + } + + private int jjStartNfa_0(int pos, long active0) { + return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); + } + + private int jjStopAtPos(int pos, int kind) { + jjmatchedKind = kind; + jjmatchedPos = pos; + return pos + 1; + } + + private int jjStartNfaWithStates_0(int pos, int kind, int state) { + jjmatchedKind = kind; + jjmatchedPos = pos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return pos + 1; + } + return jjMoveNfa_0(state, pos + 1); + } + + private int jjMoveStringLiteralDfa0_0() { + switch (curChar) { + case 35: + return jjStopAtPos(0, 30); + case 42: + return jjStopAtPos(0, 29); + case 44: + return jjStopAtPos(0, 28); + case 46: + return jjStopAtPos(0, 31); + case 58: + return jjStopAtPos(0, 13); + case 59: + return jjStopAtPos(0, 15); + case 61: + return jjStopAtPos(0, 34); + case 91: + return jjStopAtPos(0, 32); + case 93: + return jjStopAtPos(0, 33); + case 123: + return jjStopAtPos(0, 16); + default: + return jjMoveNfa_0(3, 0); + } + } + + private void jjCheckNAdd(int state) { + if (jjrounds[state] != jjround) { + jjstateSet[jjnewStateCnt++] = state; + jjrounds[state] = jjround; + } + } + + private void jjAddStates(int start, int end) { + do { + jjstateSet[jjnewStateCnt++] = jjnextStates[start]; + } while (start++ != end); + } + + private void jjCheckNAddTwoStates(int state1, int state2) { + jjCheckNAdd(state1); + jjCheckNAdd(state2); + } + + private void jjCheckNAddStates(int start, int end) { + do { + jjCheckNAdd(jjnextStates[start]); + } while (start++ != end); + } + + private void jjCheckNAddStates(int start) { + jjCheckNAdd(jjnextStates[start]); + jjCheckNAdd(jjnextStates[start + 1]); + } + + static final long[] jjbitVec0 = { + 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL + }; + + private int jjMoveNfa_0(int startState, int curPos) { + int[] nextStates; + int startsAt = 0; + jjnewStateCnt = 17; + int i = 1; + jjstateSet[0] = startState; + int j, kind = 0x7fffffff; + for (; ;) { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) { + long l = 1L << curChar; + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 3: + if ((0x3ff000000000000L & l) != 0L) { + if (kind > 7) + kind = 7; + jjCheckNAddTwoStates(0, 1); + } else if (curChar == 47) + jjAddStates(0, 1); + else if (curChar == 45) { + if (kind > 9) + kind = 9; + jjCheckNAdd(4); + } + break; + case 0: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 7) + kind = 7; + jjCheckNAddTwoStates(0, 1); + break; + case 1: + if (curChar == 46) + jjCheckNAdd(2); + break; + case 2: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 7) + kind = 7; + jjCheckNAdd(2); + break; + case 4: + if ((0x3ff200000000000L & l) == 0L) + break; + if (kind > 9) + kind = 9; + jjCheckNAdd(4); + break; + case 5: + if (curChar == 47) + jjAddStates(0, 1); + break; + case 6: + if (curChar == 47) + jjCheckNAddStates(2, 4); + break; + case 7: + if ((0xffffffffffffdbffL & l) != 0L) + jjCheckNAddStates(2, 4); + break; + case 8: + if ((0x2400L & l) != 0L && kind > 5) + kind = 5; + break; + case 9: + if (curChar == 10 && kind > 5) + kind = 5; + break; + case 10: + if (curChar == 13) + jjstateSet[jjnewStateCnt++] = 9; + break; + case 11: + if (curChar == 42) + jjCheckNAddTwoStates(12, 13); + break; + case 12: + if ((0xfffffbffffffffffL & l) != 0L) + jjCheckNAddTwoStates(12, 13); + break; + case 13: + if (curChar == 42) + jjAddStates(5, 6); + break; + case 14: + if ((0xffff7fffffffffffL & l) != 0L) + jjCheckNAddTwoStates(15, 13); + break; + case 15: + if ((0xfffffbffffffffffL & l) != 0L) + jjCheckNAddTwoStates(15, 13); + break; + case 16: + if (curChar == 47 && kind > 6) + kind = 6; + break; + default: + break; + } + } while (i != startsAt); + } else if (curChar < 128) { + long l = 1L << (curChar & 077); + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 3: + case 4: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 9) + kind = 9; + jjCheckNAdd(4); + break; + case 7: + jjAddStates(2, 4); + break; + case 12: + jjCheckNAddTwoStates(12, 13); + break; + case 14: + case 15: + jjCheckNAddTwoStates(15, 13); + break; + default: + break; + } + } while (i != startsAt); + } else { + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 7: + if ((jjbitVec0[i2] & l2) != 0L) + jjAddStates(2, 4); + break; + case 12: + if ((jjbitVec0[i2] & l2) != 0L) + jjCheckNAddTwoStates(12, 13); + break; + case 14: + case 15: + if ((jjbitVec0[i2] & l2) != 0L) + jjCheckNAddTwoStates(15, 13); + break; + default: + break; + } + } while (i != startsAt); + } + if (kind != 0x7fffffff) { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 17 - (jjnewStateCnt = startsAt))) + return curPos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return curPos; + } + } + } + + private int jjStopStringLiteralDfa_3(int pos, long active0) { + switch (pos) { + default: + return -1; + } + } + + private int jjStartNfa_3(int pos, long active0) { + return jjMoveNfa_3(jjStopStringLiteralDfa_3(pos, active0), pos + 1); + } + + private int jjStartNfaWithStates_3(int pos, int kind, int state) { + jjmatchedKind = kind; + jjmatchedPos = pos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return pos + 1; + } + return jjMoveNfa_3(state, pos + 1); + } + + private int jjMoveStringLiteralDfa0_3() { + switch (curChar) { + case 59: + return jjStopAtPos(0, 15); + default: + return jjMoveNfa_3(3, 0); + } + } + + private int jjMoveNfa_3(int startState, int curPos) { + int[] nextStates; + int startsAt = 0; + jjnewStateCnt = 8; + int i = 1; + jjstateSet[0] = startState; + int j, kind = 0x7fffffff; + for (; ;) { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) { + long l = 1L << curChar; + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 3: + if ((0x3ff000000000000L & l) != 0L) { + if (kind > 7) + kind = 7; + jjCheckNAddTwoStates(0, 1); + } else if (curChar == 45) { + if (kind > 12) + kind = 12; + jjCheckNAdd(4); + } + break; + case 0: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 7) + kind = 7; + jjCheckNAddTwoStates(0, 1); + break; + case 1: + if (curChar == 46) + jjCheckNAdd(2); + break; + case 2: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 7) + kind = 7; + jjCheckNAdd(2); + break; + case 4: + if ((0x3ff200000000000L & l) == 0L) + break; + if (kind > 12) + kind = 12; + jjCheckNAdd(4); + break; + case 6: + jjAddStates(7, 8); + break; + default: + break; + } + } while (i != startsAt); + } else if (curChar < 128) { + long l = 1L << (curChar & 077); + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 3: + if ((0x7fffffe87fffffeL & l) != 0L) { + if (kind > 12) + kind = 12; + jjCheckNAdd(4); + } else if (curChar == 123) + jjCheckNAdd(6); + break; + case 4: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 12) + kind = 12; + jjCheckNAdd(4); + break; + case 5: + if (curChar == 123) + jjCheckNAdd(6); + break; + case 6: + if ((0xdfffffffffffffffL & l) != 0L) + jjCheckNAddTwoStates(6, 7); + break; + case 7: + if (curChar == 125) + kind = 21; + break; + default: + break; + } + } while (i != startsAt); + } else { + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 6: + if ((jjbitVec0[i2] & l2) != 0L) + jjAddStates(7, 8); + break; + default: + break; + } + } while (i != startsAt); + } + if (kind != 0x7fffffff) { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 8 - (jjnewStateCnt = startsAt))) + return curPos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return curPos; + } + } + } + + private int jjStopStringLiteralDfa_1(int pos, long active0) { + switch (pos) { + default: + return -1; + } + } + + private int jjStartNfa_1(int pos, long active0) { + return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0), pos + 1); + } + + private int jjStartNfaWithStates_1(int pos, int kind, int state) { + jjmatchedKind = kind; + jjmatchedPos = pos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return pos + 1; + } + return jjMoveNfa_1(state, pos + 1); + } + + private int jjMoveStringLiteralDfa0_1() { + switch (curChar) { + case 58: + return jjStopAtPos(0, 14); + case 59: + return jjStopAtPos(0, 15); + case 125: + return jjStopAtPos(0, 17); + default: + return jjMoveNfa_1(0, 0); + } + } + + private int jjMoveNfa_1(int startState, int curPos) { + int[] nextStates; + int startsAt = 0; + jjnewStateCnt = 50; + int i = 1; + jjstateSet[0] = startState; + int j, kind = 0x7fffffff; + for (; ;) { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) { + long l = 1L << curChar; + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 0: + if ((0x3ff000000000000L & l) != 0L) { + if (kind > 7) + kind = 7; + jjCheckNAddStates(9, 22); + } else if (curChar == 47) + jjAddStates(23, 24); + else if (curChar == 35) + jjstateSet[jjnewStateCnt++] = 7; + else if (curChar == 34) + jjCheckNAddTwoStates(4, 5); + else if (curChar == 45) { + if (kind > 9) + kind = 9; + jjCheckNAdd(1); + } + break; + case 1: + if ((0x3ff200000000000L & l) == 0L) + break; + if (kind > 9) + kind = 9; + jjCheckNAdd(1); + break; + case 3: + if (curChar == 34) + jjCheckNAddTwoStates(4, 5); + break; + case 4: + if ((0xfffffffbffffdbffL & l) != 0L) + jjCheckNAddTwoStates(4, 5); + break; + case 5: + if (curChar == 34 && kind > 22) + kind = 22; + break; + case 6: + if (curChar == 35) + jjstateSet[jjnewStateCnt++] = 7; + break; + case 7: + if ((0x3ff000000000000L & l) != 0L) + jjstateSet[jjnewStateCnt++] = 8; + break; + case 8: + if ((0x3ff000000000000L & l) != 0L) + jjstateSet[jjnewStateCnt++] = 9; + break; + case 9: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 23) + kind = 23; + jjstateSet[jjnewStateCnt++] = 10; + break; + case 10: + if ((0x3ff000000000000L & l) != 0L) + jjstateSet[jjnewStateCnt++] = 11; + break; + case 11: + if ((0x3ff000000000000L & l) != 0L) + jjstateSet[jjnewStateCnt++] = 12; + break; + case 12: + if ((0x3ff000000000000L & l) != 0L && kind > 23) + kind = 23; + break; + case 13: + if (curChar == 47) + jjAddStates(23, 24); + break; + case 14: + if (curChar == 47) + jjCheckNAddStates(25, 27); + break; + case 15: + if ((0xffffffffffffdbffL & l) != 0L) + jjCheckNAddStates(25, 27); + break; + case 16: + if ((0x2400L & l) != 0L && kind > 5) + kind = 5; + break; + case 17: + if (curChar == 10 && kind > 5) + kind = 5; + break; + case 18: + if (curChar == 13) + jjstateSet[jjnewStateCnt++] = 17; + break; + case 19: + if (curChar == 42) + jjCheckNAddTwoStates(20, 21); + break; + case 20: + if ((0xfffffbffffffffffL & l) != 0L) + jjCheckNAddTwoStates(20, 21); + break; + case 21: + if (curChar == 42) + jjAddStates(28, 29); + break; + case 22: + if ((0xffff7fffffffffffL & l) != 0L) + jjCheckNAddTwoStates(23, 21); + break; + case 23: + if ((0xfffffbffffffffffL & l) != 0L) + jjCheckNAddTwoStates(23, 21); + break; + case 24: + if (curChar == 47 && kind > 6) + kind = 6; + break; + case 25: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 7) + kind = 7; + jjCheckNAddStates(9, 22); + break; + case 26: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 7) + kind = 7; + jjCheckNAddTwoStates(26, 27); + break; + case 27: + if (curChar == 46) + jjCheckNAdd(28); + break; + case 28: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 7) + kind = 7; + jjCheckNAdd(28); + break; + case 29: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(30, 32); + break; + case 30: + if (curChar == 46) + jjCheckNAdd(31); + break; + case 31: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(31, 33); + break; + case 34: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(33, 35); + break; + case 35: + if (curChar == 46) + jjCheckNAdd(36); + break; + case 36: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(36, 38); + break; + case 39: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(36, 41); + break; + case 40: + if (curChar == 46) + jjCheckNAdd(41); + break; + case 41: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(42, 46); + break; + default: + break; + } + } while (i != startsAt); + } else if (curChar < 128) { + long l = 1L << (curChar & 077); + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 0: + if ((0x7fffffe87fffffeL & l) != 0L) { + if (kind > 9) + kind = 9; + jjCheckNAdd(1); + } else if (curChar == 123) { + if (kind > 18) + kind = 18; + } + break; + case 1: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 9) + kind = 9; + jjCheckNAdd(1); + break; + case 2: + if (curChar == 123 && kind > 18) + kind = 18; + break; + case 4: + if ((0xffffffffefffffffL & l) != 0L) + jjAddStates(47, 48); + break; + case 7: + if ((0x7e0000007eL & l) != 0L) + jjstateSet[jjnewStateCnt++] = 8; + break; + case 8: + if ((0x7e0000007eL & l) != 0L) + jjstateSet[jjnewStateCnt++] = 9; + break; + case 9: + if ((0x7e0000007eL & l) == 0L) + break; + if (kind > 23) + kind = 23; + jjstateSet[jjnewStateCnt++] = 10; + break; + case 10: + if ((0x7e0000007eL & l) != 0L) + jjstateSet[jjnewStateCnt++] = 11; + break; + case 11: + if ((0x7e0000007eL & l) != 0L) + jjstateSet[jjnewStateCnt++] = 12; + break; + case 12: + if ((0x7e0000007eL & l) != 0L && kind > 23) + kind = 23; + break; + case 15: + jjAddStates(25, 27); + break; + case 20: + jjCheckNAddTwoStates(20, 21); + break; + case 22: + case 23: + jjCheckNAddTwoStates(23, 21); + break; + case 32: + if (curChar == 109 && kind > 25) + kind = 25; + break; + case 33: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 32; + break; + case 37: + if (curChar == 120 && kind > 26) + kind = 26; + break; + case 38: + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 37; + break; + case 42: + if (curChar == 109 && kind > 27) + kind = 27; + break; + case 43: + if (curChar == 109) + jjCheckNAdd(42); + break; + case 44: + if (curChar == 99) + jjCheckNAdd(42); + break; + case 45: + if (curChar == 110 && kind > 27) + kind = 27; + break; + case 46: + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 45; + break; + case 47: + if (curChar == 112) + jjAddStates(49, 50); + break; + case 48: + if (curChar == 116 && kind > 27) + kind = 27; + break; + case 49: + if (curChar == 99 && kind > 27) + kind = 27; + break; + default: + break; + } + } while (i != startsAt); + } else { + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 4: + if ((jjbitVec0[i2] & l2) != 0L) + jjAddStates(47, 48); + break; + case 15: + if ((jjbitVec0[i2] & l2) != 0L) + jjAddStates(25, 27); + break; + case 20: + if ((jjbitVec0[i2] & l2) != 0L) + jjCheckNAddTwoStates(20, 21); + break; + case 22: + case 23: + if ((jjbitVec0[i2] & l2) != 0L) + jjCheckNAddTwoStates(23, 21); + break; + default: + break; + } + } while (i != startsAt); + } + if (kind != 0x7fffffff) { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 50 - (jjnewStateCnt = startsAt))) + return curPos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return curPos; + } + } + } + + private int jjStopStringLiteralDfa_2(int pos, long active0) { + switch (pos) { + default: + return -1; + } + } + + private int jjStartNfa_2(int pos, long active0) { + return jjMoveNfa_2(jjStopStringLiteralDfa_2(pos, active0), pos + 1); + } + + private int jjStartNfaWithStates_2(int pos, int kind, int state) { + jjmatchedKind = kind; + jjmatchedPos = pos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return pos + 1; + } + return jjMoveNfa_2(state, pos + 1); + } + + private int jjMoveStringLiteralDfa0_2() { + switch (curChar) { + case 59: + return jjStartNfaWithStates_2(0, 15, 3); + default: + return jjMoveNfa_2(4, 0); + } + } + + private int jjMoveNfa_2(int startState, int curPos) { + int[] nextStates; + int startsAt = 0; + jjnewStateCnt = 5; + int i = 1; + jjstateSet[0] = startState; + int j, kind = 0x7fffffff; + for (; ;) { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) { + long l = 1L << curChar; + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 4: + if (kind > 19) + kind = 19; + jjCheckNAdd(3); + if ((0x3ff000000000000L & l) != 0L) { + if (kind > 7) + kind = 7; + jjCheckNAddTwoStates(0, 1); + } + break; + case 0: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 7) + kind = 7; + jjCheckNAddTwoStates(0, 1); + break; + case 1: + if (curChar == 46) + jjCheckNAdd(2); + break; + case 2: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 7) + kind = 7; + jjCheckNAdd(2); + break; + case 3: + if (kind > 19) + kind = 19; + jjCheckNAdd(3); + break; + default: + break; + } + } while (i != startsAt); + } else if (curChar < 128) { + long l = 1L << (curChar & 077); + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 4: + if ((0xdfffffffffffffffL & l) != 0L) { + if (kind > 19) + kind = 19; + jjCheckNAdd(3); + } else if (curChar == 125) { + if (kind > 20) + kind = 20; + } + break; + case 3: + if ((0xdfffffffffffffffL & l) == 0L) + break; + kind = 19; + jjCheckNAdd(3); + break; + default: + break; + } + } while (i != startsAt); + } else { + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + MatchLoop: + do { + switch (jjstateSet[--i]) { + case 4: + case 3: + if ((jjbitVec0[i2] & l2) == 0L) + break; + if (kind > 19) + kind = 19; + jjCheckNAdd(3); + break; + default: + break; + } + } while (i != startsAt); + } + if (kind != 0x7fffffff) { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 5 - (jjnewStateCnt = startsAt))) + return curPos; + try { + curChar = input_stream.readChar(); + } + catch (java.io.IOException e) { + return curPos; + } + } + } + + static final int[] jjnextStates = { + 6, 11, 7, 8, 10, 14, 16, 6, 7, 26, 27, 29, 30, 33, 34, 35, + 38, 39, 40, 43, 44, 46, 47, 14, 19, 15, 16, 18, 22, 24, 29, 30, + 33, 34, 35, 38, 39, 40, 43, 44, 46, 47, 41, 43, 44, 46, 47, 4, + 5, 48, 49, + }; + public static final String[] jjstrLiteralImages = { + "", null, null, null, null, null, null, null, null, null, null, null, null, + "\72", "\72", "\73", "\173", "\175", null, null, null, null, null, null, null, null, + null, null, "\54", "\52", "\43", "\56", "\133", "\135", "\75",}; + public static final String[] lexStateNames = { + "DEFAULT", + "IN_RULE", + "JAVA_CODE_RULE", + "IN_PSEUDOCLASS", + }; + public static final int[] jjnewLexState = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 3, -1, -1, 1, 0, 2, -1, 1, 0, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + }; + static final long[] jjtoToken = { + 0x7fefff281L, + }; + static final long[] jjtoSkip = { + 0x7eL, + }; + protected SimpleCharStream input_stream; + private final int[] jjrounds = new int[50]; + private final int[] jjstateSet = new int[100]; + protected char curChar; + + public CSSParserTokenManager(SimpleCharStream stream) { + if (SimpleCharStream.staticFlag) + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + input_stream = stream; + } + + public CSSParserTokenManager(SimpleCharStream stream, int lexState) { + this(stream); + SwitchTo(lexState); + } + + public void ReInit(SimpleCharStream stream) { + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); + } + + private void ReInitRounds() { + int i; + jjround = 0x80000001; + for (i = 50; i-- > 0;) + jjrounds[i] = 0x80000000; + } + + public void ReInit(SimpleCharStream stream, int lexState) { + ReInit(stream); + SwitchTo(lexState); + } + + public void SwitchTo(int lexState) { + if (lexState >= 4 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; + } + + protected Token jjFillToken() { + Token t = Token.newToken(jjmatchedKind); + t.kind = jjmatchedKind; + String im = jjstrLiteralImages[jjmatchedKind]; + t.image = (im == null) ? input_stream.GetImage() : im; + t.beginLine = input_stream.getBeginLine(); + t.beginColumn = input_stream.getBeginColumn(); + t.endLine = input_stream.getEndLine(); + t.endColumn = input_stream.getEndColumn(); + return t; + } + + int curLexState = 0; + int defaultLexState = 0; + int jjnewStateCnt; + int jjround; + int jjmatchedPos; + int jjmatchedKind; + + public Token getNextToken() { + int kind; + Token specialToken = null; + Token matchedToken; + int curPos = 0; + + EOFLoop: + for (; ;) { + try { + curChar = input_stream.BeginToken(); + } + catch (java.io.IOException e) { + jjmatchedKind = 0; + matchedToken = jjFillToken(); + return matchedToken; + } + + switch (curLexState) { + case 0: + try { + input_stream.backup(0); + while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L) + curChar = input_stream.BeginToken(); + } + catch (java.io.IOException e1) { + continue EOFLoop; + } + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_0(); + break; + case 1: + try { + input_stream.backup(0); + while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L) + curChar = input_stream.BeginToken(); + } + catch (java.io.IOException e1) { + continue EOFLoop; + } + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_1(); + break; + case 2: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_2(); + break; + case 3: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_3(); + break; + } + if (jjmatchedKind != 0x7fffffff) { + if (jjmatchedPos + 1 < curPos) + input_stream.backup(curPos - jjmatchedPos - 1); + if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { + matchedToken = jjFillToken(); + if (jjnewLexState[jjmatchedKind] != -1) + curLexState = jjnewLexState[jjmatchedKind]; + return matchedToken; + } else { + if (jjnewLexState[jjmatchedKind] != -1) + curLexState = jjnewLexState[jjmatchedKind]; + continue EOFLoop; + } + } + int error_line = input_stream.getEndLine(); + int error_column = input_stream.getEndColumn(); + String error_after = null; + boolean EOFSeen = false; + try { + input_stream.readChar(); + input_stream.backup(1); + } + catch (java.io.IOException e1) { + EOFSeen = true; + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + if (curChar == '\n' || curChar == '\r') { + error_line++; + error_column = 0; + } else + error_column++; + } + if (!EOFSeen) { + input_stream.backup(1); + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + } + throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); + } + } + +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTreeConstants.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTreeConstants.java index b9e6b20..9420b70 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTreeConstants.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/CSSParserTreeConstants.java @@ -1,3 +1,4 @@ +/* Generated By:JJTree: Do not edit this line. .\CSSParserTreeConstants.java */ /* * *##% * JAXX Compiler @@ -18,43 +19,42 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JJTree: Do not edit this line. .\CSSParserTreeConstants.java */ - -package jaxx.compiler.css.parser; - -public interface CSSParserTreeConstants { - public int JJTSTYLESHEET = 0; - public int JJTRULE = 1; - public int JJTSELECTORS = 2; - public int JJTSELECTOR = 3; - public int JJTJAVACLASS = 4; - public int JJTID = 5; - public int JJTCLASS = 6; - public int JJTPSEUDOCLASS = 7; - public int JJTANIMATIONPROPERTIES = 8; - public int JJTANIMATIONPROPERTY = 9; - public int JJTDECLARATION = 10; - public int JJTPROPERTY = 11; - public int JJTEXPRESSION = 12; - public int JJTJAVACODE = 13; - public int JJTIDENTIFIER = 14; - - - public String[] jjtNodeName = { - "Stylesheet", - "Rule", - "Selectors", - "Selector", - "JavaClass", - "Id", - "Class", - "PseudoClass", - "AnimationProperties", - "AnimationProperty", - "Declaration", - "Property", - "Expression", - "JavaCode", - "Identifier", - }; -} + +package jaxx.compiler.css.parser; + +public interface CSSParserTreeConstants { + public int JJTSTYLESHEET = 0; + public int JJTRULE = 1; + public int JJTSELECTORS = 2; + public int JJTSELECTOR = 3; + public int JJTJAVACLASS = 4; + public int JJTID = 5; + public int JJTCLASS = 6; + public int JJTPSEUDOCLASS = 7; + public int JJTANIMATIONPROPERTIES = 8; + public int JJTANIMATIONPROPERTY = 9; + public int JJTDECLARATION = 10; + public int JJTPROPERTY = 11; + public int JJTEXPRESSION = 12; + public int JJTJAVACODE = 13; + public int JJTIDENTIFIER = 14; + + + public String[] jjtNodeName = { + "Stylesheet", + "Rule", + "Selectors", + "Selector", + "JavaClass", + "Id", + "Class", + "PseudoClass", + "AnimationProperties", + "AnimationProperty", + "Declaration", + "Property", + "Expression", + "JavaCode", + "Identifier", + }; +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/JJTCSSParserState.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/JJTCSSParserState.java index 4fd91e7..818cedb 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/JJTCSSParserState.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/JJTCSSParserState.java @@ -1,3 +1,4 @@ +/* Generated By:JJTree: Do not edit this line. .\JJTCSSParserState.java */ /* * *##% * JAXX Compiler @@ -18,126 +19,125 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JJTree: Do not edit this line. .\JJTCSSParserState.java */ - -package jaxx.compiler.css.parser; - -class JJTCSSParserState { - private java.util.Stack<Node> nodes; - private java.util.Stack<Integer> marks; - - private int sp; // number of nodes on stack - private int mk; // current mark - private boolean node_created; - - JJTCSSParserState() { - nodes = new java.util.Stack<Node>(); - marks = new java.util.Stack<Integer>(); - sp = 0; - mk = 0; - } - - /* Determines whether the current node was actually closed and - pushed. This should only be called in the final user action of a - node scope. */ - boolean nodeCreated() { - return node_created; - } - - /* Call this to reinitialize the node stack. It is called -automatically by the parser's ReInit() method. */ - void reset() { - nodes.removeAllElements(); - marks.removeAllElements(); - sp = 0; - mk = 0; - } - - /* Returns the root node of the AST. It only makes sense to call -this after a successful parse. */ - Node rootNode() { - return nodes.elementAt(0); - } - - /* Pushes a node on to the stack. */ - void pushNode(Node n) { - nodes.push(n); - ++sp; - } - - /* Returns the node on the top of the stack, and remove it from the - stack. */ - Node popNode() { - if (--sp < mk) { - mk = marks.pop(); - } - return nodes.pop(); - } - - /* Returns the node currently on the top of the stack. */ - Node peekNode() { - return nodes.peek(); - } - - /* Returns the number of children on the stack in the current node - scope. */ - int nodeArity() { - return sp - mk; - } - - - void clearNodeScope(Node n) { - while (sp > mk) { - popNode(); - } - mk = marks.pop(); - } - - - void openNodeScope(Node n) { - marks.push(mk); - mk = sp; - n.jjtOpen(); - } - - - /* A definite node is constructed from a specified number of -children. That number of nodes are popped from the stack and -made the children of the definite node. Then the definite node -is pushed on to the stack. */ - void closeNodeScope(Node n, int num) { - mk = marks.pop(); - while (num-- > 0) { - Node c = popNode(); - c.jjtSetParent(n); - n.jjtAddChild(c, num); - } - n.jjtClose(); - pushNode(n); - node_created = true; - } - - - /* A conditional node is constructed if its condition is true. All -the nodes that have been pushed since the node was opened are -made children of the the conditional node, which is then pushed -on to the stack. If the condition is false the node is not -constructed and they are left on the stack. */ - void closeNodeScope(Node n, boolean condition) { - if (condition) { - int a = nodeArity(); - mk = marks.pop(); - while (a-- > 0) { - Node c = popNode(); - c.jjtSetParent(n); - n.jjtAddChild(c, a); - } - n.jjtClose(); - pushNode(n); - node_created = true; - } else { - mk = marks.pop(); - node_created = false; - } - } -} + +package jaxx.compiler.css.parser; + +class JJTCSSParserState { + private java.util.Stack<Node> nodes; + private java.util.Stack<Integer> marks; + + private int sp; // number of nodes on stack + private int mk; // current mark + private boolean node_created; + + JJTCSSParserState() { + nodes = new java.util.Stack<Node>(); + marks = new java.util.Stack<Integer>(); + sp = 0; + mk = 0; + } + + /* Determines whether the current node was actually closed and + pushed. This should only be called in the final user action of a + node scope. */ + boolean nodeCreated() { + return node_created; + } + + /* Call this to reinitialize the node stack. It is called +automatically by the parser's ReInit() method. */ + void reset() { + nodes.removeAllElements(); + marks.removeAllElements(); + sp = 0; + mk = 0; + } + + /* Returns the root node of the AST. It only makes sense to call +this after a successful parse. */ + Node rootNode() { + return nodes.elementAt(0); + } + + /* Pushes a node on to the stack. */ + void pushNode(Node n) { + nodes.push(n); + ++sp; + } + + /* Returns the node on the top of the stack, and remove it from the + stack. */ + Node popNode() { + if (--sp < mk) { + mk = marks.pop(); + } + return nodes.pop(); + } + + /* Returns the node currently on the top of the stack. */ + Node peekNode() { + return nodes.peek(); + } + + /* Returns the number of children on the stack in the current node + scope. */ + int nodeArity() { + return sp - mk; + } + + + void clearNodeScope(Node n) { + while (sp > mk) { + popNode(); + } + mk = marks.pop(); + } + + + void openNodeScope(Node n) { + marks.push(mk); + mk = sp; + n.jjtOpen(); + } + + + /* A definite node is constructed from a specified number of +children. That number of nodes are popped from the stack and +made the children of the definite node. Then the definite node +is pushed on to the stack. */ + void closeNodeScope(Node n, int num) { + mk = marks.pop(); + while (num-- > 0) { + Node c = popNode(); + c.jjtSetParent(n); + n.jjtAddChild(c, num); + } + n.jjtClose(); + pushNode(n); + node_created = true; + } + + + /* A conditional node is constructed if its condition is true. All +the nodes that have been pushed since the node was opened are +made children of the the conditional node, which is then pushed +on to the stack. If the condition is false the node is not +constructed and they are left on the stack. */ + void closeNodeScope(Node n, boolean condition) { + if (condition) { + int a = nodeArity(); + mk = marks.pop(); + while (a-- > 0) { + Node c = popNode(); + c.jjtSetParent(n); + n.jjtAddChild(c, a); + } + n.jjtClose(); + pushNode(n); + node_created = true; + } else { + mk = marks.pop(); + node_created = false; + } + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Node.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Node.java index 50f84f4..fc46a25 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Node.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Node.java @@ -1,3 +1,4 @@ +/* Generated By:JJTree: Do not edit this line. Node.java */ /* * *##% * JAXX Compiler @@ -18,54 +19,53 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JJTree: Do not edit this line. Node.java */ - -package jaxx.compiler.css.parser; - -/* All AST nodes must implement this interface. It provides basic - machinery for constructing the parent and child relationships - between nodes. */ - -public interface Node { - - /** - * This method is called after the node has been made the current - * node. It indicates that child nodes can now be added to it. - */ - public void jjtOpen(); - - /** - * This method is called after all the child nodes have been - * added. - */ - public void jjtClose(); - - /** - * This pair of methods are used to inform the node of its - * parent. - * - * @param n node - */ - public void jjtSetParent(Node n); - - public Node jjtGetParent(); - - /** - * This method tells the node to add its argument to the node's - * list of children. - * - * @param n node - * @param i pos - */ - public void jjtAddChild(Node n, int i); - - /** - * @param i pos - * @return a child node. The children are numbered - * from zero, left to right. - */ - public Node jjtGetChild(int i); - - /** @return the number of children the node has. */ - public int jjtGetNumChildren(); -} + +package jaxx.compiler.css.parser; + +/* All AST nodes must implement this interface. It provides basic + machinery for constructing the parent and child relationships + between nodes. */ + +public interface Node { + + /** + * This method is called after the node has been made the current + * node. It indicates that child nodes can now be added to it. + */ + public void jjtOpen(); + + /** + * This method is called after all the child nodes have been + * added. + */ + public void jjtClose(); + + /** + * This pair of methods are used to inform the node of its + * parent. + * + * @param n node + */ + public void jjtSetParent(Node n); + + public Node jjtGetParent(); + + /** + * This method tells the node to add its argument to the node's + * list of children. + * + * @param n node + * @param i pos + */ + public void jjtAddChild(Node n, int i); + + /** + * @param i pos + * @return a child node. The children are numbered + * from zero, left to right. + */ + public Node jjtGetChild(int i); + + /** @return the number of children the node has. */ + public int jjtGetNumChildren(); +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/ParseException.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/ParseException.java index fe59f91..eff1967 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/ParseException.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/ParseException.java @@ -1,3 +1,4 @@ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */ /* * *##% * JAXX Compiler @@ -18,23 +19,22 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */ -package jaxx.compiler.css.parser; - -public class ParseException extends jaxx.compiler.java.parser.ParseException { - private static final long serialVersionUID = 229575674880359031L; - - public ParseException() { - super(); - } - - - public ParseException(String message) { - super(message); - } - - - public ParseException(String message, int line, int column) { - super(message, line, column); - } -} +package jaxx.compiler.css.parser; + +public class ParseException extends jaxx.compiler.java.parser.ParseException { + private static final long serialVersionUID = 229575674880359031L; + + public ParseException() { + super(); + } + + + public ParseException(String message) { + super(message); + } + + + public ParseException(String message, int line, int column) { + super(message, line, column); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleCharStream.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleCharStream.java index c3de8e5..fb60977 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleCharStream.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleCharStream.java @@ -1,3 +1,4 @@ +/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 4.0 */ /* * *##% * JAXX Compiler @@ -18,401 +19,400 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 4.0 */ -package jaxx.compiler.css.parser; - -/** - * An implementation of interface CharStream, where the stream is assumed to - * contain only ASCII characters (without unicode processing). - */ - -public class SimpleCharStream { - public static final boolean staticFlag = false; - int bufsize; - int available; - int tokenBegin; - public int bufpos = -1; - protected int bufline[]; - protected int bufcolumn[]; - - protected int column = 0; - protected int line = 1; - - protected boolean prevCharIsCR = false; - protected boolean prevCharIsLF = false; - - protected java.io.Reader inputStream; - - protected char[] buffer; - protected int maxNextCharInd = 0; - protected int inBuf = 0; - protected int tabSize = 8; - - protected void setTabSize(int i) { - tabSize = i; - } - - protected int getTabSize(int i) { - return tabSize; - } - - - protected void ExpandBuff(boolean wrapAround) { - char[] newbuffer = new char[bufsize + 2048]; - int newbufline[] = new int[bufsize + 2048]; - int newbufcolumn[] = new int[bufsize + 2048]; - - try { - if (wrapAround) { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - System.arraycopy(buffer, 0, newbuffer, - bufsize - tokenBegin, bufpos); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); - bufcolumn = newbufcolumn; - - maxNextCharInd = (bufpos += (bufsize - tokenBegin)); - } else { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - bufcolumn = newbufcolumn; - - maxNextCharInd = (bufpos -= tokenBegin); - } - } - catch (Throwable t) { - throw new Error(t.getMessage()); - } - - - bufsize += 2048; - available = bufsize; - tokenBegin = 0; - } - - protected void FillBuff() throws java.io.IOException { - if (maxNextCharInd == available) { - if (available == bufsize) { - if (tokenBegin > 2048) { - bufpos = maxNextCharInd = 0; - available = tokenBegin; - } else if (tokenBegin < 0) - bufpos = maxNextCharInd = 0; - else - ExpandBuff(false); - } else if (available > tokenBegin) - available = bufsize; - else if ((tokenBegin - available) < 2048) - ExpandBuff(true); - else - available = tokenBegin; - } - - int i; - try { - if ((i = inputStream.read(buffer, maxNextCharInd, - available - maxNextCharInd)) == -1) { - inputStream.close(); - throw new java.io.IOException(); - } else - maxNextCharInd += i; - } - catch (java.io.IOException e) { - --bufpos; - backup(0); - if (tokenBegin == -1) - tokenBegin = bufpos; - throw e; - } - } - - public char BeginToken() throws java.io.IOException { - tokenBegin = -1; - char c = readChar(); - tokenBegin = bufpos; - - return c; - } - - protected void UpdateLineColumn(char c) { - column++; - - if (prevCharIsLF) { - prevCharIsLF = false; - line += (column = 1); - } else if (prevCharIsCR) { - prevCharIsCR = false; - if (c == '\n') { - prevCharIsLF = true; - } else - line += (column = 1); - } - - switch (c) { - case '\r': - prevCharIsCR = true; - break; - case '\n': - prevCharIsLF = true; - break; - case '\t': - column--; - column += (tabSize - (column % tabSize)); - break; - default: - break; - } - - bufline[bufpos] = line; - bufcolumn[bufpos] = column; - } - - public char readChar() throws java.io.IOException { - if (inBuf > 0) { - --inBuf; - - if (++bufpos == bufsize) - bufpos = 0; - - return buffer[bufpos]; - } - - if (++bufpos >= maxNextCharInd) - FillBuff(); - - char c = buffer[bufpos]; - - UpdateLineColumn(c); - return (c); - } - - /** - * @return ??? - * @see #getEndColumn - * @deprecated - */ - - public int getColumn() { - return bufcolumn[bufpos]; - } - - /** - * @return ??? - * @see #getEndLine - * @deprecated - */ - - public int getLine() { - return bufline[bufpos]; - } - - public int getEndColumn() { - return bufcolumn[bufpos]; - } - - public int getEndLine() { - return bufline[bufpos]; - } - - public int getBeginColumn() { - return bufcolumn[tokenBegin]; - } - - public int getBeginLine() { - return bufline[tokenBegin]; - } - - public void backup(int amount) { - - inBuf += amount; - if ((bufpos -= amount) < 0) - bufpos += bufsize; - } - - public SimpleCharStream(java.io.Reader dstream, int startline, - int startcolumn, int buffersize) { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - } - - public SimpleCharStream(java.io.Reader dstream, int startline, - int startcolumn) { - this(dstream, startline, startcolumn, 4096); - } - - public SimpleCharStream(java.io.Reader dstream) { - this(dstream, 1, 1, 4096); - } - - public void ReInit(java.io.Reader dstream, int startline, - int startcolumn, int buffersize) { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - if (buffer == null || buffersize != buffer.length) { - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - } - prevCharIsLF = prevCharIsCR = false; - tokenBegin = inBuf = maxNextCharInd = 0; - bufpos = -1; - } - - public void ReInit(java.io.Reader dstream, int startline, - int startcolumn) { - ReInit(dstream, startline, startcolumn, 4096); - } - - public void ReInit(java.io.Reader dstream) { - ReInit(dstream, 1, 1, 4096); - } - - public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, - int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { - this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); - } - - public SimpleCharStream(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) { - this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); - } - - public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, - int startcolumn) throws java.io.UnsupportedEncodingException { - this(dstream, encoding, startline, startcolumn, 4096); - } - - public SimpleCharStream(java.io.InputStream dstream, int startline, - int startcolumn) { - this(dstream, startline, startcolumn, 4096); - } - - public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { - this(dstream, encoding, 1, 1, 4096); - } - - public SimpleCharStream(java.io.InputStream dstream) { - this(dstream, 1, 1, 4096); - } - - public void ReInit(java.io.InputStream dstream, String encoding, int startline, - int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { - ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); - } - - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) { - ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); - } - - public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { - ReInit(dstream, encoding, 1, 1, 4096); - } - - public void ReInit(java.io.InputStream dstream) { - ReInit(dstream, 1, 1, 4096); - } - - public void ReInit(java.io.InputStream dstream, String encoding, int startline, - int startcolumn) throws java.io.UnsupportedEncodingException { - ReInit(dstream, encoding, startline, startcolumn, 4096); - } - - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn) { - ReInit(dstream, startline, startcolumn, 4096); - } - - public String GetImage() { - if (bufpos >= tokenBegin) - return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); - else - return new String(buffer, tokenBegin, bufsize - tokenBegin) + - new String(buffer, 0, bufpos + 1); - } - - public char[] GetSuffix(int len) { - char[] ret = new char[len]; - - if ((bufpos + 1) >= len) - System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); - else { - System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, - len - bufpos - 1); - System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); - } - - return ret; - } - - public void Done() { - buffer = null; - bufline = null; - bufcolumn = null; - } - - /** - * Method to adjust line and column numbers for the start of a token. - * - * @param newLine ? - * @param newCol ? - */ - public void adjustBeginLineColumn(int newLine, int newCol) { - int start = tokenBegin; - int len; - - if (bufpos >= tokenBegin) { - len = bufpos - tokenBegin + inBuf + 1; - } else { - len = bufsize - tokenBegin + bufpos + 1 + inBuf; - } - - int i = 0, j = 0, k; - int nextColDiff, columnDiff = 0; - - while (i < len && - bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { - bufline[j] = newLine; - nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; - bufcolumn[j] = newCol + columnDiff; - columnDiff = nextColDiff; - i++; - } - - if (i < len) { - bufline[j] = newLine++; - bufcolumn[j] = newCol + columnDiff; - - while (i++ < len) { - if (bufline[j = start % bufsize] != bufline[++start % bufsize]) - bufline[j] = newLine++; - else - bufline[j] = newLine; - } - } - - line = bufline[j]; - column = bufcolumn[j]; - } - -} +package jaxx.compiler.css.parser; + +/** + * An implementation of interface CharStream, where the stream is assumed to + * contain only ASCII characters (without unicode processing). + */ + +public class SimpleCharStream { + public static final boolean staticFlag = false; + int bufsize; + int available; + int tokenBegin; + public int bufpos = -1; + protected int bufline[]; + protected int bufcolumn[]; + + protected int column = 0; + protected int line = 1; + + protected boolean prevCharIsCR = false; + protected boolean prevCharIsLF = false; + + protected java.io.Reader inputStream; + + protected char[] buffer; + protected int maxNextCharInd = 0; + protected int inBuf = 0; + protected int tabSize = 8; + + protected void setTabSize(int i) { + tabSize = i; + } + + protected int getTabSize(int i) { + return tabSize; + } + + + protected void ExpandBuff(boolean wrapAround) { + char[] newbuffer = new char[bufsize + 2048]; + int newbufline[] = new int[bufsize + 2048]; + int newbufcolumn[] = new int[bufsize + 2048]; + + try { + if (wrapAround) { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + System.arraycopy(buffer, 0, newbuffer, + bufsize - tokenBegin, bufpos); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); + bufcolumn = newbufcolumn; + + maxNextCharInd = (bufpos += (bufsize - tokenBegin)); + } else { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + bufcolumn = newbufcolumn; + + maxNextCharInd = (bufpos -= tokenBegin); + } + } + catch (Throwable t) { + throw new Error(t.getMessage()); + } + + + bufsize += 2048; + available = bufsize; + tokenBegin = 0; + } + + protected void FillBuff() throws java.io.IOException { + if (maxNextCharInd == available) { + if (available == bufsize) { + if (tokenBegin > 2048) { + bufpos = maxNextCharInd = 0; + available = tokenBegin; + } else if (tokenBegin < 0) + bufpos = maxNextCharInd = 0; + else + ExpandBuff(false); + } else if (available > tokenBegin) + available = bufsize; + else if ((tokenBegin - available) < 2048) + ExpandBuff(true); + else + available = tokenBegin; + } + + int i; + try { + if ((i = inputStream.read(buffer, maxNextCharInd, + available - maxNextCharInd)) == -1) { + inputStream.close(); + throw new java.io.IOException(); + } else + maxNextCharInd += i; + } + catch (java.io.IOException e) { + --bufpos; + backup(0); + if (tokenBegin == -1) + tokenBegin = bufpos; + throw e; + } + } + + public char BeginToken() throws java.io.IOException { + tokenBegin = -1; + char c = readChar(); + tokenBegin = bufpos; + + return c; + } + + protected void UpdateLineColumn(char c) { + column++; + + if (prevCharIsLF) { + prevCharIsLF = false; + line += (column = 1); + } else if (prevCharIsCR) { + prevCharIsCR = false; + if (c == '\n') { + prevCharIsLF = true; + } else + line += (column = 1); + } + + switch (c) { + case '\r': + prevCharIsCR = true; + break; + case '\n': + prevCharIsLF = true; + break; + case '\t': + column--; + column += (tabSize - (column % tabSize)); + break; + default: + break; + } + + bufline[bufpos] = line; + bufcolumn[bufpos] = column; + } + + public char readChar() throws java.io.IOException { + if (inBuf > 0) { + --inBuf; + + if (++bufpos == bufsize) + bufpos = 0; + + return buffer[bufpos]; + } + + if (++bufpos >= maxNextCharInd) + FillBuff(); + + char c = buffer[bufpos]; + + UpdateLineColumn(c); + return (c); + } + + /** + * @return ??? + * @see #getEndColumn + * @deprecated + */ + + public int getColumn() { + return bufcolumn[bufpos]; + } + + /** + * @return ??? + * @see #getEndLine + * @deprecated + */ + + public int getLine() { + return bufline[bufpos]; + } + + public int getEndColumn() { + return bufcolumn[bufpos]; + } + + public int getEndLine() { + return bufline[bufpos]; + } + + public int getBeginColumn() { + return bufcolumn[tokenBegin]; + } + + public int getBeginLine() { + return bufline[tokenBegin]; + } + + public void backup(int amount) { + + inBuf += amount; + if ((bufpos -= amount) < 0) + bufpos += bufsize; + } + + public SimpleCharStream(java.io.Reader dstream, int startline, + int startcolumn, int buffersize) { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + } + + public SimpleCharStream(java.io.Reader dstream, int startline, + int startcolumn) { + this(dstream, startline, startcolumn, 4096); + } + + public SimpleCharStream(java.io.Reader dstream) { + this(dstream, 1, 1, 4096); + } + + public void ReInit(java.io.Reader dstream, int startline, + int startcolumn, int buffersize) { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + if (buffer == null || buffersize != buffer.length) { + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + } + prevCharIsLF = prevCharIsCR = false; + tokenBegin = inBuf = maxNextCharInd = 0; + bufpos = -1; + } + + public void ReInit(java.io.Reader dstream, int startline, + int startcolumn) { + ReInit(dstream, startline, startcolumn, 4096); + } + + public void ReInit(java.io.Reader dstream) { + ReInit(dstream, 1, 1, 4096); + } + + public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { + this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + + public SimpleCharStream(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) { + this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); + } + + public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException { + this(dstream, encoding, startline, startcolumn, 4096); + } + + public SimpleCharStream(java.io.InputStream dstream, int startline, + int startcolumn) { + this(dstream, startline, startcolumn, 4096); + } + + public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { + this(dstream, encoding, 1, 1, 4096); + } + + public SimpleCharStream(java.io.InputStream dstream) { + this(dstream, 1, 1, 4096); + } + + public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { + ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + + public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) { + ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); + } + + public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { + ReInit(dstream, encoding, 1, 1, 4096); + } + + public void ReInit(java.io.InputStream dstream) { + ReInit(dstream, 1, 1, 4096); + } + + public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException { + ReInit(dstream, encoding, startline, startcolumn, 4096); + } + + public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn) { + ReInit(dstream, startline, startcolumn, 4096); + } + + public String GetImage() { + if (bufpos >= tokenBegin) + return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); + else + return new String(buffer, tokenBegin, bufsize - tokenBegin) + + new String(buffer, 0, bufpos + 1); + } + + public char[] GetSuffix(int len) { + char[] ret = new char[len]; + + if ((bufpos + 1) >= len) + System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); + else { + System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, + len - bufpos - 1); + System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); + } + + return ret; + } + + public void Done() { + buffer = null; + bufline = null; + bufcolumn = null; + } + + /** + * Method to adjust line and column numbers for the start of a token. + * + * @param newLine ? + * @param newCol ? + */ + public void adjustBeginLineColumn(int newLine, int newCol) { + int start = tokenBegin; + int len; + + if (bufpos >= tokenBegin) { + len = bufpos - tokenBegin + inBuf + 1; + } else { + len = bufsize - tokenBegin + bufpos + 1 + inBuf; + } + + int i = 0, j = 0, k; + int nextColDiff, columnDiff = 0; + + while (i < len && + bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { + bufline[j] = newLine; + nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; + bufcolumn[j] = newCol + columnDiff; + columnDiff = nextColDiff; + i++; + } + + if (i < len) { + bufline[j] = newLine++; + bufcolumn[j] = newCol + columnDiff; + + while (i++ < len) { + if (bufline[j = start % bufsize] != bufline[++start % bufsize]) + bufline[j] = newLine++; + else + bufline[j] = newLine; + } + } + + line = bufline[j]; + column = bufcolumn[j]; + } + +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleNode.java index ac63ff5..e679b38 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleNode.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/SimpleNode.java @@ -1,3 +1,4 @@ +/* Generated By:JJTree: Do not edit this line. SimpleNode.java */ /* * *##% * JAXX Compiler @@ -18,125 +19,124 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JJTree: Do not edit this line. SimpleNode.java */ - -package jaxx.compiler.css.parser; - -public class SimpleNode implements Node { - protected Node parent; - protected Node[] children; - protected int id; - protected CSSParser parser; - public Token firstToken; - public Token lastToken; - - - public SimpleNode(int i) { - id = i; - } - - public SimpleNode(CSSParser p, int i) { - this(i); - parser = p; - } - - - public int getId() { - return id; - } - - public void jjtOpen() { - } - - public void jjtClose() { - } - - public void jjtSetParent(Node n) { - parent = n; - } - - public Node jjtGetParent() { - return parent; - } - - public SimpleNode getParent() { - return (SimpleNode) parent; - } - - public void jjtAddChild(Node n, int i) { - if (children == null) { - children = new Node[i + 1]; - } else if (i >= children.length) { - Node c[] = new Node[i + 1]; - System.arraycopy(children, 0, c, 0, children.length); - children = c; - } - children[i] = n; - } - - public Node jjtGetChild(int i) { - return children[i]; - } - - public SimpleNode getChild(int i) { - return (SimpleNode) children[i]; - } - - public int jjtGetNumChildren() { - return (children == null) ? 0 : children.length; - } - - /* You can override these two methods in subclasses of SimpleNode to -customize the way the node appears when the tree is dumped. If -your output uses more than one line you should override -toString(String), otherwise overriding toString() is probably all -you need to do. */ - - @Override - public String toString() { - return getClass().getName() + "[" + getText() + "]"; - } - - public String toString(String prefix) { - return prefix + toString(); - } - - /* Override this method if you want to customize how the node dumps - out its children. */ - - public void dump(String prefix) { - System.out.println(toString(prefix)); - if (children != null) { - for (Node aChildren : children) { - SimpleNode n = (SimpleNode) aChildren; - if (n != null) { - n.dump(prefix + " "); - } - } - } - } - - private void appendSpecialTokens(StringBuffer s, Token st) { - if (st != null) { - appendSpecialTokens(s, st.specialToken); - s.append(st.image); - } - } - - - /** @return the text of the tokens comprising this node. */ - public String getText() { - StringBuffer text = new StringBuffer(); - Token t = firstToken; - while (t != null) { - appendSpecialTokens(text, t.specialToken); - text.append(t.image); - if (t == lastToken) - break; - t = t.next; - } - - return text.toString(); - } -} - + +package jaxx.compiler.css.parser; + +public class SimpleNode implements Node { + protected Node parent; + protected Node[] children; + protected int id; + protected CSSParser parser; + public Token firstToken; + public Token lastToken; + + + public SimpleNode(int i) { + id = i; + } + + public SimpleNode(CSSParser p, int i) { + this(i); + parser = p; + } + + + public int getId() { + return id; + } + + public void jjtOpen() { + } + + public void jjtClose() { + } + + public void jjtSetParent(Node n) { + parent = n; + } + + public Node jjtGetParent() { + return parent; + } + + public SimpleNode getParent() { + return (SimpleNode) parent; + } + + public void jjtAddChild(Node n, int i) { + if (children == null) { + children = new Node[i + 1]; + } else if (i >= children.length) { + Node c[] = new Node[i + 1]; + System.arraycopy(children, 0, c, 0, children.length); + children = c; + } + children[i] = n; + } + + public Node jjtGetChild(int i) { + return children[i]; + } + + public SimpleNode getChild(int i) { + return (SimpleNode) children[i]; + } + + public int jjtGetNumChildren() { + return (children == null) ? 0 : children.length; + } + + /* You can override these two methods in subclasses of SimpleNode to +customize the way the node appears when the tree is dumped. If +your output uses more than one line you should override +toString(String), otherwise overriding toString() is probably all +you need to do. */ + + @Override + public String toString() { + return getClass().getName() + "[" + getText() + "]"; + } + + public String toString(String prefix) { + return prefix + toString(); + } + + /* Override this method if you want to customize how the node dumps + out its children. */ + + public void dump(String prefix) { + System.out.println(toString(prefix)); + if (children != null) { + for (Node aChildren : children) { + SimpleNode n = (SimpleNode) aChildren; + if (n != null) { + n.dump(prefix + " "); + } + } + } + } + + private void appendSpecialTokens(StringBuffer s, Token st) { + if (st != null) { + appendSpecialTokens(s, st.specialToken); + s.append(st.image); + } + } + + + /** @return the text of the tokens comprising this node. */ + public String getText() { + StringBuffer text = new StringBuffer(); + Token t = firstToken; + while (t != null) { + appendSpecialTokens(text, t.specialToken); + text.append(t.image); + if (t == lastToken) + break; + t = t.next; + } + + return text.toString(); + } +} + diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Token.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Token.java index b545803..853b8ff 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Token.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/Token.java @@ -1,3 +1,4 @@ +/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */ /* * *##% * JAXX Compiler @@ -18,79 +19,78 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */ -package jaxx.compiler.css.parser; - -/** Describes the input token stream. */ - -public class Token { - - /** - * An integer that describes the kind of this token. This numbering - * system is determined by JavaCCParser, and a table of these numbers is - * stored in the file ...Constants.java. - */ - public int kind; - - /** - * beginLine and beginColumn describe the position of the first character - * of this token; endLine and endColumn describe the position of the - * last character of this token. - */ - public int beginLine, beginColumn, endLine, endColumn; - - /** The string image of the token. */ - public String image; - - /** - * A reference to the next regular (non-special) token from the input - * stream. If this is the last token from the input stream, or if the - * token manager has not read tokens beyond this one, this field is - * set to null. This is true only if this token is also a regular - * token. Otherwise, see below for a description of the contents of - * this field. - */ - public Token next; - - /** - * This field is used to access special tokens that occur prior to this - * token, but after the immediately preceding regular (non-special) token. - * If there are no such special tokens, this field is set to null. - * When there are more than one such special token, this field refers - * to the last of these special tokens, which in turn refers to the next - * previous special token through its specialToken field, and so on - * until the first special token (whose specialToken field is null). - * The next fields of special tokens refer to other special tokens that - * immediately follow it (without an intervening regular token). If there - * is no such token, this field is null. - */ - public Token specialToken; - - /** Returns the image. */ - public String toString() { - return image; - } - - /** - * Returns a new Token object, by default. However, if you want, you - * can create and return subclass objects based on the value of ofKind. - * Simply add the cases to the switch for all those special cases. - * For example, if you have a subclass of Token called IDToken that - * you want to create if ofKind is ID, simlpy add something like : - * <p/> - * case MyParserConstants.ID : return new IDToken(); - * <p/> - * to the following switch statement. Then you can cast matchedToken - * variable to the appropriate type and use it in your lexical actions. - * - * @param ofKind kind of token - * @return the new token - */ - public static Token newToken(int ofKind) { - switch (ofKind) { - default: - return new Token(); - } - } - -} +package jaxx.compiler.css.parser; + +/** Describes the input token stream. */ + +public class Token { + + /** + * An integer that describes the kind of this token. This numbering + * system is determined by JavaCCParser, and a table of these numbers is + * stored in the file ...Constants.java. + */ + public int kind; + + /** + * beginLine and beginColumn describe the position of the first character + * of this token; endLine and endColumn describe the position of the + * last character of this token. + */ + public int beginLine, beginColumn, endLine, endColumn; + + /** The string image of the token. */ + public String image; + + /** + * A reference to the next regular (non-special) token from the input + * stream. If this is the last token from the input stream, or if the + * token manager has not read tokens beyond this one, this field is + * set to null. This is true only if this token is also a regular + * token. Otherwise, see below for a description of the contents of + * this field. + */ + public Token next; + + /** + * This field is used to access special tokens that occur prior to this + * token, but after the immediately preceding regular (non-special) token. + * If there are no such special tokens, this field is set to null. + * When there are more than one such special token, this field refers + * to the last of these special tokens, which in turn refers to the next + * previous special token through its specialToken field, and so on + * until the first special token (whose specialToken field is null). + * The next fields of special tokens refer to other special tokens that + * immediately follow it (without an intervening regular token). If there + * is no such token, this field is null. + */ + public Token specialToken; + + /** Returns the image. */ + public String toString() { + return image; + } + + /** + * Returns a new Token object, by default. However, if you want, you + * can create and return subclass objects based on the value of ofKind. + * Simply add the cases to the switch for all those special cases. + * For example, if you have a subclass of Token called IDToken that + * you want to create if ofKind is ID, simlpy add something like : + * <p/> + * case MyParserConstants.ID : return new IDToken(); + * <p/> + * to the following switch statement. Then you can cast matchedToken + * variable to the appropriate type and use it in your lexical actions. + * + * @param ofKind kind of token + * @return the new token + */ + public static Token newToken(int ofKind) { + switch (ofKind) { + default: + return new Token(); + } + } + +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/TokenMgrError.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/TokenMgrError.java index 3d97676..cc2f095 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/TokenMgrError.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/parser/TokenMgrError.java @@ -1,3 +1,4 @@ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */ /* * *##% * JAXX Compiler @@ -18,129 +19,128 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */ -package jaxx.compiler.css.parser; - -public class TokenMgrError extends Error { - /* - * Ordinals for various reasons why an Error of this type can be thrown. - */ - - /** Lexical error occured. */ - static final int LEXICAL_ERROR = 0; - - /** An attempt wass made to create a second instance of a static token manager. */ - static final int STATIC_LEXER_ERROR = 1; - - /** Tried to change to an invalid lexical state. */ - static final int INVALID_LEXICAL_STATE = 2; - - /** Detected (and bailed out of) an infinite loop in the token manager. */ - static final int LOOP_DETECTED = 3; - - /** - * Indicates the reason why the exception is thrown. It will have - * one of the above 4 values. - */ - int errorCode; - private static final long serialVersionUID = -4308847190164230336L; - - /** - * Replaces unprintable characters by their espaced (or unicode escaped) - * equivalents in the given string - * - * @param str text to espace - * @return the espaced text - */ - protected static String addEscapes(String str) { - StringBuffer retval = new StringBuffer(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) { - case 0: - continue; - case '\b': - retval.append("\\b"); - continue; - case '\t': - retval.append("\\t"); - continue; - case '\n': - retval.append("\\n"); - continue; - case '\f': - retval.append("\\f"); - continue; - case '\r': - retval.append("\\r"); - continue; - case '\"': - retval.append("\\\""); - continue; - case '\'': - retval.append("\\\'"); - continue; - case '\\': - retval.append("\\\\"); - continue; - default: - if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { - String s = "0000" + Integer.toString(ch, 16); - retval.append("\\u").append(s.substring(s.length() - 4, s.length())); - } else { - retval.append(ch); - } - } - } - return retval.toString(); - } - - /** - * @param EOFSeen : indicates if EOF caused the lexicl error - * @param lexState : lexical state in which this error occured - * @param errorLine : line number when the error occured - * @param errorColumn : column number when the error occured - * @param errorAfter : prefix that was seen before this error occured - * @param curChar : the offending character - * Note: You can customize the lexical error message by modifying this method. - * @return a detailed message for the Error when it is thrown by the - * token manager to indicate a lexical error. - */ - protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { - return ("Lexical error at line " + - errorLine + ", column " + - errorColumn + ". Encountered: " + - (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int) curChar + "), ") + - "after : \"" + addEscapes(errorAfter) + "\""); - } - - /** - * You can also modify the body of this method to customize your error messages. - * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not - * of end-users concern, so you can return something like : - * <p/> - * "Internal Error : Please file a bug report .... " - * <p/> - * from this method for such cases in the release version of your parser. - */ - @Override - public String getMessage() { - return super.getMessage(); - } - - /* - * Constructors of various flavors follow. - */ - - public TokenMgrError() { - } - - public TokenMgrError(String message, int reason) { - super(message); - errorCode = reason; - } - - public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { - this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); - } -} +package jaxx.compiler.css.parser; + +public class TokenMgrError extends Error { + /* + * Ordinals for various reasons why an Error of this type can be thrown. + */ + + /** Lexical error occured. */ + static final int LEXICAL_ERROR = 0; + + /** An attempt wass made to create a second instance of a static token manager. */ + static final int STATIC_LEXER_ERROR = 1; + + /** Tried to change to an invalid lexical state. */ + static final int INVALID_LEXICAL_STATE = 2; + + /** Detected (and bailed out of) an infinite loop in the token manager. */ + static final int LOOP_DETECTED = 3; + + /** + * Indicates the reason why the exception is thrown. It will have + * one of the above 4 values. + */ + int errorCode; + private static final long serialVersionUID = -4308847190164230336L; + + /** + * Replaces unprintable characters by their espaced (or unicode escaped) + * equivalents in the given string + * + * @param str text to espace + * @return the espaced text + */ + protected static String addEscapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) { + case 0: + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u").append(s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + } + } + return retval.toString(); + } + + /** + * @param EOFSeen : indicates if EOF caused the lexicl error + * @param lexState : lexical state in which this error occured + * @param errorLine : line number when the error occured + * @param errorColumn : column number when the error occured + * @param errorAfter : prefix that was seen before this error occured + * @param curChar : the offending character + * Note: You can customize the lexical error message by modifying this method. + * @return a detailed message for the Error when it is thrown by the + * token manager to indicate a lexical error. + */ + protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { + return ("Lexical error at line " + + errorLine + ", column " + + errorColumn + ". Encountered: " + + (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int) curChar + "), ") + + "after : \"" + addEscapes(errorAfter) + "\""); + } + + /** + * You can also modify the body of this method to customize your error messages. + * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not + * of end-users concern, so you can return something like : + * <p/> + * "Internal Error : Please file a bug report .... " + * <p/> + * from this method for such cases in the release version of your parser. + */ + @Override + public String getMessage() { + return super.getMessage(); + } + + /* + * Constructors of various flavors follow. + */ + + public TokenMgrError() { + } + + public TokenMgrError(String message, int reason) { + super(message); + errorCode = reason; + } + + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { + this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JJTJavaParserState.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JJTJavaParserState.java index e35b0db..87caeb3 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JJTJavaParserState.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JJTJavaParserState.java @@ -1,3 +1,4 @@ +/* Generated By:JJTree: Do not edit this line. .\JJTJavaParserState.java */ /* * *##% * JAXX Compiler @@ -18,126 +19,125 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JJTree: Do not edit this line. .\JJTJavaParserState.java */ - -package jaxx.compiler.java.parser; - -class JJTJavaParserState { - private java.util.Stack<Node> nodes; - private java.util.Stack<Integer> marks; - - private int sp; // number of nodes on stack - private int mk; // current mark - private boolean node_created; - - JJTJavaParserState() { - nodes = new java.util.Stack<Node>(); - marks = new java.util.Stack<Integer>(); - sp = 0; - mk = 0; - } - - /* Determines whether the current node was actually closed and - pushed. This should only be called in the final user action of a - node scope. */ - boolean nodeCreated() { - return node_created; - } - - /* Call this to reinitialize the node stack. It is called -automatically by the parser's ReInit() method. */ - void reset() { - nodes.removeAllElements(); - marks.removeAllElements(); - sp = 0; - mk = 0; - } - - /* Returns the root node of the AST. It only makes sense to call -this after a successful parse. */ - Node rootNode() { - return nodes.elementAt(0); - } - - /* Pushes a node on to the stack. */ - void pushNode(Node n) { - nodes.push(n); - ++sp; - } - - /* Returns the node on the top of the stack, and remove it from the - stack. */ - Node popNode() { - if (--sp < mk) { - mk = marks.pop(); - } - return nodes.pop(); - } - - /* Returns the node currently on the top of the stack. */ - Node peekNode() { - return nodes.peek(); - } - - /* Returns the number of children on the stack in the current node - scope. */ - int nodeArity() { - return sp - mk; - } - - - void clearNodeScope(Node n) { - while (sp > mk) { - popNode(); - } - mk = marks.pop(); - } - - - void openNodeScope(Node n) { - marks.push(mk); - mk = sp; - n.jjtOpen(); - } - - - /* A definite node is constructed from a specified number of -children. That number of nodes are popped from the stack and -made the children of the definite node. Then the definite node -is pushed on to the stack. */ - void closeNodeScope(Node n, int num) { - mk = marks.pop(); - while (num-- > 0) { - Node c = popNode(); - c.jjtSetParent(n); - n.jjtAddChild(c, num); - } - n.jjtClose(); - pushNode(n); - node_created = true; - } - - - /* A conditional node is constructed if its condition is true. All -the nodes that have been pushed since the node was opened are -made children of the the conditional node, which is then pushed -on to the stack. If the condition is false the node is not -constructed and they are left on the stack. */ - void closeNodeScope(Node n, boolean condition) { - if (condition) { - int a = nodeArity(); - mk = marks.pop(); - while (a-- > 0) { - Node c = popNode(); - c.jjtSetParent(n); - n.jjtAddChild(c, a); - } - n.jjtClose(); - pushNode(n); - node_created = true; - } else { - mk = marks.pop(); - node_created = false; - } - } -} + +package jaxx.compiler.java.parser; + +class JJTJavaParserState { + private java.util.Stack<Node> nodes; + private java.util.Stack<Integer> marks; + + private int sp; // number of nodes on stack + private int mk; // current mark + private boolean node_created; + + JJTJavaParserState() { + nodes = new java.util.Stack<Node>(); + marks = new java.util.Stack<Integer>(); + sp = 0; + mk = 0; + } + + /* Determines whether the current node was actually closed and + pushed. This should only be called in the final user action of a + node scope. */ + boolean nodeCreated() { + return node_created; + } + + /* Call this to reinitialize the node stack. It is called +automatically by the parser's ReInit() method. */ + void reset() { + nodes.removeAllElements(); + marks.removeAllElements(); + sp = 0; + mk = 0; + } + + /* Returns the root node of the AST. It only makes sense to call +this after a successful parse. */ + Node rootNode() { + return nodes.elementAt(0); + } + + /* Pushes a node on to the stack. */ + void pushNode(Node n) { + nodes.push(n); + ++sp; + } + + /* Returns the node on the top of the stack, and remove it from the + stack. */ + Node popNode() { + if (--sp < mk) { + mk = marks.pop(); + } + return nodes.pop(); + } + + /* Returns the node currently on the top of the stack. */ + Node peekNode() { + return nodes.peek(); + } + + /* Returns the number of children on the stack in the current node + scope. */ + int nodeArity() { + return sp - mk; + } + + + void clearNodeScope(Node n) { + while (sp > mk) { + popNode(); + } + mk = marks.pop(); + } + + + void openNodeScope(Node n) { + marks.push(mk); + mk = sp; + n.jjtOpen(); + } + + + /* A definite node is constructed from a specified number of +children. That number of nodes are popped from the stack and +made the children of the definite node. Then the definite node +is pushed on to the stack. */ + void closeNodeScope(Node n, int num) { + mk = marks.pop(); + while (num-- > 0) { + Node c = popNode(); + c.jjtSetParent(n); + n.jjtAddChild(c, num); + } + n.jjtClose(); + pushNode(n); + node_created = true; + } + + + /* A conditional node is constructed if its condition is true. All +the nodes that have been pushed since the node was opened are +made children of the the conditional node, which is then pushed +on to the stack. If the condition is false the node is not +constructed and they are left on the stack. */ + void closeNodeScope(Node n, boolean condition) { + if (condition) { + int a = nodeArity(); + mk = marks.pop(); + while (a-- > 0) { + Node c = popNode(); + c.jjtSetParent(n); + n.jjtAddChild(c, a); + } + n.jjtClose(); + pushNode(n); + node_created = true; + } else { + mk = marks.pop(); + node_created = false; + } + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaCharStream.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaCharStream.java index b3e2ee3..65cff46 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaCharStream.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaCharStream.java @@ -1,3 +1,4 @@ +/* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 4.0 */ /* * *##% * JAXX Compiler @@ -18,533 +19,532 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JavaCC: Do not edit this line. JavaCharStream.java Version 4.0 */ -package jaxx.compiler.java.parser; - -/** - * An implementation of interface CharStream, where the stream is assumed to - * contain only ASCII characters (with java-like unicode escape processing). - */ - -public class JavaCharStream { - public static final boolean staticFlag = false; - - static int hexval(char c) throws java.io.IOException { - switch (c) { - case '0': - return 0; - case '1': - return 1; - case '2': - return 2; - case '3': - return 3; - case '4': - return 4; - case '5': - return 5; - case '6': - return 6; - case '7': - return 7; - case '8': - return 8; - case '9': - return 9; - - case 'a': - case 'A': - return 10; - case 'b': - case 'B': - return 11; - case 'c': - case 'C': - return 12; - case 'd': - case 'D': - return 13; - case 'e': - case 'E': - return 14; - case 'f': - case 'F': - return 15; - } - - throw new java.io.IOException(); // Should never come here - } - - public int bufpos = -1; - int bufsize; - int available; - int tokenBegin; - protected int bufline[]; - protected int bufcolumn[]; - - protected int column = 0; - protected int line = 1; - - protected boolean prevCharIsCR = false; - protected boolean prevCharIsLF = false; - - protected java.io.Reader inputStream; - - protected char[] nextCharBuf; - protected char[] buffer; - protected int maxNextCharInd = 0; - protected int nextCharInd = -1; - protected int inBuf = 0; - protected int tabSize = 8; - - protected void setTabSize(int i) { - tabSize = i; - } - - protected int getTabSize(int i) { - return tabSize; - } - - protected void ExpandBuff(boolean wrapAround) { - char[] newbuffer = new char[bufsize + 2048]; - int newbufline[] = new int[bufsize + 2048]; - int newbufcolumn[] = new int[bufsize + 2048]; - - try { - if (wrapAround) { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - System.arraycopy(buffer, 0, newbuffer, - bufsize - tokenBegin, bufpos); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); - bufcolumn = newbufcolumn; - - bufpos += (bufsize - tokenBegin); - } else { - System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); - buffer = newbuffer; - - System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); - bufline = newbufline; - - System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); - bufcolumn = newbufcolumn; - - bufpos -= tokenBegin; - } - } - catch (Throwable t) { - throw new Error(t.getMessage()); - } - - available = (bufsize += 2048); - tokenBegin = 0; - } - - protected void FillBuff() throws java.io.IOException { - int i; - if (maxNextCharInd == 4096) - maxNextCharInd = nextCharInd = 0; - - try { - if ((i = inputStream.read(nextCharBuf, maxNextCharInd, - 4096 - maxNextCharInd)) == -1) { - inputStream.close(); - throw new java.io.IOException(); - } else { - maxNextCharInd += i; - } - } - catch (java.io.IOException e) { - if (bufpos != 0) { - --bufpos; - backup(0); - } else { - bufline[bufpos] = line; - bufcolumn[bufpos] = column; - } - throw e; - } - } - - protected char ReadByte() throws java.io.IOException { - if (++nextCharInd >= maxNextCharInd) - FillBuff(); - - return nextCharBuf[nextCharInd]; - } - - public char BeginToken() throws java.io.IOException { - if (inBuf > 0) { - --inBuf; - - if (++bufpos == bufsize) { - bufpos = 0; - } - - tokenBegin = bufpos; - return buffer[bufpos]; - } - - tokenBegin = 0; - bufpos = -1; - - return readChar(); - } - - protected void AdjustBuffSize() { - if (available == bufsize) { - if (tokenBegin > 2048) { - bufpos = 0; - available = tokenBegin; - } else - ExpandBuff(false); - } else if (available > tokenBegin) - available = bufsize; - else if ((tokenBegin - available) < 2048) - ExpandBuff(true); - else - available = tokenBegin; - } - - protected void UpdateLineColumn(char c) { - column++; - - if (prevCharIsLF) { - prevCharIsLF = false; - line += (column = 1); - } else if (prevCharIsCR) { - prevCharIsCR = false; - if (c == '\n') { - prevCharIsLF = true; - } else - line += (column = 1); - } - - switch (c) { - case '\r': - prevCharIsCR = true; - break; - case '\n': - prevCharIsLF = true; - break; - case '\t': - column--; - column += (tabSize - (column % tabSize)); - break; - default: - break; - } - - bufline[bufpos] = line; - bufcolumn[bufpos] = column; - } - - public char readChar() throws java.io.IOException { - if (inBuf > 0) { - --inBuf; - - if (++bufpos == bufsize) - bufpos = 0; - - return buffer[bufpos]; - } - - char c; - - if (++bufpos == available) - AdjustBuffSize(); - - if ((buffer[bufpos] = c = ReadByte()) == '\\') { - UpdateLineColumn(c); - - int backSlashCnt = 1; - - for (; ;) // Read all the backslashes - { - if (++bufpos == available) - AdjustBuffSize(); - - try { - if ((buffer[bufpos] = c = ReadByte()) != '\\') { - UpdateLineColumn(c); - // found a non-backslash char. - if ((c == 'u') && ((backSlashCnt & 1) == 1)) { - if (--bufpos < 0) - bufpos = bufsize - 1; - - break; - } - - backup(backSlashCnt); - return '\\'; - } - } - catch (java.io.IOException e) { - if (backSlashCnt > 1) - backup(backSlashCnt); - - return '\\'; - } - - UpdateLineColumn(c); - backSlashCnt++; - } - - // Here, we have seen an odd number of backslash's followed by a 'u' - try { - while ((c = ReadByte()) == 'u') - ++column; - - buffer[bufpos] = c = (char) (hexval(c) << 12 | - hexval(ReadByte()) << 8 | - hexval(ReadByte()) << 4 | - hexval(ReadByte())); - - column += 4; - } - catch (java.io.IOException e) { - throw new Error("Invalid escape character at line " + line + - " column " + column + "."); - } - - if (backSlashCnt == 1) - return c; - else { - backup(backSlashCnt - 1); - return '\\'; - } - } else { - UpdateLineColumn(c); - return (c); - } - } - - /** - * @return column index - * @see #getEndColumn - * @deprecated - */ - - public int getColumn() { - return bufcolumn[bufpos]; - } - - /** - * @return line type ??? - * @see #getEndLine - * @deprecated - */ - - public int getLine() { - return bufline[bufpos]; - } - - public int getEndColumn() { - return bufcolumn[bufpos]; - } - - public int getEndLine() { - return bufline[bufpos]; - } - - public int getBeginColumn() { - return bufcolumn[tokenBegin]; - } - - public int getBeginLine() { - return bufline[tokenBegin]; - } - - public void backup(int amount) { - - inBuf += amount; - if ((bufpos -= amount) < 0) - bufpos += bufsize; - } - - public JavaCharStream(java.io.Reader dstream, - int startline, int startcolumn, int buffersize) { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - nextCharBuf = new char[4096]; - } - - public JavaCharStream(java.io.Reader dstream, - int startline, int startcolumn) { - this(dstream, startline, startcolumn, 4096); - } - - public JavaCharStream(java.io.Reader dstream) { - this(dstream, 1, 1, 4096); - } - - public void ReInit(java.io.Reader dstream, - int startline, int startcolumn, int buffersize) { - inputStream = dstream; - line = startline; - column = startcolumn - 1; - - if (buffer == null || buffersize != buffer.length) { - available = bufsize = buffersize; - buffer = new char[buffersize]; - bufline = new int[buffersize]; - bufcolumn = new int[buffersize]; - nextCharBuf = new char[4096]; - } - prevCharIsLF = prevCharIsCR = false; - tokenBegin = inBuf = maxNextCharInd = 0; - nextCharInd = bufpos = -1; - } - - public void ReInit(java.io.Reader dstream, - int startline, int startcolumn) { - ReInit(dstream, startline, startcolumn, 4096); - } - - public void ReInit(java.io.Reader dstream) { - ReInit(dstream, 1, 1, 4096); - } - - public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, - int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { - this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); - } - - public JavaCharStream(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) { - this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); - } - - public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, - int startcolumn) throws java.io.UnsupportedEncodingException { - this(dstream, encoding, startline, startcolumn, 4096); - } - - public JavaCharStream(java.io.InputStream dstream, int startline, - int startcolumn) { - this(dstream, startline, startcolumn, 4096); - } - - public JavaCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { - this(dstream, encoding, 1, 1, 4096); - } - - public JavaCharStream(java.io.InputStream dstream) { - this(dstream, 1, 1, 4096); - } - - public void ReInit(java.io.InputStream dstream, String encoding, int startline, - int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { - ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); - } - - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn, int buffersize) { - ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); - } - - public void ReInit(java.io.InputStream dstream, String encoding, int startline, - int startcolumn) throws java.io.UnsupportedEncodingException { - ReInit(dstream, encoding, startline, startcolumn, 4096); - } - - public void ReInit(java.io.InputStream dstream, int startline, - int startcolumn) { - ReInit(dstream, startline, startcolumn, 4096); - } - - public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { - ReInit(dstream, encoding, 1, 1, 4096); - } - - public void ReInit(java.io.InputStream dstream) { - ReInit(dstream, 1, 1, 4096); - } - - public String GetImage() { - if (bufpos >= tokenBegin) - return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); - else - return new String(buffer, tokenBegin, bufsize - tokenBegin) + - new String(buffer, 0, bufpos + 1); - } - - public char[] GetSuffix(int len) { - char[] ret = new char[len]; - - if ((bufpos + 1) >= len) - System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); - else { - System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, - len - bufpos - 1); - System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); - } - - return ret; - } - - public void Done() { - nextCharBuf = null; - buffer = null; - bufline = null; - bufcolumn = null; - } - - /** - * Method to adjust line and column numbers for the start of a token. - * - * @param newLine line number ? - * @param newCol column number ? - */ - public void adjustBeginLineColumn(int newLine, int newCol) { - int start = tokenBegin; - int len; - - if (bufpos >= tokenBegin) { - len = bufpos - tokenBegin + inBuf + 1; - } else { - len = bufsize - tokenBegin + bufpos + 1 + inBuf; - } - - int i = 0, j = 0, k; - int nextColDiff, columnDiff = 0; - - while (i < len && - bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { - bufline[j] = newLine; - nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; - bufcolumn[j] = newCol + columnDiff; - columnDiff = nextColDiff; - i++; - } - - if (i < len) { - bufline[j] = newLine++; - bufcolumn[j] = newCol + columnDiff; - - while (i++ < len) { - if (bufline[j = start % bufsize] != bufline[++start % bufsize]) - bufline[j] = newLine++; - else - bufline[j] = newLine; - } - } - - line = bufline[j]; - column = bufcolumn[j]; - } - -} +package jaxx.compiler.java.parser; + +/** + * An implementation of interface CharStream, where the stream is assumed to + * contain only ASCII characters (with java-like unicode escape processing). + */ + +public class JavaCharStream { + public static final boolean staticFlag = false; + + static int hexval(char c) throws java.io.IOException { + switch (c) { + case '0': + return 0; + case '1': + return 1; + case '2': + return 2; + case '3': + return 3; + case '4': + return 4; + case '5': + return 5; + case '6': + return 6; + case '7': + return 7; + case '8': + return 8; + case '9': + return 9; + + case 'a': + case 'A': + return 10; + case 'b': + case 'B': + return 11; + case 'c': + case 'C': + return 12; + case 'd': + case 'D': + return 13; + case 'e': + case 'E': + return 14; + case 'f': + case 'F': + return 15; + } + + throw new java.io.IOException(); // Should never come here + } + + public int bufpos = -1; + int bufsize; + int available; + int tokenBegin; + protected int bufline[]; + protected int bufcolumn[]; + + protected int column = 0; + protected int line = 1; + + protected boolean prevCharIsCR = false; + protected boolean prevCharIsLF = false; + + protected java.io.Reader inputStream; + + protected char[] nextCharBuf; + protected char[] buffer; + protected int maxNextCharInd = 0; + protected int nextCharInd = -1; + protected int inBuf = 0; + protected int tabSize = 8; + + protected void setTabSize(int i) { + tabSize = i; + } + + protected int getTabSize(int i) { + return tabSize; + } + + protected void ExpandBuff(boolean wrapAround) { + char[] newbuffer = new char[bufsize + 2048]; + int newbufline[] = new int[bufsize + 2048]; + int newbufcolumn[] = new int[bufsize + 2048]; + + try { + if (wrapAround) { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + System.arraycopy(buffer, 0, newbuffer, + bufsize - tokenBegin, bufpos); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); + bufcolumn = newbufcolumn; + + bufpos += (bufsize - tokenBegin); + } else { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + bufcolumn = newbufcolumn; + + bufpos -= tokenBegin; + } + } + catch (Throwable t) { + throw new Error(t.getMessage()); + } + + available = (bufsize += 2048); + tokenBegin = 0; + } + + protected void FillBuff() throws java.io.IOException { + int i; + if (maxNextCharInd == 4096) + maxNextCharInd = nextCharInd = 0; + + try { + if ((i = inputStream.read(nextCharBuf, maxNextCharInd, + 4096 - maxNextCharInd)) == -1) { + inputStream.close(); + throw new java.io.IOException(); + } else { + maxNextCharInd += i; + } + } + catch (java.io.IOException e) { + if (bufpos != 0) { + --bufpos; + backup(0); + } else { + bufline[bufpos] = line; + bufcolumn[bufpos] = column; + } + throw e; + } + } + + protected char ReadByte() throws java.io.IOException { + if (++nextCharInd >= maxNextCharInd) + FillBuff(); + + return nextCharBuf[nextCharInd]; + } + + public char BeginToken() throws java.io.IOException { + if (inBuf > 0) { + --inBuf; + + if (++bufpos == bufsize) { + bufpos = 0; + } + + tokenBegin = bufpos; + return buffer[bufpos]; + } + + tokenBegin = 0; + bufpos = -1; + + return readChar(); + } + + protected void AdjustBuffSize() { + if (available == bufsize) { + if (tokenBegin > 2048) { + bufpos = 0; + available = tokenBegin; + } else + ExpandBuff(false); + } else if (available > tokenBegin) + available = bufsize; + else if ((tokenBegin - available) < 2048) + ExpandBuff(true); + else + available = tokenBegin; + } + + protected void UpdateLineColumn(char c) { + column++; + + if (prevCharIsLF) { + prevCharIsLF = false; + line += (column = 1); + } else if (prevCharIsCR) { + prevCharIsCR = false; + if (c == '\n') { + prevCharIsLF = true; + } else + line += (column = 1); + } + + switch (c) { + case '\r': + prevCharIsCR = true; + break; + case '\n': + prevCharIsLF = true; + break; + case '\t': + column--; + column += (tabSize - (column % tabSize)); + break; + default: + break; + } + + bufline[bufpos] = line; + bufcolumn[bufpos] = column; + } + + public char readChar() throws java.io.IOException { + if (inBuf > 0) { + --inBuf; + + if (++bufpos == bufsize) + bufpos = 0; + + return buffer[bufpos]; + } + + char c; + + if (++bufpos == available) + AdjustBuffSize(); + + if ((buffer[bufpos] = c = ReadByte()) == '\\') { + UpdateLineColumn(c); + + int backSlashCnt = 1; + + for (; ;) // Read all the backslashes + { + if (++bufpos == available) + AdjustBuffSize(); + + try { + if ((buffer[bufpos] = c = ReadByte()) != '\\') { + UpdateLineColumn(c); + // found a non-backslash char. + if ((c == 'u') && ((backSlashCnt & 1) == 1)) { + if (--bufpos < 0) + bufpos = bufsize - 1; + + break; + } + + backup(backSlashCnt); + return '\\'; + } + } + catch (java.io.IOException e) { + if (backSlashCnt > 1) + backup(backSlashCnt); + + return '\\'; + } + + UpdateLineColumn(c); + backSlashCnt++; + } + + // Here, we have seen an odd number of backslash's followed by a 'u' + try { + while ((c = ReadByte()) == 'u') + ++column; + + buffer[bufpos] = c = (char) (hexval(c) << 12 | + hexval(ReadByte()) << 8 | + hexval(ReadByte()) << 4 | + hexval(ReadByte())); + + column += 4; + } + catch (java.io.IOException e) { + throw new Error("Invalid escape character at line " + line + + " column " + column + "."); + } + + if (backSlashCnt == 1) + return c; + else { + backup(backSlashCnt - 1); + return '\\'; + } + } else { + UpdateLineColumn(c); + return (c); + } + } + + /** + * @return column index + * @see #getEndColumn + * @deprecated + */ + + public int getColumn() { + return bufcolumn[bufpos]; + } + + /** + * @return line type ??? + * @see #getEndLine + * @deprecated + */ + + public int getLine() { + return bufline[bufpos]; + } + + public int getEndColumn() { + return bufcolumn[bufpos]; + } + + public int getEndLine() { + return bufline[bufpos]; + } + + public int getBeginColumn() { + return bufcolumn[tokenBegin]; + } + + public int getBeginLine() { + return bufline[tokenBegin]; + } + + public void backup(int amount) { + + inBuf += amount; + if ((bufpos -= amount) < 0) + bufpos += bufsize; + } + + public JavaCharStream(java.io.Reader dstream, + int startline, int startcolumn, int buffersize) { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + nextCharBuf = new char[4096]; + } + + public JavaCharStream(java.io.Reader dstream, + int startline, int startcolumn) { + this(dstream, startline, startcolumn, 4096); + } + + public JavaCharStream(java.io.Reader dstream) { + this(dstream, 1, 1, 4096); + } + + public void ReInit(java.io.Reader dstream, + int startline, int startcolumn, int buffersize) { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + if (buffer == null || buffersize != buffer.length) { + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + nextCharBuf = new char[4096]; + } + prevCharIsLF = prevCharIsCR = false; + tokenBegin = inBuf = maxNextCharInd = 0; + nextCharInd = bufpos = -1; + } + + public void ReInit(java.io.Reader dstream, + int startline, int startcolumn) { + ReInit(dstream, startline, startcolumn, 4096); + } + + public void ReInit(java.io.Reader dstream) { + ReInit(dstream, 1, 1, 4096); + } + + public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { + this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + + public JavaCharStream(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) { + this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); + } + + public JavaCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException { + this(dstream, encoding, startline, startcolumn, 4096); + } + + public JavaCharStream(java.io.InputStream dstream, int startline, + int startcolumn) { + this(dstream, startline, startcolumn, 4096); + } + + public JavaCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { + this(dstream, encoding, 1, 1, 4096); + } + + public JavaCharStream(java.io.InputStream dstream) { + this(dstream, 1, 1, 4096); + } + + public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { + ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + + public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) { + ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); + } + + public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException { + ReInit(dstream, encoding, startline, startcolumn, 4096); + } + + public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn) { + ReInit(dstream, startline, startcolumn, 4096); + } + + public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { + ReInit(dstream, encoding, 1, 1, 4096); + } + + public void ReInit(java.io.InputStream dstream) { + ReInit(dstream, 1, 1, 4096); + } + + public String GetImage() { + if (bufpos >= tokenBegin) + return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); + else + return new String(buffer, tokenBegin, bufsize - tokenBegin) + + new String(buffer, 0, bufpos + 1); + } + + public char[] GetSuffix(int len) { + char[] ret = new char[len]; + + if ((bufpos + 1) >= len) + System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); + else { + System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, + len - bufpos - 1); + System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); + } + + return ret; + } + + public void Done() { + nextCharBuf = null; + buffer = null; + bufline = null; + bufcolumn = null; + } + + /** + * Method to adjust line and column numbers for the start of a token. + * + * @param newLine line number ? + * @param newCol column number ? + */ + public void adjustBeginLineColumn(int newLine, int newCol) { + int start = tokenBegin; + int len; + + if (bufpos >= tokenBegin) { + len = bufpos - tokenBegin + inBuf + 1; + } else { + len = bufsize - tokenBegin + bufpos + 1 + inBuf; + } + + int i = 0, j = 0, k; + int nextColDiff, columnDiff = 0; + + while (i < len && + bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { + bufline[j] = newLine; + nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; + bufcolumn[j] = newCol + columnDiff; + columnDiff = nextColDiff; + i++; + } + + if (i < len) { + bufline[j] = newLine++; + bufcolumn[j] = newCol + columnDiff; + + while (i++ < len) { + if (bufline[j = start % bufsize] != bufline[++start % bufsize]) + bufline[j] = newLine++; + else + bufline[j] = newLine; + } + } + + line = bufline[j]; + column = bufcolumn[j]; + } + +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java index 6a192d3..e8f3ca9 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParser.java @@ -1,3 +1,4 @@ +/* Generated By:JJTree&JavaCC: Do not edit this line. JavaParser.java */ /* * *##% * JAXX Compiler @@ -18,7 +19,6 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JJTree&JavaCC: Do not edit this line. JavaParser.java */ package jaxx.compiler.java.parser; import java.io.File; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserConstants.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserConstants.java index b553206..1686ded 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserConstants.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserConstants.java @@ -1,3 +1,4 @@ +/* Generated By:JJTree&JavaCC: Do not edit this line. JavaParserConstants.java */ /* * *##% * JAXX Compiler @@ -18,7 +19,6 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JJTree&JavaCC: Do not edit this line. JavaParserConstants.java */ package jaxx.compiler.java.parser; public interface JavaParserConstants { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTokenManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTokenManager.java index bc1f22d..fa8a8b1 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTokenManager.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTokenManager.java @@ -1,3 +1,4 @@ +/* Generated By:JJTree&JavaCC: Do not edit this line. JavaParserTokenManager.java */ /* * *##% * JAXX Compiler @@ -18,7 +19,6 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JJTree&JavaCC: Do not edit this line. JavaParserTokenManager.java */ package jaxx.compiler.java.parser; public class JavaParserTokenManager implements JavaParserConstants { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTreeConstants.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTreeConstants.java index 2526e36..66212f5 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTreeConstants.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/JavaParserTreeConstants.java @@ -1,3 +1,4 @@ +/* Generated By:JJTree: Do not edit this line. ./JavaParserTreeConstants.java */ /* * *##% * JAXX Compiler @@ -18,7 +19,6 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JJTree: Do not edit this line. ./JavaParserTreeConstants.java */ package jaxx.compiler.java.parser; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Node.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Node.java index 61a5e49..f6d7b0c 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Node.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Node.java @@ -1,3 +1,4 @@ +/* Generated By:JJTree: Do not edit this line. Node.java */ /* * *##% * JAXX Compiler @@ -18,54 +19,53 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JJTree: Do not edit this line. Node.java */ - -package jaxx.compiler.java.parser; - -/* All AST nodes must implement this interface. It provides basic - machinery for constructing the parent and child relationships - between nodes. */ - -public interface Node { - - /** - * This method is called after the node has been made the current - * node. It indicates that child nodes can now be added to it. - */ - public void jjtOpen(); - - /** - * This method is called after all the child nodes have been - * added. - */ - public void jjtClose(); - - /** - * This pair of methods are used to inform the node of its - * parent. - * - * @param n node - */ - public void jjtSetParent(Node n); - - public Node jjtGetParent(); - - /** - * This method tells the node to add its argument to the node's - * list of children. - * - * @param n node - * @param i index ? - */ - public void jjtAddChild(Node n, int i); - - /** - * @param i index of child - * @return a child node. The children are numbered - * from zero, left to right. - */ - public Node jjtGetChild(int i); - - /** @return the number of children the node has. */ - public int jjtGetNumChildren(); -} + +package jaxx.compiler.java.parser; + +/* All AST nodes must implement this interface. It provides basic + machinery for constructing the parent and child relationships + between nodes. */ + +public interface Node { + + /** + * This method is called after the node has been made the current + * node. It indicates that child nodes can now be added to it. + */ + public void jjtOpen(); + + /** + * This method is called after all the child nodes have been + * added. + */ + public void jjtClose(); + + /** + * This pair of methods are used to inform the node of its + * parent. + * + * @param n node + */ + public void jjtSetParent(Node n); + + public Node jjtGetParent(); + + /** + * This method tells the node to add its argument to the node's + * list of children. + * + * @param n node + * @param i index ? + */ + public void jjtAddChild(Node n, int i); + + /** + * @param i index of child + * @return a child node. The children are numbered + * from zero, left to right. + */ + public Node jjtGetChild(int i); + + /** @return the number of children the node has. */ + public int jjtGetNumChildren(); +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/ParseException.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/ParseException.java index 467227e..ebf44b1 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/ParseException.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/ParseException.java @@ -1,3 +1,4 @@ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */ /* * *##% * JAXX Compiler @@ -18,217 +19,216 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */ -package jaxx.compiler.java.parser; - -/** - * This exception is thrown when parse errors are encountered. - * You can explicitly create objects of this exception type by - * calling the method generateParseException in the generated - * parser. - * <p/> - * You can modify this class to customize your error reporting - * mechanisms so long as you retain the public fields. - */ -public class ParseException extends jaxx.compiler.CompilerException { - int line; - int column; - private static final long serialVersionUID = 6179854408401024700L; - - /** - * This constructor is used by the method "generateParseException" - * in the generated parser. Calling this constructor generates - * a new object of this type with the fields "currentToken", - * "expectedTokenSequences", and "tokenImage" set. The boolean - * flag "specialConstructor" is also set to true to indicate that - * this constructor was used to create this object. - * This constructor calls its super class with the empty string - * to force the "toString" method of parent class "Throwable" to - * print the error message in the form: - * ParseException: <result of getMessage> - * - * @param currentTokenVal ? - * @param expectedTokenSequencesVal ? - * @param tokenImageVal ? - */ - public ParseException(Token currentTokenVal, - int[][] expectedTokenSequencesVal, - String[] tokenImageVal - ) { - super(""); - specialConstructor = true; - currentToken = currentTokenVal; - expectedTokenSequences = expectedTokenSequencesVal; - tokenImage = tokenImageVal; - } - - /** - * The following constructors are for use by you for whatever - * purpose you can think of. Constructing the exception in this - * manner makes the exception behave in the normal way - i.e., as - * documented in the class "Throwable". The fields "errorToken", - * "expectedTokenSequences", and "tokenImage" do not contain - * relevant information. The JavaCC generated code does not use - * these constructors. - */ - - public ParseException() { - super(); - specialConstructor = false; - } - - public ParseException(String message) { - super(message); - specialConstructor = false; - } - - public ParseException(String message, int line, int column) { - super(message); - specialConstructor = false; - this.line = line; - this.column = column; - } - - - /** - * This variable determines which constructor was used to create - * this object and thereby affects the semantics of the - * "getMessage" method (see below). - */ - protected boolean specialConstructor; - - /** - * This is the last token that has been consumed successfully. If - * this object has been created due to a parse error, the token - * followng this token will (therefore) be the first error token. - */ - public Token currentToken; - - /** - * Each entry in this array is an array of integers. Each array - * of integers represents a sequence of tokens (by their ordinal - * values) that is expected at this point of the parse. - */ - public int[][] expectedTokenSequences; - - /** - * This is a reference to the "tokenImage" array of the generated - * parser within which the parse error occurred. This array is - * defined in the generated ...Constants interface. - */ - public String[] tokenImage; - - /** - * This method has the standard behavior when this object has been - * created using the standard constructors. Otherwise, it uses - * "currentToken" and "expectedTokenSequences" to generate a parse - * error message and returns it. If this object has been created - * due to a parse error, and you do not catch it (it gets thrown - * from the parser), then this method is called during the printing - * of the final stack trace, and hence the correct error message - * gets displayed. - */ - public String getMessage() { - if (!specialConstructor) { - return super.getMessage(); - } - StringBuffer expected = new StringBuffer(); - int maxSize = 0; - for (int[] expectedTokenSequence : expectedTokenSequences) { - if (maxSize < expectedTokenSequence.length) { - maxSize = expectedTokenSequence.length; - } - for (int anExpectedTokenSequence : expectedTokenSequence) { - expected.append(tokenImage[anExpectedTokenSequence]).append(" "); - } - if (expectedTokenSequence[expectedTokenSequence.length - 1] != 0) { - expected.append("..."); - } - expected.append(eol).append(" "); - } - String retval = "Encountered \""; - Token tok = currentToken.next; - for (int i = 0; i < maxSize; i++) { - if (i != 0) retval += " "; - if (tok.kind == 0) { - retval += tokenImage[0]; - break; - } - retval += add_escapes(tok.image); - tok = tok.next; - } - retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; - retval += "." + eol; - if (expectedTokenSequences.length == 1) { - retval += "Was expecting:" + eol + " "; - } else { - retval += "Was expecting one of:" + eol + " "; - } - retval += expected.toString(); - return retval; - } - - - public int getLine() { - return line; - } - - public int getColumn() { - return column; - } - - /** The end of line string for this machine. */ - protected String eol = System.getProperty("line.separator", "\n"); - - /** - * Used to convert raw characters to their escaped version - * when these raw version cannot be used as part of an ASCII - * string literal. - * - * @param str text to treate - * @return the escaped version of text - */ - protected String add_escapes(String str) { - StringBuffer retval = new StringBuffer(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) { - case 0: - continue; - case '\b': - retval.append("\\b"); - continue; - case '\t': - retval.append("\\t"); - continue; - case '\n': - retval.append("\\n"); - continue; - case '\f': - retval.append("\\f"); - continue; - case '\r': - retval.append("\\r"); - continue; - case '\"': - retval.append("\\\""); - continue; - case '\'': - retval.append("\\\'"); - continue; - case '\\': - retval.append("\\\\"); - continue; - default: - if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { - String s = "0000" + Integer.toString(ch, 16); - retval.append("\\u").append(s.substring(s.length() - 4, s.length())); - } else { - retval.append(ch); - } - } - } - return retval.toString(); - } - -} +package jaxx.compiler.java.parser; + +/** + * This exception is thrown when parse errors are encountered. + * You can explicitly create objects of this exception type by + * calling the method generateParseException in the generated + * parser. + * <p/> + * You can modify this class to customize your error reporting + * mechanisms so long as you retain the public fields. + */ +public class ParseException extends jaxx.compiler.CompilerException { + int line; + int column; + private static final long serialVersionUID = 6179854408401024700L; + + /** + * This constructor is used by the method "generateParseException" + * in the generated parser. Calling this constructor generates + * a new object of this type with the fields "currentToken", + * "expectedTokenSequences", and "tokenImage" set. The boolean + * flag "specialConstructor" is also set to true to indicate that + * this constructor was used to create this object. + * This constructor calls its super class with the empty string + * to force the "toString" method of parent class "Throwable" to + * print the error message in the form: + * ParseException: <result of getMessage> + * + * @param currentTokenVal ? + * @param expectedTokenSequencesVal ? + * @param tokenImageVal ? + */ + public ParseException(Token currentTokenVal, + int[][] expectedTokenSequencesVal, + String[] tokenImageVal + ) { + super(""); + specialConstructor = true; + currentToken = currentTokenVal; + expectedTokenSequences = expectedTokenSequencesVal; + tokenImage = tokenImageVal; + } + + /** + * The following constructors are for use by you for whatever + * purpose you can think of. Constructing the exception in this + * manner makes the exception behave in the normal way - i.e., as + * documented in the class "Throwable". The fields "errorToken", + * "expectedTokenSequences", and "tokenImage" do not contain + * relevant information. The JavaCC generated code does not use + * these constructors. + */ + + public ParseException() { + super(); + specialConstructor = false; + } + + public ParseException(String message) { + super(message); + specialConstructor = false; + } + + public ParseException(String message, int line, int column) { + super(message); + specialConstructor = false; + this.line = line; + this.column = column; + } + + + /** + * This variable determines which constructor was used to create + * this object and thereby affects the semantics of the + * "getMessage" method (see below). + */ + protected boolean specialConstructor; + + /** + * This is the last token that has been consumed successfully. If + * this object has been created due to a parse error, the token + * followng this token will (therefore) be the first error token. + */ + public Token currentToken; + + /** + * Each entry in this array is an array of integers. Each array + * of integers represents a sequence of tokens (by their ordinal + * values) that is expected at this point of the parse. + */ + public int[][] expectedTokenSequences; + + /** + * This is a reference to the "tokenImage" array of the generated + * parser within which the parse error occurred. This array is + * defined in the generated ...Constants interface. + */ + public String[] tokenImage; + + /** + * This method has the standard behavior when this object has been + * created using the standard constructors. Otherwise, it uses + * "currentToken" and "expectedTokenSequences" to generate a parse + * error message and returns it. If this object has been created + * due to a parse error, and you do not catch it (it gets thrown + * from the parser), then this method is called during the printing + * of the final stack trace, and hence the correct error message + * gets displayed. + */ + public String getMessage() { + if (!specialConstructor) { + return super.getMessage(); + } + StringBuffer expected = new StringBuffer(); + int maxSize = 0; + for (int[] expectedTokenSequence : expectedTokenSequences) { + if (maxSize < expectedTokenSequence.length) { + maxSize = expectedTokenSequence.length; + } + for (int anExpectedTokenSequence : expectedTokenSequence) { + expected.append(tokenImage[anExpectedTokenSequence]).append(" "); + } + if (expectedTokenSequence[expectedTokenSequence.length - 1] != 0) { + expected.append("..."); + } + expected.append(eol).append(" "); + } + String retval = "Encountered \""; + Token tok = currentToken.next; + for (int i = 0; i < maxSize; i++) { + if (i != 0) retval += " "; + if (tok.kind == 0) { + retval += tokenImage[0]; + break; + } + retval += add_escapes(tok.image); + tok = tok.next; + } + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; + retval += "." + eol; + if (expectedTokenSequences.length == 1) { + retval += "Was expecting:" + eol + " "; + } else { + retval += "Was expecting one of:" + eol + " "; + } + retval += expected.toString(); + return retval; + } + + + public int getLine() { + return line; + } + + public int getColumn() { + return column; + } + + /** The end of line string for this machine. */ + protected String eol = System.getProperty("line.separator", "\n"); + + /** + * Used to convert raw characters to their escaped version + * when these raw version cannot be used as part of an ASCII + * string literal. + * + * @param str text to treate + * @return the escaped version of text + */ + protected String add_escapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) { + case 0: + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u").append(s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + } + } + return retval.toString(); + } + +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/SimpleNode.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/SimpleNode.java index f8ed971..3be95bd 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/SimpleNode.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/SimpleNode.java @@ -1,3 +1,4 @@ +/* Generated By:JJTree: Do not edit this line. SimpleNode.java */ /* * *##% * JAXX Compiler @@ -18,138 +19,137 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JJTree: Do not edit this line. SimpleNode.java */ - -package jaxx.compiler.java.parser; - -import jaxx.compiler.reflect.ClassDescriptor; - -public class SimpleNode implements Node { - protected Node parent; - protected Node[] children; - protected int id; - protected JavaParser parser; - public Token firstToken; - public Token lastToken; - private ClassDescriptor javaType; - - - public SimpleNode(int i) { - id = i; - } - - public SimpleNode(JavaParser p, int i) { - this(i); - parser = p; - } - - - public int getId() { - return id; - } - - public void jjtOpen() { - } - - public void jjtClose() { - } - - public void jjtSetParent(Node n) { - parent = n; - } - - public Node jjtGetParent() { - return parent; - } - - public SimpleNode getParent() { - return (SimpleNode) parent; - } - - - public ClassDescriptor getJavaType() { - return javaType; - } - - - public void setJavaType(ClassDescriptor javaType) { - this.javaType = javaType; - } - - public void jjtAddChild(Node n, int i) { - if (children == null) { - children = new Node[i + 1]; - } else if (i >= children.length) { - Node c[] = new Node[i + 1]; - System.arraycopy(children, 0, c, 0, children.length); - children = c; - } - children[i] = n; - } - - public Node jjtGetChild(int i) { - return children[i]; - } - - public SimpleNode getChild(int i) { - return (SimpleNode) children[i]; - } - - public int jjtGetNumChildren() { - return (children == null) ? 0 : children.length; - } - - /* You can override these two methods in subclasses of SimpleNode to -customize the way the node appears when the tree is dumped. If -your output uses more than one line you should override -toString(String), otherwise overriding toString() is probably all -you need to do. */ - - @Override - public String toString() { - return getClass().getName() + "[" + getText() + "]"; - } - - public String toString(String prefix) { - return prefix + toString(); - } - - /* Override this method if you want to customize how the node dumps - out its children. */ - - public void dump(String prefix) { - System.out.println(toString(prefix)); - if (children != null) { - for (Node aChildren : children) { - SimpleNode n = (SimpleNode) aChildren; - if (n != null) { - n.dump(prefix + " "); - } - } - } - } - - private void appendSpecialTokens(StringBuffer s, Token st) { - if (st != null) { - appendSpecialTokens(s, st.specialToken); - s.append(st.image); - } - } - - - /** @return the text of the tokens comprising this node. */ - public String getText() { - StringBuffer text = new StringBuffer(); - Token t = firstToken; - while (t != null) { - appendSpecialTokens(text, t.specialToken); - text.append(t.image); - if (t == lastToken) - break; - t = t.next; - } - - return text.toString(); - } -} - + +package jaxx.compiler.java.parser; + +import jaxx.compiler.reflect.ClassDescriptor; + +public class SimpleNode implements Node { + protected Node parent; + protected Node[] children; + protected int id; + protected JavaParser parser; + public Token firstToken; + public Token lastToken; + private ClassDescriptor javaType; + + + public SimpleNode(int i) { + id = i; + } + + public SimpleNode(JavaParser p, int i) { + this(i); + parser = p; + } + + + public int getId() { + return id; + } + + public void jjtOpen() { + } + + public void jjtClose() { + } + + public void jjtSetParent(Node n) { + parent = n; + } + + public Node jjtGetParent() { + return parent; + } + + public SimpleNode getParent() { + return (SimpleNode) parent; + } + + + public ClassDescriptor getJavaType() { + return javaType; + } + + + public void setJavaType(ClassDescriptor javaType) { + this.javaType = javaType; + } + + public void jjtAddChild(Node n, int i) { + if (children == null) { + children = new Node[i + 1]; + } else if (i >= children.length) { + Node c[] = new Node[i + 1]; + System.arraycopy(children, 0, c, 0, children.length); + children = c; + } + children[i] = n; + } + + public Node jjtGetChild(int i) { + return children[i]; + } + + public SimpleNode getChild(int i) { + return (SimpleNode) children[i]; + } + + public int jjtGetNumChildren() { + return (children == null) ? 0 : children.length; + } + + /* You can override these two methods in subclasses of SimpleNode to +customize the way the node appears when the tree is dumped. If +your output uses more than one line you should override +toString(String), otherwise overriding toString() is probably all +you need to do. */ + + @Override + public String toString() { + return getClass().getName() + "[" + getText() + "]"; + } + + public String toString(String prefix) { + return prefix + toString(); + } + + /* Override this method if you want to customize how the node dumps + out its children. */ + + public void dump(String prefix) { + System.out.println(toString(prefix)); + if (children != null) { + for (Node aChildren : children) { + SimpleNode n = (SimpleNode) aChildren; + if (n != null) { + n.dump(prefix + " "); + } + } + } + } + + private void appendSpecialTokens(StringBuffer s, Token st) { + if (st != null) { + appendSpecialTokens(s, st.specialToken); + s.append(st.image); + } + } + + + /** @return the text of the tokens comprising this node. */ + public String getText() { + StringBuffer text = new StringBuffer(); + Token t = firstToken; + while (t != null) { + appendSpecialTokens(text, t.specialToken); + text.append(t.image); + if (t == lastToken) + break; + t = t.next; + } + + return text.toString(); + } +} + diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Token.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Token.java index 4cfce10..71d467c 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Token.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/Token.java @@ -1,3 +1,4 @@ +/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */ /* * *##% * JAXX Compiler @@ -18,7 +19,6 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */ package jaxx.compiler.java.parser; /** Describes the input token stream. */ diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/TokenMgrError.java b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/TokenMgrError.java index 7b0546d..2abbc2b 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/TokenMgrError.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/java/parser/TokenMgrError.java @@ -1,3 +1,4 @@ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */ /* * *##% * JAXX Compiler @@ -18,129 +19,128 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */ -package jaxx.compiler.java.parser; - -public class TokenMgrError extends Error { - /* - * Ordinals for various reasons why an Error of this type can be thrown. - */ - - /** Lexical error occured. */ - static final int LEXICAL_ERROR = 0; - - /** An attempt wass made to create a second instance of a static token manager. */ - static final int STATIC_LEXER_ERROR = 1; - - /** Tried to change to an invalid lexical state. */ - static final int INVALID_LEXICAL_STATE = 2; - - /** Detected (and bailed out of) an infinite loop in the token manager. */ - static final int LOOP_DETECTED = 3; - - /** - * Indicates the reason why the exception is thrown. It will have - * one of the above 4 values. - */ - int errorCode; - private static final long serialVersionUID = -9131500865453532454L; - - /** - * Replaces unprintable characters by their espaced (or unicode escaped) - * equivalents in the given string - * - * @param str text to treate - * @return the treated text - */ - protected static String addEscapes(String str) { - StringBuffer retval = new StringBuffer(); - char ch; - for (int i = 0; i < str.length(); i++) { - switch (str.charAt(i)) { - case 0: - continue; - case '\b': - retval.append("\\b"); - continue; - case '\t': - retval.append("\\t"); - continue; - case '\n': - retval.append("\\n"); - continue; - case '\f': - retval.append("\\f"); - continue; - case '\r': - retval.append("\\r"); - continue; - case '\"': - retval.append("\\\""); - continue; - case '\'': - retval.append("\\\'"); - continue; - case '\\': - retval.append("\\\\"); - continue; - default: - if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { - String s = "0000" + Integer.toString(ch, 16); - retval.append("\\u").append(s.substring(s.length() - 4, s.length())); - } else { - retval.append(ch); - } - } - } - return retval.toString(); - } - - /** - * @param EOFSeen : indicates if EOF caused the lexicl error - * @param lexState : lexical state in which this error occured - * @param errorLine : line number when the error occured - * @param errorColumn : column number when the error occured - * @param errorAfter : prefix that was seen before this error occured - * @param curChar : the offending character - * Note: You can customize the lexical error message by modifying this method. - * @return a detailed message for the Error when it is thrown by the - * token manager to indicate a lexical error. - */ - protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { - return ("Lexical error at line " + - errorLine + ", column " + - errorColumn + ". Encountered: " + - (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int) curChar + "), ") + - "after : \"" + addEscapes(errorAfter) + "\""); - } - - /** - * You can also modify the body of this method to customize your error messages. - * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not - * of end-users concern, so you can return something like : - * <p/> - * "Internal Error : Please file a bug report .... " - * <p/> - * from this method for such cases in the release version of your parser. - */ - @Override - public String getMessage() { - return super.getMessage(); - } - - /* - * Constructors of various flavors follow. - */ - - public TokenMgrError() { - } - - public TokenMgrError(String message, int reason) { - super(message); - errorCode = reason; - } - - public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { - this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); - } -} +package jaxx.compiler.java.parser; + +public class TokenMgrError extends Error { + /* + * Ordinals for various reasons why an Error of this type can be thrown. + */ + + /** Lexical error occured. */ + static final int LEXICAL_ERROR = 0; + + /** An attempt wass made to create a second instance of a static token manager. */ + static final int STATIC_LEXER_ERROR = 1; + + /** Tried to change to an invalid lexical state. */ + static final int INVALID_LEXICAL_STATE = 2; + + /** Detected (and bailed out of) an infinite loop in the token manager. */ + static final int LOOP_DETECTED = 3; + + /** + * Indicates the reason why the exception is thrown. It will have + * one of the above 4 values. + */ + int errorCode; + private static final long serialVersionUID = -9131500865453532454L; + + /** + * Replaces unprintable characters by their espaced (or unicode escaped) + * equivalents in the given string + * + * @param str text to treate + * @return the treated text + */ + protected static String addEscapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) { + case 0: + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u").append(s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + } + } + return retval.toString(); + } + + /** + * @param EOFSeen : indicates if EOF caused the lexicl error + * @param lexState : lexical state in which this error occured + * @param errorLine : line number when the error occured + * @param errorColumn : column number when the error occured + * @param errorAfter : prefix that was seen before this error occured + * @param curChar : the offending character + * Note: You can customize the lexical error message by modifying this method. + * @return a detailed message for the Error when it is thrown by the + * token manager to indicate a lexical error. + */ + protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { + return ("Lexical error at line " + + errorLine + ", column " + + errorColumn + ". Encountered: " + + (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int) curChar + "), ") + + "after : \"" + addEscapes(errorAfter) + "\""); + } + + /** + * You can also modify the body of this method to customize your error messages. + * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not + * of end-users concern, so you can return something like : + * <p/> + * "Internal Error : Please file a bug report .... " + * <p/> + * from this method for such cases in the release version of your parser. + */ + @Override + public String getMessage() { + return super.getMessage(); + } + + /* + * Constructors of various flavors follow. + */ + + public TokenMgrError() { + } + + public TokenMgrError(String message, int reason) { + super(message); + errorCode = reason; + } + + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { + this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + } +} -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 00068020f877dc881ed42d1d01a61f9440677db8 Author: Tony Chemit <chemit@codelutin.com> Date: Tue Oct 27 10:46:23 2009 +0000 in Util.initContext add a entry in ui context when parentContext is a JAXXOBbject (it will make possible to walk into UI ancestor without using the getParentContainer method --- jaxx-runtime/src/main/java/jaxx/runtime/Util.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/Util.java b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java index d3ddceb..7358266 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/Util.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java @@ -54,6 +54,7 @@ public class Util { * Logger */ static private final Log log = LogFactory.getLog(Util.class); + public static final String PARENT = "parent"; // Maps root objects to lists of event listeners private static Map<Object, WeakReference<List<EventListenerDescriptor>>> eventListeners = new WeakHashMap<Object, WeakReference<List<EventListenerDescriptor>>>(); private static Map<JAXXObject, WeakReference<List<DataBindingUpdateListener>>> dataBindingUpdateListeners = new WeakHashMap<JAXXObject, WeakReference<List<DataBindingUpdateListener>>>(); @@ -121,17 +122,15 @@ public class Util { public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef(String name) { Class<List<O>> castList = Util.<O>castList(); - JAXXContextEntryDef<List<O>> contextEntryDef = new JAXXContextEntryDef<List<O>>(name,castList); + JAXXContextEntryDef<List<O>> contextEntryDef = new JAXXContextEntryDef<List<O>>(name, castList); return contextEntryDef; } - @SuppressWarnings({"unchecked"}) protected static <O> Class<List<O>> castList() { return (Class<List<O>>) Collections.emptyList().getClass(); } - /** * Method to initialize the context of a ui. * @@ -145,6 +144,11 @@ public class Util { } else { ui.setContextValue(parentContext); } + // if parentContext is a JAXXObject then + // add an special parent entry to can go up + if (parentContext instanceof JAXXObject) { + ui.setContextValue(parentContext, PARENT); + } } public static Object getEventListener(Class<? extends EventListener> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) { -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit c71ec82f3031a32f51a660be4bc2b2a4870a6fc0 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 28 07:18:13 2009 +0000 - Evolution #105: permettre l'initialisation des objets sans JavaBean - Evolution #100: amélioration du design du compilateur - Evolution #99: Améliorer le code généré --- .../main/java/jaxx/compiler/CompiledObject.java | 12 + .../src/main/java/jaxx/compiler/JAXXCompiler.java | 44 +- .../src/main/java/jaxx/compiler/JAXXEngine.java | 4 +- .../java/jaxx/compiler/binding/DataBinding.java | 137 +++++ .../java/jaxx/compiler/binding/DataSource.java | 596 +++++++++++++++++++++ .../java/jaxx/compiler/css/StylesheetHelper.java | 2 + .../decorators/DefaultCompiledObjectDecorator.java | 2 + .../HelpRootCompiledObjectDecorator.java | 30 +- .../jaxx/compiler/finalizers/DefaultFinalizer.java | 86 +-- .../jaxx/compiler/tags/DefaultObjectHandler.java | 43 +- 10 files changed, 872 insertions(+), 84 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java index bb1b04a..a956e01 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java @@ -117,6 +117,10 @@ public class CompiledObject { * client properties */ private Map<String, String> clientProperties; + /** + * initializer of the object + */ + private String initializer; public class ChildRef { @@ -426,6 +430,14 @@ public class CompiledObject { this.constructorParams = constructorParams; } + public String getInitializer() { + return initializer; + } + + public void setInitializer(String initializer) { + this.initializer = initializer; + } + /** * Returns the code that performs basic initialization of this object, * after it has already been constructed. diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java index 2c5e870..bcde6ef 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java @@ -20,6 +20,7 @@ */ package jaxx.compiler; +import jaxx.compiler.binding.DataBinding; import jaxx.compiler.css.StylesheetHelper; import jaxx.compiler.script.ScriptManager; import jaxx.compiler.java.JavaMethod; @@ -632,18 +633,20 @@ public class JAXXCompiler { expression.append(escapeJavaString(stringValue.substring(lastPos, pos))); expression.append('"'); } - - if (expression.length() > 0) { + boolean multi = expression.length() > 0; + if (multi) { expression.append(" + "); + expression.append('('); } - expression.append('('); int pos2 = getNextRightBrace(stringValue, pos + 1); if (pos2 == -1) { reportError("unmatched '{' in expression: " + stringValue); return ""; } expression.append(stringValue.substring(pos + 1, pos2)); - expression.append(')'); + if (multi) { + expression.append(')'); + } pos2++; if (pos2 < stringValue.length()) { pos = getNextLeftBrace(stringValue, pos2); @@ -661,7 +664,12 @@ public class JAXXCompiler { expression.append(escapeJavaString(stringValue.substring(lastPos))); expression.append('"'); } - return type == ClassDescriptorLoader.getClassDescriptor(String.class) ? "String.valueOf(" + expression + ")" : expression.toString(); + //TC-20091027 : developper must write extact databinding + // the fact of adding the String boxed for String type binding is not + // a good thing, since it add one more call to process in binding + // and add nothing special more ? +// return type == ClassDescriptorLoader.getClassDescriptor(String.class) ? "String.valueOf(" + expression + ")" : expression.toString(); + return expression.toString(); } return null; } @@ -1307,10 +1315,22 @@ public class JAXXCompiler { } public String getAutoId(ClassDescriptor objectClass) { + String name = objectClass.getName(); + name = name.substring(name.lastIndexOf(".") + 1); + return getAutoId(name); +// if (configuration.getOptimize()) { +// return "$" + Integer.toString(autogenID++, 36); +// } else { +// String name = objectClass.getName(); +// name = name.substring(name.lastIndexOf(".") + 1); +// return "$" + name + autogenID++; +// } + } + + public String getAutoId(String name) { if (configuration.getOptimize()) { return "$" + Integer.toString(autogenID++, 36); } else { - String name = objectClass.getName(); name = name.substring(name.lastIndexOf(".") + 1); return "$" + name + autogenID++; } @@ -1368,26 +1388,26 @@ public class JAXXCompiler { return javaFile; } - public void finalizeCompilers(Iterable<JAXXCompilerFinalizer> generatorIterator) throws Exception { + public void finalizeCompiler(Iterable<JAXXCompilerFinalizer> finalizers) throws Exception { int dotPos = getOutputClassName().lastIndexOf("."); String packageName = dotPos != -1 ? getOutputClassName().substring(0, dotPos) : null; String simpleClassName = getOutputClassName().substring(dotPos + 1); CompiledObject compiledObject = getRootObject(); - for (JAXXCompilerFinalizer generator : generatorIterator) { - generator.finalizeCompiler(compiledObject, this, javaFile, packageName, simpleClassName); + for (JAXXCompilerFinalizer finalizer : finalizers) { + finalizer.finalizeCompiler(compiledObject, this, javaFile, packageName, simpleClassName); } for (CompiledObject object : getObjects().values()) { object.finalizeCompiler(this); } - for (JAXXCompilerFinalizer generator : generatorIterator) { - generator.prepareJavaFile(compiledObject, this, javaFile, packageName, simpleClassName); + for (JAXXCompilerFinalizer finalizer : finalizers) { + finalizer.prepareJavaFile(compiledObject, this, javaFile, packageName, simpleClassName); } } - public void generate(JavaFileGenerator generator, Iterable<JAXXCompilerFinalizer> generatorIterator) throws IOException { + public void generate(JavaFileGenerator generator) throws IOException { File dest; if (getConfiguration().getTargetDirectory() != null) { dest = new File(getConfiguration().getTargetDirectory(), getOutputClassName().replace('.', File.separatorChar) + ".java"); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java index 70f137b..dc5c331 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java @@ -365,7 +365,7 @@ public class JAXXEngine { for (String className : engine.jaxxFileClassNames) { JAXXCompiler compiler = engine.getCompiler(className, "Internal error: could not find compiler for " + className + " during code generation"); addStartProfileTime(engine, compiler); - compiler.finalizeCompilers(engine.finalizers); + compiler.finalizeCompiler(engine.finalizers); addEndProfileTime(engine, compiler); if (compiler.isFailed()) { success = false; @@ -387,7 +387,7 @@ public class JAXXEngine { for (String className : engine.jaxxFileClassNames) { JAXXCompiler compiler = engine.getCompiler(className, "Internal error: could not find compiler for " + className + " during code generation"); addStartProfileTime(engine, compiler); - compiler.generate(generator, engine.finalizers); + compiler.generate(generator); addEndProfileTime(engine, compiler); if (compiler.isFailed()) { success = false; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataBinding.java b/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataBinding.java new file mode 100644 index 0000000..7d7f064 --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataBinding.java @@ -0,0 +1,137 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.binding; + +import jaxx.compiler.CompilerException; +import jaxx.compiler.JAXXCompiler; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Represents a data binding in a JAXX file. <code>DataBinding</code> uses + * {@link DataSource} to track changes to a source expression and update + * the destination. + */ +public class DataBinding { + + /** + * Logger + */ + protected static final Log log = LogFactory.getLog(DataBinding.class); + /** + * Id of the data binding + */ + private String id; + /** + * source of the data binding + */ + private String source; + /** + * A Java snippet which will cause the destination property to be updated with the current value of + * the binding. + */ + private String assignment; + + /** + * Creates a new data binding. + * + * @param source the Java source code for the data binding expression + * @param id the data binding destination in the form <code><id>.<propertyName></code> + * @param assignment Java snippet which will cause the destination property to be updated with the current value of the binding + */ + public DataBinding(String source, String id, String assignment) { + this.id = id; + this.source = source; + this.assignment = assignment; + if (log.isDebugEnabled()) { + log.debug("id=" + id + " assignement=" + assignment + " source=" + source); + } + } + + public String getId() { + return id; + } + + /** + * Compiles the data binding expression. This method calls methods in + * <code>JAXXCompiler</code> to add the Java code that performs the data + * binding setup. + * + * @param compiler compiler which includes the data binding + * @param quickNoDependencies true to optimize bindings with no dependencies by simply running them at startup time + * @return {@code true} if the expression has dependencies, {@code false} otherwise + * @throws CompilerException if a compilation error occurs + */ + public boolean compile(JAXXCompiler compiler, boolean quickNoDependencies) throws CompilerException { + + DataSource dataSource = new DataSource(id, source, compiler); + + // handles all of the listener additions + //TC-20091026 use 'this' instead of root object javaCode +// boolean result = dataSource.compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + compiler.getJavaCode(id) + ")"); + boolean result = dataSource.compile("new jaxx.runtime.DataBindingListener(this, " + compiler.getJavaCode(id) + ")"); + if (log.isDebugEnabled()) { + log.debug(id + " isBinding ? " + result); + } + String eol = JAXXCompiler.getLineSeparator(); + if (!result && quickNoDependencies) { + // layout is specially handled early in the chain + if (!id.endsWith(".layout")) { + compiler.appendInitDataBindings(assignment + eol); + } + return false; // no dependencies, just a static expression + } + + StringBuilder buffer = new StringBuilder(); + if (compiler.hasProcessDataBinding()) { + buffer.append(" else "); +// compiler.appendProcessDataBinding(" else "); + } else { + buffer.append(" "); +// compiler.appendProcessDataBinding(" "); + } + buffer.append("if (" + compiler.getJavaCode(id) + ".equals($dest)) {" + eol); +// compiler.appendProcessDataBinding("if (" + compiler.getJavaCode(id) + ".equals($dest)) {" + eol); + String objectCode = dataSource.getObjectCode(); + if (log.isDebugEnabled()) { + log.debug(id + " objectCode= " + objectCode); + } + //TC-20091026 no need to test objectCode not null if on root object +// boolean needTest = objectCode != null; + boolean needTest = objectCode != null && !compiler.getRootObject().getId().equals(objectCode); + if (needTest) { + buffer.append(" if (" + objectCode + " != null) {" + eol); + buffer.append(" "); +// compiler.appendProcessDataBinding(" if (" + objectCode + " != null) {" + eol); +// compiler.appendProcessDataBinding(" "); + } + buffer.append(" " + assignment.trim()); +// compiler.appendProcessDataBinding(" " + assignment.trim()); + if (needTest) { + buffer.append(eol + " }"); +// compiler.appendProcessDataBinding(eol + " }"); + } + buffer.append(eol + " }"); +// compiler.appendProcessDataBinding(eol + " }"); + compiler.appendProcessDataBinding(buffer.toString()); + return true; + } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java b/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java new file mode 100644 index 0000000..2f1dfae --- /dev/null +++ b/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java @@ -0,0 +1,596 @@ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.compiler.binding; + +import jaxx.compiler.CompiledObject; +import jaxx.compiler.CompilerException; +import jaxx.compiler.JAXXCompiler; +import jaxx.compiler.UnsupportedAttributeException; +import jaxx.compiler.java.JavaField; +import jaxx.compiler.java.parser.JavaParser; +import jaxx.compiler.java.parser.JavaParserConstants; +import jaxx.compiler.java.parser.JavaParserTreeConstants; +import jaxx.compiler.java.parser.SimpleNode; +import jaxx.compiler.reflect.ClassDescriptor; +import jaxx.compiler.reflect.ClassDescriptorLoader; +import jaxx.compiler.reflect.FieldDescriptor; +import jaxx.compiler.reflect.MethodDescriptor; +import jaxx.compiler.tags.DefaultObjectHandler; +import jaxx.compiler.tags.TagManager; +import jaxx.compiler.types.TypeManager; + +import java.beans.Introspector; +import java.beans.PropertyChangeListener; +import java.io.StringReader; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Represents a Java expression which fires a <code>PropertyChangeEvent</code> when it can be + * determined that its value may have changed. Events are fired on a "best effort" basis, and events + * may either be fired too often (the value has not actually changed) or not often enough (the value + * changed but no event was fired). + */ +public class DataSource { + + /** + * Logger + */ + protected static final Log log = LogFactory.getLog(DataSource.class); + + /** + * type attached to "null" constants in parsed expressions + */ + private class NULL { + } + /** + * id of data source + */ + private String id; + /** + * The Java source code for the expression. + */ + private String source; + /** + * The current <code>JAXXCompiler</code>. + */ + private JAXXCompiler compiler; + /** + * List of symbols which this data source expression depends on. + */ + private List<String> dependencySymbols = new ArrayList<String>(); + /** + * + */ + private StringBuffer addListenerCode = new StringBuffer(); + /** + * + */ + private StringBuffer removeListenerCode = new StringBuffer(); + /** + * + */ + private boolean compiled; + /** + * the delegate of property to be required + */ + private String objectCode; + /** + * the data source id + */ + private String listenerId; + + /** + * Creates a new data source. After creating a <code>DataSource</code>, use {@link #compile} + * to cause it to function at runtime. + * + * @param id the DataSource's id + * @param source the Java source code for the data source expression + * @param compiler the current <code>JAXXCompiler</code> + */ + public DataSource(String id, String source, JAXXCompiler compiler) { + this.id = id; + this.source = source; + this.compiler = compiler; + if (log.isDebugEnabled()) { + log.debug("id=" + id + " source=" + source); + } + } + + public String getId() { + return id; + } + + public String getSource() { + return source; + } + + public String getObjectCode() { + return objectCode; + } + + public String getListenerId() { + return listenerId; + } + + /** + * Compiles the data source expression and listener. This method calls methods in <code>JAXXCompiler</code> + * to add the Java code that performs the data source setup. Adding listeners to <code>DataSource</code> is + * slightly more complicated than with ordinary classes, because <code>DataSource</code> only exists at compile + * time. You must pass in a Java expression which evaluates to a <code>PropertyChangeListener</code>; this + * expression will be compiled and evaluated at runtime to yield the <code>DataSource's</code> listener. + * + * @param propertyChangeListenerCode Java code snippet which evaluates to a <code>PropertyChangeListener</code> + * @return <code>true</code> if the expression has dependencies, <code>false</code> otherwise + * @throws CompilerException if a compilation error occurs + * @throws IllegalStateException if data source was already compiled + */ + public boolean compile(String propertyChangeListenerCode) throws CompilerException, IllegalStateException { + if (compiled) { + throw new IllegalStateException(this + " has already been compiled"); + } +// String listenerId = compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(getClass())); + listenerId = compiler.getAutoId(getClass().getSimpleName()); + if (log.isDebugEnabled()) { + log.debug("listenerId=" + listenerId); + } + JavaParser p = new JavaParser(new StringReader(source)); +// JavaParser p = new JavaParser(new StringReader(source + ";")); + while (!p.Line()) { + SimpleNode node = p.popNode(); + if (log.isDebugEnabled()) { + log.debug("will scan node " + node.getText()); + } +// scanNode(node, listenerId); + scanNode(node); + } + if (log.isDebugEnabled()) { + log.debug("dependencySymbols=" + dependencySymbols); + } + if (dependencySymbols.size() > 0) { + // a real binding was detected + + // add a dataBinding field + //TC 20081108 prefer add a real JavaField instead of raw code + //compiler.appendBodyCode("private PropertyChangeListener " + id + " = " + propertyChangeListenerCode + ";\n"); + compiler.addSimpleField(new JavaField(Modifier.PRIVATE, PropertyChangeListener.class.getSimpleName(), listenerId, false, propertyChangeListenerCode)); + + // add listener codes in compiler + +// compileListeners(); + String javaCodeId = TypeManager.getJavaCode(id); + String eol = JAXXCompiler.getLineSeparator(); + +// if (addListenerCode.length() > 0) { + if (compiler.hasApplyDataBinding()) { + compiler.appendApplyDataBinding(" else "); + } + compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {"); + compiler.appendApplyDataBinding(" " + addListenerCode + eol); + compiler.appendApplyDataBinding("}"); +// } + +// if (removeListenerCode.length() > 0) { + if (compiler.hasRemoveDataBinding()) { + compiler.appendRemoveDataBinding(" else "); + } + compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {"); + compiler.appendRemoveDataBinding(" " + removeListenerCode + eol); + compiler.appendRemoveDataBinding("}"); +// } + } + //TC-20091027 if no dependency symbols then no listeners +// compileListeners(); + compiled = true; + + return dependencySymbols.size() > 0; + } + + /** + * @return a list of symbols on which this data source depends. + */ + public Collection<String> getDependencies() { + return Collections.unmodifiableList(dependencySymbols); + } + + /** + * Examines a node to identify any dependencies it contains. + * + * @param node node to scan + // * @param listenerId id of listener + * @throws CompilerException ? + */ + private void scanNode(SimpleNode node) throws CompilerException { +// private void scanNode(SimpleNode node, String listenerId) throws CompilerException { + if (node.getId() == JavaParserTreeConstants.JJTMETHODDECLARATION || + node.getId() == JavaParserTreeConstants.JJTFIELDDECLARATION) { + return; + } + if (log.isTraceEnabled()) { + log.trace(node.getText()); + } + int count = node.jjtGetNumChildren(); + for (int i = 0; i < count; i++) { + scanNode(node.getChild(i)); + } + // determine node type + ClassDescriptor type = null; + if (node.jjtGetNumChildren() == 1) { + type = node.getChild(0).getJavaType(); + } + switch (node.getId()) { + case JavaParserTreeConstants.JJTCLASSORINTERFACETYPE: + type = ClassDescriptorLoader.getClassDescriptor(Class.class); + break; + case JavaParserTreeConstants.JJTPRIMARYEXPRESSION: +// type = determineExpressionType(node, listenerId); + type = determineExpressionType(node); + break; + case JavaParserTreeConstants.JJTLITERAL: + type = determineLiteralType(node); + break; + case JavaParserTreeConstants.JJTCASTEXPRESSION: + type = TagManager.resolveClass(node.getChild(0).getText(), compiler); + break; + } + node.setJavaType(type); + +// switch (node.getId()) { +// case JavaParserTreeConstants.JJTMETHODDECLARATION: +// break; +// case JavaParserTreeConstants.JJTFIELDDECLARATION: +// break; +// +// default: +// int count = node.jjtGetNumChildren(); +// for (int i = 0; i < count; i++) { +// scanNode(node.getChild(i), listenerId); +// } +// determineNodeType(node); +// } + } + + /** + * Adds type information to nodes where possible, and as a side effect adds event listeners to nodes which + * can be tracked. + * + * @param expression the node to scan + // * @param listenerId id of the listener + * @return the class descriptor of the return type or null + */ +// private ClassDescriptor determineExpressionType(SimpleNode expression, String listenerId) { + private ClassDescriptor determineExpressionType(SimpleNode expression) { + assert expression.getId() == JavaParserTreeConstants.JJTPRIMARYEXPRESSION; + SimpleNode prefix = expression.getChild(0); + if (prefix.jjtGetNumChildren() == 1) { + int type = prefix.getChild(0).getId(); + if (type == JavaParserTreeConstants.JJTLITERAL || type == JavaParserTreeConstants.JJTEXPRESSION) { + prefix.setJavaType(prefix.getChild(0).getJavaType()); + } else if (type == JavaParserTreeConstants.JJTNAME && expression.jjtGetNumChildren() == 1) { + // name with no arguments after it +// prefix.setJavaType(scanCompoundSymbol(prefix.getText().trim(), compiler.getRootObject().getObjectClass(), false, listenerId)); + prefix.setJavaType(scanCompoundSymbol(prefix.getText().trim(), compiler.getRootObject().getObjectClass(), false)); + } + } + + if (expression.jjtGetNumChildren() == 1) { + return prefix.getJavaType(); + } + + ClassDescriptor contextClass = prefix.getJavaType(); + if (contextClass == null) { + contextClass = compiler.getRootObject().getObjectClass(); + } + String lastNode = prefix.getText().trim(); + + for (int i = 1; i < expression.jjtGetNumChildren(); i++) { + SimpleNode suffix = expression.getChild(i); + if (suffix.jjtGetNumChildren() == 1 && suffix.getChild(0).getId() == JavaParserTreeConstants.JJTARGUMENTS) { + if (suffix.getChild(0).jjtGetNumChildren() == 0) { + // at the moment only no-argument methods are trackable +// contextClass = scanCompoundSymbol(lastNode, contextClass, true, listenerId); + contextClass = scanCompoundSymbol(lastNode, contextClass, true); + if (contextClass == null) { + return null; + } + int dotPos = lastNode.lastIndexOf("."); + String code = dotPos == -1 ? "" : lastNode.substring(0, dotPos); + for (int j = i - 2; j >= 0; j--) { + code = expression.getChild(j).getText() + code; + } + if (code.length() == 0) { + code = compiler.getRootObject().getJavaCode(); + } + String methodName = lastNode.substring(dotPos + 1).trim(); + try { + MethodDescriptor method = contextClass.getMethodDescriptor(methodName); +// trackMemberIfPossible(code, contextClass, method.getName(), true, listenerId); + trackMemberIfPossible(code, contextClass, method.getName(), true); + return method.getReturnType(); + } catch (NoSuchMethodException e) { + // happens for methods defined in the current JAXX file via scripts + String propertyName = null; + if (methodName.startsWith("is")) { + propertyName = Introspector.decapitalize(methodName.substring("is".length())); + } else if (methodName.startsWith("get")) { + propertyName = Introspector.decapitalize(methodName.substring("get".length())); + } + if (propertyName != null) { + //TC-20091026 use the getScriptMethod from compiler + MethodDescriptor newMethod = compiler.getScriptMethod(methodName); + if (newMethod != null) { + addListener(compiler.getRootObject().getId(), + null, + "addPropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator(), + "removePropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator()); + contextClass = newMethod.getReturnType(); + } +// MethodDescriptor[] newMethods = compiler.getScriptMethods(); +// for (MethodDescriptor newMethod : newMethods) { +// if (newMethod.getName().equals(methodName)) { +// addListener(compiler.getRootObject().getId(), +// null, +// "addPropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator(), +// "removePropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator()); +// contextClass = newMethod.getReturnType(); +// break; +// } +// } + } + } + } + } + lastNode = suffix.getText().trim(); + if (lastNode.startsWith(".")) { + lastNode = lastNode.substring(1); + } + } + + return null; + } + + private ClassDescriptor determineLiteralType(SimpleNode node) { + assert node.getId() == JavaParserTreeConstants.JJTLITERAL; + if (node.jjtGetNumChildren() == 1) { + int childId = node.getChild(0).getId(); + if (childId == JavaParserTreeConstants.JJTBOOLEANLITERAL) { + return ClassDescriptorLoader.getClassDescriptor(boolean.class); + } + if (childId == JavaParserTreeConstants.JJTNULLLITERAL) { + return ClassDescriptorLoader.getClassDescriptor(NULL.class); + } + throw new RuntimeException("Expected BooleanLiteral or NullLiteral, found " + JavaParserTreeConstants.jjtNodeName[childId]); + } + int nodeId = node.firstToken.kind; + switch (nodeId) { + case JavaParserConstants.INTEGER_LITERAL: + if (node.firstToken.image.toLowerCase().endsWith("l")) { + return ClassDescriptorLoader.getClassDescriptor(long.class); + } + return ClassDescriptorLoader.getClassDescriptor(int.class); + case JavaParserConstants.CHARACTER_LITERAL: + return ClassDescriptorLoader.getClassDescriptor(char.class); + case JavaParserConstants.FLOATING_POINT_LITERAL: + if (node.firstToken.image.toLowerCase().endsWith("f")) { + return ClassDescriptorLoader.getClassDescriptor(float.class); + } + return ClassDescriptorLoader.getClassDescriptor(double.class); + case JavaParserConstants.STRING_LITERAL: + return ClassDescriptorLoader.getClassDescriptor(String.class); + default: + throw new RuntimeException("Expected literal token, found " + JavaParserConstants.tokenImage[nodeId]); + } + } + + /** + * Scans through a compound symbol (foo.bar.baz) to identify and track all trackable pieces of it. + * + * @param symbol symbol to scan + * @param contextClass current class context + * @param isMethod flag to search a method + // * @param listenerId id of the listener + * @return the type of the symbol (or null if it could not be determined). + */ +// private ClassDescriptor scanCompoundSymbol(String symbol, ClassDescriptor contextClass, boolean isMethod, String listenerId) { + private ClassDescriptor scanCompoundSymbol(String symbol, ClassDescriptor contextClass, boolean isMethod) { + String[] tokens = symbol.split("\\s*\\.\\s*"); + StringBuffer currentSymbol = new StringBuffer(); + StringBuffer tokensSeenSoFar = new StringBuffer(); + boolean accepted; // if this ends up false, it means we weren't able to figure out + // which object the method is being invoked on + boolean recognizeClassNames = true; + for (int j = 0; j < tokens.length - (isMethod ? 1 : 0); j++) { + accepted = false; + + if (tokensSeenSoFar.length() > 0) { + tokensSeenSoFar.append('.'); + } + tokensSeenSoFar.append(tokens[j]); + if (currentSymbol.length() > 0) { + currentSymbol.append('.'); + } + currentSymbol.append(tokens[j]); + + if (currentSymbol.indexOf(".") == -1) { + String memberName = currentSymbol.toString(); + CompiledObject object = compiler.getCompiledObject(memberName); + if (object != null) { + contextClass = object.getObjectClass(); + currentSymbol.setLength(0); + accepted = true; + recognizeClassNames = false; + } else { + try { + FieldDescriptor field = contextClass.getFieldDescriptor(memberName); +// trackMemberIfPossible(tokensSeenSoFar.toString(), contextClass, field.getName(), false, listenerId); + trackMemberIfPossible(tokensSeenSoFar.toString(), contextClass, field.getName(), false); + contextClass = field.getType(); + currentSymbol.setLength(0); + accepted = true; + recognizeClassNames = false; + } catch (NoSuchFieldException e) { + if (j == 0 || j == 1 && tokens[0].equals(compiler.getRootObject().getId())) { // still in root context + FieldDescriptor[] newFields = compiler.getScriptFields(); + for (FieldDescriptor newField : newFields) { + if (newField.getName().equals(memberName)) { + addListener(tokensSeenSoFar.toString(), + null, + "addPropertyChangeListener(\"" + memberName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator(), + "removePropertyChangeListener(\"" + memberName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator()); + contextClass = newField.getType(); + assert contextClass != null : "script field '" + memberName + "' is defined, but has type null"; + currentSymbol.setLength(0); + accepted = true; + recognizeClassNames = false; + break; + } + } + } + } + } + } + if (currentSymbol.length() > 0 && recognizeClassNames) { + contextClass = TagManager.resolveClass(currentSymbol.toString(), compiler); + if (contextClass != null) { + currentSymbol.setLength(0); + //accepted = true; + //recognizeClassNames = false; + // TODO: for now we don't handle statics + return null; + } + } + if (!accepted) { + return null; + } + } + + return contextClass; + } + +// private void trackMemberIfPossible(String objectCode, ClassDescriptor objectClass, String memberName, boolean method, String listenerId) { + private void trackMemberIfPossible(String objectCode, ClassDescriptor objectClass, String memberName, boolean method) { +// if (objectClass.isInterface()) { +// // might be technically possible to track in some cases, but for now +// // we can't create a DefaultObjectHandler for interfaces +// return; +// } + + DefaultObjectHandler handler = TagManager.getTagHandler(objectClass); + try { + if (handler.isMemberBound(memberName)) { + addListener(objectCode + "." + memberName + (method ? "()" : ""), + objectCode, + handler.getAddMemberListenerCode(objectCode, id, memberName, listenerId, compiler), + handler.getRemoveMemberListenerCode(objectCode, id, memberName, listenerId, compiler)); + } + } catch (UnsupportedAttributeException e) { + // ignore -- this is thrown for methods like toString(), for which there is no tracking and + // no setting support + } + } + + private void addListener(String dependencySymbol, String objectCode, String addCode, String removeCode) { + this.objectCode = objectCode; + //TC-20091026 no need to test objectCode not null if on root object +// boolean needTest = objectCode != null; + boolean needTest = objectCode != null && !compiler.getRootObject().getId().equals(objectCode); + if (!dependencySymbols.contains(dependencySymbol)) { + dependencySymbols.add(dependencySymbol); + String eol = JAXXCompiler.getLineSeparator(); + addListenerCode.append(eol); + if (needTest) { + addListenerCode.append(" if (").append(objectCode).append(" != null) {").append(eol); + addListenerCode.append(" "); + } + addListenerCode.append(" ").append(addCode.trim()); + if (needTest) { + addListenerCode.append(eol).append(" }"); + } + + removeListenerCode.append(eol); + if (needTest) { + removeListenerCode.append(" if (").append(objectCode).append(" != null) {").append(eol); + removeListenerCode.append(" "); + } + removeListenerCode.append(" ").append(removeCode.trim()); + if (needTest) { + removeListenerCode.append(eol).append(" }"); + } + } + } +// /** +// * Adds type information to nodes where possible, and as a side effect adds event listeners to nodes which +// * can be tracked. +// * +// * @param node node to scan +// * @param listenerId the listener id +// */ +//// private void determineNodeType(SimpleNode node, String listenerId) { +// private void determineNodeType(SimpleNode node) { +// ClassDescriptor type = null; +// if (node.jjtGetNumChildren() == 1) { +// type = node.getChild(0).getJavaType(); +// } +// switch (node.getId()) { +// case JavaParserTreeConstants.JJTCLASSORINTERFACETYPE: +// type = ClassDescriptorLoader.getClassDescriptor(Class.class); +// break; +// case JavaParserTreeConstants.JJTPRIMARYEXPRESSION: +// type = determineExpressionType(node, listenerId); +// break; +// case JavaParserTreeConstants.JJTLITERAL: +// type = determineLiteralType(node); +// break; +// case JavaParserTreeConstants.JJTCASTEXPRESSION: +// type = TagManager.resolveClass(node.getChild(0).getText(), compiler); +// break; +// } +// node.setJavaType(type); +// } +// private void compileListeners() { +// String javaCodeId = TypeManager.getJavaCode(id); +// String eol = JAXXCompiler.getLineSeparator(); +// if (addListenerCode.length() > 0) { +// if (compiler.hasApplyDataBinding()) { +// compiler.appendApplyDataBinding(" else "); +// } +//// compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol); +// compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {"); +// compiler.appendApplyDataBinding(" " + addListenerCode + eol); +// compiler.appendApplyDataBinding("}"); +// } +// +// if (removeListenerCode.length() > 0) { +// if (compiler.hasRemoveDataBinding()) { +// compiler.appendRemoveDataBinding(" else "); +// } +//// compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol); +// compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {"); +// compiler.appendRemoveDataBinding(" " + removeListenerCode + eol); +// compiler.appendRemoveDataBinding("}"); +// } +// } +} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java index 9fbf0b7..f074c4a 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java @@ -20,6 +20,8 @@ */ package jaxx.compiler.css; +import jaxx.compiler.binding.DataSource; +import jaxx.compiler.binding.DataBinding; import jaxx.compiler.*; import jaxx.runtime.css.Selector; import jaxx.runtime.css.Rule; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java index cdcb0be..ccd10a3 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/DefaultCompiledObjectDecorator.java @@ -81,6 +81,8 @@ public class DefaultCompiledObjectDecorator implements CompiledObjectDecorator { String init = object.getId() + " = "; if (object.isJavaBean() && object.getJavaBeanInitCode() != null) { init += object.getJavaBeanInitCode(); + } else if (object.getInitializer() != null) { + init += object.getInitializer(); } else { //TC - 20081017 compiledObject can have generics String canonicalName = JAXXCompiler.getCanonicalName(object); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java index f5840fe..9b84b13 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/HelpRootCompiledObjectDecorator.java @@ -88,23 +88,23 @@ public class HelpRootCompiledObjectDecorator extends DefaultCompiledObjectDecora String eol = JAXXCompiler.getLineSeparator(); - if (options.isGenerateHelp()) { - - // add code to init javax help system - Iterator<CompiledObject> itr = compiler.getObjectCreationOrder(); - - for (; itr.hasNext();) { - CompiledObject o = itr.next(); - String helpID = getHelpId(o); - if (helpID != null) { - buffer.append(eol); - // detects a helpId to register - buffer.append("registerHelpId(_broker, " + o.getJavaCode() + ", " + helpID + ");"); - //keep the helpID for helpSet generation - helpIds.add(helpID); - } +// if (options.isGenerateHelp()) { + + // add code to init javax help system + Iterator<CompiledObject> itr = compiler.getObjectCreationOrder(); + + for (; itr.hasNext();) { + CompiledObject o = itr.next(); + String helpID = getHelpId(o); + if (helpID != null) { + buffer.append(eol); + // detects a helpId to register + buffer.append("registerHelpId(_broker, " + o.getJavaCode() + ", " + helpID + ");"); + //keep the helpID for helpSet generation + helpIds.add(helpID); } } +// } if (buffer.length() > 0) { StringBuilder extraCode = new StringBuilder(helpBrokerFQN).append(" _broker = getBroker();"); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java b/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java index 90ee171..f87db50 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java @@ -24,7 +24,7 @@ import jaxx.compiler.JAXXCompilerFinalizer; import jaxx.compiler.CompilerException; import jaxx.compiler.CompiledObject; import jaxx.compiler.CompiledObjectDecorator; -import jaxx.compiler.DataBinding; +import jaxx.compiler.binding.DataBinding; import jaxx.compiler.EventHandler; import jaxx.compiler.JAXXCompiler; import jaxx.compiler.java.JavaMethod; @@ -39,7 +39,6 @@ import jaxx.runtime.Base64Coder; import jaxx.runtime.JAXXObject; import jaxx.runtime.JAXXObjectDescriptor; import jaxx.runtime.JAXXContext; -import jaxx.runtime.Util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -48,6 +47,7 @@ import static java.lang.reflect.Modifier.*; import java.util.Iterator; import java.util.List; import java.util.Map; +import jaxx.runtime.Util; import static jaxx.compiler.java.JavaFileGenerator.*; /** @@ -242,45 +242,10 @@ public class DefaultFinalizer implements JAXXCompilerFinalizer { CompiledObjectDecorator decorator = object.getDecorator(); decorator.finalizeCompiler(compiler, root, object, javaFile, packageName, className, fullClassName); } - String eol = JAXXCompiler.getLineSeparator(); - - // DataBinding - for (DataBinding dataBinding : compiler.getDataBindings()) { - if (dataBinding.compile(compiler, true)) { - String expression = "applyDataBinding(" + compiler.getJavaCode(dataBinding.getId()) + ");" + eol; - compiler.appendInitDataBindings(expression); - } - } - - if (superclassIsJAXXObject) { - boolean hasBind = compiler.hasApplyDataBinding(); - if (hasBind) { - compiler.appendApplyDataBinding(" else {"); - compiler.appendApplyDataBinding(eol); - compiler.appendApplyDataBinding(" "); - } - compiler.appendApplyDataBinding("super.applyDataBinding($binding);"); - compiler.appendApplyDataBinding(eol); - if (hasBind) { - compiler.appendApplyDataBinding(" return;"); - compiler.appendApplyDataBinding(eol); - compiler.appendApplyDataBinding("}"); - } - - hasBind = compiler.hasRemoveDataBinding(); - if (hasBind) { - compiler.appendRemoveDataBinding(" else {"); - compiler.appendRemoveDataBinding(eol); - compiler.appendRemoveDataBinding(" "); - } - compiler.appendRemoveDataBinding("super.removeDataBinding($binding);"); - compiler.appendRemoveDataBinding(eol); + finalizeBindings(compiler, superclassIsJAXXObject); - if (hasBind) { - compiler.appendRemoveDataBinding("}"); - } - } else { + if (!superclassIsJAXXObject) { javaFile.addInterface(JAXXCompiler.getCanonicalName(JAXXObject.class)); } } @@ -405,6 +370,46 @@ public class DefaultFinalizer implements JAXXCompilerFinalizer { } + protected void finalizeBindings(JAXXCompiler compiler, boolean superclassIsJAXXObject) { + String eol = JAXXCompiler.getLineSeparator(); + + for (DataBinding dataBinding : compiler.getDataBindings()) { + if (dataBinding.compile(compiler, true)) { + String expression = "applyDataBinding(" + compiler.getJavaCode(dataBinding.getId()) + ");" + eol; + compiler.appendInitDataBindings(expression); + } + } + + if (superclassIsJAXXObject) { + boolean hasBind = compiler.hasApplyDataBinding(); + if (hasBind) { + compiler.appendApplyDataBinding(" else {"); + compiler.appendApplyDataBinding(eol); + compiler.appendApplyDataBinding(" "); + } + compiler.appendApplyDataBinding("super.applyDataBinding($binding);"); + compiler.appendApplyDataBinding(eol); + + if (hasBind) { + compiler.appendApplyDataBinding(" return;"); + compiler.appendApplyDataBinding(eol); + compiler.appendApplyDataBinding("}"); + } + + hasBind = compiler.hasRemoveDataBinding(); + if (hasBind) { + compiler.appendRemoveDataBinding(" else {"); + compiler.appendRemoveDataBinding(eol); + compiler.appendRemoveDataBinding(" "); + } + compiler.appendRemoveDataBinding("super.removeDataBinding($binding);"); + compiler.appendRemoveDataBinding(eol); + + if (hasBind) { + compiler.appendRemoveDataBinding("}"); + } + } + } /*---------------------------------------------------------------------------------*/ /*-- Create fields ----------------------------------------------------------------*/ @@ -614,8 +619,9 @@ public class DefaultFinalizer implements JAXXCompilerFinalizer { if (superclassIsJAXXObject) { code.append(" else {").append(eol); code.append(" super.processDataBinding($dest, true);").append(eol); - code.append(" }").append(eol); + code.append(" }"); } + code.append(eol); code.append("} finally {").append(eol); code.append(" $activeBindings.remove($dest);").append(eol); code.append("}").append(eol); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java index 7c92a75..d776bc6 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java @@ -85,6 +85,7 @@ public class DefaultObjectHandler implements TagHandler { public static final String GENERICTYPE_ATTRIBUTE = "genericType"; public static final String ID_ATTRIBUTE = "id"; public static final String IMPLEMENTS_ATTRIBUTE = "implements"; + public static final String INITIALIZER_ATTRIBUTE = "initializer"; public static final String JAVA_BEAN_ATTRIBUTE = "javaBean"; public static final String LAYOUT_ATTRIBUTE = "layout"; public static final String MNEMONIC_ATTRIBUTE = "mnemonic"; @@ -324,7 +325,8 @@ public class DefaultObjectHandler implements TagHandler { } ProxyEventInfo eventInfo = eventInfos != null ? eventInfos.get(memberName) : null; - if (eventInfo != null) { // a "proxied" event is one that doesn't fire PropertyChangeEvent, so we need to convert its native event type into PropertyChangeEvents + if (eventInfo != null) { + // a "proxied" event is one that doesn't fire PropertyChangeEvent, so we need to convert its native event type into PropertyChangeEvents StringBuffer result = new StringBuffer(); String methodName = "$pr" + compiler.getUniqueId(propertyChangeListenerCode); boolean methodExists = compiler.hasMethod(methodName); @@ -665,7 +667,8 @@ public class DefaultObjectHandler implements TagHandler { continue; } if (name.equals(CONSTRAINTS_ATTRIBUTE) || isEventHandlerName(name)) { - compiler.preprocessScript(value); // adds dependencies as a side effect + // adds dependencies as a side effect + compiler.preprocessScript(value); } else if (name.equals(CONSTRUCTOR_PARAMS_ATTRIBUTE)) { for (String param : value.split("\\s*,\\s*")) { compiler.preprocessScript(param); @@ -713,6 +716,14 @@ public class DefaultObjectHandler implements TagHandler { } continue; } + if (name.equals(INITIALIZER_ATTRIBUTE)) { + if (!value.isEmpty()) { + object.setInitializer(value); + } else { + object.setInitializer("null"); + } + continue; + } if (name.equals(IMPLEMENTS_ATTRIBUTE)) { if (object != compiler.getRootObject()) { // can ony be apply to root object @@ -863,23 +874,25 @@ public class DefaultObjectHandler implements TagHandler { if (inline) { compiler.addInlineStyle(object, propertyName, true); } - ClassDescriptor propertyType = getPropertyType(object, propertyName, compiler); - if (propertyType != null && - propertyType != ClassDescriptorLoader.getClassDescriptor(Boolean.class) && - propertyType != ClassDescriptorLoader.getClassDescriptor(Byte.class) && - propertyType != ClassDescriptorLoader.getClassDescriptor(Short.class) && - propertyType != ClassDescriptorLoader.getClassDescriptor(Integer.class) && - propertyType != ClassDescriptorLoader.getClassDescriptor(Float.class) && - propertyType != ClassDescriptorLoader.getClassDescriptor(Double.class) && - propertyType != ClassDescriptorLoader.getClassDescriptor(Character.class)) { - //binding = "((" + propertyType.getName() + ") " + binding + ")"; - } + //TC-20091027 : make sure this code is never used ? +// ClassDescriptor propertyType = getPropertyType(object, propertyName, compiler); +// if (propertyType != null && +// propertyType != ClassDescriptorLoader.getClassDescriptor(Boolean.class) && +// propertyType != ClassDescriptorLoader.getClassDescriptor(Byte.class) && +// propertyType != ClassDescriptorLoader.getClassDescriptor(Short.class) && +// propertyType != ClassDescriptorLoader.getClassDescriptor(Integer.class) && +// propertyType != ClassDescriptorLoader.getClassDescriptor(Float.class) && +// propertyType != ClassDescriptorLoader.getClassDescriptor(Double.class) && +// propertyType != ClassDescriptorLoader.getClassDescriptor(Character.class)) { +// //binding = "((" + propertyType.getName() + ") " + binding + ")"; +// } + String setPropertyCode = getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler); if (propertyName.equals(LAYOUT_ATTRIBUTE)) { // handle containerDelegate (e.g. contentPane on JFrame) // have to set layout early, before children are added - object.appendInitializationCode(getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler)); + object.appendInitializationCode(setPropertyCode); } // object.registerDataBinding(binding, propertyName, getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler), compiler); - compiler.registerDataBinding(binding, object.getId() + "." + propertyName, getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler)); + compiler.registerDataBinding(binding, object.getId() + "." + propertyName, setPropertyCode); } else { // no bindings, convert from string if (inline) { compiler.addInlineStyle(object, propertyName, false); -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 85711119c038ed63927a522afbca45d8c755cc48 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 28 07:19:17 2009 +0000 amelioration des renderer sur Decorator (et deplacement vers jaxx.runtime.swing.renderer) --- .../jaxx/navigation/content/ActorsContentUI.jaxx | 4 +- .../jaxx/navigation/content/ContentUI.jaxx | 9 ++- .../jaxx/navigation/content/MoviesContentUI.jaxx | 4 +- .../renderer}/DecoratorListCellRenderer.java | 2 +- .../renderer}/DecoratorTableCellRenderer.java | 2 +- .../renderer/MultiDecoratorListCellRenderer.java | 64 ++++++++++++++++++++++ .../jaxx/runtime/swing/EntityComboBoxHandler.java | 2 +- 7 files changed, 79 insertions(+), 8 deletions(-) diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx index dea8369..7c0746e 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx @@ -24,7 +24,7 @@ import jaxx.runtime.SwingUtil; import jaxx.demo.component.jaxx.navigation.*; import jaxx.runtime.decorator.DecoratorUtils; -import jaxx.runtime.decorator.swing.DecoratorListCellRenderer; +import jaxx.runtime.swing.renderer.MultiDecoratorListCellRenderer; import jaxx.runtime.swing.navigation.NavigationTreeNode; @Override @@ -56,7 +56,7 @@ public void closeUI(NavigationTreeNode node) throws Exception { columnHeaderView='{toolbar}' horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> - <JList id='list' model='{new DefaultListModel()}' cellRenderer='{new DecoratorListCellRenderer(DecoratorUtils.get(People.class.getSimpleName()))}'/> + <JList id='list' model='{new DefaultListModel()}' cellRenderer='{getContextValue(MultiDecoratorListCellRenderer.class)}'/> </JScrollPane> <JToolBar id='toolbar' constraints='BorderLayout.SOUTH' floatable='false'> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx index f5f9104..9a59431 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx @@ -27,10 +27,17 @@ import jaxx.runtime.SwingUtil; import jaxx.demo.component.jaxx.navigation.*; import jaxx.runtime.decorator.DecoratorUtils; -import jaxx.runtime.decorator.swing.DecoratorListCellRenderer; +import jaxx.runtime.decorator.MultiJXPathDecorator; +import jaxx.runtime.swing.renderer.MultiDecoratorListCellRenderer; import jaxx.runtime.swing.navigation.NavigationTreeNode; import jaxx.runtime.swing.navigation.NavigationContentUI; +// init shared list decorator +MultiJXPathDecorator<?> d0 = (MultiJXPathDecorator<?>)DecoratorUtils.get(People.class.getSimpleName()); +MultiJXPathDecorator<?> d1 = (MultiJXPathDecorator<?>)DecoratorUtils.get(Movie.class.getSimpleName()); +MultiDecoratorListCellRenderer r = new MultiDecoratorListCellRenderer(d0,d1); +setContextValue(r); + ContentUIHandler getHandler() { return getContextValue(ContentUIHandler.class); } diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx index 1dfa5fa..a921b98 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx @@ -24,7 +24,7 @@ import jaxx.runtime.SwingUtil; import jaxx.demo.component.jaxx.navigation.*; import jaxx.runtime.decorator.DecoratorUtils; -import jaxx.runtime.decorator.swing.DecoratorListCellRenderer; +import jaxx.runtime.swing.renderer.MultiDecoratorListCellRenderer; import jaxx.runtime.swing.navigation.NavigationTreeNode; @Override @@ -56,7 +56,7 @@ public void closeUI(NavigationTreeNode node) throws Exception { columnHeaderView='{toolbar}' horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> - <JList id='list' model='{new DefaultListModel()}' cellRenderer='{new DecoratorListCellRenderer(DecoratorUtils.get(Movie.class.getSimpleName()))}'/> + <JList id='list' model='{new DefaultListModel()}' cellRenderer='{getContextValue(MultiDecoratorListCellRenderer.class)}'/> </JScrollPane> <JToolBar id='toolbar' opaque='false' constraints='BorderLayout.SOUTH' floatable='false'> diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorListCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorListCellRenderer.java similarity index 98% rename from jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorListCellRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorListCellRenderer.java index 99d82b8..0737e31 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorListCellRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorListCellRenderer.java @@ -18,7 +18,7 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -package jaxx.runtime.decorator.swing; +package jaxx.runtime.swing.renderer; import jaxx.runtime.decorator.*; import java.awt.Component; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorTableCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorTableCellRenderer.java similarity index 98% rename from jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorTableCellRenderer.java rename to jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorTableCellRenderer.java index f5a9d58..9de69dc 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/swing/DecoratorTableCellRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorTableCellRenderer.java @@ -18,7 +18,7 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * ##%* */ -package jaxx.runtime.decorator.swing; +package jaxx.runtime.swing.renderer; import jaxx.runtime.decorator.*; import javax.swing.JTable; diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorListCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorListCellRenderer.java new file mode 100644 index 0000000..45e2d91 --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorListCellRenderer.java @@ -0,0 +1,64 @@ +package jaxx.runtime.swing.renderer; + +import java.awt.Component; +import java.util.ArrayList; +import java.util.List; +import javax.swing.DefaultListCellRenderer; +import javax.swing.JList; +import javax.swing.ListCellRenderer; +import jaxx.runtime.decorator.Decorator; +import jaxx.runtime.decorator.JXPathDecorator; + +/** + * A {@link ListCellRenderer} which compute text with the matching decorator + * from {@link #decorators} and leave the hand to the {@link #delegate} to + * perform the visual renderer. + * + * @author chemit + * @since 2.0.0 + */ +public class MultiDecoratorListCellRenderer implements ListCellRenderer { + + /** + * Delegate cell renderer + */ + protected ListCellRenderer delegate; + /** + * accepted types + */ + protected List<Class<?>> types; + /** + * decorators for accepted types + */ + protected Decorator<?>[] decorators; + + public MultiDecoratorListCellRenderer(ListCellRenderer delegate, JXPathDecorator<?>... decorator) { + this.delegate = delegate; + this.types = new ArrayList<Class<?>>(); + List<Decorator<?>> tmp = new ArrayList<Decorator<?>>(); + for (JXPathDecorator<?> d : decorator) { + if (types.contains(d.getInternalClass())) { + throw new IllegalArgumentException("can not have twice a decorator of type " + d.getInternalClass()); + } + types.add(d.getInternalClass()); + tmp.add(d); + } + decorators = tmp.toArray(new Decorator<?>[tmp.size()]); + } + + public MultiDecoratorListCellRenderer(JXPathDecorator<?>... decorator) { + this(new DefaultListCellRenderer(), decorator); + } + + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + if (value != null) { + int i = types.indexOf(value.getClass()); + if (i != -1) { + Decorator<?> d = decorators[i]; + value = d.toString(value); + } + } + return delegate.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + } +} diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java index 1e73438..9877f68 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java @@ -48,7 +48,7 @@ import javax.swing.JComboBox; import jaxx.runtime.decorator.Decorator; import jaxx.runtime.decorator.JXPathDecorator; import jaxx.runtime.decorator.MultiJXPathDecorator; -import jaxx.runtime.decorator.swing.DecoratorListCellRenderer; +import jaxx.runtime.swing.renderer.DecoratorListCellRenderer; import jaxx.runtime.decorator.DecoratorUtils; import org.jdesktop.swingx.autocomplete.AutoCompletePropertyChangeListener; -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 67318a5c95a436da6a48edbba40ac2264210fe38 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 28 07:20:17 2009 +0000 - ajout test sur bindings - les fichiers generes sont dans target/generated-sources --- maven-jaxx-plugin/pom.xml | 6 ++-- .../org/nuiton/jaxx/plugin/DataBinding/Bean.java | 16 +++++++++ .../nuiton/jaxx/plugin/DataBinding/BeanImpl.java | 38 ++++++++++++++++++++++ .../org/nuiton/jaxx/plugin/DataBindingTest.java | 33 +++++++++++++++++++ .../src/test/resources/log4j.properties | 9 +++++ .../nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml | 2 +- .../nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml | 2 +- .../nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml | 2 +- .../nuiton/jaxx/plugin/CompilerTest/CSSTests.xml | 2 +- .../jaxx/plugin/CompilerTest/ClassReferences.xml | 2 +- .../jaxx/plugin/CompilerTest/ClientProperty.xml | 2 +- .../ErrorJaxxContextImplementorClass.xml | 2 +- .../org/nuiton/jaxx/plugin/CompilerTest/Errors.xml | 2 +- .../org/nuiton/jaxx/plugin/CompilerTest/Force.xml | 2 +- .../org/nuiton/jaxx/plugin/CompilerTest/Icon.xml | 2 +- .../jaxx/plugin/CompilerTest/Initializers.xml | 2 +- .../jaxx/plugin/CompilerTest/InnerClasses.xml | 2 +- .../org/nuiton/jaxx/plugin/CompilerTest/NoLog.xml | 2 +- .../plugin/CompilerTest/OverridingDataBindings.xml | 2 +- .../org/nuiton/jaxx/plugin/CompilerTest/Script.xml | 2 +- .../plugin/CompilerTest/SpecialSubclassing.xml | 2 +- .../nuiton/jaxx/plugin/CompilerTest/WithLog.xml | 2 +- .../CompilerValidatorTest/ValidatorErrors.xml | 2 +- .../plugin/CompilerValidatorTest/ValidatorOk.xml | 2 +- .../nuiton/jaxx/plugin/DataBindingTest/First.jaxx | 24 ++++++++++++++ .../simpleBinding.xml} | 5 ++- .../nuiton/jaxx/plugin/DecoratorTest/Decorator.xml | 2 +- .../nuiton/jaxx/plugin/Evolution74Test/error.xml | 2 +- .../org/nuiton/jaxx/plugin/Evolution74Test/ok.xml | 2 +- .../org/nuiton/jaxx/plugin/I18nTest/I18nText.xml | 2 +- .../org/nuiton/jaxx/plugin/I18nTest/I18nTitle.xml | 2 +- .../jaxx/plugin/I18nTest/I18nToolTipText.xml | 2 +- 32 files changed, 150 insertions(+), 31 deletions(-) diff --git a/maven-jaxx-plugin/pom.xml b/maven-jaxx-plugin/pom.xml index 9a623a1..5776077 100644 --- a/maven-jaxx-plugin/pom.xml +++ b/maven-jaxx-plugin/pom.xml @@ -129,7 +129,7 @@ </execution> </executions> </plugin> - + </plugins> <pluginManagement> @@ -491,5 +491,5 @@ </plugin> </plugins> </reporting> - -</project> \ No newline at end of file + +</project> diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/Bean.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/Bean.java new file mode 100644 index 0000000..c788f0b --- /dev/null +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/Bean.java @@ -0,0 +1,16 @@ +package org.nuiton.jaxx.plugin.DataBinding; + +import java.beans.PropertyChangeListener; + +public interface Bean { + + void addPropertyChangeListener(PropertyChangeListener listener); + + void addPropertyChangeListener(String propertyName, PropertyChangeListener listener); + + void removePropertyChangeListener(PropertyChangeListener listener); + + void removePropertyChangeListener(String propertyName, PropertyChangeListener listener); + + String getText(); +} diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java new file mode 100644 index 0000000..6ba6af7 --- /dev/null +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java @@ -0,0 +1,38 @@ +package org.nuiton.jaxx.plugin.DataBinding; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; + +public class BeanImpl { + + protected String text; + PropertyChangeSupport p; + + public BeanImpl() { + p = new PropertyChangeSupport(this); + } + + public void addPropertyChangeListener(PropertyChangeListener listener) { + p.addPropertyChangeListener(listener); + } + + public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { + p.addPropertyChangeListener(propertyName, listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + p.removePropertyChangeListener(listener); + } + + public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { + p.removePropertyChangeListener(propertyName, listener); + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } +} diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java new file mode 100644 index 0000000..6da3c76 --- /dev/null +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java @@ -0,0 +1,33 @@ +package org.nuiton.jaxx.plugin; + +import java.io.IOException; +import org.junit.Test; + +/** + * + * @author chemit + * @since 2.0.0 + */ +public class DataBindingTest extends JaxxBaseTest { + + @Test + public void simpleBinding() throws Exception { + + GenerateMojo mojo = getMojo(); + mojo.execute(); + assertNumberJaxxFiles(1); + + // no bindings + checkPattern(mojo, "new jaxx.runtime.DataBindingListener(this, \"nobinding1.text\");", false); + checkPattern(mojo, "new jaxx.runtime.DataBindingListener(this, \"nobinding2.text\");", false); + + // with bindings + checkBinding(mojo, "binding8.text"); + } + + protected void checkBinding(GenerateMojo mojo, String... bindings) throws IOException { + for (String b : bindings) { + checkPattern(mojo, "new jaxx.runtime.DataBindingListener(this, \"" + b + "\");", true); + } + } +} diff --git a/maven-jaxx-plugin/src/test/resources/log4j.properties b/maven-jaxx-plugin/src/test/resources/log4j.properties new file mode 100644 index 0000000..6346919 --- /dev/null +++ b/maven-jaxx-plugin/src/test/resources/log4j.properties @@ -0,0 +1,9 @@ +# Global logging configuration +log4j.rootLogger=ERROR, stdout +# Console output... +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n + +log4j.logger.jaxx.compiler=INFO +log4j.logger.jaxx.compiler.binding=DEBUG diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml index 042f3b2..688e7fc 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <!--<verbose>true</verbose>--> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml index 7975f5c..2eec7f4 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <!--<verbose>true</verbose>--> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml index 9c7d24a..504449d 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <i18nable>true</i18nable> <force>true</force> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests.xml index 067c35c..0250aa0 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <i18nable>false</i18nable> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences.xml index 54e16e9..86d0515 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClientProperty.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClientProperty.xml index 922bd7b..8f85092 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClientProperty.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClientProperty.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <addLogger>false</addLogger> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ErrorJaxxContextImplementorClass.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ErrorJaxxContextImplementorClass.xml index bb63409..fb3fb0e 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ErrorJaxxContextImplementorClass.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ErrorJaxxContextImplementorClass.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <jaxxContextFQN>java.lang.String</jaxxContextFQN> <force>true</force> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Errors.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Errors.xml index 6651676..38802a4 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Errors.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Errors.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Force.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Force.xml index 2918a07..160c4f4 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Force.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Force.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml index 69318f6..82a93d1 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <i18nable>false</i18nable> <force>true</force> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Initializers.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Initializers.xml index 7e5fc72..7b77755 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Initializers.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Initializers.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/InnerClasses.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/InnerClasses.xml index b86cac8..39682cc 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/InnerClasses.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/InnerClasses.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/NoLog.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/NoLog.xml index ed14568..d0ad728 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/NoLog.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/NoLog.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <addLogger>false</addLogger> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings.xml index 4860b09..45334a0 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Script.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Script.xml index 6f52cdf..55453c8 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Script.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Script.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing.xml index aff3c0a..bcec799 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/WithLog.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/WithLog.xml index e2af511..f695cca 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/WithLog.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/WithLog.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <addLogger>true</addLogger> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml index 6e82724..17677f1 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml @@ -14,7 +14,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <!--<verbose>true</verbose>--> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml index 41cb77f..3cc42f0 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <!--<verbose>true</verbose>--> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DataBindingTest/First.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DataBindingTest/First.jaxx new file mode 100644 index 0000000..157d7d8 --- /dev/null +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DataBindingTest/First.jaxx @@ -0,0 +1,24 @@ + +<JPanel> + + <java.io.File id='file' constructorParams='""'/> + <java.io.File id='file2' javaBean='new File("")'/> + + <org.nuiton.jaxx.plugin.DataBinding.Bean id='bean' javaBean='new BeanImpl()'/> + <org.nuiton.jaxx.plugin.DataBinding.BeanImpl id='beanImpl' javaBean='new BeanImpl()'/> + + <JLabel id='nobinding1' text='{file.getAbsolutePath()}'/> + <JLabel id='nobinding2' text='{getFile().getAbsolutePath()}'/> + + <JLabel id='binding0' text='{file2.getAbsolutePath()}' javaBean='new JLabel()'/> + <JLabel id='binding1' text='{this.getFile2().getAbsolutePath()}'/> + <JLabel id='binding2' text='{getFile2().getAbsolutePath()}'/> + <JLabel id='binding3' text='{bean.getText()}'/> + <JLabel id='binding4' text='{getBean().getText()}'/> + <JLabel id='binding5' text='{beanImpl.getText()}'/> + <JLabel id='binding6' text='{getBeanImpl().getText()}'/> + <JLabel id='binding7' text='{binding0.getText()}'/> + <JLabel id='binding8' text='{getBinding0().getText()}'/> + <JLabel id='binding9' text='{binding0.getText() + binding1.getText()}'/> + +</JPanel> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DataBindingTest/simpleBinding.xml similarity index 77% copy from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml copy to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DataBindingTest/simpleBinding.xml index 042f3b2..b7db2a5 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DataBindingTest/simpleBinding.xml @@ -13,12 +13,11 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> - <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <force>true</force> <!--<verbose>true</verbose>--> <includes> - <value>**/Bug1722Test/*.jaxx</value> + <value>**/DataBindingTest/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/Decorator.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/Decorator.xml index 52fdd43..f05698e 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/Decorator.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/Decorator.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <addLogger>false</addLogger> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml index 8209e9f..788ca89 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <!--<verbose>true</verbose>--> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok.xml index 48d70c1..8f1bc87 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nText.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nText.xml index 2c5c9cf..c292cb6 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nText.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nText.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <i18nable>true</i18nable> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nTitle.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nTitle.xml index dd8358b..ad744a6 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nTitle.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nTitle.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <i18nable>true</i18nable> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nToolTipText.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nToolTipText.xml index 56b03e8..441f7a3 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nToolTipText.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nToolTipText.xml @@ -13,7 +13,7 @@ <artifactId>maven-jaxx-plugin</artifactId> <configuration> <src>${basedir}/target/test-classes</src> - <outJava>${basedir}/target/it-generated-sources/java</outJava> + <outJava>${basedir}/target/generated-sources/test-java</outJava> <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <i18nable>true</i18nable> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 26dbf5e85e8f5b8059a8ae23b3a91030e34d9f48 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 28 07:29:27 2009 +0000 update demo from changes in compiler and runtime --- .../demo/component/jaxx/editor/I18nEditorDemo.jaxx | 2 +- .../jaxx/demo/component/swing/JComboBoxDemo.jaxx | 4 ++-- .../feature/validation/ValidationListDemo.jaxx | 22 +++++++++++----------- .../feature/validation/ValidationTableDemo.jaxx | 14 +++++++------- .../src/main/java/jaxx/demo/fun/CounterDemo.jaxx | 2 +- .../main/resources/i18n/jaxx-demo-en_GB.properties | 3 +++ .../main/resources/i18n/jaxx-demo-fr_FR.properties | 3 +++ 7 files changed, 28 insertions(+), 22 deletions(-) diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx index 3bb2676..c2d3af4 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/editor/I18nEditorDemo.jaxx @@ -79,7 +79,7 @@ protected Border getPopupBorder(String text) { <row> <cell> <JLabel border='{new TitledBorder(_("jaxxdemo.i18neditor.selected.locale"))}' - text='{editor.getSelectedLocale()}'/> + text='{editor.getSelectedLocale().toString()}'/> </cell> </row> </Table> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JComboBoxDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JComboBoxDemo.jaxx index eec1619..5fe2420 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/swing/JComboBoxDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/swing/JComboBoxDemo.jaxx @@ -43,7 +43,7 @@ private void $afterCompleteSetup() { </cell> <cell> - <JButton text='{jaxxComboBox.getSelectedItem()}'/> + <JButton text='{String.valueOf(jaxxComboBox.getSelectedItem())}'/> </cell> </row> <row> @@ -58,7 +58,7 @@ private void $afterCompleteSetup() { </cell> <cell> - <JButton text='{comboBox.getSelectedItem()}'/> + <JButton text='{comboBox.getSelectedItem()+""}'/> </cell> </row> </Table> diff --git a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx index cbdafa7..1a02f57 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationListDemo.jaxx @@ -21,7 +21,7 @@ <jaxx.demo.DemoPanel> <style source="Validation.css"/> -<script><![CDATA[ + <script><![CDATA[ import static org.nuiton.i18n.I18n.n_; import jaxx.runtime.validator.swing.SwingValidatorMessageListRenderer; @@ -32,7 +32,7 @@ protected String[] getSources() { return new String[]{ getDefaultSource(), "Validation.css", "Model.java", "Identity.java" }; } ]]> -</script> + </script> <!-- models --> <Model id='model1'/> <Model id='model2'/> @@ -92,7 +92,7 @@ protected String[] getSources() { <JLabel text='Ratio:'/> </cell> <cell> - <JSlider id='ratio' minimum='0' maximum='100' + <JSlider id='ratio' minimum='0' maximum='100' value='{model1.getRatio()}' _validatorLabel='{n_("form.ratio")}' onStateChanged='model1.setRatio(ratio.getValue())'/> @@ -127,7 +127,7 @@ protected String[] getSources() { <JLabel text='Ratio:'/> </cell> <cell> - <JLabel text='{model1.getRatio()}'/> + <JLabel text='{model1.getRatio()+""}'/> </cell> </row> </Table> @@ -165,7 +165,7 @@ protected String[] getSources() { <JLabel text='Ratio:'/> </cell> <cell> - <JSlider id='_ratio' minimum='0' maximum='100' + <JSlider id='_ratio' minimum='0' maximum='100' value='{model2.getRatio()}' _validatorLabel='{n_("form2.ratio")}' onStateChanged='model2.setRatio(_ratio.getValue())'/> @@ -200,7 +200,7 @@ protected String[] getSources() { <JLabel text='Ratio:'/> </cell> <cell> - <JLabel text='{model2.getRatio()}'/> + <JLabel text='{model2.getRatio()+""}'/> </cell> </row> </Table> @@ -254,7 +254,7 @@ protected String[] getSources() { <JLabel text='Config file :'/> </cell> <cell> - <JTextField id='config' text='{identity.getConfig()}' + <JTextField id='config' text='{identity.getConfig()+""}' onKeyReleased='identity.setConfig(new java.io.File(config.getText()))'/> </cell> </row> @@ -263,7 +263,7 @@ protected String[] getSources() { <JLabel text='Working directory:'/> </cell> <cell> - <JTextField id='dir' text='{identity.getDir()}' + <JTextField id='dir' text='{identity.getDir()+""}' onKeyReleased='identity.setDir(new java.io.File(dir.getText()))'/> </cell> </row> @@ -303,7 +303,7 @@ protected String[] getSources() { <JLabel text='Age:'/> </cell> <cell> - <JLabel text='{identity.getAge()}'/> + <JLabel text='{identity.getAge()+""}'/> </cell> </row> <row> @@ -311,7 +311,7 @@ protected String[] getSources() { <JLabel text='Config file:'/> </cell> <cell> - <JLabel text='{identity.getConfig()}'/> + <JLabel text='{identity.getConfig()+""}'/> </cell> </row> <row> @@ -319,7 +319,7 @@ protected String[] getSources() { <JLabel text='Directory file:'/> </cell> <cell> - <JLabel text='{identity.getDir()}'/> + <JLabel text='{identity.getDir()+""}'/> </cell> </row> </Table> diff --git a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx index 6d56abf..ae50fcd 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx @@ -133,7 +133,7 @@ protected String[] getSources() { <JLabel text='Ratio:'/> </cell> <cell> - <JLabel text='{model1.getRatio()}'/> + <JLabel text='{model1.getRatio()+""}'/> </cell> </row> </Table> @@ -206,7 +206,7 @@ protected String[] getSources() { <JLabel text='Ratio:'/> </cell> <cell> - <JLabel text='{model2.getRatio()}'/> + <JLabel text='{model2.getRatio()+""}'/> </cell> </row> </Table> @@ -260,7 +260,7 @@ protected String[] getSources() { <JLabel text='Config file :'/> </cell> <cell> - <JTextField id='config' text='{identity.getConfig()}' + <JTextField id='config' text='{identity.getConfig()+""}' onKeyReleased='identity.setConfig(new java.io.File(config.getText()))'/> </cell> </row> @@ -269,7 +269,7 @@ protected String[] getSources() { <JLabel text='Working directory:'/> </cell> <cell> - <JTextField id='dir' text='{identity.getDir()}' + <JTextField id='dir' text='{identity.getDir()+""}' onKeyReleased='identity.setDir(new java.io.File(dir.getText()))'/> </cell> </row> @@ -309,7 +309,7 @@ protected String[] getSources() { <JLabel text='Age:'/> </cell> <cell> - <JLabel text='{identity.getAge()}'/> + <JLabel text='{identity.getAge()+""}'/> </cell> </row> <row> @@ -317,7 +317,7 @@ protected String[] getSources() { <JLabel text='Config file:'/> </cell> <cell> - <JLabel text='{identity.getConfig()}'/> + <JLabel text='{identity.getConfig()+""}'/> </cell> </row> <row> @@ -325,7 +325,7 @@ protected String[] getSources() { <JLabel text='Directory file:'/> </cell> <cell> - <JLabel text='{identity.getDir()}'/> + <JLabel text='{identity.getDir()+""}'/> </cell> </row> </Table> diff --git a/jaxx-demo/src/main/java/jaxx/demo/fun/CounterDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/fun/CounterDemo.jaxx index a2960e9..93c79e1 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/fun/CounterDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/fun/CounterDemo.jaxx @@ -21,7 +21,7 @@ <jaxx.demo.DemoPanel> <script>int count;</script> <JPanel id='demoPanel'> - <JTextField text='{count}' constraints='BorderLayout.NORTH'/> + <JTextField text='{count+""}' constraints='BorderLayout.NORTH'/> <HBox constraints='BorderLayout.SOUTH'> <JButton text='Dec (-)' onActionPerformed='count--'/> <JButton text='Reset' onActionPerformed='count = 0'/> diff --git a/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties b/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties index 882b626..c3a689e 100644 --- a/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties +++ b/jaxx-demo/src/main/resources/i18n/jaxx-demo-en_GB.properties @@ -42,6 +42,7 @@ Fancy\ Button= First\ Name\:= FirstName\:= Font\ size= +Font\ size\:\ = Fool\ me\ once= Fool\ me\ twice= Green= @@ -81,6 +82,7 @@ Stop= Supported\ Swing\ components\:= Text2\:= Text\:= +Total\:\ = Underline= Upper\ case\ text\:= Use\ the\ spinner\ to= @@ -90,6 +92,7 @@ View= Welcome\ to\ the\ JAXX\ framework\!= Working\ directory\:= Yellow= +You\ entered\:\ = Your\ name\:= \\u00f7= actors= diff --git a/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties b/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties index 76ec4c2..79f942f 100644 --- a/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties +++ b/jaxx-demo/src/main/resources/i18n/jaxx-demo-fr_FR.properties @@ -42,6 +42,7 @@ Fancy\ Button=Bouton 'Fancy' First\ Name\:=Pr\u00E9nom FirstName\:=Pr\u00E9nom \: Font\ size=Taille de la police +Font\ size\:\ = Fool\ me\ once= Fool\ me\ twice= Green=Vert @@ -81,6 +82,7 @@ Stop=Arr\u00EAter Supported\ Swing\ components\:=Composants Swing support\u00E9s Text2\:=Text 2 Text\:=Texte \: +Total\:\ = Underline=soulign\u00E9 Upper\ case\ text\:=Texte en majuscule Use\ the\ spinner\ to=Utiliser la jauge pour @@ -90,6 +92,7 @@ View=Vue Welcome\ to\ the\ JAXX\ framework\!=Bienvenu dans le framework JAXX Working\ directory\:=R\u00E9pertoire de travail Yellow=Jaune +You\ entered\:\ = Your\ name\:=Votre nom \: \\u00f7= actors=Acteurs -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 0845b8bca264c90df225b77b2d038dd7c89befad Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 28 07:38:25 2009 +0000 add multi table decorator --- .../renderer/MultiDecoratorTableCelleRenderer.java | 85 ++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorTableCelleRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorTableCelleRenderer.java new file mode 100644 index 0000000..82c5a1f --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorTableCelleRenderer.java @@ -0,0 +1,85 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package jaxx.runtime.swing.renderer; + +import java.awt.Component; +import java.util.ArrayList; +import java.util.List; +import javax.swing.JTable; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.TableCellRenderer; +import jaxx.runtime.decorator.Decorator; +import jaxx.runtime.decorator.JXPathDecorator; + +/** + * A {@link TableCellRenderer} which compute text with the matching decorator + * from {@link #decorators} based on the type of value and leave the hand to + * the {@link #delegate} to perform the visual renderer. + * + * @author chemit + * @since 2.0.0 + */ +public class MultiDecoratorTableCelleRenderer implements TableCellRenderer { + + /** + * Delegate cell renderer + */ + protected TableCellRenderer delegate; + /** + * accepted types + */ + protected List<Class<?>> types; + /** + * decorators for accepted types + */ + protected Decorator<?>[] decorators; + + public MultiDecoratorTableCelleRenderer(JXPathDecorator<?>... decorator) { + this(new DefaultTableCellRenderer(), decorator); + } + + public MultiDecoratorTableCelleRenderer(TableCellRenderer delegate, JXPathDecorator<?>... decorator) { + this.delegate = delegate; + + this.types = new ArrayList<Class<?>>(); + List<Decorator<?>> tmp = new ArrayList<Decorator<?>>(); + for (JXPathDecorator<?> d : decorator) { + if (types.contains(d.getInternalClass())) { + throw new IllegalArgumentException("can not have twice a decorator of type " + d.getInternalClass()); + } + types.add(d.getInternalClass()); + tmp.add(d); + } + decorators = tmp.toArray(new Decorator<?>[tmp.size()]); + } + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasfocus, int row, int column) { + if (value != null) { + int i = types.indexOf(value.getClass()); + if (i != -1) { + Decorator<?> d = decorators[i]; + value = d.toString(value); + } + } + return delegate.getTableCellRendererComponent(table, value, isSelected, hasfocus, row, column); + } +} -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 526a1f84e6da375665ab29fcb6bc3b492f0f46c3 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 28 07:42:33 2009 +0000 ajout license --- .../renderer/MultiDecoratorListCellRenderer.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorListCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorListCellRenderer.java index 45e2d91..10cc108 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorListCellRenderer.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/MultiDecoratorListCellRenderer.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Runtime + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.runtime.swing.renderer; import java.awt.Component; -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 8560e7448a08cb70c1a181bbf64f63a771de2259 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 28 07:44:28 2009 +0000 remove a old empty package -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit dbc2adeddaa0ac612b959ee0a868fedbd23fd6a7 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 28 07:51:37 2009 +0000 ajout license --- .../org/nuiton/jaxx/plugin/DataBinding/Bean.java | 20 ++++++++++++++++++++ .../org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java | 20 ++++++++++++++++++++ .../java/org/nuiton/jaxx/plugin/DataBindingTest.java | 20 ++++++++++++++++++++ 3 files changed, 60 insertions(+) diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/Bean.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/Bean.java index c788f0b..1a10a6c 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/Bean.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/Bean.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Maven plugin + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package org.nuiton.jaxx.plugin.DataBinding; import java.beans.PropertyChangeListener; diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java index 6ba6af7..546612c 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Maven plugin + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package org.nuiton.jaxx.plugin.DataBinding; import java.beans.PropertyChangeListener; diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java index 6da3c76..c442745 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java @@ -1,3 +1,23 @@ +/* + * *##% + * JAXX Maven plugin + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package org.nuiton.jaxx.plugin; import java.io.IOException; -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit ebd88138a62a203b1b5796432e87eba5a461b054 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Oct 28 07:54:21 2009 +0000 remove binding from jaxx.compiler package --- .../src/main/java/jaxx/compiler/DataBinding.java | 119 ----- .../src/main/java/jaxx/compiler/DataSource.java | 485 --------------------- 2 files changed, 604 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java b/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java deleted file mode 100644 index e55ca04..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/DataBinding.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * *##% - * JAXX Compiler - * Copyright (C) 2008 - 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * ##%* - */ -package jaxx.compiler; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Represents a data binding in a JAXX file. <code>DataBinding</code> uses - * {@link DataSource} to track changes to a source expression and update - * the destination. - */ -public class DataBinding { - - /** - * Logger - */ - protected static final Log log = LogFactory.getLog(DataBinding.class); - /** - * Id of the data binding - */ - private String id; - /** - * source of the data binding - */ - private String source; - /** - * A Java snippet which will cause the destination property to be updated with the current value of - * the binding. - */ - private String assignment; - - /** - * Creates a new data binding. - * - * @param source the Java source code for the data binding expression - * @param dest the data binding destination in the form <code><id>.<propertyName></code> - * @param assignment Java snippet which will cause the destination property to be updated with the current value of the binding - */ - public DataBinding(String source, String dest, String assignment) { - this.id = dest; - this.source = source; - this.assignment = assignment; - if (log.isDebugEnabled()) { - log.debug("id=" + id + " assignement=" + assignment + " source=" + source); - } - } - - public String getId() { - return id; - } - - /** - * Compiles the data binding expression. This method calls methods in - * <code>JAXXCompiler</code> to add the Java code that performs the data - * binding setup. - * - * @param compiler compiler which includes the data binding - * @param quickNoDependencies true to optimize bindings with no dependencies by simply running them at startup time - * @return <code>true</code> if the expression has dependencies, <code>false</code> otherwise - * @throws CompilerException if a compilation error occurs - */ - public boolean compile(JAXXCompiler compiler, boolean quickNoDependencies) throws CompilerException { - - DataSource dataSource = new DataSource(id, source, compiler); - - // handles all of the listener additions - //TC-20091026 use 'this' instead of root object javaCode -// boolean result = dataSource.compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + compiler.getJavaCode(id) + ")"); - boolean result = dataSource.compile("new jaxx.runtime.DataBindingListener(this, " + compiler.getJavaCode(id) + ")"); - - String eol = JAXXCompiler.getLineSeparator(); - if (!result && quickNoDependencies) { - // layout is specially handled early in the chain - if (!id.endsWith(".layout")) { - compiler.appendInitDataBindings(assignment + eol); - } - return false; // no dependencies, just a static expression - } - if (compiler.hasProcessDataBinding()) { - compiler.appendProcessDataBinding(" else "); - } else { - compiler.appendProcessDataBinding(" "); - } - compiler.appendProcessDataBinding("if (" + compiler.getJavaCode(id) + ".equals($dest)) {" + eol); - String objectCode = dataSource.getObjectCode(); - //TC-20091026 no need to test objectCode not null if on root object -// boolean needTest = objectCode != null; - boolean needTest = objectCode != null && !compiler.getRootObject().getId().equals(objectCode); - if (needTest) { - compiler.appendProcessDataBinding(" if (" + objectCode + " != null) {" + eol); - compiler.appendProcessDataBinding(" "); - } - compiler.appendProcessDataBinding(" " + assignment.trim()); - if (needTest) { - compiler.appendProcessDataBinding(eol + " }"); - } - compiler.appendProcessDataBinding(eol + " }"); - return true; - } -} diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java b/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java deleted file mode 100644 index 9003f2d..0000000 --- a/jaxx-compiler/src/main/java/jaxx/compiler/DataSource.java +++ /dev/null @@ -1,485 +0,0 @@ -/* - * *##% - * JAXX Compiler - * Copyright (C) 2008 - 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * ##%* - */ -package jaxx.compiler; - -import jaxx.compiler.java.JavaField; -import jaxx.compiler.java.parser.JavaParser; -import jaxx.compiler.java.parser.JavaParserConstants; -import jaxx.compiler.java.parser.JavaParserTreeConstants; -import jaxx.compiler.java.parser.SimpleNode; -import jaxx.compiler.reflect.ClassDescriptor; -import jaxx.compiler.reflect.ClassDescriptorLoader; -import jaxx.compiler.reflect.FieldDescriptor; -import jaxx.compiler.reflect.MethodDescriptor; -import jaxx.compiler.tags.DefaultObjectHandler; -import jaxx.compiler.tags.TagManager; -import jaxx.compiler.types.TypeManager; - -import java.beans.Introspector; -import java.beans.PropertyChangeListener; -import java.io.StringReader; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -/** - * Represents a Java expression which fires a <code>PropertyChangeEvent</code> when it can be - * determined that its value may have changed. Events are fired on a "best effort" basis, and events - * may either be fired too often (the value has not actually changed) or not often enough (the value - * changed but no event was fired). - */ -public class DataSource { - - /** - * type attached to "null" constants in parsed expressions - */ - private class NULL { - } - /** - * id of data source - */ - private String id; - /** - * The Java source code for the expression. - */ - private String source; - /** - * The current <code>JAXXCompiler</code>. - */ - private JAXXCompiler compiler; - /** - * List of symbols which this data source expression depends on. - */ - private List<String> dependencySymbols = new ArrayList<String>(); - /** - * - */ - private StringBuffer addListenerCode = new StringBuffer(); - /** - * - */ - private StringBuffer removeListenerCode = new StringBuffer(); - /** - * - */ - private boolean compiled; - /** - * the delegate of property to be required - */ - private String objectCode; - - /** - * Creates a new data source. After creating a <code>DataSource</code>, use {@link #compile} - * to cause it to function at runtime. - * - * @param id the DataSource's id - * @param source the Java source code for the data source expression - * @param compiler the current <code>JAXXCompiler</code> - */ - public DataSource(String id, String source, JAXXCompiler compiler) { - this.id = id; - this.source = source; - this.compiler = compiler; - } - - public String getId() { - return id; - } - - public String getSource() { - return source; - } - - public String getObjectCode() { - return objectCode; - } - - /** - * Compiles the data source expression and listener. This method calls methods in <code>JAXXCompiler</code> - * to add the Java code that performs the data source setup. Adding listeners to <code>DataSource</code> is - * slightly more complicated than with ordinary classes, because <code>DataSource</code> only exists at compile - * time. You must pass in a Java expression which evaluates to a <code>PropertyChangeListener</code>; this - * expression will be compiled and evaluated at runtime to yield the <code>DataSource's</code> listener. - * - * @param propertyChangeListenerCode Java code snippet which evaluates to a <code>PropertyChangeListener</code> - * @return <code>true</code> if the expression has dependencies, <code>false</code> otherwise - * @throws CompilerException if a compilation error occurs - * @throws IllegalStateException if data source was already compiled - */ - public boolean compile(String propertyChangeListenerCode) throws CompilerException, IllegalStateException { - if (compiled) { - throw new IllegalStateException(this + " has already been compiled"); - } - String autoId = compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(getClass())); - JavaParser p = new JavaParser(new StringReader(source + ";")); - while (!p.Line()) { - SimpleNode node = p.popNode(); - scanNode(node, autoId); - } - - if (dependencySymbols.size() > 0) { - //TC 20081108 prefer add a real JavaField instead of raw code - //compiler.appendBodyCode("private PropertyChangeListener " + id + " = " + propertyChangeListenerCode + ";\n"); - compiler.addSimpleField(new JavaField(Modifier.PRIVATE, PropertyChangeListener.class.getSimpleName(), autoId, false, propertyChangeListenerCode)); - } - - compileListeners(); - compiled = true; - - return dependencySymbols.size() > 0; - } - - /** @return a list of symbols on which this data source depends. */ - public Collection<String> getDependencies() { - return Collections.unmodifiableList(dependencySymbols); - } - - /** - * Examines a node to identify any dependencies it contains. - * - * @param node node to scan - * @param listenerId id of listener - * @throws CompilerException ? - */ - private void scanNode(SimpleNode node, String listenerId) throws CompilerException { - switch (node.getId()) { - case JavaParserTreeConstants.JJTMETHODDECLARATION: - break; - case JavaParserTreeConstants.JJTFIELDDECLARATION: - break; - - default: - int count = node.jjtGetNumChildren(); - for (int i = 0; i < count; i++) { - scanNode(node.getChild(i), listenerId); - } - determineNodeType(node, listenerId); - } - } - - private ClassDescriptor determineLiteralType(SimpleNode node) { - assert node.getId() == JavaParserTreeConstants.JJTLITERAL; - if (node.jjtGetNumChildren() == 1) { - int childId = node.getChild(0).getId(); - if (childId == JavaParserTreeConstants.JJTBOOLEANLITERAL) { - return ClassDescriptorLoader.getClassDescriptor(boolean.class); - } - if (childId == JavaParserTreeConstants.JJTNULLLITERAL) { - return ClassDescriptorLoader.getClassDescriptor(NULL.class); - } - throw new RuntimeException("Expected BooleanLiteral or NullLiteral, found " + JavaParserTreeConstants.jjtNodeName[childId]); - } - int nodeId = node.firstToken.kind; - switch (nodeId) { - case JavaParserConstants.INTEGER_LITERAL: - if (node.firstToken.image.toLowerCase().endsWith("l")) { - return ClassDescriptorLoader.getClassDescriptor(long.class); - } - return ClassDescriptorLoader.getClassDescriptor(int.class); - case JavaParserConstants.CHARACTER_LITERAL: - return ClassDescriptorLoader.getClassDescriptor(char.class); - case JavaParserConstants.FLOATING_POINT_LITERAL: - if (node.firstToken.image.toLowerCase().endsWith("f")) { - return ClassDescriptorLoader.getClassDescriptor(float.class); - } - return ClassDescriptorLoader.getClassDescriptor(double.class); - case JavaParserConstants.STRING_LITERAL: - return ClassDescriptorLoader.getClassDescriptor(String.class); - default: - throw new RuntimeException("Expected literal token, found " + JavaParserConstants.tokenImage[nodeId]); - } - } - - /** - * Scans through a compound symbol (foo.bar.baz) to identify and track all trackable pieces of it. - * - * @param symbol symbol to scan - * @param contextClass current class context - * @param isMethod flag to search a method - * @param listenerId id of the listener - * @return the type of the symbol (or null if it could not be determined). - */ - private ClassDescriptor scanCompoundSymbol(String symbol, ClassDescriptor contextClass, boolean isMethod, String listenerId) { - String[] tokens = symbol.split("\\s*\\.\\s*"); - StringBuffer currentSymbol = new StringBuffer(); - StringBuffer tokensSeenSoFar = new StringBuffer(); - boolean accepted; // if this ends up false, it means we weren't able to figure out - // which object the method is being invoked on - boolean recognizeClassNames = true; - for (int j = 0; j < tokens.length - (isMethod ? 1 : 0); j++) { - accepted = false; - - if (tokensSeenSoFar.length() > 0) { - tokensSeenSoFar.append('.'); - } - tokensSeenSoFar.append(tokens[j]); - if (currentSymbol.length() > 0) { - currentSymbol.append('.'); - } - currentSymbol.append(tokens[j]); - - if (currentSymbol.indexOf(".") == -1) { - String memberName = currentSymbol.toString(); - CompiledObject object = compiler.getCompiledObject(memberName); - if (object != null) { - contextClass = object.getObjectClass(); - currentSymbol.setLength(0); - accepted = true; - recognizeClassNames = false; - } else { - try { - FieldDescriptor field = contextClass.getFieldDescriptor(memberName); - trackMemberIfPossible(tokensSeenSoFar.toString(), contextClass, field.getName(), false, listenerId); - contextClass = field.getType(); - currentSymbol.setLength(0); - accepted = true; - recognizeClassNames = false; - } catch (NoSuchFieldException e) { - if (j == 0 || j == 1 && tokens[0].equals(compiler.getRootObject().getId())) { // still in root context - FieldDescriptor[] newFields = compiler.getScriptFields(); - for (FieldDescriptor newField : newFields) { - if (newField.getName().equals(memberName)) { - addListener(tokensSeenSoFar.toString(), - null, - "addPropertyChangeListener(\"" + memberName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator(), - "removePropertyChangeListener(\"" + memberName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator()); - contextClass = newField.getType(); - assert contextClass != null : "script field '" + memberName + "' is defined, but has type null"; - currentSymbol.setLength(0); - accepted = true; - recognizeClassNames = false; - break; - } - } - } - } - } - } - if (currentSymbol.length() > 0 && recognizeClassNames) { - contextClass = TagManager.resolveClass(currentSymbol.toString(), compiler); - if (contextClass != null) { - currentSymbol.setLength(0); - //accepted = true; - //recognizeClassNames = false; - // TODO: for now we don't handle statics - return null; - } - } - if (!accepted) { - return null; - } - } - - return contextClass; - } - - /** - * Adds type information to nodes where possible, and as a side effect adds event listeners to nodes which - * can be tracked. - * - * @param expression the node to scan - * @param listenerId id of the listener - * @return the class descriptor of the return type or null - */ - private ClassDescriptor determineExpressionType(SimpleNode expression, String listenerId) { - assert expression.getId() == JavaParserTreeConstants.JJTPRIMARYEXPRESSION; - SimpleNode prefix = expression.getChild(0); - if (prefix.jjtGetNumChildren() == 1) { - int type = prefix.getChild(0).getId(); - if (type == JavaParserTreeConstants.JJTLITERAL || type == JavaParserTreeConstants.JJTEXPRESSION) { - prefix.setJavaType(prefix.getChild(0).getJavaType()); - } else if (type == JavaParserTreeConstants.JJTNAME && expression.jjtGetNumChildren() == 1) // name with no arguments after it - { - prefix.setJavaType(scanCompoundSymbol(prefix.getText().trim(), compiler.getRootObject().getObjectClass(), false, listenerId)); - } - } - - if (expression.jjtGetNumChildren() == 1) { - return prefix.getJavaType(); - } - - ClassDescriptor contextClass = prefix.getJavaType(); - if (contextClass == null) { - contextClass = compiler.getRootObject().getObjectClass(); - } - String lastNode = prefix.getText().trim(); - - for (int i = 1; i < expression.jjtGetNumChildren(); i++) { - SimpleNode suffix = expression.getChild(i); - if (suffix.jjtGetNumChildren() == 1 && suffix.getChild(0).getId() == JavaParserTreeConstants.JJTARGUMENTS) { - if (suffix.getChild(0).jjtGetNumChildren() == 0) { - // at the moment only no-argument methods are trackable - contextClass = scanCompoundSymbol(lastNode, contextClass, true, listenerId); - if (contextClass == null) { - return null; - } - int dotPos = lastNode.lastIndexOf("."); - String code = dotPos == -1 ? "" : lastNode.substring(0, dotPos); - for (int j = i - 2; j >= 0; j--) { - code = expression.getChild(j).getText() + code; - } - if (code.length() == 0) { - code = compiler.getRootObject().getJavaCode(); - } - String methodName = lastNode.substring(dotPos + 1).trim(); - try { - MethodDescriptor method = contextClass.getMethodDescriptor(methodName); - trackMemberIfPossible(code, contextClass, method.getName(), true, listenerId); - return method.getReturnType(); - } catch (NoSuchMethodException e) { - // happens for methods defined in the current JAXX file via scripts - String propertyName = null; - if (methodName.startsWith("is")) { - propertyName = Introspector.decapitalize(methodName.substring("is".length())); - } else if (methodName.startsWith("get")) { - propertyName = Introspector.decapitalize(methodName.substring("get".length())); - } - if (propertyName != null) { - MethodDescriptor[] newMethods = compiler.getScriptMethods(); - for (MethodDescriptor newMethod : newMethods) { - if (newMethod.getName().equals(methodName)) { - addListener(compiler.getRootObject().getId(), - null, - "addPropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator(), - "removePropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator()); - contextClass = newMethod.getReturnType(); - break; - } - } - } - } - } - } - lastNode = suffix.getText().trim(); - if (lastNode.startsWith(".")) { - lastNode = lastNode.substring(1); - } - } - - return null; - } - - private void trackMemberIfPossible(String objectCode, ClassDescriptor objectClass, String memberName, boolean method, String listenerId) { - if (objectClass.isInterface()) { - // might be technically possible to track in some cases, but for now - // we can't create a DefaultObjectHandler for interfaces - return; - } - - DefaultObjectHandler handler = TagManager.getTagHandler(objectClass); - try { - if (handler.isMemberBound(memberName)) { - addListener(objectCode + "." + memberName + (method ? "()" : ""), - objectCode, - handler.getAddMemberListenerCode(objectCode, id, memberName, listenerId, compiler), - handler.getRemoveMemberListenerCode(objectCode, id, memberName, listenerId, compiler)); - } - } catch (UnsupportedAttributeException e) { - // ignore -- this is thrown for methods like toString(), for which there is no tracking and - // no setting support - } - } - - /** - * Adds type information to nodes where possible, and as a side effect adds event listeners to nodes which - * can be tracked. - * - * @param node node to scan - * @param listenerId the listener id - */ - private void determineNodeType(SimpleNode node, String listenerId) { - ClassDescriptor type = null; - if (node.jjtGetNumChildren() == 1) { - type = node.getChild(0).getJavaType(); - } - switch (node.getId()) { - case JavaParserTreeConstants.JJTCLASSORINTERFACETYPE: - type = ClassDescriptorLoader.getClassDescriptor(Class.class); - break; - case JavaParserTreeConstants.JJTPRIMARYEXPRESSION: - type = determineExpressionType(node, listenerId); - break; - case JavaParserTreeConstants.JJTLITERAL: - type = determineLiteralType(node); - break; - case JavaParserTreeConstants.JJTCASTEXPRESSION: - type = TagManager.resolveClass(node.getChild(0).getText(), compiler); - break; - } - node.setJavaType(type); - } - - private void addListener(String dependencySymbol, String objectCode, String addCode, String removeCode) { - this.objectCode = objectCode; - //TC-20091026 no need to test objectCode not null if on root object - boolean needTest = objectCode != null && !compiler.getRootObject().getId().equals(objectCode); -// boolean needTest = objectCode != null; - if (!dependencySymbols.contains(dependencySymbol)) { - dependencySymbols.add(dependencySymbol); - String eol = JAXXCompiler.getLineSeparator(); - addListenerCode.append(eol); - if (needTest) { - addListenerCode.append(" if (").append(objectCode).append(" != null) {").append(eol); - addListenerCode.append(" "); - } - addListenerCode.append(" ").append(addCode.trim()); - if (needTest) { - addListenerCode.append(eol).append(" }"); - } - - removeListenerCode.append(eol); - if (needTest) { - removeListenerCode.append(" if (").append(objectCode).append(" != null) {").append(eol); - removeListenerCode.append(" "); - } - removeListenerCode.append(" ").append(removeCode.trim()); - if (needTest) { - removeListenerCode.append(eol).append(" }"); - } - } - } - - private void compileListeners() { - String javaCodeId = TypeManager.getJavaCode(id); - String eol = JAXXCompiler.getLineSeparator(); - if (addListenerCode.length() > 0) { - if (compiler.hasApplyDataBinding()) { - compiler.appendApplyDataBinding(" else "); - } -// compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol); - compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {"); - compiler.appendApplyDataBinding(" " + addListenerCode + eol); - compiler.appendApplyDataBinding("}"); - } - - if (removeListenerCode.length() > 0) { - if (compiler.hasRemoveDataBinding()) { - compiler.appendRemoveDataBinding(" else "); - } -// compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol); - compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {"); - compiler.appendRemoveDataBinding(" " + removeListenerCode + eol); - compiler.appendRemoveDataBinding("}"); - } - } -} -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 0156041f3e0e8ab1b651b74538dfcdd7a080f3d4 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 29 01:42:54 2009 +0000 - add a DecoratorProvider to store your decorators - deprecate all states in DecoratorUtils (use a DecoratorProvider to store decorators) --- .../jaxx/runtime/decorator/DecoratorProvider.java | 226 +++++++++++++++++++++ .../jaxx/runtime/decorator/DecoratorUtils.java | 48 +++-- .../jaxx/runtime/decorator/JXPathDecorator.java | 30 +-- .../runtime/decorator/DecoratorProviderTest.java | 153 ++++++++++++++ 4 files changed, 425 insertions(+), 32 deletions(-) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorProvider.java b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorProvider.java new file mode 100644 index 0000000..9788320 --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorProvider.java @@ -0,0 +1,226 @@ +package jaxx.runtime.decorator; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.util.ArrayList; +import java.util.List; + +/** + * A decorator provider. + * <p/> + * Implements the method {@link #loadDecorators()} to fill the decorators availables. + * <p/> + * Then can obtain decorator via the methods {@code getDecorator(...)} + * <p/> + * User: chemit + * Date: 28 oct. 2009 + * Time: 19:40:48 + */ +public abstract class DecoratorProvider { + + /** + * Logger + */ + private static final Log log = LogFactory.getLog(JXPathDecorator.class); + /** + * Registred decorators. + */ + protected List<DecoratorContext<?>> decorators; + + public DecoratorProvider() { + loadDecorators(); + } + + /** + * Load all decorators of the provider + */ + protected abstract void loadDecorators(); + + /** + * Obtain a decorator for the given object. + * + * @param object object of decorated object + * @param <O> object of decorated object + * @return the decorator or {@code null} if not found + */ + @SuppressWarnings({"unchecked"}) + public <O> Decorator<O> getDecorator(O object) { + return getDecorator(object, null); + } + + /** + * Obtain a decorator given a object and an extra name to qualify the context. + * + * @param object object of decorated object + * @param name extra name to qualify the decorator to use + * @param <O> object of decorated object + * @return the decorator or {@code null} if not found + */ + @SuppressWarnings({"unchecked"}) + public <O> Decorator<O> getDecorator(O object, String name) { + Class<O> k = (Class<O>) object.getClass(); + return getDecorator(k, name); + } + + /** + * Obtain a decorator given a type. + * + * @param type type of decorated object + * @param <O> type of decorated object + * @return the decorator or {@code null} if not found + */ + public <O> Decorator<O> getDecorator(Class<O> type) { + return getDecorator(type, null); + } + + /** + * Obtain a decorator given a type and a extra name. + * + * @param type type of decorated object + * @param name extra name to qualify the decorator to use + * @param <O> type of decorated object + * @return the decorator or {@code null} if not found + */ + public <O> Decorator<O> getDecorator(Class<O> type, String name) { + DecoratorContext<O> d = getDecoratorContext(type, name); + return d == null ? null : d.getDecorator(); + } + + public void reload() { + clear(); + loadDecorators(); + } + + public void clear() { + if (decorators != null) { + decorators.clear(); + } + } + + protected void registerPropertyDecorator(Class<?> klass, String expression) { + registerPropertyDecorator(klass, null, expression); + } + + protected void registerJXPathDecorator(Class<?> klass, String expression) { + registerJXPathDecorator(klass, null, expression); + } + + protected void registerMultiJXPathDecorator(Class<?> klass, String expression, String separator, String separatorReplacement) { + registerMultiJXPathDecorator(klass, null, expression, separator, separatorReplacement); + } + + protected void registerPropertyDecorator(Class<?> klass, String name, String expression) { + Decorator<?> decorator = DecoratorUtils.newPropertyDecorator(klass, expression); + registerDecorator(name, decorator); + } + + protected void registerJXPathDecorator(Class<?> klass, String name, String expression) { + Decorator<?> decorator = DecoratorUtils.newJXPathDecorator(klass, expression); + registerDecorator(name, decorator); + } + + protected void registerMultiJXPathDecorator(Class<?> klass, String name, String expression, String separator, String separatorReplacement) { + Decorator<?> decorator = DecoratorUtils.newMultiJXPathDecorator(klass, expression, separator, separatorReplacement); + registerDecorator(name, decorator); + } + + protected void registerDecorator(Decorator<?> decorator) { + registerDecorator(null, decorator); + } + + /** + * Register a new decorator in the cache of the provider. + * + * @param <T> type of data decorated + * @param context the name decorator + * @param decorator the decorator to register + */ + protected <T> void registerDecorator(String context, Decorator<T> decorator) { + + // obtain the decorator context + DecoratorContext<?> result = getDecoratorContext(decorator.getInternalClass(), context); + + if (result != null) { + throw new IllegalArgumentException("there is an already register decorator with context " + result); + } + + DecoratorContext<T> decoratorContext = new DecoratorContext<T>(context, decorator); + if (log.isDebugEnabled()) { + log.debug(decoratorContext); + } + getDecorators().add(decoratorContext); + } + + protected List<DecoratorContext<?>> getDecorators() { + if (decorators == null) { + decorators = new ArrayList<DecoratorContext<?>>(); + } + return decorators; + } + + @SuppressWarnings({"unchecked"}) + protected <T> DecoratorContext<T> getDecoratorContext(Class<T> type, String context) { + DecoratorContext<T> result = null; + if (decorators != null) { + for (DecoratorContext<?> d : decorators) { + if (type == null) { + if (d.accept(context)) { + result = (DecoratorContext<T>) d; + break; + } + continue; + } + if (d.accept(type, context)) { + result = (DecoratorContext<T>) d; + break; + } + } + } + return result; + } + + public static class DecoratorContext<T> { + + /** + * the context name of the decorator + */ + final String context; + /** + * the decorator + */ + final Decorator<T> decorator; + + public DecoratorContext(String context, Decorator<T> decorator) { + this.context = context; + this.decorator = decorator; + } + + public String getContext() { + return context; + } + + public Decorator<T> getDecorator() { + return decorator; + } + + public Class<T> getType() { + return decorator.getInternalClass(); + } + + public boolean accept(Class<?> type, String context) { + boolean accept = getType().isAssignableFrom(type) && accept(context); + return accept; + } + + public boolean accept(String context) { + return ((this.context == null && context == null) || (this.context != null && this.context.equals(context))); + } + + @Override + public String toString() { + return super.toString() + "<type: " + getType().getName() + ", context :" + context + ">"; + } + } + +} diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java index a32cb02..d46d38d 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java @@ -20,18 +20,14 @@ */ package jaxx.runtime.decorator; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.StringTokenizer; -import jaxx.runtime.decorator.JXPathDecorator.JXPathComparator; import jaxx.runtime.decorator.JXPathDecorator.Context; +import jaxx.runtime.decorator.JXPathDecorator.JXPathComparator; + +import java.util.*; /** - * * Some usefull methods on {@link Decorator} to create, decorators and obtain decorators. - * + * <p/> * To create a new decorator, use one of the methods : * <ul> * <li>{@link #newPropertyDecorator(Class, String)}</li> @@ -40,7 +36,7 @@ import jaxx.runtime.decorator.JXPathDecorator.Context; * <li>{@link #newMultiJXPathDecorator(Class, String, String, String)})</li> * </ul> * <p/> - * + * <p/> * To register a new decorator, use the method {@link #register(String, Decorator)}. * <p/> * To obtain a registred decorator, use the method {@link #get(String)} @@ -50,7 +46,7 @@ import jaxx.runtime.decorator.JXPathDecorator.Context; * To sort a list of data, using a {@link JXPathDecorator}, use the method * {@link #sort(JXPathDecorator, List, int)}. * <p/> - * + * * @author tony * @since 1.7.2 (was previously {@code jaxx.runtime.DecoratorUtils}) */ @@ -58,11 +54,13 @@ public class DecoratorUtils { /** * Registred decorators. + * @deprecated prefer use a {@link DecoratorProvider} */ + @Deprecated protected static List<DecoratorContext<?>> decorators; /** - * Factory method to instanciate a new {@link PropertyDecorator} for the + * Factory method to instanciate a new {@link PropertyDecorator} for the * given class {@code internlaClass} and a readable property name. * * @param internalClass the class of the objects decorated by the new decorator @@ -104,17 +102,17 @@ public class DecoratorUtils { } public static <O> MultiJXPathDecorator<O> newMultiJXPathDecorator(Class<O> internalClass, - String expression, - String separator) + String expression, + String separator) throws IllegalArgumentException, NullPointerException { return newMultiJXPathDecorator(internalClass, expression, separator, separator); } public static <O> MultiJXPathDecorator<O> newMultiJXPathDecorator(Class<O> internalClass, - String expression, - String separator, - String separatorReplacement) + String expression, + String separator, + String separatorReplacement) throws IllegalArgumentException, NullPointerException { Context<O>[] contexts = createMultiJXPathContext(expression, separator, separatorReplacement); @@ -122,11 +120,13 @@ public class DecoratorUtils { return new MultiJXPathDecorator<O>(internalClass, expression, separator, separatorReplacement, contexts); } + @Deprecated public static <T> Decorator<T> get(String context) { Decorator<T> result = get(null, context); return result; } + @Deprecated public static <T> Decorator<T> get(Class<T> type, String context) { DecoratorContext<T> decoratorContext = getDecoratorContext(type, context); Decorator<T> result = decoratorContext == null ? null : decoratorContext.getDecorator(); @@ -136,10 +136,11 @@ public class DecoratorUtils { /** * Register a new decorator in the cache. * - * @param <T> type of data decorated - * @param context the name decorator + * @param <T> type of data decorated + * @param context the name decorator * @param decorator the decorator to register */ + @Deprecated public static <T> void register(String context, Decorator<T> decorator) { DecoratorContext<T> result = getDecoratorContext(decorator.getInternalClass(), context); @@ -154,6 +155,7 @@ public class DecoratorUtils { decorators.add(new DecoratorContext<T>(context, decorator)); } + @Deprecated public static void clear() { if (decorators != null) { decorators.clear(); @@ -164,7 +166,7 @@ public class DecoratorUtils { * Sort a list of data based on the first token property of a given context * in a given decorator. * - * @param <O> type of data to sort + * @param <O> type of data to sort * @param decorator the decorator to use to sort * @param datas the list of data to sort * @param pos the index of context to used in decorator to obtain sorted property. @@ -188,6 +190,7 @@ public class DecoratorUtils { } @SuppressWarnings({"unchecked"}) + @Deprecated protected static <T> DecoratorContext<T> getDecoratorContext(Class<T> type, String context) { DecoratorContext<T> result = null; if (decorators != null) { @@ -208,9 +211,16 @@ public class DecoratorUtils { return result; } + @Deprecated public static class DecoratorContext<T> { + /** + * the context name of the decorator + */ final String context; + /** + * the decorator + */ final Decorator<T> decorator; public DecoratorContext(String context, Decorator<T> decorator) { diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java index 3e99922..54c2e48 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/JXPathDecorator.java @@ -24,14 +24,10 @@ import org.apache.commons.jxpath.JXPathContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import java.util.Arrays; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** - * JXPath decorator based on {@link String#format(String, Object[])} method. + * JXPath decorator based on {@link String#format(String, Object...)} method. * <p/> * To use it, give to him a expression where all jxpath to apply on bean are boxed in <code>${}</code>. * <p/> @@ -46,10 +42,10 @@ import java.util.Map; * assert "expr = %1$s" == d.toString(d); * </pre> * - * @param <O> type of data to decorate * @author chemit + * @param <O> type of data to decorate * @see Decorator - * @since 1.7.2 (was previously {@code jaxx.runtime.JXPathDecorat}) + * @since 1.7.2 (was previously {@code jaxx.runtime.JXPathDecorator}) */ public class JXPathDecorator<O> extends Decorator<O> { @@ -58,11 +54,17 @@ public class JXPathDecorator<O> extends Decorator<O> { * Logger */ private static final Log log = LogFactory.getLog(JXPathDecorator.class); - /** the computed context of the decorator */ + /** + * the computed context of the decorator + */ protected Context<O> context; - /** nb jxpath tokens to compute */ + /** + * nb jxpath tokens to compute + */ protected int nbToken; - /** the initial expression used to compute the decorator context. */ + /** + * the initial expression used to compute the decorator context. + */ protected String initialExpression; protected JXPathDecorator(Class<O> internalClass, String expression, Context<O> context) throws IllegalArgumentException, NullPointerException { @@ -174,11 +176,13 @@ public class JXPathDecorator<O> extends Decorator<O> { public static class Context<O> implements java.io.Serializable { /** - * expression to format using {@link String#format(String, Object[])}, all variables are compute + * expression to format using {@link String#format(String, Object...)}, all variables are compute * using using the jxpath tokens. */ protected String expression; - /** list of jxpath tokens to apply on expression */ + /** + * list of jxpath tokens to apply on expression + */ protected String[] tokens; protected transient Comparator<O> comparator; private static final long serialVersionUID = 1L; diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/decorator/DecoratorProviderTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/decorator/DecoratorProviderTest.java new file mode 100644 index 0000000..4c8b277 --- /dev/null +++ b/jaxx-runtime/src/test/java/jaxx/runtime/decorator/DecoratorProviderTest.java @@ -0,0 +1,153 @@ +package jaxx.runtime.decorator; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.File; + +/** + * User: chemit + * Date: 28 oct. 2009 + * Time: 21:28:46 + */ +public class DecoratorProviderTest { + private static final String BY_NAME = "name"; + + static class MyDecoratorProvider extends DecoratorProvider { + + @Override + protected void loadDecorators() { + + registerPropertyDecorator(File.class, "name"); + registerPropertyDecorator(File.class, BY_NAME, "parent"); + + + registerJXPathDecorator(Class.class, "${simpleName}$s"); + registerJXPathDecorator(Class.class, BY_NAME, "${name}$s"); + + registerMultiJXPathDecorator(Data.class, "${name}$s", "-", " "); + registerMultiJXPathDecorator(Data.class, BY_NAME, "${pos}$d", "-", " "); + } + } + + static DecoratorProvider provider; + + @BeforeClass + public static void beforeTest() throws Exception { + provider = new MyDecoratorProvider(); + } + + @Test + public void testGetDecoratorByObject() throws Exception { + + File f = new File("myFile"); + Data d = new Data(0, "name"); + Class<?> k = File.class; + + Decorator<File> fileDecorator = provider.getDecorator(f); + Assert.assertNotNull(fileDecorator); + Assert.assertEquals(File.class, fileDecorator.getInternalClass()); + Assert.assertEquals("myFile", fileDecorator.toString(f)); + + Decorator<?> classDecorator = provider.getDecorator(Class.class); + Assert.assertNotNull(classDecorator); + Assert.assertEquals(Class.class, classDecorator.getInternalClass()); + Assert.assertEquals("File", classDecorator.toString(k)); + + Decorator<Data> dataDecorator = provider.getDecorator(d); + Assert.assertNotNull(dataDecorator); + Assert.assertEquals(Data.class, dataDecorator.getInternalClass()); + Assert.assertEquals("name", dataDecorator.toString(d)); + } + + @Test + public void testGetDecoratorByObjectAndName() throws Exception { + + File f = new File("myFile"); + Data d = new Data(0, "name"); + Class<?> k = File.class; + + Decorator<File> fileDecorator = provider.getDecorator(f, BY_NAME); + Assert.assertNotNull(fileDecorator); + Assert.assertEquals(File.class, fileDecorator.getInternalClass()); + Assert.assertEquals("null", fileDecorator.toString(f)); + + Decorator<Class> classDecorator = provider.getDecorator(Class.class, BY_NAME); + Assert.assertNotNull(classDecorator); + Assert.assertEquals(Class.class, classDecorator.getInternalClass()); + Assert.assertEquals("java.io.File", classDecorator.toString(k)); + + + Decorator<Data> dataDecorator = provider.getDecorator(d, BY_NAME); + Assert.assertNotNull(dataDecorator); + Assert.assertEquals(Data.class, dataDecorator.getInternalClass()); + Assert.assertEquals("0", dataDecorator.toString(d)); + } + + @Test + public void testGetDecoratorByType() throws Exception { + + File f = new File("myFile"); + Data d = new Data(0, "name"); + Class<?> k = File.class; + + Decorator<File> fileDecorator = provider.getDecorator(File.class); + Assert.assertNotNull(fileDecorator); + Assert.assertEquals(File.class, fileDecorator.getInternalClass()); + Assert.assertEquals("myFile", fileDecorator.toString(f)); + + Decorator<Class> classDecorator = provider.getDecorator(Class.class); + Assert.assertNotNull(classDecorator); + Assert.assertEquals(Class.class, classDecorator.getInternalClass()); + Assert.assertEquals("File", classDecorator.toString(k)); + + Decorator<Data> dataDecorator = provider.getDecorator(Data.class); + Assert.assertNotNull(dataDecorator); + Assert.assertEquals(Data.class, dataDecorator.getInternalClass()); + Assert.assertEquals("name", dataDecorator.toString(d)); + } + + @Test + public void testGetDecoratorByTypeAndName() throws Exception { + File f = new File("myFile"); + Data d = new Data(0, "name"); + Class<?> k = File.class; + + Decorator<File> fileDecorator = provider.getDecorator(File.class, BY_NAME); + Assert.assertNotNull(fileDecorator); + Assert.assertEquals(File.class, fileDecorator.getInternalClass()); + Assert.assertEquals("null", fileDecorator.toString(f)); + + Decorator<Class> classDecorator = provider.getDecorator(Class.class, BY_NAME); + Assert.assertNotNull(classDecorator); + Assert.assertEquals(Class.class, classDecorator.getInternalClass()); + Assert.assertEquals("java.io.File", classDecorator.toString(k)); + + + Decorator<Data> dataDecorator = provider.getDecorator(Data.class, BY_NAME); + Assert.assertNotNull(dataDecorator); + Assert.assertEquals(Data.class, dataDecorator.getInternalClass()); + Assert.assertEquals("0", dataDecorator.toString(d)); + } + + + @Test + public void testReload() throws Exception { + + int nb = provider.getDecorators().size(); + Assert.assertTrue(nb > 0); + + provider.reload(); + + Assert.assertEquals(nb, provider.getDecorators().size()); + } + + @Test + public void testClear() throws Exception { + provider.clear(); + + Assert.assertTrue(provider.getDecorators().isEmpty()); + } + +} -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 8d981876146bbd02d1c4cac22e1653531db466f8 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 29 02:08:58 2009 +0000 add a DecoratorProviderListCellRenderer --- .../DecoratorProviderListCellRenderer.java | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorProviderListCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorProviderListCellRenderer.java new file mode 100644 index 0000000..1f34548 --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorProviderListCellRenderer.java @@ -0,0 +1,53 @@ +package jaxx.runtime.swing.renderer; + +import jaxx.runtime.decorator.Decorator; +import jaxx.runtime.decorator.DecoratorProvider; + +import javax.swing.*; +import java.awt.*; + +/** + * A {@link ListCellRenderer} which use decorators from the {@link #provider} to obtain the text to display. + * + * The interest of this renderer is to define a unique renderer for your application (put it in JAXXContext) + * and then use it simply :) + * + * User: chemit + * Date: 29 oct. 2009 + * Time: 03:00:53 + * @since 2.0.0 + * @see DecoratorProvider + */ +public class DecoratorProviderListCellRenderer implements ListCellRenderer { + + /** + * Delegate cell renderer + */ + protected ListCellRenderer delegate; + + /** + * provider of decorators + */ + protected DecoratorProvider provider; + + public DecoratorProviderListCellRenderer(DecoratorProvider provider) { + this(new DefaultListCellRenderer(), provider); + } + + public DecoratorProviderListCellRenderer(ListCellRenderer delegate, DecoratorProvider provider) { + this.delegate = delegate; + this.provider = provider; + } + + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + if (value != null) { + Decorator<?> decorator = provider.getDecorator(value); + + if (decorator != null) { + value = decorator.toString(value); + } + } + return delegate.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + } +} -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit fe25968fa478801f14330ced814999792543e1c0 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 29 14:55:21 2009 +0000 add a DecoratorProviderTableCellRenderer --- .../DecoratorProviderTableCellRenderer.java | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorProviderTableCellRenderer.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorProviderTableCellRenderer.java new file mode 100644 index 0000000..175ab10 --- /dev/null +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/renderer/DecoratorProviderTableCellRenderer.java @@ -0,0 +1,56 @@ +package jaxx.runtime.swing.renderer; + +import jaxx.runtime.decorator.Decorator; +import jaxx.runtime.decorator.DecoratorProvider; + +import javax.swing.*; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.TableCellRenderer; +import java.awt.*; + +/** + * A {@link TableCellRenderer} which use decorators from the {@link #provider} to obtain the text to display. + * <p/> + * The interest of this renderer is to define a unique renderer for your application (put it in JAXXContext) + * and then use it simply :) + * <p/> + * User: chemit + * Date: 29 oct. 2009 + * Time: 03:00:53 + * + * @see DecoratorProvider + * @since 2.0.0 + */ +public class DecoratorProviderTableCellRenderer implements TableCellRenderer { + + /** + * Delegate cell renderer + */ + protected TableCellRenderer delegate; + + /** + * provider of decorators + */ + protected DecoratorProvider provider; + + public DecoratorProviderTableCellRenderer(DecoratorProvider provider) { + this(new DefaultTableCellRenderer(), provider); + } + + public DecoratorProviderTableCellRenderer(TableCellRenderer delegate, DecoratorProvider provider) { + this.delegate = delegate; + this.provider = provider; + } + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasfocus, int row, int column) { + if (value != null) { + Decorator<?> decorator = provider.getDecorator(value); + + if (decorator != null) { + value = decorator.toString(value); + } + } + return delegate.getTableCellRendererComponent(table, value, isSelected, hasfocus, row, column); + } +} \ No newline at end of file -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 25b43e3c7686e768bbe685fa3638bd631b9486b6 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 29 16:48:10 2009 +0000 - use DecoratorProviderListCellRenderer --- .../src/main/java/jaxx/demo/DemoUIHandler.java | 36 +++++++++++++--------- jaxx-demo/src/main/java/jaxx/demo/RunDemo.java | 28 ++++++++++++----- .../jaxx/navigation/FullNavigationTreeHelper.java | 30 +++++++++--------- .../navigation/FullNavigationTreeModelBuilder.java | 13 +++++--- .../jaxx/navigation/content/ActorsContentUI.jaxx | 5 ++- .../jaxx/navigation/content/ContentUI.jaxx | 9 ------ .../jaxx/navigation/content/MoviesContentUI.jaxx | 5 ++- 7 files changed, 68 insertions(+), 58 deletions(-) diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java b/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java index c7a1e42..ca72d26 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java @@ -20,26 +20,28 @@ */ package jaxx.demo; -import jaxx.runtime.swing.ErrorDialogUI; import jaxx.runtime.JAXXContext; +import jaxx.runtime.context.DefaultApplicationContext; +import jaxx.runtime.context.JAXXContextEntryDef; import jaxx.runtime.context.JAXXInitialContext; +import jaxx.runtime.decorator.DecoratorProvider; +import jaxx.runtime.swing.AboutPanel; +import jaxx.runtime.swing.ErrorDialogUI; +import jaxx.runtime.swing.editor.config.ConfigUI; +import jaxx.runtime.swing.editor.config.ConfigUIBuilder; +import jaxx.runtime.swing.editor.config.model.ConfigUIModel; import jaxx.runtime.swing.navigation.NavigationTreeNode; +import jaxx.runtime.swing.renderer.DecoratorProviderListCellRenderer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.i18n.I18n; import static org.nuiton.i18n.I18n._; import static org.nuiton.i18n.I18n.n_; -import java.awt.Desktop; +import javax.swing.*; +import java.awt.*; import java.net.URL; import java.util.Locale; -import javax.swing.SwingUtilities; -import jaxx.runtime.context.DefaultApplicationContext; -import jaxx.runtime.context.JAXXContextEntryDef; -import jaxx.runtime.swing.AboutPanel; -import jaxx.runtime.swing.editor.config.ConfigUI; -import jaxx.runtime.swing.editor.config.ConfigUIBuilder; -import jaxx.runtime.swing.editor.config.model.ConfigUIModel; -import org.nuiton.i18n.I18n; /** * Le handler de l'ui principale. @@ -49,7 +51,9 @@ import org.nuiton.i18n.I18n; */ public class DemoUIHandler { //implements JAXXHelp { - /** to use log facility, just put in your code: log.info(\"...\"); */ + /** + * to use log facility, just put in your code: log.info(\"...\"); + */ static private Log log = LogFactory.getLog(DemoUIHandler.class); static final JAXXContextEntryDef<DemoUI> MAIN_UI_ENTRY_DEF = jaxx.runtime.Util.newContextEntryDef("mainui", DemoUI.class); @@ -78,6 +82,10 @@ public class DemoUIHandler { //implements JAXXHelp { // share config context.add(rootContext.getContextValue(DemoConfig.class)); + // share a unique DecoratorProviderListCellRenderer + DecoratorProvider decoratorProvider = rootContext.getContextValue(DecoratorProvider.class); + context.add(new DecoratorProviderListCellRenderer(decoratorProvider)); + // instanciate ui DemoUI ui = new DemoUI(context); @@ -145,7 +153,7 @@ public class DemoUIHandler { //implements JAXXHelp { // scan main ui DemoUI ui = getUI(rootContext); - NavigationTreeNode node = null; + NavigationTreeNode node; String nodePath = null; if (ui != null) { @@ -181,7 +189,7 @@ public class DemoUIHandler { //implements JAXXHelp { * mode console (c'est à dire en mode plein écran exclusif), sinon on * passe en mode fenetré normal. * - * @param context l'ui principale de l'application + * @param context l'ui principale de l'application * @param fullscreen le nouvel état requis. */ public void changeScreen(JAXXContext context, final boolean fullscreen) { @@ -250,7 +258,7 @@ public class DemoUIHandler { //implements JAXXHelp { ConfigUIBuilder.showConfigUI(configUI, ui, false); } -// @Override + // @Override public void showHelp(JAXXContext context, String helpId) { // DemoUI mainUI = getUI(context); // ObserveHelpBroker helpBroker = context.getContextValue(ObserveHelpBroker.class); diff --git a/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java b/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java index 7a54fe7..ee9de55 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java +++ b/jaxx-demo/src/main/java/jaxx/demo/RunDemo.java @@ -20,7 +20,11 @@ */ package jaxx.demo; +import jaxx.demo.component.jaxx.navigation.Movie; +import jaxx.demo.component.jaxx.navigation.People; +import jaxx.runtime.SwingUtil; import jaxx.runtime.context.DefaultApplicationContext; +import jaxx.runtime.decorator.DecoratorProvider; import jaxx.runtime.swing.ErrorDialogUI; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -28,10 +32,7 @@ import org.nuiton.i18n.I18n; import static org.nuiton.i18n.I18n._; import org.nuiton.util.StringUtil; -import jaxx.runtime.SwingUtil; - /** - * * @author chemit */ public class RunDemo { @@ -41,17 +42,13 @@ public class RunDemo { */ private static Log log = LogFactory.getLog(RunDemo.class); /** - * When application was started - */ - private static long startingTime = System.nanoTime(); - /** * The singleton instance of the main context */ protected static DefaultApplicationContext context; public static void main(String[] args) { - startingTime = System.nanoTime(); + long startingTime = System.nanoTime(); log.info("JAXX Demo start at " + new java.util.Date() + " args: " + java.util.Arrays.toString(args)); try { @@ -81,6 +78,20 @@ public class RunDemo { // share the config rootContext.setContextValue(config); + // init decorator provider + DecoratorProvider p = new DecoratorProvider() { + + @Override + protected void loadDecorators() { + + registerMultiJXPathDecorator(Movie.class, "${title}$s##${year}$s", "##", " - "); + registerMultiJXPathDecorator(People.class, "${firstName}$s##${lastName}$s", "##", " "); + } + }; + + // share the decorator provider + rootContext.setContextValue(p); + long t00 = System.nanoTime(); // init i18n @@ -141,6 +152,7 @@ public class RunDemo { * l'context partagée. * <p/> * Note : Cette méthode ne peut être appelée qu'une seule fois. + * * @return l'context partagée * @throws IllegalStateException si un contexte applicatif a déja été positionné. */ diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java index e11ddd9..df5fab8 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeHelper.java @@ -20,10 +20,10 @@ */ package jaxx.demo.component.jaxx.navigation; -import jaxx.runtime.JAXXObject; import jaxx.runtime.JAXXContext; +import jaxx.runtime.JAXXObject; +import jaxx.runtime.Util; import jaxx.runtime.context.JAXXContextEntryDef; -import jaxx.runtime.decorator.DecoratorUtils; import jaxx.runtime.swing.CardLayout2; import jaxx.runtime.swing.ErrorDialogUI; import jaxx.runtime.swing.navigation.NavigationTreeHandler; @@ -34,11 +34,9 @@ import jaxx.runtime.swing.navigation.NavigationTreeModel; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; - +import javax.swing.*; import java.util.Arrays; import java.util.List; -import javax.swing.JPanel; -import jaxx.runtime.Util; /** * @@ -47,17 +45,17 @@ import jaxx.runtime.Util; */ public class FullNavigationTreeHelper extends NavigationTreeHelper { - static { - // register decorator one for all - - DecoratorUtils.register( - Movie.class.getSimpleName(), - DecoratorUtils.newMultiJXPathDecorator(Movie.class, "${title}$s##${year}$s", "##", " - ")); - - DecoratorUtils.register( - People.class.getSimpleName(), - DecoratorUtils.newMultiJXPathDecorator(People.class, "${firstName}$s##${lastName}$s", "##", " ")); - } +// static { +// // register decorator one for all +// +// DecoratorUtils.register( +// Movie.class.getSimpleName(), +// DecoratorUtils.newMultiJXPathDecorator(Movie.class, "${title}$s##${year}$s", "##", " - ")); +// +// DecoratorUtils.register( +// People.class.getSimpleName(), +// DecoratorUtils.newMultiJXPathDecorator(People.class, "${firstName}$s##${lastName}$s", "##", " ")); +// } /** * Logger */ diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeModelBuilder.java b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeModelBuilder.java index 7a80480..62d134f 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeModelBuilder.java +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeModelBuilder.java @@ -20,14 +20,17 @@ */ package jaxx.demo.component.jaxx.navigation; +import jaxx.demo.component.jaxx.navigation.content.ActorContentUI; +import jaxx.demo.component.jaxx.navigation.content.ActorsContentUI; +import jaxx.demo.component.jaxx.navigation.content.MovieContentUI; +import jaxx.demo.component.jaxx.navigation.content.MoviesContentUI; import jaxx.runtime.JAXXContext; import jaxx.runtime.decorator.Decorator; -import jaxx.runtime.decorator.DecoratorUtils; +import jaxx.runtime.decorator.DecoratorProvider; import jaxx.runtime.swing.navigation.NavigationTreeModelBuilder; import jaxx.runtime.swing.navigation.NavigationTreeNode; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import jaxx.demo.component.jaxx.navigation.content.*; import static org.nuiton.i18n.I18n._; import java.util.List; @@ -39,7 +42,6 @@ import java.util.List; */ public class FullNavigationTreeModelBuilder extends NavigationTreeModelBuilder { - private static final long serialVersionUID = 1l; /** * Logger */ @@ -67,8 +69,9 @@ public class FullNavigationTreeModelBuilder extends NavigationTreeModelBuilder { } - Decorator<Movie> mDecorator = DecoratorUtils.get(Movie.class.getSimpleName()); - Decorator<People> pDecorator = DecoratorUtils.get(People.class.getSimpleName()); + DecoratorProvider decoratorProvider = getModel().getContext().getContextValue(DecoratorProvider.class); + Decorator<Movie> mDecorator = decoratorProvider.getDecorator(Movie.class); + Decorator<People> pDecorator = decoratorProvider.getDecorator(People.class); // construction du noeud root // il ne contient pas de context et ne sera pas visible diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx index 7c0746e..e8e823a 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx @@ -23,8 +23,7 @@ <script><![CDATA[ import jaxx.runtime.SwingUtil; import jaxx.demo.component.jaxx.navigation.*; -import jaxx.runtime.decorator.DecoratorUtils; -import jaxx.runtime.swing.renderer.MultiDecoratorListCellRenderer; +import jaxx.runtime.swing.renderer.DecoratorProviderListCellRenderer; import jaxx.runtime.swing.navigation.NavigationTreeNode; @Override @@ -56,7 +55,7 @@ public void closeUI(NavigationTreeNode node) throws Exception { columnHeaderView='{toolbar}' horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> - <JList id='list' model='{new DefaultListModel()}' cellRenderer='{getContextValue(MultiDecoratorListCellRenderer.class)}'/> + <JList id='list' model='{new DefaultListModel()}' cellRenderer='{getContextValue(DecoratorProviderListCellRenderer.class)}'/> </JScrollPane> <JToolBar id='toolbar' constraints='BorderLayout.SOUTH' floatable='false'> diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx index 9a59431..b34026b 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx @@ -26,18 +26,9 @@ <script><![CDATA[ import jaxx.runtime.SwingUtil; import jaxx.demo.component.jaxx.navigation.*; -import jaxx.runtime.decorator.DecoratorUtils; -import jaxx.runtime.decorator.MultiJXPathDecorator; -import jaxx.runtime.swing.renderer.MultiDecoratorListCellRenderer; import jaxx.runtime.swing.navigation.NavigationTreeNode; import jaxx.runtime.swing.navigation.NavigationContentUI; -// init shared list decorator -MultiJXPathDecorator<?> d0 = (MultiJXPathDecorator<?>)DecoratorUtils.get(People.class.getSimpleName()); -MultiJXPathDecorator<?> d1 = (MultiJXPathDecorator<?>)DecoratorUtils.get(Movie.class.getSimpleName()); -MultiDecoratorListCellRenderer r = new MultiDecoratorListCellRenderer(d0,d1); -setContextValue(r); - ContentUIHandler getHandler() { return getContextValue(ContentUIHandler.class); } diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx index a921b98..f9443f4 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx @@ -23,8 +23,7 @@ <script><![CDATA[ import jaxx.runtime.SwingUtil; import jaxx.demo.component.jaxx.navigation.*; -import jaxx.runtime.decorator.DecoratorUtils; -import jaxx.runtime.swing.renderer.MultiDecoratorListCellRenderer; +import jaxx.runtime.swing.renderer.DecoratorProviderListCellRenderer; import jaxx.runtime.swing.navigation.NavigationTreeNode; @Override @@ -56,7 +55,7 @@ public void closeUI(NavigationTreeNode node) throws Exception { columnHeaderView='{toolbar}' horizontalScrollBarPolicy='{JScrollPane.HORIZONTAL_SCROLLBAR_NEVER}' verticalScrollBarPolicy='{JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED}'> - <JList id='list' model='{new DefaultListModel()}' cellRenderer='{getContextValue(MultiDecoratorListCellRenderer.class)}'/> + <JList id='list' model='{new DefaultListModel()}' cellRenderer='{getContextValue(DecoratorProviderListCellRenderer.class)}'/> </JScrollPane> <JToolBar id='toolbar' opaque='false' constraints='BorderLayout.SOUTH' floatable='false'> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit a5e0262dd45cfc4c454379842e72bd645a72b825 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 29 17:06:25 2009 +0000 svn:ingore idea files -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 5a2a7f3a339b04c6eb88c88c924a231b0cc3c927 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Oct 29 18:21:10 2009 +0000 fix context error --- jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java | 3 +++ .../jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java b/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java index ca72d26..dca43fd 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoUIHandler.java @@ -84,6 +84,9 @@ public class DemoUIHandler { //implements JAXXHelp { // share a unique DecoratorProviderListCellRenderer DecoratorProvider decoratorProvider = rootContext.getContextValue(DecoratorProvider.class); + + context.add(decoratorProvider); + context.add(new DecoratorProviderListCellRenderer(decoratorProvider)); // instanciate ui diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx index d9fc864..04b0252 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx @@ -28,11 +28,14 @@ import jaxx.runtime.SwingUtil; import jaxx.demo.component.jaxx.navigation.content.*; +import jaxx.runtime.decorator.DecoratorProvider; + private final FullNavigationTreeHelper helper = new FullNavigationTreeHelper(); private final ContentUIHandler contentUIHandler = new ContentUIHandler(); setContextValue(helper); setContextValue(contentUIHandler); helper.setTree(this, navigation); +log.info("decorator provider = "+getContextValue(DecoratorProvider.class)); helper.createModel(this); @Override @@ -73,8 +76,6 @@ private void $afterCompleteSetup() { showsRootHandles='false' model='{helper.createTreeModel(this)}' selectionModel="{helper.createTreeHandler(this)}"/> - <!--cellRenderer='{new NavigationTreeCellRenderer(this, 150)}' />--> - </JScrollPane> <JPanel id="content" layout="{contentLayout}" /> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 12fc47f2cea51f9fa5a2feea2dd20e082615955f Author: Tony Chemit <chemit@codelutin.com> Date: Fri Oct 30 11:09:43 2009 +0000 Evolution #106: Amélioration de l'api des Decorator --- .../jaxx/runtime/decorator/DecoratorUtils.java | 123 +-------------------- 1 file changed, 1 insertion(+), 122 deletions(-) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java index d46d38d..3fab5a7 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/decorator/DecoratorUtils.java @@ -26,7 +26,7 @@ import jaxx.runtime.decorator.JXPathDecorator.JXPathComparator; import java.util.*; /** - * Some usefull methods on {@link Decorator} to create, decorators and obtain decorators. + * Some usefull methods on {@link Decorator} to create, and sort data with decorators. * <p/> * To create a new decorator, use one of the methods : * <ul> @@ -36,13 +36,6 @@ import java.util.*; * <li>{@link #newMultiJXPathDecorator(Class, String, String, String)})</li> * </ul> * <p/> - * <p/> - * To register a new decorator, use the method {@link #register(String, Decorator)}. - * <p/> - * To obtain a registred decorator, use the method {@link #get(String)} - * (get the decorator based on his registred name). or the method {@link #get(Class, String)} - * (get the decorator based on the type of decorator and the registred name). - * <p/> * To sort a list of data, using a {@link JXPathDecorator}, use the method * {@link #sort(JXPathDecorator, List, int)}. * <p/> @@ -53,13 +46,6 @@ import java.util.*; public class DecoratorUtils { /** - * Registred decorators. - * @deprecated prefer use a {@link DecoratorProvider} - */ - @Deprecated - protected static List<DecoratorContext<?>> decorators; - - /** * Factory method to instanciate a new {@link PropertyDecorator} for the * given class {@code internlaClass} and a readable property name. * @@ -120,48 +106,6 @@ public class DecoratorUtils { return new MultiJXPathDecorator<O>(internalClass, expression, separator, separatorReplacement, contexts); } - @Deprecated - public static <T> Decorator<T> get(String context) { - Decorator<T> result = get(null, context); - return result; - } - - @Deprecated - public static <T> Decorator<T> get(Class<T> type, String context) { - DecoratorContext<T> decoratorContext = getDecoratorContext(type, context); - Decorator<T> result = decoratorContext == null ? null : decoratorContext.getDecorator(); - return result; - } - - /** - * Register a new decorator in the cache. - * - * @param <T> type of data decorated - * @param context the name decorator - * @param decorator the decorator to register - */ - @Deprecated - public static <T> void register(String context, Decorator<T> decorator) { - - DecoratorContext<T> result = getDecoratorContext(decorator.getInternalClass(), context); - - if (result != null) { - throw new IllegalArgumentException("there is an already register decorator " + result); - } - - if (decorators == null) { - decorators = new java.util.ArrayList<DecoratorContext<?>>(); - } - decorators.add(new DecoratorContext<T>(context, decorator)); - } - - @Deprecated - public static void clear() { - if (decorators != null) { - decorators.clear(); - } - } - /** * Sort a list of data based on the first token property of a given context * in a given decorator. @@ -189,71 +133,6 @@ public class DecoratorUtils { } } - @SuppressWarnings({"unchecked"}) - @Deprecated - protected static <T> DecoratorContext<T> getDecoratorContext(Class<T> type, String context) { - DecoratorContext<T> result = null; - if (decorators != null) { - for (DecoratorContext<?> d : decorators) { - if (type == null) { - if (d.accept(context)) { - result = (DecoratorContext<T>) d; - break; - } - continue; - } - if (d.accept(type, context)) { - result = (DecoratorContext<T>) d; - break; - } - } - } - return result; - } - - @Deprecated - public static class DecoratorContext<T> { - - /** - * the context name of the decorator - */ - final String context; - /** - * the decorator - */ - final Decorator<T> decorator; - - public DecoratorContext(String context, Decorator<T> decorator) { - this.context = context; - this.decorator = decorator; - } - - public String getContext() { - return context; - } - - public Decorator<T> getDecorator() { - return decorator; - } - - public Class<T> getType() { - return decorator.getInternalClass(); - } - - public boolean accept(Class<?> type, String context) { - return getType().isAssignableFrom(type) && accept(context); - } - - public boolean accept(String context) { - return ((this.context == null && context == null) || (this.context != null && this.context.equals(context))); - } - - @Override - public String toString() { - return super.toString() + "<type: " + getType().getName() + ", context :" + context + ">"; - } - } - public static <O> Context<O> createJXPathContext(String expression) { List<String> lTokens = new ArrayList<String>(); StringBuilder buffer = new StringBuilder(); -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 5abed9713a9d4aca9da5e61fa7c74a9fa966c5a6 Author: Tony Chemit <chemit@codelutin.com> Date: Sun Nov 1 16:21:04 2009 +0000 use maven-helper-plugin 1.1.0 new test dir layout --- .../java/org/nuiton/jaxx/plugin/Bug1750Test.java | 2 +- .../org/nuiton/jaxx/plugin/Evolution74Test.java | 28 +++++++++++----------- .../{Bug1722Test => bug1722Test}/Bug_1722.xml | 2 +- .../{Bug1722Test => bug1722Test}/DemoPanel.jaxx | 0 .../{Bug1722Test => bug1722Test}/JButtonDemo.jaxx | 0 .../{Bug1750Test => bug1750Test}/Bug_1750.xml | 2 +- .../{Bug1750Test => bug1750Test}/ComboBox.jaxx | 0 .../{Bug1751Test => bug1751Test}/Bug_1751.xml | 2 +- .../plugin/{Bug1751Test => bug1751Test}/Test1.jaxx | 0 .../plugin/{Bug1751Test => bug1751Test}/Test2.jaxx | 0 .../plugin/{Bug1751Test => bug1751Test}/Test3.jaxx | 0 .../{CompilerTest => compilerTest}/CSSTests.xml | 2 +- .../CSSTests/CSSTests.jaxx | 0 .../CSSTests/Child.jaxx | 0 .../CSSTests/Child2.jaxx | 0 .../CSSTests/GrandChild.jaxx | 0 .../CSSTests/GrandChildButton.jaxx | 0 .../CSSTests/Pseudoclasses.jaxx | 0 .../CSSTests/SimpleCSS.jaxx | 0 .../ClassReferences.xml | 2 +- .../ClassReferences/ClassReferences.jaxx | 0 .../ClassReferences/ConstructorReferenceTest.jaxx | 0 .../ClassReferences/JAXXReferenceTest.jaxx | 0 .../ClassReferences/JAXXTest.jaxx | 0 .../ClassReferences/JavaTaist.java | 0 .../ClassReferences/StaticMethodTest.jaxx | 0 .../ClassReferences/TypeReference.jaxx | 0 .../ClientProperty.xml | 2 +- .../ErrorJaxxContextImplementorClass.xml | 2 +- .../{CompilerTest => compilerTest}/Errors.xml | 4 ++-- .../{CompilerTest => compilerTest}/Force.xml | 2 +- .../plugin/{CompilerTest => compilerTest}/Icon.xml | 2 +- .../Initializers.xml | 2 +- .../Initializers/Initializers.jaxx | 0 .../InnerClasses.xml | 2 +- .../InnerClasses/InnerClasses.jaxx | 0 .../{CompilerTest => compilerTest}/NoLog.xml | 2 +- .../OverridingDataBindings.xml | 2 +- .../OverridingDataBindings/CurrentTime.jaxx | 0 .../OverriddenCurrentTime.jaxx | 0 .../OverridingDataBindings.jaxx | 0 .../{CompilerTest => compilerTest}/Script.xml | 2 +- .../Script/JScriptInitializer.jaxx | 0 .../SpecialSubclassing.xml | 2 +- .../SpecialSubclassing/JComboBoxTest1.jaxx | 0 .../SpecialSubclassing/JComboBoxTest2.jaxx | 0 .../SpecialSubclassing/JListTest1.jaxx | 0 .../SpecialSubclassing/JListTest2.jaxx | 0 .../SpecialSubclassing/JTreeTest1.jaxx | 0 .../SpecialSubclassing/JTreeTest2.jaxx | 0 .../SpecialSubclassing/SpecialSubclassing.jaxx | 0 .../{CompilerTest => compilerTest}/WithLog.xml | 2 +- .../clientProperty/TestOne.jaxx | 0 .../errors/AmbiguousName.jaxx | 0 .../errors/BadTypeConversions.jaxx | 0 .../errors/CellOutsideOfRow.jaxx | 0 .../errors/ChildrenInNonContainer.jaxx | 0 .../errors/ClassNotFound.jaxx | 0 .../errors/ConflictingPackages.jaxx | 0 .../errors/ConstraintsParseError.jaxx | 0 .../errors/DataBindingParseError.jaxx | 0 .../errors/DuplicateIDs.jaxx | 0 .../errors/EventHandlerParseError.jaxx | 0 .../errors/InvalidID.jaxx | 0 .../errors/InvalidRootTag.jaxx | 0 .../errors/InvalidXML.jaxx | 0 .../errors/ItemDuplicateValues.jaxx | 0 .../errors/ItemNoValue.jaxx | 0 .../errors/MixedContent.jaxx | 0 .../errors/RowOutsideOfTable.jaxx | 0 .../errors/RowWrongChild.jaxx | 0 .../errors/ScriptNotFound.jaxx | 0 .../errors/ScriptParseError.jaxx | 0 .../errors/ScriptSourceAndInline.jaxx | 0 .../errors/StyleNotFound.jaxx | 0 .../errors/StyleParseError.jaxx | 0 .../errors/StyleSourceAndInline.jaxx | 0 .../errors/TabOutsideOfTabbedPane.jaxx | 0 .../errors/TabbedPaneWrongChild.jaxx | 0 .../errors/TableWrongChild.jaxx | 0 .../errors/TooManyCellChildren.jaxx | 0 .../errors/TooManyScrollPaneChildren.jaxx | 0 .../errors/TooManySplitPaneChildren.jaxx | 0 .../errors/TooManyTabChildren.jaxx | 0 .../errors/UnsupportedAttribute.jaxx | 0 .../errors/UnsupportedEvent.jaxx | 0 .../errors/UnsupportedPseudoclass.jaxx | 0 .../errors/dependencies/test.css | 0 .../errors/dependencies/test.script | 0 .../force/JButton.jaxx | 0 .../{CompilerTest => compilerTest}/icon/Test1.jaxx | 0 .../log/nolog/NoLog.jaxx | 0 .../log/nolog/NoLogSon.jaxx | 0 .../log/withlog/NoLog.jaxx | 0 .../log/withlog/WithLog.jaxx | 0 .../ValidatorErrors.xml | 2 +- .../ValidatorOk.xml | 2 +- .../errors/AutoFieldComponentNotFound.jaxx | 2 +- .../validator/errors/DuplicatedBean.jaxx | 0 .../validator/errors/DuplicatedBean2.jaxx | 0 .../validator/errors/DuplicatedErrorListModel.jaxx | 2 +- .../errors/DuplicatedErrorTableModel.jaxx | 2 +- .../errors/DuplicatedFieldInSameValidator.jaxx | 2 +- .../errors/FieldBeanPropertyNotFound.jaxx | 2 +- .../validator/errors/FieldComponentDuplicated.jaxx | 2 +- .../validator/errors/FieldComponentNotFound.jaxx | 2 +- .../validator/errors/FieldComponentNotFound2.jaxx | 2 +- .../validator/errors/FieldNoName.jaxx | 2 +- .../validator/errors/FieldNoName2.jaxx | 2 +- .../validator/errors/Model.java | 2 +- .../validator/errors/NoBean.jaxx | 0 .../validator/errors/UnfoundBean.jaxx | 0 .../validator/errors/UnfoundErrorList.jaxx | 2 +- .../validator/errors/UnfoundErrorListModel.jaxx | 2 +- .../validator/errors/UnfoundErrorTable.jaxx | 2 +- .../validator/errors/UnfoundErrorTableModel.jaxx | 2 +- .../validator/errors/UnfoundParentValidator.jaxx | 2 +- .../validator/ok/Identity.java | 2 +- .../validator/ok/Model.java | 2 +- .../validator/ok/Validation.jaxx | 0 .../validator/ok/ValidationBeanClass.jaxx | 2 +- .../First.jaxx | 0 .../simpleBinding.xml | 2 +- .../BoxedDecorator.jaxx | 0 .../{DecoratorTest => decoratorTest}/Decorator.xml | 2 +- .../{Evolution74Test => evolution74Test}/error.xml | 2 +- .../error/swingcombo.jaxx | 0 .../error/swinglist.jaxx | 0 .../error/swingtree.jaxx | 0 .../{Evolution74Test => evolution74Test}/ok.xml | 2 +- .../ok/jaxxcombo.jaxx | 0 .../ok/jaxxlist.jaxx | 0 .../ok/jaxxtree.jaxx | 0 .../ok/swingcombo.jaxx | 0 .../ok/swinglist.jaxx | 0 .../ok/swingtree.jaxx | 0 .../plugin/{I18nTest => i18nTest}/I18nText.xml | 2 +- .../plugin/{I18nTest => i18nTest}/I18nTitle.xml | 2 +- .../{I18nTest => i18nTest}/I18nToolTipText.xml | 2 +- .../{I18nTest => i18nTest}/text/JButton.jaxx | 0 .../{I18nTest => i18nTest}/title/JDialog.jaxx | 0 .../{I18nTest => i18nTest}/title/JTabbedPane.jaxx | 0 .../{I18nTest => i18nTest}/title/JTabbedPane2.jaxx | 0 .../tooltiptext/JButton.jaxx | 0 .../tooltiptext/JTabbedPane.jaxx | 0 .../tooltiptext/JTabbedPane2.jaxx | 0 .../tooltiptext/JTabbedPane3.jaxx | 0 147 files changed, 61 insertions(+), 61 deletions(-) diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java index b9ca7fc..209f4f7 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Bug1750Test.java @@ -36,7 +36,7 @@ public class Bug1750Test extends JaxxBaseTest { getMojo().execute(); assertNumberJaxxFiles(1); - JAXXCompiler compiler = getMojo().getEngine().getJAXXCompiler("org.nuiton.jaxx.plugin.Bug1750Test.ComboBox"); + JAXXCompiler compiler = getMojo().getEngine().getJAXXCompiler("org.nuiton.jaxx.plugin.bug1750Test.ComboBox"); assertNotNull(compiler); JAXXObjectDescriptor descriptor = compiler.getJAXXObjectDescriptor(); diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java index ad57e6b..36d4bc4 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/Evolution74Test.java @@ -35,20 +35,20 @@ public class Evolution74Test extends JaxxBaseTest { mojo.execute(); assertNumberJaxxFiles(6); - checkPattern(mojo, "JComboBox", true, "org/nuiton/jaxx/plugin/Evolution74Test/ok/swingcombo.java"); - checkPattern(mojo, "JComboBox", false, "org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxcombo.java"); - checkPattern(mojo, "JAXXComboBox", false, "org/nuiton/jaxx/plugin/Evolution74Test/ok/swingcombo.java"); - checkPattern(mojo, "JAXXComboBox", true, "org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxcombo.java"); - - checkPattern(mojo, "JList", true, "org/nuiton/jaxx/plugin/Evolution74Test/ok/swinglist.java"); - checkPattern(mojo, "JList", false, "org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxlist.java"); - checkPattern(mojo, "JAXXList", false, "org/nuiton/jaxx/plugin/Evolution74Test/ok/swinglist.java"); - checkPattern(mojo, "JAXXList", true, "org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxlist.java"); - - checkPattern(mojo, "JTree", true, "org/nuiton/jaxx/plugin/Evolution74Test/ok/swingtree.java"); - checkPattern(mojo, "JTree", false, "org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxtree.java"); - checkPattern(mojo, "JAXXTree", false, "org/nuiton/jaxx/plugin/Evolution74Test/ok/swingtree.java"); - checkPattern(mojo, "JAXXTree", true, "org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxtree.java"); + checkPattern(mojo, "JComboBox", true, "org/nuiton/jaxx/plugin/evolution74Test/ok/swingcombo.java"); + checkPattern(mojo, "JComboBox", false, "org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxcombo.java"); + checkPattern(mojo, "JAXXComboBox", false, "org/nuiton/jaxx/plugin/evolution74Test/ok/swingcombo.java"); + checkPattern(mojo, "JAXXComboBox", true, "org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxcombo.java"); + + checkPattern(mojo, "JList", true, "org/nuiton/jaxx/plugin/evolution74Test/ok/swinglist.java"); + checkPattern(mojo, "JList", false, "org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxlist.java"); + checkPattern(mojo, "JAXXList", false, "org/nuiton/jaxx/plugin/evolution74Test/ok/swinglist.java"); + checkPattern(mojo, "JAXXList", true, "org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxlist.java"); + + checkPattern(mojo, "JTree", true, "org/nuiton/jaxx/plugin/evolution74Test/ok/swingtree.java"); + checkPattern(mojo, "JTree", false, "org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxtree.java"); + checkPattern(mojo, "JAXXTree", false, "org/nuiton/jaxx/plugin/evolution74Test/ok/swingtree.java"); + checkPattern(mojo, "JAXXTree", true, "org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxtree.java"); } @SuppressWarnings({"unchecked"}) diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1722Test/Bug_1722.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1722Test/Bug_1722.xml index 688e7fc..c19a9c4 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1722Test/Bug_1722.xml @@ -18,7 +18,7 @@ <force>true</force> <!--<verbose>true</verbose>--> <includes> - <value>**/Bug1722Test/*.jaxx</value> + <value>**/bug1722Test/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/DemoPanel.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1722Test/DemoPanel.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/DemoPanel.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1722Test/DemoPanel.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/JButtonDemo.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1722Test/JButtonDemo.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1722Test/JButtonDemo.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1722Test/JButtonDemo.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1750Test/Bug_1750.xml similarity index 94% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1750Test/Bug_1750.xml index 2eec7f4..ff62d89 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1750Test/Bug_1750.xml @@ -19,7 +19,7 @@ <!--<verbose>true</verbose>--> <resetAfterCompile>false</resetAfterCompile> <includes> - <value>**/Bug1750Test/*.jaxx</value> + <value>**/bug1750Test/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/ComboBox.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1750Test/ComboBox.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1750Test/ComboBox.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1750Test/ComboBox.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1751Test/Bug_1751.xml similarity index 94% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1751Test/Bug_1751.xml index 504449d..f8cf745 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1751Test/Bug_1751.xml @@ -20,7 +20,7 @@ <!--<verbose>true</verbose>--> <resetAfterCompile>false</resetAfterCompile> <includes> - <value>**/Bug1751Test/*.jaxx</value> + <value>**/bug1751Test/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test1.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1751Test/Test1.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test1.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1751Test/Test1.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1751Test/Test2.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test2.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1751Test/Test2.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test3.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1751Test/Test3.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Bug1751Test/Test3.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/bug1751Test/Test3.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests.xml index 0250aa0..4538ee8 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests.xml @@ -18,7 +18,7 @@ <force>true</force> <i18nable>false</i18nable> <includes> - <value>**/CompilerTest/CSSTests/*.jaxx</value> + <value>**/compilerTest/CSSTests/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests/CSSTests.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/CSSTests.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests/CSSTests.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/CSSTests.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests/Child.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/Child.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests/Child.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/Child.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests/Child2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/Child2.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests/Child2.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/Child2.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests/GrandChild.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/GrandChild.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests/GrandChild.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/GrandChild.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests/GrandChildButton.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/GrandChildButton.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests/GrandChildButton.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/GrandChildButton.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests/Pseudoclasses.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/Pseudoclasses.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests/Pseudoclasses.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/Pseudoclasses.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests/SimpleCSS.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/SimpleCSS.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/CSSTests/SimpleCSS.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/SimpleCSS.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences.xml index 86d0515..4822db4 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences.xml @@ -17,7 +17,7 @@ <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> - <value>**/CompilerTest/ClassReferences/*.jaxx</value> + <value>**/compilerTest/ClassReferences/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences/ClassReferences.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/ClassReferences.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences/ClassReferences.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/ClassReferences.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences/ConstructorReferenceTest.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/ConstructorReferenceTest.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences/ConstructorReferenceTest.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/ConstructorReferenceTest.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences/JAXXReferenceTest.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/JAXXReferenceTest.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences/JAXXReferenceTest.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/JAXXReferenceTest.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences/JAXXTest.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/JAXXTest.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences/JAXXTest.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/JAXXTest.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences/JavaTaist.java b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/JavaTaist.java similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences/JavaTaist.java rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/JavaTaist.java diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences/StaticMethodTest.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/StaticMethodTest.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences/StaticMethodTest.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/StaticMethodTest.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences/TypeReference.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/TypeReference.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClassReferences/TypeReference.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/TypeReference.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClientProperty.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClientProperty.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClientProperty.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClientProperty.xml index 8f85092..6ecfa1b 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ClientProperty.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClientProperty.xml @@ -18,7 +18,7 @@ <force>true</force> <addLogger>false</addLogger> <includes> - <value>**/CompilerTest/clientProperty/*.jaxx</value> + <value>**/compilerTest/clientProperty/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ErrorJaxxContextImplementorClass.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ErrorJaxxContextImplementorClass.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ErrorJaxxContextImplementorClass.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ErrorJaxxContextImplementorClass.xml index fb3fb0e..eb78b02 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/ErrorJaxxContextImplementorClass.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ErrorJaxxContextImplementorClass.xml @@ -18,7 +18,7 @@ <jaxxContextFQN>java.lang.String</jaxxContextFQN> <force>true</force> <includes> - <value>**/Evolution74Test/ok/*.jaxx</value> + <value>**/evolution74Test/ok/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Errors.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Errors.xml similarity index 88% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Errors.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Errors.xml index 38802a4..f4252b4 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Errors.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Errors.xml @@ -17,10 +17,10 @@ <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> - <value>**/CompilerTest/errors/*.jaxx</value> + <value>**/compilerTest/errors/*.jaxx</value> </includes> <excludes> - <value>**/CompilerTest/validator/errors/*.jaxx</value> + <value>**/compilerTest/validator/errors/*.jaxx</value> </excludes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Force.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Force.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Force.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Force.xml index 160c4f4..d0d2108 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Force.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Force.xml @@ -17,7 +17,7 @@ <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> - <value>**/CompilerTest/force/*.jaxx</value> + <value>**/compilerTest/force/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Icon.xml similarity index 94% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Icon.xml index 82a93d1..391dee7 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Icon.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Icon.xml @@ -20,7 +20,7 @@ <!--<verbose>true</verbose>--> <resetAfterCompile>true</resetAfterCompile> <includes> - <value>**/CompilerTest/icon/*.jaxx</value> + <value>**/compilerTest/icon/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Initializers.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Initializers.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Initializers.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Initializers.xml index 7b77755..03a151c 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Initializers.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Initializers.xml @@ -17,7 +17,7 @@ <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> - <value>**/CompilerTest/Initializers/*.jaxx</value> + <value>**/compilerTest/Initializers/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Initializers/Initializers.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Initializers/Initializers.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Initializers/Initializers.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Initializers/Initializers.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/InnerClasses.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/InnerClasses.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/InnerClasses.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/InnerClasses.xml index 39682cc..42f9345 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/InnerClasses.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/InnerClasses.xml @@ -17,7 +17,7 @@ <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> - <value>**/CompilerTest/InnerClasses/*.jaxx</value> + <value>**/compilerTest/InnerClasses/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/InnerClasses/InnerClasses.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/InnerClasses/InnerClasses.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/InnerClasses/InnerClasses.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/InnerClasses/InnerClasses.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/NoLog.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/NoLog.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/NoLog.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/NoLog.xml index d0ad728..a0e8025 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/NoLog.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/NoLog.xml @@ -18,7 +18,7 @@ <force>true</force> <addLogger>false</addLogger> <includes> - <value>**/CompilerTest/log/nolog/*.jaxx</value> + <value>**/compilerTest/log/nolog/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings.xml index 45334a0..a39d1a5 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings.xml @@ -17,7 +17,7 @@ <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> - <value>**/CompilerTest/OverridingDataBindings/*.jaxx</value> + <value>**/compilerTest/OverridingDataBindings/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings/CurrentTime.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings/CurrentTime.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings/CurrentTime.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings/CurrentTime.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings/OverriddenCurrentTime.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings/OverriddenCurrentTime.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings/OverriddenCurrentTime.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings/OverriddenCurrentTime.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings/OverridingDataBindings.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings/OverridingDataBindings.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/OverridingDataBindings/OverridingDataBindings.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings/OverridingDataBindings.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Script.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Script.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Script.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Script.xml index 55453c8..ec71e3f 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Script.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Script.xml @@ -17,7 +17,7 @@ <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> - <value>**/CompilerTest/Script/*.jaxx</value> + <value>**/compilerTest/Script/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Script/JScriptInitializer.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Script/JScriptInitializer.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/Script/JScriptInitializer.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Script/JScriptInitializer.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing.xml index bcec799..9683bcc 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing.xml @@ -17,7 +17,7 @@ <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> - <value>**/CompilerTest/SpecialSubclassing/*.jaxx</value> + <value>**/compilerTest/SpecialSubclassing/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JComboBoxTest1.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JComboBoxTest1.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JComboBoxTest1.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JComboBoxTest1.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JComboBoxTest2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JComboBoxTest2.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JComboBoxTest2.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JComboBoxTest2.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JListTest1.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JListTest1.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JListTest1.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JListTest1.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JListTest2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JListTest2.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JListTest2.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JListTest2.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JTreeTest1.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JTreeTest1.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JTreeTest1.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JTreeTest1.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JTreeTest2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JTreeTest2.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/JTreeTest2.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JTreeTest2.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/SpecialSubclassing.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/SpecialSubclassing.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/SpecialSubclassing/SpecialSubclassing.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/SpecialSubclassing.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/WithLog.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/WithLog.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/WithLog.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/WithLog.xml index f695cca..e88301e 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/WithLog.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/WithLog.xml @@ -18,7 +18,7 @@ <force>true</force> <addLogger>true</addLogger> <includes> - <value>**/CompilerTest/log/withlog/*.jaxx</value> + <value>**/compilerTest/log/withlog/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/clientProperty/TestOne.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/clientProperty/TestOne.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/clientProperty/TestOne.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/clientProperty/TestOne.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/AmbiguousName.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/AmbiguousName.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/AmbiguousName.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/AmbiguousName.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/BadTypeConversions.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/BadTypeConversions.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/BadTypeConversions.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/BadTypeConversions.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/CellOutsideOfRow.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/CellOutsideOfRow.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/CellOutsideOfRow.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/CellOutsideOfRow.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ChildrenInNonContainer.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/ChildrenInNonContainer.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ChildrenInNonContainer.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/ChildrenInNonContainer.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ClassNotFound.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/ClassNotFound.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ClassNotFound.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/ClassNotFound.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ConflictingPackages.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/ConflictingPackages.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ConflictingPackages.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/ConflictingPackages.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ConstraintsParseError.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/ConstraintsParseError.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ConstraintsParseError.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/ConstraintsParseError.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/DataBindingParseError.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/DataBindingParseError.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/DataBindingParseError.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/DataBindingParseError.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/DuplicateIDs.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/DuplicateIDs.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/DuplicateIDs.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/DuplicateIDs.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/EventHandlerParseError.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/EventHandlerParseError.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/EventHandlerParseError.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/EventHandlerParseError.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/InvalidID.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/InvalidID.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/InvalidID.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/InvalidID.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/InvalidRootTag.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/InvalidRootTag.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/InvalidRootTag.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/InvalidRootTag.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/InvalidXML.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/InvalidXML.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/InvalidXML.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/InvalidXML.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ItemDuplicateValues.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/ItemDuplicateValues.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ItemDuplicateValues.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/ItemDuplicateValues.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ItemNoValue.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/ItemNoValue.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ItemNoValue.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/ItemNoValue.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/MixedContent.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/MixedContent.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/MixedContent.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/MixedContent.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/RowOutsideOfTable.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/RowOutsideOfTable.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/RowOutsideOfTable.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/RowOutsideOfTable.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/RowWrongChild.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/RowWrongChild.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/RowWrongChild.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/RowWrongChild.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ScriptNotFound.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/ScriptNotFound.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ScriptNotFound.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/ScriptNotFound.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ScriptParseError.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/ScriptParseError.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ScriptParseError.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/ScriptParseError.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ScriptSourceAndInline.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/ScriptSourceAndInline.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/ScriptSourceAndInline.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/ScriptSourceAndInline.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/StyleNotFound.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/StyleNotFound.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/StyleNotFound.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/StyleNotFound.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/StyleParseError.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/StyleParseError.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/StyleParseError.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/StyleParseError.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/StyleSourceAndInline.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/StyleSourceAndInline.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/StyleSourceAndInline.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/StyleSourceAndInline.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/TabOutsideOfTabbedPane.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/TabOutsideOfTabbedPane.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/TabOutsideOfTabbedPane.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/TabOutsideOfTabbedPane.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/TabbedPaneWrongChild.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/TabbedPaneWrongChild.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/TabbedPaneWrongChild.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/TabbedPaneWrongChild.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/TableWrongChild.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/TableWrongChild.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/TableWrongChild.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/TableWrongChild.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/TooManyCellChildren.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/TooManyCellChildren.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/TooManyCellChildren.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/TooManyCellChildren.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/TooManyScrollPaneChildren.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/TooManyScrollPaneChildren.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/TooManyScrollPaneChildren.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/TooManyScrollPaneChildren.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/TooManySplitPaneChildren.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/TooManySplitPaneChildren.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/TooManySplitPaneChildren.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/TooManySplitPaneChildren.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/TooManyTabChildren.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/TooManyTabChildren.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/TooManyTabChildren.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/TooManyTabChildren.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/UnsupportedAttribute.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/UnsupportedAttribute.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/UnsupportedAttribute.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/UnsupportedAttribute.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/UnsupportedEvent.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/UnsupportedEvent.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/UnsupportedEvent.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/UnsupportedEvent.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/UnsupportedPseudoclass.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/UnsupportedPseudoclass.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/UnsupportedPseudoclass.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/UnsupportedPseudoclass.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/dependencies/test.css b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/dependencies/test.css similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/dependencies/test.css rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/dependencies/test.css diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/dependencies/test.script b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/dependencies/test.script similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/errors/dependencies/test.script rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/errors/dependencies/test.script diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/force/JButton.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/force/JButton.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/force/JButton.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/force/JButton.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/icon/Test1.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/icon/Test1.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/icon/Test1.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/icon/Test1.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/log/nolog/NoLog.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/log/nolog/NoLog.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/log/nolog/NoLog.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/log/nolog/NoLog.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/log/nolog/NoLogSon.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/log/nolog/NoLogSon.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/log/nolog/NoLogSon.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/log/nolog/NoLogSon.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/log/withlog/NoLog.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/log/withlog/NoLog.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/log/withlog/NoLog.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/log/withlog/NoLog.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/log/withlog/WithLog.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/log/withlog/WithLog.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerTest/log/withlog/WithLog.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/log/withlog/WithLog.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/ValidatorErrors.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/ValidatorErrors.xml index 17677f1..7726126 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorErrors.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/ValidatorErrors.xml @@ -19,7 +19,7 @@ <force>true</force> <!--<verbose>true</verbose>--> <includes> - <value>**/CompilerValidatorTest/validator/errors/*.jaxx</value> + <value>**/compilerValidatorTest/validator/errors/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/ValidatorOk.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/ValidatorOk.xml index 3cc42f0..78edf09 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/ValidatorOk.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/ValidatorOk.xml @@ -18,7 +18,7 @@ <force>true</force> <!--<verbose>true</verbose>--> <includes> - <value>**/CompilerValidatorTest/validator/ok/*.jaxx</value> + <value>**/compilerValidatorTest/validator/ok/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/AutoFieldComponentNotFound.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/AutoFieldComponentNotFound.jaxx similarity index 71% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/AutoFieldComponentNotFound.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/AutoFieldComponentNotFound.jaxx index 1d75089..8f1547d 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/AutoFieldComponentNotFound.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/AutoFieldComponentNotFound.jaxx @@ -1,5 +1,5 @@ <Application> - <BeanValidator beanClass="org.nuiton.jaxx.plugin.CompilerValidatorTest.validator.errors.Model" autoField='true' strictMode='true'/> + <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model" autoField='true' strictMode='true'/> <JTextField id='text'/> <JTextField id='text2'/> </Application> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/DuplicatedBean.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedBean.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/DuplicatedBean.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedBean.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/DuplicatedBean2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedBean2.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/DuplicatedBean2.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedBean2.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/DuplicatedErrorListModel.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedErrorListModel.jaxx similarity index 74% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/DuplicatedErrorListModel.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedErrorListModel.jaxx index 381e1ed..58e125b 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/DuplicatedErrorListModel.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedErrorListModel.jaxx @@ -1,4 +1,4 @@ <Application> <jaxx.runtime.validator.swing.SwingValidatorMessageListModel id='errors'/> - <BeanValidator beanClass='org.nuiton.jaxx.plugin.CompilerValidatorTest.validator.errors.Model' errorListModel='errors' errorListModel='fake'/> + <BeanValidator beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' errorListModel='errors' errorListModel='fake'/> </Application> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/DuplicatedErrorTableModel.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedErrorTableModel.jaxx similarity index 75% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/DuplicatedErrorTableModel.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedErrorTableModel.jaxx index 8cd6cd8..9616686 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/DuplicatedErrorTableModel.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedErrorTableModel.jaxx @@ -1,4 +1,4 @@ <Application> <jaxx.runtime.validator.swing.SwingValidatorMessageListModel id='errors'/> - <BeanValidator beanClass='org.nuiton.jaxx.plugin.CompilerValidatorTest.validator.errors.Model' errorTableModel='errors' errorTableModel='fake'/> + <BeanValidator beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' errorTableModel='errors' errorTableModel='fake'/> </Application> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/DuplicatedFieldInSameValidator.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedFieldInSameValidator.jaxx similarity index 72% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/DuplicatedFieldInSameValidator.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedFieldInSameValidator.jaxx index 60113c6..37d3e24 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/DuplicatedFieldInSameValidator.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/DuplicatedFieldInSameValidator.jaxx @@ -1,5 +1,5 @@ <Application> - <BeanValidator beanClass="org.nuiton.jaxx.plugin.CompilerValidatorTest.validator.errors.Model"> + <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> <field name="text"/> <field name="text"/> </BeanValidator> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/FieldBeanPropertyNotFound.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldBeanPropertyNotFound.jaxx similarity index 64% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/FieldBeanPropertyNotFound.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldBeanPropertyNotFound.jaxx index bdc7ada..115c1f9 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/FieldBeanPropertyNotFound.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldBeanPropertyNotFound.jaxx @@ -1,5 +1,5 @@ <Application> - <BeanValidator beanClass="org.nuiton.jaxx.plugin.CompilerValidatorTest.validator.errors.Model"> + <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> <field name="fake"/> </BeanValidator> </Application> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/FieldComponentDuplicated.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldComponentDuplicated.jaxx similarity index 76% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/FieldComponentDuplicated.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldComponentDuplicated.jaxx index 815c0eb..1d54b20 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/FieldComponentDuplicated.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldComponentDuplicated.jaxx @@ -1,5 +1,5 @@ <Application> - <BeanValidator beanClass="org.nuiton.jaxx.plugin.CompilerValidatorTest.validator.errors.Model"> + <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> <field name="text2" component="text"/> <field name="text" component="text"/> </BeanValidator> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/FieldComponentNotFound.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldComponentNotFound.jaxx similarity index 67% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/FieldComponentNotFound.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldComponentNotFound.jaxx index 0eabc24..5fc88b7 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/FieldComponentNotFound.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldComponentNotFound.jaxx @@ -1,5 +1,5 @@ <Application> - <BeanValidator beanClass="org.nuiton.jaxx.plugin.CompilerValidatorTest.validator.errors.Model"> + <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> <field name="text" component="fake"/> </BeanValidator> </Application> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/FieldComponentNotFound2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldComponentNotFound2.jaxx similarity index 64% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/FieldComponentNotFound2.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldComponentNotFound2.jaxx index bdc7ada..115c1f9 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/FieldComponentNotFound2.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldComponentNotFound2.jaxx @@ -1,5 +1,5 @@ <Application> - <BeanValidator beanClass="org.nuiton.jaxx.plugin.CompilerValidatorTest.validator.errors.Model"> + <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> <field name="fake"/> </BeanValidator> </Application> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/FieldNoName.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldNoName.jaxx similarity index 61% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/FieldNoName.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldNoName.jaxx index 3a68a29..e7a3178 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/FieldNoName.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldNoName.jaxx @@ -1,5 +1,5 @@ <Application> - <BeanValidator beanClass="org.nuiton.jaxx.plugin.CompilerValidatorTest.validator.errors.Model"> + <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> <field/> </BeanValidator> </Application> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/FieldNoName2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldNoName2.jaxx similarity index 65% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/FieldNoName2.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldNoName2.jaxx index 70afb31..8593dab 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/FieldNoName2.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/FieldNoName2.jaxx @@ -1,5 +1,5 @@ <Application> - <BeanValidator beanClass="org.nuiton.jaxx.plugin.CompilerValidatorTest.validator.errors.Model"> + <BeanValidator beanClass="org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model"> <field component="text"/> </BeanValidator> </Application> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/Model.java b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/Model.java similarity index 95% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/Model.java rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/Model.java index 131f13e..03e5b8e 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/Model.java +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/Model.java @@ -1,4 +1,4 @@ -package org.nuiton.jaxx.plugin.CompilerValidatorTest.validator.errors; +package org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors; import java.beans.*; diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/NoBean.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/NoBean.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/NoBean.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/NoBean.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/UnfoundBean.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundBean.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/UnfoundBean.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundBean.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/UnfoundErrorList.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorList.jaxx similarity index 56% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/UnfoundErrorList.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorList.jaxx index 11fa009..d54f150 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/UnfoundErrorList.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorList.jaxx @@ -1,3 +1,3 @@ <Application> - <BeanValidator beanClass='org.nuiton.jaxx.plugin.CompilerValidatorTest.validator.errors.Model' errorList='fake'/> + <BeanValidator beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' errorList='fake'/> </Application> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/UnfoundErrorListModel.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorListModel.jaxx similarity index 57% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/UnfoundErrorListModel.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorListModel.jaxx index 091a558..3d0f3f8 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/UnfoundErrorListModel.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorListModel.jaxx @@ -1,3 +1,3 @@ <Application> - <BeanValidator beanClass='org.nuiton.jaxx.plugin.CompilerValidatorTest.validator.errors.Model' errorListModel='fake'/> + <BeanValidator beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' errorListModel='fake'/> </Application> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/UnfoundErrorTable.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorTable.jaxx similarity index 56% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/UnfoundErrorTable.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorTable.jaxx index a4f0ef2..79d25db 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/UnfoundErrorTable.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorTable.jaxx @@ -1,3 +1,3 @@ <Application> - <BeanValidator beanClass='org.nuiton.jaxx.plugin.CompilerValidatorTest.validator.errors.Model' errorTable='fake'/> + <BeanValidator beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' errorTable='fake'/> </Application> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/UnfoundErrorTableModel.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorTableModel.jaxx similarity index 56% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/UnfoundErrorTableModel.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorTableModel.jaxx index e61dbca..1b79ddf 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/UnfoundErrorTableModel.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundErrorTableModel.jaxx @@ -1,3 +1,3 @@ <Application> - <BeanValidator bean='org.nuiton.jaxx.plugin.CompilerValidatorTest.validator.errors.Model' errorTableModel='fake'/> + <BeanValidator bean='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' errorTableModel='fake'/> </Application> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/UnfoundParentValidator.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundParentValidator.jaxx similarity index 58% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/UnfoundParentValidator.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundParentValidator.jaxx index c8a3d49..9f46635 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/errors/UnfoundParentValidator.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/errors/UnfoundParentValidator.jaxx @@ -1,3 +1,3 @@ <Application> - <BeanValidator beanClass='org.nuiton.jaxx.plugin.CompilerValidatorTest.validator.errors.Model' parentValidator='fake'/> + <BeanValidator beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.errors.Model' parentValidator='fake'/> </Application> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/ok/Identity.java b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Identity.java similarity index 96% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/ok/Identity.java rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Identity.java index f955bc8..2063551 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/ok/Identity.java +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Identity.java @@ -1,4 +1,4 @@ -package org.nuiton.jaxx.plugin.CompilerValidatorTest.validator.ok; +package org.nuiton.jaxx.plugin.compilerValidatorTest.validator.ok; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/ok/Model.java b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Model.java similarity index 95% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/ok/Model.java rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Model.java index bd91d51..0e644e0 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/ok/Model.java +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Model.java @@ -1,4 +1,4 @@ -package org.nuiton.jaxx.plugin.CompilerValidatorTest.validator.ok; +package org.nuiton.jaxx.plugin.compilerValidatorTest.validator.ok; import java.beans.*; diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/ok/Validation.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Validation.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/ok/Validation.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Validation.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/ok/ValidationBeanClass.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/ValidationBeanClass.jaxx similarity index 98% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/ok/ValidationBeanClass.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/ValidationBeanClass.jaxx index 8ba14cd..6eb200b 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/CompilerValidatorTest/validator/ok/ValidationBeanClass.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/ValidationBeanClass.jaxx @@ -7,7 +7,7 @@ <jaxx.runtime.validator.swing.SwingValidatorMessageListModel id='errors'/> <!-- validators --> - <BeanValidator id='validator3' autoField='true' beanClass='org.nuiton.jaxx.plugin.CompilerValidatorTest.validator.ok.Identity' errorListModel='errors'> + <BeanValidator id='validator3' autoField='true' beanClass='org.nuiton.jaxx.plugin.compilerValidatorTest.validator.ok.Identity' errorListModel='errors'> <field name="email" component="email2"/> </BeanValidator> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DataBindingTest/First.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/dataBindingTest/First.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DataBindingTest/First.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/dataBindingTest/First.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DataBindingTest/simpleBinding.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/dataBindingTest/simpleBinding.xml similarity index 92% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DataBindingTest/simpleBinding.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/dataBindingTest/simpleBinding.xml index b7db2a5..89bcc03 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DataBindingTest/simpleBinding.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/dataBindingTest/simpleBinding.xml @@ -17,7 +17,7 @@ <force>true</force> <!--<verbose>true</verbose>--> <includes> - <value>**/DataBindingTest/*.jaxx</value> + <value>**/dataBindingTest/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/BoxedDecorator.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/decoratorTest/BoxedDecorator.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/BoxedDecorator.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/decoratorTest/BoxedDecorator.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/Decorator.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/decoratorTest/Decorator.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/Decorator.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/decoratorTest/Decorator.xml index f05698e..218da14 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/DecoratorTest/Decorator.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/decoratorTest/Decorator.xml @@ -18,7 +18,7 @@ <force>true</force> <addLogger>false</addLogger> <includes> - <value>**/DecoratorTest/*.jaxx</value> + <value>**/decoratorTest/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error.xml index 788ca89..7a63a0f 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error.xml @@ -18,7 +18,7 @@ <force>true</force> <!--<verbose>true</verbose>--> <includes> - <value>**/Evolution74Test/error/*.jaxx</value> + <value>**/evolution74Test/error/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error/swingcombo.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error/swingcombo.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error/swingcombo.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error/swingcombo.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error/swinglist.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error/swinglist.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error/swinglist.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error/swinglist.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error/swingtree.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error/swingtree.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/error/swingtree.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/error/swingtree.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok.xml index 8f1bc87..1da9d77 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok.xml @@ -17,7 +17,7 @@ <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> - <value>**/Evolution74Test/ok/*.jaxx</value> + <value>**/evolution74Test/ok/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxcombo.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxcombo.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxcombo.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxcombo.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxlist.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxlist.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxlist.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxlist.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxtree.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxtree.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/jaxxtree.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/jaxxtree.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/swingcombo.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/swingcombo.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/swingcombo.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/swingcombo.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/swinglist.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/swinglist.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/swinglist.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/swinglist.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/swingtree.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/swingtree.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/Evolution74Test/ok/swingtree.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/evolution74Test/ok/swingtree.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nText.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nText.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nText.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nText.xml index c292cb6..a25730e 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nText.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nText.xml @@ -18,7 +18,7 @@ <force>true</force> <i18nable>true</i18nable> <includes> - <value>**/I18nTest/text/*.jaxx</value> + <value>**/i18nTest/text/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nTitle.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nTitle.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nTitle.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nTitle.xml index ad744a6..260b3af 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nTitle.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nTitle.xml @@ -18,7 +18,7 @@ <force>true</force> <i18nable>true</i18nable> <includes> - <value>**/I18nTest/title/*.jaxx</value> + <value>**/i18nTest/title/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nToolTipText.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nToolTipText.xml similarity index 93% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nToolTipText.xml rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nToolTipText.xml index 441f7a3..b16f41f 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/I18nToolTipText.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/I18nToolTipText.xml @@ -18,7 +18,7 @@ <force>true</force> <i18nable>true</i18nable> <includes> - <value>**/I18nTest/tooltiptext/*.jaxx</value> + <value>**/i18nTest/tooltiptext/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/text/JButton.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/text/JButton.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/text/JButton.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/text/JButton.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JDialog.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/title/JDialog.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JDialog.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/title/JDialog.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JTabbedPane.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/title/JTabbedPane.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JTabbedPane.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/title/JTabbedPane.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JTabbedPane2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/title/JTabbedPane2.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/title/JTabbedPane2.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/title/JTabbedPane2.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JButton.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/tooltiptext/JButton.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JButton.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/tooltiptext/JButton.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/tooltiptext/JTabbedPane.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/tooltiptext/JTabbedPane.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/tooltiptext/JTabbedPane2.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane2.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/tooltiptext/JTabbedPane2.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane3.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/tooltiptext/JTabbedPane3.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/I18nTest/tooltiptext/JTabbedPane3.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/i18nTest/tooltiptext/JTabbedPane3.jaxx -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit d86ecc08d7978251ed7c7555f8b253b5b8af2da5 Author: Tony Chemit <chemit@codelutin.com> Date: Mon Nov 2 03:38:30 2009 +0000 svn ignore idea files -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 6b2c33ae69cd2a3e774e6006f46c091ec62a5d53 Author: Tony Chemit <chemit@codelutin.com> Date: Mon Nov 2 03:47:28 2009 +0000 use mavenpom 1.1.0 --- pom.xml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index c6b1fdd..1acdd7b 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,5 @@ - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>mavenpom</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.0</version> </parent> <artifactId>jaxx</artifactId> @@ -18,7 +18,7 @@ <modules> <module>jaxx-runtime</module> - + <module>jaxx-compiler</module> <module>jaxx-swing-action</module> @@ -282,7 +282,7 @@ </exclusion> </exclusions> </dependency> - + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> @@ -296,7 +296,7 @@ <version>1.0</version> <scope>test</scope> </dependency> - + <dependency> <groupId>org.apache.maven.plugin-testing</groupId> <artifactId>maven-plugin-testing-harness</artifactId> @@ -331,7 +331,7 @@ </exclusions> </dependency> - + </dependencies> </dependencyManagement> @@ -343,7 +343,7 @@ <description>JAXX Project</description> <inceptionYear>2008</inceptionYear> <url>http://maven-site.nuiton.org/jaxx-2.0</url> - + <!-- ************************************************************* --> <!-- *** Build Settings ****************************************** --> <!-- ************************************************************* --> @@ -359,7 +359,7 @@ <i18n.version>1.0.2-SNAPSHOT</i18n.version> <jxlayer.version>3.0.3</jxlayer.version> - + <javahelp.version>2.0.02</javahelp.version> </properties> @@ -386,7 +386,7 @@ </dependency> </dependencies> </plugin> - + </plugins> </pluginManagement> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 01cdb0852e8043ff63d6a815829153880594d7d0 Author: Tony Chemit <chemit@codelutin.com> Date: Mon Nov 2 07:52:03 2009 +0000 fix javadoc --- .../src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java index 516e243..7f3b427 100644 --- a/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java +++ b/maven-jaxx-plugin/src/main/java/org/nuiton/jaxx/plugin/GenerateMojo.java @@ -120,7 +120,7 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat * * @parameter expression="${jaxx.defaultDecoratorFQN}" default-value="jaxx.compiler.decorators.DefaultCompiledObjectDecorator" * - * @see jaxx.compiler.decorators.CompiledObjectDecorator + * @see jaxx.compiler.CompiledObjectDecorator */ protected String defaultDecoratorFQN; /** @@ -173,7 +173,7 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat */ protected boolean testPhase; /** - * to make compiler i18nable, says add the {@link org.nuiton.i18n.I18n#_(String, Object[])} method + * to make compiler i18nable, says add the {@link org.nuiton.i18n.I18n#_(String, Object...)} method * invocation on {@link jaxx.compiler.I18nHelper#I18N_ATTRIBUTES} attributes. * * @parameter expression="${jaxx.i18nable}" default-value="true" @@ -205,7 +205,7 @@ public class GenerateMojo extends AbstractJaxxMojo implements CompilerConfigurat /** * extra path to be added in {@link java.beans.Introspector#setBeanInfoSearchPath(java.lang.String[])}. * <p/> - * add beanInfoSearchPath to be registred by {@link BeanInfoUtil#addJaxxBeanInfoPath(java.lang.String[])} + * add beanInfoSearchPath to be registred by {@link BeanInfoUtil#addJaxxBeanInfoPath(java.lang.String...)} * <p/> * and then will be use by {@link jaxx.compiler.spi.DefaultInitializer#initialize()}. * <p/> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit f6544f0e320083a01050e0c4dcd2449556025112 Author: Tony Chemit <chemit@codelutin.com> Date: Tue Nov 3 21:02:20 2009 +0000 add selected-ui in context accessible via helper.getSelectedUi() --- .../navigation/NavigationTreeContextHelper.java | 26 +++++++++++++++++++++- .../swing/navigation/NavigationTreeHandler.java | 10 +++++---- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java index 1b69acc..4d36e53 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java @@ -21,10 +21,13 @@ package jaxx.runtime.swing.navigation; import javax.swing.JTree; + import jaxx.runtime.JAXXContext; import jaxx.runtime.Util; import jaxx.runtime.context.JAXXContextEntryDef; +import java.awt.*; + /** * To help getting and setting navigation tree objects from a {@link JAXXContext}. * <p/> @@ -36,8 +39,9 @@ import jaxx.runtime.context.JAXXContextEntryDef; * <li>selected path : the navigation path of the selected node</li> * <li>selected node : the selected node</li> * <li>selected bean : the selected bean</li> + * <li>selected ui : the selected content ui</li> * </ul> - * + * <p/> * To make possible the use of more than one navigation tree system in a same * context, we <b>MUST</b> distinguish the context entries definition. For this * purpose, entries definition are normalized and prefixed by a unique {@link #prefix}. @@ -50,6 +54,7 @@ import jaxx.runtime.context.JAXXContextEntryDef; * <li>selected path : {@code prefix + "-selected-path"}</li> * <li>selected node : {@code prefix + "-selected-node"}</li> * <li>selected bean : {@code prefix + "-selected-bean"}</li> + * <li>selected ui: {@code prefix + "-selected-ui"}</li> * </ul> * * @author chemit @@ -64,6 +69,7 @@ public class NavigationTreeContextHelper { protected JAXXContextEntryDef<NavigationTreeModel> treeModelContextEntry; protected JAXXContextEntryDef<NavigationTreeHandler> treeHandlerContextEntry; protected JAXXContextEntryDef<JTree> treeContextEntry; + protected JAXXContextEntryDef<Component> selectedUIContextEntry; public NavigationTreeContextHelper(String prefix) { this.prefix = prefix; @@ -73,6 +79,7 @@ public class NavigationTreeContextHelper { selectedBeanContextEntry = Util.newContextEntryDef(prefix + "-selected-bean", Object.class); selectedNodeContextEntry = Util.newContextEntryDef(prefix + "-selected-node", NavigationTreeNode.class); selectedPathContextEntry = Util.newContextEntryDef(prefix + "-selected-path", String.class); + selectedUIContextEntry = Util.newContextEntryDef(prefix + "-selected-ui", Component.class); } public String getPrefix() { @@ -109,6 +116,11 @@ public class NavigationTreeContextHelper { return r; } + public Component getSelectedUI(JAXXContext context) { + Component r = getSelectedUIContextEntry().getContextValue(context); + return r; + } + public void setTreeModel(JAXXContext context, NavigationTreeModel model) { getTreeModelContextEntry().setContextValue(context, model); } @@ -145,6 +157,14 @@ public class NavigationTreeContextHelper { } } + public void setSelectedUI(JAXXContext context, Component ui) { + if (ui == null) { + getSelectedUIContextEntry().removeContextValue(context); + } else { + getSelectedUIContextEntry().setContextValue(context, ui); + } + } + protected JAXXContextEntryDef<NavigationTreeModel> getTreeModelContextEntry() { return treeModelContextEntry; } @@ -168,4 +188,8 @@ public class NavigationTreeContextHelper { protected JAXXContextEntryDef<JTree> getTreeContextEntry() { return treeContextEntry; } + + public JAXXContextEntryDef<Component> getSelectedUIContextEntry() { + return selectedUIContextEntry; + } } diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java index 05ba83c..cb87f65 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java @@ -239,10 +239,16 @@ public abstract class NavigationTreeHandler extends DefaultTreeSelectionModel { // save in context current node helper.setSelectedNode(ctxt, node); + // save in context current ui + helper.setSelectedUI(ctxt, newUI); + // really open the ui associated with the selected node + // init ui before to be visible if (newUI instanceof NavigationContentUI) { ((NavigationContentUI) newUI).openUI(node); } + + // set ui in content openUI(newUI, node); } catch (Exception e) { @@ -287,15 +293,11 @@ public abstract class NavigationTreeHandler extends DefaultTreeSelectionModel { // remove previous selected bean //TODO-TC-20091004 should have an automatic clean context method while - // quiting a node ? helper.setSelectedBean(ctxt, null); if (data != null) { helper.setSelectedBean(ctxt, data); - //FIXME-TC-20091004 : should really remove this, this is not context safe - //todo should we not use this to avoid conflict in context ? - //context.setContextValue(data); } } } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit e34f786fc61ba040710b7e35961920ab5eb64471 Author: Tony Chemit <chemit@codelutin.com> Date: Tue Nov 3 23:15:39 2009 +0000 new icons --- jaxx-demo/src/main/resources/icons/action-collapse.png | Bin 0 -> 372 bytes jaxx-demo/src/main/resources/icons/action-expand.png | Bin 0 -> 371 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/jaxx-demo/src/main/resources/icons/action-collapse.png b/jaxx-demo/src/main/resources/icons/action-collapse.png new file mode 100644 index 0000000..f88a24a Binary files /dev/null and b/jaxx-demo/src/main/resources/icons/action-collapse.png differ diff --git a/jaxx-demo/src/main/resources/icons/action-expand.png b/jaxx-demo/src/main/resources/icons/action-expand.png new file mode 100644 index 0000000..3c19e48 Binary files /dev/null and b/jaxx-demo/src/main/resources/icons/action-expand.png differ -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 7711568c4363aa8135cfd415ccd264b9d9a98852 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Nov 4 20:35:40 2009 +0000 add fillList + deprecated some code --- .../src/main/java/jaxx/runtime/SwingUtil.java | 79 ++++++++++++++-------- .../main/java/jaxx/runtime/swing/JAXXComboBox.java | 28 ++++++-- 2 files changed, 71 insertions(+), 36 deletions(-) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java b/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java index e6ea4d9..adfefa7 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java @@ -35,10 +35,7 @@ import java.beans.PropertyDescriptor; import java.io.IOException; import java.io.InputStream; import java.util.List; -import javax.swing.DefaultComboBoxModel; -import javax.swing.JComboBox; -import javax.swing.JTable; -import javax.swing.SwingUtilities; +import javax.swing.*; import javax.swing.event.TreeSelectionEvent; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; @@ -58,21 +55,12 @@ import java.util.Map; import java.util.Map.Entry; import java.util.NoSuchElementException; import java.util.Properties; -import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JLayeredPane; -import javax.swing.JRootPane; -import javax.swing.JTabbedPane; -import javax.swing.JTree; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; import javax.swing.event.HyperlinkEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; + import jaxx.runtime.swing.renderer.BooleanCellRenderer; import jaxx.runtime.swing.renderer.EmptyNumberTableCellRenderer; import jaxx.runtime.swing.renderer.EnumTableCellRenderer; @@ -85,15 +73,17 @@ import org.jdesktop.jxlayer.JXLayer; /** * The runtime swing util class with some nice stuff. - * + * <p/> * Note : Replace previous class jaxx.runtime.swing.Utils in previous versions. - * + * * @author tony * @since 1.2 */ public class SwingUtil extends Util { - /** to use log facility, just put in your code: log.info(\"...\"); */ + /** + * to use log facility, just put in your code: log.info(\"...\"); + */ static private final Log log = LogFactory.getLog(SwingUtil.class); private static Field numReaders; private static Field notifyingListeners; @@ -188,15 +178,42 @@ public class SwingUtil extends Util { } /** + * Fill a list model with some datas, and select after all the given object + * + * @param list the list to fill + * @param data data ot inject in combo + * @param select the object to select in combo after reflling his model + */ + public static void fillList(JList list, Collection<?> data, Object select) { + if (!(list.getModel() instanceof DefaultListModel)) { + throw new IllegalArgumentException("this method need a DefaultComboBoxModel for this model but was " + list.getModel().getClass()); + } + DefaultListModel model = (DefaultListModel) list.getModel(); + // evince the model +// model.removeListDataListener(combo); + model.removeAllElements(); + if (data != null) { + for (Object o : data) { + model.addElement(o); + } + } + // attach the model +// model.addListDataListener(combo); + list.setSelectedValue(select, true); + } + + /** * TODO move this to JAXXComboBox. - * + * <p/> * Fill a combo box model with some datas, and select after all the given object * * @param combo the combo to fill * @param data data ot inject in combo * @param select the object to select in combo after reflling his model * @param firstNull add a first null element + * @deprecated since 1.7.XXX this code is moved to JAXXComboBox */ + @Deprecated public static void fillComboBox(JAXXComboBox combo, Collection<?> data, Object select, boolean firstNull) { List<Item> items = new ArrayList<Item>(); if (firstNull) { @@ -385,10 +402,10 @@ public class SwingUtil extends Util { /** * Centrer un component graphique au center d'un autre component. - * + * <p/> * <b>Note:</b> si le parent est null, alors on ne fait rien. * - * @param parent le component parent + * @param parent le component parent * @param component le component à centrer */ public static void center(Component parent, Component component) { @@ -404,6 +421,7 @@ public class SwingUtil extends Util { /** * Try to load the Nimbus look and feel. * <p/> + * * @throws UnsupportedLookAndFeelException * if nimbus is not applicable * @throws ClassNotFoundException @@ -423,9 +441,8 @@ public class SwingUtil extends Util { * Load the ui.properties file and set in {@link UIManager} colors and icons found. * * @param defaultUIConfig le path vers le fichier de la config d'ui par défaut (doit etre dansle class-path) - * @param extraUIConfig le path vers une surcharge de la config d'ui (doit etre dans le class-path) - * - * @throws IOException if could not load the ui.properties file + * @param extraUIConfig le path vers une surcharge de la config d'ui (doit etre dans le class-path) + * @throws IOException if could not load the ui.properties file */ public static void loadUIConfig(String defaultUIConfig, String extraUIConfig) throws IOException { @@ -471,8 +488,9 @@ public class SwingUtil extends Util { /** * Iterate the components of a {@link JTabbedPane} in natural order. - * + * <p/> * Says using method {@link JTabbedPane#getComponent(int)} + * * @param tabs the * @return the iterator * @since 1.4 @@ -489,15 +507,15 @@ public class SwingUtil extends Util { /** * A simple iterator on a {@link JTabbedPane}. - * + * <p/> * Implements the method {@link #get(int, java.awt.Component)} to obtain * the data required given the component (or index). - * + * <p/> * You can also inverse the order by usin the method {@link #reverse()}. - * + * <p/> * Note: After the use of the method {@link #reverse()} the iterator returns * to the first element. - * + * * @param <O> the type of return elements. * @since 1.4 */ @@ -589,6 +607,7 @@ public class SwingUtil extends Util { /** * Gets the higest visible component in a ancestor hierarchy at * specific x,y coordinates + * * @param parent * @param x * @param y @@ -702,9 +721,9 @@ public class SwingUtil extends Util { /** * Open a link coming from a {@link HyperlinkEvent}. - * + * <p/> * And try to open the link if an url in a browser. - * + * * @param he the event to treate * @since 1.6.0 */ diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXComboBox.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXComboBox.java index 48a4e8a..a32b2b2 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXComboBox.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/JAXXComboBox.java @@ -20,12 +20,7 @@ */ package jaxx.runtime.swing; -import javax.swing.AbstractListModel; -import javax.swing.ComboBoxModel; -import javax.swing.DefaultListCellRenderer; -import javax.swing.JComboBox; -import javax.swing.JList; -import javax.swing.ListModel; +import javax.swing.*; import java.awt.Component; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; @@ -221,6 +216,27 @@ public class JAXXComboBox extends JComboBox { setItems(items); } + /** + * Fill the model with some datas, and select after all the given object + * + * @param data data ot inject in combo + * @param select the object to select in combo after reflling his model + * @param firstNull add a first null element + * @deprecated since 1.7.XXX this code is moved to JAXXComboBox + */ + public void fillComboBox(Collection<?> data, Object select, boolean firstNull) { + List<Item> items = new ArrayList<Item>(); + if (firstNull) { + items.add(new Item("null", " ", null, false)); + } + if (data != null) { + for (Object d : data) { + items.add(new Item(d.toString(), d.toString(), d, d.equals(select))); + } + } + this.setItems(items); + } + // this way we can keep it marked protected and still allow code in this file to call it @Override protected void fireItemStateChanged(ItemEvent e) { -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 6953eeda1d47b08b0e959267a4e296e50c58a4f3 Author: Tony Chemit <chemit@codelutin.com> Date: Wed Nov 4 21:13:46 2009 +0000 fix error message --- jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java b/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java index adfefa7..a1da7f7 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java @@ -186,7 +186,7 @@ public class SwingUtil extends Util { */ public static void fillList(JList list, Collection<?> data, Object select) { if (!(list.getModel() instanceof DefaultListModel)) { - throw new IllegalArgumentException("this method need a DefaultComboBoxModel for this model but was " + list.getModel().getClass()); + throw new IllegalArgumentException("this method need a DefaultListModel for this model but was " + list.getModel().getClass()); } DefaultListModel model = (DefaultListModel) list.getModel(); // evince the model -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit ef6a13f60052daff7718c8d310d481a84fc490e1 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Nov 5 02:21:58 2009 +0000 Anomalie #120: NPE sur un removeDataBinding --- .../jaxx/compiler/tags/DefaultObjectHandler.java | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java index d776bc6..2971f13 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java @@ -61,6 +61,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.WeakHashMap; + import org.apache.commons.lang.StringUtils; /** @@ -164,7 +165,8 @@ public class DefaultObjectHandler implements TagHandler { /** * Performs introspection on the beanClass and stores the results. * - * @throws java.beans.IntrospectionException if any pb + * @throws java.beans.IntrospectionException + * if any pb */ protected void init() throws IntrospectionException { if (jaxxBeanInfo == null) { @@ -215,7 +217,8 @@ public class DefaultObjectHandler implements TagHandler { * * @param beanClass the bean class for which to retrieve <code>JAXXBeanInfo</code> * @return the class' <code>JAXXBeanInfo</code> - * @throws java.beans.IntrospectionException if any pb + * @throws java.beans.IntrospectionException + * if any pb */ public static JAXXBeanInfo getJAXXBeanInfo(ClassDescriptor beanClass) throws IntrospectionException { return JAXXIntrospector.getJAXXBeanInfo(beanClass); @@ -403,7 +406,12 @@ public class DefaultObjectHandler implements TagHandler { String modelMemberName = eventInfo.modelName != null ? "get" + StringUtils.capitalize(eventInfo.modelName) : null; String modelClassName = modelMemberName != null ? getBeanClass().getMethodDescriptor(modelMemberName).getReturnType().getName() : JAXXCompiler.getCanonicalName(getBeanClass()); String code = objectCode + (eventInfo.modelName != null ? "." + modelMemberName + "()" : ""); - result.append("((").append(modelClassName).append(") $bindingSources.remove(\"").append(code).append("\")).").append(eventInfo.removeMethod).append("((").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(") jaxx.runtime.Util.getEventListener(").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(compiler.getJavaCode(methodName)).append("));\n"); + String eol = JAXXCompiler.getLineSeparator(); + result.append(modelClassName).append(" $target = ((").append(modelClassName).append(") $bindingSources.remove(\"").append(code).append("\"));").append(eol); + result.append("if ($target != null) {").append(eol); + result.append(" $target.").append(eventInfo.removeMethod).append("(jaxx.runtime.Util.getEventListener(").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(compiler.getJavaCode(methodName)).append("));").append(eol); + result.append("}").append(eol); +// result.append("((").append(modelClassName).append(") $bindingSources.remove(\"").append(code).append("\")).").append(eventInfo.removeMethod).append("((").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(") jaxx.runtime.Util.getEventListener(").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(compiler.getJavaCode(methodName)).append("));\n"); if (eventInfo.modelName != null) { result.append(getRemoveMemberListenerCode(objectCode, dataBinding, "get" + StringUtils.capitalize(eventInfo.modelName), Util.class.getName() + ".getDataBindingUpdateListener(this, \"" + dataBinding + "\")", @@ -504,7 +512,7 @@ public class DefaultObjectHandler implements TagHandler { // TODO: remove this temporary method, complete switchover to ClassDescriptors public void addProxyEventInfo(String memberName, Class<?> listenerClass, - String modelName, String addMethod, String removeMethod) { + String modelName, String addMethod, String removeMethod) { try { addProxyEventInfo(memberName, ClassDescriptorLoader.getClassDescriptor(listenerClass.getName()), modelName, addMethod, removeMethod); } catch (ClassNotFoundException e) { @@ -540,7 +548,7 @@ public class DefaultObjectHandler implements TagHandler { * @param removeMethod remove method name */ public void addProxyEventInfo(String memberName, ClassDescriptor listenerClass, - String modelName, String addMethod, String removeMethod) { + String modelName, String addMethod, String removeMethod) { ProxyEventInfo info = new ProxyEventInfo(); info.memberName = memberName; info.listenerClass = listenerClass; @@ -614,7 +622,7 @@ public class DefaultObjectHandler implements TagHandler { } /** - * Initializes the default settings of the object, prior to setting its + * Initializes the default settings of the object, prior to setting its * attribute values. The default implementation does nothing. * * @param object the object to initialize @@ -935,7 +943,7 @@ public class DefaultObjectHandler implements TagHandler { String id = isRoot ? object.getId() + ' ' + descriptor.getId() : "( " + object.getId() + " ) " + descriptor.getId(); CompiledObject child = new CompiledObject(id, "((" + JAXXCompiler.getCanonicalName(classDescriptor) + ") " + - object.getJavaCode() + ".getObjectById(" + compiler.getJavaCode(descriptor.getId()) + "))", + object.getJavaCode() + ".getObjectById(" + compiler.getJavaCode(descriptor.getId()) + "))", classDescriptor, compiler, true); -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 89dd54ba4dda09bd07a6ea4517c2952738741887 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Nov 5 02:22:45 2009 +0000 use generics (avoid to generate cast :)) --- jaxx-runtime/src/main/java/jaxx/runtime/Util.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/Util.java b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java index 7358266..18e5f03 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/Util.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java @@ -151,7 +151,7 @@ public class Util { } } - public static Object getEventListener(Class<? extends EventListener> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) { + public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) { WeakReference<List<EventListenerDescriptor>> ref = eventListeners.get(methodContainer); List<EventListenerDescriptor> descriptors = ref != null ? ref.get() : null; if (descriptors == null) { @@ -162,7 +162,7 @@ public class Util { if (listenerClass == descriptor.listenerClass && (listenerMethodName == null ? descriptor.listenerMethodName == null : listenerMethodName.equals(descriptor.listenerMethodName)) && methodName.equals(descriptor.methodName)) { - return descriptor.eventListener; + return (E) descriptor.eventListener; } } } @@ -218,13 +218,13 @@ public class Util { } }); descriptors.add(descriptor); - return descriptor.eventListener; + return (E) descriptor.eventListener; } catch (NoSuchMethodException e) { throw new RuntimeException(e); } } - public static Object getEventListener(Class<? extends EventListener> listenerClass, final Object methodContainer, final String methodName) { + public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final Object methodContainer, final String methodName) { return getEventListener(listenerClass, null, methodContainer, methodName); } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit db92c1700d5fa2005818e18aa16a5c858947cf66 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Nov 5 02:25:48 2009 +0000 add HidorButton widget, prefer of JXCollapsePanel since it does not works very well out of the JX framework... This widget does not modify any layout --- .../main/java/jaxx/runtime/swing/HidorButton.jaxx | 77 +++++++++++++++++++++ .../resources/i18n/jaxx-widgets-en_GB.properties | 2 + .../resources/i18n/jaxx-widgets-fr_FR.properties | 3 + .../src/main/resources/icons/action-collapse.png | Bin .../src/main/resources/icons/action-expand.png | Bin 5 files changed, 82 insertions(+) diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/HidorButton.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/HidorButton.jaxx new file mode 100644 index 0000000..98d2e64 --- /dev/null +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/HidorButton.jaxx @@ -0,0 +1,77 @@ +<!-- + +/** + * *##% jaxx-runtime-swing-widget + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* + */ + +--> +<JToggleButton id='hidor' + icon='{updateIcon(isTargetVisible())}' + toolTipText='{updateToolTipText(isTargetVisible())}' + _collapseIcon='{SwingUtil.createActionIcon("collapse")}' + _expandIcon='{SwingUtil.createActionIcon("expand")}' + _collapseTip='{_("hidor.collapseTip")}' + _expandTip='{_("hidor.expandTip")}' + onActionPerformed='setTargetVisible(!targetVisible)'> + + <!--selected='{updateCollapseIcon(isTargetVisible())}'--> + <Boolean id='targetVisible' javaBean='true'/> + + <script><![CDATA[ +import jaxx.runtime.SwingUtil; + +addPropertyChangeListener("targetVisible", new PropertyChangeListener() { + + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (log.isDebugEnabled()) { + log.debug("target visible changed <" + evt.getOldValue() + ":" + evt.getNewValue() + ">"); + } + boolean newValue = (Boolean) evt.getNewValue(); + if (target != null) { + target.setVisible(newValue); + }; + } +}); + +protected JComponent target; + +public JComponent getTarget() { + return target; +} + +public void setTarget(JComponent target) { + JComponent oldValue = this.target; + this.target = target; + firePropertyChange("target", oldValue, target); +} + +protected Icon updateIcon(boolean c) { + String key = c ? "collapseIcon" : "expandIcon"; + Icon i = (Icon) getClientProperty(key); + return i; +} + +protected String updateToolTipText(boolean c) { + String key = c ? "collapseTip" : "expandTip"; + String i = (String) getClientProperty(key); + return i; +} +]]> + </script> +</JToggleButton> diff --git a/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties b/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties index 5430ac8..3560d78 100644 --- a/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties +++ b/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties @@ -46,6 +46,8 @@ entitycombobox.unknown.type=Object of unkown type errorUI.action.close=Close errorUI.message=An error wad detected... errorUI.title=Error... +hidor.collapseTip=Hide +hidor.expandTip=Show i18neditor.empty.locales=< No locale to select > i18neditor.popup.title=Change language i18neditor.selected=Selected language \: %1$s diff --git a/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties b/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties index 4cc23a4..2a1ce17 100644 --- a/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties +++ b/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties @@ -47,6 +47,9 @@ entitycombobox.unknown.type=Objet de type inconnu errorUI.action.close=Fermer errorUI.message=Une erreur est survenue \! errorUI.title=Erreur... +hidor.collapseTip=Voir +hidor.expandTip= +hidor.showTip=Cacher i18neditor.empty.locales=< Aucune locale \u00E0 s\u00E9lectionner > i18neditor.popup.title=Changer de langue i18neditor.selected=Langue actuellement utilis\u00E9e \: %1$s diff --git a/jaxx-demo/src/main/resources/icons/action-collapse.png b/jaxx-widgets/src/main/resources/icons/action-collapse.png similarity index 100% rename from jaxx-demo/src/main/resources/icons/action-collapse.png rename to jaxx-widgets/src/main/resources/icons/action-collapse.png diff --git a/jaxx-demo/src/main/resources/icons/action-expand.png b/jaxx-widgets/src/main/resources/icons/action-expand.png similarity index 100% rename from jaxx-demo/src/main/resources/icons/action-expand.png rename to jaxx-widgets/src/main/resources/icons/action-expand.png -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit c206fcb8de8166194f412f0ced990eba01e2b611 Author: Tony Chemit <chemit@codelutin.com> Date: Thu Nov 5 17:02:40 2009 +0000 add getSimpleName method to obtain the simple name of the class --- .../jaxx/compiler/reflect/ClassDescriptor.java | 45 ++++++++++++---------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptor.java b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptor.java index b540254..976f646 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptor.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/reflect/ClassDescriptor.java @@ -1,23 +1,23 @@ -/* - * *##% - * JAXX Compiler - * Copyright (C) 2008 - 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * ##%* - */ +/* + * *##% + * JAXX Compiler + * Copyright (C) 2008 - 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ package jaxx.compiler.reflect; import jaxx.runtime.JAXXObjectDescriptor; @@ -68,6 +68,11 @@ public abstract class ClassDescriptor { return name; } + public String getSimpleName() { + int dot = name.lastIndexOf("."); + return dot == -1 ? name : name.substring(dot + 1); + } + public String getPackageName() { return packageName; } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit b5e93d99cf400e3e55cf53d4403f61acf85501fe Author: Tony Chemit <chemit@codelutin.com> Date: Thu Nov 5 20:44:42 2009 +0000 - review JAXXContext api (remove getParentContainer methods) - improve JAXXObject api (add getParentContainer + make it javaBeans compatible for PropertyChange events) - improve generation code (avoid use of FQN when possible) - fix bug of name collisions on event generated method from css - the maven-jaxx-plugin tests are all compiling, we should compile them on integration-test - add getSimpleName on class descriptor - clean code, add javadoc, reformat, ... - add ListSelectorUI widget --- .../main/java/jaxx/compiler/CompiledObject.java | 46 ++-- .../src/main/java/jaxx/compiler/JAXXCompiler.java | 231 +++++++++++---------- .../src/main/java/jaxx/compiler/JAXXEngine.java | 26 +-- .../java/jaxx/compiler/binding/DataBinding.java | 22 +- .../java/jaxx/compiler/binding/DataSource.java | 96 +-------- .../java/jaxx/compiler/css/StylesheetHelper.java | 8 +- .../jaxx/compiler/finalizers/DefaultFinalizer.java | 26 ++- .../compiler/tags/DefaultComponentHandler.java | 35 ++-- .../jaxx/compiler/tags/DefaultObjectHandler.java | 156 ++++++-------- .../main/java/jaxx/compiler/tags/TagManager.java | 14 +- .../java/jaxx/compiler/tags/swing/ItemHandler.java | 6 +- .../java/jaxx/compiler/tags/swing/TabHandler.java | 2 +- .../tags/validator/FieldValidatorHandler.java | 2 +- .../src/main/java/jaxx/runtime/JAXXContext.java | 70 +++---- .../src/main/java/jaxx/runtime/JAXXObject.java | 54 ++++- jaxx-runtime/src/main/java/jaxx/runtime/Util.java | 38 +++- .../java/jaxx/runtime/context/DataContext.java | 46 ++-- .../runtime/context/DefaultApplicationContext.java | 14 +- .../jaxx/runtime/context/DefaultJAXXContext.java | 88 ++++---- .../jaxx/runtime/context/JAXXInitialContext.java | 22 +- .../runtime/context/DefaultJAXXContextTest.java | 107 ++++++---- .../java/jaxx/runtime/swing/EntityComboBox.jaxx | 9 +- .../jaxx/runtime/swing/EntityComboBoxHandler.java | 4 +- .../main/java/jaxx/runtime/swing/HidorButton.jaxx | 51 ++--- .../java/jaxx/runtime/swing/ListSelectorUI.jaxx | 153 ++++++++++++++ .../src/main/resources/icons/action-add.png | Bin 0 -> 733 bytes .../src/main/resources/icons/action-remove.png | Bin 0 -> 715 bytes .../nuiton/jaxx/plugin/DataBinding/BeanImpl.java | 2 +- .../org/nuiton/jaxx/plugin/DataBindingTest.java | 6 +- .../compilerTest/classReferences}/JavaTaist.java | 2 +- .../validator/ok/Identity.java | 0 .../compilerValidatorTest/validator/ok/Model.java | 0 .../nuiton/jaxx/plugin/compilerTest/CSSTests.xml | 3 +- .../jaxx/plugin/compilerTest/ClassReferences.xml | 2 +- .../jaxx/plugin/compilerTest/Initializers.xml | 2 +- .../jaxx/plugin/compilerTest/InnerClasses.xml | 2 +- .../plugin/compilerTest/OverridingDataBindings.xml | 2 +- .../org/nuiton/jaxx/plugin/compilerTest/Script.xml | 2 +- .../plugin/compilerTest/SpecialSubclassing.xml | 2 +- .../{CSSTests => cSSTests}/CSSTests.jaxx | 2 +- .../compilerTest/{CSSTests => cSSTests}/Child.jaxx | 0 .../{CSSTests => cSSTests}/Child2.jaxx | 0 .../{CSSTests => cSSTests}/GrandChild.jaxx | 0 .../{CSSTests => cSSTests}/GrandChildButton.jaxx | 0 .../{CSSTests => cSSTests}/Pseudoclasses.jaxx | 0 .../{CSSTests => cSSTests}/SimpleCSS.jaxx | 0 .../ClassReferences.jaxx | 0 .../ConstructorReferenceTest.jaxx | 0 .../JAXXReferenceTest.jaxx | 0 .../JAXXTest.jaxx | 0 .../StaticMethodTest.jaxx | 0 .../TypeReference.jaxx | 0 .../Initializers.jaxx | 0 .../InnerClasses.jaxx | 0 .../CurrentTime.jaxx | 0 .../OverriddenCurrentTime.jaxx | 0 .../OverridingDataBindings.jaxx | 0 .../{Script => script}/JScriptInitializer.jaxx | 0 .../JComboBoxTest1.jaxx | 0 .../JComboBoxTest2.jaxx | 0 .../JListTest1.jaxx | 0 .../JListTest2.jaxx | 0 .../JTreeTest1.jaxx | 0 .../JTreeTest2.jaxx | 0 .../SpecialSubclassing.jaxx | 0 .../validator/ok/Validation.jaxx | 8 +- .../validator/ok/ValidationBeanClass.jaxx | 2 +- .../nuiton/jaxx/plugin/dataBindingTest/First.jaxx | 4 +- 68 files changed, 756 insertions(+), 611 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java b/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java index a956e01..2cc5461 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/CompiledObject.java @@ -127,7 +127,7 @@ public class CompiledObject { CompiledObject child; String constraints; String childJavaCode; - String delegateCode; + private String delegateCode; public ChildRef(CompiledObject child, String constraints, String childJavaCode, String delegateCode) { this.child = child; @@ -140,17 +140,17 @@ public class CompiledObject { return child; } - public void setChild(CompiledObject child) { - this.child = child; - } - - public String getConstraints() { - return constraints; - } - - public void setConstraints(String constraints) { - this.constraints = constraints; - } +// public void setChild(CompiledObject child) { +// this.child = child; +// } +// +// public String getConstraints() { +// return constraints; +// } +// +// public void setConstraints(String constraints) { +// this.constraints = constraints; +// } public String getChildJavaCode() { return childJavaCode; @@ -160,13 +160,13 @@ public class CompiledObject { this.childJavaCode = childJavaCode; } - public String getDelegateCode() { - return delegateCode; - } - - public void setDelegateCode(String delegateCode) { - this.delegateCode = delegateCode; - } +// public String getDelegateCode() { +// return delegateCode; +// } +// +// public void setDelegateCode(String delegateCode) { +// this.delegateCode = delegateCode; +// } public void addToAdditionCode(StringBuffer buffer, boolean isRootObject) { //TC-20091026 do not prefix if on root object @@ -177,10 +177,8 @@ public class CompiledObject { prefix = javaCode + delegateCode + "."; } if (constraints != null) { -// buffer.append(javaCode).append(delegateCode).append(".add(").append(childJavaCode).append(", ").append(constraints).append(");"); buffer.append(prefix).append("add(").append(childJavaCode).append(", ").append(constraints).append(");"); } else { -// buffer.append(javaCode).append(delegateCode).append(".add(").append(childJavaCode).append(");"); buffer.append(prefix).append("add(").append(childJavaCode).append(");"); } buffer.append(JAXXCompiler.getLineSeparator()); @@ -460,10 +458,9 @@ public class CompiledObject { MethodDescriptor addMethod = handler.getAddMethod(); ClassDescriptor listenerClass = addMethod.getParameterTypes()[0]; //TC-20091026 use 'this' instead of root object javaCode - return getJavaCode() + '.' + addMethod.getName() + "((" + JAXXCompiler.getCanonicalName(listenerClass) + - ") jaxx.runtime.Util.getEventListener(" + JAXXCompiler.getCanonicalName(listenerClass) + ".class, " + + //TC-20091105 Util.getEventListener is generic, no more need cast and use simple name + return getJavaCode() + '.' + addMethod.getName() + "(Util.getEventListener(" + listenerClass.getSimpleName() + ".class, " + compiler.getJavaCode(handler.getListenerMethod().getName()) + ", this, " + - // compiler.getJavaCode(handler.getListenerMethod().getName()) + ", " + compiler.getRootObject().getJavaCode() + ", " + compiler.getJavaCode(compiler.getEventHandlerMethodName(handler)) + "));" + JAXXCompiler.getLineSeparator(); } @@ -708,7 +705,6 @@ public class CompiledObject { childRef.addToAdditionCode(buffer, compiler.getRootObject() == this); } additionCode = buffer.append(additionCode); - return; } } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java index bcde6ef..106d038 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXCompiler.java @@ -82,6 +82,7 @@ import java.util.Set; import java.util.Stack; import java.util.regex.Matcher; import java.util.regex.Pattern; + import jaxx.compiler.java.JavaFileGenerator; import jaxx.compiler.types.TypeManager; import org.apache.commons.lang.StringUtils; @@ -93,7 +94,7 @@ import org.apache.commons.lang.StringUtils; */ public class JAXXCompiler { - /** + /** * Logger */ protected static final Log log = LogFactory.getLog(JAXXCompiler.class); @@ -112,7 +113,7 @@ public class JAXXCompiler { * */ public static final String JAXX_INTERNAL_NAMESPACE = "http://www.jaxxframework.org/internal"; - /** + /** * Maximum length of an inlinable creation method. */ public static final int INLINE_THRESHOLD = 300; @@ -128,27 +129,27 @@ public class JAXXCompiler { /*------------------------------------------------------------------------*/ /*-- compiler fields -----------------------------------------------------*/ /*------------------------------------------------------------------------*/ - /** + /** * flag to detect if an error occurs while compiling jaxx file */ protected boolean failed; - /** + /** * Object corresponding to the root tag in the document. */ protected CompiledObject root; - /** + /** * Contains strings of the form "javax.swing." */ protected Set<String> importedPackages = new HashSet<String>(); - /** + /** * Contains strings of the form "javax.swing.Timer" */ protected Set<String> importedClasses = new HashSet<String>(); - /** + /** * Keeps track of open components (components still having children added). */ protected Stack<CompiledObject> openComponents = new Stack<CompiledObject>(); - /** + /** * Sequence number used to create automatic variable names. */ protected int autogenID = 0; @@ -165,15 +166,15 @@ public class JAXXCompiler { * which the .jaxx file resides). */ protected File baseDir; - /** + /** * jaxx file being compiled. */ protected File src; - /** + /** * Parsed XML of src file. */ protected Document document; - /** + /** * Name of class being compiled. */ protected String outputClassName; @@ -186,7 +187,7 @@ public class JAXXCompiler { * {@link #registerStylesheet}. */ protected Stylesheet stylesheet; - /** + /** * Contains all attributes defined inline on class tags. */ protected List<Rule> inlineStyles = new ArrayList<Rule>(); @@ -195,11 +196,11 @@ public class JAXXCompiler { * contains all event handlers of a particular type attached to a particular object (again, as represented by a Java expression). */ protected Map<String, Map<ClassDescriptor, List<EventHandler>>> eventHandlers = new HashMap<String, Map<ClassDescriptor, List<EventHandler>>>(); - /** + /** * Maps of uniqued id for objects used in compiler */ protected Map<Object, String> uniqueIds = new HashMap<Object, String>(); - /** + /** * Map of event handler method names used in compiler */ protected Map<EventHandler, String> eventHandlerMethodNames = new HashMap<EventHandler, String>(); @@ -213,43 +214,43 @@ public class JAXXCompiler { * created in document order. */ protected List<Runnable> initializers = new ArrayList<Runnable>(); - /** + /** * left brace matcher */ protected Matcher leftBraceMatcher = Pattern.compile("^(\\{)|[^\\\\](\\{)").matcher(""); - /** + /** * right brace matcher */ protected Matcher rightBraceMatcher = Pattern.compile("^(\\})|[^\\\\](\\})").matcher(""); - /** + /** * extra interfaces which can by passed to root object via the 'implements' attribute */ private String[] extraInterfaces; - /** + /** * a flag to generate a abstract class */ private boolean abstractClass; - /** + /** * the possible generic type of the class */ private String genericType; - /** + /** * the possible generic type of the super class */ private String superGenericType; - /** + /** * Extra code to be added to the instance initializer. */ protected StringBuffer initializer = new StringBuffer(); - /** + /** * Extra code to be added at the end of the instance initializer. */ protected StringBuffer lateInitializer = new StringBuffer(); - /** + /** * Extra code to be added to the class body. */ protected StringBuffer bodyCode = new StringBuffer(); - /** + /** * Code to initialize data bindings. */ protected StringBuffer initDataBindings = new StringBuffer(); @@ -305,12 +306,12 @@ public class JAXXCompiler { /** * Creates a new JAXXCompiler. * - * @param engine engine which use the compiler (could be null if not attach to any engine) - * @param baseDir classpath location - * @param src location of file to run - * @param outputClassName the out file name - * @param configuration configuration to pass to javac - * @param defaultImports list of default imports to add to java files + * @param engine engine which use the compiler (could be null if not attach to any engine) + * @param baseDir classpath location + * @param src location of file to run + * @param outputClassName the out file name + * @param configuration configuration to pass to javac + * @param defaultImports list of default imports to add to java files */ public JAXXCompiler(JAXXEngine engine, File baseDir, File src, String outputClassName, CompilerConfiguration configuration, List<String> defaultImports) { this.engine = engine; @@ -412,7 +413,7 @@ public class JAXXCompiler { symbolTable.getClassTagIds().put(id, fullClassName); if (tag.getAttributeNode(DefaultObjectHandler.JAVA_BEAN_ATTRIBUTE) != null) { // add java bean support for this property - String capitalizeName = org.apache.commons.lang.StringUtils.capitalize(id); + String capitalizeName = StringUtils.capitalize(id); // add method symbolTable.getScriptMethods().add(new MethodDescriptor("get" + capitalizeName, Modifier.PUBLIC, fullClassName, new String[0], classLoader)); if (Boolean.class.getName().equals(fullClassName)) { @@ -447,15 +448,15 @@ public class JAXXCompiler { } }); } - if (handler != null) { + if (handler == null) { + reportError("Could not find a Java class corresponding to: <" + tag.getTagName() + ">"); + failed = true; + } else { try { handler.compileFirstPass(tag, this); } catch (CompilerException e) { reportError(e); } - } else { - reportError("Could not find a Java class corresponding to: <" + tag.getTagName() + ">"); - failed = true; } Element finished = tagsBeingCompiled.pop(); @@ -468,12 +469,12 @@ public class JAXXCompiler { tagsBeingCompiled.push(tag); TagHandler handler = TagManager.getTagHandler(tag.getNamespaceURI(), tag.getLocalName(), tag.getPrefix() != null, this); - if (handler != null) { - handler.compileSecondPass(tag, this); - } else { + if (handler == null) { reportError("Could not find a Java class corresponding to: <" + tag.getTagName() + ">"); - assert false : "can't-happen error: error should have been reported during the fast pass and caused an abort"; +// assert false : "can't-happen error: error should have been reported during the fast pass and caused an abort"; failed = true; + } else { + handler.compileSecondPass(tag, this); } Element finished = tagsBeingCompiled.pop(); @@ -615,11 +616,10 @@ public class JAXXCompiler { * If the attribute value does not invoke data binding, this method returns <code>null</code> * * @param stringValue the string value of the property from the XML - * @param type the type of the property, from the <code>JAXXPropertyDescriptor</code> * @return a processed version of the expression * @throws CompilerException ? */ - public String processDataBindings(String stringValue, ClassDescriptor type) throws CompilerException { + public String processDataBindings(String stringValue) throws CompilerException { int pos = getNextLeftBrace(stringValue, 0); if (pos != -1) { StringBuffer expression = new StringBuffer(); @@ -714,6 +714,17 @@ public class JAXXCompiler { String id = handler.getEventId().substring(0, handler.getEventId().indexOf(".")); result = "do" + StringUtils.capitalize(handler.getListenerMethod().getName()) + "__on__" + id; + //TC-20091105 : check the method name is available + // using css can have multi methods with result name (see priority) + if (eventHandlerMethodNames.containsValue(result)) { + int index = 0; + String result2; + do { + result2 = result + "_" + (index++); + + } while (eventHandlerMethodNames.containsValue(result2)); + result = result2; + } } eventHandlerMethodNames.put(handler, result); } @@ -810,7 +821,7 @@ public class JAXXCompiler { StringBuilder buffer = new StringBuilder(); buffer.append(srcFile); if (lineNumber != null) { - buffer.append(":" + ((sourceFiles.size() == 1) ? Integer.parseInt(lineNumber) + lineOffset : lineOffset + 1)); + buffer.append(":").append((sourceFiles.size() == 1) ? Integer.parseInt(lineNumber) + lineOffset : lineOffset + 1); } buffer.append(getLineSeparator()).append(warning.trim()); if (engine != null) { @@ -878,9 +889,9 @@ public class JAXXCompiler { StringBuilder buffer = new StringBuilder(); buffer.append(errorFile != null ? errorFile.getPath() : "<unknown source>"); if (lineNumber > 0) { - buffer.append(":" + lineNumber); + buffer.append(":").append(lineNumber); } - buffer.append(getLineSeparator()).append(": " + error); + buffer.append(getLineSeparator()).append(": ").append(error); if (engine != null) { engine.addError(buffer.toString()); } else { @@ -1038,12 +1049,12 @@ public class JAXXCompiler { return new JAXXObjectDescriptor(descriptors, css); } - /*------------------------------------------------------------------------*/ - /*-- Setter methods ------------------------------------------------------*/ - /*------------------------------------------------------------------------*/ - public void setFailed(boolean failed) { - this.failed = failed; - } +// /*------------------------------------------------------------------------*/ +// /*-- Setter methods ------------------------------------------------------*/ +// /*------------------------------------------------------------------------*/ +// public void setFailed(boolean failed) { +// this.failed = failed; +// } /*------------------------------------------------------------------------*/ /*-- Buffer --------------------------------------------------------------*/ @@ -1254,69 +1265,69 @@ public class JAXXCompiler { return pos; } - public String[] parseParameterList(String parameters) throws CompilerException { - List<String> result = new ArrayList<String>(); - StringBuffer current = new StringBuffer(); - int state = 0; // normal - for (int i = 0; i < parameters.length(); i++) { - char c = parameters.charAt(i); - switch (state) { - case 0: // normal - switch (c) { - case '"': - current.append(c); - state = 1; - break; // in quoted string - case '\\': - current.append(c); - state = 2; - break; // immediately after backslash - case ',': - if (current.length() > 0) { - result.add(current.toString()); - current.setLength(0); - break; - } else { - reportError("error parsing parameter list: " + parameters); - break; - } - default: - current.append(c); - } - break; - case 1: // in quoted string - switch (c) { - case '"': - current.append(c); - state = 0; - break; // normal - case '\\': - current.append(c); - state = 3; - break; // immediate after backslash in quoted string - default: - current.append(c); - } - break; - case 2: // immediately after backslash - current.append(c); - state = 0; // normal - break; - case 3: // immediately after backslash in quoted string - current.append(c); - state = 1; // in quoted string - break; - } - } - if (current.length() > 0) { - result.add(current.toString()); - } - return result.toArray(new String[result.size()]); - } +// public String[] parseParameterList(String parameters) throws CompilerException { +// List<String> result = new ArrayList<String>(); +// StringBuffer current = new StringBuffer(); +// int state = 0; // normal +// for (int i = 0; i < parameters.length(); i++) { +// char c = parameters.charAt(i); +// switch (state) { +// case 0: // normal +// switch (c) { +// case '"': +// current.append(c); +// state = 1; +// break; // in quoted string +// case '\\': +// current.append(c); +// state = 2; +// break; // immediately after backslash +// case ',': +// if (current.length() > 0) { +// result.add(current.toString()); +// current.setLength(0); +// break; +// } else { +// reportError("error parsing parameter list: " + parameters); +// break; +// } +// default: +// current.append(c); +// } +// break; +// case 1: // in quoted string +// switch (c) { +// case '"': +// current.append(c); +// state = 0; +// break; // normal +// case '\\': +// current.append(c); +// state = 3; +// break; // immediate after backslash in quoted string +// default: +// current.append(c); +// } +// break; +// case 2: // immediately after backslash +// current.append(c); +// state = 0; // normal +// break; +// case 3: // immediately after backslash in quoted string +// current.append(c); +// state = 1; // in quoted string +// break; +// } +// } +// if (current.length() > 0) { +// result.add(current.toString()); +// } +// return result.toArray(new String[result.size()]); +// } public String getAutoId(ClassDescriptor objectClass) { String name = objectClass.getName(); - name = name.substring(name.lastIndexOf(".") + 1); + name = name.substring(name.lastIndexOf(".") + 1); return getAutoId(name); // if (configuration.getOptimize()) { // return "$" + Integer.toString(autogenID++, 36); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java index dc5c331..ca2e9ba 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/JAXXEngine.java @@ -416,7 +416,7 @@ public class JAXXEngine { * Run the pass. * * @param engine the engine to use - * @return {@code true} if pass was ok, {@ocde false} otherwise + * @return {@code true} if pass was ok, {@code false} otherwise * @throws Exception if any pb */ public abstract boolean run(JAXXEngine engine) throws Exception; @@ -627,19 +627,19 @@ public class JAXXEngine { /** * Create a new compiler. * - * @param parentFile - * @param file - * @param className + * @param parentFile the directory where to generate the java file + * @param file the path of file to generate + * @param className name of the class to generate in the file * @return the new compiler - * @throws InvocationTargetException - * @throws IllegalAccessException - * @throws InstantiationException - * @throws NoSuchMethodException + * @throws InvocationTargetException introspection error + * @throws IllegalAccessException introspection error + * @throws InstantiationException introspection error + * @throws NoSuchMethodException introspection error */ protected JAXXCompiler newCompiler(File parentFile, File file, String className) throws InvocationTargetException, IllegalAccessException, InstantiationException, NoSuchMethodException { Constructor<? extends JAXXCompiler> cons = configuration.getCompilerClass().getConstructor(JAXXEngine.class, File.class, File.class, String.class, CompilerConfiguration.class, List.class); - return cons.newInstance(this, parentFile, file, className, configuration, Arrays.asList(new String[]{ - "java.awt.*", + return cons.newInstance(this, parentFile, file, className, configuration, + Arrays.asList("java.awt.*", "java.awt.event.*", "java.beans.*", "java.io.*", @@ -652,9 +652,11 @@ public class JAXXEngine { "jaxx.runtime.swing.HBox", "jaxx.runtime.swing.VBox", "jaxx.runtime.swing.Table", + "jaxx.runtime.Util", + "jaxx.runtime.SwingUtil", "static org.nuiton.i18n.I18n._", - "static jaxx.runtime.Util.createImageIcon" - })); + "static jaxx.runtime.Util.createImageIcon") + ); } /** diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataBinding.java b/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataBinding.java index 7d7f064..c177b8a 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataBinding.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataBinding.java @@ -54,7 +54,7 @@ public class DataBinding { * Creates a new data binding. * * @param source the Java source code for the data binding expression - * @param id the data binding destination in the form <code><id>.<propertyName></code> + * @param id the data binding destination in the form <code>id.propertyName</code> * @param assignment Java snippet which will cause the destination property to be updated with the current value of the binding */ public DataBinding(String source, String id, String assignment) { @@ -87,7 +87,7 @@ public class DataBinding { // handles all of the listener additions //TC-20091026 use 'this' instead of root object javaCode // boolean result = dataSource.compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + compiler.getJavaCode(id) + ")"); - boolean result = dataSource.compile("new jaxx.runtime.DataBindingListener(this, " + compiler.getJavaCode(id) + ")"); + boolean result = dataSource.compile("new DataBindingListener(this, " + compiler.getJavaCode(id) + ")"); if (log.isDebugEnabled()) { log.debug(id + " isBinding ? " + result); } @@ -103,13 +103,10 @@ public class DataBinding { StringBuilder buffer = new StringBuilder(); if (compiler.hasProcessDataBinding()) { buffer.append(" else "); -// compiler.appendProcessDataBinding(" else "); } else { buffer.append(" "); -// compiler.appendProcessDataBinding(" "); } - buffer.append("if (" + compiler.getJavaCode(id) + ".equals($dest)) {" + eol); -// compiler.appendProcessDataBinding("if (" + compiler.getJavaCode(id) + ".equals($dest)) {" + eol); + buffer.append("if (").append(compiler.getJavaCode(id)).append(".equals($dest)) {").append(eol); String objectCode = dataSource.getObjectCode(); if (log.isDebugEnabled()) { log.debug(id + " objectCode= " + objectCode); @@ -118,19 +115,14 @@ public class DataBinding { // boolean needTest = objectCode != null; boolean needTest = objectCode != null && !compiler.getRootObject().getId().equals(objectCode); if (needTest) { - buffer.append(" if (" + objectCode + " != null) {" + eol); + buffer.append(" if (").append(objectCode).append(" != null) {").append(eol); buffer.append(" "); -// compiler.appendProcessDataBinding(" if (" + objectCode + " != null) {" + eol); -// compiler.appendProcessDataBinding(" "); } - buffer.append(" " + assignment.trim()); -// compiler.appendProcessDataBinding(" " + assignment.trim()); + buffer.append(" ").append(assignment.trim()); if (needTest) { - buffer.append(eol + " }"); -// compiler.appendProcessDataBinding(eol + " }"); + buffer.append(eol).append(" }"); } - buffer.append(eol + " }"); -// compiler.appendProcessDataBinding(eol + " }"); + buffer.append(eol).append(" }"); compiler.appendProcessDataBinding(buffer.toString()); return true; } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java b/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java index 2f1dfae..3f3435e 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java @@ -25,6 +25,7 @@ import jaxx.compiler.CompilerException; import jaxx.compiler.JAXXCompiler; import jaxx.compiler.UnsupportedAttributeException; import jaxx.compiler.java.JavaField; +import jaxx.compiler.java.JavaFileGenerator; import jaxx.compiler.java.parser.JavaParser; import jaxx.compiler.java.parser.JavaParserConstants; import jaxx.compiler.java.parser.JavaParserTreeConstants; @@ -45,6 +46,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -66,6 +68,7 @@ public class DataSource { */ private class NULL { } + /** * id of data source */ @@ -145,26 +148,23 @@ public class DataSource { * * @param propertyChangeListenerCode Java code snippet which evaluates to a <code>PropertyChangeListener</code> * @return <code>true</code> if the expression has dependencies, <code>false</code> otherwise - * @throws CompilerException if a compilation error occurs + * @throws CompilerException if a compilation error occurs * @throws IllegalStateException if data source was already compiled */ public boolean compile(String propertyChangeListenerCode) throws CompilerException, IllegalStateException { if (compiled) { throw new IllegalStateException(this + " has already been compiled"); } -// String listenerId = compiler.getAutoId(ClassDescriptorLoader.getClassDescriptor(getClass())); listenerId = compiler.getAutoId(getClass().getSimpleName()); if (log.isDebugEnabled()) { log.debug("listenerId=" + listenerId); } JavaParser p = new JavaParser(new StringReader(source)); -// JavaParser p = new JavaParser(new StringReader(source + ";")); while (!p.Line()) { SimpleNode node = p.popNode(); if (log.isDebugEnabled()) { log.debug("will scan node " + node.getText()); } -// scanNode(node, listenerId); scanNode(node); } if (log.isDebugEnabled()) { @@ -180,27 +180,22 @@ public class DataSource { // add listener codes in compiler -// compileListeners(); String javaCodeId = TypeManager.getJavaCode(id); String eol = JAXXCompiler.getLineSeparator(); -// if (addListenerCode.length() > 0) { if (compiler.hasApplyDataBinding()) { compiler.appendApplyDataBinding(" else "); } compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {"); compiler.appendApplyDataBinding(" " + addListenerCode + eol); compiler.appendApplyDataBinding("}"); -// } -// if (removeListenerCode.length() > 0) { if (compiler.hasRemoveDataBinding()) { compiler.appendRemoveDataBinding(" else "); } compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {"); compiler.appendRemoveDataBinding(" " + removeListenerCode + eol); compiler.appendRemoveDataBinding("}"); -// } } //TC-20091027 if no dependency symbols then no listeners // compileListeners(); @@ -219,12 +214,10 @@ public class DataSource { /** * Examines a node to identify any dependencies it contains. * - * @param node node to scan - // * @param listenerId id of listener + * @param node node to scan * @throws CompilerException ? */ private void scanNode(SimpleNode node) throws CompilerException { -// private void scanNode(SimpleNode node, String listenerId) throws CompilerException { if (node.getId() == JavaParserTreeConstants.JJTMETHODDECLARATION || node.getId() == JavaParserTreeConstants.JJTFIELDDECLARATION) { return; @@ -246,7 +239,6 @@ public class DataSource { type = ClassDescriptorLoader.getClassDescriptor(Class.class); break; case JavaParserTreeConstants.JJTPRIMARYEXPRESSION: -// type = determineExpressionType(node, listenerId); type = determineExpressionType(node); break; case JavaParserTreeConstants.JJTLITERAL: @@ -278,10 +270,8 @@ public class DataSource { * can be tracked. * * @param expression the node to scan - // * @param listenerId id of the listener * @return the class descriptor of the return type or null */ -// private ClassDescriptor determineExpressionType(SimpleNode expression, String listenerId) { private ClassDescriptor determineExpressionType(SimpleNode expression) { assert expression.getId() == JavaParserTreeConstants.JJTPRIMARYEXPRESSION; SimpleNode prefix = expression.getChild(0); @@ -291,7 +281,6 @@ public class DataSource { prefix.setJavaType(prefix.getChild(0).getJavaType()); } else if (type == JavaParserTreeConstants.JJTNAME && expression.jjtGetNumChildren() == 1) { // name with no arguments after it -// prefix.setJavaType(scanCompoundSymbol(prefix.getText().trim(), compiler.getRootObject().getObjectClass(), false, listenerId)); prefix.setJavaType(scanCompoundSymbol(prefix.getText().trim(), compiler.getRootObject().getObjectClass(), false)); } } @@ -311,7 +300,6 @@ public class DataSource { if (suffix.jjtGetNumChildren() == 1 && suffix.getChild(0).getId() == JavaParserTreeConstants.JJTARGUMENTS) { if (suffix.getChild(0).jjtGetNumChildren() == 0) { // at the moment only no-argument methods are trackable -// contextClass = scanCompoundSymbol(lastNode, contextClass, true, listenerId); contextClass = scanCompoundSymbol(lastNode, contextClass, true); if (contextClass == null) { return null; @@ -327,7 +315,6 @@ public class DataSource { String methodName = lastNode.substring(dotPos + 1).trim(); try { MethodDescriptor method = contextClass.getMethodDescriptor(methodName); -// trackMemberIfPossible(code, contextClass, method.getName(), true, listenerId); trackMemberIfPossible(code, contextClass, method.getName(), true); return method.getReturnType(); } catch (NoSuchMethodException e) { @@ -348,17 +335,6 @@ public class DataSource { "removePropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator()); contextClass = newMethod.getReturnType(); } -// MethodDescriptor[] newMethods = compiler.getScriptMethods(); -// for (MethodDescriptor newMethod : newMethods) { -// if (newMethod.getName().equals(methodName)) { -// addListener(compiler.getRootObject().getId(), -// null, -// "addPropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator(), -// "removePropertyChangeListener(\"" + propertyName + "\", " + listenerId + ");" + JAXXCompiler.getLineSeparator()); -// contextClass = newMethod.getReturnType(); -// break; -// } -// } } } } @@ -411,10 +387,8 @@ public class DataSource { * @param symbol symbol to scan * @param contextClass current class context * @param isMethod flag to search a method - // * @param listenerId id of the listener * @return the type of the symbol (or null if it could not be determined). */ -// private ClassDescriptor scanCompoundSymbol(String symbol, ClassDescriptor contextClass, boolean isMethod, String listenerId) { private ClassDescriptor scanCompoundSymbol(String symbol, ClassDescriptor contextClass, boolean isMethod) { String[] tokens = symbol.split("\\s*\\.\\s*"); StringBuffer currentSymbol = new StringBuffer(); @@ -445,7 +419,6 @@ public class DataSource { } else { try { FieldDescriptor field = contextClass.getFieldDescriptor(memberName); -// trackMemberIfPossible(tokensSeenSoFar.toString(), contextClass, field.getName(), false, listenerId); trackMemberIfPossible(tokensSeenSoFar.toString(), contextClass, field.getName(), false); contextClass = field.getType(); currentSymbol.setLength(0); @@ -490,7 +463,6 @@ public class DataSource { return contextClass; } -// private void trackMemberIfPossible(String objectCode, ClassDescriptor objectClass, String memberName, boolean method, String listenerId) { private void trackMemberIfPossible(String objectCode, ClassDescriptor objectClass, String memberName, boolean method) { // if (objectClass.isInterface()) { // // might be technically possible to track in some cases, but for now @@ -523,9 +495,8 @@ public class DataSource { addListenerCode.append(eol); if (needTest) { addListenerCode.append(" if (").append(objectCode).append(" != null) {").append(eol); - addListenerCode.append(" "); } - addListenerCode.append(" ").append(addCode.trim()); + addListenerCode.append(JavaFileGenerator.indent(addCode, needTest ? 8 : 4, false, eol)); if (needTest) { addListenerCode.append(eol).append(" }"); } @@ -533,64 +504,11 @@ public class DataSource { removeListenerCode.append(eol); if (needTest) { removeListenerCode.append(" if (").append(objectCode).append(" != null) {").append(eol); - removeListenerCode.append(" "); } - removeListenerCode.append(" ").append(removeCode.trim()); + removeListenerCode.append(JavaFileGenerator.indent(removeCode, needTest ? 8 : 4, false, eol)); if (needTest) { removeListenerCode.append(eol).append(" }"); } } } -// /** -// * Adds type information to nodes where possible, and as a side effect adds event listeners to nodes which -// * can be tracked. -// * -// * @param node node to scan -// * @param listenerId the listener id -// */ -//// private void determineNodeType(SimpleNode node, String listenerId) { -// private void determineNodeType(SimpleNode node) { -// ClassDescriptor type = null; -// if (node.jjtGetNumChildren() == 1) { -// type = node.getChild(0).getJavaType(); -// } -// switch (node.getId()) { -// case JavaParserTreeConstants.JJTCLASSORINTERFACETYPE: -// type = ClassDescriptorLoader.getClassDescriptor(Class.class); -// break; -// case JavaParserTreeConstants.JJTPRIMARYEXPRESSION: -// type = determineExpressionType(node, listenerId); -// break; -// case JavaParserTreeConstants.JJTLITERAL: -// type = determineLiteralType(node); -// break; -// case JavaParserTreeConstants.JJTCASTEXPRESSION: -// type = TagManager.resolveClass(node.getChild(0).getText(), compiler); -// break; -// } -// node.setJavaType(type); -// } -// private void compileListeners() { -// String javaCodeId = TypeManager.getJavaCode(id); -// String eol = JAXXCompiler.getLineSeparator(); -// if (addListenerCode.length() > 0) { -// if (compiler.hasApplyDataBinding()) { -// compiler.appendApplyDataBinding(" else "); -// } -//// compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol); -// compiler.appendApplyDataBinding("if (" + javaCodeId + ".equals($binding)) {"); -// compiler.appendApplyDataBinding(" " + addListenerCode + eol); -// compiler.appendApplyDataBinding("}"); -// } -// -// if (removeListenerCode.length() > 0) { -// if (compiler.hasRemoveDataBinding()) { -// compiler.appendRemoveDataBinding(" else "); -// } -//// compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {" + eol); -// compiler.appendRemoveDataBinding("if (" + javaCodeId + ".equals($binding)) {"); -// compiler.appendRemoveDataBinding(" " + removeListenerCode + eol); -// compiler.appendRemoveDataBinding("}"); -// } -// } } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java b/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java index f074c4a..b4a8367 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/css/StylesheetHelper.java @@ -146,7 +146,7 @@ public class StylesheetHelper { compiler.appendProcessDataBinding("else "); } compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + pseudoClass + ") { " + propertyCode + "} }"); - new DataSource(dest, pseudoClass, compiler).compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + destCode + ")"); + new DataSource(dest, pseudoClass, compiler).compile("new DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + destCode + ")"); compiler.appendInitDataBindings("applyDataBinding(" + destCode + ");"); return; } @@ -192,7 +192,7 @@ public class StylesheetHelper { compiler.appendProcessDataBinding("else "); } compiler.appendProcessDataBinding("if ($dest.equals(" + destCode + ")) { if (" + invert(pseudoClass) + ") { " + propertyCode + "} }"); - new DataSource(dest, pseudoClass, compiler).compile("new jaxx.runtime.DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + destCode + ")"); + new DataSource(dest, pseudoClass, compiler).compile("new DataBindingListener(" + compiler.getRootObject().getJavaCode() + ", " + destCode + ")"); compiler.appendInitDataBindings("applyDataBinding(" + destCode + ");"); return; } @@ -268,7 +268,7 @@ public class StylesheetHelper { for (Map.Entry<String, String> e : properties.entrySet()) { String property = e.getKey(); ClassDescriptor type = handler.getPropertyType(object, property, compiler); - String dataBinding = compiler.processDataBindings(e.getValue(), type); + String dataBinding = compiler.processDataBindings(e.getValue()); String valueCode; if (dataBinding != null) { valueCode = "new jaxx.runtime.css.DataBinding(" + compiler.getJavaCode(object.getId() + "." + property + "." + priority) + ")"; @@ -316,7 +316,7 @@ public class StylesheetHelper { for (Map.Entry<String, String> e : properties.entrySet()) { String property = e.getKey(); ClassDescriptor type = handler.getPropertyType(object, property, compiler); - String dataBinding = compiler.processDataBindings(e.getValue(), type); + String dataBinding = compiler.processDataBindings(e.getValue()); String valueCode; if (dataBinding != null) { valueCode = "new jaxx.runtime.css.DataBinding(" + compiler.getJavaCode(object.getId() + "." + property + "." + priority) + ")"; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java b/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java index f87db50..6646eaf 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/finalizers/DefaultFinalizer.java @@ -35,10 +35,7 @@ import jaxx.compiler.reflect.ClassDescriptor; import jaxx.compiler.reflect.ClassDescriptorLoader; import jaxx.compiler.reflect.FieldDescriptor; import jaxx.compiler.reflect.MethodDescriptor; -import jaxx.runtime.Base64Coder; -import jaxx.runtime.JAXXObject; -import jaxx.runtime.JAXXObjectDescriptor; -import jaxx.runtime.JAXXContext; +import jaxx.runtime.*; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -47,7 +44,7 @@ import static java.lang.reflect.Modifier.*; import java.util.Iterator; import java.util.List; import java.util.Map; -import jaxx.runtime.Util; + import static jaxx.compiler.java.JavaFileGenerator.*; /** @@ -102,11 +99,6 @@ public class DefaultFinalizer implements JAXXCompilerFinalizer { /** * */ - protected static final JavaField DELEGATE_CONTEXT_FIELD = newField(PROTECTED, - JAXXContext.class.getName(), "delegateContext", true); - /** - * - */ protected static final JavaField PROPERTY_CHANGE_SUPPORT_FIELD = newField(0, "java.beans.PropertyChangeSupport", "$propertyChangeSupport", false); /** @@ -149,13 +141,13 @@ public class DefaultFinalizer implements JAXXCompilerFinalizer { * */ protected static final JavaMethod GET_PARENT_CONTAINER_MORE_METHOD = newMethod(PUBLIC, "<O extends Container> O", "getParentContainer", - "return delegateContext.getParentContainer(source, clazz);", true, + "return Util.getParentContainer(source, clazz);", true, new JavaArgument("Object", "source"), new JavaArgument("Class<O>", "clazz")); /** * */ protected static final JavaMethod GET_PARENT_CONTAINER_METHOD = newMethod(PUBLIC, "<O extends Container> O", "getParentContainer", - "return delegateContext.getParentContainer(clazz);", true, + "return Util.getParentContainer(this, clazz);", true, new JavaArgument("Class<O>", "clazz")); /** * @@ -272,7 +264,8 @@ public class DefaultFinalizer implements JAXXCompilerFinalizer { javaFile.addField(ACTIVE_BINDINGS_FIELD); // JAXXContext - javaFile.addField(newField(PROTECTED | FINAL, JAXXContext.class.getName(), "delegateContext", true, "new " + jaxxContextImplementorClass + "(this);")); + javaFile.addField(newField(PROTECTED | FINAL, JAXXContext.class.getName(), "delegateContext", true, "new " + jaxxContextImplementorClass + "()")); +// javaFile.addField(newField(PROTECTED | FINAL, JAXXContext.class.getName(), "delegateContext", true, "new " + jaxxContextImplementorClass + "(this)")); javaFile.addMethod(SET_CONTEXT_VALUE_METHOD); javaFile.addMethod(SET_CONTEXT_VALUE_NAMED_METHOD); javaFile.addMethod(GET_CONTEXT_VALUE_METHOD); @@ -373,6 +366,10 @@ public class DefaultFinalizer implements JAXXCompilerFinalizer { protected void finalizeBindings(JAXXCompiler compiler, boolean superclassIsJAXXObject) { String eol = JAXXCompiler.getLineSeparator(); + if (compiler.getDataBindings() != null && !compiler.getDataBindings().isEmpty()) { + compiler.addImport(DataBindingListener.class.getName()); + } + for (DataBinding dataBinding : compiler.getDataBindings()) { if (dataBinding.compile(compiler, true)) { String expression = "applyDataBinding(" + compiler.getJavaCode(dataBinding.getId()) + ");" + eol; @@ -471,6 +468,7 @@ public class DefaultFinalizer implements JAXXCompilerFinalizer { int modifiers = firePropertyChange != null ? firePropertyChange.getModifiers() : 0; if (isPublic(modifiers)) { // we have all the support we need + return; } if (isProtected(modifiers)) { // there is property change support but the firePropertyChange method is protected @@ -534,7 +532,7 @@ public class DefaultFinalizer implements JAXXCompilerFinalizer { } } if (!superclassIsJAXXObject) { - code.append(Util.class.getName() + ".initContext(this, parentContext);"); + code.append(Util.class.getName()).append(".initContext(this, parentContext);"); code.append(eol); } code.append("$initialize();"); diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java index a425c35..d5e7a0a 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultComponentHandler.java @@ -39,6 +39,7 @@ import java.awt.event.FocusListener; import java.beans.IntrospectionException; import java.io.IOException; import java.lang.reflect.Field; + import jaxx.runtime.Util; import org.w3c.dom.Attr; import org.w3c.dom.NamedNodeMap; @@ -338,26 +339,34 @@ public class DefaultComponentHandler extends DefaultObjectHandler { */ public boolean isContainer() { boolean container = ClassDescriptorLoader.getClassDescriptor(Container.class).isAssignableFrom(getBeanClass()); +// if (container) { +// try { +// init(); +// if (Boolean.FALSE.equals(getJAXXBeanInfo().getJAXXBeanDescriptor().getValue("isContainer"))) { +// container = false; +// } +// } catch (IntrospectionException e) { +// throw new RuntimeException(e); +// } +// } + safeInit(); if (container) { - try { - init(); - if (Boolean.FALSE.equals(getJAXXBeanInfo().getJAXXBeanDescriptor().getValue("isContainer"))) { - container = false; - } - } catch (IntrospectionException e) { - throw new RuntimeException(e); + if (Boolean.FALSE.equals(getJAXXBeanInfo().getJAXXBeanDescriptor().getValue("isContainer"))) { + container = false; } } return container; } public String getContainerDelegate() { - try { - init(); - return containerDelegate; - } catch (IntrospectionException e) { - throw new RuntimeException(e); - } +// try { +// init(); +// return containerDelegate; +// } catch (IntrospectionException e) { +// throw new RuntimeException(e); +// } + safeInit(); + return containerDelegate; } } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java index 2971f13..38ff946 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/DefaultObjectHandler.java @@ -235,11 +235,7 @@ public class DefaultObjectHandler implements TagHandler { * @throws CompilerException if the type cannot be determined */ public ClassDescriptor getPropertyType(CompiledObject object, String propertyName, JAXXCompiler compiler) { - try { - init(); - } catch (IntrospectionException e) { - throw new RuntimeException(e); - } + safeInit(); JAXXPropertyDescriptor property = properties.get(propertyName); if (property != null) { @@ -258,11 +254,7 @@ public class DefaultObjectHandler implements TagHandler { * @throws UnsupportedAttributeException if attribute is not supported */ public boolean isMemberBound(String name) throws UnsupportedAttributeException { - try { - init(); - } catch (IntrospectionException e) { - throw new RuntimeException(e); - } + safeInit(); if (eventInfos != null && eventInfos.containsKey(name)) { return true; @@ -294,16 +286,16 @@ public class DefaultObjectHandler implements TagHandler { return listenerClass.getMethodDescriptors()[0].getParameterTypes()[0]; } - /** - * @param memberName name of the member - * @return an array of members on which the given property depends. For - * example, the JTextField.getText() member depends upon the getModel() - * member. Returns <code>null</code> if there are no dependencies. - */ - public String[] getMemberDependencies(String memberName) { - ProxyEventInfo eventInfo = eventInfos != null ? eventInfos.get(memberName) : null; - return eventInfo == null ? null : new String[]{eventInfo.modelName}; - } +// /** +// * @param memberName name of the member +// * @return an array of members on which the given property depends. For +// * example, the JTextField.getText() member depends upon the getModel() +// * member. Returns <code>null</code> if there are no dependencies. +// */ +// public String[] getMemberDependencies(String memberName) { +// ProxyEventInfo eventInfo = eventInfos != null ? eventInfos.get(memberName) : null; +// return eventInfo == null ? null : new String[]{eventInfo.modelName}; +// } /** * Returns a snippet of Java code which will cause a <code>PropertyChangeListener</code> to be notified @@ -341,10 +333,12 @@ public class DefaultObjectHandler implements TagHandler { } String code = objectCode + (eventInfo.modelName != null ? ".get" + StringUtils.capitalize(eventInfo.modelName) + "()" : ""); result.append("$bindingSources.put(\"").append(code).append("\", ").append(code).append(");").append(JAXXCompiler.getLineSeparator()); - result.append(code).append('.').append(eventInfo.addMethod).append("((").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(") jaxx.runtime.Util.getEventListener(").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(compiler.getJavaCode(methodName)).append("));\n"); + //TC-20091105 Util.getEventListener is generic, no more need cast and use simple listener name + result.append(code).append('.').append(eventInfo.addMethod).append("( Util.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(compiler.getJavaCode(methodName)).append("));"); + result.append(JAXXCompiler.getLineSeparator()); if (eventInfo.modelName != null) { result.append(getAddMemberListenerCode(objectCode, dataBinding, "get" + StringUtils.capitalize(eventInfo.modelName), - Util.class.getName() + ".getDataBindingUpdateListener(this , \"" + dataBinding + "\")", + Util.class.getSimpleName() + ".getDataBindingUpdateListener(this , \"" + dataBinding + "\")", compiler)); } return result.toString(); @@ -372,11 +366,9 @@ public class DefaultObjectHandler implements TagHandler { // check for property-specific addPropertyChangeListener method getBeanClass().getMethodDescriptor("addPropertyChangeListener", ClassDescriptorLoader.getClassDescriptor(String.class), ClassDescriptorLoader.getClassDescriptor(PropertyChangeListener.class)); -// return objectCode + ".addPropertyChangeListener(\"" + propertyName + "\", " + propertyChangeListenerCode + ");\n"; return prefix + "addPropertyChangeListener(\"" + propertyName + "\", " + propertyChangeListenerCode + ");\n"; } catch (NoSuchMethodException e) { // no property-specific method, use general one -// return objectCode + ".addPropertyChangeListener(" + propertyChangeListenerCode + ");\n"; return prefix + "addPropertyChangeListener(" + propertyChangeListenerCode + ");\n"; } } @@ -408,13 +400,14 @@ public class DefaultObjectHandler implements TagHandler { String code = objectCode + (eventInfo.modelName != null ? "." + modelMemberName + "()" : ""); String eol = JAXXCompiler.getLineSeparator(); result.append(modelClassName).append(" $target = ((").append(modelClassName).append(") $bindingSources.remove(\"").append(code).append("\"));").append(eol); + //TC-20091105 test if $target is not null result.append("if ($target != null) {").append(eol); - result.append(" $target.").append(eventInfo.removeMethod).append("(jaxx.runtime.Util.getEventListener(").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(compiler.getJavaCode(methodName)).append("));").append(eol); + //TC-20091105 Util.getEventListener is generic, no more need cast and use simple listener name + result.append(" $target.").append(eventInfo.removeMethod).append("( Util.getEventListener(").append(eventInfo.listenerClass.getSimpleName()).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(compiler.getJavaCode(methodName)).append("));").append(eol); result.append("}").append(eol); -// result.append("((").append(modelClassName).append(") $bindingSources.remove(\"").append(code).append("\")).").append(eventInfo.removeMethod).append("((").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(") jaxx.runtime.Util.getEventListener(").append(JAXXCompiler.getCanonicalName(eventInfo.listenerClass)).append(".class, ").append(compiler.getRootObject().getJavaCode()).append(", ").append(compiler.getJavaCode(methodName)).append("));\n"); if (eventInfo.modelName != null) { result.append(getRemoveMemberListenerCode(objectCode, dataBinding, "get" + StringUtils.capitalize(eventInfo.modelName), - Util.class.getName() + ".getDataBindingUpdateListener(this, \"" + dataBinding + "\")", + Util.class.getSimpleName() + ".getDataBindingUpdateListener(this, \"" + dataBinding + "\")", compiler)); } return result.toString(); @@ -445,11 +438,9 @@ public class DefaultObjectHandler implements TagHandler { // check for property-specific removePropertyChangeListener method getBeanClass().getMethodDescriptor("removePropertyChangeListener", ClassDescriptorLoader.getClassDescriptor(String.class), ClassDescriptorLoader.getClassDescriptor(PropertyChangeListener.class)); -// return objectCode + ".removePropertyChangeListener(\"" + propertyName + "\", " + propertyChangeListenerCode + ");\n"; return prefix + "removePropertyChangeListener(\"" + propertyName + "\", " + propertyChangeListenerCode + ");\n"; } catch (NoSuchMethodException e) { // no property-specific method, use general one -// return objectCode + ".removePropertyChangeListener(" + propertyChangeListenerCode + ");\n"; return prefix + "removePropertyChangeListener(" + propertyChangeListenerCode + ");\n"; } } @@ -569,11 +560,7 @@ public class DefaultObjectHandler implements TagHandler { @Override public void compileSecondPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { - try { - init(); - } catch (IntrospectionException e) { - throw new CompilerException(e); - } + safeInit(); CompiledObject object = objectMap.get(tag); if (object == null) { throw new IllegalStateException("unable to find CompiledObject associated with tag <" + tag.getTagName() + ">; should have been registered before second pass"); @@ -586,12 +573,13 @@ public class DefaultObjectHandler implements TagHandler { setDefaults(object, tag, compiler); setAttributes(object, tag, compiler); - if (object.getGenericTypesLength() > 0 && !(object == compiler.getRootObject() || object.isJavaBean())) { - // can ony be apply to root object or javaBean object - compiler.reportWarning("'genericType' attribute can only be found on root, or a javaBean object tag but was found on tag " + tag); - object.setGenericTypes(null); - return; - } + //TC-20091105, can apply genericType everyWhere, should just test that class is generic (not possible actually) +// if (object.getGenericTypesLength() > 0 && !(object == compiler.getRootObject() || object.isJavaBean())) { +// // can ony be apply to root object or javaBean object +// compiler.reportWarning("'genericType' attribute can only be found on root, or a javaBean object tag but was found on tag " + tag); +// object.setGenericTypes(null); +// return; +// } compileChildrenSecondPass(tag, compiler); } @@ -829,25 +817,25 @@ public class DefaultObjectHandler implements TagHandler { return 0; } - public String getApplyPropertyOrDataBindingCode(CompiledObject object, String propertyName, String stringValue, JAXXCompiler compiler) { - ClassDescriptor type = getPropertyType(object, propertyName, compiler); - String binding = compiler.processDataBindings(stringValue, type); - if (binding != null) { - return ""; - } - try { - Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null; - Object value = convertFromString(propertyName, stringValue, typeClass); - return getSetPropertyCode(object.getJavaCode(), propertyName, compiler.getJavaCode(value), compiler); - } catch (NumberFormatException e) { - compiler.reportError("could not convert literal string '" + stringValue + "' to type " + type.getName()); - } catch (IllegalArgumentException e) { - compiler.reportError("could not convert literal string '" + stringValue + "' to type " + type.getName()); - } catch (ClassNotFoundException e) { - compiler.reportError("could not find class " + type.getName()); - } - return ""; - } +// public String getApplyPropertyOrDataBindingCode(CompiledObject object, String propertyName, String stringValue, JAXXCompiler compiler) { +// ClassDescriptor type = getPropertyType(object, propertyName, compiler); +// String binding = compiler.processDataBindings(stringValue); +// if (binding != null) { +// return ""; +// } +// try { +// Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null; +// Object value = convertFromString(propertyName, stringValue, typeClass); +// return getSetPropertyCode(object.getJavaCode(), propertyName, compiler.getJavaCode(value), compiler); +// } catch (NumberFormatException e) { +// compiler.reportError("could not convert literal string '" + stringValue + "' to type " + type.getName()); +// } catch (IllegalArgumentException e) { +// compiler.reportError("could not convert literal string '" + stringValue + "' to type " + type.getName()); +// } catch (ClassNotFoundException e) { +// compiler.reportError("could not find class " + type.getName()); +// } +// return ""; +// } /** * Set a single property on an object. The value may be either a simple value or contain data binding expressions. @@ -861,6 +849,8 @@ public class DefaultObjectHandler implements TagHandler { */ public void setAttribute(CompiledObject object, String propertyName, String stringValue, boolean inline, JAXXCompiler compiler) { try { + //FIXME TC-20091105 we should to this later when all binding are compiled + // because we don't know yet if this is a databinding if (ClassDescriptorLoader.getClassDescriptor(JAXXObject.class).isAssignableFrom(object.getObjectClass())) { // check for data binding & remove if found JAXXObjectDescriptor jaxxObjectDescriptor = object.getObjectClass().getJAXXObjectDescriptor(); @@ -870,41 +860,26 @@ public class DefaultObjectHandler implements TagHandler { if (object == compiler.getRootObject()) { prefix = ""; } else { - prefix = object.getId() + "."; + prefix = object.getJavaCode() + "."; } object.appendInitializationCode(prefix + "removeDataBinding(" + compiler.getJavaCode(root.getId() + "." + propertyName) + ");"); -// object.appendInitializationCode(object.getJavaCode() + ".removeDataBinding(" + compiler.getJavaCode(root.getId() + "." + propertyName) + ");"); } object.addProperty(propertyName, stringValue); ClassDescriptor type = getPropertyType(object, propertyName, compiler); - String binding = compiler.processDataBindings(stringValue, type); + String binding = compiler.processDataBindings(stringValue); + if (inline) { + compiler.addInlineStyle(object, propertyName, binding != null); + } if (binding != null) { - if (inline) { - compiler.addInlineStyle(object, propertyName, true); - } - //TC-20091027 : make sure this code is never used ? -// ClassDescriptor propertyType = getPropertyType(object, propertyName, compiler); -// if (propertyType != null && -// propertyType != ClassDescriptorLoader.getClassDescriptor(Boolean.class) && -// propertyType != ClassDescriptorLoader.getClassDescriptor(Byte.class) && -// propertyType != ClassDescriptorLoader.getClassDescriptor(Short.class) && -// propertyType != ClassDescriptorLoader.getClassDescriptor(Integer.class) && -// propertyType != ClassDescriptorLoader.getClassDescriptor(Float.class) && -// propertyType != ClassDescriptorLoader.getClassDescriptor(Double.class) && -// propertyType != ClassDescriptorLoader.getClassDescriptor(Character.class)) { -// //binding = "((" + propertyType.getName() + ") " + binding + ")"; -// } String setPropertyCode = getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler); - if (propertyName.equals(LAYOUT_ATTRIBUTE)) { // handle containerDelegate (e.g. contentPane on JFrame) + if (propertyName.equals(LAYOUT_ATTRIBUTE)) { + // handle containerDelegate (e.g. contentPane on JFrame) // have to set layout early, before children are added object.appendInitializationCode(setPropertyCode); } -// object.registerDataBinding(binding, propertyName, getSetPropertyCode(object.getJavaCode(), propertyName, binding, compiler), compiler); compiler.registerDataBinding(binding, object.getId() + "." + propertyName, setPropertyCode); - } else { // no bindings, convert from string - if (inline) { - compiler.addInlineStyle(object, propertyName, false); - } + } else { + // no bindings, convert from string try { Class<?> typeClass = type != null ? ClassDescriptorLoader.getClass(type.getName(), type.getClassLoader()) : null; Object value = convertFromString(propertyName, stringValue, typeClass); @@ -1027,11 +1002,7 @@ public class DefaultObjectHandler implements TagHandler { * @throws CompilerException if a compilation error occurs */ public String getGetPropertyCode(String javaCode, String name, JAXXCompiler compiler) { - try { - init(); - } catch (IntrospectionException e) { - throw new RuntimeException(e); - } + safeInit(); JAXXPropertyDescriptor property = properties.get(name); if (property != null) { @@ -1066,7 +1037,6 @@ public class DefaultObjectHandler implements TagHandler { prefix = javaCode + "."; } return prefix + property.getWriteMethodDescriptor().getName() + '(' + valueCode + ");"; -// return javaCode + '.' + property.getWriteMethodDescriptor().getName() + '(' + valueCode + ");"; } throw new UnsupportedAttributeException("property '" + name + "' of " + getBeanClass().getName() + " is read-only"); } @@ -1238,4 +1208,12 @@ public class DefaultObjectHandler implements TagHandler { public String toString() { return getClass().getName() + "[" + getBeanClass().getName() + "]"; } + + protected void safeInit() { + try { + init(); + } catch (IntrospectionException e) { + throw new RuntimeException(e); + } + } } diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java index 8452d35..fd7fd60 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/TagManager.java @@ -44,11 +44,11 @@ public class TagManager { * Logger */ protected static final Log log = LogFactory.getLog(TagManager.class); - /** - * Namespace for JAXX's non-class tags, such as <script;>. The namespace normally does not - * need to be specified but can be used to resolve ambiguities. - */ - public static final String JAXX_NAMESPACE = "http://www.jaxxframework.org/"; +// /** +// * Namespace for JAXX's non-class tags, such as <script;>. The namespace normally does not +// * need to be specified but can be used to resolve ambiguities. +// */ +// public static final String JAXX_NAMESPACE = "http://www.jaxxframework.org/"; /** * Maps simple tag names to their default namespaces (package names). */ @@ -119,7 +119,7 @@ public class TagManager { * encountered (either the class' simple name, if it is unambiguous, or its fully-qualified name), the specified * <code>TagHandler</code> will be invoked to run it. * - * @param <T> + * @param <T> type of handler * @param beanClass the class to associate with a <code>TagHandler</code> * @param handler the <code>TagHandler</code> class, which must descend from <code>DefaultObjectHandler</code> * @throws IllegalArgumentException if the handler class does not descend from <code>DefaultObjectHandler</code> @@ -169,7 +169,7 @@ public class TagManager { * It is not an error to register an already-registered tag and namespace combination. The new mapping * will replace the old mapping. * - * @param <T> + * @param <T> type of handler * @param namespace the tag's namespace * @param tag the simple name of the tag * @param handler the <code>TagHandler</code> which should process the tag diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ItemHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ItemHandler.java index f343046..fec4acb 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ItemHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/ItemHandler.java @@ -66,7 +66,7 @@ public class ItemHandler implements TagHandler { continue; } if (name.equals(Item.LABEL_PROPERTY)) { - String labelBinding = compiler.processDataBindings(attrValue, ClassDescriptorLoader.getClassDescriptor(String.class)); + String labelBinding = compiler.processDataBindings(attrValue); if (labelBinding != null) { compiler.registerDataBinding(labelBinding, id + ".label", id + ".setLabel(" + labelBinding + ");"); } else { @@ -75,7 +75,7 @@ public class ItemHandler implements TagHandler { continue; } if (name.equals(Item.VALUE_PROPERTY)) { - String valueBinding = compiler.processDataBindings(attrValue, ClassDescriptorLoader.getClassDescriptor(Object.class)); + String valueBinding = compiler.processDataBindings(attrValue); if (valueBinding != null) { value = DATA_BINDING; compiler.registerDataBinding(valueBinding, id + ".value", id + ".setValue(" + valueBinding + ");"); @@ -85,7 +85,7 @@ public class ItemHandler implements TagHandler { continue; } if (name.equals(Item.SELECTED_PROPERTY)) { - String selectedBinding = compiler.processDataBindings(attrValue, ClassDescriptorLoader.getClassDescriptor(Boolean.class)); + String selectedBinding = compiler.processDataBindings(attrValue); if (selectedBinding != null) { compiler.registerDataBinding(selectedBinding, id + ".selected", id + ".setSelected(" + selectedBinding + ");"); } else { diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java index 5d39daa..945964c 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/swing/TabHandler.java @@ -73,7 +73,7 @@ public class TabHandler implements TagHandler { value = value.trim(); TabInfo tabInfo = tabs.tabInfo; String id = tabInfo.getId(); - String binding = compiler.processDataBindings(value, ClassDescriptorLoader.getClassDescriptor(Object.class)); + String binding = compiler.processDataBindings(value); if (binding != null) { compiler.registerDataBinding(binding, id + "." + name, id + ".set" + org.apache.commons.lang.StringUtils.capitalize(name) + "(" + binding + ");"); return; diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java b/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java index 329c76b..5375cc6 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/tags/validator/FieldValidatorHandler.java @@ -40,7 +40,7 @@ public class FieldValidatorHandler implements TagHandler { /** to use log facility, just put in your code: log.info(\"...\"); */ static private Log log = LogFactory.getLog(FieldValidatorHandler.class); - @Override + public void compileFirstPass(Element tag, JAXXCompiler compiler) throws CompilerException, IOException { if (compiler.getConfiguration().isVerbose()) { log.debug(tag); diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java index d731cf3..427afea 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXContext.java @@ -20,8 +20,6 @@ */ package jaxx.runtime; -import java.awt.Container; - /** * The {@link jaxx.runtime.JAXXContext} contract defines a generic context. * <p/> @@ -50,37 +48,37 @@ public interface JAXXContext { * If a previous entry exists in context (unamed and same class), it will be removed. * * @param <T> type of data to set in context - * @param o the value to push in context + * @param o the value to push in context */ - public <T> void setContextValue(T o); + <T> void setContextValue(T o); /** * * Push in the context a new amed entry. * <p/> * If a previous entry exists in context (same name and class), it will be removed. * - * @param <T> type of data to set in context + * @param <T> type of data to set in context * @param o the value to push in context * @param name the name of the new entry */ - public <T> void setContextValue(T o, String name); + <T> void setContextValue(T o, String name); /** * Remove from context the value with the given klazz as an unamed entry * - * @param <T> type of data to remove from context + * @param <T> type of data to remove from context * @param klazz the klazz entry */ - public <T> void removeContextValue(Class<T> klazz); + <T> void removeContextValue(Class<T> klazz); /** * Remove from context the value with the given klazz as an unamed (if name is null) or named entry * - * @param <T> type of data to remove from context + * @param <T> type of data to remove from context * @param klazz the klazz entry * @param name extra name of the entry */ - public <T> void removeContextValue(Class<T> klazz, String name); + <T> void removeContextValue(Class<T> klazz, String name); /** * Seek for a unamed entry in the context @@ -89,42 +87,42 @@ public interface JAXXContext { * <p/> * <code><JButton onActionPerformed='{getContextValue(Action.class).method(args[])}'/></code> * - * @param <T> type of data to obtain from context + * @param <T> type of data to obtain from context * @param clazz the class of unamed entry to seek in context * @return the value of the unamed entry for the given class, or <code>null</code> if no such entry. */ - public <T> T getContextValue(Class<T> clazz); + <T> T getContextValue(Class<T> clazz); /** * Seek for a named entry in the context * - * @param <T> type of data to obtain from context + * @param <T> type of data to obtain from context * @param clazz the class of named entry to seek in context * @param name the name of the entry to seek in context * @return the value of the named entry for the given class, or <code>null</code> if no such entry. */ - public <T> T getContextValue(Class<T> clazz, String name); + <T> T getContextValue(Class<T> clazz, String name); - /** - * Return parent's container corresponding to the Class clazz - * - * @param <O> type of container to obtain from context - * @param clazz clazz desired - * @return parent's container - * @deprecated since 2.0.0 : breaks neutral since Swing - */ - @Deprecated - public <O extends Container> O getParentContainer(Class<O> clazz); - - /** - * Return parent's container corresponding to the Class clazz - * - * @param <O> type of container to obtain from context - * @param top the top container - * @param clazz desired - * @return parent's container - * @deprecated since 2.0.0 : breaks neutral since Swing - */ - @Deprecated - public <O extends Container> O getParentContainer(Object top, Class<O> clazz); +// /** +// * Return parent's container corresponding to the Class clazz +// * +// * @param <O> type of container to obtain from context +// * @param clazz clazz desired +// * @return parent's container +// * @deprecated since 2.0.0 : breaks neutral since Swing +// */ +// @Deprecated +// public <O extends Container> O getParentContainer(Class<O> clazz); +// +// /** +// * Return parent's container corresponding to the Class clazz +// * +// * @param <O> type of container to obtain from context +// * @param top the top container +// * @param clazz desired +// * @return parent's container +// * @deprecated since 2.0.0 : breaks neutral since Swing +// */ +// @Deprecated +// public <O extends Container> O getParentContainer(Object top, Class<O> clazz); } diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java index dbb12ee..0638f57 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/JAXXObject.java @@ -20,10 +20,11 @@ */ package jaxx.runtime; +import java.awt.*; import java.io.Serializable; import java.util.Map; -/** +/** * The <code>JAXXObject</code> interface is implemented by all classes * produced by the JAXX compiler. */ @@ -45,13 +46,13 @@ public interface JAXXObject extends JAXXContext, Serializable { Map<String, Object> get$objectMap(); /** - * * @return the {@link JAXXContext} attached to the object */ JAXXContext getDelegateContext(); /** * Apply the data bind by name and then process it. + * * @param id the id of the databinding */ void applyDataBinding(String id); @@ -83,4 +84,53 @@ public interface JAXXObject extends JAXXContext, Serializable { * @param newValue the new value of the property */ void firePropertyChange(String name, Object oldValue, Object newValue); + + /** + * Register a general {@link java.beans.PropertyChangeListener}. + * + * @param listener the listener to register + */ + void addPropertyChangeListener(java.beans.PropertyChangeListener listener); + + /** + * Register a {@link java.beans.PropertyChangeListener}. for the given {@code propertyName}. + * + * @param property the property name to listen + * @param listener the listener to register + */ + void addPropertyChangeListener(String property, java.beans.PropertyChangeListener listener); + + /** + * Unregister a general {@link java.beans.PropertyChangeListener}. + * + * @param listener the listener to unregister + */ + void removePropertyChangeListener(java.beans.PropertyChangeListener listener); + + /** + * Unregister a {@link java.beans.PropertyChangeListener}. for the given {@code propertyName}. + * + * @param property the property name to listen + * @param listener the listener to unregister + */ + void removePropertyChangeListener(String property, java.beans.PropertyChangeListener listener); + + /** + * Return parent's container corresponding to the Class clazz + * + * @param <O> type of container to obtain from context + * @param clazz clazz desired + * @return parent's container + */ + <O extends Container> O getParentContainer(Class<O> clazz); + + /** + * Return parent's container corresponding to the Class clazz + * + * @param <O> type of container to obtain from context + * @param top the top container + * @param clazz desired + * @return parent's container + */ + <O extends Container> O getParentContainer(Object top, Class<O> clazz); } diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/Util.java b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java index 18e5f03..b49fa49 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/Util.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/Util.java @@ -28,8 +28,7 @@ import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.UIManager; -import java.awt.Component; -import java.awt.Dimension; +import java.awt.*; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListenerProxy; import java.io.IOException; @@ -50,7 +49,7 @@ public class Util { public static final String DEFAULT_ICON_PATH = "/icons/"; public static final String DEFAULT_ICON_PATH_PROPERTY = "default.icon.path"; - /** + /** * Logger */ static private final Log log = LogFactory.getLog(Util.class); @@ -121,11 +120,34 @@ public class Util { } public static <O> JAXXContextEntryDef<List<O>> newListContextEntryDef(String name) { - Class<List<O>> castList = Util.<O>castList(); + Class<List<O>> castList = Util.castList(); JAXXContextEntryDef<List<O>> contextEntryDef = new JAXXContextEntryDef<List<O>>(name, castList); return contextEntryDef; } + /** + * Return parent's container corresponding to the Class clazz + * + * @param <O> type of container to obtain from context + * @param top the top container + * @param clazz desired + * @return parent's container + */ + @SuppressWarnings({"unchecked"}) + public static <O extends Container> O getParentContainer(Object top, Class<O> clazz) { + if (top == null) { + throw new IllegalArgumentException("top parameter can not be null"); + } + if (!Container.class.isAssignableFrom(top.getClass())) { + throw new IllegalArgumentException("top parameter " + top + " is not a " + Container.class); + } + Container parent = ((Container) top).getParent(); + if (parent != null && !clazz.isAssignableFrom(parent.getClass())) { + parent = getParentContainer(parent, clazz); + } + return (O) parent; + } + @SuppressWarnings({"unchecked"}) protected static <O> Class<List<O>> castList() { return (Class<List<O>>) Collections.emptyList().getClass(); @@ -133,8 +155,8 @@ public class Util { /** * Method to initialize the context of a ui. - * - * @param ui the ui + * + * @param ui the ui * @param parentContext the context to set in ui */ public static void initContext(JAXXObject ui, JAXXContext parentContext) { @@ -151,7 +173,7 @@ public class Util { } } - public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) { + public static <E extends EventListener> E getEventListener(Class<E> listenerClass, final String listenerMethodName, final Object methodContainer, final String methodName) { WeakReference<List<EventListenerDescriptor>> ref = eventListeners.get(methodContainer); List<EventListenerDescriptor> descriptors = ref != null ? ref.get() : null; if (descriptors == null) { @@ -334,7 +356,7 @@ public class Util { * <p/> * If entry is found, return his value in context. * - * @param <T> the type of required data + * @param <T> the type of required data * @param context the context to test * @param def the definition of the entry to seek in context * @return the value from the context diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java index c8de9fc..7162959 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/DataContext.java @@ -21,15 +21,15 @@ package jaxx.runtime.context; import jaxx.runtime.JAXXContext; -import jaxx.runtime.*; -import java.awt.Container; +import jaxx.runtime.Util; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.util.Iterator; import java.util.NoSuchElementException; import java.util.regex.Pattern; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * Un contexte de données qui permet l'utilisation des bindings sur les @@ -60,25 +60,25 @@ public abstract class DataContext { this.entries = entries; delegate = new DefaultJAXXContext() { - @Override - protected void setUi(JAXXObject ui) { - throw new IllegalStateException("can not use this method for this type of context"); - } - - @Override - public <O extends Container> O getParentContainer(Class<O> clazz) { - throw new IllegalStateException("can not use this method for this type of context"); - } - - @Override - public <O extends Container> O getParentContainer(Object top, Class<O> clazz) { - throw new IllegalStateException("can not use this method for this type of context"); - } - - @Override - protected JAXXObject getUi() { - throw new IllegalStateException("can not use this method for this type of context"); - } +// @Override +// protected void setUi(JAXXObject ui) { +// throw new IllegalStateException("can not use this method for this type of context"); +// } +// +// @Override +// public <O extends Container> O getParentContainer(Class<O> clazz) { +// throw new IllegalStateException("can not use this method for this type of context"); +// } +// +// @Override +// public <O extends Container> O getParentContainer(Object top, Class<O> clazz) { +// throw new IllegalStateException("can not use this method for this type of context"); +// } +// +// @Override +// protected JAXXObject getUi() { +// throw new IllegalStateException("can not use this method for this type of context"); +// } @Override protected void setParentContext(JAXXContext parentContext) { diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultApplicationContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultApplicationContext.java index cb20060..f0b6859 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultApplicationContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultApplicationContext.java @@ -84,7 +84,7 @@ public class DefaultApplicationContext extends DefaultJAXXContext { /** * Define a forward to a target class. When the target class - * will be asked with method {@link #getContextValue(java.lang.Class, java.lang.String)} + * will be asked with method {@link JAXXContext#getContextValue(java.lang.Class, java.lang.String)} * it will be delegating to this class. * * @return the forwarded class @@ -107,9 +107,9 @@ public class DefaultApplicationContext extends DefaultJAXXContext { pcs = new PropertyChangeSupport(this); } - public DefaultApplicationContext(JAXXObject ui) { - super(ui); - } +// public DefaultApplicationContext(JAXXObject ui) { +// super(); +// } /** to use log facility, just put in your code: log.info(\"...\"); */ static private final Log log = LogFactory.getLog(DefaultApplicationContext.class); @@ -119,7 +119,7 @@ public class DefaultApplicationContext extends DefaultJAXXContext { @SuppressWarnings({"unchecked"}) @Override public <T> T getContextValue(Class<T> clazz, String name) { - Object value = null; + Object value; MethodAccess access; Class<?> realClass; @@ -237,9 +237,9 @@ public class DefaultApplicationContext extends DefaultJAXXContext { protected Object newInstance(Class<?> clazz) throws IllegalArgumentException { - Object value = null; + Object value; - Constructor<?> constructor = null; + Constructor<?> constructor; try { constructor = clazz.getConstructor(); // auto instanciate the class diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java index 17b36e2..eb682ea 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/DefaultJAXXContext.java @@ -20,12 +20,12 @@ */ package jaxx.runtime.context; -import jaxx.runtime.*; +import jaxx.runtime.JAXXContext; +import jaxx.runtime.JAXXObject; import jaxx.runtime.Util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import java.awt.Container; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -48,19 +48,19 @@ public class DefaultJAXXContext implements JAXXContext { * entry of the parent context */ protected static final JAXXContextEntryDef<JAXXContext> PARENT_CONTEXT_ENTRY = Util.newContextEntryDef(JAXXContext.class); - /** + /** * Logger */ static private final Log log = LogFactory.getLog(DefaultJAXXContext.class); - /** - * l'ui auquel est rattache le context - */ - protected JAXXObject ui; - /** +// /** +// * l'ui auquel est rattache le context + // */ +// protected JAXXObject ui; + /** * le context parent */ protected JAXXContext parentContext; - /** + /** * les données contenues dans le context */ protected final Map<JAXXContextEntryDef<?>, Object> data; @@ -69,10 +69,10 @@ public class DefaultJAXXContext implements JAXXContext { data = new HashMap<JAXXContextEntryDef<?>, Object>(); } - public DefaultJAXXContext(JAXXObject ui) { - this(); - this.ui = ui; - } +// public DefaultJAXXContext(JAXXObject ui) { +// this(); +// this.ui = ui; +// } @Override public <T> void setContextValue(T o) { @@ -139,33 +139,33 @@ public class DefaultJAXXContext implements JAXXContext { remove0(klazz, name); } - @Override - public <O extends Container> O getParentContainer(Class<O> clazz) { - return this.getParentContainer(ui, clazz); - } - - @SuppressWarnings({"unchecked"}) - @Override - public <O extends Container> O getParentContainer(Object top, Class<O> clazz) { - if (ui == null) { - throw new IllegalStateException("no ui attached to this context"); - } - if (top == null) { - throw new IllegalArgumentException("top parameter can not be null"); - } - if (!Container.class.isAssignableFrom(top.getClass())) { - throw new IllegalArgumentException("top parameter " + top + " is not a " + Container.class); - } - Container parent = ((Container) top).getParent(); - if (parent != null && !clazz.isAssignableFrom(parent.getClass())) { - parent = getParentContainer(parent, clazz); - } - return (O) parent; - } +// @Override +// public <O extends Container> O getParentContainer(Class<O> clazz) { +// return this.getParentContainer(ui, clazz); +// } +// +// @SuppressWarnings({"unchecked"}) +// @Override +// public <O extends Container> O getParentContainer(Object top, Class<O> clazz) { +// if (ui == null) { +// throw new IllegalStateException("no ui attached to this context"); +// } +// if (top == null) { +// throw new IllegalArgumentException("top parameter can not be null"); +// } +// if (!Container.class.isAssignableFrom(top.getClass())) { +// throw new IllegalArgumentException("top parameter " + top + " is not a " + Container.class); +// } +// Container parent = ((Container) top).getParent(); +// if (parent != null && !clazz.isAssignableFrom(parent.getClass())) { +// parent = getParentContainer(parent, clazz); +// } +// return (O) parent; +// } /** * Obtain all the keys of data for a given type. - * + * * @param klass the type of searched keys * @return the array of all names of keys for the given type of data * @since 1.3 @@ -185,13 +185,13 @@ public class DefaultJAXXContext implements JAXXContext { data.clear(); } - protected JAXXObject getUi() { - return ui; - } - - protected void setUi(JAXXObject ui) { - this.ui = ui; - } +// protected JAXXObject getUi() { +// return ui; +// } +// +// protected void setUi(JAXXObject ui) { +// this.ui = ui; +// } protected JAXXContextEntryDef<?> getKey(String name, Class<?> klass) { return Util.newContextEntryDef(name, klass); diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXInitialContext.java b/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXInitialContext.java index 2b1aaed..b853001 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXInitialContext.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/context/JAXXInitialContext.java @@ -21,10 +21,10 @@ package jaxx.runtime.context; import jaxx.runtime.JAXXContext; -import java.awt.Container; -import java.util.Map.Entry; import jaxx.runtime.JAXXObject; +import java.util.Map.Entry; + /** * An initial context to be inject in a {@link JAXXObject}. * <p/> @@ -115,13 +115,13 @@ public class JAXXInitialContext extends DefaultJAXXContext { throw new RuntimeException("not implemented"); } - @Override - public <O extends Container> O getParentContainer(Class<O> clazz) { - throw new RuntimeException("not implemented"); - } - - @Override - public <O extends Container> O getParentContainer(Object top, Class<O> clazz) { - throw new RuntimeException("not implemented"); - } +// @Override +// public <O extends Container> O getParentContainer(Class<O> clazz) { +// throw new RuntimeException("not implemented"); +// } +// +// @Override +// public <O extends Container> O getParentContainer(Object top, Class<O> clazz) { +// throw new RuntimeException("not implemented"); +// } } diff --git a/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultJAXXContextTest.java b/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultJAXXContextTest.java index 3e9012f..ba84cbe 100644 --- a/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultJAXXContextTest.java +++ b/jaxx-runtime/src/test/java/jaxx/runtime/context/DefaultJAXXContextTest.java @@ -27,9 +27,12 @@ import org.junit.Before; import org.junit.Test; import java.awt.Container; +import java.beans.PropertyChangeListener; import java.util.Map; -/** @author chemit */ +/** + * @author chemit + */ public class DefaultJAXXContextTest { DefaultJAXXContext ctxt; @@ -41,40 +44,40 @@ public class DefaultJAXXContextTest { ctxt = new DefaultJAXXContext(); } - @Test(expected = IllegalStateException.class) - public void testParentContainerFail_IllegalStateException() throws Exception { - ctxt.getParentContainer(Container.class); - } - - @Test(expected = IllegalStateException.class) - public void testParentContainerFail_IllegalStateException2() throws Exception { - ctxt.getParentContainer("null", Container.class); - } - - - @Test(expected = IllegalArgumentException.class) - public void testParentContainerFail_IllegalArgumentException() throws Exception { - - // attach a fake ui (which is NOT a Container) - ctxt.setUi(new MyJAXXObject()); - ctxt.getParentContainer(Container.class); - } - - @Test(expected = IllegalArgumentException.class) - public void testParentContainerFail_IllegalArgumentException2() throws Exception { - - // attach a fake ui (which is NOT a Container) - ctxt.setUi(new MyJAXXObject()); - ctxt.getParentContainer(null, Container.class); - } - - @Test(expected = IllegalArgumentException.class) - public void testParentContainerFail_IllegalArgumentException3() throws Exception { - - // attach a fake ui (which is NOT a Container) - ctxt.setUi(new MyJAXXObject()); - ctxt.getParentContainer("null", Container.class); - } +// @Test(expected = IllegalStateException.class) +// public void testParentContainerFail_IllegalStateException() throws Exception { +// ctxt.getParentContainer(Container.class); +// } +// +// @Test(expected = IllegalStateException.class) +// public void testParentContainerFail_IllegalStateException2() throws Exception { +// ctxt.getParentContainer("null", Container.class); +// } + + +// @Test(expected = IllegalArgumentException.class) +// public void testParentContainerFail_IllegalArgumentException() throws Exception { +// +// // attach a fake ui (which is NOT a Container) +// ctxt.setUi(new MyJAXXObject()); +// ctxt.getParentContainer(Container.class); +// } +// +// @Test(expected = IllegalArgumentException.class) +// public void testParentContainerFail_IllegalArgumentException2() throws Exception { +// +// // attach a fake ui (which is NOT a Container) +// ctxt.setUi(new MyJAXXObject()); +// ctxt.getParentContainer(null, Container.class); +// } +// +// @Test(expected = IllegalArgumentException.class) +// public void testParentContainerFail_IllegalArgumentException3() throws Exception { +// +// // attach a fake ui (which is NOT a Container) +// ctxt.setUi(new MyJAXXObject()); +// ctxt.getParentContainer("null", Container.class); +// } @Test public void testGetParentContext() throws Exception { @@ -292,30 +295,64 @@ public class DefaultJAXXContextTest { } private static class MyJAXXObject extends DefaultJAXXContext implements JAXXObject { + private static final long serialVersionUID = 1L; + @Override public Object getObjectById(String id) { return null; } + @Override public Map<String, Object> get$objectMap() { return null; } + @Override public void applyDataBinding(String id) { } + @Override public void removeDataBinding(String id) { } + @Override public JAXXContext getDelegateContext() { return null; } + @Override public void processDataBinding(String dest) { } + @Override public void firePropertyChange(String name, Object oldValue, Object newValue) { } + @Override + public void addPropertyChangeListener(PropertyChangeListener listener) { + } + + @Override + public void addPropertyChangeListener(String property, PropertyChangeListener listener) { + } + + @Override + public void removePropertyChangeListener(PropertyChangeListener listener) { + } + + @Override + public void removePropertyChangeListener(String property, PropertyChangeListener listener) { + } + + @Override + public <O extends Container> O getParentContainer(Class<O> clazz) { + return null; + } + + @Override + public <O extends Container> O getParentContainer(Object top, Class<O> clazz) { + return null; + } + } } diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx index 47b2496..12bf31e 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBox.jaxx @@ -20,7 +20,7 @@ */ --> -<Table fill='both' insets='0' +<Table fill='both' insets='0' genericType='O' onFocusGained='combobox.requestFocus()' onFocusLost='hidePopup()'> @@ -33,6 +33,7 @@ <!-- show decorator property --> <Boolean id='showDecorator' javaBean='true'/> + <!-- editable combo property --> <Boolean id='editable' javaBean='true'/> <!-- bean property linked state --> @@ -48,14 +49,14 @@ <Integer id='index' javaBean='0'/> <!-- datas of the combo-box --> - <java.util.List id='data' javaBean='null'/> + <java.util.List id='data' genericType='O' javaBean='null'/> <!-- model of sorted property --> <ButtonGroup id='indexes' useToolTipText='true' onStateChanged='setIndex((Integer)indexes.getSelectedValue())'/> <!-- ui handler --> - <EntityComboBoxHandler id='handler' constructorParams='this'/> + <EntityComboBoxHandler id='handler' genericType='O' constructorParams='this'/> <String id='selectedToolTipText' javaBean='null'/> @@ -84,7 +85,7 @@ public static final String DEFAULT_SELECTED_TOOLTIP = n_("entitycombobox.sort.on public static final String DEFAULT_NOT_SELECTED_TOOLTIP = n_("entitycombobox.sort.off"); -public <O> void init(JXPathDecorator<O> decorator, java.util.List<O> data) { +public void init(JXPathDecorator<O> decorator, java.util.List<O> data) { handler.init(decorator, data); } diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java b/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java index 9877f68..0abcf23 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/EntityComboBoxHandler.java @@ -70,7 +70,7 @@ public class EntityComboBoxHandler<O> implements PropertyChangeListener { public static final String AUTO_COMPLETE_PROPERTY = "autoComplete"; public static final String DATA_PROPERTY = "data"; /** ui if the handler */ - protected EntityComboBox ui; + protected EntityComboBox<O> ui; /** the mutator method on the property of boxed bean in the ui */ protected Method mutator; /** the original document of the combbo box editor (keep it to make possible undecorate) */ @@ -81,7 +81,7 @@ public class EntityComboBoxHandler<O> implements PropertyChangeListener { protected MultiJXPathDecorator<O> decorator; protected boolean init; - public EntityComboBoxHandler(EntityComboBox ui) { + public EntityComboBoxHandler(EntityComboBox<O> ui) { this.ui = ui; } protected final FocusListener EDITOR_TEXT_COMP0NENT_FOCUSLISTENER = new FocusListener() { diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/HidorButton.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/HidorButton.jaxx index 98d2e64..7285241 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/HidorButton.jaxx +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/HidorButton.jaxx @@ -1,36 +1,14 @@ -<!-- - -/** - * *##% jaxx-runtime-swing-widget - * Copyright (C) 2008 - 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* - */ - ---> -<JToggleButton id='hidor' - icon='{updateIcon(isTargetVisible())}' +<JToggleButton id='hidor' toolTipText='{updateToolTipText(isTargetVisible())}' - _collapseIcon='{SwingUtil.createActionIcon("collapse")}' - _expandIcon='{SwingUtil.createActionIcon("expand")}' - _collapseTip='{_("hidor.collapseTip")}' - _expandTip='{_("hidor.expandTip")}' + icon='{SwingUtil.createActionIcon("collapse")}' + pressedIcon='{SwingUtil.createActionIcon("expand")}' onActionPerformed='setTargetVisible(!targetVisible)'> - <!--selected='{updateCollapseIcon(isTargetVisible())}'--> - <Boolean id='targetVisible' javaBean='true'/> + <Boolean id='targetVisible' javaBean='null'/> + + <String id='collapseTip' javaBean='_("hidor.collapseTip")'/> + + <String id='expandTip' javaBean='_("hidor.expandTip")'/> <script><![CDATA[ import jaxx.runtime.SwingUtil; @@ -61,15 +39,16 @@ public void setTarget(JComponent target) { firePropertyChange("target", oldValue, target); } -protected Icon updateIcon(boolean c) { - String key = c ? "collapseIcon" : "expandIcon"; - Icon i = (Icon) getClientProperty(key); - return i; +public void setExpandIcon(Icon icon) { + setSelectedIcon(icon); +} + +public void setCollapseIcon(Icon icon) { + setIcon(icon); } protected String updateToolTipText(boolean c) { - String key = c ? "collapseTip" : "expandTip"; - String i = (String) getClientProperty(key); + String i = c ? collapseTip : expandTip; return i; } ]]> diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/ListSelectorUI.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/ListSelectorUI.jaxx new file mode 100644 index 0000000..6e5477f --- /dev/null +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/ListSelectorUI.jaxx @@ -0,0 +1,153 @@ +<JPanel layout='{new BorderLayout()}' genericType='B'> + + <Boolean id='modified' javaBean='false'/> + + <String id='addToListTip' javaBean='"+"'/> + + <String id='addToComboTip' javaBean='"-"'/> + + <ListCellRenderer id='renderer' javaBean='null'/> + + <script><![CDATA[ + +/** + * @return the datas from the combo box. + */ +public java.util.List<B> getComboDatas() { + java.util.List<B> datas = new java.util.ArrayList<B>(); + ComboBoxModel comboModel = combo.getModel(); + for (int i = 0, j = comboModel.getSize(); i < j; i++) { + B g = (B) comboModel.getElementAt(i); + datas.add(g); + } + return datas; +} + +/** + * @return the data for the list. + */ +public java.util.List<B> getListDatas() { + java.util.List<B> datas = new java.util.ArrayList<B>(); + ListModel listModel = list.getModel(); + for (int i = 0, j = listModel.getSize(); i < j; i++) { + B g = (B) listModel.getElementAt(i); + datas.add(g); + } + return datas; +} + +/** + * Initialize the component. + * + * @param toCombo datas to set in combo + * @param toList datas to set in list + */ +public void init(java.util.List<B> toCombo, java.util.List<B> toList) { + setComboDatas(toCombo); + setListDatas(toList); + // after init, always unmodified editor + // TODO should avoid to fire a changed ? + setModified(false); +} + +/** + * Transfert the {@code b} data from combo box to list. + * + * @param b the data to transfert + */ +protected void transfertToList(B b) { + ((DefaultListModel) list.getModel()).addElement(b); + ((DefaultComboBoxModel) combo.getModel()).removeElement(b); + setModified(true); +} + +/** + * Transfert the {@code b} data from list to combo box. + * + * @param b the data to transfert + */ +protected void transfertToCombo(B b) { + ((DefaultListModel) list.getModel()).removeElement(b); + ((DefaultComboBoxModel) combo.getModel()).addElement(b); + setModified(true); +} + +/** + * @param enabled databinding + * @return {@code true} if add button should be enabled + */ +protected boolean updateAddEnabled(boolean enabled) { + return enabled && combo.getModel().getSize() > 0; +} + +/** + * @param enabled databinding + * @return {@code true} if remove button should be enabled + */ +protected boolean updateRemoveEnabled(boolean enabled) { + return enabled && list.getModel().getSize() > 0; +} + +/** + * Set the data in combo box model. + * + * @param toCombo datas to set in combo box model + */ +protected void setComboDatas(java.util.List<B> toCombo) { + SwingUtil.fillComboBox(combo, toCombo, null); + //Note : there is a case when combo was selected, then come here with an empty + // combo model : no propertyChanged is fired, so add button stays enabled... + processDataBinding("add.enabled"); +} + +/** + * Set the data in the list model. + * + * @param toList datas to set in list model + */ +protected void setListDatas(java.util.List<B> toList) { + SwingUtil.fillList(list, toList, null); +} + +]]> + </script> + + <JScrollPane constraints='BorderLayout.CENTER' + columnHeaderView='{header}' + verticalScrollBarPolicy='vertical_scrollbar_always' + minimumSize='{SwingUtil.newMinDimension()}'> + <JList id='list' + enabled='{isEnabled()}' + model='{new DefaultListModel()}' + minimumSize='{SwingUtil.newMinDimension()}' + maximumSize='{new Dimension(100,200)}' + font-size='11' + cellRenderer='{getRenderer()}'/> + </JScrollPane> + + <Table id="header" insets='0' constraints='BorderLayout.SOUTH'> + <row> + <cell fill='horizontal' weightx='1' anchor="west"> + <JComboBox id='combo' enabled='{isEnabled()}' + model='{new DefaultComboBoxModel()}' + renderer='{getRenderer()}'/> + </cell> + <cell anchor='east'> + <JToolBar floatable='false'> + <JButton id="add" + toolTipText='{getAddToListTip()}' + actionIcon='add' + enabled='{updateAddEnabled(combo.isEnabled() && combo.getSelectedIndex() > -1)}' + onActionPerformed='transfertToList((B) combo.getSelectedItem());'/> + + <JButton id="remove" + toolTipText='{getAddToComboTip()}' + actionIcon='remove' + enabled='{updateRemoveEnabled(list.isEnabled() && list.getSelectedIndex() > -1)}' + onActionPerformed='transfertToCombo((B) list.getSelectedValue());'/> + </JToolBar> + </cell> + </row> + </Table> + +</JPanel> \ No newline at end of file diff --git a/jaxx-widgets/src/main/resources/icons/action-add.png b/jaxx-widgets/src/main/resources/icons/action-add.png new file mode 100644 index 0000000..6332fef Binary files /dev/null and b/jaxx-widgets/src/main/resources/icons/action-add.png differ diff --git a/jaxx-widgets/src/main/resources/icons/action-remove.png b/jaxx-widgets/src/main/resources/icons/action-remove.png new file mode 100644 index 0000000..08f2493 Binary files /dev/null and b/jaxx-widgets/src/main/resources/icons/action-remove.png differ diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java index 546612c..8d6f6ad 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBinding/BeanImpl.java @@ -23,7 +23,7 @@ package org.nuiton.jaxx.plugin.DataBinding; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; -public class BeanImpl { +public class BeanImpl implements Bean{ protected String text; PropertyChangeSupport p; diff --git a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java index c442745..408eca4 100644 --- a/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/DataBindingTest.java @@ -38,8 +38,8 @@ public class DataBindingTest extends JaxxBaseTest { assertNumberJaxxFiles(1); // no bindings - checkPattern(mojo, "new jaxx.runtime.DataBindingListener(this, \"nobinding1.text\");", false); - checkPattern(mojo, "new jaxx.runtime.DataBindingListener(this, \"nobinding2.text\");", false); + checkPattern(mojo, "new DataBindingListener(this, \"nobinding1.text\");", false); + checkPattern(mojo, "new DataBindingListener(this, \"nobinding2.text\");", false); // with bindings checkBinding(mojo, "binding8.text"); @@ -47,7 +47,7 @@ public class DataBindingTest extends JaxxBaseTest { protected void checkBinding(GenerateMojo mojo, String... bindings) throws IOException { for (String b : bindings) { - checkPattern(mojo, "new jaxx.runtime.DataBindingListener(this, \"" + b + "\");", true); + checkPattern(mojo, "new DataBindingListener(this, \"" + b + "\");", true); } } } diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/JavaTaist.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/compilerTest/classReferences/JavaTaist.java similarity index 67% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/JavaTaist.java rename to maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/compilerTest/classReferences/JavaTaist.java index e15c38b..e0d0ab4 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/JavaTaist.java +++ b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/compilerTest/classReferences/JavaTaist.java @@ -1,4 +1,4 @@ -package testcases.ClassReferences; +package org.nuiton.jaxx.plugin.compilerTest.classReferences; import javax.swing.*; diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Identity.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Identity.java similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Identity.java rename to maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Identity.java diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Model.java b/maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Model.java similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Model.java rename to maven-jaxx-plugin/src/test/java/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Model.java diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests.xml index 4538ee8..8342298 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests.xml @@ -17,8 +17,9 @@ <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <i18nable>false</i18nable> + <verbose>true</verbose> <includes> - <value>**/compilerTest/CSSTests/*.jaxx</value> + <value>**/compilerTest/cSSTests/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences.xml index 4822db4..c289627 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences.xml @@ -17,7 +17,7 @@ <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> - <value>**/compilerTest/ClassReferences/*.jaxx</value> + <value>**/compilerTest/classReferences/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Initializers.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Initializers.xml index 03a151c..ad41798 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Initializers.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Initializers.xml @@ -17,7 +17,7 @@ <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> - <value>**/compilerTest/Initializers/*.jaxx</value> + <value>**/compilerTest/initializers/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/InnerClasses.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/InnerClasses.xml index 42f9345..aacc750 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/InnerClasses.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/InnerClasses.xml @@ -17,7 +17,7 @@ <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> - <value>**/compilerTest/InnerClasses/*.jaxx</value> + <value>**/compilerTest/innerClasses/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings.xml index a39d1a5..ff9451c 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings.xml @@ -17,7 +17,7 @@ <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> - <value>**/compilerTest/OverridingDataBindings/*.jaxx</value> + <value>**/compilerTest/overridingDataBindings/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Script.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Script.xml index ec71e3f..df270eb 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Script.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Script.xml @@ -17,7 +17,7 @@ <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> - <value>**/compilerTest/Script/*.jaxx</value> + <value>**/compilerTest/script/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing.xml b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing.xml index 9683bcc..824d13f 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing.xml +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing.xml @@ -17,7 +17,7 @@ <!--outResource>${basedir}/target/it-generated-sources/resources</outResource--> <force>true</force> <includes> - <value>**/compilerTest/SpecialSubclassing/*.jaxx</value> + <value>**/compilerTest/specialSubclassing/*.jaxx</value> </includes> </configuration> </plugin> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/CSSTests.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/CSSTests.jaxx similarity index 81% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/CSSTests.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/CSSTests.jaxx index 9dacdff..3f49b68 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/CSSTests.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/CSSTests.jaxx @@ -1,6 +1,6 @@ <Application title='CSSTests'> <style> - Application { lookAndFeel: {lookAndFeel.getSelectedValue()}; } + Application { lookAndFeel: {String.valueOf(lookAndFeel.getSelectedValue())}; } </style> <JMenuBar> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/Child.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/Child.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/Child.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/Child.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/Child2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/Child2.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/Child2.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/Child2.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/GrandChild.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/GrandChild.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/GrandChild.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/GrandChild.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/GrandChildButton.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/GrandChildButton.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/GrandChildButton.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/GrandChildButton.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/Pseudoclasses.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/Pseudoclasses.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/Pseudoclasses.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/Pseudoclasses.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/SimpleCSS.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/SimpleCSS.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/CSSTests/SimpleCSS.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/cSSTests/SimpleCSS.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/ClassReferences.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/ClassReferences.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/ClassReferences.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/ClassReferences.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/ConstructorReferenceTest.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/ConstructorReferenceTest.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/ConstructorReferenceTest.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/ConstructorReferenceTest.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/JAXXReferenceTest.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/JAXXReferenceTest.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/JAXXReferenceTest.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/JAXXReferenceTest.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/JAXXTest.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/JAXXTest.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/JAXXTest.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/JAXXTest.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/StaticMethodTest.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/StaticMethodTest.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/StaticMethodTest.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/StaticMethodTest.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/TypeReference.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/TypeReference.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/ClassReferences/TypeReference.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/classReferences/TypeReference.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Initializers/Initializers.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/initializers/Initializers.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Initializers/Initializers.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/initializers/Initializers.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/InnerClasses/InnerClasses.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/innerClasses/InnerClasses.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/InnerClasses/InnerClasses.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/innerClasses/InnerClasses.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings/CurrentTime.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/overridingDataBindings/CurrentTime.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings/CurrentTime.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/overridingDataBindings/CurrentTime.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings/OverriddenCurrentTime.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/overridingDataBindings/OverriddenCurrentTime.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings/OverriddenCurrentTime.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/overridingDataBindings/OverriddenCurrentTime.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings/OverridingDataBindings.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/overridingDataBindings/OverridingDataBindings.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/OverridingDataBindings/OverridingDataBindings.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/overridingDataBindings/OverridingDataBindings.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Script/JScriptInitializer.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/script/JScriptInitializer.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/Script/JScriptInitializer.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/script/JScriptInitializer.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JComboBoxTest1.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/specialSubclassing/JComboBoxTest1.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JComboBoxTest1.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/specialSubclassing/JComboBoxTest1.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JComboBoxTest2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/specialSubclassing/JComboBoxTest2.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JComboBoxTest2.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/specialSubclassing/JComboBoxTest2.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JListTest1.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/specialSubclassing/JListTest1.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JListTest1.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/specialSubclassing/JListTest1.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JListTest2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/specialSubclassing/JListTest2.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JListTest2.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/specialSubclassing/JListTest2.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JTreeTest1.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/specialSubclassing/JTreeTest1.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JTreeTest1.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/specialSubclassing/JTreeTest1.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JTreeTest2.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/specialSubclassing/JTreeTest2.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/JTreeTest2.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/specialSubclassing/JTreeTest2.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/SpecialSubclassing.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/specialSubclassing/SpecialSubclassing.jaxx similarity index 100% rename from maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/SpecialSubclassing/SpecialSubclassing.jaxx rename to maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerTest/specialSubclassing/SpecialSubclassing.jaxx diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Validation.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Validation.jaxx index 1469d97..d85b2c7 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Validation.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/Validation.jaxx @@ -7,7 +7,7 @@ <!-- errors model --> <jaxx.runtime.validator.swing.SwingValidatorMessageListModel id='errors' - onContentsChanged='ok.setEnabled(errors.size()==0)'/> + onContentsChanged='ok.setEnabled(errors.isEmpty())'/> <!-- validators --> <BeanValidator id='validator' bean='model' errorListModel='errors'> @@ -89,7 +89,7 @@ <JLabel text='Ratio:'/> </cell> <cell> - <JLabel text='{model.getRatio()}'/> + <JLabel text='{model.getRatio()+""}'/> </cell> </row> </Table> @@ -158,7 +158,7 @@ <JLabel text='Ratio:'/> </cell> <cell> - <JLabel text='{model2.getRatio()}'/> + <JLabel text='{model2.getRatio()+""}'/> </cell> </row> </Table> @@ -244,7 +244,7 @@ <JLabel text='Age:'/> </cell> <cell> - <JLabel text='{identity.getAge()}'/> + <JLabel text='{identity.getAge()+""}'/> </cell> </row> </Table> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/ValidationBeanClass.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/ValidationBeanClass.jaxx index 6eb200b..e9a5e97 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/ValidationBeanClass.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/compilerValidatorTest/validator/ok/ValidationBeanClass.jaxx @@ -91,7 +91,7 @@ <JLabel text='Age:'/> </cell> <cell> - <JLabel text='{identity.getAge()}'/> + <JLabel text='{identity.getAge()+""}'/> </cell> </row> </Table> diff --git a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/dataBindingTest/First.jaxx b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/dataBindingTest/First.jaxx index 157d7d8..44d5646 100644 --- a/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/dataBindingTest/First.jaxx +++ b/maven-jaxx-plugin/src/test/resources/org/nuiton/jaxx/plugin/dataBindingTest/First.jaxx @@ -4,8 +4,8 @@ <java.io.File id='file' constructorParams='""'/> <java.io.File id='file2' javaBean='new File("")'/> - <org.nuiton.jaxx.plugin.DataBinding.Bean id='bean' javaBean='new BeanImpl()'/> - <org.nuiton.jaxx.plugin.DataBinding.BeanImpl id='beanImpl' javaBean='new BeanImpl()'/> + <org.nuiton.jaxx.plugin.DataBinding.Bean id='bean' javaBean='new org.nuiton.jaxx.plugin.DataBinding.BeanImpl()'/> + <org.nuiton.jaxx.plugin.DataBinding.BeanImpl id='beanImpl' javaBean='new org.nuiton.jaxx.plugin.DataBinding.BeanImpl()'/> <JLabel id='nobinding1' text='{file.getAbsolutePath()}'/> <JLabel id='nobinding2' text='{getFile().getAbsolutePath()}'/> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 891a8fc0068d5f888c946b69a2d529f88857b0ab Author: Tony Chemit <chemit@codelutin.com> Date: Thu Nov 5 22:25:07 2009 +0000 remove import of SwingUtil in jaxx scripts (auto-import) --- jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx | 1 - jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.jaxx | 1 - .../java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx | 1 - .../java/jaxx/demo/component/jaxx/navigation/content/ActorContentUI.jaxx | 1 - .../jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx | 1 - .../main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx | 1 - .../java/jaxx/demo/component/jaxx/navigation/content/MovieContentUI.jaxx | 1 - .../jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx | 1 - .../src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx | 1 - jaxx-widgets/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx | 1 - jaxx-widgets/src/main/java/jaxx/runtime/swing/HidorButton.jaxx | 1 - jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx | 1 - .../src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx | 1 - 13 files changed, 13 deletions(-) diff --git a/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx index 7e17d00..73e0d0a 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx @@ -28,7 +28,6 @@ <jaxx.runtime.swing.CardLayout2 id='contentLayout'/> <script><![CDATA[ -import jaxx.runtime.SwingUtil; import jaxx.runtime.swing.navigation.*; import java.util.Locale; diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.jaxx index 99ad25f..cfe669c 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/BoxedDecoratorDemo.jaxx @@ -41,7 +41,6 @@ } }}' /> <script><![CDATA[ -import jaxx.runtime.SwingUtil; void $afterCompleteSetup() { for (JComponent boxed : SwingUtil.getLayeredComponents(this)) { diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx index 04b0252..1483496 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/FullNavigationTreeDemo.jaxx @@ -25,7 +25,6 @@ useOnlyVisibleComponentDimension='true'/> <script><![CDATA[ -import jaxx.runtime.SwingUtil; import jaxx.demo.component.jaxx.navigation.content.*; import jaxx.runtime.decorator.DecoratorProvider; diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorContentUI.jaxx index ea62f3f..366bc9c 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorContentUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorContentUI.jaxx @@ -21,7 +21,6 @@ <ContentUI superGenericType='People'> <script><![CDATA[ -import jaxx.runtime.SwingUtil; import jaxx.runtime.swing.navigation.NavigationTreeNode; import jaxx.demo.component.jaxx.navigation.*; diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx index e8e823a..2edce8f 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ActorsContentUI.jaxx @@ -21,7 +21,6 @@ <ContentUI superGenericType='java.util.List<People>'> <script><![CDATA[ -import jaxx.runtime.SwingUtil; import jaxx.demo.component.jaxx.navigation.*; import jaxx.runtime.swing.renderer.DecoratorProviderListCellRenderer; import jaxx.runtime.swing.navigation.NavigationTreeNode; diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx index b34026b..ecaf1ea 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/ContentUI.jaxx @@ -24,7 +24,6 @@ implements='NavigationContentUI'> <script><![CDATA[ -import jaxx.runtime.SwingUtil; import jaxx.demo.component.jaxx.navigation.*; import jaxx.runtime.swing.navigation.NavigationTreeNode; import jaxx.runtime.swing.navigation.NavigationContentUI; diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MovieContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MovieContentUI.jaxx index 115711e..4c57210 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MovieContentUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MovieContentUI.jaxx @@ -21,7 +21,6 @@ <ContentUI superGenericType='Movie'> <script><![CDATA[ -import jaxx.runtime.SwingUtil; import jaxx.runtime.swing.navigation.NavigationTreeNode; import jaxx.demo.component.jaxx.navigation.*; diff --git a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx index f9443f4..04bcbf2 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/component/jaxx/navigation/content/MoviesContentUI.jaxx @@ -21,7 +21,6 @@ <ContentUI superGenericType='java.util.List<Movie>'> <script><![CDATA[ -import jaxx.runtime.SwingUtil; import jaxx.demo.component.jaxx.navigation.*; import jaxx.runtime.swing.renderer.DecoratorProviderListCellRenderer; import jaxx.runtime.swing.navigation.NavigationTreeNode; diff --git a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx index ae50fcd..6f2ef1e 100644 --- a/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx +++ b/jaxx-demo/src/main/java/jaxx/demo/feature/validation/ValidationTableDemo.jaxx @@ -50,7 +50,6 @@ <script><![CDATA[ import static org.nuiton.i18n.I18n.n_; -import jaxx.runtime.SwingUtil; import jaxx.runtime.validator.swing.SwingValidatorUtil; import jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer; diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx index 86395e6..0b86dbf 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/AboutPanel.jaxx @@ -40,7 +40,6 @@ <script><![CDATA[ import org.nuiton.util.Resource; -import jaxx.runtime.SwingUtil; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/HidorButton.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/HidorButton.jaxx index 7285241..6aab7bb 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/HidorButton.jaxx +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/HidorButton.jaxx @@ -11,7 +11,6 @@ <String id='expandTip' javaBean='_("hidor.expandTip")'/> <script><![CDATA[ -import jaxx.runtime.SwingUtil; addPropertyChangeListener("targetVisible", new PropertyChangeListener() { diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx index 8ff7a16..1698145 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/I18nEditor.jaxx @@ -70,7 +70,6 @@ <script><![CDATA[ import java.util.Locale; -import jaxx.runtime.SwingUtil; import jaxx.runtime.swing.renderer.LocaleListCellRenderer; import static org.nuiton.i18n.I18n.n_; diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx index d4e1c6b..cf24a59 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/editor/config/ConfigCategoryUI.jaxx @@ -26,7 +26,6 @@ <style source='ConfigCategoryUI.css'/> <script><![CDATA[ -import jaxx.runtime.SwingUtil; import jaxx.runtime.swing.editor.config.model.*; import jaxx.runtime.swing.editor.ColumnSelector; import static org.nuiton.i18n.I18n.n_; -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit ccc92ef37718a3fe00172371635cc0b8984b9950 Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 6 01:00:03 2009 +0000 add hidor on ListSelector (must finish the ui refresh, still problems) --- .../main/java/jaxx/runtime/swing/HidorButton.jaxx | 2 +- .../java/jaxx/runtime/swing/ListSelectorUI.jaxx | 60 +++++++++++++++++----- .../resources/i18n/jaxx-widgets-en_GB.properties | 2 + .../resources/i18n/jaxx-widgets-fr_FR.properties | 2 + 4 files changed, 52 insertions(+), 14 deletions(-) diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/HidorButton.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/HidorButton.jaxx index 6aab7bb..8ef1600 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/HidorButton.jaxx +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/HidorButton.jaxx @@ -22,7 +22,7 @@ addPropertyChangeListener("targetVisible", new PropertyChangeListener() { boolean newValue = (Boolean) evt.getNewValue(); if (target != null) { target.setVisible(newValue); - }; + } } }); diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/ListSelectorUI.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/ListSelectorUI.jaxx index 6e5477f..02499cb 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/ListSelectorUI.jaxx +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/ListSelectorUI.jaxx @@ -1,5 +1,8 @@ <JPanel layout='{new BorderLayout()}' genericType='B'> + <!-- show hidor property --> + <Boolean id='showHidor' javaBean='false'/> + <Boolean id='modified' javaBean='false'/> <String id='addToListTip' javaBean='"+"'/> @@ -7,9 +10,30 @@ <String id='addToComboTip' javaBean='"-"'/> <ListCellRenderer id='renderer' javaBean='null'/> - + <script><![CDATA[ +hidor.addPropertyChangeListener("targetVisible", new PropertyChangeListener() { + + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (log.isDebugEnabled()) { + log.debug("target visible changed <" + evt.getOldValue() + ":" + evt.getNewValue() + ">"); + } + if (!showHidor || !isEnabled()) { + return; + } + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + log.info("invalidate " + getParent().getName()); + listPane.invalidate(); + } + }); + } +}); + /** * @return the datas from the combo box. */ @@ -112,17 +136,19 @@ protected void setListDatas(java.util.List<B> toList) { ]]> </script> - <JScrollPane constraints='BorderLayout.CENTER' - columnHeaderView='{header}' - verticalScrollBarPolicy='vertical_scrollbar_always' - minimumSize='{SwingUtil.newMinDimension()}'> - <JList id='list' - enabled='{isEnabled()}' - model='{new DefaultListModel()}' - minimumSize='{SwingUtil.newMinDimension()}' - maximumSize='{new Dimension(100,200)}' - font-size='11' - cellRenderer='{getRenderer()}'/> + <JScrollPane id='listPane' constraints='BorderLayout.CENTER' + columnHeaderView='{header}'> + <!--minimumSize='{SwingUtil.newMinDimension()}'>--> + <!--verticalScrollBarPolicy='vertical_scrollbar_always'--> + <JPanel layout="{new BorderLayout()}" minimumSize='{getMinimumSize()}'> + <JList id='list' + constraints='BorderLayout.CENTER' + enabled='{isEnabled()}' + model='{new DefaultListModel()}' + font-size='11' + cellRenderer='{getRenderer()}'/> + </JPanel> + </JScrollPane> <Table id="header" insets='0' constraints='BorderLayout.SOUTH'> @@ -133,7 +159,7 @@ protected void setListDatas(java.util.List<B> toList) { renderer='{getRenderer()}'/> </cell> <cell anchor='east'> - <JToolBar floatable='false'> + <JToolBar id='actions' floatable='false'> <JButton id="add" toolTipText='{getAddToListTip()}' actionIcon='add' @@ -145,6 +171,14 @@ protected void setListDatas(java.util.List<B> toList) { actionIcon='remove' enabled='{updateRemoveEnabled(list.isEnabled() && list.getSelectedIndex() > -1)}' onActionPerformed='transfertToCombo((B) list.getSelectedValue());'/> + + <HidorButton id="hidor" + target='{list}' + visible='{isShowHidor()}' + enabled='{isEnabled()}' + collapseTip='{_("listSelector.hideList")}' + expandTip='{_("listSelector.showList")}' + targetVisible='{true}'/> </JToolBar> </cell> </row> diff --git a/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties b/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties index 3560d78..4a846de 100644 --- a/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties +++ b/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-en_GB.properties @@ -52,6 +52,8 @@ i18neditor.empty.locales=< No locale to select > i18neditor.popup.title=Change language i18neditor.selected=Selected language \: %1$s i18neditor.unselected=Select this langage \: %1$s +listSelector.hideList=Hide the list +listSelector.showList=Show the list memorywidget.memory=%d/%dMb numbereditor..=. numbereditor.0=0 diff --git a/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties b/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties index 2a1ce17..597805d 100644 --- a/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties +++ b/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties @@ -54,6 +54,8 @@ i18neditor.empty.locales=< Aucune locale \u00E0 s\u00E9lectionner > i18neditor.popup.title=Changer de langue i18neditor.selected=Langue actuellement utilis\u00E9e \: %1$s i18neditor.unselected=Pour utiliser cette langue \: %1$s +listSelector.hideList=Cacher la liste +listSelector.showList=Afficher la liste memorywidget.memory=%d/%dMo numbereditor..=. numbereditor.0=0 -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 437016fe76115c3de844b494264fe9eb9a70f381 Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 6 11:36:48 2009 +0000 multi-selection + double click pour supprimer des elements sur un ListSelector --- .../src/main/java/jaxx/runtime/swing/ListSelectorUI.jaxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/jaxx-widgets/src/main/java/jaxx/runtime/swing/ListSelectorUI.jaxx b/jaxx-widgets/src/main/java/jaxx/runtime/swing/ListSelectorUI.jaxx index 02499cb..3a73aed 100644 --- a/jaxx-widgets/src/main/java/jaxx/runtime/swing/ListSelectorUI.jaxx +++ b/jaxx-widgets/src/main/java/jaxx/runtime/swing/ListSelectorUI.jaxx @@ -88,11 +88,13 @@ protected void transfertToList(B b) { /** * Transfert the {@code b} data from list to combo box. * - * @param b the data to transfert + * @param bs the data to transfert */ -protected void transfertToCombo(B b) { - ((DefaultListModel) list.getModel()).removeElement(b); - ((DefaultComboBoxModel) combo.getModel()).addElement(b); +protected void transfertToCombo(B[] bs) { + for (B b : bs) { + ((DefaultListModel) list.getModel()).removeElement(b); + ((DefaultComboBoxModel) combo.getModel()).addElement(b); + } setModified(true); } @@ -146,6 +148,7 @@ protected void setListDatas(java.util.List<B> toList) { enabled='{isEnabled()}' model='{new DefaultListModel()}' font-size='11' + onMouseClicked='if (event.getClickCount()==2) { transfertToCombo((B[]) list.getSelectedValues()); }' cellRenderer='{getRenderer()}'/> </JPanel> @@ -170,7 +173,7 @@ protected void setListDatas(java.util.List<B> toList) { toolTipText='{getAddToComboTip()}' actionIcon='remove' enabled='{updateRemoveEnabled(list.isEnabled() && list.getSelectedIndex() > -1)}' - onActionPerformed='transfertToCombo((B) list.getSelectedValue());'/> + onActionPerformed='transfertToCombo((B[]) list.getSelectedValues())'/> <HidorButton id="hidor" target='{list}' -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 863f26763e703a6d27cf76cf2b3d43a79093e2c4 Author: Tony Chemit <chemit@codelutin.com> Date: Sat Nov 7 06:12:53 2009 +0000 - remove selectUI from context, it is too messy (can not know exactly where it is stored...) - add getParentNode to obtain the first ancestor with a matching internalClass - open api --- .../navigation/NavigationTreeContextHelper.java | 32 +++++++++++----------- .../swing/navigation/NavigationTreeHandler.java | 2 +- .../swing/navigation/NavigationTreeHelper.java | 20 ++++++++++++++ .../swing/navigation/NavigationTreeModel.java | 8 ++++-- 4 files changed, 43 insertions(+), 19 deletions(-) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java index 4d36e53..30fa119 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeContextHelper.java @@ -69,7 +69,7 @@ public class NavigationTreeContextHelper { protected JAXXContextEntryDef<NavigationTreeModel> treeModelContextEntry; protected JAXXContextEntryDef<NavigationTreeHandler> treeHandlerContextEntry; protected JAXXContextEntryDef<JTree> treeContextEntry; - protected JAXXContextEntryDef<Component> selectedUIContextEntry; +// protected JAXXContextEntryDef<Component> selectedUIContextEntry; public NavigationTreeContextHelper(String prefix) { this.prefix = prefix; @@ -79,7 +79,7 @@ public class NavigationTreeContextHelper { selectedBeanContextEntry = Util.newContextEntryDef(prefix + "-selected-bean", Object.class); selectedNodeContextEntry = Util.newContextEntryDef(prefix + "-selected-node", NavigationTreeNode.class); selectedPathContextEntry = Util.newContextEntryDef(prefix + "-selected-path", String.class); - selectedUIContextEntry = Util.newContextEntryDef(prefix + "-selected-ui", Component.class); +// selectedUIContextEntry = Util.newContextEntryDef(prefix + "-selected-ui", Component.class); } public String getPrefix() { @@ -116,10 +116,10 @@ public class NavigationTreeContextHelper { return r; } - public Component getSelectedUI(JAXXContext context) { - Component r = getSelectedUIContextEntry().getContextValue(context); - return r; - } +// public Component getSelectedUI(JAXXContext context) { +// Component r = getSelectedUIContextEntry().getContextValue(context); +// return r; +// } public void setTreeModel(JAXXContext context, NavigationTreeModel model) { getTreeModelContextEntry().setContextValue(context, model); @@ -157,13 +157,13 @@ public class NavigationTreeContextHelper { } } - public void setSelectedUI(JAXXContext context, Component ui) { - if (ui == null) { - getSelectedUIContextEntry().removeContextValue(context); - } else { - getSelectedUIContextEntry().setContextValue(context, ui); - } - } +// public void setSelectedUI(JAXXContext context, Component ui) { +// if (ui == null) { +// getSelectedUIContextEntry().removeContextValue(context); +// } else { +// getSelectedUIContextEntry().setContextValue(context, ui); +// } +// } protected JAXXContextEntryDef<NavigationTreeModel> getTreeModelContextEntry() { return treeModelContextEntry; @@ -189,7 +189,7 @@ public class NavigationTreeContextHelper { return treeContextEntry; } - public JAXXContextEntryDef<Component> getSelectedUIContextEntry() { - return selectedUIContextEntry; - } +// public JAXXContextEntryDef<Component> getSelectedUIContextEntry() { +// return selectedUIContextEntry; +// } } diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java index cb87f65..0bfee29 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHandler.java @@ -240,7 +240,7 @@ public abstract class NavigationTreeHandler extends DefaultTreeSelectionModel { helper.setSelectedNode(ctxt, node); // save in context current ui - helper.setSelectedUI(ctxt, newUI); +// helper.setSelectedUI(ctxt, newUI); // really open the ui associated with the selected node // init ui before to be visible diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java index 48f2cbe..64260d5 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeHelper.java @@ -163,6 +163,26 @@ public abstract class NavigationTreeHelper extends NavigationTreeContextHelper { } /** + * Obtain the first ancestor with the matching internalClass + * + * @param current the node to test + * @param beanClass the type of the internal class to seek of + * @return the first ancestor node with the matching class or {@code null} if not found + */ + public NavigationTreeNode getParentNode(NavigationTreeNode current, Class<?> beanClass) { + if (current == null) { + // ancestor not found + return null; + } + if (beanClass.isAssignableFrom(current.getInternalClass())) { + // matching node + return current; + } + // try in the parent of node + return getParentNode(current.getParent(), beanClass); + } + + /** * Sélection d'un fils du noeud selectionne dans l'arbre de navigation. * * @param context le contexte applicatif diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java index 8b4a8a2..9fa2cdd 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/swing/navigation/NavigationTreeModel.java @@ -50,7 +50,7 @@ public class NavigationTreeModel extends DefaultTreeModel { * The path separator used to build the {@link NavigationTreeNode#fullPath}. * * @see NavigationTreeNode#getNodePath() - * @see NavigationTreeNode#getFullPath() + * @see NavigationTreeNode#getFullPath() */ protected final String pathSeparator; /** @@ -206,7 +206,7 @@ public class NavigationTreeModel extends DefaultTreeModel { /** * Obtain the associated bean value from context corresponding to node * - * @param node the current node + * @param node the current node * @return the value associated in context with the given node. */ public Object getBean(NavigationTreeNode node) { @@ -263,4 +263,8 @@ public class NavigationTreeModel extends DefaultTreeModel { } } } + + public String getPathSeparator() { + return pathSeparator; + } } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit e20de57c885b38c1fefdf9bd15cf51c55da601e8 Author: Tony Chemit <chemit@codelutin.com> Date: Sat Nov 7 12:39:42 2009 +0000 fix NPE if object is root --- .../java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java index 8e47db5..01984cb 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/decorators/BoxedCompiledObjectDecorator.java @@ -29,7 +29,7 @@ import jaxx.runtime.SwingUtil; /** * A decorator to surround a compiled object (should be a component at least) * with a JXLayer. - * + * * @author tony * @since 1.2 */ @@ -43,6 +43,9 @@ public class BoxedCompiledObjectDecorator extends DefaultCompiledObjectDecorator @Override public void finalizeCompiler(JAXXCompiler compiler, CompiledObject root, CompiledObject object, JavaFile javaFile, String packageName, String className, String fullClassName) { CompiledObject parent = object.getParent(); + if (parent == null) { + parent = root; + } for (ChildRef child : parent.getChilds()) { if (child.getChild() == object) { String javaCode = child.getChildJavaCode(); -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 2b1c73a53464d6bcb1b2eed349c5e76237a7ef06 Author: Tony Chemit <chemit@codelutin.com> Date: Sat Nov 7 13:26:40 2009 +0000 remove unused import and code --- .../src/main/java/jaxx/compiler/binding/DataSource.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java b/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java index 3f3435e..1e5da72 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/binding/DataSource.java @@ -43,8 +43,6 @@ import java.beans.PropertyChangeListener; import java.io.StringReader; import java.lang.reflect.Modifier; import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; import java.util.List; import org.apache.commons.logging.Log; @@ -204,12 +202,12 @@ public class DataSource { return dependencySymbols.size() > 0; } - /** - * @return a list of symbols on which this data source depends. - */ - public Collection<String> getDependencies() { - return Collections.unmodifiableList(dependencySymbols); - } +// /** +// * @return a list of symbols on which this data source depends. +// */ +// public Collection<String> getDependencies() { +// return Collections.unmodifiableList(dependencySymbols); +// } /** * Examines a node to identify any dependencies it contains. -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit e74596b01dbb55e383ef4577e93efa92d1d79d33 Author: Tony Chemit <chemit@codelutin.com> Date: Mon Nov 9 10:01:17 2009 +0000 fix i18n label --- .../resources/i18n/jaxx-widgets-fr_FR.properties | 52 +++++++++++----------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties b/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties index 597805d..586901c 100644 --- a/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties +++ b/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties @@ -1,48 +1,48 @@ -aboutframe.about=\u00C0 propos +aboutframe.about=\u00c0 propos aboutframe.license=Licence aboutframe.ok=OK aboutframe.thirdparty=Tierce partie -columnselector.action.tip=S\u00E9lectionner les colonnes +columnselector.action.tip=S\u00e9lectionner les colonnes config.action.quit=Quitter -config.action.quit.tip=Quitter l'\u00E9diteur de configuration +config.action.quit.tip=Quitter l'\u00e9diteur de configuration config.action.reset=Annuler -config.action.reset.tip=Annuler les modifications de cette cat\u00E9gorie +config.action.reset.tip=Annuler les modifications de cette cat\u00e9gorie config.action.save=Enregistrer -config.action.save.tip=Sauver les modifications de cette cat\u00E9gorie -config.category.saved=La cat\u00E9gorie '%1$s' a \u00E9t\u00E9 modifi\u00E9e \: +config.action.save.tip=Sauver les modifications de cette cat\u00e9gorie +config.category.saved=La cat\u00e9gorie '%1$s' a \u00e9t\u00e9 modifi\u00e9e \: config.choice.cancel=Annuler config.choice.continue=Continuer config.choice.doNotSave=Ne pas enregistrer config.choice.ok=Ok config.choice.save=Enregistrer -config.defaultValue=Valeur par d\u00E9faut -config.defaultValue.tip=Valeur par d\u00E9faut de l'option +config.defaultValue=Valeur par d\u00e9faut +config.defaultValue.tip=Valeur par d\u00e9faut de l'option config.descrition=Description -config.error.category.already.exists=La cat\u00E9gorie de nom '%1$s' existe d\u00E9j\u00E0\! -config.error.category.not.found=La cat\u00E9gorie de nom '%1$s' n'existe pas\! +config.error.category.already.exists=La cat\u00e9gorie de nom '%1$s' existe d\u00e9j\u00e0\! +config.error.category.not.found=La cat\u00e9gorie de nom '%1$s' n'existe pas\! config.key=Clef config.key.tip=Clef de l'option -config.message.quit.invalid.category=La cat\u00E9gorie '%1$s' n'est pas valide\! -config.message.quit.valid.and.modified.category=La cat\u00E9gorie '%1$s' poss\u00E8dent des options modifi\u00E9es \: -config.modified=Option modifi\u00E9e (valeur originale \: %1$s) -config.no.option.selected=< Pas d'option s\u00E9lectionn\u00E9e > +config.message.quit.invalid.category=La cat\u00e9gorie '%1$s' n'est pas valide\! +config.message.quit.valid.and.modified.category=La cat\u00e9gorie '%1$s' poss\u00e8dent des options modifi\u00e9es \: +config.modified=Option modifi\u00e9e (valeur originale \: %1$s) +config.no.option.selected=< Pas d'option s\u00e9lectionn\u00e9e > config.option.final=Option non modifiable config.option.label=Option '%1$s' (%2$s) -config.option.modified=Valeur modifi\u00E9e < nouvelle valeur \: '%1$s' - ancienne valeur \: '%2$s' > +config.option.modified=Valeur modifi\u00e9e < ancienne valeur \: '%1$s' - nouvelle valeur \: '%2$s' > config.option.valid=Valeur non valide -config.title=Pr\u00E9f\u00E9rences +config.title=Pr\u00e9f\u00e9rences config.title.need.confirm=Une confirmation de votre part est requise... -config.title.will.reload.application=L'application doit \u00EAtre red\u00E9marrer... -config.unmodifiable=Ne peut pas \u00EAtre modifi\u00E9 +config.title.will.reload.application=L'application doit \u00eatre red\u00e9marrer... +config.unmodifiable=Ne peut pas \u00eatre modifi\u00e9 config.unvalid=Option non valide (valeur originale \: %1$s, type requis \: %2$s) config.value=Valeur config.value.tip=Valeur de l'option -entitycombobox.action.reset.tip=R\u00E9initialiser la valeur de la liste d\u00E9roulante -entitycombobox.action.sort.tip=Modifier le tri de la liste d\u00E9roulante +entitycombobox.action.reset.tip=R\u00e9initialiser la valeur de la liste d\u00e9roulante +entitycombobox.action.sort.tip=Modifier le tri de la liste d\u00e9roulante entitycombobox.popup.label=Objet '%1$s' entitycombobox.popup.title=Modifier le tri -entitycombobox.sort.off=Cliquer pour activer le tri sur la propri\u00E9t\u00E9 '%1$s' -entitycombobox.sort.on=Le tri est effectu\u00E9 sur la propri\u00E9t\u00E9 '%1$s' +entitycombobox.sort.off=Cliquer pour activer le tri sur la propri\u00e9t\u00e9 '%1$s' +entitycombobox.sort.on=Le tri est effectu\u00e9 sur la propri\u00e9t\u00e9 '%1$s' entitycombobox.unknown.type=Objet de type inconnu errorUI.action.close=Fermer errorUI.message=Une erreur est survenue \! @@ -50,9 +50,9 @@ errorUI.title=Erreur... hidor.collapseTip=Voir hidor.expandTip= hidor.showTip=Cacher -i18neditor.empty.locales=< Aucune locale \u00E0 s\u00E9lectionner > +i18neditor.empty.locales=< Aucune locale \u00e0 s\u00e9lectionner > i18neditor.popup.title=Changer de langue -i18neditor.selected=Langue actuellement utilis\u00E9e \: %1$s +i18neditor.selected=Langue actuellement utilis\u00e9e \: %1$s i18neditor.unselected=Pour utiliser cette langue \: %1$s listSelector.hideList=Cacher la liste listSelector.showList=Afficher la liste @@ -68,8 +68,8 @@ numbereditor.6=6 numbereditor.7=7 numbereditor.8=8 numbereditor.9=9 -numbereditor.action.reset.tip=R\u00E9initialiser -numbereditor.action.show.tip=Afficher le pav\u00E9 num\u00E9rique +numbereditor.action.reset.tip=R\u00e9initialiser +numbereditor.action.show.tip=Afficher le pav\u00e9 num\u00e9rique numbereditor.clearAll=C numbereditor.clearOne=CE numbereditor.toggleSign=+/- -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit f578cfa2db55c847da9d655e7c594c14729e88df Author: Tony Chemit <chemit@codelutin.com> Date: Mon Nov 9 10:41:36 2009 +0000 fix i18n label --- .../resources/i18n/jaxx-widgets-fr_FR.properties | 58 +++++++++++----------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties b/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties index 586901c..ea88ef3 100644 --- a/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties +++ b/jaxx-widgets/src/main/resources/i18n/jaxx-widgets-fr_FR.properties @@ -1,58 +1,56 @@ -aboutframe.about=\u00c0 propos +aboutframe.about=\u00C0 propos aboutframe.license=Licence aboutframe.ok=OK aboutframe.thirdparty=Tierce partie -columnselector.action.tip=S\u00e9lectionner les colonnes +columnselector.action.tip=S\u00E9lectionner les colonnes config.action.quit=Quitter -config.action.quit.tip=Quitter l'\u00e9diteur de configuration +config.action.quit.tip=Quitter l'\u00E9diteur de configuration config.action.reset=Annuler -config.action.reset.tip=Annuler les modifications de cette cat\u00e9gorie +config.action.reset.tip=Annuler les modifications de cette cat\u00E9gorie config.action.save=Enregistrer -config.action.save.tip=Sauver les modifications de cette cat\u00e9gorie -config.category.saved=La cat\u00e9gorie '%1$s' a \u00e9t\u00e9 modifi\u00e9e \: +config.action.save.tip=Sauver les modifications de cette cat\u00E9gorie +config.category.saved=La cat\u00E9gorie '%1$s' a \u00E9t\u00E9 modifi\u00E9e \: config.choice.cancel=Annuler config.choice.continue=Continuer config.choice.doNotSave=Ne pas enregistrer config.choice.ok=Ok config.choice.save=Enregistrer -config.defaultValue=Valeur par d\u00e9faut -config.defaultValue.tip=Valeur par d\u00e9faut de l'option +config.defaultValue=Valeur par d\u00E9faut +config.defaultValue.tip=Valeur par d\u00E9faut de l'option config.descrition=Description -config.error.category.already.exists=La cat\u00e9gorie de nom '%1$s' existe d\u00e9j\u00e0\! -config.error.category.not.found=La cat\u00e9gorie de nom '%1$s' n'existe pas\! +config.error.category.already.exists=La cat\u00E9gorie de nom '%1$s' existe d\u00E9j\u00E0\! +config.error.category.not.found=La cat\u00E9gorie de nom '%1$s' n'existe pas\! config.key=Clef config.key.tip=Clef de l'option -config.message.quit.invalid.category=La cat\u00e9gorie '%1$s' n'est pas valide\! -config.message.quit.valid.and.modified.category=La cat\u00e9gorie '%1$s' poss\u00e8dent des options modifi\u00e9es \: -config.modified=Option modifi\u00e9e (valeur originale \: %1$s) -config.no.option.selected=< Pas d'option s\u00e9lectionn\u00e9e > +config.message.quit.invalid.category=La cat\u00E9gorie '%1$s' n'est pas valide\! +config.message.quit.valid.and.modified.category=La cat\u00E9gorie '%1$s' poss\u00E8dent des options modifi\u00E9es \: +config.modified=Option modifi\u00E9e (valeur originale \: %1$s) +config.no.option.selected=< Pas d'option s\u00E9lectionn\u00E9e > config.option.final=Option non modifiable config.option.label=Option '%1$s' (%2$s) -config.option.modified=Valeur modifi\u00e9e < ancienne valeur \: '%1$s' - nouvelle valeur \: '%2$s' > -config.option.valid=Valeur non valide -config.title=Pr\u00e9f\u00e9rences +config.option.modified=Valeur modifi\u00E9e < ancienne valeur \: '%1$s' - nouvelle valeur \: '%2$s' > +config.title=Pr\u00E9f\u00E9rences config.title.need.confirm=Une confirmation de votre part est requise... -config.title.will.reload.application=L'application doit \u00eatre red\u00e9marrer... -config.unmodifiable=Ne peut pas \u00eatre modifi\u00e9 +config.title.will.reload.application=L'application doit \u00EAtre red\u00E9marrer... +config.unmodifiable=Ne peut pas \u00EAtre modifi\u00E9 config.unvalid=Option non valide (valeur originale \: %1$s, type requis \: %2$s) config.value=Valeur config.value.tip=Valeur de l'option -entitycombobox.action.reset.tip=R\u00e9initialiser la valeur de la liste d\u00e9roulante -entitycombobox.action.sort.tip=Modifier le tri de la liste d\u00e9roulante +entitycombobox.action.reset.tip=R\u00E9initialiser la valeur de la liste d\u00E9roulante +entitycombobox.action.sort.tip=Modifier le tri de la liste d\u00E9roulante entitycombobox.popup.label=Objet '%1$s' entitycombobox.popup.title=Modifier le tri -entitycombobox.sort.off=Cliquer pour activer le tri sur la propri\u00e9t\u00e9 '%1$s' -entitycombobox.sort.on=Le tri est effectu\u00e9 sur la propri\u00e9t\u00e9 '%1$s' +entitycombobox.sort.off=Cliquer pour activer le tri sur la propri\u00E9t\u00E9 '%1$s' +entitycombobox.sort.on=Le tri est effectu\u00E9 sur la propri\u00E9t\u00E9 '%1$s' entitycombobox.unknown.type=Objet de type inconnu errorUI.action.close=Fermer errorUI.message=Une erreur est survenue \! errorUI.title=Erreur... -hidor.collapseTip=Voir -hidor.expandTip= -hidor.showTip=Cacher -i18neditor.empty.locales=< Aucune locale \u00e0 s\u00e9lectionner > +hidor.collapseTip=Cacher +hidor.expandTip=Voir +i18neditor.empty.locales=< Aucune locale \u00E0 s\u00E9lectionner > i18neditor.popup.title=Changer de langue -i18neditor.selected=Langue actuellement utilis\u00e9e \: %1$s +i18neditor.selected=Langue actuellement utilis\u00E9e \: %1$s i18neditor.unselected=Pour utiliser cette langue \: %1$s listSelector.hideList=Cacher la liste listSelector.showList=Afficher la liste @@ -68,8 +66,8 @@ numbereditor.6=6 numbereditor.7=7 numbereditor.8=8 numbereditor.9=9 -numbereditor.action.reset.tip=R\u00e9initialiser -numbereditor.action.show.tip=Afficher le pav\u00e9 num\u00e9rique +numbereditor.action.reset.tip=R\u00E9initialiser +numbereditor.action.show.tip=Afficher le pav\u00E9 num\u00E9rique numbereditor.clearAll=C numbereditor.clearOne=CE numbereditor.toggleSign=+/- -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 875cd5450c492cf881b4de482925a0854339dfdc Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 13 09:07:03 2009 +0000 stay for the moment on i18n 1.0.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1acdd7b..83596c0 100644 --- a/pom.xml +++ b/pom.xml @@ -356,7 +356,7 @@ <projectId>jaxx</projectId> <lutinutil.version>1.1.0</lutinutil.version> - <i18n.version>1.0.2-SNAPSHOT</i18n.version> + <i18n.version>1.0.1</i18n.version> <jxlayer.version>3.0.3</jxlayer.version> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 2acd55dfcc387609dd75ad809e0fadb5439afdcf Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 13 09:09:54 2009 +0000 patch pom since can't use at the moment mavenpom 1.1.1 (not released... --- pom.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pom.xml b/pom.xml index 83596c0..cb013a7 100644 --- a/pom.xml +++ b/pom.xml @@ -362,6 +362,10 @@ <javahelp.version>2.0.02</javahelp.version> + <!-- to include (or not) attached files to redmine file to publish --> + <!-- will be remove when using mavenpom 1.1.1 --> + <redmine.includeAttached>false</redmine.includeAttached> + </properties> <build> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 1281dda773a17ef82866ef35716951d2c7e6811f Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 13 09:21:03 2009 +0000 prepare beta release --- jaxx-compiler/pom.xml | 2 +- jaxx-demo/pom.xml | 2 +- jaxx-runtime/pom.xml | 2 +- jaxx-swing-action/pom.xml | 2 +- jaxx-widgets/pom.xml | 2 +- maven-jaxx-plugin/pom.xml | 2 +- pom.xml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/jaxx-compiler/pom.xml b/jaxx-compiler/pom.xml index 4ce78f2..8f50d62 100644 --- a/jaxx-compiler/pom.xml +++ b/jaxx-compiler/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-SNAPSHOT</version> + <version>2.0.0-beta-1-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-demo/pom.xml b/jaxx-demo/pom.xml index dd77116..b5a4469 100644 --- a/jaxx-demo/pom.xml +++ b/jaxx-demo/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-SNAPSHOT</version> + <version>2.0.0-beta-1-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-runtime/pom.xml b/jaxx-runtime/pom.xml index c0da43b..36dda18 100644 --- a/jaxx-runtime/pom.xml +++ b/jaxx-runtime/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-SNAPSHOT</version> + <version>2.0.0-beta-1-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-swing-action/pom.xml b/jaxx-swing-action/pom.xml index d304bb2..a20b5bf 100644 --- a/jaxx-swing-action/pom.xml +++ b/jaxx-swing-action/pom.xml @@ -11,7 +11,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-SNAPSHOT</version> + <version>2.0.0-beta-1-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-widgets/pom.xml b/jaxx-widgets/pom.xml index 40e80d9..66cb470 100644 --- a/jaxx-widgets/pom.xml +++ b/jaxx-widgets/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-SNAPSHOT</version> + <version>2.0.0-beta-1-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/maven-jaxx-plugin/pom.xml b/maven-jaxx-plugin/pom.xml index 5776077..33cc658 100644 --- a/maven-jaxx-plugin/pom.xml +++ b/maven-jaxx-plugin/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-SNAPSHOT</version> + <version>2.0.0-beta-1-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/pom.xml b/pom.xml index cb013a7..5b1ec41 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ </parent> <artifactId>jaxx</artifactId> - <version>2.0.0-SNAPSHOT</version> + <version>2.0.0-beta-1-SNAPSHOT</version> <modules> <module>jaxx-runtime</module> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 03b93abf1eaa984c52d69610114e8e1df789d7ba Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 13 09:21:35 2009 +0000 prepare beta release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5b1ec41..2f8abe5 100644 --- a/pom.xml +++ b/pom.xml @@ -342,7 +342,7 @@ <name>JAXX Project</name> <description>JAXX Project</description> <inceptionYear>2008</inceptionYear> - <url>http://maven-site.nuiton.org/jaxx-2.0</url> + <url>http://maven-site.nuiton.org/jaxx</url> <!-- ************************************************************* --> <!-- *** Build Settings ****************************************** --> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 7a9a1dd17f3c5647ee9a4a2b18e66994d2294d46 Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 13 09:34:56 2009 +0000 [maven-release-plugin] prepare release jaxx-2.0.0-beta-1 --- jaxx-compiler/pom.xml | 2 +- jaxx-demo/pom.xml | 2 +- jaxx-runtime/pom.xml | 2 +- jaxx-swing-action/pom.xml | 2 +- jaxx-widgets/pom.xml | 2 +- maven-jaxx-plugin/pom.xml | 2 +- pom.xml | 11 +++++------ 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/jaxx-compiler/pom.xml b/jaxx-compiler/pom.xml index 8f50d62..212a09f 100644 --- a/jaxx-compiler/pom.xml +++ b/jaxx-compiler/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1-SNAPSHOT</version> + <version>2.0.0-beta-1</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-demo/pom.xml b/jaxx-demo/pom.xml index b5a4469..2400245 100644 --- a/jaxx-demo/pom.xml +++ b/jaxx-demo/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1-SNAPSHOT</version> + <version>2.0.0-beta-1</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-runtime/pom.xml b/jaxx-runtime/pom.xml index 36dda18..009224c 100644 --- a/jaxx-runtime/pom.xml +++ b/jaxx-runtime/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1-SNAPSHOT</version> + <version>2.0.0-beta-1</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-swing-action/pom.xml b/jaxx-swing-action/pom.xml index a20b5bf..ab52608 100644 --- a/jaxx-swing-action/pom.xml +++ b/jaxx-swing-action/pom.xml @@ -11,7 +11,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1-SNAPSHOT</version> + <version>2.0.0-beta-1</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-widgets/pom.xml b/jaxx-widgets/pom.xml index 66cb470..23b016f 100644 --- a/jaxx-widgets/pom.xml +++ b/jaxx-widgets/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1-SNAPSHOT</version> + <version>2.0.0-beta-1</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/maven-jaxx-plugin/pom.xml b/maven-jaxx-plugin/pom.xml index 33cc658..f09696d 100644 --- a/maven-jaxx-plugin/pom.xml +++ b/maven-jaxx-plugin/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1-SNAPSHOT</version> + <version>2.0.0-beta-1</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/pom.xml b/pom.xml index 2f8abe5..73909f4 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,4 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -14,7 +13,7 @@ </parent> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1-SNAPSHOT</version> + <version>2.0.0-beta-1</version> <modules> <module>jaxx-runtime</module> @@ -402,9 +401,9 @@ <!-- Source control management. --> <scm> - <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</connection> - <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</developerConnection> - <url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url> + <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.0.0-beta-1</connection> + <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.0.0-beta-1</developerConnection> + <url>http://www.nuiton.org/repositories/browse/jaxx/tags/jaxx-2.0.0-beta-1</url> </scm> </project> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 1bad470834165da511b11ac70ff41f75098065fa Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 13 09:34:59 2009 +0000 [maven-scm] copy for tag jaxx-2.0.0-beta-1 -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit fda0a64eae767cb3776ec5b61f1ee36b107d3ad9 Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 13 09:35:04 2009 +0000 [maven-release-plugin] prepare for next development iteration --- jaxx-compiler/pom.xml | 2 +- jaxx-demo/pom.xml | 2 +- jaxx-runtime/pom.xml | 2 +- jaxx-swing-action/pom.xml | 2 +- jaxx-widgets/pom.xml | 2 +- maven-jaxx-plugin/pom.xml | 2 +- pom.xml | 8 ++++---- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/jaxx-compiler/pom.xml b/jaxx-compiler/pom.xml index 212a09f..68f4013 100644 --- a/jaxx-compiler/pom.xml +++ b/jaxx-compiler/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1</version> + <version>2.0.0-beta-2-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-demo/pom.xml b/jaxx-demo/pom.xml index 2400245..133d20b 100644 --- a/jaxx-demo/pom.xml +++ b/jaxx-demo/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1</version> + <version>2.0.0-beta-2-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-runtime/pom.xml b/jaxx-runtime/pom.xml index 009224c..ffac357 100644 --- a/jaxx-runtime/pom.xml +++ b/jaxx-runtime/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1</version> + <version>2.0.0-beta-2-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-swing-action/pom.xml b/jaxx-swing-action/pom.xml index ab52608..2bc5b9d 100644 --- a/jaxx-swing-action/pom.xml +++ b/jaxx-swing-action/pom.xml @@ -11,7 +11,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1</version> + <version>2.0.0-beta-2-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-widgets/pom.xml b/jaxx-widgets/pom.xml index 23b016f..5adaa3b 100644 --- a/jaxx-widgets/pom.xml +++ b/jaxx-widgets/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1</version> + <version>2.0.0-beta-2-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/maven-jaxx-plugin/pom.xml b/maven-jaxx-plugin/pom.xml index f09696d..93b15e5 100644 --- a/maven-jaxx-plugin/pom.xml +++ b/maven-jaxx-plugin/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1</version> + <version>2.0.0-beta-2-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/pom.xml b/pom.xml index 73909f4..eccffb3 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ </parent> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1</version> + <version>2.0.0-beta-2-SNAPSHOT</version> <modules> <module>jaxx-runtime</module> @@ -401,9 +401,9 @@ <!-- Source control management. --> <scm> - <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.0.0-beta-1</connection> - <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/tags/jaxx-2.0.0-beta-1</developerConnection> - <url>http://www.nuiton.org/repositories/browse/jaxx/tags/jaxx-2.0.0-beta-1</url> + <connection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</connection> + <developerConnection>scm:svn:http://svn.nuiton.org/svn/jaxx/trunk</developerConnection> + <url>http://www.nuiton.org/repositories/browse/jaxx/trunk</url> </scm> </project> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit aefcdd65ad582d1b5a51e23659d7438f0ddcd67b Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 13 10:10:27 2009 +0000 [maven-release-plugin] rollback the release of jaxx-2.0.0-beta-1 --- jaxx-compiler/pom.xml | 2 +- jaxx-demo/pom.xml | 2 +- jaxx-runtime/pom.xml | 2 +- jaxx-swing-action/pom.xml | 2 +- jaxx-widgets/pom.xml | 2 +- maven-jaxx-plugin/pom.xml | 2 +- pom.xml | 5 +++-- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/jaxx-compiler/pom.xml b/jaxx-compiler/pom.xml index 68f4013..8f50d62 100644 --- a/jaxx-compiler/pom.xml +++ b/jaxx-compiler/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-2-SNAPSHOT</version> + <version>2.0.0-beta-1-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-demo/pom.xml b/jaxx-demo/pom.xml index 133d20b..b5a4469 100644 --- a/jaxx-demo/pom.xml +++ b/jaxx-demo/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-2-SNAPSHOT</version> + <version>2.0.0-beta-1-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-runtime/pom.xml b/jaxx-runtime/pom.xml index ffac357..36dda18 100644 --- a/jaxx-runtime/pom.xml +++ b/jaxx-runtime/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-2-SNAPSHOT</version> + <version>2.0.0-beta-1-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-swing-action/pom.xml b/jaxx-swing-action/pom.xml index 2bc5b9d..a20b5bf 100644 --- a/jaxx-swing-action/pom.xml +++ b/jaxx-swing-action/pom.xml @@ -11,7 +11,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-2-SNAPSHOT</version> + <version>2.0.0-beta-1-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-widgets/pom.xml b/jaxx-widgets/pom.xml index 5adaa3b..66cb470 100644 --- a/jaxx-widgets/pom.xml +++ b/jaxx-widgets/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-2-SNAPSHOT</version> + <version>2.0.0-beta-1-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/maven-jaxx-plugin/pom.xml b/maven-jaxx-plugin/pom.xml index 93b15e5..33cc658 100644 --- a/maven-jaxx-plugin/pom.xml +++ b/maven-jaxx-plugin/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-2-SNAPSHOT</version> + <version>2.0.0-beta-1-SNAPSHOT</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/pom.xml b/pom.xml index eccffb3..2f8abe5 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,5 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -13,7 +14,7 @@ </parent> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-2-SNAPSHOT</version> + <version>2.0.0-beta-1-SNAPSHOT</version> <modules> <module>jaxx-runtime</module> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit c9257727d4557add830d4e0b1e9277d7de3dcfcc Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 13 10:27:16 2009 +0000 prepare a false release fro Vradi (not a true release since we are on a branch) --- jaxx-compiler/pom.xml | 2 +- jaxx-demo/pom.xml | 2 +- jaxx-runtime/pom.xml | 2 +- jaxx-swing-action/pom.xml | 2 +- jaxx-widgets/pom.xml | 2 +- maven-jaxx-plugin/pom.xml | 2 +- pom.xml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/jaxx-compiler/pom.xml b/jaxx-compiler/pom.xml index 8f50d62..212a09f 100644 --- a/jaxx-compiler/pom.xml +++ b/jaxx-compiler/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1-SNAPSHOT</version> + <version>2.0.0-beta-1</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-demo/pom.xml b/jaxx-demo/pom.xml index b5a4469..2400245 100644 --- a/jaxx-demo/pom.xml +++ b/jaxx-demo/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1-SNAPSHOT</version> + <version>2.0.0-beta-1</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-runtime/pom.xml b/jaxx-runtime/pom.xml index 36dda18..009224c 100644 --- a/jaxx-runtime/pom.xml +++ b/jaxx-runtime/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1-SNAPSHOT</version> + <version>2.0.0-beta-1</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-swing-action/pom.xml b/jaxx-swing-action/pom.xml index a20b5bf..ab52608 100644 --- a/jaxx-swing-action/pom.xml +++ b/jaxx-swing-action/pom.xml @@ -11,7 +11,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1-SNAPSHOT</version> + <version>2.0.0-beta-1</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/jaxx-widgets/pom.xml b/jaxx-widgets/pom.xml index 66cb470..23b016f 100644 --- a/jaxx-widgets/pom.xml +++ b/jaxx-widgets/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1-SNAPSHOT</version> + <version>2.0.0-beta-1</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/maven-jaxx-plugin/pom.xml b/maven-jaxx-plugin/pom.xml index 33cc658..f09696d 100644 --- a/maven-jaxx-plugin/pom.xml +++ b/maven-jaxx-plugin/pom.xml @@ -10,7 +10,7 @@ <parent> <groupId>org.nuiton</groupId> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1-SNAPSHOT</version> + <version>2.0.0-beta-1</version> </parent> <groupId>org.nuiton.jaxx</groupId> diff --git a/pom.xml b/pom.xml index 2f8abe5..0c712c9 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ </parent> <artifactId>jaxx</artifactId> - <version>2.0.0-beta-1-SNAPSHOT</version> + <version>2.0.0-beta-1</version> <modules> <module>jaxx-runtime</module> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to annotated tag v2.0.0-beta-1 in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 9da47a036a0035e3664b4e05e992bf024a4888df Merge: 1bad470 c925772 Author: Tony Chemit <chemit@codelutin.com> Date: Fri Nov 13 10:33:12 2009 +0000 create an intermediaire version for Vradi release jaxx-compiler/pom.xml | 16 +- jaxx-compiler/src/main/java/jaxx/ClassMap.java | 96 - .../src/main/java/jaxx/CompilerException.java | 52 - .../src/main/java/jaxx/DefaultInitializer.java | 52 - jaxx-compiler/src/main/java/jaxx/PrintTagInfo.java | 118 - .../src/main/java/jaxx/ScriptException.java | 45 - .../src/main/java/jaxx/SwingInitializer.java | 127 - .../java/jaxx/UnsupportedAttributeException.java | 49 - .../main/java/jaxx/UnsupportedTagException.java | 45 - .../src/main/java/jaxx/beaninfos/BeanInfoUtil.java | 36 - .../compiler/BoxedCompiledObjectDecorator.java | 27 - .../src/main/java/jaxx/compiler/ClassMap.java | 112 + .../main/java/jaxx/compiler/CompiledObject.java | 1352 +-- .../jaxx/compiler/CompiledObjectDecorator.java | 126 +- .../java/jaxx/compiler/CompilerConfiguration.java | 150 + .../main/java/jaxx/compiler/CompilerException.java | 66 + .../main/java/jaxx/compiler/CompilerOptions.java | 406 - .../src/main/java/jaxx/compiler/DataBinding.java | 92 - .../src/main/java/jaxx/compiler/DataSource.java | 454 - .../compiler/DefaultCompiledObjectDecorator.java | 128 - .../compiler/DefaultCompilerConfiguration.java | 216 + .../src/main/java/jaxx/compiler/EventHandler.java | 133 +- .../src/main/java/jaxx/compiler/Generator.java | 14 - .../compiler/HelpRootCompiledObjectDecorator.java | 93 - .../src/main/java/jaxx/compiler/I18nHelper.java | 33 +- .../src/main/java/jaxx/compiler/JAXXCompiler.java | 938 +- .../java/jaxx/compiler/JAXXCompilerFinalizer.java | 59 + .../java/jaxx/compiler/JAXXCompilerLaunchor.java | 451 - .../src/main/java/jaxx/compiler/JAXXEngine.java | 675 ++ .../java/jaxx/compiler/JAXXObjectGenerator.java | 598 -- .../src/main/java/jaxx/compiler/JAXXProfile.java | 50 +- .../src/main/java/jaxx/compiler/JavaArgument.java | 86 - .../src/main/java/jaxx/compiler/JavaField.java | 187 - .../src/main/java/jaxx/compiler/JavaFile.java | 344 - .../src/main/java/jaxx/compiler/JavaMethod.java | 499 - .../main/java/jaxx/compiler/ScriptInitializer.java | 20 - .../src/main/java/jaxx/compiler/ScriptManager.java | 336 - .../src/main/java/jaxx/compiler/SwingCompiler.java | 73 - .../main/java/jaxx/compiler/SwingGenerator.java | 26 - .../src/main/java/jaxx/compiler/SymbolTable.java | 34 +- .../compiler/UnsupportedAttributeException.java | 63 + .../jaxx/compiler/UnsupportedTagException.java | 61 + .../java/jaxx/compiler/ValidatorGenerator.java | 89 - .../java/jaxx/compiler/beans/BeanInfoUtil.java | 56 + .../jaxx/compiler/beans/JAXXBeanDescriptor.java | 35 + .../java/jaxx/compiler/beans/JAXXBeanInfo.java | 55 + .../compiler/beans/JAXXEventSetDescriptor.java | 56 + .../jaxx/compiler/beans/JAXXFeatureDescriptor.java | 72 + .../java/jaxx/compiler/beans/JAXXIntrospector.java | 187 + .../compiler/beans/JAXXPropertyDescriptor.java | 107 + .../java/jaxx/compiler/binding/DataBinding.java | 129 + .../java/jaxx/compiler/binding/DataSource.java | 512 + .../java/jaxx/compiler/css/StylesheetHelper.java | 447 + .../java/jaxx/{css => compiler/css/parser}/CSS.jj | 0 .../java/jaxx/{css => compiler/css/parser}/CSS.jjt | 0 .../java/jaxx/compiler/css/parser/CSSParser.java | 819 ++ .../compiler/css/parser/CSSParserConstants.java | 92 + .../compiler/css/parser/CSSParserTokenManager.java | 1172 +++ .../css/parser/CSSParserTreeConstants.java | 60 + .../compiler/css/parser/JJTCSSParserState.java | 143 + .../main/java/jaxx/compiler/css/parser/Node.java | 71 + .../jaxx/compiler/css/parser/ParseException.java | 40 + .../jaxx/compiler/css/parser/SimpleCharStream.java | 418 + .../java/jaxx/compiler/css/parser/SimpleNode.java | 142 + .../main/java/jaxx/compiler/css/parser/Token.java | 96 + .../jaxx/compiler/css/parser/TokenMgrError.java | 146 + .../decorators/BoxedCompiledObjectDecorator.java | 58 + .../decorators/DefaultCompiledObjectDecorator.java | 178 + .../HelpRootCompiledObjectDecorator.java | 126 + .../jaxx/compiler/finalizers/DefaultFinalizer.java | 632 ++ .../jaxx/compiler/finalizers/SwingFinalizer.java | 53 + .../compiler/finalizers/ValidatorFinalizer.java | 117 + .../main/java/jaxx/compiler/java/JavaArgument.java | 76 + .../main/java/jaxx/compiler/java/JavaElement.java | 97 + .../main/java/jaxx/compiler/java/JavaField.java | 174 + .../src/main/java/jaxx/compiler/java/JavaFile.java | 201 + .../java/jaxx/compiler/java/JavaFileGenerator.java | 285 + .../main/java/jaxx/compiler/java/JavaMethod.java | 395 + .../compiler/java/parser/JJTJavaParserState.java | 143 + .../jaxx/{ => compiler/java}/parser/Java1.5.jj | 0 .../jaxx/{ => compiler/java}/parser/Java1.5.jjt | 0 .../jaxx/compiler/java/parser/JavaCharStream.java | 550 + .../java/jaxx/compiler/java/parser/JavaParser.java | 10068 +++++++++++++++++++ .../compiler/java/parser/JavaParserConstants.java | 280 + .../java/parser/JavaParserTokenManager.java | 2092 ++++ .../java/parser/JavaParserTreeConstants.java | 250 + .../main/java/jaxx/compiler/java/parser/Node.java | 71 + .../jaxx/compiler/java/parser/ParseException.java | 234 + .../java/jaxx/compiler/java/parser/SimpleNode.java | 155 + .../main/java/jaxx/compiler/java/parser/Token.java | 99 + .../jaxx/compiler/java/parser/TokenMgrError.java | 146 + .../jaxx/compiler/reflect/ClassDescriptor.java | 169 + .../compiler/reflect/ClassDescriptorLoader.java | 446 + .../jaxx/compiler/reflect/FieldDescriptor.java | 45 + .../java/jaxx/compiler/reflect/JavaFileParser.java | 237 + .../jaxx/compiler/reflect/MemberDescriptor.java | 57 + .../jaxx/compiler/reflect/MethodDescriptor.java | 70 + .../jaxx/compiler/script/ScriptInitializer.java | 39 + .../java/jaxx/compiler/script/ScriptManager.java | 332 + .../java/jaxx/compiler/spi/DefaultInitializer.java | 219 + .../main/java/jaxx/compiler/spi/Initializer.java | 37 + .../compiler/tags/DefaultComponentHandler.java | 372 + .../jaxx/compiler/tags/DefaultObjectHandler.java | 1219 +++ .../java/jaxx/compiler/tags/ScriptHandler.java | 101 + .../main/java/jaxx/compiler/tags/StyleHandler.java | 200 + .../main/java/jaxx/compiler/tags/TagHandler.java | 64 + .../main/java/jaxx/compiler/tags/TagManager.java | 493 + .../compiler/tags/swing/ApplicationHandler.java | 55 + .../java/jaxx/compiler/tags/swing/CellHandler.java | 166 + .../compiler/tags/swing/CompiledItemContainer.java | 66 + .../java/jaxx/compiler/tags/swing/ItemHandler.java | 163 + .../compiler/tags/swing/JAXXComboBoxHandler.java | 77 + .../jaxx/compiler/tags/swing/JAXXListHandler.java | 80 + .../jaxx/compiler/tags/swing/JAXXTabHandler.java | 31 + .../jaxx/compiler/tags/swing/JAXXTreeHandler.java | 85 + .../jaxx/compiler/tags/swing/JCheckBoxHandler.java | 42 + .../jaxx/compiler/tags/swing/JComboBoxHandler.java | 60 + .../compiler/tags/swing/JInternalFrameHandler.java | 70 + .../jaxx/compiler/tags/swing/JListHandler.java | 62 + .../jaxx/compiler/tags/swing/JMenuHandler.java | 42 + .../compiler/tags/swing/JPasswordFieldHandler.java | 41 + .../compiler/tags/swing/JPopupMenuHandler.java | 48 + .../compiler/tags/swing/JProgressBarHandler.java | 42 + .../compiler/tags/swing/JRadioButtonHandler.java | 96 + .../compiler/tags/swing/JScrollPaneHandler.java | 58 + .../jaxx/compiler/tags/swing/JSliderHandler.java | 64 + .../jaxx/compiler/tags/swing/JSpinnerHandler.java | 110 + .../compiler/tags/swing/JSplitPaneHandler.java | 87 + .../compiler/tags/swing/JTabbedPaneHandler.java | 151 + .../compiler/tags/swing/JTextComponentHandler.java | 86 + .../jaxx/compiler/tags/swing/JToolBarHandler.java | 55 + .../jaxx/compiler/tags/swing/JTreeHandler.java | 63 + .../jaxx/compiler/tags/swing/JWindowHandler.java | 78 + .../java/jaxx/compiler/tags/swing/RowHandler.java | 104 + .../java/jaxx/compiler/tags/swing/TabHandler.java | 185 + .../jaxx/compiler/tags/swing/TableHandler.java | 139 + .../tags/validator/BeanValidatorHandler.java | 731 ++ .../validator/ExcludeFieldValidatorHandler.java | 101 + .../tags/validator/FieldValidatorHandler.java | 94 + .../java/jaxx/compiler/tools/PrintTagInfo.java | 137 + .../tools/jaxxcapture/AbstractContextNode.java | 39 + .../compiler/tools/jaxxcapture/CapturedObject.java | 166 + .../compiler/tools/jaxxcapture/ContextNode.java | 28 + .../compiler/tools/jaxxcapture/JAXXCapture.java | 398 + .../compiler/tools/jaxxcapture/LiteralNode.java | 40 + .../compiler/tools/jaxxcapture/MethodNode.java | 39 + .../compiler/tools/jaxxcapture/PropertyNode.java | 39 + .../jaxx/compiler/tools/jaxxcapture/ValueNode.java | 34 + .../jaxxcapture/handlers/JTabbedPaneHandler.java | 46 + .../tools/jaxxcapture/handlers/ObjectHandler.java | 343 + .../tools/jaxxcapture/handlers/TableHandler.java | 34 + .../java/jaxx/compiler/types/ColorConverter.java | 58 + .../types/GridBagConstraintsConverter.java | 46 + .../java/jaxx/compiler/types/InsetsConverter.java | 59 + .../jaxx/compiler/types/KeyStrokeConverter.java | 44 + .../jaxx/compiler/types/PrimitiveConverter.java | 120 + .../java/jaxx/compiler/types/TypeConverter.java | 30 + .../main/java/jaxx/compiler/types/TypeManager.java | 70 + .../src/main/java/jaxx/css/CSSParser.java | 799 -- .../src/main/java/jaxx/css/CSSParserConstants.java | 72 - .../main/java/jaxx/css/CSSParserTokenManager.java | 1152 --- .../main/java/jaxx/css/CSSParserTreeConstants.java | 40 - .../src/main/java/jaxx/css/JJTCSSParserState.java | 123 - jaxx-compiler/src/main/java/jaxx/css/Node.java | 51 - .../src/main/java/jaxx/css/ParseException.java | 20 - .../src/main/java/jaxx/css/SimpleCharStream.java | 398 - .../src/main/java/jaxx/css/SimpleNode.java | 122 - .../src/main/java/jaxx/css/StylesheetHelper.java | 563 -- jaxx-compiler/src/main/java/jaxx/css/Token.java | 76 - .../src/main/java/jaxx/css/TokenMgrError.java | 126 - .../jaxx/introspection/JAXXBeanDescriptor.java | 14 - .../main/java/jaxx/introspection/JAXXBeanInfo.java | 36 - .../jaxx/introspection/JAXXEventSetDescriptor.java | 39 - .../jaxx/introspection/JAXXFeatureDescriptor.java | 55 - .../java/jaxx/introspection/JAXXIntrospector.java | 176 - .../jaxx/introspection/JAXXPropertyDescriptor.java | 96 - .../main/java/jaxx/parser/JJTJavaParserState.java | 123 - .../src/main/java/jaxx/parser/JavaCharStream.java | 530 - .../src/main/java/jaxx/parser/JavaParser.java | 10048 ------------------ .../main/java/jaxx/parser/JavaParserConstants.java | 260 - .../java/jaxx/parser/JavaParserTokenManager.java | 2072 ---- .../java/jaxx/parser/JavaParserTreeConstants.java | 230 - jaxx-compiler/src/main/java/jaxx/parser/Node.java | 51 - .../src/main/java/jaxx/parser/ParseException.java | 214 - .../src/main/java/jaxx/parser/SimpleNode.java | 135 - jaxx-compiler/src/main/java/jaxx/parser/Token.java | 79 - .../src/main/java/jaxx/parser/TokenMgrError.java | 126 - .../main/java/jaxx/reflect/ClassDescriptor.java | 166 - .../java/jaxx/reflect/ClassDescriptorLoader.java | 431 - .../main/java/jaxx/reflect/FieldDescriptor.java | 27 - .../src/main/java/jaxx/reflect/JavaFileParser.java | 230 - .../main/java/jaxx/reflect/MemberDescriptor.java | 40 - .../main/java/jaxx/reflect/MethodDescriptor.java | 54 - .../src/main/java/jaxx/spi/Initializer.java | 15 - .../java/jaxx/tags/DefaultComponentHandler.java | 322 - .../main/java/jaxx/tags/DefaultObjectHandler.java | 1184 --- .../src/main/java/jaxx/tags/ScriptHandler.java | 81 - .../src/main/java/jaxx/tags/StyleHandler.java | 180 - .../src/main/java/jaxx/tags/TagHandler.java | 46 - .../src/main/java/jaxx/tags/TagManager.java | 479 - .../java/jaxx/tags/swing/ApplicationHandler.java | 41 - .../src/main/java/jaxx/tags/swing/CellHandler.java | 154 - .../jaxx/tags/swing/CompiledItemContainer.java | 53 - .../java/jaxx/tags/swing/EnumEditorHandler.java | 56 - .../src/main/java/jaxx/tags/swing/ItemHandler.java | 144 - .../main/java/jaxx/tags/swing/JAXXTabHandler.java | 28 - .../java/jaxx/tags/swing/JCheckBoxHandler.java | 25 - .../java/jaxx/tags/swing/JComboBoxHandler.java | 62 - .../jaxx/tags/swing/JInternalFrameHandler.java | 54 - .../main/java/jaxx/tags/swing/JListHandler.java | 64 - .../main/java/jaxx/tags/swing/JMenuHandler.java | 26 - .../jaxx/tags/swing/JPasswordFieldHandler.java | 25 - .../java/jaxx/tags/swing/JPopupMenuHandler.java | 31 - .../java/jaxx/tags/swing/JProgressBarHandler.java | 26 - .../java/jaxx/tags/swing/JRadioButtonHandler.java | 81 - .../java/jaxx/tags/swing/JScrollPaneHandler.java | 41 - .../main/java/jaxx/tags/swing/JSliderHandler.java | 45 - .../main/java/jaxx/tags/swing/JSpinnerHandler.java | 92 - .../java/jaxx/tags/swing/JSplitPaneHandler.java | 69 - .../java/jaxx/tags/swing/JTabbedPaneHandler.java | 135 - .../jaxx/tags/swing/JTextComponentHandler.java | 70 - .../main/java/jaxx/tags/swing/JToolBarHandler.java | 38 - .../main/java/jaxx/tags/swing/JTreeHandler.java | 69 - .../main/java/jaxx/tags/swing/JWindowHandler.java | 61 - .../java/jaxx/tags/swing/LocaleEditorHandler.java | 56 - .../src/main/java/jaxx/tags/swing/RowHandler.java | 85 - .../src/main/java/jaxx/tags/swing/TabHandler.java | 175 - .../main/java/jaxx/tags/swing/TableHandler.java | 124 - .../jaxx/tags/validator/BeanValidatorHandler.java | 734 -- .../validator/ExcludeFieldValidatorHandler.java | 85 - .../jaxx/tags/validator/FieldValidatorHandler.java | 78 - .../jaxx/tags/validator/ValidatorInitializer.java | 22 - .../tools/jaxxcapture/AbstractContextNode.java | 17 - .../jaxx/tools/jaxxcapture/CapturedObject.java | 146 - .../java/jaxx/tools/jaxxcapture/ContextNode.java | 7 - .../java/jaxx/tools/jaxxcapture/JAXXCapture.java | 404 - .../java/jaxx/tools/jaxxcapture/LiteralNode.java | 20 - .../java/jaxx/tools/jaxxcapture/MethodNode.java | 19 - .../java/jaxx/tools/jaxxcapture/PropertyNode.java | 19 - .../java/jaxx/tools/jaxxcapture/ValueNode.java | 14 - .../jaxxcapture/handlers/JTabbedPaneHandler.java | 25 - .../tools/jaxxcapture/handlers/ObjectHandler.java | 323 - .../tools/jaxxcapture/handlers/TableHandler.java | 12 - .../src/main/java/jaxx/types/ColorConverter.java | 35 - .../jaxx/types/GridBagConstraintsConverter.java | 22 - .../src/main/java/jaxx/types/InsetsConverter.java | 37 - .../main/java/jaxx/types/KeyStrokeConverter.java | 22 - .../main/java/jaxx/types/PrimitiveConverter.java | 78 - .../src/main/java/jaxx/types/TypeConverter.java | 11 - .../src/main/java/jaxx/types/TypeManager.java | 45 - .../services/jaxx.compiler.CompiledObjectDecorator | 3 + .../META-INF/services/jaxx.compiler.Generator | 3 - .../services/jaxx.compiler.JAXXCompilerFinalizer | 3 + .../services/jaxx.compiler.spi.Initializer | 1 + .../services/jaxx.compiler.types.TypeConverter | 5 + .../META-INF/services/jaxx.spi.Initializer | 3 - jaxx-compiler/src/site/rst/JAXXContext.rst | 4 +- .../test/java/jaxx/beaninfos/BeanIntoUtilTest.java | 34 - .../java/jaxx/compiler/JavaFileParserTest.java | 77 + .../test/java/jaxx/compiler/JavaMethodTest.java | 72 + .../java/jaxx/compiler/beans/BeanIntoUtilTest.java | 54 + .../jaxx/compiler/reflect/ClassDescriptorTest.java | 79 + .../java/jaxx/compiler/tags/TagManagerTest.java | 158 + .../jaxx/compiler/types/ColorConverterTest.java | 71 + .../jaxx/compiler/types/InsetsConverterTest.java | 70 + .../compiler/types/PrimitiveConverterTest.java | 133 + .../test/java/jaxx/junit/ClassDescriptorTest.java | 63 - .../test/java/jaxx/junit/ColorConverterTest.java | 51 - .../test/java/jaxx/junit/InsetsConverterTest.java | 50 - .../test/java/jaxx/junit/JavaFileParserTest.java | 57 - .../src/test/java/jaxx/junit/JavaMethodTest.java | 52 - .../java/jaxx/junit/PrimitiveConverterTest.java | 113 - .../src/test/java/jaxx/junit/TagManagerTest.java | 143 - .../swing/navigation/NavigationTreeModelTest.java | 394 - jaxx-demo/pom.xml | 34 +- jaxx-demo/src/main/filters/jaxx-demo.properties | 3 + jaxx-demo/src/main/java/jaxx/demo/DemoConfig.java | 11 +- jaxx-demo/src/main/java/jaxx/demo/DemoPanel.jaxx | 205 +- .../src/main/java/jaxx/demo/DemoTreeHelper.java | 74 +- jaxx-demo/src/main/java/jaxx/demo/DemoUI.css | 33 +- jaxx-demo/src/main/java/jaxx/demo/DemoUI.jaxx | 190 +- .../src/main/java/jaxx/demo/DemoUIHandler.java | 91 +- jaxx-demo/src/main/java/jaxx/demo/RunDemo.java | 37 +- .../demo/component/jaxx/BoxedDecoratorDemo.jaxx | 201 +- .../component/jaxx/StatusMessagePanelDemo.jaxx | 42 +- .../component/jaxx/editor/ComboEditorDemo.jaxx | 90 +- .../demo/component/jaxx/editor/I18nEditorDemo.jaxx | 132 +- .../component/jaxx/editor/NumberEditorDemo.jaxx | 314 +- .../jaxx/editor/NumberEditorDemoModel.java | 98 +- .../jaxx/navigation/FullNavigationTreeDemo.jaxx | 86 + .../jaxx/navigation/FullNavigationTreeHelper.java | 165 + .../navigation/FullNavigationTreeModelBuilder.java | 143 + .../jaxx/demo/component/jaxx/navigation/Movie.java | 128 + .../demo/component/jaxx/navigation/People.java | 118 + .../jaxx/navigation/content/ActorContentUI.jaxx | 76 + .../jaxx/navigation/content/ActorsContentUI.jaxx | 68 + .../jaxx/navigation/content/ContentUI.jaxx | 49 + .../jaxx/navigation/content/ContentUIHandler.java | 48 + .../jaxx/navigation/content/MovieContentUI.jaxx | 76 + .../jaxx/navigation/content/MoviesContentUI.jaxx | 68 + .../jaxx/navigation/full/BaseContent.jaxx | 79 - .../navigation/full/FullNavigationTreeDemo.jaxx | 58 - .../navigation/full/FullNavigationTreeHelper.java | 230 - .../demo/component/jaxx/navigation/full/Movie.java | 127 - .../component/jaxx/navigation/full/People.java | 117 - .../item/ExempleItemTreeNavigationAdapter.java | 2 +- .../navigation/item/ItemTreeNavigationDemo.jaxx | 26 +- .../jaxx/demo/component/swing/JButtonDemo.jaxx | 78 +- .../jaxx/demo/component/swing/JCheckBoxDemo.jaxx | 96 +- .../component/swing/JCheckBoxMenuItemDemo.jaxx | 138 +- .../jaxx/demo/component/swing/JComboBoxDemo.jaxx | 87 +- .../jaxx/demo/component/swing/JDialogDemo.jaxx | 178 +- .../java/jaxx/demo/component/swing/JListDemo.jaxx | 138 +- .../jaxx/demo/component/swing/JMenuItemDemo.jaxx | 22 +- .../demo/component/swing/JPasswordFieldDemo.jaxx | 40 +- .../demo/component/swing/JProgressBarDemo.jaxx | 174 +- .../demo/component/swing/JRadioButtonDemo.jaxx | 42 +- .../component/swing/JRadioButtonMenuItemDemo.jaxx | 48 +- .../jaxx/demo/component/swing/JSliderDemo.jaxx | 44 +- .../jaxx/demo/component/swing/JSpinnerDemo.jaxx | 46 +- .../jaxx/demo/component/swing/JSplitPaneDemo.jaxx | 46 +- .../jaxx/demo/component/swing/JTextAreaDemo.jaxx | 86 +- .../jaxx/demo/component/swing/JTextFieldDemo.jaxx | 64 +- .../demo/component/swing/JToggleButtonDemo.jaxx | 38 +- .../feature/databinding/BaseBeanDataBinding.jaxx | 20 + .../feature/databinding/BeanDataBindingDemo.jaxx | 20 + .../jaxx/demo/feature/validation/Identity.java | 2 +- .../java/jaxx/demo/feature/validation/Model.java | 2 +- .../feature/validation/ValidationListDemo.jaxx | 46 +- .../feature/validation/ValidationTableDemo.jaxx | 39 +- .../main/java/jaxx/demo/fun/CalculatorDemo.jaxx | 22 +- .../main/java/jaxx/demo/fun/CalculatorEngine.java | 2 +- .../src/main/java/jaxx/demo/fun/CounterDemo.jaxx | 44 +- .../main/java/jaxx/demo/fun/LabelStyleDemo.jaxx | 22 +- .../main/resources/i18n/jaxx-demo-en_GB.properties | 37 +- .../main/resources/i18n/jaxx-demo-fr_FR.properties | 37 +- jaxx-demo/src/main/resources/log4j.properties | 5 +- .../java/jaxx/demo/BeanValidatorDetectorTest.java | 20 + jaxx-example/changelog.txt | 18 - jaxx-example/pom.xml | 256 - .../main/java/jaxx/demo/BaseBeanDataBinding.jaxx | 21 - .../main/java/jaxx/demo/BeanDataBindingDemo.jaxx | 47 - .../main/java/jaxx/demo/BoxedDecoratorDemo.jaxx | 91 - .../src/main/java/jaxx/demo/Calculator.css | 68 - .../src/main/java/jaxx/demo/CalculatorDemo.jaxx | 89 - .../src/main/java/jaxx/demo/CalculatorEngine.java | 177 - .../src/main/java/jaxx/demo/ComboEditorDemo.jaxx | 35 - .../src/main/java/jaxx/demo/CounterDemo.jaxx | 12 - .../src/main/java/jaxx/demo/DemoPanel.jaxx | 45 - .../src/main/java/jaxx/demo/EmptyDemo.jaxx | 5 - .../demo/ExempleItemTreeNavigationAdapter.java | 60 - .../src/main/java/jaxx/demo/I18nEditorDemo.jaxx | 46 - jaxx-example/src/main/java/jaxx/demo/Identity.java | 103 - .../java/jaxx/demo/ItemTreeNavigationDemo.jaxx | 41 - jaxx-example/src/main/java/jaxx/demo/JAXXDemo.jaxx | 134 - .../src/main/java/jaxx/demo/JButtonDemo.jaxx | 29 - .../src/main/java/jaxx/demo/JCheckBoxDemo.jaxx | 38 - .../main/java/jaxx/demo/JCheckBoxMenuItemDemo.jaxx | 59 - .../src/main/java/jaxx/demo/JComboBoxDemo.jaxx | 22 - .../src/main/java/jaxx/demo/JDialogDemo.jaxx | 79 - .../src/main/java/jaxx/demo/JListDemo.jaxx | 59 - .../src/main/java/jaxx/demo/JMenuItemDemo.jaxx | 23 - .../main/java/jaxx/demo/JPasswordFieldDemo.jaxx | 10 - .../src/main/java/jaxx/demo/JProgressBarDemo.jaxx | 77 - .../src/main/java/jaxx/demo/JRadioButtonDemo.jaxx | 11 - .../java/jaxx/demo/JRadioButtonMenuItemDemo.jaxx | 14 - .../src/main/java/jaxx/demo/JSliderDemo.jaxx | 12 - .../src/main/java/jaxx/demo/JSpinnerDemo.jaxx | 13 - .../src/main/java/jaxx/demo/JSplitPaneDemo.jaxx | 13 - .../src/main/java/jaxx/demo/JTextAreaDemo.jaxx | 33 - .../src/main/java/jaxx/demo/JTextFieldDemo.jaxx | 22 - .../src/main/java/jaxx/demo/JToggleButtonDemo.jaxx | 9 - .../src/main/java/jaxx/demo/LabelStyle.css | 43 - .../src/main/java/jaxx/demo/LabelStyleDemo.jaxx | 85 - jaxx-example/src/main/java/jaxx/demo/Model.java | 66 - .../src/main/java/jaxx/demo/NumberEditorDemo.jaxx | 132 - .../main/java/jaxx/demo/NumberEditorDemoModel.java | 78 - .../java/jaxx/demo/StatusMessagePanelDemo.jaxx | 11 - .../src/main/java/jaxx/demo/Validation.css | 5 - .../main/java/jaxx/demo/ValidationListDemo.jaxx | 325 - .../main/java/jaxx/demo/ValidationTableDemo.jaxx | 331 - jaxx-example/src/main/jnlp/jxlayer.jnlp | 12 - jaxx-example/src/main/jnlp/sun.jnlp | 12 - .../resources/i18n/jaxx-example-en_GB.properties | 142 - .../resources/i18n/jaxx-example-fr_FR.properties | 134 - .../src/main/resources/icons/action-accept.png | Bin 781 -> 0 bytes .../src/main/resources/icons/action-block.png | Bin 576 -> 0 bytes .../jaxx/demo/Identity-error-validation.xml | 49 - .../jaxx/demo/Identity-info-validation.xml | 49 - .../jaxx/demo/Identity-warning-validation.xml | 49 - .../resources/jaxx/demo/Model-error-validation.xml | 35 - .../resources/jaxx/demo/Model-info-validation.xml | 13 - .../jaxx/demo/Model-warning-validation.xml | 18 - .../main/resources/jaxx/demo/images/Amethyst.jpg | Bin 24619 -> 0 bytes .../src/main/resources/jaxx/demo/images/Lynx.jpg | Bin 40463 -> 0 bytes .../src/main/resources/jaxx/demo/images/Tomato.jpg | Bin 22862 -> 0 bytes .../resources/jaxx/demo/images/pencil_black.gif | Bin 190 -> 0 bytes jaxx-example/src/main/resources/log4j.properties | 10 - jaxx-example/src/site/site.xml | 27 - .../java/jaxx/demo/BeanValidatorDetectorTest.java | 34 - jaxx-runtime-api/pom.xml | 138 - .../src/main/java/jaxx/Base64Coder.java | 240 - jaxx-runtime-api/src/main/java/jaxx/css/Rule.java | 54 - .../src/main/java/jaxx/css/Selector.java | 99 - .../src/main/java/jaxx/css/Stylesheet.java | 45 - .../main/java/jaxx/runtime/BeanValidatorUtil.java | 176 - .../java/jaxx/runtime/ComponentDescriptor.java | 49 - .../java/jaxx/runtime/DataBindingListener.java | 46 - .../jaxx/runtime/DataBindingUpdateListener.java | 46 - .../src/main/java/jaxx/runtime/DataContext.java | 400 - .../src/main/java/jaxx/runtime/Decorator.java | 36 - .../src/main/java/jaxx/runtime/DecoratorUtils.java | 111 - .../jaxx/runtime/DefaultApplicationContext.java | 281 - .../main/java/jaxx/runtime/DefaultJAXXContext.java | 214 - .../src/main/java/jaxx/runtime/JAXXAction.java | 19 - .../src/main/java/jaxx/runtime/JAXXContext.java | 99 - .../java/jaxx/runtime/JAXXContextEntryDef.java | 119 - .../main/java/jaxx/runtime/JAXXInitialContext.java | 105 - .../src/main/java/jaxx/runtime/JAXXObject.java | 52 - .../java/jaxx/runtime/JAXXObjectDescriptor.java | 42 - .../src/main/java/jaxx/runtime/JAXXValidator.java | 25 - .../main/java/jaxx/runtime/JXPathDecorator.java | 278 - .../java/jaxx/runtime/MultiJXPathDecorator.java | 129 - .../main/java/jaxx/runtime/PropertyDecorator.java | 94 - .../src/main/java/jaxx/runtime/Util.java | 465 - .../main/java/jaxx/runtime/css/DataBinding.java | 31 - .../main/java/jaxx/runtime/css/Pseudoclasses.java | 176 - .../java/jaxx/runtime/validator/BeanValidator.java | 490 - .../runtime/validator/BeanValidatorDetector.java | 208 - .../jaxx/runtime/validator/BeanValidatorEvent.java | 52 - .../jaxx/runtime/validator/BeanValidatorField.java | 239 - .../runtime/validator/BeanValidatorListener.java | 17 - .../runtime/validator/BeanValidatorMessage.java | 72 - .../jaxx/runtime/validator/BeanValidatorScope.java | 46 - .../jaxx/runtime/validator/XWorkBeanValidator.java | 252 - .../field/CollectionFieldExpressionValidator.java | 448 - .../field/CollectionUniqueKeyValidator.java | 208 - .../field/ExistingDirectoryFieldValidator.java | 72 - .../field/ExistingFileFieldValidator.java | 72 - .../field/FieldExpressionWithParamsValidator.java | 175 - .../field/NotExistingDirectoryFieldValidator.java | 72 - .../field/NotExistingFileFieldValidator.java | 73 - .../field/RequiredFileFieldValidator.java | 72 - .../i18n/jaxx-runtime-api-en_GB.properties | 3 - .../i18n/jaxx-runtime-api-fr_FR.properties | 3 - .../runtime/DefaultApplicationContextTest.java | 117 - .../java/jaxx/runtime/DefaultJAXXContextTest.java | 299 - .../java/jaxx/runtime/JXPathDecoratorTest.java | 163 - .../jaxx/runtime/MultiJXPathDecoratorTest.java | 184 - .../src/test/java/jaxx/runtime/UtilTest.java | 29 - .../AbstractBeanValidatorDetectorTest.java | 108 - .../validator/BeanValidatorDetectorTest.java | 101 - .../jaxx/runtime/validator/BeanValidatorTest.java | 198 - .../java/jaxx/runtime/validator/SimpleBean.java | 51 - .../runtime/validator/XWorkBeanValidatorTest.java | 156 - .../field/AbstractFieldValidatorTest.java | 97 - .../AbstractValidatorBeanFieldValidatorTest.java | 14 - .../CollectionFieldExpressionValidatorTest.java | 234 - .../field/CollectionUniqueKeyValidatorTest.java | 86 - .../field/ExistingDirectoryFieldValidatorTest.java | 30 - .../field/ExistingFileFieldValidatorTest.java | 30 - .../validator/field/FieldExpressionBean.java | 103 - .../FieldExpressionWithParamsValidatorTest.java | 116 - .../NotExistingDirectoryFieldValidatorTest.java | 33 - .../field/NotExistingFileFieldValidatorTest.java | 37 - .../field/RequiredFileFieldValidatorTest.java | 29 - .../runtime/validator/field/ValidatorBean.java | 149 - .../src/test/resources/log4j.properties | 8 - jaxx-runtime-swing-widget/LICENSE.txt | 166 - jaxx-runtime-swing-widget/README.txt | 2 - jaxx-runtime-swing-widget/pom.xml | 123 - .../main/java/jaxx/runtime/swing/AboutPanel.jaxx | 224 - .../java/jaxx/runtime/swing/EntityComboBox.jaxx | 131 - .../jaxx/runtime/swing/EntityComboBoxHandler.java | 470 - .../runtime/swing/StatusMessagePanelHandler.java | 75 - .../jaxx/runtime/swing/editor/ColumnSelector.jaxx | 152 - .../java/jaxx/runtime/swing/editor/I18nEditor.jaxx | 211 - .../runtime/swing/editor/NumberEditorHandler.java | 468 - .../runtime/swing/editor/TimeEditorHandler.java | 222 - .../swing/editor/config/ConfigCategoryUI.jaxx | 120 - .../swing/editor/config/ConfigTableEditor.java | 125 - .../swing/editor/config/ConfigTableRenderer.java | 112 - .../swing/editor/config/ConfigUIBuilder.java | 246 - .../swing/editor/config/model/CategoryModel.java | 175 - .../editor/config/model/ConfigTableModel.java | 134 - .../swing/editor/config/model/ConfigUIModel.java | 224 - .../swing/editor/config/model/OptionModel.java | 112 - .../jaxx-runtime-swing-widget-en_GB.properties | 71 - .../jaxx-runtime-swing-widget-fr_FR.properties | 72 - .../src/site/rst/images/Components-screenshot.gif | Bin 46663 -> 0 bytes .../src/site/rst/images/webstart.gif | Bin 1806 -> 0 bytes jaxx-runtime-swing-widget/src/site/rst/index.rst | 40 - jaxx-runtime-swing/LICENSE.txt | 166 - jaxx-runtime-swing/README.txt | 2 - jaxx-runtime-swing/changelog.txt | 114 - jaxx-runtime-swing/pom.xml | 53 - .../src/main/java/jaxx/beaninfos/HBoxBeanInfo.java | 58 - .../src/main/java/jaxx/beaninfos/VBoxBeanInfo.java | 58 - .../src/main/java/jaxx/runtime/JaxxHelpUI.java | 23 - .../src/main/java/jaxx/runtime/SwingUtil.java | 795 -- .../main/java/jaxx/runtime/SwingValidatorUtil.java | 200 - .../main/java/jaxx/runtime/swing/Application.java | 56 - .../java/jaxx/runtime/swing/BlockingLayerUI.java | 259 - .../java/jaxx/runtime/swing/BlockingLayerUI2.java | 217 - .../jaxx/runtime/swing/BooleanCellRenderer.java | 61 - .../main/java/jaxx/runtime/swing/CardLayout2.java | 221 - .../java/jaxx/runtime/swing/CardLayout2Ext.java | 99 - .../runtime/swing/DecoratorTableCellRenderer.java | 33 - .../swing/EmptyNumberTableCellRenderer.java | 37 - .../jaxx/runtime/swing/EnumTableCellRenderer.java | 47 - .../src/main/java/jaxx/runtime/swing/GBC.java | 151 - .../src/main/java/jaxx/runtime/swing/HBox.java | 94 - .../main/java/jaxx/runtime/swing/HBoxLayout.java | 127 - .../jaxx/runtime/swing/I18nTableCellRenderer.java | 66 - .../src/main/java/jaxx/runtime/swing/Item.java | 223 - .../java/jaxx/runtime/swing/JAXXButtonGroup.java | 222 - .../main/java/jaxx/runtime/swing/JAXXComboBox.java | 292 - .../src/main/java/jaxx/runtime/swing/JAXXList.java | 396 - .../src/main/java/jaxx/runtime/swing/JAXXTab.java | 25 - .../java/jaxx/runtime/swing/JAXXToggleButton.java | 92 - .../src/main/java/jaxx/runtime/swing/JAXXTree.java | 259 - .../java/jaxx/runtime/swing/JaxxHelpBroker.java | 500 - .../jaxx/runtime/swing/LocaleListCellRenderer.java | 114 - .../jaxx/runtime/swing/MyDefaultCellEditor.java | 104 - .../runtime/swing/OneClicListSelectionModel.java | 181 - .../src/main/java/jaxx/runtime/swing/Spacer.java | 12 - .../src/main/java/jaxx/runtime/swing/TabInfo.java | 165 - .../swing/TabInfoPropertyChangeListener.java | 44 - .../src/main/java/jaxx/runtime/swing/Table.java | 58 - .../src/main/java/jaxx/runtime/swing/VBox.java | 94 - .../main/java/jaxx/runtime/swing/VBoxLayout.java | 127 - .../jaxx/runtime/swing/editor/ClassCellEditor.java | 119 - .../java/jaxx/runtime/swing/editor/EnumEditor.java | 57 - .../jaxx/runtime/swing/editor/LocaleEditor.java | 64 - .../swing/navigation/ItemNavigationCardPanel.java | 66 - .../swing/navigation/ItemNavigationPanel.java | 28 - .../navigation/ItemTreeNavigationAdapter.java | 64 - .../navigation/NavigationTreeCellRenderer.java | 137 - .../navigation/NavigationTreeContextHelper.java | 133 - .../swing/navigation/NavigationTreeHandler.java | 307 - .../NavigationTreeHandlerWithCardLayout.java | 129 - .../swing/navigation/NavigationTreeHelper.java | 123 - .../swing/navigation/NavigationTreeModel.java | 589 -- .../navigation/NavigationTreeModelBuilder.java | 210 - .../navigation/NavigationTreeSelectionAdapter.java | 248 - ...vigationTreeSelectionAdapterWithCardLayout.java | 110 - .../runtime/swing/navigation/NavigationUtil.java | 264 - .../jaxx/runtime/swing/wizard/WizardModel.java | 244 - .../swing/wizard/WizardOperationAction.java | 108 - .../swing/wizard/WizardOperationActionThread.java | 204 - .../runtime/swing/wizard/WizardOperationModel.java | 269 - .../runtime/swing/wizard/WizardOperationState.java | 32 - .../runtime/swing/wizard/WizardOperationStep.java | 34 - .../java/jaxx/runtime/swing/wizard/WizardStep.java | 20 - .../jaxx/runtime/swing/wizard/WizardStepUI.java | 14 - .../java/jaxx/runtime/swing/wizard/WizardUI.java | 94 - .../jaxx/runtime/swing/wizard/WizardUILancher.java | 162 - .../java/jaxx/runtime/swing/wizard/WizardUtil.java | 157 - .../runtime/validator/swing/SwingValidator.java | 279 - .../validator/swing/SwingValidatorMessage.java | 66 - .../swing/SwingValidatorMessageListModel.java | 142 - .../SwingValidatorMessageListMouseListener.java | 60 - .../swing/SwingValidatorMessageListRenderer.java | 90 - .../swing/SwingValidatorMessageTableModel.java | 327 - .../SwingValidatorMessageTableMouseListener.java | 94 - .../swing/SwingValidatorMessageTableRenderer.java | 84 - .../swing/ui/AbstractBeanValidatorUI.java | 37 - .../validator/swing/ui/IconValidationUI.java | 86 - .../validator/swing/ui/ImageValidationUI.java | 78 - .../swing/ui/TranslucentValidationUI.java | 65 - .../i18n/jaxx-runtime-swing-en_GB.properties | 9 - .../i18n/jaxx-runtime-swing-fr_FR.properties | 9 - jaxx-runtime-swing/src/site/site.xml | 25 - {jaxx-example => jaxx-runtime}/LICENSE.txt | 0 {jaxx-example => jaxx-runtime}/README.txt | 0 {jaxx-runtime-api => jaxx-runtime}/changelog.txt | 0 jaxx-runtime/pom.xml | 146 + .../src/main/java/jaxx/runtime/Base64Coder.java | 260 + .../java/jaxx/runtime/ComponentDescriptor.java | 65 + .../java/jaxx/runtime/DataBindingListener.java | 63 + .../jaxx/runtime/DataBindingUpdateListener.java | 63 + .../src/main/java/jaxx/runtime/JAXXAction.java | 41 + .../src/main/java/jaxx/runtime/JAXXContext.java | 128 + .../src/main/java/jaxx/runtime/JAXXObject.java | 136 + .../java/jaxx/runtime/JAXXObjectDescriptor.java | 58 + .../src/main/java/jaxx/runtime/JAXXValidator.java | 45 + .../src/main/java/jaxx/runtime/SwingUtil.java | 802 ++ jaxx-runtime/src/main/java/jaxx/runtime/Util.java | 508 + .../java/jaxx/runtime/context/DataContext.java | 422 + .../runtime/context/DefaultApplicationContext.java | 304 + .../jaxx/runtime/context/DefaultJAXXContext.java | 246 + .../jaxx/runtime/context/JAXXContextEntryDef.java | 144 + .../jaxx/runtime/context/JAXXInitialContext.java | 127 + .../main/java/jaxx/runtime/css/DataBinding.java | 48 + .../main/java/jaxx/runtime/css/Pseudoclasses.java | 199 + .../src/main/java/jaxx/runtime/css/Rule.java | 68 + .../src/main/java/jaxx/runtime/css/Selector.java | 108 + .../src/main/java/jaxx/runtime/css/Stylesheet.java | 61 + .../java/jaxx/runtime/decorator/Decorator.java | 54 + .../jaxx/runtime/decorator/DecoratorProvider.java | 226 + .../jaxx/runtime/decorator/DecoratorUtils.java | 203 + .../jaxx/runtime/decorator/JXPathDecorator.java | 221 + .../runtime/decorator/MultiJXPathDecorator.java | 100 + .../jaxx/runtime/decorator/PropertyDecorator.java | 96 + .../main/java/jaxx/runtime/swing/Application.java | 71 + .../java/jaxx/runtime/swing/BlockingLayerUI.java | 279 + .../java/jaxx/runtime/swing/BlockingLayerUI2.java | 237 + .../main/java/jaxx/runtime/swing/CardLayout2.java | 241 + .../java/jaxx/runtime/swing/CardLayout2Ext.java | 119 + .../src/main/java/jaxx/runtime/swing/GBC.java | 153 + .../src/main/java/jaxx/runtime/swing/HBox.java | 110 + .../main/java/jaxx/runtime/swing/HBoxBeanInfo.java | 72 + .../main/java/jaxx/runtime/swing/HBoxLayout.java | 143 + .../src/main/java/jaxx/runtime/swing/Item.java | 239 + .../java/jaxx/runtime/swing/JAXXButtonGroup.java | 238 + .../main/java/jaxx/runtime/swing/JAXXComboBox.java | 324 + .../src/main/java/jaxx/runtime/swing/JAXXList.java | 412 + .../src/main/java/jaxx/runtime/swing/JAXXTab.java | 27 + .../java/jaxx/runtime/swing/JAXXToggleButton.java | 112 + .../src/main/java/jaxx/runtime/swing/JAXXTree.java | 275 + .../runtime/swing/OneClicListSelectionModel.java | 201 + .../src/main/java/jaxx/runtime/swing/Spacer.java | 28 + .../src/main/java/jaxx/runtime/swing/TabInfo.java | 181 + .../swing/TabInfoPropertyChangeListener.java | 60 + .../src/main/java/jaxx/runtime/swing/Table.java | 74 + .../src/main/java/jaxx/runtime/swing/VBox.java | 110 + .../main/java/jaxx/runtime/swing/VBoxBeanInfo.java | 72 + .../main/java/jaxx/runtime/swing/VBoxLayout.java | 143 + .../jaxx/runtime/swing/editor/ClassCellEditor.java | 121 + .../java/jaxx/runtime/swing/editor/EnumEditor.java | 59 + .../jaxx/runtime/swing/editor/LocaleEditor.java | 66 + .../runtime/swing/editor/MyDefaultCellEditor.java | 122 + .../jaxx/runtime/swing/help/JAXXHelpBroker.java | 584 ++ .../java/jaxx/runtime/swing/help/JAXXHelpUI.java | 42 + .../jaxx/runtime/swing/help/JAXXHelpUIHandler.java | 32 + .../swing/navigation/ItemNavigationCardPanel.java | 82 + .../swing/navigation/ItemNavigationPanel.java | 44 + .../navigation/ItemTreeNavigationAdapter.java | 89 + .../swing/navigation/NavigationContentUI.java | 49 + .../navigation/NavigationTreeContextHelper.java | 195 + .../swing/navigation/NavigationTreeHandler.java | 303 + .../NavigationTreeHandlerWithCardLayout.java | 120 + .../swing/navigation/NavigationTreeHelper.java | 258 + .../swing/navigation/NavigationTreeModel.java | 270 + .../navigation/NavigationTreeModelBuilder.java | 262 + .../swing/navigation/NavigationTreeNode.java | 444 + .../navigation/NavigationTreeNodeRenderer.java | 64 + .../NavigationTreeNodeRendererDecoratorImpl.java | 73 + .../NavigationTreeNodeRendererI18nImpl.java | 68 + .../jaxx/runtime/swing/navigation/package.html | 12 + .../swing/renderer/BooleanCellRenderer.java | 81 + .../swing/renderer/DecoratorListCellRenderer.java | 67 + .../DecoratorProviderListCellRenderer.java | 53 + .../DecoratorProviderTableCellRenderer.java | 56 + .../swing/renderer/DecoratorTableCellRenderer.java | 63 + .../renderer/EmptyNumberTableCellRenderer.java | 57 + .../swing/renderer/EnumTableCellRenderer.java | 67 + .../swing/renderer/I18nTableCellRenderer.java | 86 + .../swing/renderer/LocaleListCellRenderer.java | 146 + .../renderer/MultiDecoratorListCellRenderer.java | 84 + .../renderer/MultiDecoratorTableCelleRenderer.java | 85 + .../jaxx/runtime/swing/wizard/WizardModel.java | 264 + .../swing/wizard/WizardOperationAction.java | 128 + .../swing/wizard/WizardOperationActionThread.java | 224 + .../runtime/swing/wizard/WizardOperationModel.java | 289 + .../runtime/swing/wizard/WizardOperationState.java | 52 + .../runtime/swing/wizard/WizardOperationStep.java | 54 + .../java/jaxx/runtime/swing/wizard/WizardStep.java | 40 + .../jaxx/runtime/swing/wizard/WizardStepUI.java | 34 + .../java/jaxx/runtime/swing/wizard/WizardUI.java | 114 + .../jaxx/runtime/swing/wizard/WizardUILancher.java | 182 + .../java/jaxx/runtime/swing/wizard/WizardUtil.java | 177 + .../java/jaxx/runtime/swing/wizard/package.html | 0 .../java/jaxx/runtime/validator/BeanValidator.java | 509 + .../runtime/validator/BeanValidatorDetector.java | 228 + .../jaxx/runtime/validator/BeanValidatorEvent.java | 72 + .../jaxx/runtime/validator/BeanValidatorField.java | 259 + .../runtime/validator/BeanValidatorListener.java | 37 + .../runtime/validator/BeanValidatorMessage.java | 92 + .../jaxx/runtime/validator/BeanValidatorScope.java | 66 + .../jaxx/runtime/validator/BeanValidatorUtil.java | 196 + .../jaxx/runtime/validator/XWorkBeanValidator.java | 271 + .../field/CollectionFieldExpressionValidator.java | 468 + .../field/CollectionUniqueKeyValidator.java | 228 + .../field/ExistingDirectoryFieldValidator.java | 93 + .../field/ExistingFileFieldValidator.java | 93 + .../field/FieldExpressionWithParamsValidator.java | 195 + .../field/NotExistingDirectoryFieldValidator.java | 92 + .../field/NotExistingFileFieldValidator.java | 93 + .../field/RequiredFileFieldValidator.java | 93 + .../runtime/validator/swing/SwingValidator.java | 299 + .../validator/swing/SwingValidatorMessage.java | 86 + .../swing/SwingValidatorMessageListModel.java | 162 + .../SwingValidatorMessageListMouseListener.java | 80 + .../swing/SwingValidatorMessageListRenderer.java | 109 + .../swing/SwingValidatorMessageTableModel.java | 347 + .../SwingValidatorMessageTableMouseListener.java | 114 + .../swing/SwingValidatorMessageTableRenderer.java | 103 + .../validator/swing/SwingValidatorUtil.java | 216 + .../swing/ui/AbstractBeanValidatorUI.java | 57 + .../validator/swing/ui/IconValidationUI.java | 106 + .../validator/swing/ui/ImageValidationUI.java | 98 + .../swing/ui/TranslucentValidationUI.java | 85 + .../resources/i18n/jaxx-runtime-en_GB.properties | 12 + .../resources/i18n/jaxx-runtime-fr_FR.properties | 12 + .../src/main/resources/icons/action-delete.png | Bin .../resources/icons/action-wizard-config-16.png | Bin .../main/resources/icons/action-wizard-config.png | Bin .../resources/icons/action-wizard-message-16.png | Bin .../main/resources/icons/action-wizard-message.png | Bin .../main/resources/icons/action-wizard-next-16.png | Bin .../main/resources/icons/action-wizard-next.png | Bin .../resources/icons/action-wizard-pause-16.png | Bin .../main/resources/icons/action-wizard-pause.png | Bin .../resources/icons/action-wizard-previous-16.png | Bin .../resources/icons/action-wizard-previous.png | Bin .../resources/icons/action-wizard-refresh-16.png | Bin .../main/resources/icons/action-wizard-refresh.png | Bin .../resources/icons/action-wizard-start-16.png | Bin .../main/resources/icons/action-wizard-start.png | Bin .../icons/action-wizard-state-canceled-16.png | Bin .../icons/action-wizard-state-canceled.png | Bin .../icons/action-wizard-state-failed-16.png | Bin .../resources/icons/action-wizard-state-failed.png | Bin .../icons/action-wizard-state-need_fix-16.png | Bin .../icons/action-wizard-state-need_fix.png | Bin .../icons/action-wizard-state-pending-16.png | Bin .../icons/action-wizard-state-pending.png | Bin .../icons/action-wizard-state-running-16.png | Bin .../icons/action-wizard-state-running.png | Bin .../icons/action-wizard-state-successed-16.png | Bin .../icons/action-wizard-state-successed.png | Bin .../src/main/resources/icons/error.png | Bin .../src/main/resources/icons/info.png | Bin .../src/main/resources/icons/warning.png | Bin .../src/main/resources/validators.xml | 0 .../src/site/site.xml | 0 .../src/test/java/jaxx/runtime/UtilTest.java | 49 + .../context/DefaultApplicationContextTest.java | 133 + .../runtime/context/DefaultJAXXContextTest.java | 358 + .../src/test/java/jaxx/runtime/decorator/Data.java | 57 + .../runtime/decorator/DecoratorProviderTest.java | 153 + .../runtime/decorator/JXPathDecoratorTest.java | 156 + .../decorator/MultiJXPathDecoratorTest.java | 205 + .../swing/navigation/NavigationTreeModelTest.java | 397 + .../AbstractBeanValidatorDetectorTest.java | 128 + .../validator/BeanValidatorDetectorTest.java | 121 + .../jaxx/runtime/validator/BeanValidatorTest.java | 218 + .../java/jaxx/runtime/validator/SimpleBean.java | 71 + .../runtime/validator/XWorkBeanValidatorTest.java | 176 + .../field/AbstractFieldValidatorTest.java | 117 + .../AbstractValidatorBeanFieldValidatorTest.java | 34 + .../CollectionFieldExpressionValidatorTest.java | 254 + .../field/CollectionUniqueKeyValidatorTest.java | 106 + .../field/ExistingDirectoryFieldValidatorTest.java | 50 + .../field/ExistingFileFieldValidatorTest.java | 50 + .../validator/field/FieldExpressionBean.java | 123 + .../FieldExpressionWithParamsValidatorTest.java | 136 + .../NotExistingDirectoryFieldValidatorTest.java | 53 + .../field/NotExistingFileFieldValidatorTest.java | 57 + .../field/RequiredFileFieldValidatorTest.java | 49 + .../runtime/validator/field/ValidatorBean.java | 169 + .../validator/SimpleBean-error-validation.xml | 0 .../validator/SimpleBean-info-validation.xml | 0 .../validator/SimpleBean-simple-validation.xml | 0 .../validator/SimpleBean-warning-validation.xml | 0 .../field/FieldExpressionBean-error-validation.xml | 0 .../field/ValidatorBean-error-validation.xml | 0 jaxx-runtime/src/test/resources/log4j.properties | 8 + .../src/test/resources/validators.xml | 0 jaxx-swing-action/pom.xml | 8 +- .../AbstractActionConfigurationResolver.java | 20 + .../jaxx/action/ActionAnnotationProcessing.java | 20 + .../java/org/nuiton/jaxx/action/ActionConfig.java | 20 + .../action/ActionConfigConfigurationResolver.java | 20 + .../jaxx/action/ActionConfigurationResolver.java | 20 + .../java/org/nuiton/jaxx/action/ActionFactory.java | 20 + .../jaxx/action/ActionFactoryFromProvider.java | 20 + .../org/nuiton/jaxx/action/ActionNameProvider.java | 20 + .../org/nuiton/jaxx/action/ActionProvider.java | 20 + .../jaxx/action/ActionProviderAnnotation.java | 20 + .../jaxx/action/ActionProviderFromProperties.java | 20 + .../org/nuiton/jaxx/action/MyAbstractAction.java | 20 + .../org/nuiton/jaxx/action/SelectActionConfig.java | 20 + .../SelectActionConfigConfigurationResolver.java | 20 + .../org/nuiton/jaxx/action/ToggleActionConfig.java | 20 + .../ToggleActionConfigConfigurationResolver.java | 20 + .../java/org/nuiton/jaxx/tab/TabContentConfig.java | 20 + .../main/java/org/nuiton/jaxx/tab/TabFactory.java | 20 + .../main/java/org/nuiton/jaxx/tab/TabModel.java | 20 + .../org/nuiton/jaxx/util/AbstractUIAction.java | 20 + .../main/java/org/nuiton/jaxx/util/DialogUI.java | 20 + .../java/org/nuiton/jaxx/util/DialogUIDef.java | 20 + .../java/org/nuiton/jaxx/util/DialogUIHandler.java | 20 + .../java/org/nuiton/jaxx/util/DialogUIModel.java | 20 + .../nuiton/jaxx/util/FactoryWindowListener.java | 20 + .../java/org/nuiton/jaxx/util/FormElement.java | 20 + .../java/org/nuiton/jaxx/util/ShowUIAction.java | 20 + .../main/java/org/nuiton/jaxx/util/UIFactory.java | 20 + .../main/java/org/nuiton/jaxx/util/UIHelper.java | 20 + .../main/java/org/nuiton/jaxx/util/UIProvider.java | 20 + .../org/nuiton/jaxx/util/config/CancelAction.java | 20 + .../nuiton/jaxx/util/config/DialogConfigUI.java | 20 + .../jaxx/util/config/DialogConfigUIHandler.java | 20 + .../jaxx/util/config/DialogConfigUIModel.java | 20 + .../org/nuiton/jaxx/util/config/ResetAction.java | 20 + .../org/nuiton/jaxx/util/config/SaveAction.java | 20 + {jaxx-runtime-api => jaxx-widgets}/LICENSE.txt | 0 {jaxx-runtime-api => jaxx-widgets}/README.txt | 0 .../changelog.txt | 0 jaxx-widgets/pom.xml | 120 + .../main/java/jaxx/runtime/swing/AboutPanel.jaxx | 223 + .../main/java/jaxx/runtime/swing/ClockWidget.jaxx | 0 .../java/jaxx/runtime/swing/EntityComboBox.jaxx | 133 + .../jaxx/runtime/swing/EntityComboBoxHandler.java | 473 + .../java/jaxx/runtime/swing/ErrorDialogUI.jaxx | 0 .../main/java/jaxx/runtime/swing/HidorButton.jaxx | 55 + .../java/jaxx/runtime/swing/ListSelectorUI.jaxx | 190 + .../jaxx/runtime/swing/MemoryStatusWidget.jaxx | 0 .../jaxx/runtime/swing/StatusMessagePanel.jaxx | 0 .../runtime/swing/StatusMessagePanelHandler.java | 77 + .../jaxx/runtime/swing/editor/ColumnSelector.jaxx | 152 + .../java/jaxx/runtime/swing/editor/I18nEditor.jaxx | 252 + .../jaxx/runtime/swing/editor/NumberEditor.jaxx | 0 .../runtime/swing/editor/NumberEditorHandler.java | 470 + .../runtime/swing/editor/NumberEditorPopup.css | 0 .../java/jaxx/runtime/swing/editor/TimeEditor.css | 0 .../java/jaxx/runtime/swing/editor/TimeEditor.jaxx | 0 .../runtime/swing/editor/TimeEditorHandler.java | 224 + .../swing/editor/config/ConfigCategoryUI.css | 0 .../swing/editor/config/ConfigCategoryUI.jaxx | 119 + .../swing/editor/config/ConfigTableEditor.java | 127 + .../swing/editor/config/ConfigTableRenderer.java | 114 + .../jaxx/runtime/swing/editor/config/ConfigUI.css | 0 .../jaxx/runtime/swing/editor/config/ConfigUI.jaxx | 0 .../swing/editor/config/ConfigUIBuilder.java | 248 + .../swing/editor/config/model/CategoryModel.java | 177 + .../editor/config/model/ConfigTableModel.java | 136 + .../swing/editor/config/model/ConfigUIModel.java | 226 + .../swing/editor/config/model/OptionModel.java | 114 + .../resources/i18n/jaxx-widgets-en_GB.properties | 74 + .../resources/i18n/jaxx-widgets-fr_FR.properties | 74 + .../src/main/resources/icons/action-add.png | Bin 0 -> 733 bytes .../src/main/resources/icons/action-collapse.png | Bin 0 -> 372 bytes .../main/resources/icons/action-config-quit.png | Bin .../main/resources/icons/action-config-reset.png | Bin .../main/resources/icons/action-config-save.png | Bin .../src/main/resources/icons/action-expand.png | Bin 0 -> 371 bytes .../src/main/resources/icons/action-i18n-be.png | Bin .../src/main/resources/icons/action-i18n-ca.png | Bin .../src/main/resources/icons/action-i18n-ch.png | Bin .../src/main/resources/icons/action-i18n-de.png | Bin .../src/main/resources/icons/action-i18n-dk.png | Bin .../src/main/resources/icons/action-i18n-es.png | Bin .../src/main/resources/icons/action-i18n-fi.png | Bin .../src/main/resources/icons/action-i18n-fr.png | Bin .../src/main/resources/icons/action-i18n-gb.png | Bin .../src/main/resources/icons/action-i18n-it.png | Bin .../src/main/resources/icons/action-i18n-nl.png | Bin .../src/main/resources/icons/action-i18n-no.png | Bin .../src/main/resources/icons/action-i18n-se.png | Bin .../src/main/resources/icons/action-i18n-us.png | Bin .../icons/action-numbereditor-calculator.png | Bin .../resources/icons/action-numbereditor-reset.png | Bin .../icons/action-numbereditor-validate.png | Bin .../src/main/resources/icons/action-remove.png | Bin 0 -> 715 bytes .../src/site/rst/images/Components-screenshot.gif | Bin .../src/site/rst/images/webstart.gif | Bin .../src/site/rst/index.rst | 0 .../src/site/site.xml | 0 maven-jaxx-plugin/pom.xml | 393 +- .../org/nuiton/jaxx/plugin/AbstractJaxxMojo.java | 155 +- .../org/nuiton/jaxx/plugin/GenerateHelpMojo.java | 589 ++ .../java/org/nuiton/jaxx/plugin/GenerateMojo.java | 602 ++ .../org/nuiton/jaxx/plugin/JaxxGeneratorMojo.java | 663 -- .../nuiton/jaxx/plugin/JaxxHelpGeneratorMojo.java | 795 -- .../main/java/org/nuiton/jaxx/plugin/NodeItem.java | 24 + .../org/nuiton/jaxx/plugin/TemplateGenerator.java | 142 - .../java/org/nuiton/jaxx/plugin/XmlHelper.java | 207 + .../src/main/resources/defaultContent.html.vm | 4 +- .../src/main/resources/defaultHelpSet.hs.vm | 12 +- .../src/main/resources/log4j.properties | 4 +- maven-jaxx-plugin/src/site/rst/index.rst | 21 +- maven-jaxx-plugin/src/site/site.xml | 8 +- .../java/org/nuiton/jaxx/plugin/Bug1722Test.java | 20 + .../java/org/nuiton/jaxx/plugin/Bug1750Test.java | 25 +- .../java/org/nuiton/jaxx/plugin/Bug1751Test.java | 24 +- .../java/org/nuiton/jaxx/plugin/CompilerTest.java | 83 +- .../nuiton/jaxx/plugin/CompilerValidatorTest.java | 41 +- .../org/nuiton/jaxx/plugin/DataBinding/Bean.java | 36 + .../nuiton/jaxx/plugin/DataBinding/BeanImpl.java | 58 + .../org/nuiton/jaxx/plugin/DataBindingTest.java | 53 + .../java/org/nuiton/jaxx/plugin/DecoratorTest.java | 24 +- .../org/nuiton/jaxx/plugin/Evolution74Test.java | 101 + .../test/java/org/nuiton/jaxx/plugin/I18nTest.java | 38 +- .../java/org/nuiton/jaxx/plugin/JaxxBaseTest.java | 66 +- .../java/org/nuiton/jaxx/plugin/NodeItemTest.java | 20 + .../compilerTest/classReferences/JavaTaist.java | 9 + .../validator/ok/Identity.java | 79 + .../compilerValidatorTest/validator/ok/Model.java | 66 + .../src/test/resources/log4j.properties | 9 + .../nuiton/jaxx/plugin/Bug1722Test/Bug_1722.xml | 27 - .../nuiton/jaxx/plugin/Bug1750Test/Bug_1750.xml | 28 - .../nuiton/jaxx/plugin/Bug1751Test/Bug_1751.xml | 29 - .../org/nuiton/jaxx/plugin/Bug1751Test/Test1.jaxx | 1 - .../org/nuiton/jaxx/plugin/Bug1751Test/Test2.jaxx | 1 - .../org/nuiton/jaxx/plugin/Bug1751Test/Test3.jaxx | 1 - .../nuiton/jaxx/plugin/CompilerTest/CSSTests.xml | 27 - .../plugin/CompilerTest/CSSTests/CSSTests.jaxx | 24 - .../jaxx/plugin/CompilerTest/ClassReferences.xml | 26 - .../CompilerTest/ClassReferences/JavaTaist.java | 9 - .../jaxx/plugin/CompilerTest/ClientProperty.xml | 27 - .../ErrorJaxxContextImplementorClass.xml | 24 - .../org/nuiton/jaxx/plugin/CompilerTest/Errors.xml | 29 - .../org/nuiton/jaxx/plugin/CompilerTest/Force.xml | 26 - .../org/nuiton/jaxx/plugin/CompilerTest/Icon.xml | 29 - .../jaxx/plugin/CompilerTest/Initializers.xml | 26 - .../jaxx/plugin/CompilerTest/InnerClasses.xml | 26 - .../org/nuiton/jaxx/plugin/CompilerTest/NoLog.xml | 27 - .../plugin/CompilerTest/OverridingDataBindings.xml | 26 - .../org/nuiton/jaxx/plugin/CompilerTest/Script.xml | 26 - .../plugin/CompilerTest/SpecialSubclassing.xml | 26 - .../SpecialSubclassing/JComboBoxTest1.jaxx | 3 - .../SpecialSubclassing/JComboBoxTest2.jaxx | 3 - .../SpecialSubclassing/JListTest1.jaxx | 3 - .../SpecialSubclassing/JListTest2.jaxx | 3 - .../SpecialSubclassing/JTreeTest1.jaxx | 3 - .../SpecialSubclassing/JTreeTest2.jaxx | 3 - .../nuiton/jaxx/plugin/CompilerTest/WithLog.xml | 27 - .../CompilerTest/errors/ItemDuplicateValues.jaxx | 8 - .../plugin/CompilerTest/errors/ItemNoValue.jaxx | 4 - .../CompilerValidatorTest/ValidatorErrors.xml | 28 - .../plugin/CompilerValidatorTest/ValidatorOk.xml | 27 - .../errors/AutoFieldComponentNotFound.jaxx | 5 - .../validator/errors/DuplicatedErrorListModel.jaxx | 4 - .../errors/DuplicatedErrorTableModel.jaxx | 4 - .../errors/DuplicatedFieldInSameValidator.jaxx | 7 - .../errors/FieldBeanPropertyNotFound.jaxx | 5 - .../validator/errors/FieldComponentDuplicated.jaxx | 7 - .../validator/errors/FieldComponentNotFound.jaxx | 5 - .../validator/errors/FieldComponentNotFound2.jaxx | 5 - .../validator/errors/FieldNoName.jaxx | 5 - .../validator/errors/FieldNoName2.jaxx | 5 - .../validator/errors/Model.java | 66 - .../validator/errors/UnfoundErrorList.jaxx | 3 - .../validator/errors/UnfoundErrorListModel.jaxx | 3 - .../validator/errors/UnfoundErrorTable.jaxx | 3 - .../validator/errors/UnfoundErrorTableModel.jaxx | 3 - .../validator/errors/UnfoundParentValidator.jaxx | 3 - .../validator/ok/Identity.java | 79 - .../CompilerValidatorTest/validator/ok/Model.java | 66 - .../validator/ok/Validation.jaxx | 274 - .../validator/ok/ValidationBeanClass.jaxx | 112 - .../jaxx/plugin/DecoratorTest/BoxedDecorator.jaxx | 3 - .../nuiton/jaxx/plugin/DecoratorTest/Decorator.xml | 27 - .../org/nuiton/jaxx/plugin/I18nTest/I18nText.xml | 27 - .../org/nuiton/jaxx/plugin/I18nTest/I18nTitle.xml | 27 - .../jaxx/plugin/I18nTest/I18nToolTipText.xml | 27 - .../nuiton/jaxx/plugin/I18nTest/text/JButton.jaxx | 1 - .../nuiton/jaxx/plugin/I18nTest/title/JDialog.jaxx | 1 - .../jaxx/plugin/I18nTest/title/JTabbedPane.jaxx | 3 - .../jaxx/plugin/I18nTest/title/JTabbedPane2.jaxx | 5 - .../jaxx/plugin/I18nTest/tooltiptext/JButton.jaxx | 1 - .../plugin/I18nTest/tooltiptext/JTabbedPane.jaxx | 3 - .../plugin/I18nTest/tooltiptext/JTabbedPane2.jaxx | 3 - .../plugin/I18nTest/tooltiptext/JTabbedPane3.jaxx | 5 - .../nuiton/jaxx/plugin/bug1722Test/Bug_1722.xml | 27 + .../{Bug1722Test => bug1722Test}/DemoPanel.jaxx | 0 .../{Bug1722Test => bug1722Test}/JButtonDemo.jaxx | 0 .../nuiton/jaxx/plugin/bug1750Test/Bug_1750.xml | 28 + .../{Bug1750Test => bug1750Test}/ComboBox.jaxx | 0 .../nuiton/jaxx/plugin/bug1751Test/Bug_1751.xml | 29 + .../org/nuiton/jaxx/plugin/bug1751Test/Test1.jaxx | 1 + .../org/nuiton/jaxx/plugin/bug1751Test/Test2.jaxx | 1 + .../org/nuiton/jaxx/plugin/bug1751Test/Test3.jaxx | 1 + .../nuiton/jaxx/plugin/compilerTest/CSSTests.xml | 28 + .../jaxx/plugin/compilerTest/ClassReferences.xml | 26 + .../jaxx/plugin/compilerTest/ClientProperty.xml | 27 + .../ErrorJaxxContextImplementorClass.xml | 27 + .../org/nuiton/jaxx/plugin/compilerTest/Errors.xml | 29 + .../org/nuiton/jaxx/plugin/compilerTest/Force.xml | 26 + .../org/nuiton/jaxx/plugin/compilerTest/Icon.xml | 29 + .../jaxx/plugin/compilerTest/Initializers.xml | 26 + .../jaxx/plugin/compilerTest/InnerClasses.xml | 26 + .../org/nuiton/jaxx/plugin/compilerTest/NoLog.xml | 27 + .../plugin/compilerTest/OverridingDataBindings.xml | 26 + .../org/nuiton/jaxx/plugin/compilerTest/Script.xml | 26 + .../plugin/compilerTest/SpecialSubclassing.xml | 26 + .../nuiton/jaxx/plugin/compilerTest/WithLog.xml | 27 + .../plugin/compilerTest/cSSTests/CSSTests.jaxx | 24 + .../CSSTests => compilerTest/cSSTests}/Child.jaxx | 0 .../CSSTests => compilerTest/cSSTests}/Child2.jaxx | 0 .../cSSTests}/GrandChild.jaxx | 0 .../cSSTests}/GrandChildButton.jaxx | 0 .../cSSTests}/Pseudoclasses.jaxx | 0 .../cSSTests}/SimpleCSS.jaxx | 0 .../classReferences}/ClassReferences.jaxx | 0 .../classReferences}/ConstructorReferenceTest.jaxx | 0 .../classReferences}/JAXXReferenceTest.jaxx | 0 .../classReferences}/JAXXTest.jaxx | 0 .../classReferences}/StaticMethodTest.jaxx | 0 .../classReferences}/TypeReference.jaxx | 0 .../clientProperty/TestOne.jaxx | 0 .../errors/AmbiguousName.jaxx | 0 .../errors/BadTypeConversions.jaxx | 0 .../errors/CellOutsideOfRow.jaxx | 0 .../errors/ChildrenInNonContainer.jaxx | 0 .../errors/ClassNotFound.jaxx | 0 .../errors/ConflictingPackages.jaxx | 0 .../errors/ConstraintsParseError.jaxx | 0 .../errors/DataBindingParseError.jaxx | 0 .../errors/DuplicateIDs.jaxx | 0 .../errors/EventHandlerParseError.jaxx | 0 .../errors/InvalidID.jaxx | 0 .../errors/InvalidRootTag.jaxx | 0 .../errors/InvalidXML.jaxx | 0 .../compilerTest/errors/ItemDuplicateValues.jaxx | 8 + .../plugin/compilerTest/errors/ItemNoValue.jaxx | 4 + .../errors/MixedContent.jaxx | 0 .../errors/RowOutsideOfTable.jaxx | 0 .../errors/RowWrongChild.jaxx | 0 .../errors/ScriptNotFound.jaxx | 0 .../errors/ScriptParseError.jaxx | 0 .../errors/ScriptSourceAndInline.jaxx | 0 .../errors/StyleNotFound.jaxx | 0 .../errors/StyleParseError.jaxx | 0 .../errors/StyleSourceAndInline.jaxx | 0 .../errors/TabOutsideOfTabbedPane.jaxx | 0 .../errors/TabbedPaneWrongChild.jaxx | 0 .../errors/TableWrongChild.jaxx | 0 .../errors/TooManyCellChildren.jaxx | 0 .../errors/TooManyScrollPaneChildren.jaxx | 0 .../errors/TooManySplitPaneChildren.jaxx | 0 .../errors/TooManyTabChildren.jaxx | 0 .../errors/UnsupportedAttribute.jaxx | 0 .../errors/UnsupportedEvent.jaxx | 0 .../errors/UnsupportedPseudoclass.jaxx | 0 .../errors/dependencies/test.css | 0 .../errors/dependencies/test.script | 0 .../force/JButton.jaxx | 0 .../{CompilerTest => compilerTest}/icon/Test1.jaxx | 0 .../initializers}/Initializers.jaxx | 0 .../innerClasses}/InnerClasses.jaxx | 0 .../log/nolog/NoLog.jaxx | 0 .../log/nolog/NoLogSon.jaxx | 0 .../log/withlog/NoLog.jaxx | 0 .../log/withlog/WithLog.jaxx | 0 .../overridingDataBindings}/CurrentTime.jaxx | 0 .../OverriddenCurrentTime.jaxx | 0 .../OverridingDataBindings.jaxx | 0 .../script}/JScriptInitializer.jaxx | 0 .../specialSubclassing/JComboBoxTest1.jaxx | 3 + .../specialSubclassing/JComboBoxTest2.jaxx | 3 + .../specialSubclassing/JListTest1.jaxx | 3 + .../specialSubclassing/JListTest2.jaxx | 3 + .../specialSubclassing/JTreeTest1.jaxx | 3 + .../specialSubclassing/JTreeTest2.jaxx | 3 + .../specialSubclassing}/SpecialSubclassing.jaxx | 0 .../compilerValidatorTest/ValidatorErrors.xml | 28 + .../plugin/compilerValidatorTest/ValidatorOk.xml | 27 + .../errors/AutoFieldComponentNotFound.jaxx | 5 + .../validator/errors/DuplicatedBean.jaxx | 0 .../validator/errors/DuplicatedBean2.jaxx | 0 .../validator/errors/DuplicatedErrorListModel.jaxx | 4 + .../errors/DuplicatedErrorTableModel.jaxx | 4 + .../errors/DuplicatedFieldInSameValidator.jaxx | 7 + .../errors/FieldBeanPropertyNotFound.jaxx | 5 + .../validator/errors/FieldComponentDuplicated.jaxx | 7 + .../validator/errors/FieldComponentNotFound.jaxx | 5 + .../validator/errors/FieldComponentNotFound2.jaxx | 5 + .../validator/errors/FieldNoName.jaxx | 5 + .../validator/errors/FieldNoName2.jaxx | 5 + .../validator/errors/Model.java | 66 + .../validator/errors/NoBean.jaxx | 0 .../validator/errors/UnfoundBean.jaxx | 0 .../validator/errors/UnfoundErrorList.jaxx | 3 + .../validator/errors/UnfoundErrorListModel.jaxx | 3 + .../validator/errors/UnfoundErrorTable.jaxx | 3 + .../validator/errors/UnfoundErrorTableModel.jaxx | 3 + .../validator/errors/UnfoundParentValidator.jaxx | 3 + .../validator/ok/Validation.jaxx | 274 + .../validator/ok/ValidationBeanClass.jaxx | 112 + .../nuiton/jaxx/plugin/dataBindingTest/First.jaxx | 24 + .../jaxx/plugin/dataBindingTest/simpleBinding.xml | 26 + .../jaxx/plugin/decoratorTest/BoxedDecorator.jaxx | 3 + .../nuiton/jaxx/plugin/decoratorTest/Decorator.xml | 27 + .../nuiton/jaxx/plugin/evolution74Test/error.xml | 27 + .../plugin/evolution74Test/error/swingcombo.jaxx | 4 + .../plugin/evolution74Test/error/swinglist.jaxx | 4 + .../plugin/evolution74Test/error/swingtree.jaxx | 4 + .../org/nuiton/jaxx/plugin/evolution74Test/ok.xml | 26 + .../jaxx/plugin/evolution74Test/ok/jaxxcombo.jaxx | 4 + .../jaxx/plugin/evolution74Test/ok/jaxxlist.jaxx | 4 + .../jaxx/plugin/evolution74Test/ok/jaxxtree.jaxx | 4 + .../jaxx/plugin/evolution74Test/ok/swingcombo.jaxx | 2 + .../jaxx/plugin/evolution74Test/ok/swinglist.jaxx | 1 + .../jaxx/plugin/evolution74Test/ok/swingtree.jaxx | 2 + .../org/nuiton/jaxx/plugin/i18nTest/I18nText.xml | 27 + .../org/nuiton/jaxx/plugin/i18nTest/I18nTitle.xml | 27 + .../jaxx/plugin/i18nTest/I18nToolTipText.xml | 27 + .../nuiton/jaxx/plugin/i18nTest/text/JButton.jaxx | 1 + .../nuiton/jaxx/plugin/i18nTest/title/JDialog.jaxx | 1 + .../jaxx/plugin/i18nTest/title/JTabbedPane.jaxx | 3 + .../jaxx/plugin/i18nTest/title/JTabbedPane2.jaxx | 5 + .../jaxx/plugin/i18nTest/tooltiptext/JButton.jaxx | 1 + .../plugin/i18nTest/tooltiptext/JTabbedPane.jaxx | 3 + .../plugin/i18nTest/tooltiptext/JTabbedPane2.jaxx | 3 + .../plugin/i18nTest/tooltiptext/JTabbedPane3.jaxx | 5 + pom.xml | 73 +- src/site/rst/JAXXContext.rst | 4 +- src/site/rst/index.rst | 18 +- src/site/rst/migration.rst | 25 + src/site/site.xml | 1 + 1113 files changed, 68735 insertions(+), 63865 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm