Protégé-OWL 3.4

edu.stanford.smi.protegex.owl.ui.conditions
Class ConditionsTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by edu.stanford.smi.protegex.owl.ui.conditions.ConditionsTableModel
All Implemented Interfaces:
ConditionsTableConstants, OWLTableModel, SymbolTableModel, Serializable, TableModel

public class ConditionsTableModel
extends AbstractTableModel
implements ConditionsTableConstants, OWLTableModel

The TableModel used by the AssertedConditionsWidget.

Author:
Holger Knublauch , Tania Tudorache
See Also:
Serialized Form

Field Summary
 edu.stanford.smi.protege.model.Cls previouslyEditedCls
          Needed to select the most recently edited row after closing the expression editor
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Fields inherited from interface edu.stanford.smi.protegex.owl.ui.conditions.ConditionsTableConstants
COL_COUNT, COL_EXPRESSION, TYPE_DEFINITION_BASE, TYPE_INHERITED, TYPE_SUPERCLASS
 
Constructor Summary
ConditionsTableModel(OWLModel owlModel)
          Constructs a new ConditionsTableModel with default superslot.
ConditionsTableModel(OWLNamedClass hostCls, edu.stanford.smi.protege.model.Slot superclassesSlot)
          Constructs a new ConditionsTableModel for a given Cls.
ConditionsTableModel(edu.stanford.smi.protege.model.Slot superclassesSlot)
          Constructs a new ConditionsTableModel with customized superslot.
 
Method Summary
 int addEmptyDefinitionBlock()
           
 int addEmptyRow(int selectedRow)
           
 boolean addRow(RDFSClass aClass, int selectedRow)
          Adds a given Cls to the class conditions specified by a given row.
 boolean addRowAllowMove(RDFSClass aClass, int selectedRow)
           
 void deleteRow(int index)
           
 void deleteRow(int index, boolean forceDelete)
           
 void displaySemanticError(String message)
          Displays an illegal assignment error dialog, e.g.
 void dispose()
           
 void dumpItems()
           
 int getBlockSize(int blockStartRow)
           
 String getBlockText(int type)
          Gets a string of the form [& ] from all rows of a given block.
 RDFSClass getClass(int row)
          Gets the RDFSClass displayed at a given row.
 int getClassRow(RDFSClass cls)
           
 Class getColumnClass(int columnIndex)
           
 int getColumnCount()
           
 OWLIntersectionClass getDefinition(int rowIndex)
          If a given row displays an operand from an equivalent class intersection, then this method returns the OWLIntersectionClass hosting it.
 OWLNamedClass getEditedCls()
           
 Icon getIcon(int rowIndex, int rowHeight)
           
 Icon getIcon(RDFResource resource)
           
 OWLNamedClass getOriginClass(int rowIndex)
          Gets the class where the entry from a given row has been inherited from.
 RDFProperty getPredicate(int row)
           
 RDFResource getRDFResource(int row)
           
 int getRowCount()
           
 RDFResource getSubject()
           
 int getSymbolColumnIndex()
           
 int getType(int rowIndex)
          Gets the type of the entry at a certain row.
 Object getValueAt(int rowIndex, int columnIndex)
           
 boolean isAddEnabledAt(int rowIndex)
          Checks whether the "add named class" function is enabled for a given row.
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 boolean isCreateEnabledAt(int row)
          Checks whether an anonymous class could be added/created at a given row.
 boolean isDefinition(int rowIndex)
           
 boolean isDeleteEnabledFor(RDFSClass cls)
           
 boolean isEditable()
           
 boolean isRemoveEnabledFor(int rowIndex)
           
 boolean isSeparator(int rowIndex)
           
 void refresh()
           
 void removeEmptyRow()
           
 void setCls(OWLNamedClass cls)
           
 void setValueAt(int rowIndex, OWLModel owlModel, String parsableText)
           
 void setValueAt(Object value, int rowIndex, int columnIndex)
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnName, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, getColumnName, removeTableModelListener
 

Field Detail

previouslyEditedCls

public edu.stanford.smi.protege.model.Cls previouslyEditedCls
Needed to select the most recently edited row after closing the expression editor

Constructor Detail

ConditionsTableModel

public ConditionsTableModel(OWLModel owlModel)
Constructs a new ConditionsTableModel with default superslot.

Parameters:
owlModel - the OWLModel

ConditionsTableModel

public ConditionsTableModel(edu.stanford.smi.protege.model.Slot superclassesSlot)
Constructs a new ConditionsTableModel with customized superslot.

Parameters:
superclassesSlot - the Slot (either inferred or asserted superclasses)

ConditionsTableModel

public ConditionsTableModel(OWLNamedClass hostCls,
                            edu.stanford.smi.protege.model.Slot superclassesSlot)
Constructs a new ConditionsTableModel for a given Cls.

Parameters:
hostCls - the initially displayed class
superclassesSlot - the Slot (either inferred or asserted superclasses)
Method Detail

addEmptyDefinitionBlock

public int addEmptyDefinitionBlock()

addEmptyRow

public int addEmptyRow(int selectedRow)
Specified by:
addEmptyRow in interface OWLTableModel

addRow

public boolean addRow(RDFSClass aClass,
                      int selectedRow)
Adds a given Cls to the class conditions specified by a given row.

Specified by:
addRow in interface OWLTableModel
Parameters:
aClass - the aClassass to add
selectedRow - the row to add to
Returns:
true if the row has been added

addRowAllowMove

public boolean addRowAllowMove(RDFSClass aClass,
                               int selectedRow)

deleteRow

public void deleteRow(int index)
Specified by:
deleteRow in interface OWLTableModel

deleteRow

public void deleteRow(int index,
                      boolean forceDelete)

displaySemanticError

public void displaySemanticError(String message)
Description copied from interface: OWLTableModel
Displays an illegal assignment error dialog, e.g. through a JOptionPane. This can be used if someone tries to assign an illegal superclass to the model.

Specified by:
displaySemanticError in interface OWLTableModel
Parameters:
message - the message text

dispose

public void dispose()
Specified by:
dispose in interface OWLTableModel

dumpItems

public void dumpItems()

getBlockSize

public int getBlockSize(int blockStartRow)

getBlockText

public String getBlockText(int type)
Gets a string of the form [& ] from all rows of a given block.

Parameters:
type - the type
Returns:
the string

getClassRow

public int getClassRow(RDFSClass cls)
Specified by:
getClassRow in interface OWLTableModel

getClass

public RDFSClass getClass(int row)
Gets the RDFSClass displayed at a given row.

Specified by:
getClass in interface OWLTableModel
Parameters:
row - the row to get the Class from
Returns:
the RDFSClass there

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface TableModel

getColumnClass

public Class getColumnClass(int columnIndex)
Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel

getDefinition

public OWLIntersectionClass getDefinition(int rowIndex)
If a given row displays an operand from an equivalent class intersection, then this method returns the OWLIntersectionClass hosting it.

Parameters:
rowIndex - the index of the row to get the OWLIntersectionClass from
Returns:
an OWLIntersectionClass or null

getEditedCls

public OWLNamedClass getEditedCls()
Specified by:
getEditedCls in interface OWLTableModel

getIcon

public Icon getIcon(RDFResource resource)
Specified by:
getIcon in interface SymbolTableModel

getIcon

public Icon getIcon(int rowIndex,
                    int rowHeight)

getOriginClass

public OWLNamedClass getOriginClass(int rowIndex)
Gets the class where the entry from a given row has been inherited from. This only makes sense for rows which have the type TYPE_INHERITED.

Parameters:
rowIndex - the index of the row to query
Returns:
the origin class

getPredicate

public RDFProperty getPredicate(int row)
Specified by:
getPredicate in interface SymbolTableModel

getRDFResource

public RDFResource getRDFResource(int row)
Specified by:
getRDFResource in interface SymbolTableModel

getSubject

public RDFResource getSubject()
Specified by:
getSubject in interface SymbolTableModel

getSymbolColumnIndex

public int getSymbolColumnIndex()
Specified by:
getSymbolColumnIndex in interface SymbolTableModel

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface TableModel

getType

public int getType(int rowIndex)
Gets the type of the entry at a certain row.

Parameters:
rowIndex - the index of the row to get the type of
Returns:
one of ConditionsTableColumns.TYPE_xxx

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)
Specified by:
getValueAt in interface TableModel

isAddEnabledAt

public boolean isAddEnabledAt(int rowIndex)
Checks whether the "add named class" function is enabled for a given row.

Specified by:
isAddEnabledAt in interface OWLTableModel
Parameters:
rowIndex - the index of the row where a named class shall be added
Returns:
true if a named class could be added

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel

isCreateEnabledAt

public boolean isCreateEnabledAt(int row)
Checks whether an anonymous class could be added/created at a given row.

Parameters:
row - the index of the row to add a new anonymous class
Returns:
true if yes

isDeleteEnabledFor

public boolean isDeleteEnabledFor(RDFSClass cls)
Specified by:
isDeleteEnabledFor in interface OWLTableModel

isDefinition

public boolean isDefinition(int rowIndex)

isEditable

public boolean isEditable()
Specified by:
isEditable in interface OWLTableModel

isRemoveEnabledFor

public boolean isRemoveEnabledFor(int rowIndex)

isSeparator

public boolean isSeparator(int rowIndex)

refresh

public void refresh()

removeEmptyRow

public void removeEmptyRow()
Specified by:
removeEmptyRow in interface OWLTableModel

setCls

public void setCls(OWLNamedClass cls)
Specified by:
setCls in interface OWLTableModel

setValueAt

public void setValueAt(Object value,
                       int rowIndex,
                       int columnIndex)
Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel

setValueAt

public void setValueAt(int rowIndex,
                       OWLModel owlModel,
                       String parsableText)
                throws Exception
Throws:
Exception

Protégé-OWL 3.4

Submit a bug report or feature request
Copyright (c) 1998-2009 Stanford University.