Class GroupEditorTableModel

  • All Implemented Interfaces:
    java.io.Serializable, javax.swing.table.TableModel

    public class GroupEditorTableModel
    extends javax.swing.table.AbstractTableModel
    Represents the list off all possible alliance states
    Version:
    1.0, 25.09.2008
    Author:
    Thoralf Rickert
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.List<Group> columns  
      protected boolean hasAllied  
      protected java.util.Map<Group,​java.util.Map<Faction,​magellan.plugin.groupeditor.AllianceState>> newGroupStates  
      protected java.util.Map<Faction,​magellan.plugin.groupeditor.AllianceState> newStates  
      protected int offset  
      protected Faction owner  
      protected java.util.List<Faction> rows  
      protected static java.lang.String signature  
      • Fields inherited from class javax.swing.table.AbstractTableModel

        listenerList
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addColumn​(Group group)
      Adds a new column
      void addRow​(Faction faction)
      Adds a new row
      magellan.plugin.groupeditor.AllianceState getAlliedState​(Faction faction, java.util.Collection<Alliance> allied)
      Returns the string representation of the allied state of a given faction towards the given group.
      java.lang.Class<?> getColumnClass​(int c)  
      int getColumnCount()  
      java.lang.String getColumnName​(int pos)  
      protected java.lang.String getOrderTranslation​(StringID orderId)  
      Faction getOwner()
      Returns the value of faction.
      Unit getRepresentative​(int column)  
      int getRowCount()  
      java.lang.Object getValueAt​(int rowIndex, int columnIndex)  
      boolean isCellEditable​(int row, int col)  
      void save()
      Saves the settings from the world.
      protected void save​(java.lang.String helpcommand, Unit unit, java.util.Map<Faction,​magellan.plugin.groupeditor.AllianceState> states)
      Adds multiple commands per faction to the given unit.
      void setOwner​(Faction owner)
      Sets the value of faction.
      void setValueAt​(java.lang.Object value, int rowIndex, int columnIndex)  
      • Methods inherited from class javax.swing.table.AbstractTableModel

        addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • columns

        protected java.util.List<Group> columns
      • rows

        protected java.util.List<Faction> rows
      • hasAllied

        protected boolean hasAllied
      • offset

        protected int offset
      • newStates

        protected java.util.Map<Faction,​magellan.plugin.groupeditor.AllianceState> newStates
      • newGroupStates

        protected java.util.Map<Group,​java.util.Map<Faction,​magellan.plugin.groupeditor.AllianceState>> newGroupStates
    • Constructor Detail

      • GroupEditorTableModel

        public GroupEditorTableModel()
    • Method Detail

      • getOwner

        public Faction getOwner()
        Returns the value of faction.
        Returns:
        Returns faction.
      • setOwner

        public void setOwner​(Faction owner)
        Sets the value of faction.
        Parameters:
        owner - The value for faction.
      • addColumn

        public void addColumn​(Group group)
        Adds a new column
      • addRow

        public void addRow​(Faction faction)
        Adds a new row
      • getColumnCount

        public int getColumnCount()
        See Also:
        TableModel.getColumnCount()
      • getColumnName

        public java.lang.String getColumnName​(int pos)
        Specified by:
        getColumnName in interface javax.swing.table.TableModel
        Overrides:
        getColumnName in class javax.swing.table.AbstractTableModel
        See Also:
        AbstractTableModel.getColumnName(int)
      • getRowCount

        public int getRowCount()
        See Also:
        TableModel.getRowCount()
      • getValueAt

        public java.lang.Object getValueAt​(int rowIndex,
                                           int columnIndex)
        See Also:
        TableModel.getValueAt(int, int)
      • setValueAt

        public void setValueAt​(java.lang.Object value,
                               int rowIndex,
                               int columnIndex)
        Specified by:
        setValueAt in interface javax.swing.table.TableModel
        Overrides:
        setValueAt in class javax.swing.table.AbstractTableModel
        See Also:
        AbstractTableModel.setValueAt(java.lang.Object, int, int)
      • save

        public void save()
        Saves the settings from the world.
      • getOrderTranslation

        protected java.lang.String getOrderTranslation​(StringID orderId)
      • save

        protected void save​(java.lang.String helpcommand,
                            Unit unit,
                            java.util.Map<Faction,​magellan.plugin.groupeditor.AllianceState> states)
        Adds multiple commands per faction to the given unit.
      • getColumnClass

        public java.lang.Class<?> getColumnClass​(int c)
        Specified by:
        getColumnClass in interface javax.swing.table.TableModel
        Overrides:
        getColumnClass in class javax.swing.table.AbstractTableModel
        See Also:
        AbstractTableModel.getColumnClass(int)
      • isCellEditable

        public boolean isCellEditable​(int row,
                                      int col)
        Specified by:
        isCellEditable in interface javax.swing.table.TableModel
        Overrides:
        isCellEditable in class javax.swing.table.AbstractTableModel
        See Also:
        AbstractTableModel.isCellEditable(int, int)
      • getAlliedState

        public magellan.plugin.groupeditor.AllianceState getAlliedState​(Faction faction,
                                                                        java.util.Collection<Alliance> allied)
        Returns the string representation of the allied state of a given faction towards the given group.
      • getRepresentative

        public Unit getRepresentative​(int column)