本文整理汇总了Java中javax.faces.event.FacesEvent.getComponent方法的典型用法代码示例。如果您正苦于以下问题:Java FacesEvent.getComponent方法的具体用法?Java FacesEvent.getComponent怎么用?Java FacesEvent.getComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.faces.event.FacesEvent
的用法示例。
在下文中一共展示了FacesEvent.getComponent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: queueEvent
import javax.faces.event.FacesEvent; //导入方法依赖的package包/类
/**
* <p>Intercept <code>queueEvent</code> and mark the phaseId for the
* event to be <code>PhaseId.APPLY_REQUEST_VALUES</code> if the
* <code>immediate</code> flag is true,
* <code>PhaseId.INVOKE_APPLICATION</code> otherwise.</p>
*/
@Override
public void queueEvent(FacesEvent e)
{
if (this == e.getComponent() && ((e instanceof ActionEvent) || (e instanceof ReturnEvent)))
{
if (isImmediate())
{
e.setPhaseId(PhaseId.ANY_PHASE);
}
else
{
e.setPhaseId(PhaseId.INVOKE_APPLICATION);
}
}
super.queueEvent(e);
}
示例2: _isImmediateEvent
import javax.faces.event.FacesEvent; //导入方法依赖的package包/类
/**
* Checks to see if the given event could possible be affected by the
* "immediate" property of the given component.
*/
private static boolean _isImmediateEvent(UIComponent comp, FacesEvent event)
{
if (event.getComponent() == comp)
{
return
(event instanceof RangeChangeEvent) ||
(event instanceof DisclosureEvent) ||
(event instanceof RowDisclosureEvent) ||
(event instanceof SelectionEvent) ||
(event instanceof SortEvent) ||
(event instanceof FocusEvent);
}
return false;
}
示例3: broadcastInContext
import javax.faces.event.FacesEvent; //导入方法依赖的package包/类
/**
* Broadcast the FacesEvent after updating the current component and
* current composite component
*
* @param context The current instance of FacesContext
* @param event The FacesEvent to be broadcasted
*/
public static void broadcastInContext(FacesContext context, FacesEvent event)
{
UIComponent component = event.getComponent();
UIComponent compositeParent = null;
RequestContext requestContext = RequestContext.getCurrentInstance();
if (!UIComponent.isCompositeComponent(component))
{
compositeParent = UIComponent.getCompositeComponentParent(component);
if (compositeParent != null)
{
requestContext.pushCurrentComponent(context, compositeParent);
compositeParent.pushComponentToEL(context, null);
}
}
requestContext.pushCurrentComponent(context, component);
component.pushComponentToEL(context, null);
try
{
component.broadcast(event);
}
finally
{
component.popComponentFromEL(context);
requestContext.popCurrentComponent(context, component);
if (compositeParent != null)
{
compositeParent.popComponentFromEL(context);
requestContext.popCurrentComponent(context, compositeParent);
}
}
}
示例4: queueEvent
import javax.faces.event.FacesEvent; //导入方法依赖的package包/类
/**
* Queues an event recursively to the root component.
* @param event
* @throws javax.faces.event.AbortProcessingException
*/
@Override
public void queueEvent(FacesEvent event)
throws AbortProcessingException
{
// For a "show-one" panel accordion, handle an "expanding"
// DisclosureEvent specifically, only if the source
// is one of its immediate children
if ((event instanceof DisclosureEvent) &&
!isDiscloseMany() &&
(this == event.getComponent().getParent()) &&
((DisclosureEvent) event).isExpanded())
{
for (UIComponent comp : ((List<UIComponent>) getChildren()))
{
// Skip over the show detail that is the source of this event
if (comp == event.getComponent())
continue;
if (comp instanceof UIXShowDetail)
{
UIXShowDetail showDetail = (UIXShowDetail) comp;
// Queue an event to hide the currently expanded showDetail
if (showDetail.isDisclosed())
(new DisclosureEvent(showDetail, false)).queue();
}
}
}
super.queueEvent(event);
}
示例5: getAudioMediaUploadPath
import javax.faces.event.FacesEvent; //导入方法依赖的package包/类
/**
* Get audio media upload path from the event's component tree.
* @param ae the event
* @return
*/
private String getAudioMediaUploadPath(FacesEvent ae)
{
String audioMediaUploadPath = null;
// now find what component fired the event
UIComponent component = ae.getComponent();
// get the subview containing the audio question
UIComponent parent = component.getParent();
// get the its peer components from the parent
List peers = parent.getChildren();
// look for the correct file upload path information
// held in the value of the component 'audioMediaUploadPath'
for (int i = 0; i < peers.size(); i++)
{
UIComponent peer = (UIComponent) peers.get(i);
if ("audioMediaUploadPath".equals(peer.getId()) && peer instanceof UIOutput)
{
audioMediaUploadPath = "" + ((UIOutput) peer).getValue();
log.info("FOUND: Component " + i +
" peer.getId(): " + peer.getId()+
" peer.getValue(): " + audioMediaUploadPath );
break;
}
}
return audioMediaUploadPath;
}
示例6: broadcast
import javax.faces.event.FacesEvent; //导入方法依赖的package包/类
public void broadcast(FacesEvent event) throws AbortProcessingException {
if (event instanceof IndexedEvent) {
IndexedEvent idxEvent = (IndexedEvent) event;
this.resetDataModel();
int prevIndex = this.index;
FacesContext ctx = FacesContext.getCurrentInstance();
FacesEvent target = idxEvent.getTarget();
UIComponent source = target.getComponent();
UIComponent compositeParent = null;
try {
int rowCount = getDataModel().getRowCount();
int idx = idxEvent.getIndex();
this.setIndex(ctx, idx);
Integer begin = this.getBegin();
Integer end = this.getEnd();
Integer step = this.getStep();
int b = ((begin != null) ? begin : 0);
int e = ((end != null) ? end : rowCount);
int s = ((step != null) ? step : 1);
this.updateIterationStatus(ctx,
new IterationStatus(idx == b, (idx + s >= e || rowCount == 1), idx, begin, end, step));
if (this.isIndexAvailable()) {
if (!UIComponent.isCompositeComponent(source)) {
compositeParent = UIComponent.getCompositeComponentParent(source);
}
if (compositeParent != null) {
compositeParent.pushComponentToEL(ctx, null);
}
source.pushComponentToEL(ctx, null);
source.broadcast(target);
}
} finally {
source.popComponentFromEL(ctx);
if (compositeParent != null) {
compositeParent.popComponentFromEL(ctx);
}
this.updateIterationStatus(ctx, null);
this.setIndex(ctx, prevIndex);
}
} else {
super.broadcast(event);
}
}