Griffon
  1. Griffon
  2. GRIFFON-44

Enhance Swing classes and models with additional methods

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.2
    • Fix Version/s: 0.1.2, 0.2
    • Component/s: rt
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Some swing models do not follow a naming standard for common operations like get(int), set(int,element), clear() nor they provide an iterator() method (for those that make sense). This is a request to enhance Swing classes and models with additional methods that bridge the gap with useful collection/groovy methods.

        Activity

        Hide
        Andres Almiray added a comment - - edited

        Current list of updates

        java.awt.Container  
        size() getComponentCount()
        getAt(int) getComponentAt(int)
        leftShift(Object) add(Object)
        iterator() getComponents().iterator()
        clear() removeAll()
        javax.swing.ButtonGroup  
        size() getButtonCount()
        getAt(int) internal impl based on getElements()
        leftShift(AbstractButton) add(AbstractButton)
        iterator() getElements().iterator()
        javax.swing.ListModel
        size() getSize()
        getAt(int) getElementAt(int)
        iterator() immutable Iterator
        javax.swing.DefaultListModel  
        putAt(int,Object) set(int,Object)
        leftShift(Object) addElement(Object)
        iterator() mutable iterator
        clear() removeAllElements()
        javax.swingJComboBox  
        getAt(int) getItemAt(int)
        leftShift(Object) addItem(Object)
        size() getItemCount()
        clear() removeAllItems()
        javax.swing.MutableComboBoxModel  
        putAt(int,Object) insertElementAt(Object,int)
        leftShift(Object) addElement(Object)
        iterator() mutable iterator
        javax.swing.table.TableModel  
        getAt(int) internal impl,returns a row (Object[])
        size() getRowCount()
        iterator() immutable row iterator
        javax.swing.table.DefaultTableModel  
        leftShift(Object) shifts an entire row (Object, array or Collection)
        putAt(int,Object) shifts an entire row (Object, array or Collection)
        iterator() mutable iterator
        javax.swing.table.TableColumnModel  
        getAt(int) getColumn(int)
        size() getColumnCount()
        leftShift(TableColumn) addColumn(TableColumn)
        iterator() mutable iterator
        javax.swing.tree.TreePath  
        size() getPathCount()
        getAt(int) getPath()[i]
        iterator() getPath().iterator()
        leftShift(Object) pathByAddingChild(Object)
        javax.swing.tree.TreeNode  
        size() getChildCount()
        getAt(int) getChildAt(int)
        iterator() getChildren().iterator()
        javax.swing.tree.MutableTreeNode  
        putAt(int,MutableTreeNode) insert(MutableTreeNode,int)
        leftShift(MutableTreeNode) insert(MutableTreeNode,i) -> where i == size()
        javax.swing.tree.DefaultMutableTreeNode  
        leftShift(MutableTreeNode) add(MutableTreeNode,i)
        clear() removeAllChildren()
        javax.swing.JMenu  
        size() getMenuComponentCount()
        getAt(int) getMenuComponentAt(int)
        leftShift(Object) add(Object)
        iterator() getMenuComponents().iterator()
        javax.swing.JMenuBar  
        size() getMenuCount()
        getAt(int) getMenu(int)
        leftShift(JMenu) add(JMenu)
        iterator() getSubElements().iterator()
        javax.swing.JPopupMenu  
        leftShift(Object) add(Object)
        iterator() getSubElements().iterator()
        javax.swing.JTabbedPane  
        size() getTabCount()
        getAt(int) getTabComponentAt(int)
        putAt(int,Component) setTabComponentAt(int,Component)
        clear() removeAll()
        javax.swing.JToolBar  
        getAt(int) getComponentAtIndex(int)
        leftShift(Action) add(Action)

        Methods annotated with behave differently from their List counterparts because they increment the model's size by one, as they are insert operations.
        TreePath.leftShift() does not mutate the original path, it returns a new TreePath.

        Show
        Andres Almiray added a comment - - edited Current list of updates java.awt.Container   size() getComponentCount() getAt(int) getComponentAt(int) leftShift(Object) add(Object) iterator() getComponents().iterator() clear() removeAll() javax.swing.ButtonGroup   size() getButtonCount() getAt(int) internal impl based on getElements() leftShift(AbstractButton) add(AbstractButton) iterator() getElements().iterator() javax.swing.ListModel size() getSize() getAt(int) getElementAt(int) iterator() immutable Iterator javax.swing.DefaultListModel   putAt(int,Object) set(int,Object) leftShift(Object) addElement(Object) iterator() mutable iterator clear() removeAllElements() javax.swingJComboBox   getAt(int) getItemAt(int) leftShift(Object) addItem(Object) size() getItemCount() clear() removeAllItems() javax.swing.MutableComboBoxModel   putAt(int,Object) insertElementAt(Object,int) leftShift(Object) addElement(Object) iterator() mutable iterator javax.swing.table.TableModel   getAt(int) internal impl,returns a row (Object[]) size() getRowCount() iterator() immutable row iterator javax.swing.table.DefaultTableModel   leftShift(Object) shifts an entire row (Object, array or Collection) putAt(int,Object) shifts an entire row (Object, array or Collection) iterator() mutable iterator javax.swing.table.TableColumnModel   getAt(int) getColumn(int) size() getColumnCount() leftShift(TableColumn) addColumn(TableColumn) iterator() mutable iterator javax.swing.tree.TreePath   size() getPathCount() getAt(int) getPath() [i] iterator() getPath().iterator() leftShift(Object) pathByAddingChild(Object) javax.swing.tree.TreeNode   size() getChildCount() getAt(int) getChildAt(int) iterator() getChildren().iterator() javax.swing.tree.MutableTreeNode   putAt(int,MutableTreeNode) insert(MutableTreeNode,int) leftShift(MutableTreeNode) insert(MutableTreeNode,i) -> where i == size() javax.swing.tree.DefaultMutableTreeNode   leftShift(MutableTreeNode) add(MutableTreeNode,i) clear() removeAllChildren() javax.swing.JMenu   size() getMenuComponentCount() getAt(int) getMenuComponentAt(int) leftShift(Object) add(Object) iterator() getMenuComponents().iterator() javax.swing.JMenuBar   size() getMenuCount() getAt(int) getMenu(int) leftShift(JMenu) add(JMenu) iterator() getSubElements().iterator() javax.swing.JPopupMenu   leftShift(Object) add(Object) iterator() getSubElements().iterator() javax.swing.JTabbedPane   size() getTabCount() getAt(int) getTabComponentAt(int) putAt(int,Component) setTabComponentAt(int,Component) clear() removeAll() javax.swing.JToolBar   getAt(int) getComponentAtIndex(int) leftShift(Action) add(Action) Methods annotated with behave differently from their List counterparts because they increment the model's size by one, as they are insert operations. TreePath.leftShift() does not mutate the original path, it returns a new TreePath.

          People

          • Assignee:
            Andres Almiray
            Reporter:
            Andres Almiray
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: