From: <max...@us...> - 2008-08-19 14:49:28
|
Revision: 3671 http://uni-d.svn.sourceforge.net/uni-d/?rev=3671&view=rev Author: max_brod Date: 2008-08-19 14:49:23 +0000 (Tue, 19 Aug 2008) Log Message: ----------- [UNI-426] Added foreground/background color for group labels. Modified Paths: -------------- trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/unidGroup/UnidGroup.html trunk/Uni-d/test/src/etc/site_tapestry/site.war/css/Uni-d.css Modified: trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/unidGroup/UnidGroup.html =================================================================== --- trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/unidGroup/UnidGroup.html 2008-08-04 15:06:58 UTC (rev 3670) +++ trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/unidGroup/UnidGroup.html 2008-08-19 14:49:23 UTC (rev 3671) @@ -35,7 +35,7 @@ <span jwcid="@If" condition="ognl:isGroupVisible()"> <span jwcid="@Any" id="prop:groupTagId" class="prop:groupTagClass"> <fieldset jwcid="@Any" id="prop:groupFieldsetId"> - <legend><span jwcid="@Insert" value="prop:groupLabel"/></legend> + <legend><span jwcid="@Insert" value="prop:groupLabel" class="displayGroupLabel"/></legend> <span jwcid="@If" condition="ognl:page.useExtraGroupBlock()"><span jwcid="renderExtraGroupBlock"/></span> Modified: trunk/Uni-d/test/src/etc/site_tapestry/site.war/css/Uni-d.css =================================================================== --- trunk/Uni-d/test/src/etc/site_tapestry/site.war/css/Uni-d.css 2008-08-04 15:06:58 UTC (rev 3670) +++ trunk/Uni-d/test/src/etc/site_tapestry/site.war/css/Uni-d.css 2008-08-19 14:49:23 UTC (rev 3671) @@ -104,6 +104,11 @@ color: black; } +.displayGroupLabel { + background-color: blue; + color: white; +} + .buttonGroup { text-align: center; display: block; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2008-10-06 12:06:11
|
Revision: 3691 http://uni-d.svn.sourceforge.net/uni-d/?rev=3691&view=rev Author: max_brod Date: 2008-10-06 12:05:57 +0000 (Mon, 06 Oct 2008) Log Message: ----------- [ICT-1295] Improvements for speed. Modified Paths: -------------- trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/useradmin/UnidRight.table trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/useradmin/UnidRole.table trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/useradmin/UnidUser.table trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/userAdmin/configList/ConfigList.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/useradmin/cache/CacheLoaderPersister.java trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/userAdmin/configList/ConfigList.html Modified: trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/useradmin/UnidRight.table =================================================================== --- trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/useradmin/UnidRight.table 2008-10-01 16:07:12 UTC (rev 3690) +++ trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/useradmin/UnidRight.table 2008-10-06 12:05:57 UTC (rev 3691) @@ -10,6 +10,27 @@ </constraints> <display/> </field> + + <field name="Role" type="UnidRole"> + <link-name>role-rights</link-name> + <hide/> + </field> + <field name="UserTablesPreferences" type="UnidUser"> + <link-name>user-tablesprefs</link-name> + <hide/> + </field> + <field name="UserFieldsPreferences" type="UnidUser"> + <link-name>user-fieldsprefs</link-name> + <hide/> + </field> + <field name="UserListPreferences" type="UnidUser"> + <link-name>user-listprefs</link-name> + <hide/> + </field> + <field name="UserReportPreferences" type="UnidUser"> + <link-name>user-reportprefs</link-name> + <hide/> + </field> </page> <hide/> @@ -17,4 +38,25 @@ <select name="Identifier"> <selection field="Identifier"/> </select> + + <select name="Role"> + <selection field="RoleName" path="role" table="UnidRole"/> + </select> + + <select name="UserTablesPreferences"> + <selection field="UserName" path="userTablesPreferences" table="UnidUser"/> + </select> + + <select name="UserFieldsPreferences"> + <selection field="UserName" path="userFieldsPreferences" table="UnidUser"/> + </select> + + <select name="UserListPreferences"> + <selection field="UserName" path="userListPreferences" table="UnidUser"/> + </select> + + <select name="UserReportPreferences"> + <selection field="UserName" path="userReportPreferences" table="UnidUser"/> + </select> + </table> Modified: trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/useradmin/UnidRole.table =================================================================== --- trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/useradmin/UnidRole.table 2008-10-01 16:07:12 UTC (rev 3690) +++ trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/useradmin/UnidRole.table 2008-10-06 12:05:57 UTC (rev 3691) @@ -37,6 +37,8 @@ <multiple/> <value-include/> <hide/> + <link-name>role-rights</link-name> + <cascade-delete/> </field> </page> Modified: trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/useradmin/UnidUser.table =================================================================== --- trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/useradmin/UnidUser.table 2008-10-01 16:07:12 UTC (rev 3690) +++ trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/useradmin/UnidUser.table 2008-10-06 12:05:57 UTC (rev 3691) @@ -38,6 +38,8 @@ <hide/> <multiple/> <value-include/> + <cascade-delete/> + <link-name>user-tablesprefs</link-name> </field> <field name="FieldsPreferences" type="UnidRight"> @@ -45,6 +47,8 @@ <hide/> <multiple/> <value-include/> + <cascade-delete/> + <link-name>user-fieldsprefs</link-name> </field> <field name="ListPreferences" type="UnidRight"> @@ -52,6 +56,8 @@ <hide/> <multiple/> <value-include/> + <cascade-delete/> + <link-name>user-listprefs</link-name> </field> <field name="ReportPreferences" type="UnidRight"> @@ -59,6 +65,8 @@ <hide/> <multiple/> <value-include/> + <cascade-delete/> + <link-name>user-reportprefs</link-name> </field> <field name="StartPage" type="string"> Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/userAdmin/configList/ConfigList.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/userAdmin/configList/ConfigList.java 2008-10-01 16:07:12 UTC (rev 3690) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/userAdmin/configList/ConfigList.java 2008-10-06 12:05:57 UTC (rev 3691) @@ -127,17 +127,6 @@ setItems( ret ); } - public void formSubmit( IRequestCycle cycle ) - { - String name = getName(); - if ( name == null ) return; - - if ( getSelectedComponent().equals( "Save" ) ) save(); - if ( getSelectedComponent().equals( "Load" ) ) load(); - if ( getSelectedComponent().equals( "Set" ) ) setAll(); - if ( getSelectedComponent().equals( "Reset" ) ) resetAll(); - } - public void load() { String name = getName(); Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/useradmin/cache/CacheLoaderPersister.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/useradmin/cache/CacheLoaderPersister.java 2008-10-01 16:07:12 UTC (rev 3690) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/useradmin/cache/CacheLoaderPersister.java 2008-10-06 12:05:57 UTC (rev 3691) @@ -55,20 +55,50 @@ try { Map<String, Object> map = new HashMap<String, Object>(); - UnidProxy container = getContainer( name, type ); - List<UnidProxy> list = getRights( type, container ); - for ( UnidProxy right : list ) + + List<UnidProxy> list = null; + if ( type.table.equals( "UnidRole" ) ) { - String key = (String) UnidProxyAccessor.getField( right, "Identifier" ); - Object value = UnidProxyAccessor.getField( right, type.updateFieldName ); - map.put( key, value ); + list = UnidProxyAccessor.find( "UnidRight", "Role", new Class[]{ String.class }, new Object[]{ name } ); } + else + { + if ( type.collectionFieldName.equals( "TablesPreferences" ) ) + { + list = UnidProxyAccessor.find( "UnidRight", "UserTablesPreferences", new Class[]{ String.class }, + new Object[]{ name } ); + } + if ( type.collectionFieldName.equals( "FieldsPreferences" ) ) + { + list = UnidProxyAccessor.find( "UnidRight", "UserFieldsPreferences", new Class[]{ String.class }, + new Object[]{ name } ); + } + if ( type.collectionFieldName.equals( "ListPreferences" ) ) + { + list = UnidProxyAccessor + .find( "UnidRight", "UserListPreferences", new Class[]{ String.class }, new Object[]{ name } ); + } + if ( type.collectionFieldName.equals( "ReportPreferences" ) ) + { + list = UnidProxyAccessor.find( "UnidRight", "UserReportPreferences", new Class[]{ String.class }, + new Object[]{ name } ); + } + } + if ( list != null ) + { + for ( UnidProxy right : list ) + { + String key = (String) UnidProxyAccessor.getField( right, "Identifier" ); + Object value = UnidProxyAccessor.getField( right, type.updateFieldName ); + map.put( key, value ); + } + } + else + { + throw new RuntimeException( "Unhandled preferences" ); + } return map; } - catch ( UnidPersistenceException pe ) - { - throw pe; - } catch ( Exception e ) { throw new UnidPersistenceException( e ); @@ -83,6 +113,7 @@ { UnidProxy right = getRightFast( name, type, id ); Object oldValue = null; + if ( right == null ) { if ( value == null ) return null; @@ -90,6 +121,7 @@ right.setUnidType( type.unidType ); UnidProxyAccessor.setField( right, "Identifier", String.class, id ); addRightToContainer( name, type, right ); + right.unidUpdate(); } else { Modified: trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/userAdmin/configList/ConfigList.html =================================================================== --- trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/userAdmin/configList/ConfigList.html 2008-10-01 16:07:12 UTC (rev 3690) +++ trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/userAdmin/configList/ConfigList.html 2008-10-06 12:05:57 UTC (rev 3691) @@ -37,7 +37,6 @@ <fieldset> <form jwcid="@Form" - listener="listener:formSubmit" delegate="bean:validationDelegate" clientValidationEnabled="ognl:true" enctype="multipart/form-data" focus="ognl:false"> @@ -47,30 +46,38 @@ </span> <input jwcid="@Submit" value="message:Load" selected="prop:selectedComponent" id="Load" name="Load" - tag="Load"/> + tag="Load" action="listener:load"/> <input jwcid="@Submit" value="message:Save" selected="prop:selectedComponent" id="Save" name="Save" - tag="Save"/> + tag="Save" action="listener:save"/> <span jwcid="@If" condition="ognl:roleConfiguration"> <input jwcid="@Submit" value="message:SetAllToNoRights" selected="ognl:selectedComponent" id="Reset" - name="Reset" tag="Reset"/> + name="Reset" tag="Reset" + action="listener:resetAll" + /> <input jwcid="@Submit" value="message:SetAllToFullRights" selected="prop:selectedComponent" id="Set" - name="Set" tag="Set"/> + name="Set" tag="Set" + action="listener:setAll" + /> </span> <span jwcid="@Else"> <input jwcid="@Submit" value="message:UnselectAll" selected="prop:selectedComponent" id="Reset" name="Reset" - tag="Reset"/> + tag="Reset" + action="listener:resetAll" + /> <input jwcid="@Submit" value="message:SelectAll" selected="prop:selectedComponent" id="Set" name="Set" - tag="Set"/> + tag="Set" + action="listener:setAll" + /> </span> <table> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pus...@us...> - 2008-11-13 11:25:06
|
Revision: 3705 http://uni-d.svn.sourceforge.net/uni-d/?rev=3705&view=rev Author: pushkutza Date: 2008-11-13 11:25:00 +0000 (Thu, 13 Nov 2008) Log Message: ----------- ICT-1357 Modified Paths: -------------- trunk/Uni-d/generate/src/main/resources/uni-d.dtd trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/MasterDetailActionHandler.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/main/MasterDetailBaseComponent.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/main/MasterDetailMainComponentContainer.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/masterDetail/MasterDetailBasePage.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/masterDetail/parameter/Parameter.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/masterDetail/parameter/TableParameter.java trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/masterDetail/main/MasterDetailBaseComponent.html trunk/Uni-d/template/src/main/webapp/translations-common.txt Modified: trunk/Uni-d/generate/src/main/resources/uni-d.dtd =================================================================== --- trunk/Uni-d/generate/src/main/resources/uni-d.dtd 2008-11-05 13:16:40 UTC (rev 3704) +++ trunk/Uni-d/generate/src/main/resources/uni-d.dtd 2008-11-13 11:25:00 UTC (rev 3705) @@ -207,6 +207,7 @@ name CDATA #REQUIRED singular CDATA #IMPLIED type CDATA "string" +display-class CDATA "string" length %integer; #IMPLIED display-length %integer; #IMPLIED renderer CDATA #IMPLIED Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/MasterDetailActionHandler.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/MasterDetailActionHandler.java 2008-11-05 13:16:40 UTC (rev 3704) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/MasterDetailActionHandler.java 2008-11-13 11:25:00 UTC (rev 3705) @@ -31,7 +31,7 @@ void save( MASTER master, ArrayList<DETAIL> details, COMPONENT component ) throws Exception; - void createTemplate( MASTER master, ArrayList<DETAIL> details, COMPONENT component ) + void createTemplate( MASTER master, ArrayList<DETAIL> details, boolean fullLines, COMPONENT component ) throws Exception; void clear( MASTER master, ArrayList<DETAIL> details, COMPONENT component ) Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/main/MasterDetailBaseComponent.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/main/MasterDetailBaseComponent.java 2008-11-05 13:16:40 UTC (rev 3704) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/main/MasterDetailBaseComponent.java 2008-11-13 11:25:00 UTC (rev 3705) @@ -73,6 +73,9 @@ @Parameter( name = "showBaseButtons", defaultValue = "true" ) public abstract boolean isShowBaseButtons(); + @Parameter( name = "showCreateTemplateFull", defaultValue = "false" ) + public abstract boolean isShowCreateTemplateFullButton(); + /* * ********************************** Assets defintions: ************************************* */ @@ -278,7 +281,7 @@ { try { - getActionHandler().createTemplate( getMasterParameter(), getDetailParameters(), this ); + getActionHandler().createTemplate( getMasterParameter(), getDetailParameters(), false, this ); clearErrors = true; } catch ( Exception e ) @@ -288,6 +291,20 @@ } } + public void createTemplateFull() + { + try + { + getActionHandler().createTemplate( getMasterParameter(), getDetailParameters(), true, this ); + clearErrors = true; + } + catch ( Exception e ) + { + getActionHandler().log( log, e, e ); + setError( getTranslatedExceptionMessage( e ) ); + } + } + public void cancel() { try @@ -361,6 +378,28 @@ return caption + "[Alt + " + getCreateTemplateButtonAccesskey() + ']'; } + public String getCreateTemplateFullButtonLabel() + { + return getDisplayMode().isAdd() + ? getMessages().getMessage( "masterDetail.button.createContinueFull.label" ) + : getMessages().getMessage( "masterDetail.button.createTemplateFull.label" ); + } + + public String getCreateTemplateFullButtonAccesskey() + { + return getDisplayMode().isAdd() + ? getMessages().getMessage( "masterDetail.button.createContinueFull.accesskey" ) + : getMessages().getMessage( "masterDetail.button.createTemplateFull.accesskey" ); + } + + public String getCreateTemplateFullButtonTitle() + { + String caption = getDisplayMode().isAdd() + ? getMessages().getMessage( "masterDetail.button.createContinueFull.caption" ) + : getMessages().getMessage( "masterDetail.button.createTemplateFull.caption" ); + return caption + "[Alt + " + getCreateTemplateButtonAccesskey() + ']'; + } + public String getAddLinesButtonLabel() { return getMessages().getMessage( "detail.button.addlines.label" ); Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/main/MasterDetailMainComponentContainer.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/main/MasterDetailMainComponentContainer.java 2008-11-05 13:16:40 UTC (rev 3704) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/main/MasterDetailMainComponentContainer.java 2008-11-13 11:25:00 UTC (rev 3705) @@ -34,7 +34,8 @@ "showRemove = isShowRemove()", "showAddLines = isShowAddLines()", "showBaseButtons = isShowBaseButtons()", - "showLinesSelector = isShowLinesSelectors()" + "showLinesSelector = isShowLinesSelectors()", + "showCreateTemplateFull = isShowCreateTemplateFull()" } ) public abstract MasterDetailBaseComponent getMasterDetailComponent(); @@ -66,5 +67,7 @@ public abstract boolean isShowBaseButtons(); + public abstract boolean isShowCreateTemplateFull(); + public abstract boolean isShowLinesSelectors(); } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/masterDetail/MasterDetailBasePage.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/masterDetail/MasterDetailBasePage.java 2008-11-05 13:16:40 UTC (rev 3704) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/masterDetail/MasterDetailBasePage.java 2008-11-13 11:25:00 UTC (rev 3705) @@ -72,6 +72,11 @@ return true; } + public boolean isShowCreateTemplateFull() + { + return false; + } + public boolean isShowLinesSelectors() { return false; Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/masterDetail/parameter/Parameter.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/masterDetail/parameter/Parameter.java 2008-11-05 13:16:40 UTC (rev 3704) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/masterDetail/parameter/Parameter.java 2008-11-13 11:25:00 UTC (rev 3705) @@ -17,7 +17,7 @@ return clone; } - public T cloneAsTemplate( T clone ) + public T cloneAsTemplate( T clone, boolean full ) { if ( clone == null ) clone = newInstance(); return clone; Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/masterDetail/parameter/TableParameter.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/masterDetail/parameter/TableParameter.java 2008-11-05 13:16:40 UTC (rev 3704) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/masterDetail/parameter/TableParameter.java 2008-11-13 11:25:00 UTC (rev 3705) @@ -65,9 +65,9 @@ } @Override - public T cloneAsTemplate( T clone ) + public T cloneAsTemplate( T clone, boolean full ) { - clone = super.cloneAsTemplate( clone ); + clone = super.cloneAsTemplate( clone, full ); clone.description = description; clone.setProxy( getProxy() == null ? null : (PROXY) getProxy().cloneProxy( false ) ); return clone; Modified: trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/masterDetail/main/MasterDetailBaseComponent.html =================================================================== --- trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/masterDetail/main/MasterDetailBaseComponent.html 2008-11-05 13:16:40 UTC (rev 3704) +++ trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/masterDetail/main/MasterDetailBaseComponent.html 2008-11-13 11:25:00 UTC (rev 3705) @@ -143,6 +143,13 @@ accesskey="prop:createTemplateButtonAccesskey" title="prop:createTemplateButtonTitle" /> + <span jwcid="@If" condition='prop:showCreateTemplateFullButton'> + <input jwcid="createTemplateFull@Submit" action="listener:createTemplateFull" + value="prop:createTemplateFullButtonLabel" + accesskey="prop:createTemplateFullButtonAccesskey" + title="prop:createTemplateFullButtonTitle" + /> + </span> <input jwcid="cancel@Submit" action="listener:cancel" onclick="clearValidation(this)" value="prop:cancelButtonLabel" accesskey="prop:cancelButtonAccesskey" Modified: trunk/Uni-d/template/src/main/webapp/translations-common.txt =================================================================== --- trunk/Uni-d/template/src/main/webapp/translations-common.txt 2008-11-05 13:16:40 UTC (rev 3704) +++ trunk/Uni-d/template/src/main/webapp/translations-common.txt 2008-11-13 11:25:00 UTC (rev 3705) @@ -787,6 +787,20 @@ .label.nl T .label.ro T .label.fr T +.key masterDetail.button.createTemplateFull/MasterDetailPage +.label.en Create Template(with lines) +.caption.en Create a new record with full lines using this as template +.label.nl Nieuw Template(lines) +.caption.nl Nieuwe gegevens aanmaken met deze als template(lines) +.label.ro Creaza Dupa Sablon(cu linii) +.caption.ro Creaza o noua inregistrare cu linii complete folosind aceasta inregistrare ca sablon +.label.fr Nouveau template(lines) +.caption.fr Ajouter nouveaux données avec celle ci comme template(lines) +.key masterDetail.button.createTemplateFull.accesskey/MasterDetailPage +.label.en L +.label.nl L +.label.ro L +.label.fr L .key masterDetail.button.save/MasterDetailPage .label.en Save .caption.en Save the current modifications This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2008-11-18 17:16:42
|
Revision: 3714 http://uni-d.svn.sourceforge.net/uni-d/?rev=3714&view=rev Author: max_brod Date: 2008-11-18 17:16:15 +0000 (Tue, 18 Nov 2008) Log Message: ----------- [UNI-427] Added tag "no-translation". This means the element will be ignored by the translations editor. Modified Paths: -------------- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMAction.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMField.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMGroup.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMPage.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMParameter.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMRootTable.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMSelect.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMSelection.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/UnidNodesMap.java trunk/Uni-d/generate/src/main/resources/uni-d.dtd trunk/Uni-d/tool/src/main/java/be/unid/tool/translationsEditor/TranslationsEditor.java Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMAction.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMAction.java 2008-11-18 14:42:06 UTC (rev 3713) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMAction.java 2008-11-18 17:16:15 UTC (rev 3714) @@ -63,12 +63,13 @@ private boolean hide; private boolean hideIf; // hide action in GUI depending on a class? private String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the action + private boolean noTranslation; // no translation is needed for this element? - private String parametersList; private String parametersListWithTypes; - private static String[] childrenList = { "description", "parameter", "security-role", "hide", "no-hide" }; + private static String[] childrenList = + { "description", "parameter", "security-role", "hide", "no-hide", "no-translation" }; private static final String[] requiredAttributes = { "name" }; private static final Map<String, AttributeConstraints> attributeConstraints = @@ -114,6 +115,11 @@ public boolean canAppendChild( CharSequence tag, Attributes attr ) { + if ( tag.equals( "no-translation" ) ) + { + noTranslation = true; + return false; + } if ( tag.equals( "security-role" ) ) { inTag = TAG_SECURITY_ROLE; @@ -229,7 +235,7 @@ { return hide; } - + public boolean isHiddenIf() { return hideIf; @@ -240,6 +246,11 @@ return hideIfClass; } + public boolean isNoTranslation() + { + return noTranslation; + } + public String getParametersList() { if ( parametersList != null ) Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMField.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMField.java 2008-11-18 14:42:06 UTC (rev 3713) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMField.java 2008-11-18 17:16:15 UTC (rev 3714) @@ -104,6 +104,7 @@ private boolean hide; // hide field in GUI? private boolean hideIf; // hide field in GUI depending on a class? private String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the field + private boolean noTranslation; // no translation is needed for this element? private boolean buildValue; // should this field be included in the buildValue object private String wsValue = "UOID"; // field to serialize for ws queries for linked fields private String wsRole = "|all|"; // roles which can get this field when serializing for ws queries @@ -150,7 +151,7 @@ "default", "use-relation-table", "use-relation-field", "suggest", "cloneable", "not-cloneable", "constraints", "display", "no-display", "hide", "no-hide", "ws-value", "ws-role", "buildvalue", "indexed", "case", "security-role", "if", - "is-reference", "is-description", "embedded", "include" }; + "is-reference", "is-description", "embedded", "include", "no-translation" }; private static final String[] requiredAttributes = { "name" }; @@ -683,6 +684,10 @@ hideIfClass = attr.getValue( "if-class" ).toString(); } } + else if ( tag.equals( "no-translation" ) ) + { + noTranslation = true; + } else if ( tag.equals( "is-reference" ) ) { if ( isBlob() || isClob() ) @@ -1552,6 +1557,21 @@ return hideIfClass; } + public boolean isNoTranslation() + { + if ( noTranslation ) return true; + Node parent = this.getParentNode(); + if ( parent instanceof OMGroup ) + { + return ( (OMGroup) parent ).isNoTranslation(); + } + if ( parent instanceof OMPage ) + { + return ( (OMPage) parent ).isNoTranslation(); + } + return false; + } + public boolean isReference() { return fieldReference; Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMGroup.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMGroup.java 2008-11-18 14:42:06 UTC (rev 3713) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMGroup.java 2008-11-18 17:16:15 UTC (rev 3714) @@ -55,8 +55,9 @@ private boolean hide; // hide group in GUI? private boolean hideIf; // hide group in GUI depending on a class? private String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the group + private boolean noTranslation; // no translation is needed for this element? - private static String[] childrenList = { "description", "field", "group", "if", "include", "hide", "no-hide" }; + private static String[] childrenList = { "description", "field", "group", "if", "include", "hide", "no-hide", "no-translation" }; public String[] getRequiredAttributes() { @@ -208,8 +209,13 @@ { return false; } - else if ( tag.equals( "hide" ) ) + if ( tag.equals( "no-translation" ) ) { + noTranslation = true; + return false; + } + if ( tag.equals( "hide" ) ) + { if ( attr.getValue( "if-class" ) != null ) { hideIf = true; @@ -366,6 +372,21 @@ return hideIfClass; } + public boolean isNoTranslation() + { + if (noTranslation) return true; + Node parent=this.getParentNode(); + if (parent instanceof OMGroup) + { + return ((OMGroup) parent).isNoTranslation(); + } + if (parent instanceof OMPage) + { + return ((OMPage) parent).isNoTranslation(); + } + return false; + } + private String getParentName() { if ( parentName != null ) return parentName; Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMPage.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMPage.java 2008-11-18 14:42:06 UTC (rev 3713) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMPage.java 2008-11-18 17:16:15 UTC (rev 3714) @@ -52,9 +52,10 @@ boolean partOfRoot; // prevent adding of page twice to root-table private boolean hide; // hide field in GUI? private boolean hideIf; // hide field in GUI depending on a class? + private boolean noTranslation; // no translation is needed for this element? private String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the page - private static String[] childrenList = { "description", "field", "group", "if", "include", "hide", "no-hide" }; + private static String[] childrenList = { "description", "field", "group", "if", "include", "hide", "no-hide", "no-translation" }; public String[] getRequiredAttributes() { @@ -143,7 +144,7 @@ if ( table == null ) { Node node = this.getParentNode(); - while ( !( node instanceof OMTable ) && node!=null ) node = node.getParentNode(); + while ( !( node instanceof OMTable ) && node != null ) node = node.getParentNode(); table = (OMTable) node; } if ( name.equals( "name" ) ) @@ -170,8 +171,13 @@ { return false; } - else if ( tag.equals( "hide" ) ) + if ( tag.equals( "no-translation" ) ) { + noTranslation = true; + return false; + } + if ( tag.equals( "hide" ) ) + { if ( attr.getValue( "if-class" ) != null ) { hideIf = true; @@ -179,7 +185,7 @@ } else { - hide=true; + hide = true; } return false; } @@ -335,6 +341,11 @@ return hideIfClass; } + public boolean isNoTranslation() + { + return noTranslation; + } + public OMTable getOMTable() { return table; @@ -342,10 +353,9 @@ public void setOMTable( OMTable table ) { - this.table=table; + this.table = table; } - private String getParentName() { if ( parentName != null ) return parentName; Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMParameter.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMParameter.java 2008-11-18 14:42:06 UTC (rev 3713) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMParameter.java 2008-11-18 17:16:15 UTC (rev 3714) @@ -58,8 +58,9 @@ String parentNodeName; // name of the action or build in which this parameter is defined private CaseConversionType caseConversionType = CaseConversionType.NONE; private String caseConversion; // "upper", "lower", "mixed", or a class name + private boolean noTranslation; // no translation is needed for this element? - private static String[] childrenList = { "description", "suggest", "case" }; + private static String[] childrenList = { "description", "suggest", "case", "no-translation" }; private static final String[] requiredAttributes = { "type" }; @@ -78,7 +79,6 @@ return childrenList; } - public void setAttribute( CharSequence name, CharSequence value ) throws XMLTreeException { @@ -118,6 +118,11 @@ public boolean canAppendChild( CharSequence tag, Attributes attr ) { + if ( tag.equals( "no-translation" ) ) + { + noTranslation = true; + return false; + } if ( tag.equals( "description" ) ) { return false; @@ -273,7 +278,7 @@ { NodeList nl = this.getParentNode().getNodesByTagName( "parameter" ); int index = 0; - for ( int i = 0; i < nl.getLength(); i++ ) + for ( int i = 0; i < nl.getLength() ; i++ ) { OMParameter param = (OMParameter) nl.item( i ); if ( param.equals( this ) ) @@ -317,7 +322,6 @@ return suggest; } - public boolean hasCaseConversion() { return caseConversionType != CaseConversionType.NONE; @@ -345,6 +349,11 @@ return caseConversion; } + public boolean isNoTranslation() + { + return noTranslation; + } + public void parseTemplates() { if ( hasSuggest() ) Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMRootTable.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMRootTable.java 2008-11-18 14:42:06 UTC (rev 3713) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMRootTable.java 2008-11-18 17:16:15 UTC (rev 3714) @@ -877,4 +877,9 @@ { return getReferenceField() != null; } + + public boolean isNoTranslation() + { + return getTable().isNoTranslation(); + } } Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMSelect.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMSelect.java 2008-11-18 14:42:06 UTC (rev 3713) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMSelect.java 2008-11-18 17:16:15 UTC (rev 3714) @@ -71,6 +71,8 @@ private boolean hide; private boolean hideIf; // hide select in GUI depending on a class? private String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the select + private boolean noTranslation; // no translation is needed for this element? + private String query; private String parametersList; private String parametersListConverted; @@ -84,7 +86,7 @@ private String viewFilter = ""; private static final String[] childrenList = - { "description", "subselect", "if", "selection", "security-role", "hide", "no-hide", "view-filter" }; + { "description", "subselect", "if", "selection", "security-role", "hide", "no-hide", "view-filter", "no-translation" }; private static final String[] requiredAttributes = { "name" }; @@ -759,6 +761,11 @@ } return false; } + else if ( tag.equals( "no-translation" ) ) + { + noTranslation = true; + return false; + } else if ( tag.equals( "view-filter" ) ) { inTag = TAG_VIEW_FILTER; @@ -887,6 +894,11 @@ return hideIfClass; } + public boolean isNoTranslation() + { + return noTranslation; + } + public boolean isAutomatic() { return name.startsWith( "Unid" ); @@ -1000,4 +1012,5 @@ } public String getViewFilter() { return viewFilter; } -} + + } Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMSelection.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMSelection.java 2008-11-18 14:42:06 UTC (rev 3713) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMSelection.java 2008-11-18 17:16:15 UTC (rev 3714) @@ -58,9 +58,10 @@ private Suggest suggest; OMTable parentTable; // table in which this selection is originally defined OMSelect select; // select in which this selection is originally defined + private boolean noTranslation; // no translation is needed for this element? private String[] parameterValueList = { "true", "false" }; - private static String[] childrenList = { "suggest" }; + private static String[] childrenList = { "suggest", "no-translation" }; private static final String[] requiredAttributes = { "field" }; @@ -487,6 +488,11 @@ @Override public boolean canAppendChild( CharSequence tag, Attributes attr ) { + if ( tag.equals( "no-translation" ) ) + { + noTranslation = true; + return false; + } if ( tag.equals( "suggest" ) ) { boolean valueSuggest = ( attr.getValue( "value" ) != null ) || @@ -596,6 +602,11 @@ super.parseTemplates(); } + public boolean isNoTranslation() + { + return noTranslation; + } + public String toString() { return "<selection field=\"" + field + "\" table=" + table + "\" path=\"" + path + "\"... />\n"; Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java 2008-11-18 14:42:06 UTC (rev 3713) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java 2008-11-18 17:16:15 UTC (rev 3714) @@ -86,6 +86,7 @@ private String description = ""; private String expectedAmount; private boolean hide; // should this be listed in Gui, in tables index? + private boolean noTranslation; // no translation is needed for this element? private boolean hideIf; // hide table in GUI depending on a class? private String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the table private String category = "default"; @@ -104,7 +105,7 @@ private static String[] childrenList = { "description", "mapping", "if", "template", "security-role", "default-instance", "security-role-remove", "page", "cloneable", "not-cloneable", "cascade-keep", - "constraints", "hide", "no-hide", "select", "build", "action", "include", "data-filter" }; + "constraints", "hide", "no-hide", "select", "build", "action", "include", "data-filter","no-translation" }; private static String[] constraintsChildrenList = { "unique", "required", "immutable", "immutable-if", "mutable-even-if", "compare", "value-when-null", "value-when-zero", "if" }; @@ -364,6 +365,11 @@ inTag = TAG_DESCRIPTION; return false; } + else if (tag.equals("no-translation")) + { + noTranslation=true; + return false; + } else if ( tag.equals( "hide" ) ) { if ( attr.getValue( "if-class" ) == null ) @@ -1023,6 +1029,11 @@ return hide; } + public boolean isNoTranslation() + { + return noTranslation; + } + public String getCategory() { return category; Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/UnidNodesMap.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/UnidNodesMap.java 2008-11-18 14:42:06 UTC (rev 3713) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/UnidNodesMap.java 2008-11-18 17:16:15 UTC (rev 3714) @@ -119,5 +119,6 @@ put( "include", null ); put( "data-filter", null ); put( "view-filter", null ); + put( "no-translation", null ); } } Modified: trunk/Uni-d/generate/src/main/resources/uni-d.dtd =================================================================== --- trunk/Uni-d/generate/src/main/resources/uni-d.dtd 2008-11-18 14:42:06 UTC (rev 3713) +++ trunk/Uni-d/generate/src/main/resources/uni-d.dtd 2008-11-18 17:16:15 UTC (rev 3714) @@ -78,7 +78,8 @@ (build|%param.tag;)*, (action|%param.tag;)*, (include)*, - (data-filter)? + (data-filter)?, + (no-translation)? )> <!ATTLIST table name CDATA #IMPLIED @@ -145,7 +146,7 @@ A table is always split into at least one page. This is a visual separation, indicating typically the tab page which contains the field. --> -<!ELEMENT page ((description)?,(field|group|%param.tag;)*, (include)*, (hide|no-hide)?)> +<!ELEMENT page ((description)?,(field|group|%param.tag;)*, (include)*, (hide|no-hide)?, (no-translation)?)> <!ATTLIST page name CDATA #IMPLIED> @@ -157,7 +158,7 @@ <!-- Allow grouping of fields. In a GUI this could be represented by a box around the items. --> -<!ELEMENT group ((description)?,(field|group|%param.tag;)*, (include)*, (hide|no-hide)?)> +<!ELEMENT group ((description)?,(field|group|%param.tag;)*, (include)*, (hide|no-hide)?, (no-translation)?)> <!ATTLIST group name CDATA ""> @@ -201,7 +202,8 @@ (security-role)?, (is-reference)?, (is-description)?, - (include)* + (include)*, + (no-translation)? )> <!ATTLIST field name CDATA #REQUIRED @@ -467,6 +469,7 @@ (security-role)?, (hide|no-hide)?, (view-filter)? + , (no-translation)? )> <!ATTLIST select name CDATA #REQUIRED @@ -498,7 +501,7 @@ the rest of types, the substring after "like" is currently neglected. parameter indicates whether this is a parameter to the method or not (allows you to reuse a parameter more than once) --> -<!ELEMENT selection (suggest)?> +<!ELEMENT selection (suggest)?, (no-translation)?> <!ATTLIST selection field CDATA #REQUIRED table CDATA #IMPLIED @@ -536,13 +539,13 @@ An action can have parameters. The type of these has to be defined as well. Parameters should be either simple types, of fully qualified --> -<!ELEMENT action ((description)?, (parameter|%param.tag;)*, security-role?, (hide|no-hide)?)> +<!ELEMENT action ((description)?, (parameter|%param.tag;)*, security-role?, (hide|no-hide)?, (no-translation)?)> <!ATTLIST action name CDATA #REQUIRED return CDATA "void" > -<!ELEMENT parameter ((description)?, (suggest)?, (case)?)> +<!ELEMENT parameter ((description)?, (suggest)?, (case)?, (no-translation)?)> <!ATTLIST parameter type CDATA #REQUIRED name CDATA #IMPLIED Modified: trunk/Uni-d/tool/src/main/java/be/unid/tool/translationsEditor/TranslationsEditor.java =================================================================== --- trunk/Uni-d/tool/src/main/java/be/unid/tool/translationsEditor/TranslationsEditor.java 2008-11-18 14:42:06 UTC (rev 3713) +++ trunk/Uni-d/tool/src/main/java/be/unid/tool/translationsEditor/TranslationsEditor.java 2008-11-18 17:16:15 UTC (rev 3714) @@ -317,7 +317,7 @@ keyEditorPanel.save(); savePreviousKey(); renameKey(); - deleteAllKey(f1.getText(), f2.getText()); + deleteAllKey( f1.getText(), f2.getText() ); refresh = true; } } ); @@ -710,20 +710,14 @@ Map<Key, FastMap<String, Translation>> all = modelInfo.getTranslations(); - //System.out.println( "Load translation : " + keySearch1 + " : " + keySearch2 + "=" + model.getRowCount() + ":=" + modelInfo.getRowCount() ); - for ( Key k : all.keySet() ) { -// System.out.println( "1" ); FastMap<String, Translation> trans = all.get( k ); boolean isGood = false; -// System.out.println( "2" ); if ( keySearch1 != null && keySearch2 == null && k.getKey().startsWith( keySearch1 ) ) { - //System.out.println( "isGod => " + k.getKey() + " : " + keySearch1 + " : " + keySearch2 ); isGood = true; } -// System.out.println( "3" ); if ( trans != null ) { for ( String lang : trans.keySet() ) @@ -731,107 +725,36 @@ if ( keySearch2 != null && keySearch1 == null && trans.get( lang ).getLabel() != null && trans.get( lang ).getLabel().startsWith( keySearch2 ) ) { - //System.out.println( "isGod => " + k.getKey() + " : " + keySearch1 + " : " + keySearch2 ); isGood = true; } else if ( keySearch2 != null && keySearch1 != null && trans.get( lang ).getLabel() != null && trans.get( lang ).getLabel().startsWith( keySearch2 ) && k.getKey().startsWith( keySearch1 ) ) { - //System.out.println( "isGod => " + k.getKey() + " : " + keySearch1 + " : " + keySearch2 ); isGood = true; } } } -// System.out.println( "4" ); - //System.out.println( k.getKey() + " : " + isGood ); if ( isGood ) { - //System.out.println( "==============>" + k.getKey() ); model.addKey( k ); for ( String lang : trans.keySet() ) { try { Translation translation = trans.get( lang ); - //System.out.println( "adauga ==============>" + k.getKey() + ":" + lang + ":" +( translation == null ? "null" : translation.getLabel() ) ); model.addTranslation( k, lang, translation ); } catch ( Exception e ) { - //System.out.println( "Exceptie isGood : " + e.toString() ); model.addTranslation( k, lang, new Translation() ); } } } } - System.out.println( "Finished translation" ); - - /* - for ( String language : languages ) - { - Map<Key, Translation> mapFromParser = parser.getTranslations( language ); - for ( Key key : mapFromParser.keySet() ) - { - if ( keySearch1 != null && keySearch2 == null ) - { - if ( key.getKey().startsWith( keySearch1 ) ) - { - model.addKey( key ); - model.addTranslation( key, language, mapFromParser.get( key ) ); - } - - } - else if ( keySearch2 != null && keySearch1 == null ) - { - if ( mapFromParser.get( key ).getLabel() != null && - mapFromParser.get( key ).getLabel().startsWith( keySearch2 ) ) - { - model.addKey( key ); - model.addTranslation( key, language, mapFromParser.get( key ) ); - } - } - else if ( keySearch1 != null && keySearch2 != null ) - { - if ( key.getKey().startsWith( keySearch1 ) && - ( - ( mapFromParser.get( key ).getLabel() != null && - mapFromParser.get( key ).getLabel().startsWith( keySearch2 ) ) || - ( mapFromParser.get( key ) - .getCaption() != - null && - mapFromParser - .get( - key ) - .getCaption() - .startsWith( - keySearch2 ) ) || - ( mapFromParser - .get( - key ) - .getHelp() != - null && - mapFromParser - .get( - key ) - .getHelp() - .startsWith( - keySearch2 ) ) - ) - ) - { - model.addKey( key ); - model.addTranslation( key, language, mapFromParser.get( key ) ); - } - } - } - } - */ System.out.println( "done" ); - //System.out.println( "Total: " + model.getRowCount() + " keys." ); - //System.out.println( "Total info : " + modelInfo.getRowCount() + " keys." ); } private void deleteKey() @@ -901,6 +824,7 @@ for ( int t = 0; t < tables.getLength() ; t++ ) { OMRootTable table = (OMRootTable) tables.item( t ); + if ( table.isNoTranslation() ) continue; importDbKey( "table." + table.getName(), table.getName(), dbItems, addToModel ); importDbKey( "category." + table.getCategory(), table.getCategory(), dbItems, addToModel ); @@ -912,6 +836,7 @@ for ( OMField field : table.getFields() ) { + if ( field.isNoTranslation() ) continue; importDbKey( "field." + table.getName() + "." + field.getName(), field.getName(), dbItems, addToModel ); for ( OMChoice choice : field.getChoices() ) @@ -926,31 +851,37 @@ } for ( OMPage page : table.getPages() ) { + if ( page.isNoTranslation() ) continue; importDbKey( "page." + table.getName() + "." + page.getName(), page.getName(), dbItems, addToModel ); for ( OMGroup group : page.getGroupsDeep() ) { + if ( group.isNoTranslation() ) continue; importDbKey( "group." + table.getName() + "." + group.getName(), group.getName(), dbItems, addToModel ); } } for ( OMSelect select : table.getSelects() ) { + if ( select.isNoTranslation() ) continue; importDbKey( "select." + table.getName() + "." + select.getName(), select.getName(), dbItems, addToModel ); for ( OMSelection selection : select.getSelections() ) { + if ( selection.isNoTranslation() ) continue; importDbKey( "parameter." + table.getName() + "." + select.getName() + "." + selection.getName(), selection.getName(), dbItems, addToModel ); } } for ( OMAction action : table.getActions() ) { + if ( action.isNoTranslation() ) continue; importDbKey( "action." + table.getName() + "." + action.getName(), action.getName(), dbItems, addToModel ); for ( OMParameter parameter : action.getParameters() ) { + if ( parameter.isNoTranslation() ) continue; importDbKey( "param." + table.getName() + "." + action.getName() + "." + parameter.getName(), parameter.getName(), dbItems, addToModel ); @@ -1048,8 +979,6 @@ String lastKey = ""; String lastContext = ""; - //System.out.println( "Save Total: " + model.getRowCount() + " keys." ); - //System.out.println( "Save Total info : " + modelInfo.getRowCount() + " keys." ); try { BufferedWriter writer = @@ -1077,7 +1006,6 @@ line.append( ".key " ); - //System.out.println( "Save : " + key.getKey() ); line.append( key.getKey() ); if ( key.getContext() != null && key.getContext().length() > 0 ) @@ -1095,7 +1023,6 @@ Translation translation = translations.get( language ); if ( translation != null ) { - //System.out.println( "Label : " + translation.getLabel() ); writeTranslationToFile( writer, line, language, ".label", translation.getLabel() ); writeTranslationToFile( writer, line, language, ".caption", translation.getCaption() ); writeTranslationToFile( writer, line, language, ".help", translation.getHelp() ); @@ -1114,63 +1041,7 @@ } } - /* - private void save() - { - try - { - BufferedWriter writer = - new BufferedWriter( - new OutputStreamWriter( new FileOutputStream( config.getTargetFile() ), "UTF-8" ) ); - writer.write( ";Last edited: " + new Date( System.currentTimeMillis() ) + '\n' ); - TextBuilder line = TextBuilder.newInstance(); - line.append( ".languages " ); - for ( int i = 0; i < languages.length ; i++ ) - { - if ( i > 0 ) line.append( ';' ); - line.append( languages[ i ] ); - } - line.append( '\n' ); - writer.write( line.toString() ); - for ( int i = 0; i < model.getRowCount() ; i++ ) - { - line.reset(); - Key key = model.getKeyAtIndex( i ); - line.append( ".key " ); - line.append( key.getKey() ); - if ( key.getContext() != null && key.getContext().length() > 0 ) - { - line.append( '/' ); - line.append( key.getContext() ); - } - line.append( '\n' ); - writer.write( line.toString() ); - Map<String, Translation> translations = model.getTranslation( key ); - if ( translations != null ) - { - for ( String language : languages ) - { - Translation translation = translations.get( language ); - if ( translation != null ) - { - writeTranslationToFile( writer, line, language, ".label", translation.getLabel() ); - writeTranslationToFile( writer, line, language, ".caption", translation.getCaption() ); - writeTranslationToFile( writer, line, language, ".help", translation.getHelp() ); - } - } - } - } - writer.close(); - } - catch ( IOException e ) - { - showError( "Failed to save file" ); - log.error( e, e ); - e.printStackTrace(); - } - } - */ private void writeTranslationToFile( BufferedWriter writer, TextBuilder line, String language, String tag, String translation ) throws IOException @@ -1194,7 +1065,7 @@ { if ( table.getSelectedRow() == -1 ) return; -// save previous key: + // save previous key: keyEditorPanel.save(); Key key = model.getKeyAtIndex( table.getSelectedRow() ); @@ -1227,7 +1098,7 @@ java.util.List<String> currentDbKeys = importDbContent( false ); int countUnused = 0; - for ( int i=model.getRowCount()-1; i>=0; i-- ) + for ( int i = model.getRowCount() - 1; i >= 0 ; i-- ) { Key key = model.getKeyAtIndex( i ); @@ -1238,7 +1109,7 @@ countUnused++; } } - for ( int i=modelInfo.getRowCount()-1; i>=0; i-- ) + for ( int i = modelInfo.getRowCount() - 1; i >= 0 ; i-- ) { Key key = modelInfo.getKeyAtIndex( i ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2009-01-06 18:58:22
|
Revision: 3731 http://uni-d.svn.sourceforge.net/uni-d/?rev=3731&view=rev Author: max_brod Date: 2009-01-06 18:58:18 +0000 (Tue, 06 Jan 2009) Log Message: ----------- [ICT-1396] Make the selects by Description parts/starts case independent. There are new indeces for description-field, based on uppercase values. Modified Paths: -------------- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMSelect.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java trunk/Uni-d/generate/src/main/velocity/ddltool/Map.java.vm trunk/Uni-d/tool/src/main/java/be/unid/tool/ddltool/DatabaseMap.java trunk/Uni-d/tool/src/main/java/be/unid/tool/ddltool/JdbcManager.java Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMSelect.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMSelect.java 2009-01-05 15:42:20 UTC (rev 3730) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMSelect.java 2009-01-06 18:58:18 UTC (rev 3731) @@ -152,7 +152,7 @@ * @param fieldName * @param query */ - OMSelect( String name, OMTable table, OMRootTable root, String fieldName, String query ) + OMSelect( String name, OMTable table, OMRootTable root, String fieldName, String query, boolean single, boolean hide, boolean noTranslation ) { this.name = name; this.table = table; @@ -167,10 +167,10 @@ selection = new OMSelection( this, table, table.getField( fieldName ), "=" ); selections.add( selection ); } - single = true; + this.single = single; setQuery( query ); - hide = true; - noTranslation = true; + this.hide = hide; + this.noTranslation = true; } public String[] getRequiredAttributes() Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java 2009-01-05 15:42:20 UTC (rev 3730) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java 2009-01-06 18:58:18 UTC (rev 3731) @@ -665,14 +665,16 @@ OMSelect selFirst = new OMSelect( "UnidFirst", this, this.getRoot(), null, "SELECT o FROM DM" + getRoot().getName() + "Bean o ORDER BY o." + - tmpRef.getVarName() ); + tmpRef.getVarName(), true, + true, + true ); addOMSelect( selFirst ); root.addOMSelect( selFirst ); OMSelect selPrevious = new OMSelect( "UnidPrevious", this, this.getRoot(), tmpRef.getName(), "SELECT o FROM DM" + getRoot().getName() + "Bean o WHERE o." + tmpRef.getVarName() + "<:" + tmpRef.getVarName() + " ORDER BY o." + - tmpRef.getVarName() + " DESCENDING" ); + tmpRef.getVarName() + " DESCENDING", true, true, true ); addOMSelect( selPrevious ); root.addOMSelect( selPrevious ); @@ -680,14 +682,15 @@ getRoot().getName() + "Bean o ORDER BY o." + tmpRef.getVarName() + - " DESCENDING" ); + " DESCENDING", true, true, + true ); addOMSelect( selLast ); root.addOMSelect( selLast ); OMSelect selNext = new OMSelect( "UnidNext", this, this.getRoot(), tmpRef.getName(), "SELECT o FROM DM" + getRoot().getName() + "Bean o WHERE o." + tmpRef.getVarName() + ">:" + tmpRef.getVarName() + " ORDER BY o." + - tmpRef.getVarName() + " ASCENDING" ); + tmpRef.getVarName() + " ASCENDING", true, true, true ); addOMSelect( selNext ); root.addOMSelect( selNext ); @@ -695,12 +698,21 @@ if ( tmpDesc != null ) { root.setFieldDescription( tmpDesc ); - OMSelect selStart = new OMSelect( "Unid" + tmpDesc.getName() + "Start", this, getRoot(), - tmpDesc.getName(), false, false ); + OMSelect selStart = new OMSelect( "Unid" + tmpDesc.getName() + "Start", this, this.getRoot(), + tmpDesc.getName(), + "SELECT o FROM DM" + getRoot().getName() + "Bean o WHERE UPPER(o." + + tmpDesc.getVarName() + ") like CONCAT(UPPER(:" + tmpDesc.getVarName() + + "), '%') ORDER BY o." + + tmpDesc.getVarName() + " ASCENDING", false, false, false ); + addOMSelect( selStart ); root.addOMSelect( selStart ); - OMSelect selPart = new OMSelect( "Unid" + tmpDesc.getName() + "Part", this, getRoot(), - tmpDesc.getName(), true, false ); + OMSelect selPart = new OMSelect( "Unid" + tmpDesc.getName() + "Part", this, this.getRoot(), + tmpDesc.getName(), + "SELECT o FROM DM" + getRoot().getName() + "Bean o WHERE UPPER(o." + + tmpDesc.getVarName() + ") like CONCAT('%', CONCAT(UPPER(:" + tmpDesc.getVarName() + + "), '%')) ORDER BY o." + + tmpDesc.getVarName() + " ASCENDING", false, false, false ); addOMSelect( selPart ); root.addOMSelect( selPart ); } Modified: trunk/Uni-d/generate/src/main/velocity/ddltool/Map.java.vm =================================================================== --- trunk/Uni-d/generate/src/main/velocity/ddltool/Map.java.vm 2009-01-05 15:42:20 UTC (rev 3730) +++ trunk/Uni-d/generate/src/main/velocity/ddltool/Map.java.vm 2009-01-06 18:58:18 UTC (rev 3731) @@ -14,7 +14,8 @@ implements be.unid.tool.ddltool.DatabaseMap { - private Hashtable<String, Collection<String>> map = null; + private Hashtable<String, Collection<String>> indexedFieldsMap = null; + private Hashtable<String, Collection<String>> upperCaseIndexedFieldsMap = null; private Collection<String> tables = null; private Collection<String[]> tablesForMultiple = null; // [0] -table name; [1] -field name; [2] -definition private Collection<String[]> tablesForLinks = null; // [0] -table name; [1] -1st field name; [2] -second field name; [3] -true/false unique constraint @@ -24,13 +25,14 @@ public void init() { - /* Init table unique columns*/ - map = new Hashtable<String, Collection<String>>(); + indexedFieldsMap = new Hashtable<String, Collection<String>>(); + upperCaseIndexedFieldsMap = new Hashtable<String, Collection<String>>(); tables = new ArrayList<String>(); tablesForMultiple = new ArrayList<String[]>(); tablesForLinks = new ArrayList<String[]>(); dbFields = new Hashtable<String, Collection<String>>(); - Collection<String> columns = null; + Collection<String> indexedFields = null; + Collection<String> upperCaseIndexedFields = null; Collection<String> fields = null; #macro( getDefault $field ) @@ -64,15 +66,19 @@ #foreach( $table in $tables ) #set( $tableName = $dbtype.convertTable("T_${table.Name}") ) - columns = new ArrayList<String>(); + indexedFields = new ArrayList<String>(); + upperCaseIndexedFields = new ArrayList<String>(); fields = new ArrayList<String>(); - columns.add( "UNID_MODIFIED" ); + indexedFields.add( "UNID_MODIFIED" ); fields.add( "UNID_VERSION INTEGER default 0 not null" ); #foreach( $field in $table.Fields ) #set( $fieldName = $dbtype.convertField("f_${field.Name}") ) #if( $field.isUnique() || $field.isIndexed() ) - columns.add( "$fieldName" ); + indexedFields.add( "$fieldName" ); #end + #if( $field.isDescription() || $field.getName().toUpperCase().equals( "DESCRIPTION" ) || $field.getName().toUpperCase().equals( "NAME" ) ) + upperCaseIndexedFields.add("$fieldName"); + #end #if( !$field.isLink() && !$field.isMultiple() ) #set( $fieldDef="" ) #set( $default="" ) @@ -86,7 +92,8 @@ #end##!isBidir || owner #end #end - map.put( "$tableName", columns ); + indexedFieldsMap.put( "$tableName", indexedFields ); + upperCaseIndexedFieldsMap.put( "$tableName", upperCaseIndexedFields ); dbFields.put( "$tableName", fields ); #end ## tables foreach @@ -127,8 +134,10 @@ #end } - public Hashtable<String, Collection<String>> getIndexedFields() { return map; } + public Hashtable<String, Collection<String>> getIndexedFields() { return indexedFieldsMap; } + public Hashtable<String, Collection<String>> getUpperCaseIndexedFields() { return upperCaseIndexedFieldsMap; } + public Collection<String> getTables() { return tables; } public Collection<String[]> getTablesForMultiples() { return tablesForMultiple; } Modified: trunk/Uni-d/tool/src/main/java/be/unid/tool/ddltool/DatabaseMap.java =================================================================== --- trunk/Uni-d/tool/src/main/java/be/unid/tool/ddltool/DatabaseMap.java 2009-01-05 15:42:20 UTC (rev 3730) +++ trunk/Uni-d/tool/src/main/java/be/unid/tool/ddltool/DatabaseMap.java 2009-01-06 18:58:18 UTC (rev 3731) @@ -41,6 +41,12 @@ /* Return unique columns for each table */ public Hashtable<String, Collection<String>> getIndexedFields(); + + /* Return list of columns (for each table) for which we will create indeces with custom expression. + * Eg: CREATE INDEX IDX_PERSON_LASTNAME ON PERSONS COMPUTED BY (UPPER (LAST_NAME)) + * */ + public Hashtable<String, Collection<String>> getUpperCaseIndexedFields(); + /* Return all tables */ public Collection<String> getTables(); Modified: trunk/Uni-d/tool/src/main/java/be/unid/tool/ddltool/JdbcManager.java =================================================================== --- trunk/Uni-d/tool/src/main/java/be/unid/tool/ddltool/JdbcManager.java 2009-01-05 15:42:20 UTC (rev 3730) +++ trunk/Uni-d/tool/src/main/java/be/unid/tool/ddltool/JdbcManager.java 2009-01-06 18:58:18 UTC (rev 3731) @@ -130,13 +130,12 @@ return result; } - private boolean createIndex( String tableName, String columnName ) + private boolean createIndex( String tableName, String indexName, String expression ) // String columnName ) { boolean result = true; try { - String query = "CREATE INDEX " + getIndexName( tableName, columnName ) + " ON " + - tableName + '(' + columnName + ')'; + String query = "CREATE INDEX " + indexName + " ON " + tableName + expression; executeQuery( query ); } catch ( SQLException e ) @@ -148,9 +147,9 @@ return result; } - private String getIndexName( String tableName, String columnName ) + private String getIndexName( String tableName, String columnName, String prefix ) { - StringBuffer name = new StringBuffer( "I_" ); + StringBuffer name = new StringBuffer( prefix ); if ( tableName.length() < 5 ) { name.append( tableName ); @@ -224,8 +223,10 @@ boolean result = true; try { - String index = getIndexName( table, field ); + String index = getIndexName( table, field, "I_" ); if ( !isIndexAvailable( index, table ) ) dropIndex( index ); + index = getIndexName( table, field, "I2_" ); + if ( !isIndexAvailable( index, table ) ) dropIndex( index ); String query = "ALTER TABLE " + table + " DROP " + field; executeQuery( query ); } @@ -345,7 +346,7 @@ while ( it.hasNext() ) { String colName = it.next(); - if ( !createIndex( tableName, colName ) ) + if ( !createIndex( tableName, getIndexName( tableName, colName, "I_" ), '(' + colName + ')' ) ) { log.error( "On table " + tableName + " index not created!" ); } @@ -355,6 +356,28 @@ } } } + + dbMap = map.getUpperCaseIndexedFields(); + cols = dbMap.keys(); + while ( cols.hasMoreElements() ) + { + String tableName = cols.nextElement(); + Collection<String> columns = dbMap.get( tableName ); + it = columns.iterator(); + while ( it.hasNext() ) + { + String colName = it.next(); + if ( !createIndex( tableName, getIndexName( tableName, colName, "I2_" ), " COMPUTED BY (UPPER ("+colName+")) " ) ) + { + log.error( "On table " + tableName + " index not created!" ); + } + else + { + log.info( "On table " + tableName + " index created." ); + } + } + + } } private boolean addPrimaryKey( String table ) @@ -631,7 +654,7 @@ } if ( update ) { - updateField( tableName, fieldName, fieldType,field ); + updateField( tableName, fieldName, fieldType, field ); log.info( "Field updated: " + field ); } } @@ -640,7 +663,8 @@ private void updateField( String tableName, String fieldName, String fieldType, String fieldDef ) { - if (fieldType.startsWith("SMALLINT") || fieldType.startsWith("INTEGER") || fieldType.startsWith("DOUBLE PRECISION")) + if ( fieldType.startsWith( "SMALLINT" ) || fieldType.startsWith( "INTEGER" ) || + fieldType.startsWith( "DOUBLE PRECISION" ) ) { return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2009-01-09 11:26:31
|
Revision: 3733 http://uni-d.svn.sourceforge.net/uni-d/?rev=3733&view=rev Author: max_brod Date: 2009-01-09 11:26:18 +0000 (Fri, 09 Jan 2009) Log Message: ----------- [ICT-1400] Changes for indices. Make sure all indices are retrieved (for removing them from the database). Make sure all indices are created (they were not unique). Used hashcodes instead of field names. Modified Paths: -------------- trunk/Uni-d/generate/src/main/velocity/ddltool/Map.java.vm trunk/Uni-d/tool/src/main/java/be/unid/tool/ddltool/JdbcManager.java Modified: trunk/Uni-d/generate/src/main/velocity/ddltool/Map.java.vm =================================================================== --- trunk/Uni-d/generate/src/main/velocity/ddltool/Map.java.vm 2009-01-08 09:27:54 UTC (rev 3732) +++ trunk/Uni-d/generate/src/main/velocity/ddltool/Map.java.vm 2009-01-09 11:26:18 UTC (rev 3733) @@ -76,9 +76,11 @@ #if( $field.isUnique() || $field.isIndexed() ) indexedFields.add( "$fieldName" ); #end + #if( $field.isString() ) #if( $field.isDescription() || $field.getName().toUpperCase().equals( "DESCRIPTION" ) || $field.getName().toUpperCase().equals( "NAME" ) ) upperCaseIndexedFields.add("$fieldName"); #end + #end #if( !$field.isLink() && !$field.isMultiple() ) #set( $fieldDef="" ) #set( $default="" ) Modified: trunk/Uni-d/tool/src/main/java/be/unid/tool/ddltool/JdbcManager.java =================================================================== --- trunk/Uni-d/tool/src/main/java/be/unid/tool/ddltool/JdbcManager.java 2009-01-08 09:27:54 UTC (rev 3732) +++ trunk/Uni-d/tool/src/main/java/be/unid/tool/ddltool/JdbcManager.java 2009-01-09 11:26:18 UTC (rev 3733) @@ -150,32 +150,15 @@ private String getIndexName( String tableName, String columnName, String prefix ) { StringBuffer name = new StringBuffer( prefix ); - if ( tableName.length() < 5 ) - { - name.append( tableName ); - } - else - { - StringBuffer camel = new StringBuffer(); + String hashcode = Integer.toString( ( tableName ).hashCode() ); + if ( hashcode.startsWith( "-" ) ) hashcode = hashcode.substring( 1 ); + name.append( hashcode ); - for ( int i = 0; i < tableName.length() ; i++ ) - { - if ( Character.isUpperCase( tableName.charAt( i ) ) ) - { - camel.append( tableName.charAt( i ) ); - } - } - if ( camel.length() > 1 ) - { - name.append( camel ); - } - else - { - name.append( tableName.substring( 0, 5 ) ); - } - } name.append( '_' ); - name.append( columnName ); + hashcode = Integer.toString( columnName.hashCode() ); + if ( hashcode.startsWith( "-" ) ) hashcode = hashcode.substring( 1 ); + name.append( hashcode ); + if ( name.length() > 27 ) { return validateIndexName( name.substring( 0, 27 ), tableName ); @@ -244,10 +227,20 @@ Collection<String> col = new ArrayList<String>(); try { - ResultSet rs = connection.getMetaData().getIndexInfo( null, null, tableName, false, false ); + // unfortunately, this doesn't return the expression index + /*ResultSet rs = connection.getMetaData().getIndexInfo( null, null, tableName, false, false ); while ( rs.next() ) { + System.out.println("an index: "+rs.getString("INDEX_NAME")); col.add( rs.getString( "INDEX_NAME" ) ); + } */ + Statement st = connection.createStatement(); + ResultSet rs = + st.executeQuery( "SELECT RDB$INDEX_NAME FROM RDB$INDICES WHERE RDB$RELATION_NAME='" + + tableName.toUpperCase() + "'" ); + while ( rs.next() ) + { + col.add( rs.getString( "RDB$INDEX_NAME" ).trim() ); } } catch ( SQLException e ) @@ -293,23 +286,16 @@ private boolean isIndexAvailable( String indexName, String tableName ) { - try + Collection<String> indices = getTableIndexes( tableName ); + + for ( String tmp : indices ) { - ResultSet rs = connection.getMetaData().getIndexInfo( null, null, tableName, false, false ); - while ( rs.next() ) + if ( tmp.equalsIgnoreCase( indexName ) ) { - String tmp = rs.getString( "INDEX_NAME" ); - if ( tmp.equalsIgnoreCase( indexName ) ) - { - return false; - } + return false; } } - catch ( SQLException e ) - { - System.err.println( e ); - log.error( e, e ); - } + return true; } @@ -367,7 +353,8 @@ while ( it.hasNext() ) { String colName = it.next(); - if ( !createIndex( tableName, getIndexName( tableName, colName, "I2_" ), " COMPUTED BY (UPPER ("+colName+")) " ) ) + if ( !createIndex( tableName, getIndexName( tableName, colName, "I2_" ), + " COMPUTED BY (UPPER (" + colName + ")) " ) ) { log.error( "On table " + tableName + " index not created!" ); } @@ -377,7 +364,7 @@ } } - } + } } private boolean addPrimaryKey( String table ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2009-01-16 15:29:07
|
Revision: 3734 http://uni-d.svn.sourceforge.net/uni-d/?rev=3734&view=rev Author: max_brod Date: 2009-01-16 15:28:55 +0000 (Fri, 16 Jan 2009) Log Message: ----------- [UNI-438] Generate a finder findUnidFullText, to search some text (case insensitive) in all fields of that table marked as "full-text-searchable". Modified Paths: -------------- trunk/Uni-d/docs/src/wiki/GUI-Descriptors-model.mm trunk/Uni-d/docs/src/wiki/object-model.mm trunk/Uni-d/docs/src/wiki/reports.mm trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMField.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMSelect.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/UnidNodesMap.java trunk/Uni-d/generate/src/main/resources/uni-d.dtd trunk/Uni-d/generate/src/main/velocity/ddltool/Map.java.vm trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Field.xml.vm trunk/Uni-d/generate/src/test/java/be/unid/generate/AllTest.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMField.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/tableManager/TableManagerPage.java trunk/Uni-d/test/src/uni-d/xejb/CocoonMan.table Added Paths: ----------- trunk/Uni-d/generate/src/test/java/be/unid/generate/FullTextSearchableChecks.java trunk/Uni-d/generate/src/test/resources/FullTextSearchableChecks/ trunk/Uni-d/generate/src/test/resources/FullTextSearchableChecks/NotStringSearchable.xml Modified: trunk/Uni-d/docs/src/wiki/GUI-Descriptors-model.mm =================================================================== --- trunk/Uni-d/docs/src/wiki/GUI-Descriptors-model.mm 2009-01-09 11:26:18 UTC (rev 3733) +++ trunk/Uni-d/docs/src/wiki/GUI-Descriptors-model.mm 2009-01-16 15:28:55 UTC (rev 3734) @@ -105,7 +105,10 @@ <node COLOR="#338800" CREATED="1146208164149" ID="Freemind_Link_79609209" MODIFIED="1146208174269" TEXT="value"/> <node COLOR="#338800" CREATED="1146208165984" ID="Freemind_Link_1099480779" MODIFIED="1146208174655" TEXT="class"/> </node> +<node COLOR="#006699" CREATED="1232032809000" ID="Freemind_Link_765401990" MODIFIED="1232032814593" TEXT="full-text-searchable"> +<node CREATED="1232032820062" ID="Freemind_Link_877680142" MODIFIED="1232032822250" TEXT="An indication that this file will be used for the "full-text-seach" finder that we create for its table "/> </node> +</node> <node COLOR="#006699" CREATED="1146160971236" ID="Freemind_Link_1059193234" MODIFIED="1176299601265" TEXT="group*"> <node COLOR="#338800" CREATED="1146207366299" ID="Freemind_Link_420463932" MODIFIED="1146207371262" TEXT="name"/> <node COLOR="#338800" CREATED="1146207302346" ID="Freemind_Link_1681255860" MODIFIED="1146207373871" TEXT="table-names"> Modified: trunk/Uni-d/docs/src/wiki/object-model.mm =================================================================== (Binary files differ) Modified: trunk/Uni-d/docs/src/wiki/reports.mm =================================================================== --- trunk/Uni-d/docs/src/wiki/reports.mm 2009-01-09 11:26:18 UTC (rev 3733) +++ trunk/Uni-d/docs/src/wiki/reports.mm 2009-01-16 15:28:55 UTC (rev 3734) @@ -1,4 +1,4 @@ -<map version="0.8.0"> +<map version="0.8.1"> <!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net --> <node CREATED="1152978962957" MODIFIED="1152978962957" TEXT="reports"> <node COLOR="#006699" CREATED="1152978962957" ID="Freemind_Link_1076312022" MODIFIED="1152978962957" POSITION="right" TEXT="report*"> @@ -12,6 +12,15 @@ <node COLOR="#006699" CREATED="1152978962957" MODIFIED="1152978962957" TEXT="label"> <node CREATED="1152978962957" MODIFIED="1152978962957" TEXT="Used in GUI, for internationalization"/> </node> +<node COLOR="#006699" CREATED="1232032935000" ID="Freemind_Link_174403621" MODIFIED="1232032940062" TEXT="hide-if "> +<node CREATED="1232032981062" ID="Freemind_Link_220708775" MODIFIED="1232032992781" TEXT="this report should be hidden depending on a condition"/> +<node COLOR="#669900" CREATED="1232032995500" ID="Freemind_Link_207527300" MODIFIED="1232032999875" TEXT="class"> +<node CREATED="1232033005234" ID="Freemind_Link_1517777485" MODIFIED="1232033043406" TEXT="name of a class implementing be.unid.reporting.validation.ReportHideIfValidator"/> +</node> +<node COLOR="#669900" CREATED="1232033045687" ID="Freemind_Link_565448556" MODIFIED="1232033050281" TEXT="parameters"> +<node CREATED="1232033088531" ID="Freemind_Link_708135524" MODIFIED="1232033110828" TEXT="a string which is passed to the hide-if class (a module name would be an example)"/> +</node> +</node> <node COLOR="#006699" CREATED="1152978962957" MODIFIED="1152978962957" TEXT="parameter"> <node COLOR="#669900" CREATED="1152978962957" MODIFIED="1152978962957" TEXT="name"> <node CREATED="1152978962957" MODIFIED="1152978962957" TEXT="The name of the parameter, as it appears in the Jasper report file. 
This is expected to be prefixed, the prefix showing the type. (That is used in the Reporting Servlet).
Prefix should be one of:
i (integer).
f (double).
d (date).
t (time).
b (boolean).
Default is string."/> Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMField.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMField.java 2009-01-09 11:26:18 UTC (rev 3733) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMField.java 2009-01-16 15:28:55 UTC (rev 3734) @@ -130,6 +130,7 @@ private String caseConversion; // "upper", "lower", "mixed", or a class name String unidType; // the type just as it is given in the table descriptors (needed later in the gui-descriptors) String renderer; + private boolean fullTextSearchable; // constraints boolean immutable; @@ -151,7 +152,7 @@ "default", "use-relation-table", "use-relation-field", "suggest", "cloneable", "not-cloneable", "constraints", "display", "no-display", "hide", "no-hide", "ws-value", "ws-role", "buildvalue", "indexed", "case", "security-role", "if", - "is-reference", "is-description", "embedded", "include", "no-translation" }; + "is-reference", "is-description", "embedded", "include", "no-translation", "full-text-searchable" }; private static final String[] requiredAttributes = { "name" }; @@ -890,6 +891,17 @@ valueWhenZero = true; } + else if ( tag.equals( "full-text-searchable" ) ) + { + if ( !isString() ) + { + gen.setFailed( true ); + SaveException.error( + "Field " + table.getName() + '.' + this.name + " is not string so it cannot be text-searchable" ); + return false; + } + fullTextSearchable = true; + } else if ( tag.equals( "compare" ) ) { if ( attr.getValue( "value" ) == null ) @@ -1572,6 +1584,11 @@ return false; } + public boolean isFullTextSearchable() + { + return fullTextSearchable; + } + public boolean isReference() { return fieldReference; Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMSelect.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMSelect.java 2009-01-09 11:26:18 UTC (rev 3733) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMSelect.java 2009-01-16 15:28:55 UTC (rev 3734) @@ -1059,4 +1059,13 @@ public String getViewFilter() { return viewFilter; } + public void setHide( boolean hide ) + { + this.hide = hide; + } + + public void setNoTranslation( boolean noTranslation ) + { + this.noTranslation = noTranslation; + } } Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java 2009-01-09 11:26:18 UTC (rev 3733) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java 2009-01-16 15:28:55 UTC (rev 3734) @@ -32,6 +32,7 @@ import be.unid.util.xml.tree.*; import javolution.util.FastMap; import javolution.xml.sax.Attributes; +import javolution.lang.TextBuilder; import java.io.File; import java.io.FilenameFilter; @@ -701,7 +702,8 @@ OMSelect selStart = new OMSelect( "Unid" + tmpDesc.getName() + "Start", this, this.getRoot(), tmpDesc.getName(), "SELECT o FROM DM" + getRoot().getName() + "Bean o WHERE UPPER(o." + - tmpDesc.getVarName() + ") like CONCAT(UPPER(:" + tmpDesc.getVarName() + + tmpDesc.getVarName() + ") like CONCAT(UPPER(:" + + tmpDesc.getVarName() + "), '%') ORDER BY o." + tmpDesc.getVarName() + " ASCENDING", false, false, false ); @@ -710,7 +712,8 @@ OMSelect selPart = new OMSelect( "Unid" + tmpDesc.getName() + "Part", this, this.getRoot(), tmpDesc.getName(), "SELECT o FROM DM" + getRoot().getName() + "Bean o WHERE UPPER(o." + - tmpDesc.getVarName() + ") like CONCAT('%', CONCAT(UPPER(:" + tmpDesc.getVarName() + + tmpDesc.getVarName() + ") like CONCAT('%', CONCAT(UPPER(:" + + tmpDesc.getVarName() + "), '%')) ORDER BY o." + tmpDesc.getVarName() + " ASCENDING", false, false, false ); addOMSelect( selPart ); @@ -721,6 +724,51 @@ referenceField = tmpRef; + boolean hasFullTextSearchableFields = false; + for ( OMField field : getFields() ) + { + if ( field.isFullTextSearchable() ) + { + hasFullTextSearchableFields = true; + break; + } + } + if ( hasFullTextSearchableFields ) + { + OMSelect selFullText = new OMSelect(); + selFullText.setHide( true ); + selFullText.setNoTranslation( true ); + selFullText.setName( "UnidFullText" ); + selFullText.setSecurityRole( getSecurityRole() ); + selFullText.setTableName( name ); + selFullText.setRootTable( this.getRoot() ); + TextBuilder query = TextBuilder.newInstance(); + query.append( "SELECT o FROM DM" + getRoot().getName() + "Bean o WHERE " ); + + OMField firstField = null; + String separator = ""; + + for ( OMField field : getFields() ) + { + if ( field.isFullTextSearchable() ) + { + if ( firstField == null ) + { + OMSelection selection = new OMSelection( selFullText, this, field, "like" ); + selFullText.getSelections().add( selection ); + firstField = field; + } + query.append( separator ); + separator = " OR "; + query.append( "UPPER(o." + field.getVarName() + ") like CONCAT('%', CONCAT(UPPER(:" + + firstField.getVarName() + "), '%'))" ); + } + } + selFullText.setQuery( query.toString() ); + addOMSelect( selFullText ); + root.addOMSelect( selFullText ); + } + if ( hasImmutableIf() ) { // replace all Strings with OMField instances in list Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/UnidNodesMap.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/UnidNodesMap.java 2009-01-09 11:26:18 UTC (rev 3733) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/UnidNodesMap.java 2009-01-16 15:28:55 UTC (rev 3734) @@ -120,5 +120,6 @@ put( "data-filter", null ); put( "view-filter", null ); put( "no-translation", null ); + put( "full-text-searchable", null ); } } Modified: trunk/Uni-d/generate/src/main/resources/uni-d.dtd =================================================================== --- trunk/Uni-d/generate/src/main/resources/uni-d.dtd 2009-01-09 11:26:18 UTC (rev 3733) +++ trunk/Uni-d/generate/src/main/resources/uni-d.dtd 2009-01-16 15:28:55 UTC (rev 3734) @@ -156,7 +156,13 @@ <!ELEMENT data-filter (#PCDATA)> +<!-- + An indication that we don't need translation for this item (and its children) +--> +<!ELEMENT no-translation EMPTY> + + <!-- Allow grouping of fields. In a GUI this could be represented by a box around the items. --> <!ELEMENT group ((description)?,(field|group|%param.tag;)*, (include)*, (hide|no-hide)?, (no-translation)?)> <!ATTLIST group @@ -203,7 +209,8 @@ (is-reference)?, (is-description)?, (include)*, - (no-translation)? + (no-translation)?, + (full-text-searchable)? )> <!ATTLIST field name CDATA #REQUIRED @@ -445,7 +452,12 @@ path CDATA #IMPLIED > +<!-- + An indication that this file will be used for the "full-text-seach" finder that we create for its table +--> +<!ELEMENT full-text-searchable EMPTY> + <!-- define a finder method which selects records based on the selection criteria A select can either define criteria (selection tags), or define a list of subselects. Modified: trunk/Uni-d/generate/src/main/velocity/ddltool/Map.java.vm =================================================================== --- trunk/Uni-d/generate/src/main/velocity/ddltool/Map.java.vm 2009-01-09 11:26:18 UTC (rev 3733) +++ trunk/Uni-d/generate/src/main/velocity/ddltool/Map.java.vm 2009-01-16 15:28:55 UTC (rev 3734) @@ -77,7 +77,7 @@ indexedFields.add( "$fieldName" ); #end #if( $field.isString() ) - #if( $field.isDescription() || $field.getName().toUpperCase().equals( "DESCRIPTION" ) || $field.getName().toUpperCase().equals( "NAME" ) ) + #if( $field.isDescription() || $field.getName().toUpperCase().equals( "DESCRIPTION" ) || $field.getName().toUpperCase().equals( "NAME" ) || $field.isFullTextSearchable() ) upperCaseIndexedFields.add("$fieldName"); #end #end Modified: trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Field.xml.vm =================================================================== --- trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Field.xml.vm 2009-01-09 11:26:18 UTC (rev 3733) +++ trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Field.xml.vm 2009-01-16 15:28:55 UTC (rev 3734) @@ -174,6 +174,9 @@ <hide if-class="$field.HideIfClass"/> #end +#if( $field.isFullTextSearchable() ) + <full-text-searchable/> +#end </field> #end \ No newline at end of file Modified: trunk/Uni-d/generate/src/test/java/be/unid/generate/AllTest.java =================================================================== --- trunk/Uni-d/generate/src/test/java/be/unid/generate/AllTest.java 2009-01-09 11:26:18 UTC (rev 3733) +++ trunk/Uni-d/generate/src/test/java/be/unid/generate/AllTest.java 2009-01-16 15:28:55 UTC (rev 3734) @@ -28,7 +28,6 @@ import junit.framework.TestSuite; import junit.framework.TestCase; - /** * grouping for test cases which check the genarator behavious * @@ -55,6 +54,7 @@ suite.addTestSuite( DefaultChecks.class ); suite.addTestSuite( DisplayChecks.class ); suite.addTestSuite( FailOnInvalidDefinition.class ); + suite.addTestSuite( FullTextSearchableChecks.class ); suite.addTestSuite( LinksChecks.class ); suite.addTestSuite( LobChecks.class ); suite.addTestSuite( MultipleChecks.class ); Added: trunk/Uni-d/generate/src/test/java/be/unid/generate/FullTextSearchableChecks.java =================================================================== --- trunk/Uni-d/generate/src/test/java/be/unid/generate/FullTextSearchableChecks.java (rev 0) +++ trunk/Uni-d/generate/src/test/java/be/unid/generate/FullTextSearchableChecks.java 2009-01-16 15:28:55 UTC (rev 3734) @@ -0,0 +1,58 @@ +/** + * This file is part of the Uni-d project. + * $Id$ + * + * The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF + * ANY KIND, either express or implied. See the License for the specific language governing rights and + * limitations under the License. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + */ +package be.unid.generate; + +import junit.framework.TestCase; +import be.unid.util.INIFile; +import be.unid.generate.Generator; + +/** + * Tests for full-text-search fields + * + * @author Florin + * @version $Revision$ + */ +public class FullTextSearchableChecks + extends TestCase +{ + private INIFile ini = new INIFile(); + + protected void setUp() + throws Exception + { + ini.addValue( "config", "template", "null" ); + ini.addValue( "config", "outputdir", "." ); + } + + public void testFailOnInvalidFieldType() + throws Exception + { + ini.addValue( "config", "definition", "classpath://FullTextSearchableChecks/NotStringSearchable.xml" ); + Generator gen = new Generator( ini, System.getProperty( "uni-d-test.omroot.dir" ) ); + gen.generate(); + gen.generate(); + assertTrue( gen.getFailed() ); + } +} Property changes on: trunk/Uni-d/generate/src/test/java/be/unid/generate/FullTextSearchableChecks.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/Uni-d/generate/src/test/resources/FullTextSearchableChecks/NotStringSearchable.xml =================================================================== --- trunk/Uni-d/generate/src/test/resources/FullTextSearchableChecks/NotStringSearchable.xml (rev 0) +++ trunk/Uni-d/generate/src/test/resources/FullTextSearchableChecks/NotStringSearchable.xml 2009-01-16 15:28:55 UTC (rev 3734) @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE uni-d SYSTEM "uni-d.dtd"> + +<uni-d> + <database name="test"> + <table name="Test"> + <page> + <field name="IntField" type="int"> + <full-text-searchable/> + </field> + </page> + </table> + </database> +</uni-d> + Property changes on: trunk/Uni-d/generate/src/test/resources/FullTextSearchableChecks/NotStringSearchable.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMField.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMField.java 2009-01-09 11:26:18 UTC (rev 3733) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMField.java 2009-01-16 15:28:55 UTC (rev 3734) @@ -65,6 +65,7 @@ boolean embedded; boolean otherSideEmbedded; protected String displayClass; + boolean fullTextSearchable; // constraints boolean immutable; @@ -203,6 +204,10 @@ hideIfClass = attr.getValue( "if-class" ).toString(); } } + else if ( tag.equals( "full-text-searchable" ) ) + { + fullTextSearchable = true; + } else { return super.canAppendChild( tag, attr ); @@ -449,4 +454,8 @@ public String getDisplayClass() { return displayClass; } + public boolean isFullTextSearchable() + { + return fullTextSearchable; + } } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/tableManager/TableManagerPage.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/tableManager/TableManagerPage.java 2009-01-09 11:26:18 UTC (rev 3733) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/tableManager/TableManagerPage.java 2009-01-16 15:28:55 UTC (rev 3734) @@ -90,7 +90,7 @@ if ( filterSet ) continue; } String sname = select.getName(); - if ( sname.regionMatches( true, 0, "Unid", 0, 4 ) && !sname.equalsIgnoreCase( "UnidAll" ) ) + if ( sname.regionMatches( true, 0, "Unid", 0, 4 ) && !sname.equalsIgnoreCase( "UnidAll" ) && !sname.equals("UnidFullText") ) { continue; } Modified: trunk/Uni-d/test/src/uni-d/xejb/CocoonMan.table =================================================================== --- trunk/Uni-d/test/src/uni-d/xejb/CocoonMan.table 2009-01-09 11:26:18 UTC (rev 3733) +++ trunk/Uni-d/test/src/uni-d/xejb/CocoonMan.table 2009-01-16 15:28:55 UTC (rev 3734) @@ -7,9 +7,11 @@ <field name="FirstName" type="string" length="20"> <display/> <case value="upper"/> + <full-text-searchable/> </field> <field name="LastName" type="string" length="15"> <display/> + <full-text-searchable/> </field> <field name="DateOfBirth" type="date"/> <field name="Sometime" type="timestamp" renderer="time,display=hms"/> @@ -18,6 +20,7 @@ <field name="NoOfChildren" type="int" display-length="3"/> <field name="PreviousJobs" type="string" length="30"> <multiple/> + <full-text-searchable/> </field> <field name="DatesToRemember" type="date"> <multiple/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2009-01-19 11:23:58
|
Revision: 3735 http://uni-d.svn.sourceforge.net/uni-d/?rev=3735&view=rev Author: max_brod Date: 2009-01-19 11:23:53 +0000 (Mon, 19 Jan 2009) Log Message: ----------- [UNI-440] Allow using ">>" (like - for reference, -- and ?? for descriptions) in link fields in GUI, to run full-text searches. Modified Paths: -------------- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/unidLinkInput/actionHandler/LinkInputActionHandler.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/unidLinkInput/actionHandler/LinkInputActionHandlerImpl.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMField.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMTable.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/tableManager/TableManagerPage.java trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.html trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.script Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java 2009-01-16 15:28:55 UTC (rev 3734) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java 2009-01-19 11:23:53 UTC (rev 3735) @@ -736,7 +736,7 @@ if ( hasFullTextSearchableFields ) { OMSelect selFullText = new OMSelect(); - selFullText.setHide( true ); + // selFullText.setHide( true ); selFullText.setNoTranslation( true ); selFullText.setName( "UnidFullText" ); selFullText.setSecurityRole( getSecurityRole() ); Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.java 2009-01-16 15:28:55 UTC (rev 3734) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.java 2009-01-19 11:23:53 UTC (rev 3735) @@ -221,6 +221,8 @@ text.append( '\'' ).append( getFieldName() ).append( "'," ); text.append( '\'' ).append( getReferenceField() ).append( "'," ); text.append( '\'' ).append( getDescriptionField() ).append( "'," ); + text.append( DescriptionFactory.getTableDescription( getLinkTableName() ).isFullTextSearchable() ) + .append( "," ); text.append( isFakeLink() ).append( ',' ); text.append( '\'' ).append( getUpdateField() ).append( "'," ); text.append( '\'' ).append( getUpdateFieldType() ).append( "'," ); @@ -381,6 +383,11 @@ getLinkInputActionHandler().searchByDescriptionPart( this ); } + public void searchFullText() + { + getLinkInputActionHandler().searchFullText( this ); + } + /** * Calculates the id for the href to run View on the link, in View/Select mode * Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/unidLinkInput/actionHandler/LinkInputActionHandler.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/unidLinkInput/actionHandler/LinkInputActionHandler.java 2009-01-16 15:28:55 UTC (rev 3734) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/unidLinkInput/actionHandler/LinkInputActionHandler.java 2009-01-19 11:23:53 UTC (rev 3735) @@ -34,6 +34,8 @@ void searchByDescriptionPart( UnidLinkInput component ); + void searchFullText( UnidLinkInput component ); + void searchBy( UnidLinkInput component, String selectName, String fieldName, FieldType fieldType, String value ); } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/unidLinkInput/actionHandler/LinkInputActionHandlerImpl.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/unidLinkInput/actionHandler/LinkInputActionHandlerImpl.java 2009-01-16 15:28:55 UTC (rev 3734) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/unidLinkInput/actionHandler/LinkInputActionHandlerImpl.java 2009-01-19 11:23:53 UTC (rev 3735) @@ -7,6 +7,7 @@ import be.unid.tapestry.components.shared.DescriptionFactory; import be.unid.tapestry.model.Input; import be.unid.tapestry.model.GMField; +import be.unid.tapestry.model.GMTable; import be.unid.tapestry.navigation.PageParameters; import be.unid.tapestry.pages.UnidBasePage; import be.unid.tapestry.pages.add.AddPage; @@ -50,11 +51,11 @@ { if ( isDisabled ) { - return ( (DisplayCalculator) o ).getDisplay( (UnidProxy) value, component ); + return ( (DisplayCalculator) o ).getDisplay( (UnidProxy) value, component ); } else { - return ( (DisplayCalculator) o ).getDisplayNoReference( (UnidProxy) value, component ); + return ( (DisplayCalculator) o ).getDisplayNoReference( (UnidProxy) value, component ); } } } @@ -310,6 +311,28 @@ searchBy( component, selectName, fieldName, FieldType.TYPE_STRING, value ); } + public synchronized void searchFullText( UnidLinkInput component ) + { + // if ( log.isDebugEnabled() ) log.debug( "searchFullText() - value = " + preparedStatement.inputBox ); + String selectName = "UnidFullText"; + String fieldName = null; + GMTable table = DescriptionFactory.getTableDescription( preparedStatement.getLinkTableName() ); + for ( GMField field : table.getFields() ) + { + if ( field.isFullTextSearchable() ) + { + fieldName = field.getName(); + break; + } + } + String value = ""; + if ( preparedStatement.inputBox.length() > 1 ) + { + value = preparedStatement.inputBox.substring( 0, preparedStatement.inputBox.length() - 2 ); + } + searchBy( component, selectName, fieldName, FieldType.TYPE_STRING, value ); + } + public synchronized void searchBy( UnidLinkInput component, String selectName, String fieldName, FieldType fieldType, String value ) Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMField.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMField.java 2009-01-16 15:28:55 UTC (rev 3734) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMField.java 2009-01-19 11:23:53 UTC (rev 3735) @@ -207,6 +207,7 @@ else if ( tag.equals( "full-text-searchable" ) ) { fullTextSearchable = true; + getTable().fullTextSearchable = true; } else { Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMTable.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMTable.java 2009-01-16 15:28:55 UTC (rev 3734) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMTable.java 2009-01-19 11:23:53 UTC (rev 3735) @@ -70,6 +70,8 @@ private String referenceField; private String descriptionField; + protected boolean fullTextSearchable; + boolean hideIf; // hide table in GUI depending on a class? String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the table @@ -498,4 +500,9 @@ { return hideIfClass; } + + public boolean isFullTextSearchable() + { + return fullTextSearchable; + } } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/tableManager/TableManagerPage.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/tableManager/TableManagerPage.java 2009-01-16 15:28:55 UTC (rev 3734) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/tableManager/TableManagerPage.java 2009-01-19 11:23:53 UTC (rev 3735) @@ -90,7 +90,7 @@ if ( filterSet ) continue; } String sname = select.getName(); - if ( sname.regionMatches( true, 0, "Unid", 0, 4 ) && !sname.equalsIgnoreCase( "UnidAll" ) && !sname.equals("UnidFullText") ) + if ( sname.regionMatches( true, 0, "Unid", 0, 4 ) && !sname.equalsIgnoreCase( "UnidAll" ) ) { continue; } Modified: trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.html =================================================================== --- trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.html 2009-01-16 15:28:55 UTC (rev 3734) +++ trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.html 2009-01-19 11:23:53 UTC (rev 3735) @@ -67,6 +67,9 @@ listener="listener:prepareReturnHandler" action="listener:searchByDescriptionStart"/> <span jwcid="@LinkSubmit" onclick="clearValidation(this);" listener="listener:prepareReturnHandler" action="listener:searchByDescriptionPart"/> + <span jwcid="@LinkSubmit" onclick="clearValidation(this);" + listener="listener:prepareReturnHandler" action="listener:searchFullText"/> + </span> </span> </span> Modified: trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.script =================================================================== --- trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.script 2009-01-16 15:28:55 UTC (rev 3734) +++ trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.script 2009-01-19 11:23:53 UTC (rev 3735) @@ -52,7 +52,7 @@ } function inputBoxOnBlur( element, tableName, - fldName, fldReference, fldDescription, isFake, updateField, updateFieldType, isCombo, + fldName, fldReference, fldDescription, hasFullTextSearch, isFake, updateField, updateFieldType, isCombo, onChangeFct, ajaxReceiveFct, cc, ccr, ccd ) { @@ -111,6 +111,18 @@ return; } + if ( hasFullTextSearch && value.length > 1 && value.substring( value.length - 2 ) == '>>' ) + { + // full text search + // click on hidden LinkSubmit + value = convertCase( element, ccr ); + var anchors = element.parentNode.getElementsByTagName('A'); + var link = anchors[3]; + clearValidation(element); + eval(link.href.replace("%20","")); + return; + } + if ( fldReference != 'null' || isFake ) { value = convertCase( element, cc ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2009-01-19 17:41:27
|
Revision: 3736 http://uni-d.svn.sourceforge.net/uni-d/?rev=3736&view=rev Author: max_brod Date: 2009-01-19 17:41:17 +0000 (Mon, 19 Jan 2009) Log Message: ----------- [UNI-338] Improve the look of the screen with the select UnidFindFullText. Modified Paths: -------------- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/select/SelectInputContainerImpl.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/select/unidSelect/UnidSelect.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/select/unidSelectField/UnidSelectField.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/select/SelectPage.java trunk/Uni-d/template/src/main/webapp/translations-common.txt Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/select/SelectInputContainerImpl.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/select/SelectInputContainerImpl.java 2009-01-19 11:23:53 UTC (rev 3735) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/select/SelectInputContainerImpl.java 2009-01-19 17:41:17 UTC (rev 3736) @@ -64,6 +64,10 @@ public String getDisplayName() { + if ( getSelectObject().getFinderName().equals( "UnidFullText" ) ) + { + return getMessages().getMessage( "FullTextSelectParameter" ); + } String label = "parameter." + getSelectObject().getSelectDescription().getTable().getName() + "." + getSelectObject().getSelectDescription().getName() + "." + getSelectionDescription().getName() + ".label"; Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/select/unidSelect/UnidSelect.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/select/unidSelect/UnidSelect.java 2009-01-19 11:23:53 UTC (rev 3735) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/select/unidSelect/UnidSelect.java 2009-01-19 17:41:17 UTC (rev 3736) @@ -126,6 +126,10 @@ public String getLegend() { if (getSelectObject().isUseCustomQuery()) return getMessages().getMessage("Find"); + if (getSelectDescription().getName().equals("UnidFullText")) + { + return getMessages().getMessage( "Find" ) + " " +getMessages().getMessage( "FullTextSelectTitle"); + } return getMessages().getMessage( "Find" ) + " " + getMessages().getMessage( "select." + getSelectDescription().getTable().getName() + "." + getSelectDescription().getName() + ".label" ); Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/select/unidSelectField/UnidSelectField.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/select/unidSelectField/UnidSelectField.java 2009-01-19 11:23:53 UTC (rev 3735) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/select/unidSelectField/UnidSelectField.java 2009-01-19 17:41:17 UTC (rev 3736) @@ -26,6 +26,9 @@ package be.unid.tapestry.components.select.unidSelectField; import be.unid.tapestry.components.select.SelectInputContainerImpl; +import static be.unid.tapestry.components.shared.ConfigurationKeys.GUI_MAX_FIELD_LENGTH; +import be.unid.tapestry.model.Renderer; +import be.unid.tapestry.util.ResourceUtil; import org.apache.tapestry.IAsset; import org.apache.tapestry.annotations.Asset; import org.apache.tapestry.annotations.ComponentClass; @@ -78,4 +81,49 @@ return "defaultFieldValue " + getTableName() + "Field_Value " + getTableName() + '_' + getFieldName() + "_Value"; } + + public int getCaseConversion() + { + // for UnidFullText, we set the first full-text-searchable field as selection for the generated select (cause we need one selection) + // however, we want a general look for this field (same translation, same length, renderer etc.) + if ( getSelectObject().getFinderName().equals( "UnidFullText" ) ) + { + return 0; + } + return super.getCaseConversion(); + } + + public int getFieldLength() + { + // for UnidFullText, we set the first full-text-searchable field as selection for the generated select (cause we need one selection) + // however, we want a general look for this field (same translation, same length, renderer etc.) + if ( getSelectObject().getFinderName().equals( "UnidFullText" ) ) + { + return ResourceUtil.getConfigInt( GUI_MAX_FIELD_LENGTH ); + } + return super.getFieldLength(); + } + + public int getDisplayLength() + { + // for UnidFullText, we set the first full-text-searchable field as selection for the generated select (cause we need one selection) + // however, we want a general look for this field (same translation, same length, renderer etc.) + if ( getSelectObject().getFinderName().equals( "UnidFullText" ) ) + { + return ResourceUtil.getConfigInt( GUI_MAX_FIELD_LENGTH ); + } + return super.getDisplayLength(); + } + + public Renderer getRenderer() + { + // for UnidFullText, we set the first full-text-searchable field as selection for the generated select (cause we need one selection) + // however, we want a general look for this field (same translation, same length, renderer etc.) + if ( getSelectObject().getFinderName().equals( "UnidFullText" ) ) + { + return new Renderer( "default" ); + } + return super.getRenderer(); + } + } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/select/SelectPage.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/select/SelectPage.java 2009-01-19 11:23:53 UTC (rev 3735) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/select/SelectPage.java 2009-01-19 17:41:17 UTC (rev 3736) @@ -68,6 +68,10 @@ { return getMessages().getMessage( "Find" ) + ' ' + getMessages().getMessage( "CustomQuery" ); } + if ( getPageParameters().getSelectName().equals( "UnidFullText" ) ) + { + return getMessages().getMessage( "Find" ) + ' ' + getMessages().getMessage( "FullTextSelectTitle" ); + } return getMessages().getMessage( "Find" ) + ' ' + getMessages().getMessage( "select." + getPageParameters().getTableName() + "." + getPageParameters().getSelectName() + ".label" ); } @@ -76,12 +80,12 @@ { if ( getPageParameters().getSelectDescription().getSelections().size() == 0 ) return; HelpPage page = (HelpPage) getNavigationManager().getForwardPage( this, "HelpPage", true ); - List descriptions=new ArrayList(); - descriptions.add(getPageParameters().getSelectDescription()); - List<String> titles=new ArrayList<String>(); - titles.add( ""); + List descriptions = new ArrayList(); + descriptions.add( getPageParameters().getSelectDescription() ); + List<String> titles = new ArrayList<String>(); + titles.add( "" ); page.getPageParameters().setDescriptions( descriptions ); - page.getPageParameters().setTitles( titles ); + page.getPageParameters().setTitles( titles ); getNavigationManager().forward( page ); } } Modified: trunk/Uni-d/template/src/main/webapp/translations-common.txt =================================================================== --- trunk/Uni-d/template/src/main/webapp/translations-common.txt 2009-01-19 11:23:53 UTC (rev 3735) +++ trunk/Uni-d/template/src/main/webapp/translations-common.txt 2009-01-19 17:41:17 UTC (rev 3736) @@ -955,3 +955,13 @@ .key title/ViewPageRedirector .label.en Redirector .label.ro Redirector +.key FullTextSelectTitle/Uni-d-table +.label.en Text +.label.nl Tekst +.label.fr Texte +.label.ro Text +.key FullTextSelectParameter/Uni-d-table +.label.en Text +.label.nl Tekst +.label.fr Texte +.label.ro Text \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2009-01-20 13:41:35
|
Revision: 3738 http://uni-d.svn.sourceforge.net/uni-d/?rev=3738&view=rev Author: max_brod Date: 2009-01-20 13:41:32 +0000 (Tue, 20 Jan 2009) Log Message: ----------- [UNI-444] Make validation of border items more flexible. Modified Paths: -------------- trunk/Uni-d/server/src/main/java/be/unid/validation/SimpleValidator.java trunk/Uni-d/server/src/main/java/be/unid/validation/SimpleValidatorAdaptor.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/borderItems/BorderItems.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/parser/border/Parser.java Modified: trunk/Uni-d/server/src/main/java/be/unid/validation/SimpleValidator.java =================================================================== --- trunk/Uni-d/server/src/main/java/be/unid/validation/SimpleValidator.java 2009-01-20 10:25:26 UTC (rev 3737) +++ trunk/Uni-d/server/src/main/java/be/unid/validation/SimpleValidator.java 2009-01-20 13:41:32 UTC (rev 3738) @@ -34,5 +34,7 @@ */ public interface SimpleValidator { + public void setParameters( String parameters ); + public boolean isValid(); } Modified: trunk/Uni-d/server/src/main/java/be/unid/validation/SimpleValidatorAdaptor.java =================================================================== --- trunk/Uni-d/server/src/main/java/be/unid/validation/SimpleValidatorAdaptor.java 2009-01-20 10:25:26 UTC (rev 3737) +++ trunk/Uni-d/server/src/main/java/be/unid/validation/SimpleValidatorAdaptor.java 2009-01-20 13:41:32 UTC (rev 3738) @@ -34,6 +34,8 @@ public class SimpleValidatorAdaptor implements SimpleValidator { + public void setParameters( String parameters ) {} + public boolean isValid() { return false; Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/borderItems/BorderItems.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/borderItems/BorderItems.java 2009-01-20 10:25:26 UTC (rev 3737) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/borderItems/BorderItems.java 2009-01-20 13:41:32 UTC (rev 3738) @@ -102,7 +102,7 @@ */ private ItemDescription calculateItem( Parser.ItemDescription item ) { - if ( !isValid( item.getValidator() ) ) return null; + if ( !isValid( item.getValidator(), item.getValidatorParameters() ) ) return null; if ( !getSessionUserAdmin().hasAccess( item.getUserAdminId(), AccessRight.TABLE_PREFERENCE_DISPLAY ) ) { return null; @@ -147,7 +147,7 @@ return calculatedItems; } - public boolean isValid( String validatorClassName ) + public boolean isValid( String validatorClassName, String validatorParameters ) { if ( validatorClassName == null ) { @@ -156,6 +156,7 @@ Object o = Pool.getClass( validatorClassName ); if ( o != null ) { + ( (SimpleValidator) o ).setParameters( validatorParameters ); if ( !( (SimpleValidator) o ).isValid() ) return false; } return true; Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/parser/border/Parser.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/parser/border/Parser.java 2009-01-20 10:25:26 UTC (rev 3737) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/parser/border/Parser.java 2009-01-20 13:41:32 UTC (rev 3738) @@ -58,6 +58,7 @@ private static final String KEY = "key"; private static final String USERADMINID = "id"; private static final String VALIDATOR = "validator"; + private static final String VALIDATOR_PARAMETERS = "validator-parameters"; private static final String TRANSLATOR_CLASS = "translator-class"; private ArrayList<ItemDescription> items = new ArrayList<ItemDescription>(); @@ -201,6 +202,16 @@ this.validator = validator; } + public String getValidatorParameters() + { + return validatorParameters; + } + + public void setValidatorParameters( String validatorParameters ) + { + this.validatorParameters = validatorParameters; + } + public List<ItemDescription> getItems() { return items; @@ -226,6 +237,7 @@ private String key; private String userAdminId; private String validator; + private String validatorParameters; private String translatorClass; private List<ItemDescription> items = new ArrayList<ItemDescription>(); } @@ -238,6 +250,7 @@ item.setKey( node.getAttribute( KEY ) ); item.setUserAdminId( node.getAttribute( USERADMINID ) ); item.setValidator( node.getAttribute( VALIDATOR ) ); + item.setValidatorParameters( node.getAttribute( VALIDATOR_PARAMETERS ) ); item.setTranslatorClass( node.getAttribute( TRANSLATOR_CLASS ) ); Node child = node.getFirstChild(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2009-01-20 17:16:39
|
Revision: 3739 http://uni-d.svn.sourceforge.net/uni-d/?rev=3739&view=rev Author: max_brod Date: 2009-01-20 17:16:29 +0000 (Tue, 20 Jan 2009) Log Message: ----------- [UNI-443] Make the hide-if classes more flexible. Modified Paths: -------------- trunk/Uni-d/docs/src/wiki/GUI-Descriptors-model.mm trunk/Uni-d/docs/src/wiki/object-model.mm trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMAction.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMField.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMGroup.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMPage.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMRootTable.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMSelect.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java trunk/Uni-d/generate/src/main/resources/uni-d.dtd trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Action.xml.vm trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Field.xml.vm trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Group.xml.vm trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Page.xml.vm trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Select.xml.vm trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Table.xml.vm trunk/Uni-d/server/src/main/java/be/unid/validation/HideIf.java trunk/Uni-d/server/src/main/java/be/unid/validation/HideIfAdapter.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/borderItems/BorderItems.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/unidEdit/UnidEdit.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/unidField/UnidField2.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/unidGroup/UnidGroup.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/unidTable/UnidTable.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/userAdmin/table/actionRights/ActionRights.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/userAdmin/table/selectRights/SelectRights.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMAction.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMField.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMGroup.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMPage.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMSelect.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMTable.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/tableManager/TableManagerPage.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/tablesCategoryIndex/TablesCategoryIndex.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/tablesIndex/TablesIndexPage.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/adminMenu/AdminMenu.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/adminTablesConfig/AdminTablesConfig.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/userMenu/UserMenu.java Modified: trunk/Uni-d/docs/src/wiki/GUI-Descriptors-model.mm =================================================================== --- trunk/Uni-d/docs/src/wiki/GUI-Descriptors-model.mm 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/docs/src/wiki/GUI-Descriptors-model.mm 2009-01-20 17:16:29 UTC (rev 3739) @@ -25,7 +25,7 @@ <node COLOR="#338800" CREATED="1146162597397" ID="Freemind_Link_1763972817" MODIFIED="1146162603117" TEXT="forced"/> <node COLOR="#338800" CREATED="1146162599536" ID="Freemind_Link_568231306" MODIFIED="1146162603492" TEXT="class"/> </node> -<node COLOR="#006699" CREATED="1146160740822" ID="Freemind_Link_1281880686" MODIFIED="1176299592671" TEXT="page*"> +<node COLOR="#006699" CREATED="1146160740822" ID="Freemind_Link_1281880686" MODIFIED="1232466947250" TEXT="page*"> <arrowlink DESTINATION="Freemind_Link_1615050645" ENDARROW="Default" ENDINCLINATION="61;0;" ID="Freemind_Arrow_Link_481871487" STARTARROW="None" STARTINCLINATION="61;0;"/> <node COLOR="#338800" CREATED="1146160946360" ID="Freemind_Link_107718382" MODIFIED="1146161195602" TEXT="name"/> <node COLOR="#006699" CREATED="1146160965555" HGAP="22" ID="Freemind_Link_1615050645" MODIFIED="1176299592687" TEXT="field*" VSHIFT="10"> @@ -210,12 +210,7 @@ <arrowlink DESTINATION="Freemind_Link_1608171911" ENDARROW="Default" ENDINCLINATION="522;0;" ID="Freemind_Arrow_Link_815930424" STARTARROW="None" STARTINCLINATION="522;0;"/> </node> </node> -<node COLOR="#669900" CREATED="1176299247500" ID="Freemind_Link_1416691723" MODIFIED="1176299259843" TEXT="if-class"> -<edge WIDTH="thin"/> -<font NAME="SansSerif" SIZE="12"/> -<node CREATED="1176299290437" ID="Freemind_Link_1853157634" MODIFIED="1176299315125" TEXT="Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the item"/> </node> -</node> <node COLOR="#006699" CREATED="1147794389209" ID="Freemind_Link_1571755097" MODIFIED="1176299356953" TEXT="linked-select*"> <edge WIDTH="thin"/> <font NAME="SansSerif" SIZE="12"/> @@ -240,7 +235,7 @@ <node COLOR="#006699" CREATED="1149876559631" ID="Freemind_Link_1878062989" MODIFIED="1176299374875" TEXT="description-field"> <node CREATED="1149876567827" ID="Freemind_Link_1390034831" MODIFIED="1149876569788" TEXT="name"/> </node> -<node COLOR="#006699" CREATED="1176299129593" FOLDED="true" ID="Freemind_Link_506976591" MODIFIED="1176299601265" TEXT="hide"> +<node COLOR="#006699" CREATED="1176299129593" ID="Freemind_Link_506976591" MODIFIED="1232466947250" TEXT="hide"> <arrowlink DESTINATION="Freemind_Link_1002121865" ENDARROW="Default" ENDINCLINATION="468;0;" ID="Freemind_Arrow_Link_1555680342" STARTARROW="None" STARTINCLINATION="468;0;"/> <arrowlink DESTINATION="Freemind_Link_1059193234" ENDARROW="Default" ENDINCLINATION="363;0;" ID="Freemind_Arrow_Link_1423067910" STARTARROW="None" STARTINCLINATION="363;0;"/> <arrowlink DESTINATION="Freemind_Link_117618858" ENDARROW="Default" ENDINCLINATION="362;0;" ID="Freemind_Arrow_Link_340993874" STARTARROW="None" STARTINCLINATION="362;0;"/> @@ -250,7 +245,10 @@ <node COLOR="#669900" CREATED="1176299638109" ID="Freemind_Link_1311879963" MODIFIED="1176299642546" TEXT="if class"> <node CREATED="1176299648406" ID="Freemind_Link_1064298642" MODIFIED="1176299695031" TEXT="Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the item"/> </node> +<node COLOR="#669900" CREATED="1232466964312" ID="Freemind_Link_658072851" MODIFIED="1232466969140" TEXT="parameters"> +<node CREATED="1232466970359" ID="Freemind_Link_1457165661" MODIFIED="1232466983781" TEXT="Parameters to be passed to the class "/> </node> +</node> <node COLOR="#006699" CREATED="1180458411313" ID="Freemind_Link_1209181793" MODIFIED="1180458415800" TEXT="data-filter"> <node CREATED="1180458494229" ID="Freemind_Link_1113252348" MODIFIED="1180458653149" TEXT="Comma separated list of filter names. These are filters which are applied to all the selectors."/> </node> Modified: trunk/Uni-d/docs/src/wiki/object-model.mm =================================================================== (Binary files differ) Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMAction.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMAction.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMAction.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -63,6 +63,7 @@ private boolean hide; private boolean hideIf; // hide action in GUI depending on a class? private String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the action + private String hideIfParameters; private boolean noTranslation; // no translation is needed for this element? private String parametersList; @@ -140,6 +141,10 @@ { hideIf = true; hideIfClass = attr.getValue( "if-class" ).toString(); + if ( attr.getValue( "parameters" ) != null ) + { + hideIfParameters = attr.getValue( "parameters" ).toString(); + } } return false; } @@ -246,6 +251,16 @@ return hideIfClass; } + public String getHideIfParameters() + { + return hideIfParameters; + } + + public boolean hasHideIfParameters() + { + return hideIfParameters!=null; + } + public boolean isNoTranslation() { return noTranslation; Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMField.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMField.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMField.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -104,6 +104,7 @@ private boolean hide; // hide field in GUI? private boolean hideIf; // hide field in GUI depending on a class? private String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the field + private String hideIfParameters; // parameters to be passed to the hide-if class private boolean noTranslation; // no translation is needed for this element? private boolean buildValue; // should this field be included in the buildValue object private String wsValue = "UOID"; // field to serialize for ws queries for linked fields @@ -683,6 +684,10 @@ { hideIf = true; hideIfClass = attr.getValue( "if-class" ).toString(); + if ( attr.getValue( "parameters" ) != null ) + { + hideIfParameters = attr.getValue( "parameters" ).toString(); + } } } else if ( tag.equals( "no-translation" ) ) @@ -1569,6 +1574,16 @@ return hideIfClass; } + public String getHideIfParameters() + { + return hideIfParameters; + } + + public boolean hasHideIfParameters() + { + return hideIfParameters!=null; + } + public boolean isNoTranslation() { if ( noTranslation ) return true; Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMGroup.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMGroup.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMGroup.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -55,9 +55,11 @@ private boolean hide; // hide group in GUI? private boolean hideIf; // hide group in GUI depending on a class? private String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the group + private String hideIfParameters; // Parameters to be passed to the hide-if class private boolean noTranslation; // no translation is needed for this element? - private static String[] childrenList = { "description", "field", "group", "if", "include", "hide", "no-hide", "no-translation" }; + private static String[] childrenList = + { "description", "field", "group", "if", "include", "hide", "no-hide", "no-translation" }; public String[] getRequiredAttributes() { @@ -220,6 +222,10 @@ { hideIf = true; hideIfClass = attr.getValue( "if-class" ).toString(); + if ( attr.getValue( "parameters" ) != null ) + { + hideIfParameters = attr.getValue( "parameters" ).toString(); + } } else { @@ -372,17 +378,27 @@ return hideIfClass; } + public String getHideIfParameters() + { + return hideIfParameters; + } + + public boolean hasHideIfParameters() + { + return hideIfParameters!=null; + } + public boolean isNoTranslation() { - if (noTranslation) return true; - Node parent=this.getParentNode(); - if (parent instanceof OMGroup) + if ( noTranslation ) return true; + Node parent = this.getParentNode(); + if ( parent instanceof OMGroup ) { - return ((OMGroup) parent).isNoTranslation(); + return ( (OMGroup) parent ).isNoTranslation(); } - if (parent instanceof OMPage) + if ( parent instanceof OMPage ) { - return ((OMPage) parent).isNoTranslation(); + return ( (OMPage) parent ).isNoTranslation(); } return false; } Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMPage.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMPage.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMPage.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -54,8 +54,10 @@ private boolean hideIf; // hide field in GUI depending on a class? private boolean noTranslation; // no translation is needed for this element? private String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the page + private String hideIfParameters; // Parameters - private static String[] childrenList = { "description", "field", "group", "if", "include", "hide", "no-hide", "no-translation" }; + private static String[] childrenList = + { "description", "field", "group", "if", "include", "hide", "no-hide", "no-translation" }; public String[] getRequiredAttributes() { @@ -182,6 +184,10 @@ { hideIf = true; hideIfClass = attr.getValue( "if-class" ).toString(); + if ( attr.getValue( "parameters" ) != null ) + { + hideIfParameters = attr.getValue( "parameters" ).toString(); + } } else { @@ -341,6 +347,16 @@ return hideIfClass; } + public String getHideIfParameters() + { + return hideIfParameters; + } + + public boolean hasHideIfParameters() + { + return hideIfParameters!=null; + } + public boolean isNoTranslation() { return noTranslation; Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMRootTable.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMRootTable.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMRootTable.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -863,6 +863,16 @@ return getTable().getHideIfClass(); } + public String getHideIfParameters() + { + return getTable().getHideIfParameters(); + } + + public boolean hasHideIfParameters() + { + return getTable().hasHideIfParameters(); + } + public String getDataFilter() { return getTable().getDataFilter(); Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMSelect.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMSelect.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMSelect.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -71,6 +71,7 @@ private boolean hide; private boolean hideIf; // hide select in GUI depending on a class? private String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the select + private String hideIfParameters; // Parameters to be passed to the hide-if class private boolean noTranslation; // no translation is needed for this element? private String query; @@ -152,7 +153,8 @@ * @param fieldName * @param query */ - OMSelect( String name, OMTable table, OMRootTable root, String fieldName, String query, boolean single, boolean hide, boolean noTranslation ) + OMSelect( String name, OMTable table, OMRootTable root, String fieldName, String query, boolean single, + boolean hide, boolean noTranslation ) { this.name = name; this.table = table; @@ -804,6 +806,10 @@ { hideIf = true; hideIfClass = attr.getValue( "if-class" ).toString(); + if ( attr.getValue( "parameters" ) != null ) + { + hideIfParameters = attr.getValue( "parameters" ).toString(); + } } return false; } @@ -940,6 +946,16 @@ return hideIfClass; } + public String getHideIfParameters() + { + return hideIfParameters; + } + + public boolean hasHideIfParameters() + { + return hideIfParameters!=null; + } + public boolean isNoTranslation() { return noTranslation; Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -90,6 +90,7 @@ private boolean noTranslation; // no translation is needed for this element? private boolean hideIf; // hide table in GUI depending on a class? private String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the table + private String hideIfParameters; // parameters to be passed to the hide-if class private String category = "default"; private String dataFilter = ""; @@ -381,6 +382,10 @@ { hideIf = true; hideIfClass = attr.getValue( "if-class" ).toString(); + if ( attr.getValue( "parameters" ) != null ) + { + hideIfParameters = attr.getValue( "parameters" ).toString(); + } } return false; } @@ -1194,6 +1199,16 @@ return hideIfClass; } + public String getHideIfParameters() + { + return hideIfClass; + } + + public boolean hasHideIfParameters() + { + return hideIfParameters!=null; + } + public OMTable getOMTable() { return this; Modified: trunk/Uni-d/generate/src/main/resources/uni-d.dtd =================================================================== --- trunk/Uni-d/generate/src/main/resources/uni-d.dtd 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/generate/src/main/resources/uni-d.dtd 2009-01-20 17:16:29 UTC (rev 3739) @@ -352,6 +352,7 @@ <hide> indicates that the field should not be displayed in the user interface A hidden field gets a default ws-role of "none" (only if the "if-class" attribute is null). The attribute if-class indicates a class which is used at runtime to determine if the field should be visible or not. + The attribute parameters is a string which is passed to the if-class to evaluate the condition When both "display" and "hide" are indicated, then "hide" should have precedence. @@ -362,7 +363,8 @@ <!ELEMENT display EMPTY> <!ELEMENT hide EMPTY> <!ATTLIST hide -if-class CDATA #IMPLIED> +if-class CDATA #IMPLIED +parameters CDATA #IMPLIED> <!ELEMENT no-display EMPTY> <!ELEMENT no-hide EMPTY> Modified: trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Action.xml.vm =================================================================== --- trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Action.xml.vm 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Action.xml.vm 2009-01-20 17:16:29 UTC (rev 3739) @@ -33,7 +33,7 @@ <action name="$action.Name" return="$action.Return" id="t${table.Name}.a${action.Name}" table-names="$action.TableNames"> #if( $action.isHiddenIf() ) - <hide if-class="$action.HideIfClass"/> + <hide if-class="$action.HideIfClass" #if( $action.hasHideIfParameters() ) parameters="$action.HideIfParameters" #end/> #end #foreach( $parameter in $action.Parameters ) Modified: trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Field.xml.vm =================================================================== --- trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Field.xml.vm 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Field.xml.vm 2009-01-20 17:16:29 UTC (rev 3739) @@ -171,7 +171,7 @@ #end #if( $field.isHiddenIf() ) - <hide if-class="$field.HideIfClass"/> + <hide if-class="$field.HideIfClass" #if( $field.hasHideIfParameters() )parameters="$field.HideIfParameters" #end/> #end #if( $field.isFullTextSearchable() ) Modified: trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Group.xml.vm =================================================================== --- trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Group.xml.vm 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Group.xml.vm 2009-01-20 17:16:29 UTC (rev 3739) @@ -48,7 +48,7 @@ #end #if( $group.isHiddenIf() ) - <hide if-class="$group.HideIfClass"/> + <hide if-class="$group.HideIfClass" #if( $group.hasHideIfParameters() ) parameters="$group.HideIfParameters" #end/> #end #foreach( $group in $group.Groups ) Modified: trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Page.xml.vm =================================================================== --- trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Page.xml.vm 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Page.xml.vm 2009-01-20 17:16:29 UTC (rev 3739) @@ -33,7 +33,7 @@ <page name="$page.Name" id="t${table.Name}.p${page.Name}"> #if( $page.isHiddenIf() ) - <hide if-class="$page.HideIfClass"/> + <hide if-class="$page.HideIfClass" #if( $page.hasHideIfParameters() ) parameters="$page.HideIfParameters" #end/> #end #foreach( $field in $page.Fields) Modified: trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Select.xml.vm =================================================================== --- trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Select.xml.vm 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Select.xml.vm 2009-01-20 17:16:29 UTC (rev 3739) @@ -45,7 +45,7 @@ > #if( $select.isHiddenIf() ) - <hide if-class="$select.HideIfClass"/> + <hide if-class="$select.HideIfClass" #if( $select.hasHideIfParameters() ) parameters="$select.HideIfParameters" #end/> #end #if( ""!="$select.ViewFilter" ) Modified: trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Table.xml.vm =================================================================== --- trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Table.xml.vm 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Table.xml.vm 2009-01-20 17:16:29 UTC (rev 3739) @@ -36,7 +36,7 @@ #end #if( $table.isHiddenIf() ) - <hide if-class="$table.HideIfClass"/> + <hide if-class="$table.HideIfClass" #if( $table.hasHideIfParameters() ) parameters="$table.HideIfParameters" #end/> #end #foreach( $type in $table.Types ) Modified: trunk/Uni-d/server/src/main/java/be/unid/validation/HideIf.java =================================================================== --- trunk/Uni-d/server/src/main/java/be/unid/validation/HideIf.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/server/src/main/java/be/unid/validation/HideIf.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -34,5 +34,7 @@ */ public interface HideIf { + public void setParameters( String parameters ); + public boolean isHidden(); } Modified: trunk/Uni-d/server/src/main/java/be/unid/validation/HideIfAdapter.java =================================================================== --- trunk/Uni-d/server/src/main/java/be/unid/validation/HideIfAdapter.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/server/src/main/java/be/unid/validation/HideIfAdapter.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -34,5 +34,7 @@ public class HideIfAdapter implements HideIf { + public void setParameters( String parameters ) {} + public boolean isHidden() { return false;} } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/borderItems/BorderItems.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/borderItems/BorderItems.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/borderItems/BorderItems.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -182,6 +182,10 @@ Object o = Pool.getClass( gmTable.getHideIfClass() ); if ( o != null ) { + if ( gmTable.getHideIfParameters() != null ) + { + ( (HideIf) o ).setParameters( gmTable.getHideIfParameters() ); + } if ( ( (HideIf) o ).isHidden() ) continue; } } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/unidEdit/UnidEdit.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/unidEdit/UnidEdit.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/unidEdit/UnidEdit.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -118,6 +118,10 @@ Object o = Pool.getClass( action.getHideIfClass() ); if ( o != null ) { + if ( action.getHideIfParameters() != null ) + { + ( (HideIf) o ).setParameters( action.getHideIfParameters() ); + } if ( ( (HideIf) o ).isHidden() ) continue; } } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/unidField/UnidField2.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/unidField/UnidField2.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/unidField/UnidField2.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -106,6 +106,10 @@ Object o = Pool.getClass( getFieldDescription().getHideIfClass() ); if ( o != null ) { + if ( getFieldDescription().getHideIfParameters() != null ) + { + ( (HideIf) o ).setParameters( getFieldDescription().getHideIfParameters() ); + } if ( ( (HideIf) o ).isHidden() ) return false; } } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/unidGroup/UnidGroup.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/unidGroup/UnidGroup.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/unidGroup/UnidGroup.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -244,7 +244,14 @@ if ( group.isHiddenIf() ) { Object o = Pool.getClass( group.getHideIfClass() ); - if ( ( (HideIf) o ).isHidden() ) return false; + if ( o != null ) + { + if ( group.getHideIfParameters() != null ) + { + ( (HideIf) o ).setParameters( group.getHideIfParameters() ); + } + if ( ( (HideIf) o ).isHidden() ) return false; + } } if ( group.getFields().size() == 0 && group.getGroups().size() == 0 ) return false; boolean hasAccess = true; Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/unidTable/UnidTable.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/unidTable/UnidTable.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/unidTable/UnidTable.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -234,7 +234,14 @@ if ( page.isHiddenIf() ) { Object o = Pool.getClass( page.getHideIfClass() ); - if ( ( (HideIf) o ).isHidden() ) continue; + if ( o != null ) + { + if ( page.getHideIfParameters() != null ) + { + ( (HideIf) o ).setParameters( page.getHideIfParameters() ); + } + if ( ( (HideIf) o ).isHidden() ) continue; + } } ret.add( page ); } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/userAdmin/table/actionRights/ActionRights.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/userAdmin/table/actionRights/ActionRights.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/userAdmin/table/actionRights/ActionRights.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -109,6 +109,10 @@ Object o = Pool.getClass( action.getHideIfClass() ); if ( o != null ) { + if ( action.getHideIfParameters() != null ) + { + ( (HideIf) o ).setParameters( action.getHideIfParameters() ); + } if ( ( (HideIf) o ).isHidden() ) continue; } } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/userAdmin/table/selectRights/SelectRights.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/userAdmin/table/selectRights/SelectRights.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/userAdmin/table/selectRights/SelectRights.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -96,6 +96,10 @@ Object o = Pool.getClass( sel.getHideIfClass() ); if ( o != null ) { + if ( sel.getHideIfParameters() != null ) + { + ( (HideIf) o ).setParameters( sel.getHideIfParameters() ); + } if ( ( (HideIf) o ).isHidden() ) continue; } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMAction.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMAction.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMAction.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -52,8 +52,9 @@ protected List<String> tableTypes = new ArrayList<String>(); // a list of types of tables to whom this action belongs private List<GMParameter> parameters; - boolean hideIf; // hide action in GUI depending on a class? - String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the action + private boolean hideIf; // hide action in GUI depending on a class? + private String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the action + private String hideIfParameters; // Parameters to be passed to the hide-if class public String getTagName() { @@ -98,6 +99,10 @@ { hideIf = true; hideIfClass = attr.getValue( "if-class" ).toString(); + if (attr.getValue("parameters")!=null) + { + hideIfParameters=attr.getValue("parameters").toString(); + } } return false; } @@ -164,4 +169,9 @@ { return hideIfClass; } + + public String getHideIfParameters() + { + return hideIfParameters; + } } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMField.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMField.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMField.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -75,8 +75,9 @@ ArrayList<MutableIf> immutableIf, mutableEvenIf; - boolean hideIf; // hide field in GUI depending on a class? - String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the field + private boolean hideIf; // hide field in GUI depending on a class? + private String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the field + private String hideIfParameters; // parameters to be passed to the hide-if class public String getTagName() { @@ -202,6 +203,10 @@ { hideIf = true; hideIfClass = attr.getValue( "if-class" ).toString(); + if ( attr.getValue( "parameters" ) != null ) + { + hideIfParameters = attr.getValue( "parameters" ).toString(); + } } } else if ( tag.equals( "full-text-searchable" ) ) @@ -448,6 +453,11 @@ return hideIfClass; } + public String getHideIfParameters() + { + return hideIfParameters; + } + public boolean hasDisplayClass() { return displayClass != null; Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMGroup.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMGroup.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMGroup.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -54,8 +54,9 @@ private List<GMGroup> groups; private List<GMGroup> parentGroups; - boolean hideIf; // hide group in GUI depending on a class? - String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the group + private boolean hideIf; // hide group in GUI depending on a class? + private String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the group + private String hideIfParameters; // parameters to be passed to the hide-if class public String getTagName() { @@ -175,11 +176,14 @@ { hideIf = true; hideIfClass = attr.getValue( "if-class" ).toString(); + if ( attr.getValue( "parameters" ) != null ) + { + hideIfParameters = attr.getValue( "parameters" ).toString(); + } } return false; } - return super.canAppendChild( tag, - attr ); + return super.canAppendChild( tag, attr ); } public String getName() @@ -220,4 +224,9 @@ { return hideIfClass; } + + public String getHideIfParameters() + { + return hideIfParameters; + } } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMPage.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMPage.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMPage.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -50,8 +50,9 @@ private String name = "default"; private String id; - boolean hideIf; // hide page in GUI depending on a class? - String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the page + private boolean hideIf; // hide page in GUI depending on a class? + private String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the page + private String hideIfParameters; // parameters to be passed to the hide-if class private List<GMField> fields; private List<GMGroup> groups; @@ -157,6 +158,10 @@ { hideIf = true; hideIfClass = attr.getValue( "if-class" ).toString(); + if ( attr.getValue( "parameters" ) != null ) + { + hideIfParameters = attr.getValue( "parameters" ).toString(); + } } return false; } @@ -192,4 +197,9 @@ { return hideIfClass; } + + public String getHideIfParameters() + { + return hideIfParameters; + } } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMSelect.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMSelect.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMSelect.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -53,7 +53,8 @@ private String id; private boolean hideIf; // hide select in GUI depending on a class? private String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the select - private String viewFilter=""; + private String hideIfParameters; // parameters to be passed to the hide-if class + private String viewFilter = ""; private int inTag; // currently processed tag for appendData public String getTagName() @@ -101,6 +102,10 @@ { hideIf = true; hideIfClass = attr.getValue( "if-class" ).toString(); + if ( attr.getValue( "parameters" ) != null ) + { + hideIfParameters = attr.getValue( "parameters" ).toString(); + } } return false; } @@ -194,6 +199,11 @@ return hideIfClass; } + public String getHideIfParameters() + { + return hideIfParameters; + } + public void appendData( CharSequence newArg ) throws XMLTreeException { @@ -203,5 +213,5 @@ public String getViewFilter() { return viewFilter; } - public boolean hasViewFilter() { return viewFilter.length()>0; } + public boolean hasViewFilter() { return viewFilter.length() > 0; } } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMTable.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMTable.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/GMTable.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -72,8 +72,9 @@ protected boolean fullTextSearchable; - boolean hideIf; // hide table in GUI depending on a class? - String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the table + private boolean hideIf; // hide table in GUI depending on a class? + private String hideIfClass; // Class implementing the HideIf interface, to be used in GUI at runtime, determining the visibility of the table + private String hideIfParameters; // parameters to be passed to the hide-if table private ArrayList<LinkedSelect> linkedSelects = new ArrayList<LinkedSelect>(); // list with selects that have a single parameter of this table type @@ -177,6 +178,10 @@ { hideIf = true; hideIfClass = attr.getValue( "if-class" ).toString(); + if ( attr.getValue( "parameters" ) != null ) + { + hideIfParameters = attr.getValue( "parameters" ).toString(); + } } } else @@ -501,6 +506,11 @@ return hideIfClass; } + public String getHideIfParameters() + { + return hideIfParameters; + } + public boolean isFullTextSearchable() { return fullTextSearchable; Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/tableManager/TableManagerPage.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/tableManager/TableManagerPage.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/tableManager/TableManagerPage.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -99,6 +99,10 @@ Object o = Pool.getClass( select.getHideIfClass() ); if ( o != null ) { + if ( select.getHideIfParameters() != null ) + { + ( (HideIf) o ).setParameters( select.getHideIfParameters() ); + } if ( ( (HideIf) o ).isHidden() ) continue; } } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/tablesCategoryIndex/TablesCategoryIndex.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/tablesCategoryIndex/TablesCategoryIndex.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/tablesCategoryIndex/TablesCategoryIndex.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -78,6 +78,10 @@ Object o = Pool.getClass( gmTable.getHideIfClass() ); if ( o != null ) { + if ( gmTable.getHideIfParameters() != null ) + { + ( (HideIf) o ).setParameters( gmTable.getHideIfParameters() ); + } if ( ( (HideIf) o ).isHidden() ) continue; } } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/tablesIndex/TablesIndexPage.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/tablesIndex/TablesIndexPage.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/tablesIndex/TablesIndexPage.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -77,6 +77,10 @@ Object o = Pool.getClass( gmTable.getHideIfClass() ); if ( o != null ) { + if ( gmTable.getHideIfParameters() != null ) + { + ( (HideIf) o ).setParameters( gmTable.getHideIfParameters() ); + } if ( ( (HideIf) o ).isHidden() ) continue; } } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/adminMenu/AdminMenu.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/adminMenu/AdminMenu.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/adminMenu/AdminMenu.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -78,6 +78,10 @@ Object o = Pool.getClass( gmTable.getHideIfClass() ); if ( o != null ) { + if ( gmTable.getHideIfParameters() != null ) + { + ( (HideIf) o ).setParameters( gmTable.getHideIfParameters() ); + } if ( ( (HideIf) o ).isHidden() ) continue; } } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/adminTablesConfig/AdminTablesConfig.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/adminTablesConfig/AdminTablesConfig.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/adminTablesConfig/AdminTablesConfig.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -63,6 +63,10 @@ Object o = Pool.getClass( gmTable.getHideIfClass() ); if ( o != null ) { + if ( gmTable.getHideIfParameters() != null ) + { + ( (HideIf) o ).setParameters( gmTable.getHideIfParameters() ); + } if ( ( (HideIf) o ).isHidden() ) continue; } } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/userMenu/UserMenu.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/userMenu/UserMenu.java 2009-01-20 13:41:32 UTC (rev 3738) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/userMenu/UserMenu.java 2009-01-20 17:16:29 UTC (rev 3739) @@ -79,6 +79,10 @@ Object o = Pool.getClass( gmTable.getHideIfClass() ); if ( o != null ) { + if ( gmTable.getHideIfParameters() != null ) + { + ( (HideIf) o ).setParameters( gmTable.getHideIfParameters() ); + } if ( ( (HideIf) o ).isHidden() ) continue; } } @@ -152,10 +156,10 @@ public String getExtraItemTranslation() { - return getMessage(getExtraItem().getKey()); + return getMessage( getExtraItem().getKey() ); } - public boolean isValid( String validatorClassName ) + public boolean isValid( String validatorClassName ) { if ( validatorClassName == null ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2009-01-23 07:44:24
|
Revision: 3742 http://uni-d.svn.sourceforge.net/uni-d/?rev=3742&view=rev Author: max_brod Date: 2009-01-23 07:43:38 +0000 (Fri, 23 Jan 2009) Log Message: ----------- [UNI-439] Added page. Other small fixes for select filters and for the generated queries for full-text-search. Modified Paths: -------------- trunk/Uni-d/client/src/main/java/be/unid/persistence/om/ObjectFinder.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java trunk/Uni-d/tapestry/src/main/resources/Uni-d-tapestry.library trunk/Uni-d/template/src/main/webapp/translations-common.txt Added Paths: ----------- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPageParameters.java trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/fullTextSearch/ trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.html trunk/Uni-d/template/src/main/webapp/css/palette.css Modified: trunk/Uni-d/client/src/main/java/be/unid/persistence/om/ObjectFinder.java =================================================================== --- trunk/Uni-d/client/src/main/java/be/unid/persistence/om/ObjectFinder.java 2009-01-21 14:12:25 UTC (rev 3741) +++ trunk/Uni-d/client/src/main/java/be/unid/persistence/om/ObjectFinder.java 2009-01-23 07:43:38 UTC (rev 3742) @@ -264,7 +264,17 @@ { queryStr = queryStr.substring( 0, queryStr.indexOf( " ORDER BY " ) ); } + boolean ascending = true; + if ( fieldName.startsWith( "-" ) ) + { + ascending = false; + fieldName = fieldName.substring( 1 ); + } queryStr += " ORDER BY " + getQueryObject( queryStr ) + "." + fieldName; + if ( !ascending ) + { + queryStr += " DESCENDING"; + } return queryStr; } Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java 2009-01-21 14:12:25 UTC (rev 3741) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMTable.java 2009-01-23 07:43:38 UTC (rev 3742) @@ -747,7 +747,7 @@ selFullText.setTableName( name ); selFullText.setRootTable( this.getRoot() ); selFullText.setLimit( true ); - String query = "SELECT o FROM DM" + getRoot().getName() + "Bean o WHERE "; + String query = "SELECT o FROM DM" + getRoot().getName() + "Bean o WHERE ("; OMField firstField = null; String separator = ""; @@ -825,6 +825,7 @@ query += ')'; } } + query+=')'; selFullText.setQuery( query.toString() ); addOMSelect( selFullText ); root.addOMSelect( selFullText ); Added: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.java (rev 0) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.java 2009-01-23 07:43:38 UTC (rev 3742) @@ -0,0 +1,336 @@ +/** + * This file is part of the Uni-d project. + * $Id$ + * + * The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF + * ANY KIND, either express or implied. See the License for the specific language governing rights and + * limitations under the License. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + */ +package be.unid.tapestry.pages.fullTextSearch; + +import be.unid.tapestry.navigation.NavigationablePageImpl; +import be.unid.tapestry.util.UnidFormValidator; +import be.unid.tapestry.util.UnidProxyAccessor; +import be.unid.tapestry.util.Global; +import be.unid.tapestry.components.shared.DescriptionFactory; +import be.unid.tapestry.model.GMTable; +import be.unid.tapestry.model.GMField; +import be.unid.tapestry.pool.Pool; +import be.unid.tapestry.rights.AccessRight; +import be.unid.tapestry.pages.view.ViewPage; +import be.unid.tapestry.translator.UnidIntTranslator; +import be.unid.tapestry.translator.TranslatorFactory; +import be.unid.persistence.om.UnidProxy; +import be.unid.persistence.om.SelectorsState; +import be.unid.validation.HideIf; +import org.apache.log4j.Logger; +import org.apache.tapestry.annotations.Bean; +import org.apache.tapestry.annotations.Component; +import org.apache.tapestry.valid.ValidationDelegate; +import org.apache.tapestry.form.translator.Translator; +import org.apache.tapestry.form.IPropertySelectionModel; +import org.apache.tapestry.contrib.palette.Palette; +import org.joda.time.format.DateTimeFormatter; +import org.joda.time.format.DateTimeFormat; + +import java.util.*; + +import javolution.util.FastMap; + +/** + * Page for full-text search inside all tables + * + * @author Florin + * @version $Revision$ + */ +public abstract class FullTextSearchPage + extends NavigationablePageImpl<FullTextSearchPageParameters> +{ + private static final Logger log = Logger.getLogger( FullTextSearchPage.class ); + private DateTimeFormatter dateFormat = DateTimeFormat.forPattern( "dd.MM.YYYY" ); + + public abstract String getError(); + + public abstract void setError( String error ); + + public abstract String getCurrentTableName(); + + public abstract void setCurrentTableName( String tableName ); + + public abstract UnidProxy getCurrentRecord(); + + public abstract void setCurrentRecord( UnidProxy proxy ); + + @Bean( UnidFormValidator.class ) + public abstract ValidationDelegate getValidationDelegate(); + + public FullTextSearchPageParameters buildNewPageParameters() + { + return new FullTextSearchPageParameters(); + } + + public String getText() + { + return getPageParameters().getText(); + } + + public void setText( String text ) + { + getPageParameters().setText( text ); + } + + public int getMaxResultsPerTable() + { + return getPageParameters().getMaxResultsPerTable(); + } + + public void setMaxResultsPerTable( int maxResultsPerTable ) + { + getPageParameters().setMaxResultsPerTable( maxResultsPerTable ); + } + + public Map<String, List<UnidProxy>> getResults() + { + return getPageParameters().getResults(); + } + + public void setResults( Map<String, List<UnidProxy>> results ) + { + getPageParameters().setResults( results ); + } + + public boolean isOrderAscending() + { + return getPageParameters().isOrderAscending(); + } + + public void setOrderAscending( boolean orderAscending ) + { + getPageParameters().setOrderAscending( orderAscending ); + } + + public Date getPeriodStart() + { + return getPageParameters().getPeriodStart(); + } + + public void setPeriodStart( Date periodStart ) + { + getPageParameters().setPeriodStart( periodStart ); + } + + public Date getPeriodEnd() + { + return getPageParameters().getPeriodEnd(); + } + + public void setPeriodEnd( Date periodEnd ) + { + getPageParameters().setPeriodEnd( periodEnd ); + } + + public void find() + { + try + { + List<String> tableNames = DescriptionFactory.getTableNames(); + Map<String, List<UnidProxy>> results = new FastMap<String, List<UnidProxy>>(); + for ( String tableName : tableNames ) + { + GMTable table = DescriptionFactory.getTableDescription( tableName ); + if ( !table.isFullTextSearchable() ) continue; + if ( table.isHiddenIf() ) + { + Object o = Pool.getClass( table.getHideIfClass() ); + if ( o != null ) + { + if ( table.getHideIfParameters() != null ) + { + ( (HideIf) o ).setParameters( table.getHideIfParameters() ); + } + if ( ( (HideIf) o ).isHidden() ) continue; + } + } + if ( !getSessionUserAdmin().hasAccess( "t" + tableName, AccessRight.TABLE_PREFERENCE_DISPLAY ) ) + { + continue; + } + + if ( getTablesPaletteValue() != null && getTablesPaletteValue().contains( tableName ) ) continue; + + if ( isOrderAscending() ) + { + SelectorsState.setSorting( tableName, "unidModificationDate" ); + } + else + { + SelectorsState.setSorting( tableName, "-unidModificationDate" ); + } + + if ( getPeriodStart() != null ) + { + SelectorsState.setFilter( tableName, "ModificationDateStart", "o.unidModificationDate>='" + + dateFormat.print( + getPeriodStart().getTime() ) + + "'" ); + } + if ( getPeriodEnd() != null ) + { + SelectorsState.setFilter( tableName, "ModificationDateEnd", "o.unidModificationDate<='" + + dateFormat.print( + getPeriodEnd().getTime() ) + "'" ); + } + List<UnidProxy> proxies = UnidProxyAccessor.find( tableName, "UnidFullText", + new Class[]{ java.lang.String.class, int.class }, + new Object[]{ getText(), getMaxResultsPerTable() } ); + if ( proxies.size() > 0 ) + { + results.put( tableName, proxies ); + } + SelectorsState.setSorting( tableName, null ); + SelectorsState.setFilter( tableName, "ModificationDateStart", "" ); + SelectorsState.setFilter( tableName, "ModificationDateEnd", "" ); + } + + setResults( results ); + } + catch ( Exception e ) + { + log.error( e, e ); + setError( getTranslatedExceptionMessage( e ) ); + } + } + + public boolean isHavingResults() + { + return getResults() != null && getResults().size() > 0; + } + + public Collection<String> getTableNames() + { + if ( !isHavingResults() ) return null; + return getResults().keySet(); + } + + public List<UnidProxy> getCurrentRecordsForTable() + { + return getResults().get( getCurrentTableName() ); + } + + public String getDisplayForRecord() + { + return UnidProxyAccessor.getDisplay( getCurrentRecord(), this ); + } + + public String[] getCurrentViewParameters() + { + return new String[]{ getCurrentRecord().getUOID().getId(), getCurrentTableName() }; + } + + public void view( String id, String tableName ) + { + try + { + UnidProxy proxy = UnidProxyAccessor.findUoid( tableName, id ); + ViewPage page = (ViewPage) getNavigationManager().getForwardPage( this, "ViewPage", true ); + page.getPageParameters().setTableName( tableName ); + page.getPageParameters().setProxy( proxy ); + page.getPageParameters().setShowSelect( false ); + getNavigationManager().forward( page ); + } + catch ( Exception e ) + { + log.error( e, e ); + setError( getTranslatedExceptionMessage( e ) ); + } + } + + public Translator getIntTranslator() + { + return TranslatorFactory.getIntTranslator( false ); + } + + public abstract List<String> getTablesPaletteValue(); + + public abstract void setTablesPaletteValue( List<String> fields ); + + public IPropertySelectionModel getTablesPaletteModel() + { + final List<String> values = new ArrayList<String>(); + List<String> tableNames = DescriptionFactory.getTableNames(); + for ( String tableName : tableNames ) + { + GMTable table = DescriptionFactory.getTableDescription( tableName ); + if ( !table.isFullTextSearchable() ) continue; + if ( table.isHiddenIf() ) + { + Object o = Pool.getClass( table.getHideIfClass() ); + if ( o != null ) + { + if ( table.getHideIfParameters() != null ) + { + ( (HideIf) o ).setParameters( table.getHideIfParameters() ); + } + if ( ( (HideIf) o ).isHidden() ) continue; + } + } + if ( !getSessionUserAdmin().hasAccess( "t" + tableName, AccessRight.TABLE_PREFERENCE_DISPLAY ) ) + { + continue; + } + values.add( tableName ); + } + + return new IPropertySelectionModel() + { + + public int getOptionCount() + { + return values.size(); + } + + public Object getOption( int i ) + { + return values.get( i ); + } + + public String getLabel( int i ) + { + return getMessage( values.get( i ) ); + } + + public String getValue( int i ) + { + return values.get( i ); + } + + public Object translateValue( String string ) + { + return string; + } + }; + } + + @Component( type = "contrib:Palette", id = "tablesPalette", + bindings = { + "selected = tablesPaletteValue", + "model = tablesPaletteModel", + "sort = @org.apache.tapestry.contrib.palette.SortMode@USER" } ) + public abstract Palette getTablesPalette(); +} Property changes on: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPageParameters.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPageParameters.java (rev 0) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPageParameters.java 2009-01-23 07:43:38 UTC (rev 3742) @@ -0,0 +1,109 @@ +/** + * This file is part of the Uni-d project. + * $Id$ + * + * The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF + * ANY KIND, either express or implied. See the License for the specific language governing rights and + * limitations under the License. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + */ +package be.unid.tapestry.pages.fullTextSearch; + +import be.unid.tapestry.navigation.PageParametersImpl; +import be.unid.persistence.om.UnidProxy; + +import java.util.List; +import java.util.Map; +import java.util.Date; + +/** + * Parameters class for page FullTextSearch + * + * @author Florin + * @version $Revision$ + */ +public class FullTextSearchPageParameters + extends PageParametersImpl +{ + private String text; + private int maxResultsPerTable=10; + private Map<String, List<UnidProxy>> results; + private boolean orderAscending; + private Date periodStart; + private Date periodEnd; + + public String getText() + { + return text; + } + + public void setText( String text ) + { + this.text = text; + } + + public int getMaxResultsPerTable() + { + return maxResultsPerTable; + } + + public void setMaxResultsPerTable( int maxResultsPerTable ) + { + this.maxResultsPerTable = maxResultsPerTable; + } + + public Map<String, List<UnidProxy>> getResults() + { + return results; + } + + public void setResults( Map<String, List<UnidProxy>> results ) + { + this.results = results; + } + + public boolean isOrderAscending() + { + return orderAscending; + } + + public void setOrderAscending( boolean orderAscending ) + { + this.orderAscending = orderAscending; + } + + public Date getPeriodStart() + { + return periodStart; + } + + public void setPeriodStart( Date periodStart ) + { + this.periodStart = periodStart; + } + + public Date getPeriodEnd() + { + return periodEnd; + } + + public void setPeriodEnd( Date periodEnd ) + { + this.periodEnd = periodEnd; + } +} Property changes on: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPageParameters.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/Uni-d/tapestry/src/main/resources/Uni-d-tapestry.library =================================================================== --- trunk/Uni-d/tapestry/src/main/resources/Uni-d-tapestry.library 2009-01-21 14:12:25 UTC (rev 3741) +++ trunk/Uni-d/tapestry/src/main/resources/Uni-d-tapestry.library 2009-01-23 07:43:38 UTC (rev 3742) @@ -26,6 +26,7 @@ be.unid.tapestry.pages.add, be.unid.tapestry.pages.alerts, be.unid.tapestry.pages.edit, + be.unid.tapestry.pages.fullTextSearch, be.unid.tapestry.pages.help, be.unid.tapestry.pages.select, be.unid.tapestry.pages.tableManager, Added: trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.html =================================================================== --- trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.html (rev 0) +++ trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.html 2009-01-23 07:43:38 UTC (rev 3742) @@ -0,0 +1,102 @@ +<border jwcid="@Border" internationalizedTitle="prop:title"> + <link type="text/css" media="all" href="css/layout.css" rel="stylesheet"></link> + <link type="text/css" media="all" href="css/palette.css" rel="stylesheet"></link> + <span jwcid="keepAlive"/> + + <span class="displayError" jwcid="@Insert" value="prop:error"/> + + <form jwcid="@Form" delegate="bean:validationDelegate" enctype="multipart/form-data" + clientValidationEnabled="literal:true"> + <!--fieldset> + <legend><span jwcid="@Insert" value="message:FullTextSelectTitle"/></legend--> + <span class="defaultBlock"> + <span class="defaultField"> + <span class="defaultFieldLabel"> + <span key="FullTextSelectParameter"/> + </span> + <span class="defaultFieldValue"> + <input jwcid="@TextField" value="prop:text"/> + </span> + </span> + <span class="defaultField"> + <span class="defaultFieldLabel"> + <span key="MaxResultsPerTable"/> + </span> + <span class="defaultFieldValue"> + <input jwcid="@TextField" value="prop:maxResultsPerTable" translator="prop:intTranslator"/> + </span> + </span> + <span class="defaultField"> + <span class="defaultFieldLabel"> + <span key="OrderAscending"/> + </span> + <span class="defaultFieldValue"> + <input jwcid="@Checkbox" value="prop:orderAscending"/> + </span> + </span> + <span class="defaultField"> + <span class="defaultFieldLabel"> + <span key="PeriodStart"/> + </span> + <span class="defaultFieldValue"> + <input jwcid="@tacos:DatePicker" value="prop:periodStart" translator="translator:date,pattern=dd.MM.yyyy" size="10"/> + </span> + </span> + <span class="defaultField"> + <span class="defaultFieldLabel"> + <span key="PeriodEnd"/> + </span> + <span class="defaultFieldValue"> + <input jwcid="@tacos:DatePicker" value="prop:periodEnd" translator="translator:date,pattern=dd.MM.yyyy" size="10"/> + </span> + </span> + <span class="defaultField"> + <span class="defaultFieldLabel"> + <a href="#" onclick="var elem=document.getElementById('TABLES_TO_FILTER'); if (elem.style.display=='none') {elem.style.display='block';} else {elem.style.display='none';}"><span jwcid="@Insert" value="message:FilterOutTables"/></a> + </span> + <span class="defaultFieldValue"> + <span id="TABLES_TO_FILTER" style="display:none"> + <span jwcid="tablesPalette"/> + </span> + </span> + </span> + </span> + + + <span jwcid="@Submit" class="submitButton" value="message:Find" action="listener:find"/> + <!--/fieldset--> + <br/><br/> + <span jwcid="@If" condition="prop:havingResults"> + <!--fieldset--> + <center> + <legend><span jwcid="@Insert" value=""/></legend> + <span jwcid="@For" source="prop:tableNames" value="prop:currentTableName"> + <table width="100%" border="0"> + <tr> + <td><span jwcid="@Insert" value="prop:currentTableName"/></td> + </tr> + <span jwcid="@For" source="prop:currentRecordsForTable" value="prop:currentRecord"> + <tr> + <td><a jwcid="@NavigationLink" listener="listener:view" + parameters="prop:currentViewParameters" + class="result"> + <span jwcid="@Insert" value="prop:displayForRecord"/> + </a> + </td> + </tr> + </span> + </table> + <br/> + <br/> + </span> + <!--/fieldset--> + </center> + </span> + + <!--span jwcid="@Else"> + <span jwcid="@Insert" value="message:NoResults"/> + </span--> + </form> + + +</border> Added: trunk/Uni-d/template/src/main/webapp/css/palette.css =================================================================== --- trunk/Uni-d/template/src/main/webapp/css/palette.css (rev 0) +++ trunk/Uni-d/template/src/main/webapp/css/palette.css 2009-01-23 07:43:38 UTC (rev 3742) @@ -0,0 +1,25 @@ +TABLE.tapestry-palette TH { + font-size: 9pt; + font-weight: bold; + color: white; + background-color: #330066; + text-align: center; +} + +TD.available-cell SELECT { + font-weight: normal; + background-color: #FFFFFF; + width: 200px; +} + +TD.selected-cell SELECT { + font-weight: normal; + background-color: #FFFFFF; + width: 200px; +} + +TABLE.tapestry-palette TD.controls { + text-align: center; + vertical-align: middle; + width: 60px; +} \ No newline at end of file Modified: trunk/Uni-d/template/src/main/webapp/translations-common.txt =================================================================== --- trunk/Uni-d/template/src/main/webapp/translations-common.txt 2009-01-21 14:12:25 UTC (rev 3741) +++ trunk/Uni-d/template/src/main/webapp/translations-common.txt 2009-01-23 07:43:38 UTC (rev 3742) @@ -964,4 +964,26 @@ .label.en Text .label.nl Tekst .label.fr Texte -.label.ro Text \ No newline at end of file +.label.ro Text +.key title/FullTextSearchPage +.label.en Search text in all tables +.label.ro Cautare text in toate tabelele +.key MaxResultsPerTable/FullTextSearchPage +.label.en Max. results per table +.label.nr Nr. max. rezultate per tabela +.key OrderAscending/FullTextSearchPage +.label.en Order ascending by date +.label.ro Ordoneaza cresc. dupa data +.key PeriodStart/FullTextSearchPage +.label.en Period start +.label.nl Begindatum +.label.ro Perioada inceput +.label.fr Date de début +.key PeriodEnd/FullTextSearchPage +.label.en Period end +.label.nl Einde periode +.label.ro Sf. perioadei +.label.fr Fin du période +.key FilterOutTables/FullTextSearchPage +.label.en Filter out tables +.label.ro Taie din tabelele cautate \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2009-01-26 16:12:20
|
Revision: 3745 http://uni-d.svn.sourceforge.net/uni-d/?rev=3745&view=rev Author: max_brod Date: 2009-01-26 16:12:04 +0000 (Mon, 26 Jan 2009) Log Message: ----------- [UNI-444] Added tag "hide-anchors" for link and fake links, allowing to hide the select/add/view links on the screen. Modified Paths: -------------- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMField.java trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/UnidNodesMap.java trunk/Uni-d/generate/src/main/resources/uni-d.dtd trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Field.xml.vm trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/CommonInputContainerImpl.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInputContainer.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/Input.java trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.html trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.script Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMField.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMField.java 2009-01-23 11:00:42 UTC (rev 3744) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMField.java 2009-01-26 16:12:04 UTC (rev 3745) @@ -131,7 +131,8 @@ private String caseConversion; // "upper", "lower", "mixed", or a class name String unidType; // the type just as it is given in the table descriptors (needed later in the gui-descriptors) String renderer; - private boolean fullTextSearchable; + private boolean fullTextSearchable; // field will be searched by the generated findUnidFullText finder? + private boolean hideAnchors; // An indication, for link fields, that only the textbox or combobox with the reference will be visible (and no add/view/select links) // constraints boolean immutable; @@ -907,6 +908,11 @@ } fullTextSearchable = true; } + // @todo tests in this package: hide-anchors should only be allowed for links and fake-links (fields with suggests) + else if ( tag.equals( "hide-anchors" ) ) + { + hideAnchors = true; + } else if ( tag.equals( "compare" ) ) { if ( attr.getValue( "value" ) == null ) @@ -1581,7 +1587,7 @@ public boolean hasHideIfParameters() { - return hideIfParameters!=null; + return hideIfParameters != null; } public boolean isNoTranslation() @@ -1604,6 +1610,11 @@ return fullTextSearchable; } + public boolean isHideAnchors() + { + return hideAnchors; + } + public boolean isReference() { return fieldReference; Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/UnidNodesMap.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/UnidNodesMap.java 2009-01-23 11:00:42 UTC (rev 3744) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/UnidNodesMap.java 2009-01-26 16:12:04 UTC (rev 3745) @@ -121,5 +121,6 @@ put( "view-filter", null ); put( "no-translation", null ); put( "full-text-searchable", null ); + put( "hide-anchors", null ); } } Modified: trunk/Uni-d/generate/src/main/resources/uni-d.dtd =================================================================== --- trunk/Uni-d/generate/src/main/resources/uni-d.dtd 2009-01-23 11:00:42 UTC (rev 3744) +++ trunk/Uni-d/generate/src/main/resources/uni-d.dtd 2009-01-26 16:12:04 UTC (rev 3745) @@ -210,7 +210,8 @@ (is-description)?, (include)*, (no-translation)?, - (full-text-searchable)? + (full-text-searchable)?, + (hide-anchors)? )> <!ATTLIST field name CDATA #REQUIRED @@ -461,6 +462,12 @@ <!-- + An indication, for link fields, that only the textbox or combobox with the reference will be visible (and no add/view/select links) +--> +<!ELEMENT hide-anchors EMPTY> + + +<!-- define a finder method which selects records based on the selection criteria A select can either define criteria (selection tags), or define a list of subselects. Subselects are a way to build brackets in the selection. The operator which has to be used can be specified. Modified: trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Field.xml.vm =================================================================== --- trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Field.xml.vm 2009-01-23 11:00:42 UTC (rev 3744) +++ trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Field.xml.vm 2009-01-26 16:12:04 UTC (rev 3745) @@ -178,5 +178,9 @@ <full-text-searchable/> #end +#if( $field.isHideAnchors() ) + <hide-anchors/> +#end + </field> #end \ No newline at end of file Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/CommonInputContainerImpl.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/CommonInputContainerImpl.java 2009-01-23 11:00:42 UTC (rev 3744) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/CommonInputContainerImpl.java 2009-01-26 16:12:04 UTC (rev 3745) @@ -341,4 +341,9 @@ { return isFieldLink() && "UnidAttachment".equalsIgnoreCase( getLinkTableName() ); } + + public boolean isHideAnchors() + { + return getDescription().isHideAnchors(); + } } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.java 2009-01-23 11:00:42 UTC (rev 3744) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.java 2009-01-26 16:12:04 UTC (rev 3745) @@ -121,6 +121,9 @@ @Parameter( name = "size", defaultValue = "20" ) public abstract int getSize(); + @Parameter( name = "length", defaultValue = "-1" ) + public abstract int getLength(); + @Parameter( name = "selectionModel" ) public abstract IPropertySelectionModel getSelectionModel(); @@ -172,9 +175,12 @@ @Parameter( name = "caseConversionDescription", defaultValue = "0" ) public abstract int getCaseConversionDescription(); + @Parameter( name = "hideAnchors", defaultValue = "false" ) + public abstract boolean isHideAnchors(); + /* - * ********************************** Assets defintions: ************************************* - */ + * ********************************** Assets defintions: ************************************* + */ @Asset( value = "/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.html" ) public abstract IAsset get$template(); @@ -206,6 +212,7 @@ "id = 'inputBox_' + getFieldId()", "value = binderWrapper.inputBox", "size = size", + "maxlength = length", "displayName = displayName", "disabled = disabled", "onkeyup = getOnKeyUpTextField()", @@ -495,4 +502,9 @@ return ( isAjaxSelect() || isFakeLink() ) && !isEmbedded(); } + public boolean isNotHiddenAnchors() + { + return !isHideAnchors(); + } + } \ No newline at end of file Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInputContainer.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInputContainer.java 2009-01-23 11:00:42 UTC (rev 3744) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInputContainer.java 2009-01-26 16:12:04 UTC (rev 3745) @@ -56,7 +56,8 @@ "displayName = getDisplayName()", "required = isRequired()", "disabled = isDisabled()", - "size = getFieldSize()", + "length = getFieldLength()", + "size = getDisplayLength()", "fakeLink = isFakeLink()", "linkTableName = getLinkTableName()", "bidirFieldName = getBidirFieldName()", @@ -78,7 +79,8 @@ "informalParameters = getInformalParameters()", "caseConversion = getCaseConversion()", "caseConversionReference = getCaseConversionReference()", - "caseConversionDescription= getCaseConversionDescription()" + "caseConversionDescription= getCaseConversionDescription()", + "hideAnchors =isHideAnchors()" } ) UnidLinkInput getUnidLinkInputComponent(); @@ -98,8 +100,10 @@ boolean isDisabled(); - int getFieldSize(); + int getFieldLength(); + int getDisplayLength(); + boolean isFakeLink(); String getLinkTableName(); @@ -143,4 +147,6 @@ int getCaseConversionReference(); int getCaseConversionDescription(); + + boolean isHideAnchors(); } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/Input.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/Input.java 2009-01-23 11:00:42 UTC (rev 3744) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/Input.java 2009-01-26 16:12:04 UTC (rev 3745) @@ -53,6 +53,7 @@ // informal parameters could be stuff like javascript event handlers... They should be copy in tapestry components as they are private Map<String, String> informalParameters = new HashMap<String, String>(); Renderer renderer = new Renderer(); + private boolean hideAnchors; // An indication, for link fields, that only the textbox or combobox with the reference will be visible (and no add/view/select links) public static enum LinkGUILook { @@ -200,6 +201,10 @@ caseConversionClass = attr.getValue( "class" ).toString(); } } + else if (tag.equals("hide-anchors")) + { + hideAnchors=true; + } else { return super.canAppendChild( tag, attr ); @@ -424,5 +429,15 @@ { this.showLinkedTableFully = showLinkedTableFully; } + + public boolean isHideAnchors() + { + return hideAnchors; + } + + public void setHideAnchors( boolean hideAnchors ) + { + this.hideAnchors = hideAnchors; + } } Modified: trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.html =================================================================== --- trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.html 2009-01-23 11:00:42 UTC (rev 3744) +++ trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.html 2009-01-26 16:12:04 UTC (rev 3745) @@ -74,34 +74,35 @@ </span> </span> - <span jwcid="@If" condition="prop:comboboxOrEmbedded"> - <input jwcid="unidComboboxLinkField" class="displayInline" - onchange="prop:changeComboboxSelection"/> - - <span jwcid="@LinkSubmit" onclick="clearValidation(this);" class="displayInline" - listener="listener:prepareReturnHandler" action="listener:runAdd" id="prop:addId"> - <span key="Add"/> + <span jwcid="@If" condition="prop:notHiddenAnchors"> + <span jwcid="@If" condition="prop:comboboxOrEmbedded"> + <input jwcid="unidComboboxLinkField" class="displayInline" + onchange="prop:changeComboboxSelection"/> + + <span jwcid="@LinkSubmit" onclick="clearValidation(this);" class="displayInline" + listener="listener:prepareReturnHandler" action="listener:runAdd" id="prop:addId"> + <span key="Add"/> + </span> + </span> - - </span> - <span jwcid="display@LinkSubmit" onclick="clearValidation(this);" class="displayInline" - listener="listener:prepareReturnHandler" action="listener:runView" id="prop:viewId"> - <span jwcid="@If" condition="prop:comboboxOrEmbedded"> - <span jwcid="@If" condition="prop:valueSet"><span key="View"/></span> + <span jwcid="display@LinkSubmit" onclick="clearValidation(this);" class="displayInline" + listener="listener:prepareReturnHandler" action="listener:runView" id="prop:viewId"> + <span jwcid="@If" condition="prop:comboboxOrEmbedded"> + <span jwcid="@If" condition="prop:valueSet"><span key="View"/></span> + </span> + <span jwcid="@Else"> + <span jwcid="@Insert" value="prop:calculateDisplay"/> + </span> </span> - <span jwcid="@Else"> - <span jwcid="@Insert" value="prop:calculateDisplay"/> - </span> - </span> - + - <span jwcid="@If" condition="prop:notEmbedded"> - <span jwcid="runSelect@LinkSubmit" onclick="clearValidation(this);" class="prop:selectCssStyle" - listener="listener:prepareReturnHandler" action="listener:runSelect" id="prop:selectId"> - <span key="Select"/> + <span jwcid="@If" condition="prop:notEmbedded"> + <span jwcid="runSelect@LinkSubmit" onclick="clearValidation(this);" class="prop:selectCssStyle" + listener="listener:prepareReturnHandler" action="listener:runSelect" id="prop:selectId"> + <span key="Select"/> + </span> </span> </span> - </span> </span> Modified: trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.script =================================================================== --- trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.script 2009-01-23 11:00:42 UTC (rev 3744) +++ trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/input/unidLinkInput/UnidLinkInput.script 2009-01-26 16:12:04 UTC (rev 3745) @@ -183,7 +183,7 @@ var display = searchByIdStart('display', elem.parentNode.parentNode.getElementsByTagName('A')); if (isCombo.toString() != "true") { - display.innerHTML = displayValue; + if (display!=null) { display.innerHTML = displayValue;} if (isFake.toString() != "true") { var uoidElem = elem.parentNode.getElementsByTagName('INPUT')[0]; @@ -200,13 +200,13 @@ var combo = searchByIdStart('unidComboboxLinkField', elem.parentNode.parentNode.getElementsByTagName('select')); if (uoid && uoid != '') { - display.innerHTML = "View"; + if (display!=null) { display.innerHTML = "View"; } combo.options[combo.options.length] = new Option(displayValue, uoid); combo.selectedIndex = combo.options.length - 1; } else { - display.innerHTML = ""; + if (display!=null) { display.innerHTML = ""; } combo.selectedIndex = 0; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2009-01-29 13:10:44
|
Revision: 3751 http://uni-d.svn.sourceforge.net/uni-d/?rev=3751&view=rev Author: max_brod Date: 2009-01-29 13:10:39 +0000 (Thu, 29 Jan 2009) Log Message: ----------- [UNI-446] Added table UnidReport in infrastructure. Modified Paths: -------------- trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/infrastructure.xml trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/adminMenu/AdminMenu.java trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/userAdmin/adminMenu/AdminMenu.html Added Paths: ----------- trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/util/UnidReport.table Modified: trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/infrastructure.xml =================================================================== --- trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/infrastructure.xml 2009-01-27 15:52:20 UTC (rev 3750) +++ trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/infrastructure.xml 2009-01-29 13:10:39 UTC (rev 3751) @@ -16,6 +16,7 @@ <table file="classpath://be/unid/infrastructure/tapestry/UnidNavigation.table"/> <!-- utility files --> <table file="classpath://be/unid/infrastructure/util/UnidAlert.table"/> + <table file="classpath://be/unid/infrastructure/util/UnidReport.table"/> <table file="classpath://be/unid/infrastructure/util/UnidAttachment.table"/> <table file="classpath://be/unid/infrastructure/util/UnidTranslation.table"/> </database> Added: trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/util/UnidReport.table =================================================================== --- trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/util/UnidReport.table (rev 0) +++ trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/util/UnidReport.table 2009-01-29 13:10:39 UTC (rev 3751) @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE table SYSTEM "uni-d.dtd"> + +<table name="UnidReport" expected-amount="small"> + <security-role-remove>LocalUser, LocalAdmin</security-role-remove> + <hide/> + <page> + <field name="Name" type="string" length="20"> + <constraints> + <unique/> + <required/> + </constraints> + </field> + + <field name="Description" length="5000" renderer="text,lines=8,cols=50"> + <description> + A "report" node like in reports.xml. + </description> + </field> + + <field name="Report" type="UnidAttachment"> + <description> + The actual compiled report + </description> + </field> + </page> + + <select name="Name"> + <selection field="Name"/> + </select> +</table> \ No newline at end of file Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/adminMenu/AdminMenu.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/adminMenu/AdminMenu.java 2009-01-27 15:52:20 UTC (rev 3750) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/adminMenu/AdminMenu.java 2009-01-29 13:10:39 UTC (rev 3751) @@ -118,6 +118,14 @@ getNavigationManager().forward( page ); } + public void actionListenerUnidReport() + { + TableManagerPage page = + (TableManagerPage) getNavigationManager().getForwardPage( this, "TableManagerPage", true ); + page.getPageParameters().setTableName( "UnidReport" ); + getNavigationManager().forward( page ); + } + public void actionListenerBorderConfig( IRequestCycle cycle ) { AdminBorderConfig page = @@ -139,31 +147,11 @@ getNavigationManager().forward( page ); } - private String getTableLabel( String tableName ) - { - return getMessages().getMessage( "table." + tableName + ".label" ); - } - public String getTableLabel() { - return getTableLabel( getTableName() ); + return getMessages().getMessage( "table." + getTableName() + ".label" ); } - public String getTableLabelUnidUser() - { - return getTableLabel( "UnidUser" ); - } - - public String getTableLabelUnidRole() - { - return getTableLabel( "UnidRole" ); - } - - public String getTitle() - { - return getMessages().getMessage( "title" ); - } - public abstract Parser.ItemDescription getExtraItem(); public abstract void setExtraItem( Parser.ItemDescription item ); Modified: trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/userAdmin/adminMenu/AdminMenu.html =================================================================== --- trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/userAdmin/adminMenu/AdminMenu.html 2009-01-27 15:52:20 UTC (rev 3750) +++ trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/userAdmin/adminMenu/AdminMenu.html 2009-01-29 13:10:39 UTC (rev 3751) @@ -37,12 +37,16 @@ <span jwcid="keepAlive"/> <center> <span jwcid="@NavigationLink" listener="listener:actionListenerUnidUser"> - <span jwcid="@Insert" value="prop:tableLabelUnidUser"/> + <span jwcid="@Insert" value="message:table.UnidUser"/> </span> <br/> <span jwcid="@NavigationLink" listener="listener:actionListenerUnidRole"> - <span jwcid="@Insert" value="prop:tableLabelUnidRole"/> + <span jwcid="@Insert" value="message:table.UnidRole"/> </span> + <br/> + <span jwcid="@NavigationLink" listener="listener:actionListenerUnidReport"> + <span jwcid="@Insert" value="message:table.UnidReport"/> + </span> <hr/> <span jwcid="foreachTable"> <span jwcid="@NavigationLink" listener="listener:actionListenerTable" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2009-02-01 17:12:27
|
Revision: 3753 http://uni-d.svn.sourceforge.net/uni-d/?rev=3753&view=rev Author: max_brod Date: 2009-02-01 17:12:19 +0000 (Sun, 01 Feb 2009) Log Message: ----------- [UNI-448] Initial version (not yet checked for the subreports). Other small improvements. Modified Paths: -------------- trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/util/UnidReport.table trunk/Uni-d/server/src/main/java/be/unid/reporting/servlet/ReportServlet.java Modified: trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/util/UnidReport.table =================================================================== --- trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/util/UnidReport.table 2009-01-30 08:17:42 UTC (rev 3752) +++ trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/util/UnidReport.table 2009-02-01 17:12:19 UTC (rev 3753) @@ -3,6 +3,7 @@ <table name="UnidReport" expected-amount="small"> <security-role-remove>LocalUser, LocalAdmin</security-role-remove> + <security-role>NONE</security-role> <hide/> <page> <field name="Name" type="string" length="20"> @@ -14,18 +15,48 @@ <field name="Description" length="5000" renderer="text,lines=8,cols=50"> <description> - A "report" node like in reports.xml. + A "report" node like in reports.xml. </description> </field> - <field name="Report" type="UnidAttachment"> + <field name="ReportEN" type="UnidAttachment"> <description> - The actual compiled report + The actual compiled report, English version </description> </field> + <field name="ReportNL" type="UnidAttachment"> + <description> + The actual compiled report, NL version + </description> + </field> + <field name="ReportRO" type="UnidAttachment"> + <description> + The actual compiled report, RO version + </description> + </field> + <field name="ReportFR" type="UnidAttachment"> + <description> + The actual compiled report, FR version + </description> + </field> + <field name="ReportDE" type="UnidAttachment"> + <description> + The actual compiled report, DE version + </description> + </field> + <field name="ReportPT" type="UnidAttachment"> + <description> + The actual compiled report, PT version + </description> + </field> + <field name="Locked" type="boolean"/> </page> - <select name="Name"> + <constraints> + <immutable-if field="Locked"/> + </constraints> + + <select name="Name" type="single"> <selection field="Name"/> </select> </table> \ No newline at end of file Modified: trunk/Uni-d/server/src/main/java/be/unid/reporting/servlet/ReportServlet.java =================================================================== --- trunk/Uni-d/server/src/main/java/be/unid/reporting/servlet/ReportServlet.java 2009-01-30 08:17:42 UTC (rev 3752) +++ trunk/Uni-d/server/src/main/java/be/unid/reporting/servlet/ReportServlet.java 2009-02-01 17:12:19 UTC (rev 3753) @@ -41,10 +41,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; +import java.io.*; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; @@ -55,6 +52,8 @@ import java.util.Locale; import java.util.StringTokenizer; +import be.unid.persistence.om.UnidSelector; + /** * reporting servlet * @@ -68,6 +67,7 @@ public static final String PARAMETER_REPORT_EXTENSION = "ReportExtension"; public static final String PARAMETER_REPORT_CACHE_PAGES = "ReportCachePages"; public static final String PARAMETER_REPORT_CACHE_DIR = "ReportCacheDirectory"; + public static final String PARAMETER_EJB_CLIENT_PACKAGE = "EJBClientPackage"; public static final DateTimeFormatter dateParser = DateTimeFormat.forPattern( "yyyy-MM-dd" ); public static final DateTimeFormatter timeParser = DateTimeFormat.forPattern( "yyyy-MM-dd HH:mm:ss" ); @@ -79,6 +79,7 @@ int cachePages = 10; ServletResolver resolver; + String ejbClientPackage; public void init() throws ServletException @@ -118,6 +119,13 @@ log.info( "Default used : \"/data/jasper\"" ); cacheDirectory = "/data/jasper"; } + ejbClientPackage = getInitParameter( PARAMETER_EJB_CLIENT_PACKAGE ); + if ( ejbClientPackage == null ) + { + log.info( "Missing servlet parameter '" + PARAMETER_EJB_CLIENT_PACKAGE + "' " ); + log.info( "Default used: 'org.ictrace.client'" ); + ejbClientPackage = "org.ictrace.client"; + } // set up resolver resolver = new ServletResolver( getServletContext() ); @@ -232,9 +240,6 @@ return; } - SecurityAssociation.setPrincipal( new SimplePrincipal( username ) ); - SecurityAssociation.setCredential( password.toCharArray() ); - if ( filename == null || type == null ) { log.error( "\"file\" or \"type\" attributes must be specified in the query" ); @@ -242,7 +247,18 @@ } // resolve report file - InputStream reportInputStream = readReportFile( filename, language ); + + //SecurityAssociation.setPrincipal( new SimplePrincipal( username ) ); + //SecurityAssociation.setCredential( password.toCharArray() ); + // @todo When run from browser, the password received is not correct + // for the moment, will use these fixed user/password + SecurityAssociation.setPrincipal( new SimplePrincipal( "kealekekua" ) ); + SecurityAssociation.setCredential( "kaahumanu".toCharArray() ); + + InputStream reportInputStream = null; + reportInputStream = readReportFromTable( filename, language ); + + if ( reportInputStream == null ) reportInputStream = readReportFile( filename, language ); if ( reportInputStream == null ) { log.error( "could not read report file " + filename ); @@ -341,8 +357,10 @@ log.error( "error while exporting report ", e ); if ( !type.equalsIgnoreCase( "PRINT" ) ) { - res.setContentType("text/html"); - res.getOutputStream().print( "<html><header><title>Error</title></header><body><h1>Error</h1><br/>"+e.getMessage().replace("\n", "<br/>")+"</body></html>" ); + res.setContentType( "text/html" ); + res.getOutputStream().print( + "<html><header><title>Error</title></header><body><h1>Error</h1><br/>" + + e.getMessage().replace( "\n", "<br/>" ) + "</body></html>" ); } } finally @@ -387,6 +405,37 @@ return out; } + private InputStream readReportFromTable( String filename, String language ) + { + try + { + Class selectorUtilClass = Thread.currentThread().getContextClassLoader() + .loadClass( ejbClientPackage + ".UnidReportSelectorEJBUtil" ); + Object selectorUtil = selectorUtilClass.newInstance(); + UnidSelector selector = (UnidSelector) selectorUtilClass.getMethod( "get" ).invoke( selectorUtil ); + Object result = selector.getClass() + .getMethod( "findNameProxy", String.class ) + .invoke( selector, filename ); + if ( result == null ) return null; + Object report = + result.getClass().getMethod( "getReport" + language.toUpperCase(), null ).invoke( result, null ); + if ( report == null && !"EN".equals( language.toUpperCase() ) ) + { + report = result.getClass().getMethod( "getReportEN", null ).invoke( result, null ); + } + if ( report == null ) return null; + + Object reportData = report.getClass().getMethod( "getData", null ).invoke( report, null ); + if ( reportData == null ) return null; + return new ByteArrayInputStream( (byte[]) reportData ); + } + catch ( Exception e ) + { + log.error( e, e ); + return null; + } + } + private InputStream readReportFile( String filename, String language ) { InputStream in = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2009-02-02 10:19:15
|
Revision: 3754 http://uni-d.svn.sourceforge.net/uni-d/?rev=3754&view=rev Author: max_brod Date: 2009-02-02 10:19:05 +0000 (Mon, 02 Feb 2009) Log Message: ----------- [UNI-448] Improvements, fixing subreports. Modified Paths: -------------- trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/util/UnidReport.table trunk/Uni-d/server/src/main/java/be/unid/reporting/servlet/ReportServlet.java trunk/Uni-d/server/src/main/java/be/unid/reporting/servlet/ServletResolver.java trunk/Uni-d/tapestry/src/main/java/be/unid/reporting/parser/ReportParser.java Modified: trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/util/UnidReport.table =================================================================== --- trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/util/UnidReport.table 2009-02-01 17:12:19 UTC (rev 3753) +++ trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/util/UnidReport.table 2009-02-02 10:19:05 UTC (rev 3754) @@ -3,7 +3,6 @@ <table name="UnidReport" expected-amount="small"> <security-role-remove>LocalUser, LocalAdmin</security-role-remove> - <security-role>NONE</security-role> <hide/> <page> <field name="Name" type="string" length="20"> @@ -19,6 +18,9 @@ </description> </field> + <field name="SubReport" type="boolean"> + </field> + <field name="ReportEN" type="UnidAttachment"> <description> The actual compiled report, English version @@ -59,4 +61,10 @@ <select name="Name" type="single"> <selection field="Name"/> </select> + + <select name="MainReports"> + <selection field="SubReport" test="=0"/> + <hide/> + <no-translation/> + </select> </table> \ No newline at end of file Modified: trunk/Uni-d/server/src/main/java/be/unid/reporting/servlet/ReportServlet.java =================================================================== --- trunk/Uni-d/server/src/main/java/be/unid/reporting/servlet/ReportServlet.java 2009-02-01 17:12:19 UTC (rev 3753) +++ trunk/Uni-d/server/src/main/java/be/unid/reporting/servlet/ReportServlet.java 2009-02-02 10:19:05 UTC (rev 3754) @@ -128,7 +128,7 @@ } // set up resolver - resolver = new ServletResolver( getServletContext() ); + resolver = new ServletResolver( getServletContext(), ejbClientPackage ); } protected void doPut( HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse ) @@ -255,10 +255,7 @@ SecurityAssociation.setPrincipal( new SimplePrincipal( "kealekekua" ) ); SecurityAssociation.setCredential( "kaahumanu".toCharArray() ); - InputStream reportInputStream = null; - reportInputStream = readReportFromTable( filename, language ); - - if ( reportInputStream == null ) reportInputStream = readReportFile( filename, language ); + InputStream reportInputStream = readReportFile( filename, language ); if ( reportInputStream == null ) { log.error( "could not read report file " + filename ); @@ -405,37 +402,6 @@ return out; } - private InputStream readReportFromTable( String filename, String language ) - { - try - { - Class selectorUtilClass = Thread.currentThread().getContextClassLoader() - .loadClass( ejbClientPackage + ".UnidReportSelectorEJBUtil" ); - Object selectorUtil = selectorUtilClass.newInstance(); - UnidSelector selector = (UnidSelector) selectorUtilClass.getMethod( "get" ).invoke( selectorUtil ); - Object result = selector.getClass() - .getMethod( "findNameProxy", String.class ) - .invoke( selector, filename ); - if ( result == null ) return null; - Object report = - result.getClass().getMethod( "getReport" + language.toUpperCase(), null ).invoke( result, null ); - if ( report == null && !"EN".equals( language.toUpperCase() ) ) - { - report = result.getClass().getMethod( "getReportEN", null ).invoke( result, null ); - } - if ( report == null ) return null; - - Object reportData = report.getClass().getMethod( "getData", null ).invoke( report, null ); - if ( reportData == null ) return null; - return new ByteArrayInputStream( (byte[]) reportData ); - } - catch ( Exception e ) - { - log.error( e, e ); - return null; - } - } - private InputStream readReportFile( String filename, String language ) { InputStream in = null; Modified: trunk/Uni-d/server/src/main/java/be/unid/reporting/servlet/ServletResolver.java =================================================================== --- trunk/Uni-d/server/src/main/java/be/unid/reporting/servlet/ServletResolver.java 2009-02-01 17:12:19 UTC (rev 3753) +++ trunk/Uni-d/server/src/main/java/be/unid/reporting/servlet/ServletResolver.java 2009-02-02 10:19:05 UTC (rev 3754) @@ -25,11 +25,13 @@ package be.unid.reporting.servlet; - import javax.servlet.ServletContext; import java.io.InputStream; +import java.io.ByteArrayInputStream; import be.unid.reporting.i18n.ReportResolver; +import be.unid.persistence.om.UnidSelector; +import org.apache.log4j.Logger; /** * report resolver @@ -43,16 +45,70 @@ public static final String REPORTS_PATH = "/reports/"; public static final String REPORTS_IMAGE_PATH = "/reports/img/"; + private static final Logger log = Logger.getLogger( ServletResolver.class ); + private ServletContext context; + private String ejbClientPackage; public ServletResolver( ServletContext context ) { this.context = context; } + public ServletResolver( ServletContext context, String ejbClientPackage ) + { + this.context = context; + this.ejbClientPackage = ejbClientPackage; + } + + private InputStream getInputStreamFromTable( String target, String language ) + { + try + { + Class selectorUtilClass = Thread.currentThread().getContextClassLoader() + .loadClass( ejbClientPackage + ".UnidReportSelectorEJBUtil" ); + Object selectorUtil = selectorUtilClass.newInstance(); + UnidSelector selector = (UnidSelector) selectorUtilClass.getMethod( "get" ).invoke( selectorUtil ); + Object result = selector.getClass() + .getMethod( "findNameProxy", String.class ) + .invoke( selector, target ); + selector.remove(); + if ( result == null ) return null; + if ( language == null ) language = "EN"; + Object report = + result.getClass().getMethod( "getReport" + language.toUpperCase() ).invoke( result ); + + if ( report == null ) return null; + + Object reportData = report.getClass().getMethod( "getData" ).invoke( report ); + if ( reportData == null ) return null; + return new ByteArrayInputStream( (byte[]) reportData ); + } + catch ( Exception e ) + { + log.error( e, e ); + } + return null; + } + public InputStream getInputStream( String target ) { - target = preProcess( target ); + InputStream result = null; + if ( target.endsWith( ".jasper" ) ) + { + String fileName = target.substring( 0, target.indexOf( ".jasper" ) ); + if ( fileName.length() > 3 && fileName.charAt( fileName.length() - 3 ) == '_' ) + { + String reportName = fileName.substring( 0, fileName.length() - 3 ); + String language = fileName.substring( fileName.length() - 2 ); + result = getInputStreamFromTable( reportName, language ); + } + else + { + result = getInputStreamFromTable( fileName, null ); + } + } + if ( result != null ) return result; return context.getResourceAsStream( REPORTS_PATH + target ); } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/reporting/parser/ReportParser.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/reporting/parser/ReportParser.java 2009-02-01 17:12:19 UTC (rev 3753) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/reporting/parser/ReportParser.java 2009-02-02 10:19:05 UTC (rev 3754) @@ -184,7 +184,7 @@ { XMLParser parser; Document customReportDoc; - List<UnidProxy> customReports = UnidProxyAccessor.find( "UnidReport", "UnidAll", null, null ); + List<UnidProxy> customReports = UnidProxyAccessor.find( "UnidReport", "MainReports", null, null ); for ( UnidProxy proxy : customReports ) { // String name = (String) UnidProxyAccessor.getField( proxy, "Name" ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2009-02-03 07:52:58
|
Revision: 3756 http://uni-d.svn.sourceforge.net/uni-d/?rev=3756&view=rev Author: max_brod Date: 2009-02-03 07:52:50 +0000 (Tue, 03 Feb 2009) Log Message: ----------- [UNI-449] Allow to uppload a custom translations file for GUI. Modified Paths: -------------- trunk/Uni-d/client/src/main/java/be/unid/translations/TranslatorEJBLocal.java trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/infrastructure.xml trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/util/UnidReport.table trunk/Uni-d/server/src/main/java/be/unid/translations/TranslatorBean.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/adminMenu/AdminMenu.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/util/Global.java trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/userAdmin/adminMenu/AdminMenu.html trunk/Uni-d/template/src/main/webapp/translations-common.txt Added Paths: ----------- trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/util/UnidConfiguration.table Modified: trunk/Uni-d/client/src/main/java/be/unid/translations/TranslatorEJBLocal.java =================================================================== --- trunk/Uni-d/client/src/main/java/be/unid/translations/TranslatorEJBLocal.java 2009-02-02 13:59:32 UTC (rev 3755) +++ trunk/Uni-d/client/src/main/java/be/unid/translations/TranslatorEJBLocal.java 2009-02-03 07:52:50 UTC (rev 3756) @@ -26,6 +26,7 @@ import javax.ejb.Local; import java.util.List; +import java.io.InputStream; /** * Local interface for TranslatorEJB. @@ -36,8 +37,12 @@ @Local public interface TranslatorEJBLocal { + public void addCustomTranslationInputStream( InputStream stream ); + public String translateLabel( String language, String message, List<String> contexts ); + public String translateCaption( String language, String message, List<String> contexts ); + public String translateHelp( String language, String message, List<String> contexts ); void remove(); Modified: trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/infrastructure.xml =================================================================== --- trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/infrastructure.xml 2009-02-02 13:59:32 UTC (rev 3755) +++ trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/infrastructure.xml 2009-02-03 07:52:50 UTC (rev 3756) @@ -19,5 +19,6 @@ <table file="classpath://be/unid/infrastructure/util/UnidReport.table"/> <table file="classpath://be/unid/infrastructure/util/UnidAttachment.table"/> <table file="classpath://be/unid/infrastructure/util/UnidTranslation.table"/> + <table file="classpath://be/unid/infrastructure/util/UnidConfiguration.table"/> </database> </uni-d> \ No newline at end of file Added: trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/util/UnidConfiguration.table =================================================================== --- trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/util/UnidConfiguration.table (rev 0) +++ trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/util/UnidConfiguration.table 2009-02-03 07:52:50 UTC (rev 3756) @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE table SYSTEM "uni-d.dtd"> + +<table name="UnidConfiguration" expected-amount="small"> + <!--security-role-remove>LocalUser, LocalAdmin</security-role-remove--> + <description> + Table to store various installation-specific customizations, like a custom translations file. + Should be a single record. + </description> + <hide/> + <!--no-translation/--> + <page> + <field name="Translation" type="UnidAttachment"/> + </page> +</table> \ No newline at end of file Modified: trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/util/UnidReport.table =================================================================== --- trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/util/UnidReport.table 2009-02-02 13:59:32 UTC (rev 3755) +++ trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/util/UnidReport.table 2009-02-03 07:52:50 UTC (rev 3756) @@ -4,6 +4,9 @@ <table name="UnidReport" expected-amount="small"> <security-role-remove>LocalUser, LocalAdmin</security-role-remove> <hide/> + <description> + Table to store custom reports, uploaded by the user + </description> <page> <field name="Name" type="string" length="20"> <constraints> Modified: trunk/Uni-d/server/src/main/java/be/unid/translations/TranslatorBean.java =================================================================== --- trunk/Uni-d/server/src/main/java/be/unid/translations/TranslatorBean.java 2009-02-02 13:59:32 UTC (rev 3755) +++ trunk/Uni-d/server/src/main/java/be/unid/translations/TranslatorBean.java 2009-02-03 07:52:50 UTC (rev 3756) @@ -39,6 +39,7 @@ import java.sql.Date; import java.util.*; import java.io.Serializable; +import java.io.InputStream; /** * Utility bean for translating messages in client applications @@ -63,12 +64,18 @@ private TreeMap<String, TreeMap<Key, Translation>> translations; private String[] languages; + private InputStream customTranslationInputStream; private enum TranslationType { LABEL, CAPTION, HELP } + public void addCustomTranslationInputStream( InputStream stream ) + { + this.customTranslationInputStream = stream; + } + private void initTranslations() { if ( translations == null ) @@ -78,6 +85,11 @@ Parser parser = new Parser(); parser.parse( COMMON_TRANSLATIONS_FILE_NAME ); parser.parse( APP_TRANSLATIONS_FILE_NAME ); + if ( customTranslationInputStream != null ) + { + parser.parse( customTranslationInputStream ); + customTranslationInputStream.close(); + } translations = parser.getTranslations(); languages = parser.getLanguages(); if ( languages == null || languages.length == 0 ) @@ -92,19 +104,19 @@ } } - public String translateLabel(String language, String strKey, List<String> contexts) + public String translateLabel( String language, String strKey, List<String> contexts ) { - return translate(language, strKey, contexts, TranslationType.LABEL); + return translate( language, strKey, contexts, TranslationType.LABEL ); } - public String translateCaption(String language, String strKey, List<String> contexts) + public String translateCaption( String language, String strKey, List<String> contexts ) { - return translate(language, strKey, contexts, TranslationType.CAPTION); + return translate( language, strKey, contexts, TranslationType.CAPTION ); } - public String translateHelp(String language, String strKey, List<String> contexts) + public String translateHelp( String language, String strKey, List<String> contexts ) { - return translate(language, strKey, contexts, TranslationType.HELP); + return translate( language, strKey, contexts, TranslationType.HELP ); } private String translate( String language, String strKey, List<String> contexts, TranslationType type ) Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/adminMenu/AdminMenu.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/adminMenu/AdminMenu.java 2009-02-02 13:59:32 UTC (rev 3755) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/adminMenu/AdminMenu.java 2009-02-03 07:52:50 UTC (rev 3756) @@ -32,12 +32,16 @@ import be.unid.tapestry.pages.userAdmin.adminReportsConfig.AdminReportsConfig; import be.unid.tapestry.pages.userAdmin.adminTablesConfig.AdminTablesConfig; import be.unid.tapestry.pages.userAdmin.tableRightsPage.TableRightsPage; +import be.unid.tapestry.pages.add.AddPage; +import be.unid.tapestry.pages.edit.EditPage; import be.unid.tapestry.util.TranslationComparator; +import be.unid.tapestry.util.UnidProxyAccessor; import be.unid.tapestry.model.GMTable; import be.unid.tapestry.pool.Pool; import be.unid.tapestry.parser.border.Parser; import be.unid.validation.HideIf; import be.unid.validation.SimpleValidator; +import be.unid.persistence.om.UnidProxy; import org.apache.tapestry.IRequestCycle; import org.apache.tapestry.annotations.Component; import org.apache.tapestry.components.ForBean; @@ -126,6 +130,32 @@ getNavigationManager().forward( page ); } + public void actionInstallationConfiguration() + { + try + { + List<UnidProxy> results = UnidProxyAccessor.find( "UnidConfiguration", "UnidAll", null, null ); + if ( results.size() > 0 ) + { + EditPage page = + (EditPage) getNavigationManager().getForwardPage( this, "EditPage", true ); + page.getPageParameters().setTableName( "UnidConfiguration" ); + page.getPageParameters().setProxy( results.get( 0 ) ); + page.getPageParameters().setShowSelect( false ); + getNavigationManager().forward( page ); + return; + } + } + catch ( Exception e ) + { + log.error( e, e ); + } + AddPage page = + (AddPage) getNavigationManager().getForwardPage( this, "AddPage", true ); + page.getPageParameters().setTableName( "UnidConfiguration" ); + getNavigationManager().forward( page ); + } + public void actionListenerBorderConfig( IRequestCycle cycle ) { AdminBorderConfig page = Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/util/Global.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/util/Global.java 2009-02-02 13:59:32 UTC (rev 3755) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/util/Global.java 2009-02-03 07:52:50 UTC (rev 3756) @@ -24,13 +24,13 @@ */ package be.unid.tapestry.util; -import org.apache.log4j.Logger; - import be.unid.translations.*; import be.unid.tapestry.messages.MessagesGroup; import be.unid.persistence.om.TableSelectorsConfiguration; +import be.unid.persistence.om.UnidProxy; import java.io.Serializable; +import java.io.ByteArrayInputStream; import java.util.*; /** @@ -47,6 +47,8 @@ public class Global implements Serializable { + private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger( Global.class ); + private TranslatorEJBLocal translator; private Map<String, TableSelectorsConfiguration> selectorsState = new Hashtable<String, TableSelectorsConfiguration>(); @@ -89,7 +91,29 @@ } } } - if ( translator == null ) translator = TranslatorEJBUtil.getLocal(); + if ( translator == null ) + { + translator = TranslatorEJBUtil.getLocal(); + try + { + List<UnidProxy> results = UnidProxyAccessor.find( "UnidConfiguration", "UnidAll", null, null ); + if ( results.size() > 0 ) + { + Object translationAttachment = + UnidProxyAccessor.getField( results.get( 0 ), "Translation" ); + if ( translationAttachment != null ) + { + translator.addCustomTranslationInputStream( + new ByteArrayInputStream( (byte[]) translationAttachment.getClass().getMethod( "getData" ) + .invoke( translationAttachment ) ) ); + } + } + } + catch ( Exception e ) + { + log.error( e, e ); + } + } if ( type == TranslationType.HELP ) return translator.translateHelp( language, strKey, contexts ); if ( type == TranslationType.CAPTION ) return translator.translateCaption( language, strKey, contexts ); return translator.translateLabel( language, strKey, contexts ); Modified: trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/userAdmin/adminMenu/AdminMenu.html =================================================================== --- trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/userAdmin/adminMenu/AdminMenu.html 2009-02-02 13:59:32 UTC (rev 3755) +++ trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/userAdmin/adminMenu/AdminMenu.html 2009-02-03 07:52:50 UTC (rev 3756) @@ -47,6 +47,10 @@ <span jwcid="@NavigationLink" listener="listener:actionListenerUnidReport"> <span jwcid="@Insert" value="message:table.UnidReport"/> </span> + <br/> + <span jwcid="@NavigationLink" listener="listener:actionInstallationConfiguration"> + <span jwcid="@Insert" value="message:InstallationConfiguration"/> + </span> <hr/> <span jwcid="foreachTable"> <span jwcid="@NavigationLink" listener="listener:actionListenerTable" Modified: trunk/Uni-d/template/src/main/webapp/translations-common.txt =================================================================== --- trunk/Uni-d/template/src/main/webapp/translations-common.txt 2009-02-02 13:59:32 UTC (rev 3755) +++ trunk/Uni-d/template/src/main/webapp/translations-common.txt 2009-02-03 07:52:50 UTC (rev 3756) @@ -884,6 +884,9 @@ .label.nl Configureer rand .label.ro Configureaza Border .label.fr Configuration bordure +.key InstallationConfiguration/AdminMenu +.label.en Other customizations +.label.ro Alte configurari .key title/AdminMenu .label.en Administrator menu .label.nl Administrator menu This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2009-02-03 13:11:14
|
Revision: 3758 http://uni-d.svn.sourceforge.net/uni-d/?rev=3758&view=rev Author: max_brod Date: 2009-02-03 13:11:08 +0000 (Tue, 03 Feb 2009) Log Message: ----------- [UNI-439] Warn if text is bigger than searchable fields. Modified Paths: -------------- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.java trunk/Uni-d/template/src/main/webapp/translations-common.txt Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.java 2009-02-03 12:04:13 UTC (rev 3757) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.java 2009-02-03 13:11:08 UTC (rev 3758) @@ -28,6 +28,7 @@ import be.unid.tapestry.util.UnidFormValidator; import be.unid.tapestry.util.UnidProxyAccessor; import be.unid.tapestry.util.Global; +import be.unid.tapestry.util.FieldType; import be.unid.tapestry.components.shared.DescriptionFactory; import be.unid.tapestry.model.GMTable; import be.unid.tapestry.model.GMField; @@ -151,6 +152,11 @@ { List<String> tableNames = DescriptionFactory.getTableNames(); Map<String, List<UnidProxy>> results = new FastMap<String, List<UnidProxy>>(); + if ( getText() == null ) + { + setResults( results ); + return; + } for ( String tableName : tableNames ) { GMTable table = DescriptionFactory.getTableDescription( tableName ); @@ -174,6 +180,42 @@ if ( getTablesPaletteValue() != null && getTablesPaletteValue().contains( tableName ) ) continue; + boolean sizeOk = true; + for ( GMField field : table.getFields() ) + { + if ( field.isFullTextSearchable() ) + { + if ( field.getFieldType().equals( FieldType.TYPE_STRING ) ) + { + if ( getText().length() > field.getFieldLength() ) + { + sizeOk = false; + break; + } + } + if ( field.getFieldType().equals( FieldType.TYPE_LINK ) ) + { + GMTable linkTable = DescriptionFactory.getTableDescription( field.getLinkTableName() ); + for ( GMField field2 : linkTable.getFields() ) + { + if ( field2.getFieldType().equals( FieldType.TYPE_STRING ) ) + { + if ( getText().length() > field2.getFieldLength() ) + { + sizeOk = false; + break; + } + } + } + } + if ( !sizeOk ) break; + } + } + if ( !sizeOk ) + { + setError( getMessages().getMessage("ErrorTextTooBigForTable") + " "+getMessages().getMessage("table."+tableName) ); + } + if ( isOrderAscending() ) { SelectorsState.setSorting( tableName, "unidModificationDate" ); Modified: trunk/Uni-d/template/src/main/webapp/translations-common.txt =================================================================== --- trunk/Uni-d/template/src/main/webapp/translations-common.txt 2009-02-03 12:04:13 UTC (rev 3757) +++ trunk/Uni-d/template/src/main/webapp/translations-common.txt 2009-02-03 13:11:08 UTC (rev 3758) @@ -968,6 +968,9 @@ .label.nl Tekst .label.fr Texte .label.ro Text +.key ErrorTextTooBigForTable/FullTextSearchPage +.label.en Text too big for table +.label.ro Textul prea lung pentru tabela .key title/FullTextSearchPage .label.en Search text in all tables .label.ro Cautare text in toate tabelele This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2009-02-04 16:56:23
|
Revision: 3759 http://uni-d.svn.sourceforge.net/uni-d/?rev=3759&view=rev Author: max_brod Date: 2009-02-04 16:56:17 +0000 (Wed, 04 Feb 2009) Log Message: ----------- [UNI-451] Added attribute "prefered-select" for link-combobox fields, to indicate the finder which should populate the combobox. Modified Paths: -------------- trunk/Uni-d/docs/src/wiki/GUI-Descriptors-model.mm trunk/Uni-d/docs/src/wiki/object-model.mm trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMField.java trunk/Uni-d/generate/src/main/resources/uni-d.dtd trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Field.xml.vm trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/Input.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/selectionModel/LinkFieldSelectionModel.java Modified: trunk/Uni-d/docs/src/wiki/GUI-Descriptors-model.mm =================================================================== --- trunk/Uni-d/docs/src/wiki/GUI-Descriptors-model.mm 2009-02-03 13:11:08 UTC (rev 3758) +++ trunk/Uni-d/docs/src/wiki/GUI-Descriptors-model.mm 2009-02-04 16:56:17 UTC (rev 3759) @@ -68,6 +68,9 @@ <node COLOR="#669900" CREATED="1227018797046" ID="Freemind_Link_853642447" MODIFIED="1227018801484" TEXT="show-linked-table-fully"> <node CREATED="1227018825343" ID="Freemind_Link_460084597" MODIFIED="1227019003859" TEXT="should the combobox for links with expected amount small be unlimited (and not show that "..." sign)"/> </node> +<node COLOR="#669900" CREATED="1233762498078" ID="Freemind_Link_1975950562" MODIFIED="1233762503421" TEXT="prefered-select"> +<node CREATED="1233762505406" ID="Freemind_Link_277799937" MODIFIED="1233762507234" TEXT="used for link fields of type combobox. Represents the name of a finder (in the linked table) that will be used for populating the combobox (normally findUnidAll is used)"/> +</node> <node COLOR="#006699" CREATED="1146207550892" ID="Freemind_Link_127687021" MODIFIED="1146207562628" TEXT="multiple?"/> <node COLOR="#006699" CREATED="1146207555300" FOLDED="true" ID="Freemind_Link_344659397" MODIFIED="1146207581024" TEXT="unique?"> <node COLOR="#338800" CREATED="1146207605967" ID="Freemind_Link_1661751794" MODIFIED="1146207612130" TEXT="convert-class"/> Modified: trunk/Uni-d/docs/src/wiki/object-model.mm =================================================================== (Binary files differ) Modified: trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMField.java =================================================================== --- trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMField.java 2009-02-03 13:11:08 UTC (rev 3758) +++ trunk/Uni-d/generate/src/main/java/be/unid/persistence/xml/OMField.java 2009-02-04 16:56:17 UTC (rev 3759) @@ -133,6 +133,7 @@ String renderer; private boolean fullTextSearchable; // field will be searched by the generated findUnidFullText finder? private boolean hideAnchors; // An indication, for link fields, that only the textbox or combobox with the reference will be visible (and no add/view/select links) + private String preferedSelect; // constraints boolean immutable; @@ -336,6 +337,10 @@ { displayClass = value.toString(); } + else if ( name.equals( "prefered-select" ) ) + { + preferedSelect = value.toString(); + } else { throw new XMLTreeException( XMLTreeException.NOT_SUPPORTED_ERR ); @@ -2576,4 +2581,8 @@ public String getDisplayClass() { return displayClass; } public boolean hasDisplayClass() { return displayClass != null; } + + public String getPreferedSelect() { return preferedSelect; } + + public boolean hasPreferedSelect() { return preferedSelect != null; } } \ No newline at end of file Modified: trunk/Uni-d/generate/src/main/resources/uni-d.dtd =================================================================== --- trunk/Uni-d/generate/src/main/resources/uni-d.dtd 2009-02-03 13:11:08 UTC (rev 3758) +++ trunk/Uni-d/generate/src/main/resources/uni-d.dtd 2009-02-04 16:56:17 UTC (rev 3759) @@ -181,7 +181,9 @@ "display-length" is the number of characters used in GUI for the textbox of this field. Can be different from "length". of the widget for that field. Default length for strings is 50. Default length for dates and timestamps is 10. Default length for int and double is 5. - renderer is extra info for rendering the field in GUI. + "renderer" is extra info for rendering the field in GUI. + "prefered-select" is used for link fields of type combobox. Represents the name of a finder (in the linked table) that will be used for populating the combobox (normally findUnidAll is used) + --> <!ELEMENT field ( (description)?, (internal)?, @@ -222,6 +224,7 @@ display-length %integer; #IMPLIED renderer CDATA #IMPLIED priority %integer "5" +prefered-select CDATA "string" > <!-- Modified: trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Field.xml.vm =================================================================== --- trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Field.xml.vm 2009-02-03 13:11:08 UTC (rev 3758) +++ trunk/Uni-d/generate/src/main/velocity/gui-descriptors/Field.xml.vm 2009-02-04 16:56:17 UTC (rev 3759) @@ -85,8 +85,13 @@ #if( $field.hasDisplayClass() ) display-class="$field.DisplayClass" #end + +#if( $field.hasPreferedSelect() ) +prefered-select="$field.PreferedSelect" +#end > + #if( $field.isMultiple() ) <multiple/> #end Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/Input.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/Input.java 2009-02-03 13:11:08 UTC (rev 3758) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/model/Input.java 2009-02-04 16:56:17 UTC (rev 3759) @@ -54,6 +54,7 @@ private Map<String, String> informalParameters = new HashMap<String, String>(); Renderer renderer = new Renderer(); private boolean hideAnchors; // An indication, for link fields, that only the textbox or combobox with the reference will be visible (and no add/view/select links) + private String preferedSelect; public static enum LinkGUILook { @@ -66,7 +67,6 @@ // @todo possibly to OM xml's too protected boolean showLinkedTableFully; // should the combobox for links with expected amount small be unlimited (and not show that ... sign) - protected String bidirField; // for link fields, the bidirectional field in the linked table protected String referenceField; // for link fields, the reference-field in the linked table protected String descriptionField; // for link fields, the description-field in the linked table @@ -141,8 +141,12 @@ } else if ( name.equals( "show-linked-table-fully" ) ) { - showLinkedTableFully=Boolean.valueOf( value.toString() ); + showLinkedTableFully = Boolean.valueOf( value.toString() ); } + else if ( name.equals( "prefered-select" ) ) + { + preferedSelect = value.toString(); + } else { informalParameters.put( name.toString(), value.toString() ); @@ -201,9 +205,9 @@ caseConversionClass = attr.getValue( "class" ).toString(); } } - else if (tag.equals("hide-anchors")) + else if ( tag.equals( "hide-anchors" ) ) { - hideAnchors=true; + hideAnchors = true; } else { @@ -420,6 +424,10 @@ public String getDisplayClass() { return null; } + public boolean hasPreferedSelect() { return preferedSelect != null; } + + public String getPreferedSelect() { return preferedSelect; } + public boolean isShowLinkedTableFully() { return showLinkedTableFully; Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/selectionModel/LinkFieldSelectionModel.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/selectionModel/LinkFieldSelectionModel.java 2009-02-03 13:11:08 UTC (rev 3758) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/selectionModel/LinkFieldSelectionModel.java 2009-02-04 16:56:17 UTC (rev 3759) @@ -61,7 +61,6 @@ private List<String> uoids = null; private List<String> displays = null; - public LinkFieldSelectionModel( FieldBinder fieldBinder, Input fieldDescription, boolean required, IComponent resolver ) { @@ -90,7 +89,9 @@ List<UnidProxy> results; try { - results = UnidProxyAccessor.find( fieldDescription.getLinkTableName(), "UnidAll", null, null ); + String finder = ( fieldDescription.hasPreferedSelect() ) ? fieldDescription.getPreferedSelect() : "UnidAll"; + + results = UnidProxyAccessor.find( fieldDescription.getLinkTableName(), finder, null, null ); } catch ( Exception e ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pus...@us...> - 2009-02-06 14:10:11
|
Revision: 3760 http://uni-d.svn.sourceforge.net/uni-d/?rev=3760&view=rev Author: pushkutza Date: 2009-02-06 14:10:05 +0000 (Fri, 06 Feb 2009) Log Message: ----------- show all users that have gui access at login; display an image at login (configurable) Modified Paths: -------------- trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/useradmin/UnidUser.table trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/shared/ConfigurationKeys.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/login/loginPage/LoginPage.java trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/userAdmin/login/loginPage/LoginPage.html Modified: trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/useradmin/UnidUser.table =================================================================== --- trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/useradmin/UnidUser.table 2009-02-04 16:56:17 UTC (rev 3759) +++ trunk/Uni-d/generate/src/main/resources/be/unid/infrastructure/useradmin/UnidUser.table 2009-02-06 14:10:05 UTC (rev 3760) @@ -114,4 +114,9 @@ <security-role>NONE</security-role> <query> SELECT o FROM DMUnidUserBean o, IN (o.roles) i WHERE (i.administrator = 1 )</query> </select> + + <select name="GUIUsers"> + <security-role>NONE</security-role> + <query> SELECT o FROM DMUnidUserBean o, IN (o.roles) i WHERE (i.guiAccessProhibited = 0 )</query> + </select> </table> Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/shared/ConfigurationKeys.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/shared/ConfigurationKeys.java 2009-02-04 16:56:17 UTC (rev 3759) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/shared/ConfigurationKeys.java 2009-02-06 14:10:05 UTC (rev 3760) @@ -38,6 +38,7 @@ public static final String GUI_SELECT_PAGE_SIZE = "gui-select-page-size"; public static final String KEEP_ALIVE_REFRESH_TIME = "keep-alive-refresh-time"; public static final String LOGOFF_TIMEOUT_CLASS = "logoff-timeout-class"; + public static final String LOGIN_IMAGE_PATH = "login-image-path"; public static final String FINDER_LIMIT = "finder-limit"; public static final String LOGO_FILE = "logo-file"; public static final String MAX_ALERTS = "max-alerts"; Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/login/loginPage/LoginPage.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/login/loginPage/LoginPage.java 2009-02-04 16:56:17 UTC (rev 3759) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/userAdmin/login/loginPage/LoginPage.java 2009-02-06 14:10:05 UTC (rev 3760) @@ -2,24 +2,24 @@ * This file is part of the Uni-d project. * $Id$ * - * The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); - * you may not use this file except in compliance with the License. + * The contents of <code>this</code> file are subject to the Mozilla Public License Version 1.1 (the "License"); + * you may not use <code>this</code> file except in compliance with the License. * You may obtain a copy of the License at http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF * ANY KIND, either express or implied. See the License for the specific language governing rights and * limitations under the License. * - * Alternatively, the contents of this file may be used under the terms of + * Alternatively, the contents of <code>this</code> file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only + * of those above. If you wish to allow use of your version of <code>this</code> file only * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your + * use your version of <code>this</code> file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under + * the provisions above, a recipient may use your version of <code>this</code> file under * the terms of any one of the MPL, the GPL or the LGPL. */ @@ -28,12 +28,11 @@ import org.apache.tapestry.annotations.InjectObject; import org.apache.tapestry.html.BasePage; import org.apache.tapestry.web.WebRequest; -import org.apache.tapestry.form.IPropertySelectionModel; -import org.apache.tapestry.form.StringPropertySelectionModel; import org.apache.log4j.Logger; import be.unid.persistence.om.UnidProxy; -import be.unid.persistence.om.UnidPersistenceException; import be.unid.tapestry.util.UnidProxyAccessor; +import be.unid.tapestry.util.ResourceUtil; +import be.unid.tapestry.components.shared.ConfigurationKeys; import java.util.List; import java.util.ArrayList; @@ -52,7 +51,7 @@ * (The form for login should be hidden if scheme==https * An error message should be visible if scheme==https) * - * @return boolean indicating whether the https protocol is used to request this page + * @return <code>boolean</code> indicating whether the https protocol is used to request <code>this</code> page */ private static final Logger log = Logger.getLogger( LoginPage.class ); @@ -78,7 +77,7 @@ { try { - List<UnidProxy> users = UnidProxyAccessor.find( "UnidUser", "AdminUsers", null, null ); + List<UnidProxy> users = UnidProxyAccessor.find( "UnidUser", "GUIUsers", null, null ); return users; } catch ( Exception e ) @@ -92,8 +91,8 @@ { try { - String userName= (String) UnidProxyAccessor.getField( getCurrentUser(), "UserName" ); - return "<option value=\""+userName+"\">"+userName+"</option>"; + String userName = (String) UnidProxyAccessor.getField( getCurrentUser(), "UserName" ); + return "<option value=\"" + userName + "\">" + userName + "</option>"; } catch ( Exception e ) { @@ -103,6 +102,19 @@ } public void setUserOption( String userOption ) {} + + public void setImage( String s ) {} + + public String getImage() + { + try + { + String logo = ResourceUtil.getConfigString( ConfigurationKeys.LOGIN_IMAGE_PATH ); + if ( logo != null ) return logo; + } + catch ( Exception e ) {/*ignore*/} + return ""; + } } Modified: trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/userAdmin/login/loginPage/LoginPage.html =================================================================== --- trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/userAdmin/login/loginPage/LoginPage.html 2009-02-04 16:56:17 UTC (rev 3759) +++ trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/userAdmin/login/loginPage/LoginPage.html 2009-02-06 14:10:05 UTC (rev 3760) @@ -1,4 +1,4 @@ -<span jwcid="$remove$"> +<span jwcid="$remove$" style="display:none"> This file is part of the Uni-d project. $Id$ @@ -40,60 +40,69 @@ <span jwcid="@Else"> <table align="center" border="1"> - <tr><td> - <form name="lform" id="lform" method="POST" action="j_security_check"> - <p> + <tr> + <td> + <img jwcid="@Any" src="prop:image" alt="" border="0" vspace="0" hspace="0"/> + </td> + <td width="300px"> + <form name="lform" id="lform" method="POST" action="j_security_check"> + <p> <span id="textinput" style="display:block"> - Username <input type="text" id="j_username" name="j_username"/> +   Username <input type="text" id="j_username" name="j_username"/> <a href="#" onclick="swapInputs();">>></a> </span> <span id="listboxinput" style="display:none"> - Username <select onchange="document.getElementById('j_username').value=document.getElementById('usersN').options[document.getElementById('usersN').selectedIndex].text" id="usersN"> +   Username <select + onchange="document.getElementById('j_username').value=document.getElementById('usersN').options[document.getElementById('usersN').selectedIndex].text" + id="usersN" width="100%"> <for jwcid="@For" source="prop:users" value="prop:currentUser"> <span jwcid="@Insert" value="prop:userOption" raw="true"/> </for> - </select> + </select> <a href="#" onclick="swapInputs();">>></a> </span> - <br/> - Password <input type="password" id="j_password" name="j_password"/> - </p> + <br/> +   Password <input type="password" id="j_password" name="j_password"/> + </p> - <p align="center"><input type="submit" id="j_submit" name="login" value="login" - class="submitButton"/> - </p> - </form> - </td></tr> + <p align="center"><input type="submit" id="j_submit" name="login" value="login" + class="submitButton"/> + </p> + </form> + </td> + </tr> </table> </span> <script language="JavaScript"> - <!-- - function swapInputs() - { - var textinput=document.getElementById("textinput"); - var listboxinput=document.getElementById("listboxinput"); - if (textinput.style.display=="none") + // <!-- + function swapInputs() { - textinput.style.display="block"; - listboxinput.style.display="none"; - if (document.getElementById('usersN').options.length>0) + var textinput = document.getElementById("textinput"); + var listboxinput = document.getElementById("listboxinput"); + if ( textinput.style.display == "none" ) { - document.getElementById('j_username').value=document.getElementById('usersN').options[document.getElementById('usersN').selectedIndex].text; + textinput.style.display = "block"; + listboxinput.style.display = "none"; + if ( document.getElementById('usersN').options.length > 0 ) + { + document.getElementById('j_username').value = + document.getElementById('usersN').options[document.getElementById('usersN').selectedIndex].text; + } } - } - else - { - textinput.style.display="none"; - listboxinput.style.display="block"; - if (document.getElementById('usersN').options.length>0) + else { - document.getElementById('j_username').value=document.getElementById('usersN').options[document.getElementById('usersN').selectedIndex].text; + textinput.style.display = "none"; + listboxinput.style.display = "block"; + if ( document.getElementById('usersN').options.length > 0 ) + { + document.getElementById('j_username').value = + document.getElementById('usersN').options[document.getElementById('usersN').selectedIndex].text; + } } } - } - --> + // --> </script> </border> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pus...@us...> - 2009-02-09 16:34:29
|
Revision: 3761 http://uni-d.svn.sourceforge.net/uni-d/?rev=3761&view=rev Author: pushkutza Date: 2009-02-09 16:34:25 +0000 (Mon, 09 Feb 2009) Log Message: ----------- ICT-1434 - add remove buton for master detail Modified Paths: -------------- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/MasterDetailActionHandler.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/main/MasterDetailBaseComponent.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/main/MasterDetailMainComponentContainer.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/masterDetail/MasterDetailBasePage.java trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/masterDetail/main/MasterDetailBaseComponent.html trunk/Uni-d/template/src/main/webapp/translations-common.txt Added Paths: ----------- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/MasterDetailActionHandlerBase.java Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/MasterDetailActionHandler.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/MasterDetailActionHandler.java 2009-02-06 14:10:05 UTC (rev 3760) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/MasterDetailActionHandler.java 2009-02-09 16:34:25 UTC (rev 3761) @@ -34,6 +34,11 @@ void createTemplate( MASTER master, ArrayList<DETAIL> details, boolean fullLines, COMPONENT component ) throws Exception; + boolean isDeleteEntityAllowed( MASTER master, ArrayList<DETAIL> details, COMPONENT component ); + + void deleteEntity( MASTER master, ArrayList<DETAIL> details, COMPONENT component ) + throws Exception; + void clear( MASTER master, ArrayList<DETAIL> details, COMPONENT component ) throws Exception; Added: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/MasterDetailActionHandlerBase.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/MasterDetailActionHandlerBase.java (rev 0) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/MasterDetailActionHandlerBase.java 2009-02-09 16:34:25 UTC (rev 3761) @@ -0,0 +1,95 @@ +package be.unid.tapestry.components.masterDetail; + +import be.unid.tapestry.components.masterDetail.main.MasterDetailBaseComponent; +import be.unid.tapestry.pages.masterDetail.parameter.Parameter; + +import java.util.ArrayList; + +import org.apache.tapestry.IRequestCycle; +import org.apache.log4j.Logger; + +/** + * Description!!! + * + * @author <a href="mailto:an...@pa...">Andrei Chiritescu</a> + * @version $Revision$ + */ +public class MasterDetailActionHandlerBase< + COMPONENT extends MasterDetailBaseComponent, + MASTER extends Parameter, + DETAIL extends Parameter> + implements MasterDetailActionHandler<COMPONENT, MASTER, DETAIL> +{ + public void insertLines( ArrayList<DETAIL> details, int index, int noOfLines, COMPONENT component ) + throws Exception + { + + } + + public void insertLine( ArrayList<DETAIL> details, int index, COMPONENT component ) + throws Exception + { + + } + + public void deleteLine( ArrayList<DETAIL> details, int index, COMPONENT component ) + throws Exception + { + + } + + public void save( MASTER master, ArrayList<DETAIL> details, COMPONENT component ) + throws Exception + { + + } + + public void createTemplate( MASTER master, ArrayList<DETAIL> details, boolean fullLines, COMPONENT component ) + throws Exception + { + + } + + public boolean isDeleteEntityAllowed( MASTER master, ArrayList<DETAIL> details, COMPONENT component ) + { + return false; + } + + public void deleteEntity( MASTER master, ArrayList<DETAIL> details, COMPONENT component ) + throws Exception + { + + } + + public void clear( MASTER master, ArrayList<DETAIL> details, COMPONENT component ) + throws Exception + { + + } + + public void back( COMPONENT component ) + throws Exception + { + + } + + public void formSubmit( IRequestCycle cycle, COMPONENT masterDetailBaseComponent ) + { + + } + + public DETAIL getNewDetailParameter( COMPONENT masterDetailBaseComponent ) + { + return null; + } + + public MASTER getNewMasterParameter( COMPONENT masterDetailBaseComponent ) + { + return null; + } + + public void log( Logger log, Object object, Throwable throwable ) + { + + } +} Property changes on: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/MasterDetailActionHandlerBase.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/main/MasterDetailBaseComponent.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/main/MasterDetailBaseComponent.java 2009-02-06 14:10:05 UTC (rev 3760) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/main/MasterDetailBaseComponent.java 2009-02-09 16:34:25 UTC (rev 3761) @@ -76,6 +76,9 @@ @Parameter( name = "showCreateTemplateFull", defaultValue = "false" ) public abstract boolean isShowCreateTemplateFullButton(); + @Parameter( name = "deleteEntity", defaultValue = "false" ) + public abstract boolean isShowDeleteEntityButtonParam(); + /* * ********************************** Assets defintions: ************************************* */ @@ -199,6 +202,12 @@ public boolean isShowAddLinesButton() { return isEditMode() && isShowAddLines(); } + public boolean isShowDeleteEntityButton() + { + return isShowDeleteEntityButtonParam() && !getDisplayMode().isAdd() && + getActionHandler().isDeleteEntityAllowed( getMasterParameter(), getDetailParameters(), this ); + } + private boolean clearErrors; public void formSubmit( IRequestCycle cycle ) @@ -305,6 +314,20 @@ } } + public void deleteEntity() + { + try + { + getActionHandler().deleteEntity( getMasterParameter(), getDetailParameters(), this ); + clearErrors = true; + } + catch ( Exception e ) + { + getActionHandler().log( log, e, e ); + setError( getTranslatedExceptionMessage( e ) ); + } + } + public void cancel() { try @@ -474,6 +497,22 @@ return caption + "[Alt + " + getBackButtonAccesskey() + ']'; } + public String getDeleteEntityButtonLabel() + { + return getMessages().getMessage( "masterDetail.button.deleteEntity.label" ); + } + + public String getDeleteEntityButtonAccesskey() + { + return getMessages().getMessage( "masterDetail.button.deleteEntity.accesskey" ); + } + + public String getDeleteEntityButtonTitle() + { + String caption = getMessages().getMessage( "masterDetail.button.deleteEntity.caption" ); + return caption + "[Alt + " + getDeleteEntityButtonAccesskey() + ']'; + } + public boolean isEditMode() { return !getDisplayMode().isView(); Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/main/MasterDetailMainComponentContainer.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/main/MasterDetailMainComponentContainer.java 2009-02-06 14:10:05 UTC (rev 3760) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/components/masterDetail/main/MasterDetailMainComponentContainer.java 2009-02-09 16:34:25 UTC (rev 3761) @@ -34,9 +34,10 @@ "showRemove = isShowRemove()", "showAddLines = isShowAddLines()", "showBaseButtons = isShowBaseButtons()", - "showLinesSelector = isShowLinesSelectors()", - "showCreateTemplateFull = isShowCreateTemplateFull()" - } ) + "showLinesSelector = isShowLinesSelectors()", + "showCreateTemplateFull = isShowCreateTemplateFull()", + "deleteEntity = isShowDeleteEntity()" + } ) public abstract MasterDetailBaseComponent getMasterDetailComponent(); public abstract BasicParameterBlock getMasterBlock(); @@ -70,4 +71,6 @@ public abstract boolean isShowCreateTemplateFull(); public abstract boolean isShowLinesSelectors(); + + public abstract boolean isShowDeleteEntity(); } Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/masterDetail/MasterDetailBasePage.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/masterDetail/MasterDetailBasePage.java 2009-02-06 14:10:05 UTC (rev 3760) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/masterDetail/MasterDetailBasePage.java 2009-02-09 16:34:25 UTC (rev 3761) @@ -82,6 +82,11 @@ return false; } + public boolean isShowDeleteEntity() + { + return false; + } + @Override public abstract PARAMS buildNewPageParameters(); // force abstract Modified: trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/masterDetail/main/MasterDetailBaseComponent.html =================================================================== --- trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/masterDetail/main/MasterDetailBaseComponent.html 2009-02-06 14:10:05 UTC (rev 3760) +++ trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/components/masterDetail/main/MasterDetailBaseComponent.html 2009-02-09 16:34:25 UTC (rev 3761) @@ -150,6 +150,13 @@ title="prop:createTemplateFullButtonTitle" /> </span> + <span jwcid="@If" condition='prop:showDeleteEntityButton'> + <input jwcid="deleteEntity@Submit" action="listener:deleteEntity" + value="prop:deleteEntityButtonLabel" + accesskey="prop:deleteEntityButtonAccesskey" + title="prop:deleteEntityButtonTitle" + /> + </span> <input jwcid="cancel@Submit" action="listener:cancel" onclick="clearValidation(this)" value="prop:cancelButtonLabel" accesskey="prop:cancelButtonAccesskey" Modified: trunk/Uni-d/template/src/main/webapp/translations-common.txt =================================================================== --- trunk/Uni-d/template/src/main/webapp/translations-common.txt 2009-02-06 14:10:05 UTC (rev 3760) +++ trunk/Uni-d/template/src/main/webapp/translations-common.txt 2009-02-09 16:34:25 UTC (rev 3761) @@ -729,10 +729,10 @@ .label.fr Retour .caption.fr Retour .key masterDetail.button.back.accesskey/MasterDetailPage -.label.en X -.label.nl X -.label.ro X -.label.fr X +.label.en Z +.label.nl Z +.label.ro Z +.label.fr Z .key masterDetail.button.cancel/MasterDetailPage .label.en Cancel .caption.en Cancel @@ -825,6 +825,16 @@ .caption.ro Inapoi la registrul de declaratii .label.fr Arrête .key masterDetail.button.stop.accesskey/MasterDetailPage +.label.en Z +.label.nl Z +.label.ro Z +.label.fr Z +.key masterDetail.button.deleteEntity/MasterDetailPage +.label.en Delete +.caption.en Remove the document +.label.ro Sterge +.caption.ro Sterge documentul +.key masterDetail.button.deleteEntity.accesskey/MasterDetailPage .label.en X .label.nl X .label.ro X This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2009-02-18 16:57:30
|
Revision: 3765 http://uni-d.svn.sourceforge.net/uni-d/?rev=3765&view=rev Author: max_brod Date: 2009-02-18 16:57:24 +0000 (Wed, 18 Feb 2009) Log Message: ----------- [ICT-1456] Added a general purpose page, displaying a list of texts that it receives as parameters; title is also settable as parameter of the page. To be used, for example, for showing some kind of details/logs about some action. Modified Paths: -------------- trunk/Uni-d/tapestry/src/main/resources/Uni-d-tapestry.library trunk/Uni-d/template/src/main/webapp/translations-common.txt Added Paths: ----------- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/generalText/ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/generalText/GeneralTextPage.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/generalText/GeneralTextPageParameters.java trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/generalText/ trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/generalText/GeneralTextPage.html Added: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/generalText/GeneralTextPage.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/generalText/GeneralTextPage.java (rev 0) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/generalText/GeneralTextPage.java 2009-02-18 16:57:24 UTC (rev 3765) @@ -0,0 +1,60 @@ +/** + * This file is part of the Uni-d project. + * $Id$ + * + * The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF + * ANY KIND, either express or implied. See the License for the specific language governing rights and + * limitations under the License. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + */ +package be.unid.tapestry.pages.generalText; + +import be.unid.tapestry.navigation.NavigationablePageImpl; +import be.unid.tapestry.pages.fullTextSearch.FullTextSearchPageParameters; + +import java.util.List; + +/** + * A general purpose page, to show any texts it receives as parameters + * Useful when a page have generated some logs and the user may navigate here to see them + * + * @author Florin + * @version $Revision$ + */ +public abstract class GeneralTextPage + extends NavigationablePageImpl<GeneralTextPageParameters> +{ + public GeneralTextPageParameters buildNewPageParameters() + { + return new GeneralTextPageParameters(); + } + + public String getTitle() + { + return getPageParameters().getTitle(); + } + + public List<String> getTexts() + { + return getPageParameters().getTexts(); + } + + public abstract String getCurrentText(); + + public abstract void setCurrentText( String currentText ); +} Property changes on: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/generalText/GeneralTextPage.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/generalText/GeneralTextPageParameters.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/generalText/GeneralTextPageParameters.java (rev 0) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/generalText/GeneralTextPageParameters.java 2009-02-18 16:57:24 UTC (rev 3765) @@ -0,0 +1,62 @@ +/** + * This file is part of the Uni-d project. + * $Id$ + * + * The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF + * ANY KIND, either express or implied. See the License for the specific language governing rights and + * limitations under the License. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + */ +package be.unid.tapestry.pages.generalText; + +import be.unid.tapestry.navigation.PageParametersImpl; + +import java.util.List; + +/** + * Parameters class for the GeneralText page + * + * @author Florin + * @version $Revision$ + */ +public class GeneralTextPageParameters + extends PageParametersImpl +{ + private String title; + private List<String> texts; + + public String getTitle() + { + return title; + } + + public void setTitle( String title ) + { + this.title = title; + } + + public List<String> getTexts() + { + return texts; + } + + public void setTexts( List<String> texts ) + { + this.texts = texts; + } +} Property changes on: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/generalText/GeneralTextPageParameters.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/Uni-d/tapestry/src/main/resources/Uni-d-tapestry.library =================================================================== --- trunk/Uni-d/tapestry/src/main/resources/Uni-d-tapestry.library 2009-02-18 16:00:19 UTC (rev 3764) +++ trunk/Uni-d/tapestry/src/main/resources/Uni-d-tapestry.library 2009-02-18 16:57:24 UTC (rev 3765) @@ -27,6 +27,7 @@ be.unid.tapestry.pages.alerts, be.unid.tapestry.pages.edit, be.unid.tapestry.pages.fullTextSearch, + be.unid.tapestry.pages.generalText, be.unid.tapestry.pages.help, be.unid.tapestry.pages.select, be.unid.tapestry.pages.tableManager, Added: trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/generalText/GeneralTextPage.html =================================================================== --- trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/generalText/GeneralTextPage.html (rev 0) +++ trunk/Uni-d/tapestry/src/main/resources/be/unid/tapestry/pages/generalText/GeneralTextPage.html 2009-02-18 16:57:24 UTC (rev 3765) @@ -0,0 +1,13 @@ +<border jwcid="@Border" internationalizedTitle="prop:title"> + <span jwcid="keepAlive"/> + + <table width="90%" border="0"> + <span jwcid="@For" source="prop:texts" value="prop:currentText"> + <tr> + <td> + <span jwcid="@Insert" value="prop:currentText"/> + </td> + </tr> + </span> + </table> +</border> Modified: trunk/Uni-d/template/src/main/webapp/translations-common.txt =================================================================== --- trunk/Uni-d/template/src/main/webapp/translations-common.txt 2009-02-18 16:00:19 UTC (rev 3764) +++ trunk/Uni-d/template/src/main/webapp/translations-common.txt 2009-02-18 16:57:24 UTC (rev 3765) @@ -1013,3 +1013,14 @@ .label.nl Tabellen waarin niet wordt gezoch .label.ro Necautate .label.fr Pas recherchés +.key ShowDetails/Uni-d-fixed +.label.en Show details +.label.nl Toon detail +.label.ro Arata detalii +.label.fr Montréz les détails +.key Details/Uni-d-fixed +.label.en Details +.label.nl Detail +.label.ro Detalii +.label.fr Les détails + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2009-02-20 16:11:06
|
Revision: 3770 http://uni-d.svn.sourceforge.net/uni-d/?rev=3770&view=rev Author: max_brod Date: 2009-02-20 16:10:57 +0000 (Fri, 20 Feb 2009) Log Message: ----------- [UNI-439] Fix the checkings for searchable field sizes (to not be smaller then the searched text.) Improved the error message. Modified Paths: -------------- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.java trunk/Uni-d/template/src/main/webapp/translations-common.txt Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.java 2009-02-20 14:05:05 UTC (rev 3769) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.java 2009-02-20 16:10:57 UTC (rev 3770) @@ -180,7 +180,7 @@ if ( getTablesPaletteValue() != null && getTablesPaletteValue().contains( tableName ) ) continue; - boolean sizeOk = true; + GMField errorField = null; for ( GMField field : table.getFields() ) { if ( field.isFullTextSearchable() ) @@ -189,7 +189,7 @@ { if ( getText().length() > field.getFieldLength() ) { - sizeOk = false; + errorField = field; break; } } @@ -198,22 +198,30 @@ GMTable linkTable = DescriptionFactory.getTableDescription( field.getLinkTableName() ); for ( GMField field2 : linkTable.getFields() ) { - if ( field2.getFieldType().equals( FieldType.TYPE_STRING ) ) + if ( field2.getFieldType().equals( FieldType.TYPE_STRING ) && + field2.isFullTextSearchable() ) { if ( getText().length() > field2.getFieldLength() ) { - sizeOk = false; + errorField = field2; break; } } } } - if ( !sizeOk ) break; + if ( errorField != null ) break; } } - if ( !sizeOk ) + if ( errorField != null ) { - setError( getMessages().getMessage("ErrorTextTooBigForTable") + " "+getMessages().getMessage("table."+tableName) ); + String errorMessage = getMessages().getMessage( "ErrorTextTooBigForField" ); + errorMessage = errorMessage.replace( "$1", getMessages().getMessage( + "table." + errorField.getTableName() ) + '.' + getMessages() + .getMessage( "field." + errorField.getTableName() + '.' + errorField.getName() ) ); + errorMessage = errorMessage.replace( "$2", Integer.toString( errorField.getFieldLength() ) ); + setError( errorMessage ); + log.error( errorMessage ); + continue; } if ( isOrderAscending() ) Modified: trunk/Uni-d/template/src/main/webapp/translations-common.txt =================================================================== --- trunk/Uni-d/template/src/main/webapp/translations-common.txt 2009-02-20 14:05:05 UTC (rev 3769) +++ trunk/Uni-d/template/src/main/webapp/translations-common.txt 2009-02-20 16:10:57 UTC (rev 3770) @@ -978,9 +978,9 @@ .label.nl Tekst .label.fr Texte .label.ro Text -.key ErrorTextTooBigForTable/FullTextSearchPage -.label.en Text too big for table -.label.ro Textul prea lung pentru tabela +.key ErrorTextTooBigForField/FullTextSearchPage +.label.en Text too big. Field $1 only supports $2 characters. Filter out this table or reduce the number of characters. +.label.ro Textul prea lung. Campul $1 suporta doar $2 caractere. Elimina tabela din cautare sau redu numarul de caractere. .key title/FullTextSearchPage .label.en Search text in all tables .label.ro Cautare text in toate tabelele This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2009-02-20 16:16:01
|
Revision: 3771 http://uni-d.svn.sourceforge.net/uni-d/?rev=3771&view=rev Author: max_brod Date: 2009-02-20 16:15:43 +0000 (Fri, 20 Feb 2009) Log Message: ----------- [UNI-439] Improved the error message. Modified Paths: -------------- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.java trunk/Uni-d/template/src/main/webapp/translations-common.txt Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.java 2009-02-20 16:10:57 UTC (rev 3770) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/pages/fullTextSearch/FullTextSearchPage.java 2009-02-20 16:15:43 UTC (rev 3771) @@ -216,7 +216,7 @@ { String errorMessage = getMessages().getMessage( "ErrorTextTooBigForField" ); errorMessage = errorMessage.replace( "$1", getMessages().getMessage( - "table." + errorField.getTableName() ) + '.' + getMessages() + "table." + errorField.getTableName() ) + "->" + getMessages() .getMessage( "field." + errorField.getTableName() + '.' + errorField.getName() ) ); errorMessage = errorMessage.replace( "$2", Integer.toString( errorField.getFieldLength() ) ); setError( errorMessage ); Modified: trunk/Uni-d/template/src/main/webapp/translations-common.txt =================================================================== --- trunk/Uni-d/template/src/main/webapp/translations-common.txt 2009-02-20 16:10:57 UTC (rev 3770) +++ trunk/Uni-d/template/src/main/webapp/translations-common.txt 2009-02-20 16:15:43 UTC (rev 3771) @@ -979,8 +979,8 @@ .label.fr Texte .label.ro Text .key ErrorTextTooBigForField/FullTextSearchPage -.label.en Text too big. Field $1 only supports $2 characters. Filter out this table or reduce the number of characters. -.label.ro Textul prea lung. Campul $1 suporta doar $2 caractere. Elimina tabela din cautare sau redu numarul de caractere. +.label.en Text too big. Field [$1] only supports $2 characters. Filter out this table or reduce the number of characters. +.label.ro Textul prea lung. Campul [$1] suporta doar $2 caractere. Elimina tabela din cautare sau redu numarul de caractere. .key title/FullTextSearchPage .label.en Search text in all tables .label.ro Cautare text in toate tabelele This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <max...@us...> - 2009-02-26 10:12:09
|
Revision: 3777 http://uni-d.svn.sourceforge.net/uni-d/?rev=3777&view=rev Author: max_brod Date: 2009-02-26 10:12:00 +0000 (Thu, 26 Feb 2009) Log Message: ----------- Fix for translations, the InputStream no longer saved in the bean. Modified Paths: -------------- trunk/Uni-d/client/src/main/java/be/unid/translations/TranslatorEJB.java trunk/Uni-d/client/src/main/java/be/unid/translations/TranslatorEJBLocal.java trunk/Uni-d/server/src/main/java/be/unid/translations/TranslatorBean.java trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/util/Global.java Modified: trunk/Uni-d/client/src/main/java/be/unid/translations/TranslatorEJB.java =================================================================== --- trunk/Uni-d/client/src/main/java/be/unid/translations/TranslatorEJB.java 2009-02-25 17:21:22 UTC (rev 3776) +++ trunk/Uni-d/client/src/main/java/be/unid/translations/TranslatorEJB.java 2009-02-26 10:12:00 UTC (rev 3777) @@ -27,6 +27,7 @@ import javax.ejb.Local; import javax.ejb.Remote; import java.util.List; +import java.io.InputStream; /** * Remote interface for TranslatorEJB @@ -37,8 +38,13 @@ @Remote public interface TranslatorEJB { + public void initTranslations( InputStream customTranslationsInputStream ); + public String translateLabel( String language, String message, List<String> contexts ); + public String translateCaption( String language, String message, List<String> contexts ); + public String translateHelp( String language, String message, List<String> contexts ); + void remove(); } Modified: trunk/Uni-d/client/src/main/java/be/unid/translations/TranslatorEJBLocal.java =================================================================== --- trunk/Uni-d/client/src/main/java/be/unid/translations/TranslatorEJBLocal.java 2009-02-25 17:21:22 UTC (rev 3776) +++ trunk/Uni-d/client/src/main/java/be/unid/translations/TranslatorEJBLocal.java 2009-02-26 10:12:00 UTC (rev 3777) @@ -37,8 +37,8 @@ @Local public interface TranslatorEJBLocal { - public void addCustomTranslationInputStream( InputStream stream ); - + public void initTranslations( InputStream customTranslationsInputStream); + public String translateLabel( String language, String message, List<String> contexts ); public String translateCaption( String language, String message, List<String> contexts ); Modified: trunk/Uni-d/server/src/main/java/be/unid/translations/TranslatorBean.java =================================================================== --- trunk/Uni-d/server/src/main/java/be/unid/translations/TranslatorBean.java 2009-02-25 17:21:22 UTC (rev 3776) +++ trunk/Uni-d/server/src/main/java/be/unid/translations/TranslatorBean.java 2009-02-26 10:12:00 UTC (rev 3777) @@ -64,20 +64,14 @@ private TreeMap<String, TreeMap<Key, Translation>> translations; private String[] languages; - private InputStream customTranslationInputStream; private enum TranslationType { LABEL, CAPTION, HELP } - public void addCustomTranslationInputStream( InputStream stream ) + public void initTranslations( InputStream customTranslationInputStream ) { - this.customTranslationInputStream = stream; - } - - private void initTranslations() - { if ( translations == null ) { try @@ -126,7 +120,7 @@ log.warn( "Null key for translation" ); return null; } - initTranslations(); + initTranslations( null ); if ( translations == null ) return '[' + strKey + ']'; if ( languages == null || languages.length == 0 ) return '[' + strKey + ']'; Modified: trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/util/Global.java =================================================================== --- trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/util/Global.java 2009-02-25 17:21:22 UTC (rev 3776) +++ trunk/Uni-d/tapestry/src/main/java/be/unid/tapestry/util/Global.java 2009-02-26 10:12:00 UTC (rev 3777) @@ -31,6 +31,7 @@ import java.io.Serializable; import java.io.ByteArrayInputStream; +import java.io.InputStream; import java.util.*; /** @@ -101,17 +102,18 @@ try { List<UnidProxy> results = UnidProxyAccessor.find( "UnidConfiguration", "UnidAll", null, null ); + InputStream customTranslationsInputStream = null; if ( results.size() > 0 ) { Object translationAttachment = UnidProxyAccessor.getField( results.get( 0 ), "Translation" ); if ( translationAttachment != null ) { - translator.addCustomTranslationInputStream( - new ByteArrayInputStream( (byte[]) translationAttachment.getClass().getMethod( "getData" ) - .invoke( translationAttachment ) ) ); + customTranslationsInputStream = new ByteArrayInputStream( (byte[]) translationAttachment.getClass().getMethod( "getData" ) + .invoke( translationAttachment ) ); } } + translator.initTranslations( customTranslationsInputStream ); } catch ( Exception e ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |