TableSortListener.java :  » J2EE » WiSerFramework » de » ug2t » unifiedGui » cellRenderer » implementations » table » Java Open Source

Java Open Source » J2EE » WiSerFramework 
WiSerFramework » de » ug2t » unifiedGui » cellRenderer » implementations » table » TableSortListener.java
// @@
// @@
/*
 * Wi.Ser Framework
 *
 * LGPL Version: 1.8.1, 20-September-2007  
 * Copyright (C) 2005-2006 Dirk von der Weiden <dvdw@imail.de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library located in LGPL.txt in the 
 * license directory; if not, write to the 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA  02111-1307, USA.
 * 
 * If this agreement does not cover your requirements, please contact us
 * via email to get detailed information about the commercial license 
 * or our service offerings!
 *
 */
// @@

package de.ug2t.unifiedGui.cellRenderer.implementations.table;

import java.util.*;

import de.ug2t.kernel.*;
import de.ug2t.unifiedGui.*;
import de.ug2t.unifiedGui.interfaces.*;

public class TableSortListener implements IUnGuiEventListener
{
  public void pcmf_execListener(UnComponent xParam) throws Exception
  {
    IUnTable l_table = null;
    l_table = (IUnTable)xParam.pcmf_getParentNode().pcmf_getParentNode().pcmf_getAdditionalInfo();    
    
    Collection l_header = l_table.pcmf_getHeader();
    KeTable l_content = l_table.pcmf_getComplete();
    Iterator l_it = l_header.iterator();
    int l_cnt = -1;
    while (l_it.hasNext())
    {
      l_cnt++;
      Object l_hobj = l_it.next();
      if (l_hobj instanceof IUnBox)
      {
        l_hobj = ((IUnBox)l_hobj).pcmf_getUnComponent().pcmf_getNodeAt(0).pcmf_getNodeAt(0);
      }
      if (l_hobj instanceof IUnButton)
      {
        IUnButton l_cbut = (IUnButton)l_hobj;
        
        if (l_cbut == xParam)
        {
          String l_iname = l_cbut.pcmf_getIcon().pcmf_getUnComponent().pcmf_getName();
          if (l_iname.equals("nn"))
          {
            l_content.pcmf_sortByColDir(l_cnt, false);
            l_cbut.pcmf_setIcon((IUnImage)KeRegisteredObject.pcmf_getObjByName("RgUpIcon"));
          }
          else
          {
            l_content.pcmf_sortByColDir(l_cnt, true);
            l_cbut.pcmf_setIcon((IUnImage)KeRegisteredObject.pcmf_getObjByName("RgDownIcon"));            
          }
        }
        else
        {
          l_cbut.pcmf_setIcon((IUnImage)KeRegisteredObject.pcmf_getObjByName("RgBlankIcon"));
        }
      }
    }
    l_table.pcmf_setComplete(l_content);
  }
}

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.