Package org.richfaces.model.selection

Examples of org.richfaces.model.selection.ClientSelection


        if (value != null) {

            Converter converter = application
                    .createConverter(ClientSelection.class);

            ClientSelection _oldClientSelection = (ClientSelection) table
                    .getAttributes().get(CLIENT_SELECTION);

            final ClientSelection oldClientSelection = _oldClientSelection == null ? new ClientSelection()
                    : _oldClientSelection;

            final ClientSelection clientSelection = (ClientSelection) converter
                    .getAsObject(context, table, value);

            // final ScrollableDataTableRendererState state =
            // ScrollableDataTableRendererState.createState(context, grid);
            // state.setRowIndex(ScrollableDataTableUtils.getClientRowIndex(grid));
            Object savedKey = table.getRowKey();

            final TableHolder holder = new TableHolder(table);

            final SimpleSelection simpleSelection = table.getSelection() == null ? new SimpleSelection()
                    : (SimpleSelection) table.getSelection();

            if (clientSelection.isReset() || clientSelection.isSelectAll()) {
                simpleSelection.clear();
            }

            try {
                table.walk(context, new DataVisitor() {
                    public void process(FacesContext context, Object rowKey,
                            Object argument) throws IOException {

                        // TableHolder holder = (TableHolder) argument;
                        // int i = state.getRowIndex();
                        int i = holder.getRowCounter();

                        if (shouldAddToSelection(i, oldClientSelection,
                                clientSelection)) {

                            simpleSelection.addKey(rowKey);

                        } else if (shouldRemoveFromSelection(i,
                                oldClientSelection, clientSelection)) {

                            simpleSelection.removeKey(rowKey);

                        }

                        if (i == clientSelection.getActiveRowIndex()) {
                            table.setActiveRowKey(rowKey);
                        }
                        holder.nextRow();

                    }
View Full Code Here


        final TableHolder holder = new TableHolder(table);

        final Selection gridSelection = table.getSelection() == null ? new SimpleSelection()
                : table.getSelection();
        final ClientSelection clientSelection = new ClientSelection();

        table.walk(context, new DataVisitor() {
            public void process(FacesContext context, Object rowKey,
                    Object argument) throws IOException {

                // TableHolder holder = (TableHolder) argument;

                if (gridSelection.isSelected(rowKey)) {

                    int i = holder.getRowCounter();

                    clientSelection.addIndex(i);
                }

                if (rowKey.equals(table.getActiveRowKey())) {
                    clientSelection.setActiveRowIndex(holder.getRowCounter());
                }

                holder.nextRow();

            }
View Full Code Here

        Application application = context.getApplication();

        Converter converter = application
                .createConverter(ClientSelection.class);

        ClientSelection selection = (ClientSelection) table.getAttributes()
                .get(CLIENT_SELECTION);
        String string = converter.getAsString(context, table, selection);

        if (string == null) {
            string = "";
        }

        string += selection.getActiveRowIndex();

        String id = getSelectionInputName(context, table);

        ResponseWriter writer = context.getResponseWriter();
        writer.startElement(HTML.INPUT_ELEM, table);
View Full Code Here

      Application application = context.getApplication();
      String id = getSelectionInputName(context, grid);
      String value = (String) requestParamMap.get(id);
      Converter converter = application
          .createConverter(ClientSelection.class);
      ClientSelection _oldClientSelection = (ClientSelection) grid
          .getAttributes().get(CLIENT_SELECTION);
      final ClientSelection oldClientSelection = _oldClientSelection == null ? new ClientSelection()
          : _oldClientSelection;
      final ClientSelection clientSelection = (ClientSelection) converter
          .getAsObject(context, grid, value);
      final ScrollableDataTableRendererState state = ScrollableDataTableRendererState
          .createState(context, grid);
      state.setRowIndex(ScrollableDataTableUtils.getClientRowIndex(grid));
      final SimpleSelection simpleSelection = grid.getSelection() == null ? new SimpleSelection()
          : (SimpleSelection) grid.getSelection();
      if (clientSelection.isReset() || clientSelection.isSelectAll()) {
        simpleSelection.clear();
        simpleSelection.setSelectAll(clientSelection.isSelectAll());
      }
      try {
        grid.walk(context, new DataVisitor() {
          public void process(FacesContext context, Object rowKey,
              Object argument) throws IOException {

            int i = state.getRowIndex();

            if (shouldAddToSelection(i, oldClientSelection,
                clientSelection)) {

              simpleSelection.addKey(rowKey);

            } else if (shouldRemoveFromSelection(i,
                oldClientSelection, clientSelection)) {

              simpleSelection.removeKey(rowKey);

            }

            if (i == clientSelection.getActiveRowIndex()) {
              grid.setActiveRowKey(rowKey);
            }
            state.nextRow();

          }
View Full Code Here

   
    final Selection gridSelection =
      grid.getSelection() == null ?
          new SimpleSelection() :
            grid.getSelection();
    final ClientSelection clientSelection = new ClientSelection();
   
    grid.walk(context,
      new DataVisitor() {
        public void process(FacesContext context, Object rowKey,
            Object argument) throws IOException {
       
          if (gridSelection.isSelected(rowKey)) {

            int i = state.getRowIndex();
           
            clientSelection.addIndex(i);
          }
         
          if (rowKey.equals(grid.getActiveRowKey())) {
            clientSelection.setActiveRowIndex(state.getRowIndex());
          }
         
          state.nextRow();
         
        }
View Full Code Here

    Application application = context.getApplication();
   
    Converter converter =
      application.createConverter(ClientSelection.class);
   
    ClientSelection selection = (ClientSelection)grid.getAttributes().get(CLIENT_SELECTION);
    String string =
      converter.getAsString(context, grid, selection);
   
    if (string == null) {
      string = "";
    }
   
    string += selection.getActiveRowIndex();
   
    String id = getSelectionInputName(context, grid);
   
   
    ResponseWriter writer = context.getResponseWriter();
View Full Code Here

   
    if (log.isDebugEnabled()) {
      log.debug("parsing " + stringSelection);
    }
   
    final ClientSelection clientSelection = new ClientSelection();
    if(stringSelection == null || stringSelection.length() == 0) {
      return clientSelection;
    }
   
    String [] selections = stringSelection.split(";");
    int length = selections.length;
    if (selections[length-1].charAt(0) > '9') {
      clientSelection.setSelectionFlag(selections[length-1]);
      length--;
    }
    clientSelection.setActiveRowIndex(Integer.parseInt(selections[length-1]));
    length--;
    for (int i = 0; i < length; i++) {
     
      String range = selections[i];
     
      if (range.length() != 0) {
        String [] rng = range.split(",");
       
        try {
          int fi = Integer.parseInt(rng[0]);
          int il = Integer.parseInt(rng[1]);
         
          if (log.isDebugEnabled()) {
            log.debug("Parsed range " + fi + " " + il);
          }
         
          clientSelection.addRange(new SelectionRange(fi, il));
         
        } catch (NumberFormatException e) {
          throw new ConverterException(e);
        }
      }
View Full Code Here

   
    String value = (String) requestParamMap.get(id);
   
    Converter converter = application.createConverter(ClientSelection.class);
   
    ClientSelection _oldClientSelection =
      (ClientSelection) grid.getAttributes().get(CLIENT_SELECTION);
   
    final ClientSelection oldClientSelection =
      _oldClientSelection == null ?
          new ClientSelection() :
            _oldClientSelection;
   
    final ClientSelection clientSelection =
      (ClientSelection) converter.getAsObject(context, grid, value);

   
   
   
    final ScrollableDataTableRendererState state =
      ScrollableDataTableRendererState.createState(context, grid);
   
    state.setRowIndex(ScrollableDataTableUtils.getClientRowIndex(grid));
   
    final SimpleSelection simpleSelection = grid.getSelection() == null ? new SimpleSelection()
        : (SimpleSelection) grid.getSelection();

   
   
    if (clientSelection.isReset() || clientSelection.isSelectAll()) {
      simpleSelection.clear();
      simpleSelection.setSelectAll(clientSelection.isSelectAll());
    }
   
    try {
      grid.walk(context,
          new DataVisitor() {
            public void process(FacesContext context, Object rowKey,
                Object argument) throws IOException {
           
              int i = state.getRowIndex();
             
              if (shouldAddToSelection(i, oldClientSelection, clientSelection)) {
               
                simpleSelection.addKey(rowKey);
             
              } else if (shouldRemoveFromSelection(i, oldClientSelection, clientSelection)){
               
                simpleSelection.removeKey(rowKey);
             
              }
             
              if(i == clientSelection.getActiveRowIndex()) {
                grid.setActiveRowKey(rowKey);
              }
              state.nextRow();
             
            }
View Full Code Here

   
    final Selection gridSelection =
      grid.getSelection() == null ?
          new SimpleSelection() :
            grid.getSelection();
    final ClientSelection clientSelection = new ClientSelection();
   
    grid.walk(context,
      new DataVisitor() {
        public void process(FacesContext context, Object rowKey,
            Object argument) throws IOException {
       
          if (gridSelection.isSelected(rowKey)) {

            int i = state.getRowIndex();
           
            clientSelection.addIndex(i);
          }
         
          if (rowKey.equals(grid.getActiveRowKey())) {
            clientSelection.setActiveRowIndex(state.getRowIndex());
          }
         
          state.nextRow();
         
        }
View Full Code Here

    Application application = context.getApplication();
   
    Converter converter =
      application.createConverter(ClientSelection.class);
   
    ClientSelection selection = (ClientSelection)grid.getAttributes().get(CLIENT_SELECTION);
    String string =
      converter.getAsString(context, grid, selection);
   
    if (string == null) {
      string = "";
    }
   
    string += selection.getActiveRowIndex();
   
    String id = getSelectionInputName(context, grid);
   
   
    ResponseWriter writer = context.getResponseWriter();
View Full Code Here

TOP

Related Classes of org.richfaces.model.selection.ClientSelection

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.