Package jmri.jmrit.logixng
Interface NamedTableManager
-
- All Superinterfaces:
Manager<NamedTable>
,PropertyChangeProvider
,SilenceablePropertyChangeProvider
,VetoableChangeProvider
- All Known Implementing Classes:
DefaultNamedTableManager
public interface NamedTableManager extends Manager<NamedTable>
A manager for a NamedTable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.Manager
Manager.ManagerDataEvent<E extends NamedBean>, Manager.ManagerDataListener<E extends NamedBean>, Manager.NameValidity
-
-
Field Summary
-
Fields inherited from interface jmri.Manager
ANALOGIOS, AUDIO, BLOCKBOSS, BLOCKS, CONDITIONALS, CTCDATA, ENTRYEXIT, IDTAGS, LAYOUTBLOCKS, LIGHTS, LOGIXNG_ANALOG_ACTIONS, LOGIXNG_ANALOG_EXPRESSIONS, LOGIXNG_CONDITIONALNGS, LOGIXNG_DIGITAL_ACTIONS, LOGIXNG_DIGITAL_BOOLEAN_ACTIONS, LOGIXNG_DIGITAL_EXPRESSIONS, LOGIXNG_GLOBAL_VARIABLES, LOGIXNG_MODULES, LOGIXNG_STRING_ACTIONS, LOGIXNG_STRING_EXPRESSIONS, LOGIXNG_TABLES, LOGIXNGS, LOGIXS, MEMORIES, METERFRAMES, METERS, OBLOCKS, PANELFILES, REPORTERS, ROUTES, SECTIONS, SENSORGROUPS, SENSORS, SIGNALGROUPS, SIGNALHEADS, SIGNALMASTLOGICS, SIGNALMASTS, STRINGIOS, TIMEBASE, TRANSITS, TURNOUTS, WARRANTS
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
deleteNamedTable(NamedTable x)
Delete NamedTable by removing it from the manager.java.lang.String
getAutoSystemName()
Create a new system name for a LogixNG.NamedTable
getBySystemName(java.lang.String name)
Locate an existing instance based on a system name.NamedTable
getByUserName(java.lang.String name)
Locate an existing instance based on a user name.NamedTable
getNamedTable(java.lang.String name)
Locate via user name, then system name if needed.default java.lang.String
getSubSystemNamePrefix()
Get the sub system prefix of this manager.NamedTable
loadTableFromCSV(java.lang.String sys, java.lang.String user, java.io.File file)
Load a table from a CSV finle.NamedTable
loadTableFromCSV(java.lang.String sys, java.lang.String user, java.lang.String fileName)
Load a table from a CSV finle.NamedTable
loadTableFromCSVData(java.lang.String sys, java.lang.String user, java.lang.String text)
Load a table from a CSV text.AnonymousTable
newAnonymousTable(int numRows, int numColumns)
Create a new anonymous table.NamedTable
newCSVTable(java.lang.String systemName, java.lang.String userName, java.lang.String fileName)
Create a new CSV table.NamedTable
newCSVTable(java.lang.String systemName, java.lang.String userName, java.lang.String fileName, Table.CsvType csvType)
NamedTable
newInternalTable(java.lang.String systemName, java.lang.String userName, int numRows, int numColumns)
Create a new internal named table.void
printTree(java.io.PrintWriter writer, java.lang.String indent)
Print the tree to a stream.void
printTree(java.util.Locale locale, java.io.PrintWriter writer, java.lang.String indent)
Print the tree to a stream.-
Methods inherited from interface jmri.Manager
addDataListener, deleteBean, deregister, dispose, getBeanTypeHandled, getBeanTypeHandled, getEntryToolTip, getKnownBeanProperties, getMemo, getNamedBean, getNamedBeanClass, getNamedBeanSet, getObjectCount, getSystemNamePrefix, getSystemPrefix, getXMLOrder, isValidSystemNameFormat, makeSystemName, makeSystemName, makeSystemName, register, removeDataListener, setDataListenerMute, typeLetter, validateBadCharsInSystemNameFormat, validateIntegerSystemNameFormat, validateNmraAccessorySystemNameFormat, validateSystemNameFormat, validateSystemNameFormat, validateSystemNameFormatOnlyNumeric, validateSystemNamePrefix, validateTrimmedMin1NumberSystemNameFormat, validateTrimmedSystemNameFormat, validateUppercaseTrimmedSystemNameFormat, validSystemNameFormat
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from interface jmri.beans.SilenceablePropertyChangeProvider
setPropertyChangesSilenced
-
Methods inherited from interface jmri.beans.VetoableChangeProvider
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
-
-
-
-
Method Detail
-
newAnonymousTable
AnonymousTable newAnonymousTable(int numRows, int numColumns)
Create a new anonymous table. This table is not stored in the manager.- Parameters:
numRows
- number of rows in the tablenumColumns
- number of columns in the table- Returns:
- the new table
-
newCSVTable
NamedTable newCSVTable(java.lang.String systemName, java.lang.String userName, java.lang.String fileName)
Create a new CSV table. This table is stored in the manager but it's contents does only exists in the CSV file. If the CSV file is changed, the contents will be read on the next start of the program.- Parameters:
systemName
- the system name of the tableuserName
- the user name of the table, or null if no user namefileName
- the file name of the CSV file- Returns:
- the new table
-
newCSVTable
NamedTable newCSVTable(java.lang.String systemName, java.lang.String userName, java.lang.String fileName, Table.CsvType csvType)
-
newInternalTable
NamedTable newInternalTable(java.lang.String systemName, java.lang.String userName, int numRows, int numColumns)
Create a new internal named table. This table is stored in the manager together with its contents. Note that a big table will take a lot of space in the panel file since the storage of table data has a lot of overhead. For larger tables, a CSV table is recommended.- Parameters:
systemName
- the system name of the tableuserName
- the user name of the table, or null if no user namenumRows
- number of rows in the tablenumColumns
- number of columns in the table- Returns:
- the new table
-
loadTableFromCSVData
NamedTable loadTableFromCSVData(@Nonnull java.lang.String sys, @CheckForNull java.lang.String user, @Nonnull java.lang.String text) throws java.io.IOException
Load a table from a CSV text.- Parameters:
sys
- the system name of the new tableuser
- the user name of the new table or null if no user nametext
- the CSV text- Returns:
- the loaded table
- Throws:
java.io.IOException
- in case of an exception
-
loadTableFromCSV
NamedTable loadTableFromCSV(@Nonnull java.lang.String sys, @CheckForNull java.lang.String user, @Nonnull java.lang.String fileName) throws java.io.IOException
Load a table from a CSV finle.- Parameters:
sys
- the system name of the new tableuser
- the user name of the new table or null if no user namefileName
- the file name of the CSV table- Returns:
- the loaded table
- Throws:
java.io.IOException
- in case of an exception
-
loadTableFromCSV
NamedTable loadTableFromCSV(@Nonnull java.lang.String sys, @CheckForNull java.lang.String user, @Nonnull java.io.File file) throws java.io.IOException
Load a table from a CSV finle.- Parameters:
file
- the CSV filesys
- the system name of the new tableuser
- the user name of the new table or null if no user name- Returns:
- the loaded table
- Throws:
java.io.IOException
- in case of an exception
-
getNamedTable
NamedTable getNamedTable(java.lang.String name)
Locate via user name, then system name if needed. Does not create a new one if nothing found- Parameters:
name
- User name or system name to match- Returns:
- null if no match found
-
getByUserName
NamedTable getByUserName(java.lang.String name)
Locate an existing instance based on a user name.- Specified by:
getByUserName
in interfaceManager<NamedTable>
- Parameters:
name
- System Name of the required NamedBean- Returns:
- requested NamedBean object or null if none exists
-
getBySystemName
NamedTable getBySystemName(java.lang.String name)
Locate an existing instance based on a system name.- Specified by:
getBySystemName
in interfaceManager<NamedTable>
- Parameters:
name
- System Name of the required NamedBean- Returns:
- requested NamedBean object or null if none exists
-
getAutoSystemName
java.lang.String getAutoSystemName()
Create a new system name for a LogixNG.- Returns:
- a new system name
-
getSubSystemNamePrefix
default java.lang.String getSubSystemNamePrefix()
Get the sub system prefix of this manager. The sub system prefix is the system name prefix and possibly some extra characters of the NamedBeans handled by this manager.For most managers, this is the same as
Manager.getSystemNamePrefix()
, but for some like the managers in LogixNG, it differs. The sub system prefix for the NamedTableManager isManager.getSystemNamePrefix()
and "T";- Specified by:
getSubSystemNamePrefix
in interfaceManager<NamedTable>
- Returns:
- the sub system prefix
-
deleteNamedTable
void deleteNamedTable(NamedTable x)
Delete NamedTable by removing it from the manager.- Parameters:
x
- the NamedTable to delete
-
printTree
void printTree(java.io.PrintWriter writer, java.lang.String indent)
Print the tree to a stream.- Parameters:
writer
- the stream to print the tree toindent
- the indentation of each level
-
printTree
void printTree(java.util.Locale locale, java.io.PrintWriter writer, java.lang.String indent)
Print the tree to a stream.- Parameters:
locale
- The locale to be usedwriter
- the stream to print the tree toindent
- the indentation of each level
-
-