本文整理汇总了Java中javax.faces.event.ActionEvent类的典型用法代码示例。如果您正苦于以下问题:Java ActionEvent类的具体用法?Java ActionEvent怎么用?Java ActionEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ActionEvent类属于javax.faces.event包,在下文中一共展示了ActionEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addEvent
import javax.faces.event.ActionEvent; //导入依赖的package包/类
/**
* Adds a new event to the tutorial event.
* @param actionEvent The actionEvent triggered by the PrimeFaces scheduler.
*/
public void addEvent(ActionEvent actionEvent) {
log.debug("addEvent called with " + actionEvent);
if (event.getId() == null) {
tutorialEventModel.addEvent(event);
log.debug("Event gets added");
logEventCreated(event);
} else {
tutorialEventModel.updateEvent(event);
log.debug("Event gets updated");
if (event.getStartDate() != oldEventStartDate
|| event.getEndDate() != oldEventEndDate) {
log.debug("The event dates have changed");
logEventMoved(event);
mailEventMoved(event, oldEventStartDate, oldEventEndDate);
} else {
logEventUpdated(event);
}
}
updateTutorialEvents();
event = new TutorialEvent();
}
示例2: addEvent
import javax.faces.event.ActionEvent; //导入依赖的package包/类
/**
* Adds a new event to the exam event.
* @param actionEvent The actionEvent triggered by the PrimeFaces scheduler.
* @pre The selected event is not null.
*/
public void addEvent(ActionEvent actionEvent) {
if (event.getId() == null) {
updateExaminedStudentsFromDualList();
event = examEventService.persist(event);
examEventModel.addEvent(event);
log.debug("Event gets added");
logEventCreated(event);
} else {
updateExaminedStudentsFromDualList();;
examEventModel.updateEvent(event);
log.debug("Event gets updated");
if ((oldEventEndDate != null && oldEventStartDate != null)
&& (!event.getStartDate().equals(oldEventStartDate)
|| !event.getEndDate().equals(oldEventEndDate))) {
logEventMoved(event);
mailEventMoved(event, oldEventStartDate, oldEventEndDate);
} else {
logEventUpdated(event);
}
}
updateExamEvents();
event = createDefaultEvent();
}
示例3: decode
import javax.faces.event.ActionEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void decode(FacesContext context, UIComponent component)
{
UIXProgress progressComponent = (UIXProgress)component;
Map<String, Object> attrs = component.getAttributes();
Object modelValue= attrs.get(UIConstants.VALUE_PARAM);
if (modelValue instanceof BoundedRangeModel)
{
BoundedRangeModel model = (BoundedRangeModel) modelValue;
if (model != null)
{
long value = model.getValue();
long maximum = model.getMaximum();
if (maximum <= value)
//pu: This means the background task is complete.
{
(new ActionEvent(progressComponent)).queue();
}
}
}
}
示例4: actionListener
import javax.faces.event.ActionEvent; //导入依赖的package包/类
public void actionListener(ActionEvent event)
{
String value = _actionListener;
if (value != null)
{
FacesContext facesContext = FacesContext.getCurrentInstance();
ExpressionFactory expressionFactory =
facesContext.getApplication().getExpressionFactory();
ELContext context = facesContext.getELContext();
MethodExpression methodExpression =
expressionFactory.createMethodExpression(context, value, Void.TYPE,
new Class<?>[]
{ ActionEvent.class });
methodExpression.invoke(context, new Object[]
{ event });
}
}
示例5: actionListener
import javax.faces.event.ActionEvent; //导入依赖的package包/类
public void actionListener(ActionEvent event)
{
String value = _actionListener;
if (value != null)
{
FacesContext facesContext = FacesContext.getCurrentInstance();
ExpressionFactory expressionFactory =
facesContext.getApplication().getExpressionFactory();
ELContext context = facesContext.getELContext();
MethodExpression methodExpression =
expressionFactory.createMethodExpression(context, value, Void.TYPE,
new Class<?>[]
{ ActionEvent.class });
methodExpression.invoke(context, new Object[]{ event });
}
}
示例6: performReport
import javax.faces.event.ActionEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void performReport(ActionEvent action)
{
UIXCollection table = (UIXCollection) _table;
final RowKeySet state;
if (table instanceof UIXTable)
state = ((UIXTable) table).getSelectedRowKeys();
else
state = ((UIXTree) table).getSelectedRowKeys();
Iterator<Object> selection = state.iterator();
Object oldKey = table.getRowKey();
_selection = new ArrayList<Object>();
while (selection.hasNext())
{
table.setRowKey(selection.next());
_selection.add(table.getRowData());
}
table.setRowKey(oldKey);
FacesContext context = FacesContext.getCurrentInstance();
FacesMessage message =
new FacesMessage("Report Performed","Report was performed on "+
_selection.size()+" records");
context.addMessage(null, message);
}
示例7: modifyColumn
import javax.faces.event.ActionEvent; //导入依赖的package包/类
/**
* Modifies the sortable property of the column.
*/
@SuppressWarnings("unchecked")
public void modifyColumn(ActionEvent event)
{
//=-=pu: 'uic1' gets null, while 'uic' gets valid component, maybe a bug ?.
//UIComponent uic1 = event.getComponent().findComponent("c1");
UIComponent uic2 = event.getComponent().findComponent("t1");
UIComponent uic = uic2.findComponent("c1");
Object sortableAttrib = uic.getAttributes().get("sortable");
Boolean isSortable =
(sortableAttrib == null)? Boolean.TRUE:(Boolean)sortableAttrib;
Boolean newSortableValue =
Boolean.TRUE.equals(isSortable)? Boolean.FALSE:Boolean.TRUE;
uic.getAttributes().put("sortable", newSortableValue);
_addAttributeChange(uic, "sortable", newSortableValue);
}
示例8: 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);
}
}
示例9: 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);
}
示例10: 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);
}
示例11: reorderChildren
import javax.faces.event.ActionEvent; //导入依赖的package包/类
/**
* Reverses the order of children of the panelGroup.
*/
@SuppressWarnings("unchecked")
public void reorderChildren(ActionEvent event)
{
UIComponent uic = event.getComponent().findComponent("pg1");
int numChildren = uic.getChildCount();
if (numChildren == 0)
return;
List<UIComponent> children = uic.getChildren();
Collections.reverse(children);
List<String> reorderedChildIdList = new ArrayList<String>();
for(UIComponent child : children)
{
reorderedChildIdList.add(child.getId());
}
ComponentChange ra = new ReorderChildrenComponentChange(reorderedChildIdList);
FacesContext fc = FacesContext.getCurrentInstance();
ChangeManager apm = RequestContext.getCurrentInstance().getChangeManager();
apm.addComponentChange(fc, uic, ra);
}
示例12: 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");
}
}
示例13: getPanel
import javax.faces.event.ActionEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public CorePanelBox getPanel()
{
if (_panel == null)
{
FacesContext context = FacesContext.getCurrentInstance();
_panel = new CorePanelBox();
CoreCommandLink link = new CoreCommandLink();
link.setText("Dynamic Link");
MethodBinding actionListenerMethod = context.getApplication().
createMethodBinding("#{dynamic.doSomething}",
new Class[]{ActionEvent.class});
link.setActionListener(actionListenerMethod);
link.setId("TheLinkId");
_panel.getChildren().add(link);
}
return _panel;
}
示例14: broadcast
import javax.faces.event.ActionEvent; //导入依赖的package包/类
@Override
public void broadcast(FacesEvent event) throws AbortProcessingException
{
super.broadcast(event);
// Notify the specified action listener method (if any),
// and the default action listener
if (event instanceof ActionEvent)
{
FacesContext context = getFacesContext();
MethodBinding mb = getActionListener();
if (mb != null)
mb.invoke(context, new Object[] { event });
ActionListener defaultActionListener =
context.getApplication().getActionListener();
if (defaultActionListener != null)
{
defaultActionListener.processAction((ActionEvent) event);
}
}
}
示例15: queueEvent
import javax.faces.event.ActionEvent; //导入依赖的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);
}