本文整理匯總了Java中javax.faces.event.ActionEvent.getComponent方法的典型用法代碼示例。如果您正苦於以下問題:Java ActionEvent.getComponent方法的具體用法?Java ActionEvent.getComponent怎麽用?Java ActionEvent.getComponent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.faces.event.ActionEvent
的用法示例。
在下文中一共展示了ActionEvent.getComponent方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: appendChildToDocument
import javax.faces.event.ActionEvent; //導入方法依賴的package包/類
/**
* Appends an image child to the panelGroup in the underlying JSP document
*/
public void appendChildToDocument(ActionEvent event)
{
UIComponent eventSource = event.getComponent();
UIComponent uic = eventSource.findComponent("pg1");
// only allow the image to be added once
if (_findChildById(uic,"oi3") != null)
return;
FacesContext fc = FacesContext.getCurrentInstance();
DocumentFragment imageFragment = _createDocumentFragment(_IMAGE_MARK_UP);
if (imageFragment != null)
{
DocumentChange change = new AddChildDocumentChange(imageFragment);
ChangeManager apm = RequestContext.getCurrentInstance().getChangeManager();
apm.addDocumentChange(fc, uic, change);
}
}
示例2: appendChild
import javax.faces.event.ActionEvent; //導入方法依賴的package包/類
/**
* Appends an image child to the panelGroup.
*/
@SuppressWarnings("unchecked")
public void appendChild(ActionEvent event)
{
UIComponent eventSource = event.getComponent();
UIComponent uic = eventSource.findComponent("pg1");
if (_findChildById(uic,"oi2") != null)
return;
FacesContext fc = FacesContext.getCurrentInstance();
CoreImage newChild =
(CoreImage) fc.getApplication().createComponent(
"org.apache.myfaces.trinidad.CoreImage");
newChild.setId("oi2");
newChild.setInlineStyle("height: 100px, width: 120px");
newChild.setSource(
"http://homepage.mac.com/awiner/.Pictures/WindyHill/PaleSwallowtail.jpg");
uic.getChildren().add(newChild);
ComponentChange aca = new AddChildComponentChange(newChild);
ChangeManager apm = RequestContext.getCurrentInstance().getChangeManager();
apm.addComponentChange(fc, uic, aca);
}
示例3: addFacet
import javax.faces.event.ActionEvent; //導入方法依賴的package包/類
/**
* Adds a 'brandingAppContextual' facet to the panelGroup.
*/
@SuppressWarnings("unchecked")
public void addFacet(ActionEvent event)
{
UIComponent eventSource = event.getComponent();
UIComponent uic = eventSource.findComponent("pp1");
FacesContext fc = FacesContext.getCurrentInstance();
CoreOutputFormatted newFacetComponent =
(CoreOutputFormatted) fc.getApplication().createComponent(
"org.apache.myfaces.trinidad.CoreOutputFormatted");
newFacetComponent.setStyleUsage("inContextBranding" );
newFacetComponent.setValue(
"Customer Company - Menlo Park");
uic.getFacets().put("brandingAppContextual", newFacetComponent);
ComponentChange afa = new SetFacetChildComponentChange("brandingAppContextual", newFacetComponent);
ChangeManager apm = RequestContext.getCurrentInstance().getChangeManager();
apm.addComponentChange(fc, uic, afa);
}
示例4: removeChildren
import javax.faces.event.ActionEvent; //導入方法依賴的package包/類
/**
* Removes a pair of children, based on some characteristic of the
* event source.
*/
public void removeChildren(ActionEvent event)
{
UIComponent eventSource = event.getComponent();
UIComponent uic = eventSource.findComponent("pg1");
int numChildren = uic.getChildCount();
if (numChildren == 0)
return;
String eventSourceId = eventSource.getId();
if (eventSourceId.equals("cb2"))
{
_removeChild(uic, "sic1");
_removeChild(uic, "cc1");
}
else if (eventSourceId.equals("cb3"))
{
_removeChild(uic, "cd1");
_removeChild(uic, "sid1");
}
}
示例5: temporaryMoveComponent
import javax.faces.event.ActionEvent; //導入方法依賴的package包/類
public void temporaryMoveComponent(ActionEvent ae)
{
System.out.println("Temporarily moving a component");
UIComponent button = ae.getComponent();
UIComponent moveme = button.findComponent("moveme");
UIComponent moveto = button.findComponent("moveto");
UIComponent parent = moveme.getParent();
parent.getChildren().remove(moveme);
moveto.getChildren().add(moveme);
moveto.getChildren().remove(moveme);
parent.getChildren().add(moveme);
}
示例6: handleArrangeNewItem
import javax.faces.event.ActionEvent; //導入方法依賴的package包/類
public void handleArrangeNewItem(ActionEvent evt)
{
UIComponent target = evt.getComponent();
String forEachKey = (String)target.getAttributes().get("forEachKey");
String newKey = "new" + (_nextArrangePersonKey++);
if (forEachKey == null)
{
// Append use case, just add the person to the map, no need to re-order
_arrangeMap.put(newKey,
new Person(newKey, _newPersonFirstName, _newPersonLastName));
}
else
{
LinkedHashMap<String, Person> mapCopy = new LinkedHashMap<String, Person>(_arrangeMap);
_arrangeMap.clear();
boolean added = false;
for (Map.Entry<String, Person> entry : mapCopy.entrySet())
{
String key = entry.getKey();
if (added == false && forEachKey.equals(key))
{
_arrangeMap.put(newKey,
new Person(newKey, _newPersonFirstName, _newPersonLastName));
added = true;
}
_arrangeMap.put(key, entry.getValue());
}
_sortArrangedDemoChildren(target);
}
_newPersonFirstName = null;
_newPersonLastName = null;
}
示例7: handleArrangeRemoveItem
import javax.faces.event.ActionEvent; //導入方法依賴的package包/類
public void handleArrangeRemoveItem(ActionEvent evt)
{
UIComponent target = evt.getComponent();
String forEachKey = (String)target.getAttributes().get("forEachKey");
_arrangeMap.remove(forEachKey);
// No need to re-order the components as the mark-and-sweep will remove the unmatched component
// during tag execution
RequestContext.getCurrentInstance().addPartialTargets(target, "::forEachParent");
}
示例8: handleArrangeMoveItemUp
import javax.faces.event.ActionEvent; //導入方法依賴的package包/類
public void handleArrangeMoveItemUp(ActionEvent evt)
{
UIComponent target = evt.getComponent();
String forEachKey = (String)target.getAttributes().get("forEachKey");
_moveItem(forEachKey, true);
_sortArrangedDemoChildren(target);
}
示例9: handleArrangeMoveItemDown
import javax.faces.event.ActionEvent; //導入方法依賴的package包/類
public void handleArrangeMoveItemDown(ActionEvent evt)
{
UIComponent target = evt.getComponent();
String forEachKey = (String)target.getAttributes().get("forEachKey");
_moveItem(forEachKey, false);
_sortArrangedDemoChildren(target);
}
示例10: removeFacets
import javax.faces.event.ActionEvent; //導入方法依賴的package包/類
/**
* Removes one or more facets, based on some characteristic of the
* event source.
*/
@SuppressWarnings("unchecked")
public void removeFacets(ActionEvent event)
{
CoreCommandButton eventSource = (CoreCommandButton) event.getComponent();
//pu: Anything until ":" in the button text represents the facet name/s
String facetNameFromButtonText = (eventSource.getText().split(":"))[0];
//pu: In case of the button that removes multiple facets, this is again
// delimited by "_"
String removableFacetNames[] = facetNameFromButtonText.split("_");
//pu: Get the CorePanelPage components that has all the removable facets
UIComponent uic = eventSource.findComponent("pp1");
Map<String, UIComponent> facets = uic.getFacets();
if (facets.keySet().size() == 0)
return;
for (int i=0; i<removableFacetNames.length; i++)
{
if (facets.get(removableFacetNames[i]) != null)
{
facets.remove(removableFacetNames[i]);
ComponentChange rfa = new RemoveFacetComponentChange(removableFacetNames[i]);
FacesContext fc = FacesContext.getCurrentInstance();
ChangeManager apm = RequestContext.getCurrentInstance().getChangeManager();
apm.addComponentChange(fc, uic, rfa);
}
}
}
示例11: navigationItemAction
import javax.faces.event.ActionEvent; //導入方法依賴的package包/類
/**
* Changes the selected state of all of the navigation items in the
* parent component so that the clicked navigation item becomes
* selected and the others become deselected.
* @param event the ActionEvent associated with the action
*/
@SuppressWarnings("unchecked")
public void navigationItemAction(ActionEvent event)
{
UIComponent actionItem = event.getComponent();
UIComponent parent = actionItem.getParent();
while (! (parent instanceof UIXNavigationHierarchy) )
{
parent = parent.getParent();
if (parent == null)
{
System.err.println(
"Unexpected component hierarchy, no UIXNavigationHierarchy found.");
return;
}
}
List<UIComponent> children = parent.getChildren();
for (UIComponent child : children)
{
FacesBean childFacesBean = ((UIXCommand) child).getFacesBean();
FacesBean.Type type = childFacesBean.getType();
PropertyKey selectedKey = type.findKey("selected");
if (selectedKey != null)
{
childFacesBean.setProperty(selectedKey, (child == actionItem));
}
}
RequestContext adfContext = RequestContext.getCurrentInstance();
adfContext.addPartialTarget(parent);
}
示例12: getRequestName
import javax.faces.event.ActionEvent; //導入方法依賴的package包/類
protected String getRequestName(ActionEvent event) {
final String actionName;
if (event.getComponent() instanceof ActionSource2) {
// actionSource est une UICommand en général
final ActionSource2 actionSource = (ActionSource2) event.getComponent();
if (actionSource.getActionExpression() != null) {
actionName = actionSource.getActionExpression().getExpressionString();
} else {
actionName = actionSource.getClass().getName();
}
} else {
actionName = event.getComponent().getClass().getName();
}
return actionName;
}
示例13: btnOccursAction
import javax.faces.event.ActionEvent; //導入方法依賴的package包/類
public String btnOccursAction(ActionEvent event) {
Button source = (Button) event.getComponent() ;
SubPanel parent = (SubPanel) source.getParent();
String btnType = (String) source.getText();
getApplicationBean().refresh();
getDynFormFactory().processOccursAction(parent, btnType);
return null;
}
示例14: getDocComponentForEvent
import javax.faces.event.ActionEvent; //導入方法依賴的package包/類
private DocComponent getDocComponentForEvent(ActionEvent event) {
Button source = (Button) event.getComponent();
UIComponent parent = source.getParent();
if (parent instanceof DocComponent) { // if doc component button clicked
return (DocComponent) parent;
}
else {
return (DocComponent) parent.getAttributes().get("docComponent");
}
}
示例15: setAttribute
import javax.faces.event.ActionEvent; //導入方法依賴的package包/類
public void setAttribute(ActionEvent event, String name, Object value) {
UIComponent comp = event.getComponent();
Map<String, Object> map = event.getComponent().getAttributes();
map.put(name, comp.getClientId(FacesContext.getCurrentInstance()));
}