Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
// WARNING: This file was automatically generated. Do not edit it directly,
// or you will lose your changes.
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.myfaces.trinidad.component;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.el.MethodExpression;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
import javax.faces.event.PhaseId;
import org.apache.myfaces.trinidad.bean.FacesBean;
import org.apache.myfaces.trinidad.bean.PropertyKey;
import org.apache.myfaces.trinidad.event.RangeChangeEvent;
import org.apache.myfaces.trinidad.event.RangeChangeListener;
import org.apache.myfaces.trinidad.event.RowDisclosureEvent;
import org.apache.myfaces.trinidad.event.RowDisclosureListener;
import org.apache.myfaces.trinidad.event.SelectionEvent;
import org.apache.myfaces.trinidad.event.SelectionListener;
import org.apache.myfaces.trinidad.event.SortEvent;
import org.apache.myfaces.trinidad.event.SortListener;
import org.apache.myfaces.trinidad.model.CollectionModel;
import org.apache.myfaces.trinidad.model.RowKeySet;
import org.apache.myfaces.trinidad.model.RowKeySetImpl;
import org.apache.myfaces.trinidad.model.SortCriterion;
import org.apache.myfaces.trinidad.util.ComponentUtils;
/**
*
*
The expansion event is generated for a table when the detail facet of a row is expanded or collapsed. For tree or a treeTable, the expansion
event is generated when tree nodes are expanded or collapsed.
*
*
*
org.apache.myfaces.trinidad.event.SelectionEvent
*
Apply Request Values Invoke Application
*
The selection event is delivered when the table selection
changes.
Event delivered to describe an attribute change. Attribute change events are not delivered for any programmatic change to a property. They are only delivered when a renderer changes a property without the application's specific request. An example of an attribute change event might include the width of a column that supported client-side resizing.
*
*
*/
public class UIXTable extends UIXIterator
implements CollectionComponent
{
static public final FacesBean.Type TYPE = new FacesBean.Type(
UIXIterator.TYPE);
static public final PropertyKey ROW_DISCLOSURE_LISTENER_KEY =
TYPE.registerKey("rowDisclosureListener", MethodExpression.class);
static public final PropertyKey DISCLOSED_ROW_KEYS_KEY =
TYPE.registerKey("disclosedRowKeys", RowKeySet.class, null, 0, PropertyKey.Mutable.OFTEN);
static public final PropertyKey SELECTION_LISTENER_KEY =
TYPE.registerKey("selectionListener", MethodExpression.class);
static public final PropertyKey SELECTED_ROW_KEYS_KEY =
TYPE.registerKey("selectedRowKeys", RowKeySet.class, null, 0, PropertyKey.Mutable.OFTEN);
static public final PropertyKey IMMEDIATE_KEY =
TYPE.registerKey("immediate", Boolean.class, Boolean.FALSE);
static public final PropertyKey SORT_LISTENER_KEY =
TYPE.registerKey("sortListener", MethodExpression.class);
static public final PropertyKey RANGE_CHANGE_LISTENER_KEY =
TYPE.registerKey("rangeChangeListener", MethodExpression.class);
static public final PropertyKey SHOW_ALL_KEY =
TYPE.registerKey("showAll", Boolean.class, Boolean.FALSE);
static public final String DETAIL_STAMP_FACET = "detailStamp";
static public final String COMPONENT_FAMILY =
"org.apache.myfaces.trinidad.Table";
static public final String COMPONENT_TYPE =
"org.apache.myfaces.trinidad.Table";
/**
* Construct an instance of the UIXTable.
*/
public UIXTable()
{
super("org.apache.myfaces.trinidad.Table");
}
// These are "fake" properties that allow the table to get the disclosed row keys and the
// selected row key without triggering the call to getCollectionModel from the
// RowKeyFacesBeanWrapper class. See the stamp state saving code for its usage.
static private final PropertyKey _DISCLOSED_ROW_KEYS_WITHOUT_MODEL_KEY =
TYPE.registerKey("disclosedRowKeysWithoutModel", RowKeySet.class);
static private final PropertyKey _SELECTED_ROW_KEYS_WITHOUT_MODEL_KEY =
TYPE.registerKey("selectedRowKeysWithoutModel", RowKeySet.class);
/**
* Override to update the container client id cache before decode
*/
@Override
public void decode(FacesContext context)
{
_resetContainerClientIdCache();
super.decode(context);
}
/**
* Override to update the container client id cache before validations
*/
@Override
public void processValidators(FacesContext context)
{
_resetContainerClientIdCache();
super.processValidators(context);
}
/**
* Override to update the container client id cache before updates
*/
@Override
public void processUpdates(FacesContext context)
{
_resetContainerClientIdCache();
super.processUpdates(context);
}
/**
* Override to update the container client id cache before encode
*/
@Override
void __encodeBegin(FacesContext context) throws IOException
{
_resetContainerClientIdCache();
super.__encodeBegin(context);
}
/**
* Override to return clientd ids with no currency for items in header/footer facets
*/
@Override
public String getContainerClientId(FacesContext context, UIComponent child)
{
String id;
if (_containerClientIdCache == null || _isStampedChild(child))
{
// call the UIXCollection getContainerClientId, which attaches currency string to the client id
id = getContainerClientId(context);
}
else
{
// The target is not a stamped child, so return a client id with no currency string
id = getClientId(context);
}
return id;
}
@Override
public void setSortCriteria(List criteria)
{
_sortCriteria = criteria;
super.setSortCriteria(criteria);
}
/**
* Sets the phaseID of UI events depending on the "immediate" property.
*/
@Override
public void queueEvent(FacesEvent event)
{
TableUtils.__handleQueueEvent(this, event);
super.queueEvent(event);
}
/**
* Delivers an event to the appropriate listeners.
* @param event
* @throws javax.faces.event.AbortProcessingException
*/
@Override
public void broadcast(FacesEvent event)
throws AbortProcessingException
{
// the order of processing is
// 1. do any default action handling
// 2. invoke any actionListener method binding
// 3. call all the registered ActionListener instances.
// Deliver to the default RangeChangeListener
if (event instanceof RangeChangeEvent)
{
RangeChangeEvent rEvent = (RangeChangeEvent) event;
int first = rEvent.getNewStart();
setFirst(first);
//pu: Implicitly record a Change for 'first' attribute
addAttributeChange("first", Integer.valueOf(first));
if ((first == 0) && (rEvent.getNewEnd() == getRowCount()))
{
setShowAll(true);
//pu: Implicitly record a Change for 'showAll' attribute
addAttributeChange("showAll", Boolean.TRUE);
}
else if (isShowAll())
{
setShowAll(false);
//pu: Implicitly record a Change for 'showAll' attribute
addAttributeChange("showAll", Boolean.FALSE);
}
// since the range is now different we can clear the currency cache:
clearCurrencyStringCache();
broadcastToMethodExpression(event, getRangeChangeListener());
}
else if (event instanceof RowDisclosureEvent)
{
RowDisclosureEvent eEvent = (RowDisclosureEvent) event;
RowKeySet set = getDisclosedRowKeys();
set.addAll(eEvent.getAddedSet());
set.removeAll(eEvent.getRemovedSet());
addAttributeChange("disclosedRowKeys", set);
broadcastToMethodExpression(event, getRowDisclosureListener());
}
else if (event instanceof SortEvent)
{
SortEvent sEvent = (SortEvent) event;
setSortCriteria(sEvent.getSortCriteria());
broadcastToMethodExpression(event, getSortListener());
}
else if (event instanceof SelectionEvent)
{
//pu: Implicitly record a Change for 'selectionState' attribute
addAttributeChange("selectedRowKeys",
getSelectedRowKeys());
broadcastToMethodExpression(event, getSelectionListener());
}
super.broadcast(event);
}
@Deprecated
public void setRangeChangeListener(MethodBinding binding)
{
setRangeChangeListener(adaptMethodBinding(binding));
}
@Deprecated
public void setSortListener(MethodBinding binding)
{
setSortListener(adaptMethodBinding(binding));
}
@Deprecated
public void setRowDisclosureListener(MethodBinding binding)
{
setRowDisclosureListener(adaptMethodBinding(binding));
}
@Deprecated
public void setSelectionListener(MethodBinding binding)
{
setSelectionListener(adaptMethodBinding(binding));
}
@Override
@SuppressWarnings("unchecked")
public Object saveState(FacesContext context)
{
Object o = super.saveState(context);
if ((o == null) &&
((_sortCriteria == null) || _sortCriteria.isEmpty()))
return null;
return new Object[]{o, _sortCriteria};
}
@Override
@SuppressWarnings("unchecked")
public void restoreState(FacesContext context, Object state)
{
Object[] array = (Object[]) state;
super.restoreState(context, array[0]);
// Get the sort criteria - but *don't* call setSortCriteria()
// here; doing so would require getting the collection model,
// and that may invoke client code that isn't quite in a state
// to be invoked, in part because component "binding"s have not been
// evaluated yet.
List criteria = (List) array[1];
_sortCriteria = criteria;
}
/**
* Gets the data for the first selected row.
* This is useful when using EL to get at column data for the selected
* row when using a table with single selection.
* @return null if there is nothing selected in the table.
*/
public Object getSelectedRowData()
{
RowKeySet state = getSelectedRowKeys();
Iterator