Re: Missingresourceexception only in Firefox but not in Chrome or Safari

2012-07-13 Thread Pablo Diaz Redondo

No, I don't override getLocale, I only have a panel to change the locale when 
the user likes such as the above code:

public class ChangeLocalePanel extends Panel {

private static final long serialVersionUID = -627656359411214982L;
private static class LocaleDropDown extends DropDownChoice {
private static final long serialVersionUID = 
7005942730218677106L;

public class LocaleRenderer extends ChoiceRenderer {

private static final long serialVersionUID = 
-6725227495514242466L;
LocaleDropDown localeDropDown;
LocaleRenderer(LocaleDropDown localeDropDown){
this.localeDropDown = localeDropDown;
}
//@Override
public String getDisplayValue(Object locale) {
String displayName = "";

if(((Locale)locale).getLanguage().compareToIgnoreCase("es")==0)
displayName = "locale.spanish";
else
displayName = "locale.galician";

return (new StringResourceModel(displayName, 
localeDropDown, localeDropDown.getInnermostModel())).getString();
}
}

LocaleDropDown(String id, @SuppressWarnings("rawtypes") List 
supportedLocales) {
super(id, supportedLocales);
this.setMarkupId("es");
setChoiceRenderer(new LocaleRenderer(this));
setModel(new IModel() {

private static final long serialVersionUID = 1L;

public Object getObject() {
return getSession().getLocale();
}

public void setObject(Object object) {
getSession().setLocale((Locale) object);
}

public void detach() {
}
});
}

@Override
protected boolean wantOnSelectionChangedNotifications() {
return true;
}
}
public ChangeLocalePanel(String id, @SuppressWarnings("rawtypes") List 
supportedLocales){
super(id);
add(new LocaleDropDown("localeSelect",supportedLocales));

}
}


El 13/07/2012, a las 10:59, Decebal Suiu escribió:

> In your Session override getLocale() ?
> 
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Missingresourceexception-only-in-Firefox-but-not-in-Chrome-or-Safari-tp4650503p4650508.html
> Sent from the Users forum 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: Missingresourceexception only in Firefox but not in Chrome or Safari

2012-07-13 Thread Pablo Diaz Redondo
Thanks, I modified the default language in Fireforx Preferences, and nothing 
change, but I tried to move my Base_es.properties file to Base.properties, and 
runs well. 
Is there another way to set the default app language in Wicket?
 
Thanks.  

El 13/07/2012, a las 10:34, Ernesto Reinaldo Barreiro escribió:

> It might be that those browser have different default locale and for the
> locale on chrome and safari you have he  resource "BasePage.title" but not
> for the locale on your FF?
> 
> On Fri, Jul 13, 2012 at 10:26 AM, Pablo Diaz Redondo 
> wrote:
> 
>> Hi,
>> 
>> I get this error when I run my app in Firefox (mac), but in Safari and
>> Chrome it runs well. Somebody can help me? Thanks in advance:
>> 
>> Unexpected RuntimeException
>> 
>> Last cause: Unable to find property: 'BasePage.title' for component:
>> windowTitle [class=org.apache.wicket.markup.html.basic.Label]
>> WicketMessage: Exception in rendering component: [Component id =
>> windowTitle]
>> 
>> 
>> Stacktrace
>> 
>> Root cause:
>> 
>> java.util.MissingResourceException: Unable to find property:
>> 'BasePage.title' for component: windowTitle
>> [class=org.apache.wicket.markup.html.basic.Label]
>> at org.apache.wicket.Localizer.getString(Localizer.java:239)
>> at org.apache.wicket.Localizer.getString(Localizer.java:149)
>> at
>> org.apache.wicket.model.ResourceModel$AssignmentWrapper.getObject(ResourceModel.java:124)
>> at
>> org.apache.wicket.model.ResourceModel$AssignmentWrapper.getObject(ResourceModel.java:91)
>> at
>> org.apache.wicket.Component.getDefaultModelObject(Component.java:1640)
>> at
>> org.apache.wicket.Component.getDefaultModelObjectAsString(Component.java:1668)
>> at
>> org.apache.wicket.markup.html.basic.Label.onComponentTagBody(Label.java:113)
>> at
>> org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:72)
>> at
>> org.apache.wicket.Component.internalRenderComponent(Component.java:2517)
>> at
>> org.apache.wicket.markup.html.WebComponent.onRender(WebComponent.java:56)
>> at org.apache.wicket.Component.internalRender(Component.java:2347)
>> at org.apache.wicket.Component.render(Component.java:2275)
>> at
>> org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1474)
>> at
>> org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1638)
>> at
>> org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1613)
>> at
>> org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1567)
>> at
>> org.apache.wicket.markup.html.internal.HtmlHeaderContainer.onComponentTagBody(HtmlHeaderContainer.java:145)
>> at
>> org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:72)
>> at
>> org.apache.wicket.Component.internalRenderComponent(Component.java:2517)
>> at
>> org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1576)
>> at org.apache.wicket.Component.internalRender(Component.java:2347)
>> at org.apache.wicket.Component.render(Component.java:2275)
>> at
>> org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1474)
>> at
>> org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1638)
>> at org.apache.wicket.Page.onRender(Page.java:904)
>> at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:140)
>> at org.apache.wicket.Component.internalRender(Component.java:2347)
>> at org.apache.wicket.Component.render(Component.java:2275)
>> at org.apache.wicket.Page.renderPage(Page.java:1035)
>> at
>> org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
>> at
>> org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224)
>> at
>> org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
>> at
>> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:750)
>> at
>> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
>> at
>> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:252)
>> at
>> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:209)
>> at
>> org.apache.wic

Re: Gets an "userobject" content from a TreeTable when I click on a node?

2012-04-24 Thread Pablo Diaz
Yes, I've tried this solution at this moment and its ok.

Thank you so much!!!

2012/4/25 Sven Meier 

> Sorry, I've seen you're using DefaultMutableTreeNode when you're
> converting your structure to the tree.
>
> So you have to cast to the TreeNode implementation:
>
>  rowClickSelect(node, ((DefaultMutableTreeNode)node)**.getUserObject());
>
>
> Sven
>
>
>
> On 04/25/2012 12:30 AM, Pablo Diaz wrote:
>
>> Hi, thank you for your answer.
>>
>> I have 1.5.3 Wicket versión and I haven't the function getUserObject() to
>> use in TreeNode Object.
>>
>>
>> 2012/4/24 Sven Meier
>>
>>  Hi,
>>>
>>>
>>>  protected void onEvent(final AjaxRequestTarget target) {
>>>>  final TreeNode node = (TreeNode) item.getDefaultModelObject();
>>>>  rowClickSelect(node, item.getDefaultModelObject());
>>>> }
>>>>
>>> the item's model object is the TreeNode. You probably want to get hold on
>>> the node's user object:
>>>
>>>   rowClickSelect(node, node.getUserObject());
>>>
>>> Hope this helps
>>> Sven
>>>
>>>
>>> On 04/24/2012 08:23 PM, Pablo Díaz wrote:
>>>
>>>  Hi,
>>>>
>>>> I'm trying to get the content of a cell when I click on it?.
>>>>
>>>> I've the next code to create de treetable:
>>>>
>>>> |public class DocTreeTable extends TreeTable {
>>>>
>>>>private static final long serialVersionUID = 8799304134058383380L;
>>>>
>>>>public DocTreeTable(String id, TreeModel model) {
>>>>super(id, model, createColumns());
>>>>}
>>>>
>>>>private static IColumn[] createColumns() {
>>>>IColumn columns[] = new IColumn[] {
>>>>new PropertyRenderableColumn<Integer>(new
>>>>
>>>> ColumnLocation(
>>>>Alignment.LEFT, 3, Unit.EM), "Id",
>>>> "userObject.idDoc"),
>>>>new PropertyTreeColumn(new ColumnLocation(
>>>>Alignment.MIDDLE, 50, Unit.PROPORTIONAL),
>>>> "Fichero",
>>>>"userObject.data.name"),
>>>>new PropertyRenderableColumn<String>(new
>>>> ColumnLocation(
>>>>
>>>>Alignment.MIDDLE, 25, Unit.PROPORTIONAL),
>>>>"Descripción", "userObject.data.desc"),
>>>>new PropertyRenderableColumn<String>(new
>>>> ColumnLocation(
>>>>
>>>>Alignment.RIGHT, 25, Unit.PERCENT), "Fase",
>>>>"userObject.data.phase.data.name<
>>>> http://userObject.data.**phase.data.name<http://userObject.data.phase.data.name>
>>>> >"),
>>>>
>>>> };
>>>>return columns;
>>>>}
>>>>
>>>>@Override
>>>>protected void populateTreeItem(final WebMarkupContainer item,
>>>>final int level) {
>>>>super.populateTreeItem(item, level);
>>>>item.add(new AjaxEventBehavior("onclick") {
>>>>
>>>>private static final long serialVersionUID = 1L;
>>>>
>>>>@Override
>>>>protected void onEvent(final AjaxRequestTarget target) {
>>>>final TreeNode node = (TreeNode)
>>>> item.getDefaultModelObject();
>>>>rowClickSelect(node,item.getDefaultModelObject());
>>>>
>>>>
>>>>}
>>>>});
>>>>}
>>>>
>>>>private void rowClickSelect(TreeNode node, Object obj) {
>>>>node.toString();
>>>>if (this.getTreeState().isNodeSelected(node)) {
>>>>
>>>>DocTO doc = (DocTO) obj; // *HERE IS THE ERROR, AND I DON'T
>>>> KNOW HOW SOLVE IT.*
>>>>
>>>>if (node.isLeaf())
>>>>getWebPage()
>>>>.setResponsePage(
>>>>new DocViewPage(doc));
>>>>}
>>>>}
>>>> }|
>>>>
>>

Re: Gets an "userobject" content from a TreeTable when I click on a node?

2012-04-24 Thread Pablo Diaz
Hi, thank you for your answer.

I have 1.5.3 Wicket versión and I haven't the function getUserObject() to
use in TreeNode Object.


2012/4/24 Sven Meier 

> Hi,
>
>
> >protected void onEvent(final AjaxRequestTarget target) {
> >  final TreeNode node = (TreeNode) item.getDefaultModelObject();
> >  rowClickSelect(node, item.getDefaultModelObject());
> >}
>
> the item's model object is the TreeNode. You probably want to get hold on
> the node's user object:
>
>   rowClickSelect(node, node.getUserObject());
>
> Hope this helps
> Sven
>
>
> On 04/24/2012 08:23 PM, Pablo Díaz wrote:
>
>> Hi,
>>
>> I'm trying to get the content of a cell when I click on it?.
>>
>> I've the next code to create de treetable:
>>
>> |public class DocTreeTable extends TreeTable {
>>
>>private static final long serialVersionUID = 8799304134058383380L;
>>
>>public DocTreeTable(String id, TreeModel model) {
>>super(id, model, createColumns());
>>}
>>
>>private static IColumn[] createColumns() {
>>IColumn columns[] = new IColumn[] {
>>new PropertyRenderableColumn<**Integer>(new
>> ColumnLocation(
>>Alignment.LEFT, 3, Unit.EM), "Id",
>> "userObject.idDoc"),
>>new PropertyTreeColumn(new ColumnLocation(
>>Alignment.MIDDLE, 50, Unit.PROPORTIONAL),
>> "Fichero",
>>"userObject.data.name"),
>>new PropertyRenderableColumn<**String>(new ColumnLocation(
>>Alignment.MIDDLE, 25, Unit.PROPORTIONAL),
>>"Descripción", "userObject.data.desc"),
>>new PropertyRenderableColumn<**String>(new ColumnLocation(
>>Alignment.RIGHT, 25, Unit.PERCENT), "Fase",
>>
>> "userObject.data.phase.data.**name"),
>> };
>>return columns;
>>}
>>
>>@Override
>>protected void populateTreeItem(final WebMarkupContainer item,
>>final int level) {
>>super.populateTreeItem(item, level);
>>item.add(new AjaxEventBehavior("onclick") {
>>
>>private static final long serialVersionUID = 1L;
>>
>>@Override
>>protected void onEvent(final AjaxRequestTarget target) {
>>final TreeNode node = (TreeNode)
>> item.getDefaultModelObject();
>>rowClickSelect(node,item.**getDefaultModelObject());
>>
>>}
>>});
>>}
>>
>>private void rowClickSelect(TreeNode node, Object obj) {
>>node.toString();
>>if (this.getTreeState().**isNodeSelected(node)) {
>>DocTO doc = (DocTO) obj; // *HERE IS THE ERROR, AND I DON'T
>> KNOW HOW SOLVE IT.*
>>
>>if (node.isLeaf())
>>getWebPage()
>>.setResponsePage(
>>new DocViewPage(doc));
>>}
>>}
>> }|
>>
>> And I have de next code to create the page with treetable, after reading
>> the database content of a docs:
>> |
>>public DocsPage(PageParameters pageParameters) {
>>super(pageParameters);
>>
>>DocTreeTable() tree = new DocTreeTable("docs", createTreeModel());
>>tree.setRootLess(false);
>>tree.getTreeState().**setAllowSelectMultiple(false);
>>add(tree);
>>}
>>
>>public DocsPage() {
>>this(null);
>>}
>>
>>private TreeModel createTreeModel(){
>>List docs = docService.findMainFolders();
>>return convertToTreeModel(docs);
>>}
>>private TreeModel convertToTreeModel(List<**Object> list){
>>TreeModel model = null;
>>DefaultMutableTreeNode rootNode = new
>> DefaultMutableTreeNode((DocTO)**list.get(0));
>>addNode(rootNode, list);
>>model = new DefaultTreeModel(rootNode);
>>return model;
>>
>>}
>>
>>private void addNode(DefaultMutableTreeNode parent, List sub){
>>for(Object obj : sub){
>>if(((DocTO)obj).getData().**getFolder()){
>>DefaultMutableTreeNode child = new
>> DefaultMutableTreeNode((DocTO)**obj);
>>parent.add(child);
>>addNode(child, docService.findFolderChilds((**DocTO)obj));
>>}else{
>>DefaultMutableTreeNode child = new
>> DefaultMutableTreeNode((DocTO)**obj);
>>parent.add(child);
>>}
>>}
>>}
>> |
>>
>> Thank you in advance,
>>
>> Pablo.
>>
>>
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>