Enforcing CSS Styles to be Loaded From Server ?

2009-08-17 Thread FaRHaN
I want to customize themes for my website for each Valid User, for that purpose 
i have a unique StyleSheet for each user. When a user Logs IN, a respective CSS 
file turned ON. The problem exist when a user Logs IN again after modifying 
styles (theme) of his website, the latest CSS file not being applied on the 
Website but preexisting styles for that user applied on the Website. 
When I Logs IN after clearing History (Cache) of the Browser(IE or FireFox), 
the latest styles are being applied. So I believe, problem exist in the Browser 
Cache. I have tried all Cache Headers for that purpose but it didn't work at 
all.
That's why i want to create a Random number in my URL (for HomePage) so that 
request to HomePage after Logging IN will go to Server (enforcing Styles to be 
loaded from Server, not from cache).

Is this a valid approach, and how i can add random number to my URL ?
Is there exist any other solution for clearing Browser's Cache ? 

Thanks...



  

Re: pannels with diffrent width and height

2009-08-17 Thread burnst...@burnstone.ch

Gerald Fernando schrieb:

i used table but it will not be placed in the full page even i put table
height and width = 100%
if possible please explain little bit about

div with CSS float: etc. in the page template.


div with CSS float means, that you use the float: CSS attribute to 
layout the div elements, like this:


htmlbody
div style=background-color:red; float:left;width:30%left/div
div style=background-color:blue; float: right;width:30%right/div
div style=background-color:greencenter/div
/body/html

You can find more information about that here:
* http://webdesign.about.com/od/advancedcss/a/aa010107.htm
* http://www.w3schools.com/css/pr_class_float.asp


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Populating a model with form data from external site

2009-08-17 Thread bgooren

Sophia,

There are a number of solutions to this. I will name two:

1) Use a stateless form, take a look at the HTML (and form action) it
generates, and post to that form from an external site. I have not tested
this myself, but I expect it will work like a charm. Since the form is
stateless, it should always be handle a post, wherever it comes from

2) mount a custom handler on a URL and process the form fields manually.
This is a two-fold process:
- extend (e.g.) URIRequestTargetUrlCodingStrategy, and mount that @
application init
- decode() is most important to you in this case, you should return an
instance of your IRequestTarget implementation here (see my next point)
- create a second class which implements IRequestTarget and handles the form
submit
- in respond( RequestCycle ) you can access the HttpServlet through
   HttpServletRequest request = ( (WebRequest) requestCycle.getRequest()
).getHttpServletRequest();

Hope this helps.

Bas


NYSophia wrote:
 
 Were you able to find a solution?
 
 
 LLehtinen wrote:
 
 Hi -
 
 I have normal POST requests coming from an external website. I would 
 like to have a model object's members populated with the matching HTTP 
 parameter values sent in the request. I have a feeling that there is an 
 obvious an elegant way of having Wicket do this for me, but I can't seem 
 to figure it out at this late hour. I would appreciate it if someone 
 could point me to the right direction!
 
 Right now I'm depending on a bunch of getRequest().getParameter() calls 
 which seems way too servlet-ish to be the right way of doing this.
 
 For clarity:
 
 Let's say the incoming POST request contains the following parameters: 
 id and name.
 
 I would like to have Wicket populate a POJO (a model object) like this 
 for me:
 
 public class ModelObject {
   private Long id;
   private String name;
 
   .. getters  setters ..
 
 }
 
 instead of doing
 
 Long id = Long.parseLong(getRequest().getParameter(id));
 String name = getRequest().getParameter(name);
 
 Thank you all for your quick responses to my earlier questions.
 
 --
 LL
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Populating-a-model-with-form-data-from-external-site-tp17395075p25001556.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Enforcing CSS Styles to be Loaded From Server ?

2009-08-17 Thread bgooren

Farhan,

Please take a look at IResourceSettings (accessible from the application
object). More specifically at 

http://wicket.apache.org/docs/wicket-1.3.2/wicket/apidocs/org/apache/wicket/settings/IResourceSettings.html#setAddLastModifiedTimeToResourceReferenceUrl(boolean)
setAddLastModifiedTimeToResourceReferenceUrl(boolean) 

Bas


Farhan Bajwa wrote:
 
 I want to customize themes for my website for each Valid User, for that
 purpose i have a unique StyleSheet for each user. When a user Logs IN, a
 respective CSS file turned ON. The problem exist when a user Logs IN again
 after modifying styles (theme) of his website, the latest CSS file not
 being applied on the Website but preexisting styles for that user applied
 on the Website. 
 When I Logs IN after clearing History (Cache) of the Browser(IE or
 FireFox), the latest styles are being applied. So I believe, problem exist
 in the Browser Cache. I have tried all Cache Headers for that purpose but
 it didn't work at all.
 That's why i want to create a Random number in my URL (for HomePage) so
 that request to HomePage after Logging IN will go to Server (enforcing
 Styles to be loaded from Server, not from cache).
 
 Is this a valid approach, and how i can add random number to my URL ?
 Is there exist any other solution for clearing Browser's Cache ? 
 
 Thanks...
 
 
 
   
 

-- 
View this message in context: 
http://www.nabble.com/Enforcing-CSS-Styles-to-be-Loaded-From-Server---tp25001539p25001595.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Enforcing CSS Styles to be Loaded From Server ?

2009-08-17 Thread FaRHaN
Thanks Bas...
It really works.





From: bgooren b...@iswd.nl
To: users@wicket.apache.org
Sent: Monday, August 17, 2009 11:27:12 AM
Subject: Re: Enforcing CSS Styles to be Loaded From Server ?


Farhan,

Please take a look at IResourceSettings (accessible from the application
object). More specifically at 

http://wicket.apache.org/docs/wicket-1.3.2/wicket/apidocs/org/apache/wicket/settings/IResourceSettings.html#setAddLastModifiedTimeToResourceReferenceUrl(boolean)
setAddLastModifiedTimeToResourceReferenceUrl(boolean) 

Bas


Farhan Bajwa wrote:
 
 I want to customize themes for my website for each Valid User, for that
 purpose i have a unique StyleSheet for each user. When a user Logs IN, a
 respective CSS file turned ON. The problem exist when a user Logs IN again
 after modifying styles (theme) of his website, the latest CSS file not
 being applied on the Website but preexisting styles for that user applied
 on the Website. 
 When I Logs IN after clearing History (Cache) of the Browser(IE or
 FireFox), the latest styles are being applied. So I believe, problem exist
 in the Browser Cache. I have tried all Cache Headers for that purpose but
 it didn't work at all.
 That's why i want to create a Random number in my URL (for HomePage) so
 that request to HomePage after Logging IN will go to Server (enforcing
 Styles to be loaded from Server, not from cache).
 
 Is this a valid approach, and how i can add random number to my URL ?
 Is there exist any other solution for clearing Browser's Cache ? 
 
 Thanks...
 
 
 
  
 

-- 
View this message in context: 
http://www.nabble.com/Enforcing-CSS-Styles-to-be-Loaded-From-Server---tp25001539p25001595.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Design of components utilizing JS, was: Wicket and JQuery - lavalamp

2009-08-17 Thread Joseph Pachod



m a totally newbie in the JS domain so your ramark really helps me
learning this stuff.
  

Have a look at http://docs.jquery.com/Plugins/Authoring

It provides lot of interesting hints on how to write jQuery plugins :)

++

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: CORRECT portlet+spring+hibernate configuration (Two options, what's right?)

2009-08-17 Thread Gonzalo Aguilar Delgado
Sure? 


But I will loose control over how transactions are managed...



El vie, 14-08-2009 a las 22:14 +0200, nino martinez wael escribió:

 Yup so you should either use open session in view or more preferred
 AFAIK detachable models.
 
 2009/8/14 Russell Simpkins russellsimpk...@hotmail.com:
 
  Errors like those are caused when the hibernate session is closed too soon.
  https://www.hibernate.org/43.html
  Russ
 
  Subject: Re: CORRECT portlet+spring+hibernate configuration (Two options, 
  what's right?)
  From: g...@aguilardelgado.com
  To: users@wicket.apache.org
  Date: Fri, 14 Aug 2009 11:01:05 +0200
 
  About the error I mentioned the exception it throws is:
 
  Caused by: org.hibernate.LazyInitializationException: failed to lazily
  initialize a collection of role:
  com.level2crm.hibernate.generated.User.contactBasicDetails, no session
  or session was closed
at
  org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
at
  org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
at
  org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
at
  org.hibernate.collection.PersistentSet.isEmpty(PersistentSet.java:146)
at com.level2crm.portals.crm.wicket.customerdetail.pages.ViewModePage
  $1.load(ViewModePage.java:54)
at
  org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetachableModel.java:122)
at
  org.apache.wicket.Component.getDefaultModelObject(Component.java:1664)
at
  org.apache.wicket.markup.html.list.ListView.getViewSize(ListView.java:221)
at
  org.apache.wicket.markup.html.list.ListView.onPopulate(ListView.java:525)
at
  org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:131)
at
  org.apache.wicket.Component.internalBeforeRender(Component.java:1061)
at org.apache.wicket.Component.beforeRender(Component.java:1095)
at
  org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1751)
... 109 more
 
 
  May this have something to do with selected configuration?
 
  Thank you again.
 
 
  El vie, 14-08-2009 a las 10:53 +0200, Gonzalo Aguilar Delgado escribió:
 
   Hi again,
  
   For a shake of completeness y will provide two of the working
   configurations I've found to work. I would know what's the one
   correct and why. Someone can throw a little bit light on this issue,
   please?
  
   -=[ First Choice ]=-
  
  
   -
   web.xml
   -
   ?xml version=1.0 encoding=UTF-8?
   !--
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 License); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at
  
  http://www.apache.org/licenses/LICENSE-2.0
  
 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
   --
   web-app xmlns=http://java.sun.com/xml/ns/j2ee;
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; version=2.4
   xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
   display-nameMy Portlet Application/display-name
  
   !-- For deploying on Websphere: disable WebSphere default
   portletcontainer
However: if you actually want to deploy on WebSphere Portal,
   comment the following out --
  
   context-param
  
   param-namecom.ibm.websphere.portletcontainer.PortletDeploymentEnabled/param-name
   param-valuefalse/param-value
   /context-param
  
   !-- This is for Spring self configuration --
   context-param
   param-namecontextConfigLocation/param-name
   param-value/WEB-INF/applicationContext.xml/param-value
   /context-param
  
   listener
  
   listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
   /listener
  
   !-- Enable the filters for Hibernate (How to check it's working?)--
  
   filter
   filter-nameopensessioninview/filter-name
  
   filter-classorg.springframework.orm.hibernate3.support.OpenSessionInViewFilter/filter-class
   /filter
   filter-mapping
   filter-nameopensessioninview/filter-name
   

Controlling the order of resource files

2009-08-17 Thread Arie Fishler
Hello,

The normal way wicket goes over resource files is based on locale and
different component names, application name etc.

What's the best practice for a situation in which I would like my
application to find the resource file based on a skin.
This means that for the same classes set (same wicket application) and same
local I still need to have different texts for a certain resource key.

It is like I need another selection mechanism for resource file which is not
the locale but something that is specific to the logic of my application.

Is there some way to implement that? Like making wicket look for resource
files the same way it does but add a prefix for every resource file name

Thanks,
Arie


Re: Controlling the order of resource files

2009-08-17 Thread bgooren

Arie,

This is possible out-of-the-box using Session.setStyle();

Setting a style will make wicket consider resource files and property files
with the style you've specified.

The following is from the Component javadoc:

Style - The style (skin) for a component is available through getStyle(),
which is equivalent to getSession().getStyle(). Styles are intended to give
a particular look to a Component or Resource that is independent of its
Locale. For example, a style might be a set of resources, including images
and markup files, which gives the design look of ocean to the user. If the
Session's style is set to ocean and these resources are given names
suffixed with _ocean, Wicket's resource management logic will prefer these
resources to other resources, such as default resources, which are not as
good of a match. 

Bas


Arie Fishler-2 wrote:
 
 Hello,
 
 The normal way wicket goes over resource files is based on locale and
 different component names, application name etc.
 
 What's the best practice for a situation in which I would like my
 application to find the resource file based on a skin.
 This means that for the same classes set (same wicket application) and
 same
 local I still need to have different texts for a certain resource key.
 
 It is like I need another selection mechanism for resource file which is
 not
 the locale but something that is specific to the logic of my application.
 
 Is there some way to implement that? Like making wicket look for resource
 files the same way it does but add a prefix for every resource file
 name
 
 Thanks,
 Arie
 
 

-- 
View this message in context: 
http://www.nabble.com/Controlling-the-order-of-resource-files-tp25002679p25002802.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



SV: Controlling the order of resource files

2009-08-17 Thread Wilhelmsen Tor Iver
 It is like I need another selection mechanism for resource file which
 is not
 the locale but something that is specific to the logic of my
 application.

Look at styles, i.e. Session.setStyle(String) and the documentation there for 
resource lookup. Basically the style tag goes before the locale, e.g. 
MyPage_foo_nl.properties for locale nl and style foo.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: DefaultDataTable gets no CSS styling

2009-08-17 Thread Kringlan

For anyone who might be interested... for all I know Igor is right and the
DataTable component does not add any CSS itself. This seems very odd to me
as a default styling would be nice to have. Anyway, I managed to find the
styling used in the Wicket-examples page and i just added it to my own CSS.
Here it goes:

table.dataview {
margin-bottom: 10px;
border-bottom: 1px solid #0079d6;
font-size: 1em;
font-family: arial;
width: 100%;
}

table.dataview caption { text-align: left; }
table.dataview tr { padding-top: 2px; padding-bottom: 2px; }
table.dataview tr.even { background-color: #ffebcd; }
table.dataview tr.odd { background-color: #fff; }
table.dataview tr td { padding-left: 8px; padding-right: 30px; }
table.dataview tr th { color: black; padding-top: 3px; padding-bottom: 3px;
padding-left: 8px; padding-right: 30px; background-color: #c1e4ff;
border-bottom: 1px solid #0079d6; border-top: 1px solid #0079d6; text-align:
left; white-space: nowrap; vertical-align: middle;}

table.dataview tr th { background-position: right;
background-repeat:no-repeat; }
table.dataview tr th.wicket_orderDown {
background-color: #87cbff; background-image:
url(displaytag/img/arrow_down.png); }
table.dataview tr th.wicket_orderUp {
background-color: #87cbff; background-image:
url(displaytag/img/arrow_up.png); }
table.dataview tr th.wicket_orderNone {
background-image: url(displaytag/img/arrow_off.png);
}
table.dataview tr th a { font-weight: normal; }
table.dataview #message { padding-left: 3px; }
table.dataview caption { padding-bottom: 2px; }

Just remember to add the .dataview CSS class to your component markup like
this:
table class=dataview wicket:id=myTable/table
-- 
View this message in context: 
http://www.nabble.com/DefaultDataTable-gets-no-CSS-styling-tp24913804p25002913.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Controlling the order of resource files

2009-08-17 Thread Arie Fishler
Many thanks guys...this is exactly what I meant. Happy this is found in the
base of wicket. Anoter example of how flexible and great wicket is:)

Cheers..great day to all.

Arie.

On Mon, Aug 17, 2009 at 11:17 AM, Wilhelmsen Tor Iver toriv...@arrive.nowrote:

  It is like I need another selection mechanism for resource file which
  is not
  the locale but something that is specific to the logic of my
  application.

 Look at styles, i.e. Session.setStyle(String) and the documentation there
 for resource lookup. Basically the style tag goes before the locale, e.g.
 MyPage_foo_nl.properties for locale nl and style foo.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: CORRECT portlet+spring+hibernate configuration (Two options, what's right?)

2009-08-17 Thread nino martinez wael
Why will you lose that?

2009/8/17 Gonzalo Aguilar Delgado g...@aguilardelgado.com:
 Sure?


 But I will loose control over how transactions are managed...



 El vie, 14-08-2009 a las 22:14 +0200, nino martinez wael escribió:

 Yup so you should either use open session in view or more preferred
 AFAIK detachable models.

 2009/8/14 Russell Simpkins russellsimpk...@hotmail.com:
 
  Errors like those are caused when the hibernate session is closed too soon.
  https://www.hibernate.org/43.html
  Russ
 
  Subject: Re: CORRECT portlet+spring+hibernate configuration (Two options, 
  what's right?)
  From: g...@aguilardelgado.com
  To: users@wicket.apache.org
  Date: Fri, 14 Aug 2009 11:01:05 +0200
 
  About the error I mentioned the exception it throws is:
 
  Caused by: org.hibernate.LazyInitializationException: failed to lazily
  initialize a collection of role:
  com.level2crm.hibernate.generated.User.contactBasicDetails, no session
  or session was closed
        at
  org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
        at
  org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
        at
  org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
        at
  org.hibernate.collection.PersistentSet.isEmpty(PersistentSet.java:146)
        at 
  com.level2crm.portals.crm.wicket.customerdetail.pages.ViewModePage
  $1.load(ViewModePage.java:54)
        at
  org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetachableModel.java:122)
        at
  org.apache.wicket.Component.getDefaultModelObject(Component.java:1664)
        at
  org.apache.wicket.markup.html.list.ListView.getViewSize(ListView.java:221)
        at
  org.apache.wicket.markup.html.list.ListView.onPopulate(ListView.java:525)
        at
  org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:131)
        at
  org.apache.wicket.Component.internalBeforeRender(Component.java:1061)
        at org.apache.wicket.Component.beforeRender(Component.java:1095)
        at
  org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1751)
        ... 109 more
 
 
  May this have something to do with selected configuration?
 
  Thank you again.
 
 
  El vie, 14-08-2009 a las 10:53 +0200, Gonzalo Aguilar Delgado escribió:
 
   Hi again,
  
   For a shake of completeness y will provide two of the working
   configurations I've found to work. I would know what's the one
   correct and why. Someone can throw a little bit light on this issue,
   please?
  
   -=[ First Choice ]=-
  
  
   -
   web.xml
   -
   ?xml version=1.0 encoding=UTF-8?
   !--
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
     regarding copyright ownership.  The ASF licenses this file
     to you under the Apache License, Version 2.0 (the
     License); you may not use this file except in compliance
     with the License.  You may obtain a copy of the License at
  
      http://www.apache.org/licenses/LICENSE-2.0
  
     Unless required by applicable law or agreed to in writing,
     software distributed under the License is distributed on an
     AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
     under the License.
   --
   web-app xmlns=http://java.sun.com/xml/ns/j2ee;
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; version=2.4
       xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
       display-nameMy Portlet Application/display-name
  
       !-- For deploying on Websphere: disable WebSphere default
   portletcontainer
            However: if you actually want to deploy on WebSphere Portal,
   comment the following out --
  
       context-param
  
   param-namecom.ibm.websphere.portletcontainer.PortletDeploymentEnabled/param-name
           param-valuefalse/param-value
       /context-param
  
       !-- This is for Spring self configuration --
       context-param
               param-namecontextConfigLocation/param-name
               param-value/WEB-INF/applicationContext.xml/param-value
       /context-param
  
       listener
  
   listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
       /listener
  
       !-- Enable the filters for Hibernate (How to check it's 
   working?)--
  
       filter
               filter-nameopensessioninview/filter-name
  
   filter-classorg.springframework.orm.hibernate3.support.OpenSessionInViewFilter/filter-class
       /filter
       

Re: CORRECT portlet+spring+hibernate configuration (Two options, what's right?)

2009-08-17 Thread Gonzalo Aguilar Delgado
Ok. Maybe I don't understand...

Let me show the situation. I have Spring + portlet + hibernate config
with transactions working with the current configuration:

I have my DAO objects under package
com.level2crm.hibernate.enterprise.dao.contact
And model under com.level2crm.model

I configured one advice:
tx:advice id=txAdvice transaction-manager=txManager
!-- the transactional semantics... --
tx:attributes
!-- all methods starting with 'get' are read-only --
tx:method name=get*  propagation=REQUIRED 
read-only=true /
!-- other methods use the default transaction settings 
(see below)
--
tx:method name=*  propagation=REQUIRED / !--
propagation=SUPPORTS --
/tx:attributes
/tx:advice

And several pointcuts:
aop:config
aop:pointcut id=allModelOperation expression=execution(*
com.level2crm.model..*+.*(..))/
aop:advisor advice-ref=txAdvice
pointcut-ref=allModelOperation/
/aop:config

aop:config
aop:pointcut id=allDAO expression=execution(*
com.level2crm.hibernate.enterprise.dao..*+.*(..))/
aop:advisor advice-ref=txAdvice pointcut-ref=allDAO/
/aop:config

aop:config
aop:pointcut id=TRG expression=execution(*
com.trg.dao.hibernate.*+.*(..))/
aop:advisor advice-ref=txAdvice pointcut-ref=TRG/
/aop:config

!-- This one does not work -- 
aop:config
aop:pointcut id=portlets expression=execution(*
com.level2crm.portals.crm.wicket.customerlist.pages..*+.*(..))/
aop:advisor advice-ref=txAdvice pointcut-ref=portlets/
/aop:config

I tried to configure the open session in view (web.xml):
listener

listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
/listener

!-- Enable the filters for Hibernate --

filter
filter-nameopensessioninview/filter-name

filter-classorg.springframework.orm.hibernate3.support.OpenSessionInViewFilter/filter-class
/filter
filter-mapping
filter-nameopensessioninview/filter-name
url-pattern/hibernate/*/url-pattern
/filter-mapping
!-- END hibernate filters --



But I found that this does not work. Because:


public class ViewModePage extends org.apache.wicket.markup.html.WebPage
{
...

@SpringBean(name = userDAOBean)
private UserDAO userDAO;


IModel loadableUserModel = new LoadableDetachableModel() {

@Override
protected Object load(){
User selectedUser = null;
String value =
((PortletRequestContext)RequestContext.get()).getPortletRequest().getParameter(crmportal:userId);
if(value!=null)
{
UuidUserType uuid = 
UuidUserType.fromString(value); //Works!!
userDAO.testSessoion(uuid);//Works!!

selectedUser = userDAO.find(uuid);//Works!!

if(!userDAO.isAttached(selectedUser)) //Works!! 
But is not
attached!!!
{

userDAO.save(selectedUser); //Attach it 
//Works!! It
saves/updates the object but it's still not attached
}



SetContactBasicDetail setDetails =
selectedUser.getContactBasicDetails(); //Works!! It gets the set
setDetails.isEmpty(); // FAIL FAIL Cannot load 
lazy

return setDetails.toArray();
}
return null;
}


};
...
}


This load() function does not work! It makes the exception. But:


1.- It can get the User. Because the pointcut works inside the
DAO?
2.- It can save the object. Because the pointcut works inside
the DAO?
3.- It can get the Set. Because the pointcut works inside the
DAO?


The  userDAO.testSessoion(uuid); function inside the DAO object works.
What I do is to get the Hibernate session, check that is ok. And check
also if the transaction was created and I can attach and use object.
Inside the userDAO.testSessoion function I do the same code that in the
load() function but this time everything works!

I'm sure that it works because it has a session and a open transaction
due to the 

Re: crud app with wicket

2009-08-17 Thread Ivan Dudko
Thank you guys!

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: CORRECT portlet+spring+hibernate configuration (Two options, what's right?)

2009-08-17 Thread nino martinez wael
Hmm

I have several suggestions.

The order of the web filters are important. You could also try with
with the wicket spring managed apps, im not sure how that applies.

And are you sure that your filter ( /hibernate/*), get's hit? What's
your wicket filter url, the same or?

2009/8/17 Gonzalo Aguilar Delgado g...@aguilardelgado.com:
 Ok. Maybe I don't understand...

 Let me show the situation. I have Spring + portlet + hibernate config
 with transactions working with the current configuration:

 I have my DAO objects under package
 com.level2crm.hibernate.enterprise.dao.contact
 And model under com.level2crm.model

 I configured one advice:
        tx:advice id=txAdvice transaction-manager=txManager
                !-- the transactional semantics... --
                tx:attributes
                        !-- all methods starting with 'get' are read-only --
                        tx:method name=get*  propagation=REQUIRED 
 read-only=true /
                        !-- other methods use the default transaction 
 settings (see below)
 --
                        tx:method name=*  propagation=REQUIRED / !--
 propagation=SUPPORTS --
                /tx:attributes
        /tx:advice

 And several pointcuts:
        aop:config
                aop:pointcut id=allModelOperation expression=execution(*
 com.level2crm.model..*+.*(..))/
                aop:advisor advice-ref=txAdvice
 pointcut-ref=allModelOperation/
        /aop:config

        aop:config
                aop:pointcut id=allDAO expression=execution(*
 com.level2crm.hibernate.enterprise.dao..*+.*(..))/
                aop:advisor advice-ref=txAdvice pointcut-ref=allDAO/
        /aop:config

        aop:config
                aop:pointcut id=TRG expression=execution(*
 com.trg.dao.hibernate.*+.*(..))/
                aop:advisor advice-ref=txAdvice pointcut-ref=TRG/
        /aop:config

 !-- This one does not work --
    aop:config
                aop:pointcut id=portlets expression=execution(*
 com.level2crm.portals.crm.wicket.customerlist.pages..*+.*(..))/
                aop:advisor advice-ref=txAdvice pointcut-ref=portlets/
        /aop:config

 I tried to configure the open session in view (web.xml):
        listener

 listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
        /listener

        !-- Enable the filters for Hibernate --

        filter
                filter-nameopensessioninview/filter-name

 filter-classorg.springframework.orm.hibernate3.support.OpenSessionInViewFilter/filter-class
        /filter
        filter-mapping
                filter-nameopensessioninview/filter-name
                url-pattern/hibernate/*/url-pattern
        /filter-mapping
        !-- END hibernate filters --



 But I found that this does not work. Because:


 public class ViewModePage extends org.apache.wicket.markup.html.WebPage
 {
 ...

       �...@springbean(name = userDAOBean)
        private UserDAO userDAO;


        IModel loadableUserModel = new LoadableDetachableModel() {

               �...@override
                protected Object load(){
                        User selectedUser = null;
                        String value =
 ((PortletRequestContext)RequestContext.get()).getPortletRequest().getParameter(crmportal:userId);
                        if(value!=null)
                        {
                                UuidUserType uuid = 
 UuidUserType.fromString(value); //Works!!
                                userDAO.testSessoion(uuid);//Works!!

                                selectedUser = userDAO.find(uuid);//Works!!

                                if(!userDAO.isAttached(selectedUser)) 
 //Works!! But is not
 attached!!!
                                {

                                        userDAO.save(selectedUser); //Attach 
 it     //Works!! It
 saves/updates the object but it's still not attached
                                }



                                SetContactBasicDetail setDetails =
 selectedUser.getContactBasicDetails(); //Works!! It gets the set
                                setDetails.isEmpty(); // FAIL FAIL Cannot load 
 lazy

                                return setDetails.toArray();
                        }
                        return null;
                }


        };
 ...
 }


 This load() function does not work! It makes the exception. But:


        1.- It can get the User. Because the pointcut works inside the
        DAO?
        2.- It can save the object. Because the pointcut works inside
        the DAO?
        3.- It can get the Set. Because the pointcut works inside the
        DAO?


 The  userDAO.testSessoion(uuid); function inside the DAO object works.
 What I do is to get the Hibernate session, check that is ok. And check
 also if the transaction was created and I can attach and use object.
 Inside the userDAO.testSessoion function I do the same code that in the
 load() function but this time everything works!

 I'm sure that it works because 

Tree based on database

2009-08-17 Thread Oliver-Sven Fritsch

Hi everybody!

Still new to Wicket I'm trying to get a wicket tree with nodes from a 
database. What I got so far is a simple JTree put onto a JFrame. What I 
don't understand is how to geht my tree onto a wicket web page. I'm 
kinda confused on how to get things working. As far as I now wicket tree 
uses jtree aswell, but I'm really stuck at this point. I'd really 
appreaciate any help from anyone pointing me into the right direction.


public class MyJTree extends JFrame {

   Connection con = null;
   Statement st = null;
   ResultSet rs = null;

   public static void main(String args[]) throws Exception {
   new MyJTree();
   }

   public MyJTree() throws Exception {

   super(Retrieving data from database );

   MyConnection mycon = MyConnectionFactory.getNewConnection();
   mycon.connect();

   ArrayList list = new ArrayList();
   list.add(The Root);

   try {
   String sql = select key, node_id, parent_id, caption from 
mytable;


   st = mycon.createPreparedStatement(sql);
   rs = st.executeQuery(sql);


   while (rs.next()) {
   Object value[] = {rs.getString(1), rs.getString(2),
   rs.getString(3), rs.getString(4)};
   list.add(value);
   }
   } catch (Exception e) {
   System.out.println(e);
   }
   rs.close();
   st.close();

   Object hierarchy[] = list.toArray();

   JFrame frame = new JFrame();
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   Container content = getContentPane();

   DefaultMutableTreeNode root = processHierarchy(hierarchy);
   JTree tree = new JTree(root);
   content.add(new JScrollPane(tree), BorderLayout.CENTER);
   setSize(275, 300);
   setLocation(300, 100);
   setVisible(true);
   }

   private DefaultMutableTreeNode processHierarchy(Object[] hierarchy) {
   DefaultMutableTreeNode node = new 
DefaultMutableTreeNode(hierarchy[0]);

   DefaultMutableTreeNode child;
   for (int i = 1; i  hierarchy.length; i++) {
   Object nodeSpecifier = hierarchy[i];
   if (nodeSpecifier instanceof Object[]) // Ie node with children
   {
   child = processHierarchy((Object[]) nodeSpecifier);
   } else {
   child = new DefaultMutableTreeNode(nodeSpecifier); // Ie 
Leaf

   }
   node.add(child);
   }
   return (node);
   }
}


Thanks!
Oliver

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



how to create a TabPanel as a separate class.

2009-08-17 Thread Gerald Fernando
Hello Friends,


This is my need

 what i want whenever i need this tabbedPanel i want to place in any page

 public class choicePanel extends TabbedPanel{
super();
}

not like
 public class choicePanel extends webpage


i have created the above one but it shows the error that

he constructor TabbedPanel() is undefined

please give me urgent Reply
-- 
Thanksregards,
Gerald A


Re: Tree based on database

2009-08-17 Thread jWeekend

Oliver,

Wicket (core and extensions) has several tree components and they all
currently use Swing's TreeModel (javax.swing.tree.TreeModel). I say
currently as this is the case upto and including Wicket 1.4 but there is
some discussion about using a new type of model, more suited to webapps, in
Wicket 1.5. Swing's TreeModel is not coupled to JTree at all even though it
happens to be the model JTree uses. Wicket does _not_ use JTree, but its
trees use TreeModel.

In the context of a Swing UI your code below would be much more flexible,
powerful and in the spirit of Swing if you were to explicitly use a
TreeModel to manage interaction with the underlying data; I expect even
Swing's out-of-the-box AbstractTreeModel (or the provided concrete subclass,
DefaultTreeModel which uses DefaultMutableTreeNode) would suffice for your
use-case based on what the code you've posted is doing.

Once you have created your TreeModel, you can use it with Wicket's trees too
as simply as:
 add(new LinkTree(tree, myTreeModel));
for example

See [1] for a simple example of how to use JTree (with a TreeModel), [2] for
a simple Wicket tree example and if you want to learn a bit more about how
some of Wicket's trees work check out this class diagram [3] from a couple
of years ago. 

Does that make sense?

Regards - Cemal 
jWeekend 
OO  Java Technologies, Wicket Training and Development 
http://jWeekend.com

[1]
http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html#dynamic
[2] http://www.wicket-library.com/wicket-examples/ajax/tree/simple.1
[3] http://jweekend.com/dev/ArticlesPage/



Oliver-Sven Fritsch wrote:
 
 Hi everybody!
 
 Still new to Wicket I'm trying to get a wicket tree with nodes from a 
 database. What I got so far is a simple JTree put onto a JFrame. What I 
 don't understand is how to geht my tree onto a wicket web page. I'm 
 kinda confused on how to get things working. As far as I now wicket tree 
 uses jtree aswell, but I'm really stuck at this point. I'd really 
 appreaciate any help from anyone pointing me into the right direction.
 
 public class MyJTree extends JFrame {
 
 Connection con = null;
 Statement st = null;
 ResultSet rs = null;
 
 public static void main(String args[]) throws Exception {
 new MyJTree();
 }
 
 public MyJTree() throws Exception {
 
 super(Retrieving data from database );
 
 MyConnection mycon = MyConnectionFactory.getNewConnection();
 mycon.connect();
 
 ArrayList list = new ArrayList();
 list.add(The Root);
 
 try {
 String sql = select key, node_id, parent_id, caption from 
 mytable;
 
 st = mycon.createPreparedStatement(sql);
 rs = st.executeQuery(sql);
 
 
 while (rs.next()) {
 Object value[] = {rs.getString(1), rs.getString(2),
 rs.getString(3), rs.getString(4)};
 list.add(value);
 }
 } catch (Exception e) {
 System.out.println(e);
 }
 rs.close();
 st.close();
 
 Object hierarchy[] = list.toArray();
 
 JFrame frame = new JFrame();
 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 Container content = getContentPane();
 
 DefaultMutableTreeNode root = processHierarchy(hierarchy);
 JTree tree = new JTree(root);
 content.add(new JScrollPane(tree), BorderLayout.CENTER);
 setSize(275, 300);
 setLocation(300, 100);
 setVisible(true);
 }
 
 private DefaultMutableTreeNode processHierarchy(Object[] hierarchy) {
 DefaultMutableTreeNode node = new 
 DefaultMutableTreeNode(hierarchy[0]);
 DefaultMutableTreeNode child;
 for (int i = 1; i  hierarchy.length; i++) {
 Object nodeSpecifier = hierarchy[i];
 if (nodeSpecifier instanceof Object[]) // Ie node with
 children
 {
 child = processHierarchy((Object[]) nodeSpecifier);
 } else {
 child = new DefaultMutableTreeNode(nodeSpecifier); // Ie 
 Leaf
 }
 node.add(child);
 }
 return (node);
 }
 }
 
 
 Thanks!
 Oliver
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Tree-based-on-database-tp25004992p25005490.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: how to create a TabPanel as a separate class.

2009-08-17 Thread Eyal Golan
it's exactly what it says.
TabbedPanel doesn't have the default constructor.
You must give it at least ID.

Eyal Golan
egola...@gmail.com

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


On Mon, Aug 17, 2009 at 2:42 PM, Gerald Fernando 
gerald.anto.ferna...@gmail.com wrote:

 Hello Friends,


 This is my need

  what i want whenever i need this tabbedPanel i want to place in any page

  public class choicePanel extends TabbedPanel{
 super();
 }

 not like
  public class choicePanel extends webpage


 i have created the above one but it shows the error that

 he constructor TabbedPanel() is undefined

 please give me urgent Reply
 --
 Thanksregards,
 Gerald A



Re: Removing an element from ListView with AjaxFallbackButton

2009-08-17 Thread Major Péter
So I'm populating an item into the LV, which is gonna have a Remove 
button, so when I'm add the AFB in the onsubmit I write to remove the 
ListItem which I'm currently populating??


The LV looks like this
final ListViewIMAccount listview = new ListViewIMAccount(ims, new 
PropertyModel(person, ImAccounts)) {...}


I tried to remove the markup for the ListView, but didn't found a 
working way:

- I tried:
person.getImAccounts().remove(acc); where acc = item.getModelObject();
If I do so, than one item is removing from the LV, but not the correct 
one, remember I'm just removed an element from the list, I didn't 
removed anything from the markup, but the listview's gonna have one less 
line. Why? And why not the removed item is disappearing?


- I tried
item.setVisible(false);
but then I did not removed the item from the model, so it would send 
incorrect datas. The markup now works as intended.


- I tried
item.setVisible(false); person.getImAccounts().remove(acc);
so both of them, than when I pressed the remove button, I successfully 
removed from the markup two(!) items. Why?


- I tried
final ListViewIMAccount curr = this; final ListIMAccount model = 
getModelObject();

and in the AFB:
curr.remove(item);
model.remove(acc);
person.setImAccounts(model);
It looks like this is deleting from the markup the last item, and the 
correct ListItem's row is setted to defaults...


The only thing I don't get, that when I remove an item from the model, 
than why a different row is gonna disappear from the markup...
//In these cases when I'm remove from the model an element in the markup 
always the last row is disappearing...


Any help would be appreciated.
Thanks

Regards,
Peter

2009-08-14 18:07 keltezéssel, Igor Vaynberg írta:

if removeall() doesnt do what you want then you have to find the
specific listitem that represents your deleted row and remove just
that one.

-igor

2009/8/14 Major Pétermajorpe...@sch.bme.hu:

I tried to do this:
ListView obj = (ListView) form.get(rowPanel:ims);
obj.removeAll();

But after that, the input is forgotten.
I tought, that if I enable the ReuseItems, than the list will remember the
contents, but when I call, the removeAll(), it's just forgots the input
values. It's like I just left the reuseItems on false.
How can I achieve, that the new values won't be forgotten when I remove one
item from the list?
Thanks

Peter

2009-08-14 17:18 keltezéssel, Igor Vaynberg írta:


you have ot call removeall() on the listview, not on the button.

-igor

2009/8/14 Major Pétermajorpe...@sch.bme.hu:


I tried this:

item.add(new AjaxFallbackButton(imRemove, PersonForm.this) {

@Override
public void onSubmit(AjaxRequestTarget target, Form?
form) {
person.getIMAccounts().remove(acc);
removeAll();
if (target != null) {
target.addComponent(rowPanel);
}
}
}.setDefaultFormProcessing(false));

but it's still not working, it looks like that on every single
imRemove#onSubmit in the list the last element will disappear. I have no
idea what's causing this behavior...

Regards,
Peter

2009-08-14 04:19 keltezéssel, Cserep Janos írta:


Because of this:


listview.setReuseItems(true);


You should do a

removeAll()

in your onSubmit() method when you change the model (the list in this
case).


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Tree based on database

2009-08-17 Thread Oliver-Sven Fritsch
Thanks for your reply. I guess defining the TreeModel is exactly my 
problem. I tried to find a tutorial on how to do so based on my database 
entries but I don't seem to find any. Maybe this is basic java knowledge 
and I'm searching at the wrong spots. But a little how to would be great 
because right now I have no idea how to solve my problem. I guess this 
is a common use case while handling Trees on web apps, yet wondering why 
there isn't a fool-proof guide. Any hints would be greatly appreaciated.


Oliver


Cemal wrote:


Oliver,

Wicket (core and extensions) has several tree components and they all
currently use Swing's TreeModel (javax.swing.tree.TreeModel). I say
currently as this is the case upto and including Wicket 1.4 but there is
some discussion about using a new type of model, more suited to webapps, in
Wicket 1.5. Swing's TreeModel is not coupled to JTree at all even though it
happens to be the model JTree uses. Wicket does _not_ use JTree, but its
trees use TreeModel.

In the context of a Swing UI your code below would be much more flexible,
powerful and in the spirit of Swing if you were to explicitly use a
TreeModel to manage interaction with the underlying data; I expect even
Swing's out-of-the-box AbstractTreeModel (or the provided concrete subclass,
DefaultTreeModel which uses DefaultMutableTreeNode) would suffice for your
use-case based on what the code you've posted is doing.

Once you have created your TreeModel, you can use it with Wicket's trees too
as simply as:
 add(new LinkTree(tree, myTreeModel));
for example

See [1] for a simple example of how to use JTree (with a TreeModel), [2] for
a simple Wicket tree example and if you want to learn a bit more about how
some of Wicket's trees work check out this class diagram [3] from a couple
of years ago. 


Does that make sense?

Regards - Cemal 
jWeekend 
OO  Java Technologies, Wicket Training and Development 
http://jWeekend.com


[1]
http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html#dynamic
[2] http://www.wicket-library.com/wicket-examples/ajax/tree/simple.1
[3] http://jweekend.com/dev/ArticlesPage/



Oliver-Sven Fritsch wrote:
  

Hi everybody!

Still new to Wicket I'm trying to get a wicket tree with nodes from a 
database. What I got so far is a simple JTree put onto a JFrame. What I 
don't understand is how to geht my tree onto a wicket web page. I'm 
kinda confused on how to get things working. As far as I now wicket tree 
uses jtree aswell, but I'm really stuck at this point. I'd really 
appreaciate any help from anyone pointing me into the right direction.


public class MyJTree extends JFrame {

Connection con = null;
Statement st = null;
ResultSet rs = null;

public static void main(String args[]) throws Exception {
new MyJTree();
}

public MyJTree() throws Exception {

super(Retrieving data from database );

MyConnection mycon = MyConnectionFactory.getNewConnection();
mycon.connect();

ArrayList list = new ArrayList();
list.add(The Root);

try {
String sql = select key, node_id, parent_id, caption from 
mytable;


st = mycon.createPreparedStatement(sql);
rs = st.executeQuery(sql);


while (rs.next()) {
Object value[] = {rs.getString(1), rs.getString(2),
rs.getString(3), rs.getString(4)};
list.add(value);
}
} catch (Exception e) {
System.out.println(e);
}
rs.close();
st.close();

Object hierarchy[] = list.toArray();

JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container content = getContentPane();

DefaultMutableTreeNode root = processHierarchy(hierarchy);
JTree tree = new JTree(root);
content.add(new JScrollPane(tree), BorderLayout.CENTER);
setSize(275, 300);
setLocation(300, 100);
setVisible(true);
}

private DefaultMutableTreeNode processHierarchy(Object[] hierarchy) {
DefaultMutableTreeNode node = new 
DefaultMutableTreeNode(hierarchy[0]);

DefaultMutableTreeNode child;
for (int i = 1; i  hierarchy.length; i++) {
Object nodeSpecifier = hierarchy[i];
if (nodeSpecifier instanceof Object[]) // Ie node with
children
{
child = processHierarchy((Object[]) nodeSpecifier);
} else {
child = new DefaultMutableTreeNode(nodeSpecifier); // Ie 
Leaf

}
node.add(child);
}
return (node);
}
}


Thanks!
Oliver

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org






  



-
To unsubscribe, e-mail: 

Re: MarkupnotFoundException in eclipse 3.4.2

2009-08-17 Thread Mathias Nilsson

After plugin in the pom file

resources
  resource
filteringfalse/filtering
 directorysrc/main/resources/directory
   /resource
   resource
filteringfalse/filtering
directorysrc/main/java/directory
includes
  include**/include
/includes
excludes
  exclude**/*.java/exclude
/excludes
  /resource
/resources
-- 
View this message in context: 
http://www.nabble.com/MarkupnotFoundException-in-eclipse-3.4.2-tp25001104p25006663.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Removing an element from ListView with AjaxFallbackButton

2009-08-17 Thread Erik van Oosten

Perhaps you can use the list editor:
http://wicketinaction.com/2008/10/building-a-listeditor-form-component/

Regards,
   Erik.


Major Péter wrote:

Any help would be appreciated.
Thanks

Regards,
Peter



--
Erik van Oosten
http://day-to-day-stuff.blogspot.com/



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Tree based on database

2009-08-17 Thread jWeekend

Oliver,

It's not difficult but you may need to break the problem down a bit if you
are new to some of this stuff. Then we can address any bits you really need
help with.

Broadly speaking, you could:
1 - create a simple database schema to experiment with and populate the
relevant table(s) with just enough data. Bear in mind that there are whole
books/doctoral-theses on hierarchical data structures in RDBMS and related
SQL techniques so keep your first example as simple as possible (eg a single
table with two text columns representing the relationship between your
nodes, say parent and child, and keep nodes unique eg Bob should
appear no more than once in once under child for its single, corresponding
parent, and Bob will appear as many times under parent as it has
children. Your root node should not appear under child! You can get much
more sophisticated/powerful/scalabe etc later. 

2 - prepare your JDBC/iBatis/JPA/Hibernate/SpringJDBC/Guice/Warp/Spring...
to access your database and extract the data as required and test that this
works. In essence, all you'll be doing is executing queries along the lines
of 
SELECT child FROM mytable WHERE parent = ?

3 implement a TreeModel (or extend/use AbstractTreeModel or
DefaultTreeModel) that uses whatever DAO (or direct data access) you set up
in step 2. In the most naive/simple implementation using JDBC, your getChild
implementation could 

make a connection, 
run the query above (the parent will be passed in), 
create a list from the result set,
return the child corresponding to the index passed in

Of course this would be a crazy solution but once you've got everything
working (you can test that same model in Swing and/or Wicket), you can start
worrying about lazy vs eager loading of nodes, caching,
adding/moving/editing nodes, n-tier architecture and plenty of other stuff a
real-world implementation needs to take account of.

Let us know how you get on once you given that (along with the stuff in my
previous post) a go.

Regards - Cemal 
jWeekend 
OO  Java Technologies, Wicket Training and Development 
http://jWeekend.com


Oliver-Sven Fritsch wrote:
 
 Thanks for your reply. I guess defining the TreeModel is exactly my 
 problem. I tried to find a tutorial on how to do so based on my database 
 entries but I don't seem to find any. Maybe this is basic java knowledge 
 and I'm searching at the wrong spots. But a little how to would be great 
 because right now I have no idea how to solve my problem. I guess this 
 is a common use case while handling Trees on web apps, yet wondering why 
 there isn't a fool-proof guide. Any hints would be greatly appreaciated.
 
 Oliver
 
 
 Cemal wrote:
 
 Oliver,

 Wicket (core and extensions) has several tree components and they all
 currently use Swing's TreeModel (javax.swing.tree.TreeModel). I say
 currently as this is the case upto and including Wicket 1.4 but there is
 some discussion about using a new type of model, more suited to webapps,
 in
 Wicket 1.5. Swing's TreeModel is not coupled to JTree at all even though
 it
 happens to be the model JTree uses. Wicket does _not_ use JTree, but its
 trees use TreeModel.

 In the context of a Swing UI your code below would be much more flexible,
 powerful and in the spirit of Swing if you were to explicitly use a
 TreeModel to manage interaction with the underlying data; I expect even
 Swing's out-of-the-box AbstractTreeModel (or the provided concrete
 subclass,
 DefaultTreeModel which uses DefaultMutableTreeNode) would suffice for
 your
 use-case based on what the code you've posted is doing.

 Once you have created your TreeModel, you can use it with Wicket's trees
 too
 as simply as:
  add(new LinkTree(tree, myTreeModel));
 for example

 See [1] for a simple example of how to use JTree (with a TreeModel), [2]
 for
 a simple Wicket tree example and if you want to learn a bit more about
 how
 some of Wicket's trees work check out this class diagram [3] from a
 couple
 of years ago. 

 Does that make sense?

 Regards - Cemal 
 jWeekend 
 OO  Java Technologies, Wicket Training and Development 
 http://jWeekend.com

 [1]
 http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html#dynamic
 [2] http://www.wicket-library.com/wicket-examples/ajax/tree/simple.1
 [3] http://jweekend.com/dev/ArticlesPage/



 Oliver-Sven Fritsch wrote:
   
 Hi everybody!

 Still new to Wicket I'm trying to get a wicket tree with nodes from a 
 database. What I got so far is a simple JTree put onto a JFrame. What I 
 don't understand is how to geht my tree onto a wicket web page. I'm 
 kinda confused on how to get things working. As far as I now wicket tree 
 uses jtree aswell, but I'm really stuck at this point. I'd really 
 appreaciate any help from anyone pointing me into the right direction.

 public class MyJTree extends JFrame {

 Connection con = null;
 Statement st = null;
 ResultSet rs = null;

 public static void main(String args[]) throws Exception {

ListView Validation

2009-08-17 Thread jpalmer1026





I'm trying to display a validation message for an item contained in a list view but the validation message isn't getting displayed. Is there something special that needs to be done to display validation messages for list view items?







Re: Tree based on database

2009-08-17 Thread Oliver-Sven Fritsch

Cemal,

thanks for your reply! right now I'am at step 3 of your guide. I got the 
database schema with entries in it, my connection works well and queries 
the database and delivers a ResultSet. :-)


The code I posted in my first email does work perfectly well, it even 
sorts the child nodes in the right order. There's just one big 
disadvantage: it displays my tree on a JFrame. I thought I could easily 
use my current code by just adding a few lines of code. But if i get you 
right I have to implement it in a complete different way. And this is 
where I'm running into troubles. I just have no clue how to implement 
the TreeModel. Is this task to trival to be explained somewhere? Can't 
believe I'm such a rookie. :-(


I'll try to get things done. Nevertheless be thankful for any further 
advices from you and the rest of this group.


Cheers Oliver.

Cemal wrote:

Oliver,

It's not difficult but you may need to break the problem down a bit if you
are new to some of this stuff. Then we can address any bits you really need
help with.

Broadly speaking, you could:
1 - create a simple database schema to experiment with and populate the
relevant table(s) with just enough data. Bear in mind that there are whole
books/doctoral-theses on hierarchical data structures in RDBMS and related
SQL techniques so keep your first example as simple as possible (eg a single
table with two text columns representing the relationship between your
nodes, say parent and child, and keep nodes unique eg Bob should
appear no more than once in once under child for its single, corresponding
parent, and Bob will appear as many times under parent as it has
children. Your root node should not appear under child! You can get much
more sophisticated/powerful/scalabe etc later. 


2 - prepare your JDBC/iBatis/JPA/Hibernate/SpringJDBC/Guice/Warp/Spring...
to access your database and extract the data as required and test that this
works. In essence, all you'll be doing is executing queries along the lines
of 
SELECT child FROM mytable WHERE parent = ?


3 implement a TreeModel (or extend/use AbstractTreeModel or
DefaultTreeModel) that uses whatever DAO (or direct data access) you set up
in step 2. In the most naive/simple implementation using JDBC, your getChild
implementation could 

make a connection, 
run the query above (the parent will be passed in), 
create a list from the result set,

return the child corresponding to the index passed in

Of course this would be a crazy solution but once you've got everything
working (you can test that same model in Swing and/or Wicket), you can start
worrying about lazy vs eager loading of nodes, caching,
adding/moving/editing nodes, n-tier architecture and plenty of other stuff a
real-world implementation needs to take account of.

Let us know how you get on once you given that (along with the stuff in my
previous post) a go.

Regards - Cemal 
jWeekend 
OO  Java Technologies, Wicket Training and Development 
http://jWeekend.com



Oliver-Sven Fritsch wrote:
  
Thanks for your reply. I guess defining the TreeModel is exactly my 
problem. I tried to find a tutorial on how to do so based on my database 
entries but I don't seem to find any. Maybe this is basic java knowledge 
and I'm searching at the wrong spots. But a little how to would be great 
because right now I have no idea how to solve my problem. I guess this 
is a common use case while handling Trees on web apps, yet wondering why 
there isn't a fool-proof guide. Any hints would be greatly appreaciated.


Oliver


Cemal wrote:



Oliver,

Wicket (core and extensions) has several tree components and they all
currently use Swing's TreeModel (javax.swing.tree.TreeModel). I say
currently as this is the case upto and including Wicket 1.4 but there is
some discussion about using a new type of model, more suited to webapps,
in
Wicket 1.5. Swing's TreeModel is not coupled to JTree at all even though
it
happens to be the model JTree uses. Wicket does _not_ use JTree, but its
trees use TreeModel.

In the context of a Swing UI your code below would be much more flexible,
powerful and in the spirit of Swing if you were to explicitly use a
TreeModel to manage interaction with the underlying data; I expect even
Swing's out-of-the-box AbstractTreeModel (or the provided concrete
subclass,
DefaultTreeModel which uses DefaultMutableTreeNode) would suffice for
your
use-case based on what the code you've posted is doing.

Once you have created your TreeModel, you can use it with Wicket's trees
too
as simply as:
 add(new LinkTree(tree, myTreeModel));
for example

See [1] for a simple example of how to use JTree (with a TreeModel), [2]
for
a simple Wicket tree example and if you want to learn a bit more about
how
some of Wicket's trees work check out this class diagram [3] from a
couple
of years ago. 


Does that make sense?

Regards - Cemal 
jWeekend 
OO  Java Technologies, Wicket Training and Development 
http://jWeekend.com


[1]

Re: ListView Validation

2009-08-17 Thread jWeekend

see setReuseItems on ListView.

Regards - Cemal 
jWeekend 
OO  Java Technologies, Wicket Training and Development 
http://jWeekend.com


jpalmer1026 wrote:
 
 I'm trying to display a validation message for an item contained in a list
 view but the validation message isn't getting displayed. Is there
 something special that needs to be done to display validation messages for
 list view items?
 
 

-- 
View this message in context: 
http://www.nabble.com/ListView-Validation-tp25007136p25007438.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



How to use Guice to inject Service to LoadableDetachableModel

2009-08-17 Thread Haulyn R. Jason
Hi, all:
I have a class which is likes below:


public class DetachableMemberModel extends LoadableDetachableModelMember {

private final long id;

public DetachableMemberModel(Member m) {
this(m.getId());
}

public DetachableMemberModel(long id) {
if (id == 0) {
throw new IllegalArgumentException();
}
this.id = id;
}

@Override
public int hashCode() {
return Long.valueOf(id).hashCode();
}

@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
} else if (obj == null) {
return false;
} else if (obj instanceof DetachableMemberModel) {
DetachableMemberModel other = (DetachableMemberModel) obj;
return other.id == id;
}
return false;
}

@Override
protected Member load() {
// I do not know how to inject this service to
Object DetachableMemberModel
return memberService.query(id);
}
}

please see the last method of this class, I do not know how to inject
memberService to this class.
If I use @Inject private MemberService memberService, I have to inject this
class to the WebPage, but I can not bind DetachableMemberModel to any
interface.

So, I do not know to to implement this, can anybody help me? Thanks very
much.

-- 
--
Enjoy. Thanks!

Haulyn Microproduction

Mobile: +086-15864011231
email: saharab...@gmail.com,
 hmp.hau...@foxmail.com
website: http://haulynjason.net
gtalk: saharab...@gmail.com
yahoo: jia_hao...@yahoo.com
msn: saharab...@gmail.com
skype: saharabear
QQ: 378606292

Haulyn Jason


Re: ListView Validation

2009-08-17 Thread Major Péter
Yes, with the setReuseItems(true) you just enabled that, the list won't 
forget the contents on validation fail.


If you would like to use custom validation messages, check out the 
Application.properties file in wicket.jar, there you can see the 
original messages, and also the format of message keys.


If you have an PatternValidator on a TextField in a form with wicket:id 
'form', then you need this line in your properties file:
form.textfieldwicketid.PatternValidator='${input}' does not match 
pattern '${pattern}'.

for example.

Hope this helps.

Peter

2009-08-17 17:51 keltezéssel, jpalmer1026 írta:


I have setReuseItems set to true but I'm still only seeing the generic Wicket
validation messages and not the custom validation messages that I created.

Is there a way to display custom validation messages to items in a ListView?


jWeekend wrote:


see setReuseItems on ListView.

Regards - Cemal
jWeekend
OO  Java Technologies, Wicket Training and Development
http://jWeekend.com


jpalmer1026 wrote:


I'm trying to display a validation message for an item contained in a
list view but the validation message isn't getting displayed. Is there
something special that needs to be done to display validation messages
for list view items?









-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: how to use wicket tree in extension

2009-08-17 Thread jWeekend

Assuming the class diagram at http://jweekend.com/dev/ArticlesPage/ is
up-to-date for your version of Wicket, perhaps you can override protected
ITreeState newTreeState() to return an ITreeState that you pass between
pages (or, put in your custom WebSession if that makes more sense in your
app or in a table or ).
I wouldn't be surprised if Matej comes back to say there's a neater way than
that!

Regards - Cemal 
jWeekend 
OO  Java Technologies, Wicket Training and Development 
http://jWeekend.com


Haulyn Jason-2 wrote:
 
 Yes, that's right, is that a way to tell the new page(and the new instance
 of the tree), the status of the old tree?
 I means expand the node which I clicked?
 
 Thanks!
 
 
 On Sat, Aug 15, 2009 at 9:00 AM, jWeekend
 jweekend_for...@cabouge.comwrote:
 

 Is your menu (tree) in some parent page class that both the first and the
 linked-to page extend? When you go to a new page instance you will get a
 new
 instance of the Tree.

 Regards - Cemal
 jWeekend
 OO  Java Technologies, Wicket Training and Development
 http://jWeekend.com


 Haulyn Jason-2 wrote:
 
  No, just use Tree in extension package.
 
  On Fri, Aug 14, 2009 at 11:17 PM, Igor Vaynberg
  igor.vaynb...@gmail.comwrote:
 
  are you using LinkTree?
 
  -igor
 
  On Fri, Aug 14, 2009 at 12:15 AM, Haulyn R.
 Jasonsaharab...@gmail.com
  wrote:
   Hi,all:
  
   I design a page with a tree for page navigation. But I can not find
  more
   information from Internet to learn how to use the Tree component.
  
   I can display the tree as
  
   menu1
  |-sub_menu1
  |-sub_menu2
   menu2
  |-sub_menu3
  |-sub_menu4
  
   and I remove root node, make all tree expand while init the tree,
 but
 I
  do
   not know how to add links to the sub_menus, I tried to add some code
  like
   this:
  @Override
  protected void onNodeLinkClicked(AjaxRequestTarget
 target,
   TreeNode node) {
  DefaultMutableTreeNode treeNode =
  (DefaultMutableTreeNode)
   node;
  NavigationTreeNode navigationTreeNode =
  (NavigationTreeNode)
   treeNode.getUserObject();
  if (navigationTreeNode.isURL) {
  setResponsePage(navigationTreeNode.getURL());
  super.onNodeLinkClicked(target, node);
  } else {
  super.onNodeLinkClicked(target, node);
  }
  }
  
   this looks work well, but when I clink on a link, the page redirect
 to
  the
   target page, but I can not keep the tree with the selected node
 expand.
  
   Can anyone help me or give me some reference URLs? Thanks!
  
   --
   --
   Enjoy. Thanks!
  
   Mobile: +086-15864011231
   email: saharab...@gmail.com, hmp.hau...@foxmail.com
   website: http://haulynjason.net
   gtalk: saharab...@gmail.com
   yahoo: jia_hao...@yahoo.com
   msn: saharab...@gmail.com
   skype: saharabear
   QQ: 378606292
  
   Haulyn Jason
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
  --
  --
  Enjoy. Thanks!
 
  Mobile: +086-15864011231
  email: saharab...@gmail.com, hmp.hau...@foxmail.com
  website: http://haulynjason.net
  gtalk: saharab...@gmail.com
  yahoo: jia_hao...@yahoo.com
  msn: saharab...@gmail.com
  skype: saharabear
  QQ: 378606292
 
  贾昊林 Haulyn Jason
 
 

 --
 View this message in context:
 http://www.nabble.com/how-to-use-wicket-tree-in-extension-tp24967306p24980702.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 
 
 -- 
 --
 Enjoy. Thanks!
 
 Haulyn Microproduction
 
 Mobile: +086-15864011231
 email: saharab...@gmail.com,
  hmp.hau...@foxmail.com
 website: http://haulynjason.net
 gtalk: saharab...@gmail.com
 yahoo: jia_hao...@yahoo.com
 msn: saharab...@gmail.com
 skype: saharabear
 QQ: 378606292
 
 Haulyn Jason
 
 

-- 
View this message in context: 
http://www.nabble.com/how-to-use-wicket-tree-in-extension-tp24967306p25010539.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to use Guice to inject Service to LoadableDetachableModel

2009-08-17 Thread Haulyn R. Jason
Hi,
I got these blow:
java.lang.IllegalStateException: InjectorHolder has not been assigned an
injector. Use InjectorHolder.setInjector() to assign an injector. In most
cases this should be done once inside SpringWebApplication subclass's init()
method.


I didn't use spring. I use wicket with guice. I do not know how to solve
this.

confused by:... done once inside SpringWebApplication subclass's init()
method



On Tue, Aug 18, 2009 at 12:10 AM, Haulyn R. Jason saharab...@gmail.comwrote:

 I try to add this line, but it doesn't work.
 I try to test a simple service binding in guice module, it works well with
 : @Inject ITestService testService;


 Thanks.



 On Tue, Aug 18, 2009 at 12:01 AM, Arie Fishler arie@gmail.com wrote:

 in the ctor just add this line

 InjectorHolder.*getInjector*().inject(*this*);


 On Mon, Aug 17, 2009 at 6:26 PM, Haulyn R. Jason saharab...@gmail.com
 wrote:

  Hi, all:
  I have a class which is likes below:
 
 
  public class DetachableMemberModel extends
 LoadableDetachableModelMember
  {
 
 private final long id;
 
 public DetachableMemberModel(Member m) {
 this(m.getId());
 }
 
 public DetachableMemberModel(long id) {
 if (id == 0) {
 throw new IllegalArgumentException();
 }
 this.id = id;
 }
 
 @Override
 public int hashCode() {
 return Long.valueOf(id).hashCode();
 }
 
 @Override
 public boolean equals(final Object obj) {
 if (obj == this) {
 return true;
 } else if (obj == null) {
 return false;
 } else if (obj instanceof DetachableMemberModel) {
 DetachableMemberModel other = (DetachableMemberModel) obj;
 return other.id == id;
 }
 return false;
 }
 
 @Override
 protected Member load() {
 // I do not know how to inject this service to
  Object DetachableMemberModel
 return memberService.query(id);
 }
  }
 
  please see the last method of this class, I do not know how to inject
  memberService to this class.
  If I use @Inject private MemberService memberService, I have to inject
 this
  class to the WebPage, but I can not bind DetachableMemberModel to any
  interface.
 
  So, I do not know to to implement this, can anybody help me? Thanks very
  much.
 
  --
  --
  Enjoy. Thanks!
 
  Haulyn Microproduction
 
  Mobile: +086-15864011231
  email: saharab...@gmail.com,
  hmp.hau...@foxmail.com
  website: http://haulynjason.net
  gtalk: saharab...@gmail.com
  yahoo: jia_hao...@yahoo.com
  msn: saharab...@gmail.com
  skype: saharabear
  QQ: 378606292
 
  Haulyn Jason
 




 --
 --
 Enjoy. Thanks!

 Haulyn Microproduction

 Mobile: +086-15864011231
 email: saharab...@gmail.com,
  hmp.hau...@foxmail.com
 website: http://haulynjason.net
 gtalk: saharab...@gmail.com
 yahoo: jia_hao...@yahoo.com
 msn: saharab...@gmail.com
 skype: saharabear
 QQ: 378606292

 Haulyn Jason





-- 
--
Enjoy. Thanks!

Haulyn Microproduction

Mobile: +086-15864011231
email: saharab...@gmail.com,
 hmp.hau...@foxmail.com
website: http://haulynjason.net
gtalk: saharab...@gmail.com
yahoo: jia_hao...@yahoo.com
msn: saharab...@gmail.com
skype: saharabear
QQ: 378606292

Haulyn Jason


Re: MarkupnotFoundException in eclipse 3.4.2

2009-08-17 Thread jWeekend

The quick fix is:
  in Project Properties/Java Build Path/Source) set Included: *.* (and
make sure *.html is not Excluded) for the folder your html is in, most
likely src/main/java if you keep your templates next to your Java source
files.

Regards - Cemal 
jWeekend 
OO  Java Technologies, Wicket Training and Development 
http://jWeekend.com


dale77 wrote:
 
 Hello,
 
 The quickstart is proving anything but. I run quickstart:
 
 mvn archetype:create -DarchetypeGroupId=org.apache.wicket
 -DarchetypeArtifactId=wicket-archetype-quickstart
 -DarchetypeVersion=1.4.0 -DgroupId=nz.co.acme -DartifactId=myproject
 
 Then generate and eclipse project:
 
 mvn eclipse:eclipse -DdownloadSources=true
 
 Then I import the project into eclipse, leaving copy into workspace
 unchecked, and Run As Junit test on TestHomePage.java...
 
 Markup of type 'html' for component 'nz.co.acme.HomePage' not found.
 Enable debug messages for org.apache.wicket.util.resource to get a list
 of all filenames tried.: [Page class = nz.co.acme.HomePage, id = 0,
 version = 0] org.apache.wicket.markup.MarkupNotFoundException: Markup of
 type 'html' for component 'nz.co.acme.HomePage' not found.
 
 Eclipse is not copying the .html file alongside the .class. But the Java
 | Compiler | Output Folder | Filtered Resources is only *.launch. How do
 I make eclipse copy the html file next to the class?
 
 No doubt there is a simple explanation, but I'm not seeing it. Can
 anyone help me out?
 
 Thanks
 
 Dale
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/MarkupnotFoundException-in-eclipse-3.4.2-tp25001104p25010844.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: how to use wicket tree in extension

2009-08-17 Thread Igor Vaynberg
instead of navigating between pages and passing the tree state around
why not simply swap panels. that way the tree instance is the same and
keeps its state.

-igor

On Mon, Aug 17, 2009 at 8:23 AM, Haulyn R. Jasonsaharab...@gmail.com wrote:
 Yes, that's right, is that a way to tell the new page(and the new instance
 of the tree), the status of the old tree?
 I means expand the node which I clicked?

 Thanks!


 On Sat, Aug 15, 2009 at 9:00 AM, jWeekend jweekend_for...@cabouge.comwrote:


 Is your menu (tree) in some parent page class that both the first and the
 linked-to page extend? When you go to a new page instance you will get a
 new
 instance of the Tree.

 Regards - Cemal
 jWeekend
 OO  Java Technologies, Wicket Training and Development
 http://jWeekend.com


 Haulyn Jason-2 wrote:
 
  No, just use Tree in extension package.
 
  On Fri, Aug 14, 2009 at 11:17 PM, Igor Vaynberg
  igor.vaynb...@gmail.comwrote:
 
  are you using LinkTree?
 
  -igor
 
  On Fri, Aug 14, 2009 at 12:15 AM, Haulyn R. Jasonsaharab...@gmail.com
  wrote:
   Hi,all:
  
   I design a page with a tree for page navigation. But I can not find
  more
   information from Internet to learn how to use the Tree component.
  
   I can display the tree as
  
   menu1
      |-sub_menu1
      |-sub_menu2
   menu2
      |-sub_menu3
      |-sub_menu4
  
   and I remove root node, make all tree expand while init the tree, but
 I
  do
   not know how to add links to the sub_menus, I tried to add some code
  like
   this:
             �...@override
              protected void onNodeLinkClicked(AjaxRequestTarget target,
   TreeNode node) {
                  DefaultMutableTreeNode treeNode =
  (DefaultMutableTreeNode)
   node;
                  NavigationTreeNode navigationTreeNode =
  (NavigationTreeNode)
   treeNode.getUserObject();
                  if (navigationTreeNode.isURL) {
                      setResponsePage(navigationTreeNode.getURL());
                      super.onNodeLinkClicked(target, node);
                  } else {
                      super.onNodeLinkClicked(target, node);
                  }
              }
  
   this looks work well, but when I clink on a link, the page redirect to
  the
   target page, but I can not keep the tree with the selected node
 expand.
  
   Can anyone help me or give me some reference URLs? Thanks!
  
   --
   --
   Enjoy. Thanks!
  
   Mobile: +086-15864011231
   email: saharab...@gmail.com, hmp.hau...@foxmail.com
   website: http://haulynjason.net
   gtalk: saharab...@gmail.com
   yahoo: jia_hao...@yahoo.com
   msn: saharab...@gmail.com
   skype: saharabear
   QQ: 378606292
  
   Haulyn Jason
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
  --
  --
  Enjoy. Thanks!
 
  Mobile: +086-15864011231
  email: saharab...@gmail.com, hmp.hau...@foxmail.com
  website: http://haulynjason.net
  gtalk: saharab...@gmail.com
  yahoo: jia_hao...@yahoo.com
  msn: saharab...@gmail.com
  skype: saharabear
  QQ: 378606292
 
  贾昊林 Haulyn Jason
 
 

 --
 View this message in context:
 http://www.nabble.com/how-to-use-wicket-tree-in-extension-tp24967306p24980702.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 --
 Enjoy. Thanks!

 Haulyn Microproduction

 Mobile: +086-15864011231
 email: saharab...@gmail.com,
         hmp.hau...@foxmail.com
 website: http://haulynjason.net
 gtalk: saharab...@gmail.com
 yahoo: jia_hao...@yahoo.com
 msn: saharab...@gmail.com
 skype: saharabear
 QQ: 378606292

 Haulyn Jason


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to use Guice to inject Service to LoadableDetachableModel

2009-08-17 Thread Igor Vaynberg
the easiest thing is to inject your component and pass the reference
into your model.

outside that there is salve.googlecode.com that lets you inject any object.

InjectorHolder.getInjector() doesnt work with guice because it is
possible to have more then one injector - one per module.

-igor

On Mon, Aug 17, 2009 at 8:26 AM, Haulyn R. Jasonsaharab...@gmail.com wrote:
 Hi, all:
 I have a class which is likes below:


 public class DetachableMemberModel extends LoadableDetachableModelMember {

    private final long id;

    public DetachableMemberModel(Member m) {
        this(m.getId());
    }

    public DetachableMemberModel(long id) {
        if (id == 0) {
            throw new IllegalArgumentException();
        }
        this.id = id;
    }

   �...@override
    public int hashCode() {
        return Long.valueOf(id).hashCode();
    }

   �...@override
    public boolean equals(final Object obj) {
        if (obj == this) {
            return true;
        } else if (obj == null) {
            return false;
        } else if (obj instanceof DetachableMemberModel) {
            DetachableMemberModel other = (DetachableMemberModel) obj;
            return other.id == id;
        }
        return false;
    }

   �...@override
    protected Member load() {
        // I do not know how to inject this service to
 Object DetachableMemberModel
        return memberService.query(id);
    }
 }

 please see the last method of this class, I do not know how to inject
 memberService to this class.
 If I use @Inject private MemberService memberService, I have to inject this
 class to the WebPage, but I can not bind DetachableMemberModel to any
 interface.

 So, I do not know to to implement this, can anybody help me? Thanks very
 much.

 --
 --
 Enjoy. Thanks!

 Haulyn Microproduction

 Mobile: +086-15864011231
 email: saharab...@gmail.com,
         hmp.hau...@foxmail.com
 website: http://haulynjason.net
 gtalk: saharab...@gmail.com
 yahoo: jia_hao...@yahoo.com
 msn: saharab...@gmail.com
 skype: saharabear
 QQ: 378606292

 Haulyn Jason


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: how to use wicket tree in extension

2009-08-17 Thread jWeekend

Yes, Igor's solution is easier (and will remember other tree state beyond
just which nodes are expanded) if you are able to use this panel swapping
technique instead of your current markup-inheritance solution for the common
menu (tree). 

It looks like a common decision one has to make: whether to pass components
around (remember, only ever use a component instance on a single page
instance at any one time!) versus just passing around component state (in
this case, which nodes are expanded and which are collapsed).

Regards - Cemal 
jWeekend 
OO  Java Technologies, Wicket Training and Development 
http://jWeekend.com


igor.vaynberg wrote:
 
 instead of navigating between pages and passing the tree state around
 why not simply swap panels. that way the tree instance is the same and
 keeps its state.
 
 -igor
 
 On Mon, Aug 17, 2009 at 8:23 AM, Haulyn R. Jasonsaharab...@gmail.com
 wrote:
 Yes, that's right, is that a way to tell the new page(and the new
 instance
 of the tree), the status of the old tree?
 I means expand the node which I clicked?

 Thanks!


 On Sat, Aug 15, 2009 at 9:00 AM, jWeekend
 jweekend_for...@cabouge.comwrote:


 Is your menu (tree) in some parent page class that both the first and
 the
 linked-to page extend? When you go to a new page instance you will get a
 new
 instance of the Tree.

 Regards - Cemal
 jWeekend
 OO  Java Technologies, Wicket Training and Development
 http://jWeekend.com


 Haulyn Jason-2 wrote:
 
  No, just use Tree in extension package.
 
  On Fri, Aug 14, 2009 at 11:17 PM, Igor Vaynberg
  igor.vaynb...@gmail.comwrote:
 
  are you using LinkTree?
 
  -igor
 
  On Fri, Aug 14, 2009 at 12:15 AM, Haulyn R.
 Jasonsaharab...@gmail.com
  wrote:
   Hi,all:
  
   I design a page with a tree for page navigation. But I can not find
  more
   information from Internet to learn how to use the Tree component.
  
   I can display the tree as
  
   menu1
      |-sub_menu1
      |-sub_menu2
   menu2
      |-sub_menu3
      |-sub_menu4
  
   and I remove root node, make all tree expand while init the tree,
 but
 I
  do
   not know how to add links to the sub_menus, I tried to add some
 code
  like
   this:
             �...@override
              protected void onNodeLinkClicked(AjaxRequestTarget
 target,
   TreeNode node) {
                  DefaultMutableTreeNode treeNode =
  (DefaultMutableTreeNode)
   node;
                  NavigationTreeNode navigationTreeNode =
  (NavigationTreeNode)
   treeNode.getUserObject();
                  if (navigationTreeNode.isURL) {
                      setResponsePage(navigationTreeNode.getURL());
                      super.onNodeLinkClicked(target, node);
                  } else {
                      super.onNodeLinkClicked(target, node);
                  }
              }
  
   this looks work well, but when I clink on a link, the page redirect
 to
  the
   target page, but I can not keep the tree with the selected node
 expand.
  
   Can anyone help me or give me some reference URLs? Thanks!
  
   --
   --
   Enjoy. Thanks!
  
   Mobile: +086-15864011231
   email: saharab...@gmail.com, hmp.hau...@foxmail.com
   website: http://haulynjason.net
   gtalk: saharab...@gmail.com
   yahoo: jia_hao...@yahoo.com
   msn: saharab...@gmail.com
   skype: saharabear
   QQ: 378606292
  
   Haulyn Jason
  
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
  --
  --
  Enjoy. Thanks!
 
  Mobile: +086-15864011231
  email: saharab...@gmail.com, hmp.hau...@foxmail.com
  website: http://haulynjason.net
  gtalk: saharab...@gmail.com
  yahoo: jia_hao...@yahoo.com
  msn: saharab...@gmail.com
  skype: saharabear
  QQ: 378606292
 
  贾昊林 Haulyn Jason
 
 

 --
 View this message in context:
 http://www.nabble.com/how-to-use-wicket-tree-in-extension-tp24967306p24980702.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 --
 Enjoy. Thanks!

 Haulyn Microproduction

 Mobile: +086-15864011231
 email: saharab...@gmail.com,
         hmp.hau...@foxmail.com
 website: http://haulynjason.net
 gtalk: saharab...@gmail.com
 yahoo: jia_hao...@yahoo.com
 msn: saharab...@gmail.com
 skype: saharabear
 QQ: 378606292

 Haulyn Jason

 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/how-to-use-wicket-tree-in-extension-tp24967306p25011340.html
Sent from the Wicket - User mailing list archive at Nabble.com.



Re: Improving maven/wicket deployment process

2009-08-17 Thread Tauren Mills
Janos and Jeremy,

Thank you both for your feedback!

After considering your answers, I think that using Maven profiles is
most in line with my needs.  And the suggestion to use the command
line -Dwicket.configuration=deployment parameter will certainly help.
I've never used Hudson before, but I'm looking into it now. It sounds
like it could help simplify things significantly.

Thanks again,
Tauren

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: CORRECT portlet+spring+hibernate configuration (Two options, what's right?)

2009-08-17 Thread Gonzalo Aguilar Delgado


 I have several suggestions.
 
 The order of the web filters are important. You could also try with
 with the wicket spring managed apps, im not sure how that applies.

Will check. I didn't know about filter order... Will also check it.
Thanks!


 
 And are you sure that your filter ( /hibernate/*), get's hit? What's
 your wicket filter url, the same or?


No, It's different. Can I set it to just /*? Should I do it that way?

Thank you very much for your answers...



 
 2009/8/17 Gonzalo Aguilar Delgado g...@aguilardelgado.com:
  Ok. Maybe I don't understand...
 
  Let me show the situation. I have Spring + portlet + hibernate config
  with transactions working with the current configuration:
 
  I have my DAO objects under package
  com.level2crm.hibernate.enterprise.dao.contact
  And model under com.level2crm.model
 
  I configured one advice:
 tx:advice id=txAdvice transaction-manager=txManager
 !-- the transactional semantics... --
 tx:attributes
 !-- all methods starting with 'get' are read-only 
  --
 tx:method name=get*  propagation=REQUIRED 
  read-only=true /
 !-- other methods use the default transaction 
  settings (see below)
  --
 tx:method name=*  propagation=REQUIRED / !--
  propagation=SUPPORTS --
 /tx:attributes
 /tx:advice
 
  And several pointcuts:
 aop:config
 aop:pointcut id=allModelOperation expression=execution(*
  com.level2crm.model..*+.*(..))/
 aop:advisor advice-ref=txAdvice
  pointcut-ref=allModelOperation/
 /aop:config
 
 aop:config
 aop:pointcut id=allDAO expression=execution(*
  com.level2crm.hibernate.enterprise.dao..*+.*(..))/
 aop:advisor advice-ref=txAdvice pointcut-ref=allDAO/
 /aop:config
 
 aop:config
 aop:pointcut id=TRG expression=execution(*
  com.trg.dao.hibernate.*+.*(..))/
 aop:advisor advice-ref=txAdvice pointcut-ref=TRG/
 /aop:config
 
  !-- This one does not work --
 aop:config
 aop:pointcut id=portlets expression=execution(*
  com.level2crm.portals.crm.wicket.customerlist.pages..*+.*(..))/
 aop:advisor advice-ref=txAdvice pointcut-ref=portlets/
 /aop:config
 
  I tried to configure the open session in view (web.xml):
 listener
 
  listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
 /listener
 
 !-- Enable the filters for Hibernate --
 
 filter
 filter-nameopensessioninview/filter-name
 
  filter-classorg.springframework.orm.hibernate3.support.OpenSessionInViewFilter/filter-class
 /filter
 filter-mapping
 filter-nameopensessioninview/filter-name
 url-pattern/hibernate/*/url-pattern
 /filter-mapping
 !-- END hibernate filters --
 
 
 
  But I found that this does not work. Because:
 
 
  public class ViewModePage extends org.apache.wicket.markup.html.WebPage
  {
  ...
 
 @SpringBean(name = userDAOBean)
 private UserDAO userDAO;
 
 
 IModel loadableUserModel = new LoadableDetachableModel() {
 
 @Override
 protected Object load(){
 User selectedUser = null;
 String value =
  ((PortletRequestContext)RequestContext.get()).getPortletRequest().getParameter(crmportal:userId);
 if(value!=null)
 {
 UuidUserType uuid = 
  UuidUserType.fromString(value); //Works!!
 userDAO.testSessoion(uuid);//Works!!
 
 selectedUser = userDAO.find(uuid);//Works!!
 
 if(!userDAO.isAttached(selectedUser)) 
  //Works!! But is not
  attached!!!
 {
 
 userDAO.save(selectedUser); //Attach 
  it //Works!! It
  saves/updates the object but it's still not attached
 }
 
 
 
 SetContactBasicDetail setDetails =
  selectedUser.getContactBasicDetails(); //Works!! It gets the set
 setDetails.isEmpty(); // FAIL FAIL Cannot 
  load lazy
 
 return setDetails.toArray();
 }
 return null;
 }
 
 
 };
  ...
  }
 
 
  This load() function does not work! It makes the exception. But:
 
 
 1.- It can get the User. Because the pointcut works inside the
 DAO?
 2.- It can save the object. Because the pointcut works inside
 the DAO?
 3.- It can get the Set. Because the pointcut works inside the
 DAO?
 
 
  The  userDAO.testSessoion(uuid); 

RE: MarkupnotFoundException in eclipse 3.4.2

2009-08-17 Thread Dale Ogilvie
 
Thanks, that worked. 

I wonder why this isn't automatically set up in the quickstart?

-Original Message-
From: jWeekend [mailto:jweekend_for...@cabouge.com] 
Sent: Tuesday, 18 August 2009 5:25 a.m.
To: users@wicket.apache.org
Subject: Re: MarkupnotFoundException in eclipse 3.4.2


The quick fix is:
  in Project Properties/Java Build Path/Source) set Included: *.* (and
make sure *.html is not Excluded) for the folder your html is in, most
likely src/main/java if you keep your templates next to your Java source
files.

Regards - Cemal
jWeekend
OO  Java Technologies, Wicket Training and Development
http://jWeekend.com


dale77 wrote:
 
 Eclipse is not copying the .html file alongside the .class. But the 
 Java
 | Compiler | Output Folder | Filtered Resources is only *.launch. How 
 | do
 I make eclipse copy the html file next to the class?

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org