Package org.ajax4jsf.model

Examples of org.ajax4jsf.model.ExtendedDataModel


   *
   * @see javax.faces.component.UIData#setRowIndex(int)
   */
  public void setRowIndex(int index) {
    FacesContext faces = FacesContext.getCurrentInstance();
    ExtendedDataModel localModel = getExtendedDataModel();
   
    boolean rowAvailable = isRowAvailable();
   
   
//    if (rowAvailable) {
      // save child state
      this.saveChildState(faces);
//    }

    // Set current model row by int, but immediately get value from model.
    // for compability, complex models must provide values map between
    // integer and key value.
    localModel.setRowIndex(index);
   
    rowAvailable = isRowAvailable();
    this._rowKey = localModel.getRowKey();
    this._clientId = null;
   
    boolean rowSelected = this._rowKey != null && rowAvailable;

    setupVariable(faces, localModel, rowSelected);
View Full Code Here


   *            current FacesContext
   * @param key
   *            new key value.
   */
  public void setRowKey(FacesContext faces, Object key) {
    ExtendedDataModel localModel = getExtendedDataModel();
   
    boolean rowAvailable = isRowAvailable();
   
//    if (rowAvailable) {
      // save child state
      this.saveChildState(faces);
//    }

    this._rowKey = key;
    this._clientId = null;
   
    localModel.setRowKey(key);

    rowAvailable = isRowAvailable();
    boolean rowSelected = key != null && rowAvailable;

    //XXX check for row availability
View Full Code Here

   * @return current data model.
   */
  protected ExtendedDataModel getExtendedDataModel() {
    if (this._currentModel == null) {
      String baseClientId = getBaseClientId(getFacesContext());
      ExtendedDataModel model;
      model = (ExtendedDataModel) this._modelsMap.get(baseClientId);
      if (null == model) {
        model = createDataModel();
        this._modelsMap.put(baseClientId, model);
      }
View Full Code Here

  protected void processUpdates(FacesContext faces, Object argument) {
    if (!this.isRendered())
      return;
    this.iterate(faces, updateVisitor, argument);
    ExtendedDataModel dataModel = getExtendedDataModel();
    // If no validation errors, update values for serializable model,
    // restored from view.
    if (dataModel instanceof SerializableDataModel && (!keepSaved(faces))) {
      SerializableDataModel serializableModel = (SerializableDataModel) dataModel;
      serializableModel.update();
View Full Code Here

          } else if (dataComponentState instanceof StateHolder) {
            idState.componentState = ((StateHolder) dataComponentState)
                .saveState(faces);
            idState.stateInHolder = true;
          }
          ExtendedDataModel extendedDataModel = (ExtendedDataModel) this._modelsMap
              .get(stateKey);
          if (null != extendedDataModel) {
            idState.model = extendedDataModel
                .getSerializableModel(dataComponentState
                    .getRange());

          }
        }
View Full Code Here

          }
        }
      }
    }
    sortFields.addAll(sortFieldsMap.values());
    ExtendedDataModel dataModel = super.createDataModel();
    if ((filterFields != null && !filterFields.isEmpty())
        || (sortFields != null && !sortFields.isEmpty())) {
      Modifiable modifiable = null;
      if (dataModel instanceof Modifiable) {
        modifiable = (Modifiable) dataModel;
View Full Code Here

    checkRange();
    super.encodeBegin(context);
  }
 
  protected ExtendedDataModel createDataModel() {
    ExtendedDataModel model = super.createDataModel();
    if (model instanceof ScrollableTableDataModel) {
      if (isCacheable()) {
        if (log.isDebugEnabled()) {
          log.debug("Initializing cache of type "
              + DataModelCache.class);
View Full Code Here

        }
      }
    } else {
      UIComponent component = null;
     
      ExtendedDataModel dataModel = getExtendedDataModel();
      if (dataModel instanceof TreeModelVisualComponentProvider) {
        TreeModelVisualComponentProvider componentProvider = (TreeModelVisualComponentProvider) dataModel;
        component = componentProvider.getComponent();
      }
View Full Code Here

//  private StackingTreeModel stackingTreeModel;
  private LinkedList<StackEntry> stackEntries = new LinkedList<StackEntry>();

  public ExtendedDataModel getDataModel() {
    Object data = dataProvider.getData();
    ExtendedDataModel dataModel;
    if (data instanceof Map || data instanceof NamedNodeMap) {
      dataModel = new MapDataModel();
    } else {
      dataModel = new SequenceDataModel();
    }

    dataModel.setWrappedData(data);
    return dataModel;
  }
View Full Code Here

    return null;
  }

  public boolean setupModel(Object key, FacesContext facesContext) {
    ExtendedDataModel dataModel = getDataModel();
    dataModel.setRowKey(key);

    if (dataModel.isRowAvailable()) {
      Object rowData = dataModel.getRowData();
      //System.out.println("StackingTreeModel.setupModel() " + rowData);
      Object varObject = setupVariable(rowData, facesContext);

      getRoot().stackEntries.add(new StackEntry(varObject, key, rowData, this));
View Full Code Here

TOP

Related Classes of org.ajax4jsf.model.ExtendedDataModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.