public class UICommand extends UIComponentBase implements ActionSource2
UICommand は、ユーザーによってアクティブ化されると、アプリケーション固有の「コマンド」または「アクション」をトリガーするユーザーインターフェースコンポーネントを表す UIComponent です。このようなコンポーネントは通常、プッシュボタン、メニュー項目、ハイパーリンクとしてレンダリングされます。
この UICommand の decode() メソッドまたは対応する Renderer は、このコントロールがアクティブ化されたことを検出すると、ActionEvent をキューに入れます。後で、broadcast() メソッドは、このイベントがすべての関心のあるリスナーにブロードキャストされることを保証します。
リスナーは次の順序で呼び出されます。
ActionListener の登録された順序。MethodExpression(MethodBinding として設定された "actionListener" をカバーします)。Application から取得されたデフォルトの ActionListener。つまり、アタッチされた「アクション」MethodExpression。 デフォルトでは、rendererType プロパティを "javax.faces.Button" に設定する必要があります。この値は、setRendererType() メソッドを呼び出すことで変更できます。
| 修飾子と型 | フィールドと説明 |
|---|---|
static StringSE | COMPONENT_FAMILY このコンポーネントの標準コンポーネントファミリ。 |
static StringSE | COMPONENT_TYPE このコンポーネントの標準コンポーネント型。 |
ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME, VIEW_LOCATION_KEY| 修飾子と型 | メソッドと説明 |
|---|---|
void | addActionListener(ActionListener listener) 新しい ActionListener を、ActionEvent の発生時に通知を受けることに関心のあるリスナーのセットに追加します。 |
void | broadcast(FacesEvent event) デフォルトの UIComponent.broadcast(javax.faces.event.FacesEvent) 処理に加えて、ブロードキャストされている ActionEvent を、actionListener によって参照されるメソッド(存在する場合)、および Application に登録されているデフォルトの ActionListener に渡します。 |
MethodBinding | getAction() 使用すべきではありません。 これは getActionExpression() に置き換えられました。 |
MethodExpression | getActionExpression()immediate プロパティの値に応じて、リクエスト処理ライフサイクルのリクエスト値の適用フェーズまたはアプリケーションの呼び出しフェーズ中に、ユーザーがこの UIComponent をアクティブ化した場合、呼び出されるアプリケーションアクションを指す MethodExpression を返します。 |
MethodBinding | getActionListener() 使用すべきではありません。 代わりに getActionListeners() を使用してください。 |
ActionListener[] | getActionListeners() この ActionSource インスタンスに登録されている ActionListener のセットを返します。 |
StringSE | getFamily()このコンポーネントが属するコンポーネントファミリの識別子を返します。 |
ObjectSE | getValue()UICommand の value プロパティを返します。 |
boolean | isImmediate() 即時フラグ。 |
void | queueEvent(FacesEvent event)queueEvent をインターセプトし、次のアクションを実行します。 |
void | removeActionListener(ActionListener listener)ActionEvent の発生時に通知を受けることに関心のあるリスナーのセットから既存の ActionListener(存在する場合)を削除します。 |
void | setAction(MethodBinding action) 使用すべきではありません。 これは setActionExpression(javax.el.MethodExpression) に置き換えられました。 |
void | setActionExpression(MethodExpression actionExpression)immediate プロパティの値に応じて、リクエスト処理ライフサイクルのリクエスト値の適用フェーズまたはアプリケーションの呼び出しフェーズ中に、この UIComponent がユーザーによってアクティブ化された場合に呼び出されるアプリケーションアクションを指す MethodExpression を設定します。 |
void | setActionListener(MethodBinding actionListener) 使用すべきではありません。 これは addActionListener(javax.faces.event.ActionListener) に置き換えられました。 |
void | setImmediate(boolean immediate) この UIComponent の「即時実行」フラグを設定します。 |
void | setValue(ObjectSE value)UICommand の value プロパティを設定します。 |
addClientBehavior, addFacesListener, clearInitialState, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getListenersForEventClass, getParent, getPassThroughAttributes, getRenderer, getRendererType, getRendersChildren, getValueBinding, invokeOnComponent, isRendered, isTransient, markInitialState, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, removeFacesListener, restoreAttachedState, restoreState, saveAttachedState, saveState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding, subscribeToEvent, unsubscribeFromEventencodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView, setValueExpression, visitTreecloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSEpublic UICommand()
デフォルトのプロパティ値で新しい UICommand インスタンスを作成します。
public StringSE getFamily()
UIComponent このコンポーネントが属するコンポーネントファミリの識別子を返します。この識別子は、rendererType プロパティの値と組み合わせて、このコンポーネントインスタンスに適切な Renderer を選択するために使用できます。このメソッドは null を返すべきではないことに注意してください
UIComponent の getFamily public boolean isImmediate()
即時フラグ。
ActionSource の isImmediate true、それ以外の場合は false。public void setImmediate(boolean immediate)
ActionSource この UIComponent の「即時実行」フラグを設定します。
ActionSource の setImmediate immediate - 新しい即時実行フラグ public ObjectSE getValue()
UICommand の value プロパティを返します。これはほとんどの場合、ラベルとしてレンダリングされます。
public void setValue(ObjectSE value)
UICommand の value プロパティを設定します。これはほとんどの場合、ラベルとしてレンダリングされます。
value - 新しい価値 public MethodExpression getActionExpression()
ActionSource2immediate プロパティの値に応じて、リクエスト処理ライフサイクルのリクエスト値の適用フェーズまたはアプリケーションの呼び出しフェーズ中に、ユーザーがこの UIComponent をアクティブ化した場合、呼び出されるアプリケーションアクションを指す MethodExpression を返します。
返される MethodExpression が、ActionSource.setAction(javax.faces.el.MethodBinding) の呼び出しによって設定された MethodBinding インスタンスの単なるラッパーである可能性があることに注意してください。これにより、デフォルトの ActionListener が古いコンポーネントで適切に機能し続けることが可能になります。
ActionSource2 の getActionExpression public void setActionExpression(MethodExpression actionExpression)
ActionSource2immediate プロパティの値に応じて、リクエスト処理ライフサイクルのリクエスト値の適用フェーズまたはアプリケーションの呼び出しフェーズ中に、この UIComponent がユーザーによってアクティブ化された場合に呼び出されるアプリケーションアクションを指す MethodExpression を設定します。
このような式で参照されるメソッドはすべて、String の戻り値の型でパブリックであり、パラメーターを受け入れない必要があります。
ActionSource2 の setActionExpression actionExpression - 新しいメソッド式 public void addActionListener(ActionListener listener)
ActionSource 新しい ActionListener を、ActionEvent の発生時に通知を受けることに関心のあるリスナーのセットに追加します。
ActionSource の addActionListener listener - 追加する ActionListenerNullPointerExceptionSE - listener が null の場合 public ActionListener[] getActionListeners()
ActionSource この ActionSource インスタンスに登録されている ActionListener のセットを返します。登録済みのリスナーがない場合は、長さ 0 の配列が返されます。
ActionSource の getActionListeners public void removeActionListener(ActionListener listener)
ActionSourceActionEvent の発生時に通知を受けることに関心のあるリスナーのセットから既存の ActionListener(存在する場合)を削除します。
ActionSource の removeActionListener listener - 削除する ActionListenerNullPointerExceptionSE - listener が null の場合 public void broadcast(FacesEvent event) throws AbortProcessingException
デフォルトの UIComponent.broadcast(javax.faces.event.FacesEvent) 処理に加えて、ブロードキャストされている ActionEvent を、actionListener によって参照されるメソッド(存在する場合)、および Application に登録されているデフォルトの ActionListener に渡します。
UIComponentBase の broadcast event - 放送予定の FacesEventAbortProcessingException - Jakarta Server Faces 実装に、現在のイベントでこれ以上の処理を実行しないことを通知します IllegalArgumentExceptionSE - この FacesEvent の実装クラスがこのコンポーネントでサポートされていない場合 NullPointerExceptionSE - event が null の場合 public void queueEvent(FacesEvent event)
queueEvent をインターセプトし、次のアクションを実行します。イベントが の場合、イベントから ActionEventUIComponent インスタンスを取得します。コンポーネントが の場合、その "immediate" プロパティの値を取得します。それが true の場合、イベントの phaseId を ActionSourcePhaseId.APPLY_REQUEST_VALUES としてマークし、そうでない場合は、phaseId を PhaseId.INVOKE_APPLICATION としてマークします。このメソッドから戻る前に、イベントを super.queueEvent() に渡す必要があります。
UIComponentBase の queueEvent event - キューに入れられる FacesEventpublic MethodBinding getAction()
getActionExpression() に置き換えられました。 実装クラスも ActionSource2 を実装している場合、このメソッドの実装は ActionSource2.getActionExpression() を呼び出して結果を調べる必要があります。以前の ActionSource.setAction(javax.faces.el.MethodBinding) の呼び出しの結果が返された場合は、そこから MethodBinding を抽出して返します。それ以外の場合は、返された MethodExpression を MethodBinding 実装でラップして返します。
実装クラスが ActionSource2 を実装していない場合は、呼び出されるアプリケーションアクションを指す MethodBinding を返します。この UIComponent がユーザーによってアクティブ化されている場合、リクエスト処理ライフサイクルのリクエスト値の適用フェーズまたはアプリケーションの呼び出しフェーズ中に、immediate プロパティ。
ActionSource の getAction public void setAction(MethodBinding action)
setActionExpression(javax.el.MethodExpression) に置き換えられました。 実装クラスが ActionSource2 も実装する場合、このメソッドの実装は、MethodExpression を実装するクラスで引数 action をラップし、ラップされた action を渡して ActionSource2.setActionExpression(javax.el.MethodExpression) を呼び出す必要があります。
実装クラスが ActionSource2 を実装していない場合、MethodBinding がアプリケーションアクションを指すように設定します。この UIComponent がユーザーによってアクティブ化された場合、リクエスト処理ライフサイクルのリクエスト値の適用フェーズまたはアプリケーションの呼び出しフェーズ中に、immediate プロパティ。
このような式で参照されるメソッドはすべて、String の戻り値の型でパブリックであり、パラメーターを受け入れない必要があります。
ActionSource の setAction action - 新しい MethodBinding 式 public MethodBinding getActionListener()
getActionListeners() を使用してください。 このインスタンスに対して ActionSource.setActionListener(javax.faces.el.MethodBinding) が以前に呼び出されていなかった場合、このメソッドは null を返す必要があります。呼び出された場合、このメソッドは ActionSource.setActionListener(javax.faces.el.MethodBinding) に渡された正確な MethodBinding インスタンスを返す必要があります。
呼び出されるメソッドは、この UIComponent がユーザーによってアクティブ化された場合、immediate プロパティの値に応じて、リクエスト処理ライフサイクルのリクエスト値の適用フェーズまたはアプリケーションの呼び出しフェーズ中に呼び出されます。
ActionSource の getActionListener public void setActionListener(MethodBinding actionListener)
addActionListener(javax.faces.event.ActionListener) に置き換えられました。 引数 actionListener を ActionListener の実装にラップし、ActionSource.getActionListeners() メソッドをサポートする内部データ構造に格納します。setActionListener への以前の呼び出しによって格納されたインスタンスを上書きすることに注意してください。
このような式で参照されるメソッドは、戻り値の型が void のパブリックであり、型 ActionEvent の単一のパラメーターを受け入れる必要があります。
ActionSource の setActionListener actionListener - 新しいメソッドバインディング式 Copyright © 2019 Eclipse Foundation.
Use is subject to license terms.