jakarta.faces.component.UIOutcomeTarget Maven / Gradle / Ivy
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package jakarta.faces.component;
/**
*
* This component is paired with the jakarta.faces.Button
or
* jakarta.faces.Link
renderers and encapsulates properties relating to the rendering of outcomes directly
* to the response. This enables bookmarkability in Jakarta Server Faces applications.
*
*
* @since 2.0
*/
public class UIOutcomeTarget extends UIOutput {
// ------------------------------------------------------ Manifest Constants
/**
*
* The standard component type for this component.
*
*/
public static final String COMPONENT_TYPE = "jakarta.faces.OutcomeTarget";
/**
*
* The standard component family for this component.
*
*/
public static final String COMPONENT_FAMILY = "jakarta.faces.OutcomeTarget";
enum PropertyKeys {
includeViewParams, outcome, disableClientWindow
}
// ------------------------------------------------------------ Constructors
/**
*
* Create a new {@link UIOutcomeTarget} instance with default property values.
*
*/
public UIOutcomeTarget() {
super();
setRendererType("jakarta.faces.Link");
}
// -------------------------------------------------------------- Properties
@Override
public String getFamily() {
return COMPONENT_FAMILY;
}
/**
*
* Return whether or not the view parameters should be encoded into the target url.
*
*
* @return true
if the view parameters should be encoded in the url, false
otherwise.
* @since 2.0
*/
public boolean isIncludeViewParams() {
return (Boolean) getStateHelper().eval(PropertyKeys.includeViewParams, false);
}
/**
*
* Set whether or not the page parameters should be encoded into the target url.
*
*
* @param includeViewParams The state of the switch for encoding page parameters
*
* @since 2.0
*/
public void setIncludeViewParams(boolean includeViewParams) {
getStateHelper().put(PropertyKeys.includeViewParams, includeViewParams);
}
/**
*
* Return whether or not the client window should be encoded into the target url.
*
*
* @return true
if the client window should NOT be encoded in the url, false
otherwise.
* @since 2.0
*/
public boolean isDisableClientWindow() {
return (Boolean) getStateHelper().eval(PropertyKeys.disableClientWindow, false);
}
/**
*
* Set whether or not the client window should be encoded into the target url.
*
*
* @param disableClientWindow if @{code true}, the client window will not be included in this outcome target.
*
* @since 2.2
*/
public void setDisableClientWindow(boolean disableClientWindow) {
getStateHelper().put(PropertyKeys.disableClientWindow, disableClientWindow);
}
/**
*
* Returns the outcome
property of the UIOutcomeTarget
. This value is passed to the
* {@link jakarta.faces.application.NavigationHandler} when resolving the target url of this component.
*
*
* @return the outcome.
* @since 2.0
*/
public String getOutcome() {
return (String) getStateHelper().eval(PropertyKeys.outcome);
}
/**
*
* Sets the outcome
property of the UIOutcomeTarget
. This value is passed to the
* NavigationHandler when resolving the target url of this component.
*
*
* @since 2.0
*
* @param outcome the navigation outcome
*/
public void setOutcome(String outcome) {
getStateHelper().put(PropertyKeys.outcome, outcome);
}
}