You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Kolesnikov, Alexander GNI" <Al...@CIGNA.com> on 2007/09/05 11:09:47 UTC

[T5] PageLink cannot be disabled?

Just discovered that PageLink doesn't have a disabled parameter. That's
a pity. Any ideas how to deal wit this?

Thanks,

Alexander

------------------------------------------------------------------------------
CONFIDENTIALITY NOTICE: If you have received this email in error, please immediately notify the sender by e-mail at the address shown.  This email transmission may contain confidential information.  This information is intended only for the use of the individual(s) or entity to whom it is intended even if addressed incorrectly.  Please delete it from your files if you are not the intended recipient.  Thank you for your compliance.  Copyright 2007 CIGNA
==============================================================================

Re: [T5] PageLink cannot be disabled?

Posted by Robin Helgelin <lo...@gmail.com>.
On 9/5/07, Nick Westgate <ni...@key-planning.co.jp> wrote:
> Put this in your components directory and it will override Tapestry's
> PageLink component unless your classes import the corelib type.

[component snipped]

Semi-OT question :)
Wouldn't a disable PageLink component be better of to render the
link-text without the <a></a> instead of not render anything?

-- 
        regards,
        Robin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5] PageLink cannot be disabled?

Posted by Nick Westgate <ni...@key-planning.co.jp>.
Put this in your components directory and it will override Tapestry's
PageLink component unless your classes import the corelib type.

(I'll submit a JIRA.)

Cheers,
Nick.


// Copyright 2007 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package yourapp.components;

import java.util.List;

import org.apache.tapestry.ClientElement;
import org.apache.tapestry.ComponentResources;
import org.apache.tapestry.Link;
import org.apache.tapestry.MarkupWriter;
import org.apache.tapestry.PageRenderSupport;
import org.apache.tapestry.annotations.Environmental;
import org.apache.tapestry.annotations.Inject;
import org.apache.tapestry.annotations.Parameter;
import org.apache.tapestry.annotations.SupportsInformalParameters;

/**
  * Generates a render request link to some other page in the application. If an activation
  * context is supplied (as the context parameter), then the context values will be encoded into
  * the URL. If no context is supplied, then the target page itself will supply the context via a
  * passivate event.
  * <p>
  * Pages are not required to have an activation context. When a page does have an activation
  * context, the value typically represents the identity of some object displayed or otherwise
  * manipulated by the page.
  */
@SupportsInformalParameters
public class PageLink implements ClientElement
{
     /** The logical name of the page to link to. */
     @Parameter(required = true, defaultPrefix = "literal")
     private String _page;

     @Inject
     private ComponentResources _resources;

     @Environmental
     private PageRenderSupport _support;

     /**
      * If true, then then no link element is rendered (and no informal parameters as well). The
      * body is, however, still rendered.
      */
     @Parameter("false")
     private boolean _disabled;

     private String _clientId;

     /**
      * If provided, this is the activation context for the target page (the information will be
      * encoded into the URL). If not provided, then the target page will provide its own
      * activation context.
      */
     @Parameter
     private List _context;

     private final Object[] _emptyContext = new Object[0];

     void beginRender(MarkupWriter writer)
     {
         if (_disabled) return;

         _clientId = _support.allocateClientId(_resources.getId());

         Object[] activationContext = _context != null ? _context.toArray() : _emptyContext;

         Link link = _resources.createPageLink(_page, _resources.isBound("context"),
             activationContext);

         writer.element("a", "href", link, "id", _clientId);

         _resources.renderInformalParameters(writer);
     }

     void afterRender(MarkupWriter writer)
     {
         if (_disabled) return;

         writer.end(); // <a>
     }

     public String getClientId()
     {
         return _clientId;
     }
}


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5] PageLink cannot be disabled?

Posted by Kristian Marinkovic <kr...@porsche.co.at>.
write a mixin that is able to render a pagelink that is disabled and 
attach it to your pagelink component.






"Robin Helgelin" <lo...@gmail.com> 
05.09.2007 11:14
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>


An
"Tapestry users" <us...@tapestry.apache.org>
Kopie

Thema
Re: [T5] PageLink cannot be disabled?






On 9/5/07, Kolesnikov, Alexander      GNI
<Al...@cigna.com> wrote:
> Just discovered that PageLink doesn't have a disabled parameter. That's
> a pity. Any ideas how to deal wit this?

Edit the source and provide your solution to the community :)

-- 
        regards,
        Robin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org



Re: [T5] PageLink cannot be disabled?

Posted by Robin Helgelin <lo...@gmail.com>.
On 9/5/07, Kolesnikov, Alexander      GNI
<Al...@cigna.com> wrote:
> Just discovered that PageLink doesn't have a disabled parameter. That's
> a pity. Any ideas how to deal wit this?

Edit the source and provide your solution to the community :)

-- 
        regards,
        Robin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org