當前位置: 首頁>>代碼示例>>Java>>正文


Java ActionEvent.getComponent方法代碼示例

本文整理匯總了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);
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:26,代碼來源:ChangeBean.java

示例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);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:27,代碼來源:ChangeBean.java

示例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);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:23,代碼來源:ChangeBean.java

示例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");
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:24,代碼來源:ChangeBean.java

示例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);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:14,代碼來源:TestStateSavingBean.java

示例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;
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:39,代碼來源:ForEachBean.java

示例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");
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:13,代碼來源:ForEachBean.java

示例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);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:10,代碼來源:ForEachBean.java

示例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);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:10,代碼來源:ForEachBean.java

示例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);
    }
  }
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:33,代碼來源:ChangeBean.java

示例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);
}
 
開發者ID:apache,項目名稱:myfaces-trinidad,代碼行數:38,代碼來源:DemoCommandNavigationItemBean.java

示例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;
}
 
開發者ID:javamelody,項目名稱:javamelody,代碼行數:16,代碼來源:JsfActionListener.java

示例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;
}
 
開發者ID:yawlfoundation,項目名稱:yawl,代碼行數:9,代碼來源:dynForm.java

示例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");
    }
}
 
開發者ID:yawlfoundation,項目名稱:yawl,代碼行數:11,代碼來源:dynForm.java

示例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()));
}
 
開發者ID:salimvanak,項目名稱:myWMS,代碼行數:6,代碼來源:JSFHelper.java


注:本文中的javax.faces.event.ActionEvent.getComponent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。