Package org.apache.myfaces.trinidad.component

Examples of org.apache.myfaces.trinidad.component.UIXCollection


  //
  @SuppressWarnings("unchecked")
  @Override
  public void decode(FacesContext context, UIComponent component)
  {
    UIXCollection table = (UIXCollection) component;
    Object oldKey = table.getRowKey();

    try
    {
      // Set the row key to null to force the clientId to be correct
      table.setRowKey(null);

      String selectionParam = __getSelectionParameterName(context, table);

      Map<String, String> parameters = 
        context.getExternalContext().getRequestParameterMap();
     
      _LOG.finest("Params:{0}", parameters);

      String selection = parameters.get(selectionParam);

      if (selection != null)
      {
        final RowKeySet state;
        if (table instanceof UIXTable)
          state = ((UIXTable) table).getSelectedRowKeys();
        else
          state = ((UIXTree) table).getSelectedRowKeys();

        table.setClientRowKey(selection);
        if (!state.isContained())
        {
          RowKeySet unselected = state.clone();
          // TODO : do not mutate the selectedRowKeys here.
          // instead, mutate when event is broadcast:
          state.clear();
          state.add();
          // clone, so that subsequent mutations of "state" will
          // not affect the parameters of this event: bug 4733858:
          RowKeySet selected = state.clone();
          FacesEvent event = new SelectionEvent(table, unselected, selected);
          event.queue();
        }
      }
    }
    finally
    {
      table.setRowKey(oldKey);
    }
  }
View Full Code Here


  }


  private boolean _assertCurrencyKeyPreserved(Object oldKey, UIComponent table)
  {
    UIXCollection base = (UIXCollection) table;
    Object newKey = base.getRowKey();
    return (oldKey != null)?  oldKey.equals(newKey): (newKey == null);
  }
View Full Code Here

    if (!getSortable(bean))
      return SORT_NO;

    // Otherwise, look at the first sort criteria
    // =-=AEW This seems slow...
    UIXCollection table = (UIXCollection) tContext.getTable();
    List<SortCriterion> criteria = table.getSortCriteria();
    // We currently only show anything for the primary sort criterion
    if (criteria.size() > 0)
    {
      SortCriterion criterion = criteria.get(0);
      if (property.equals(criterion.getProperty()))
      {
        return criterion.isAscending() ? SORT_ASCENDING : SORT_DESCENDING;
      }
    }

    return table.isSortable(property) ? SORT_SORTABLE : SORT_NO;
  }
View Full Code Here

  }

  @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);
View Full Code Here

TOP

Related Classes of org.apache.myfaces.trinidad.component.UIXCollection

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.