use of jmri.jmrit.roster.RosterEntry in project JMRI by JMRI.
the class TrainIconXml method store.
/**
* Default implementation for storing the contents of a TrainIcon
*
* @param o Object to store, of type TrainIcon
* @return Element containing the complete info
*/
@Override
public Element store(Object o) {
TrainIcon p = (TrainIcon) o;
if (!p.isActive()) {
// if flagged as inactive, don't store
return null;
}
Element element = new Element(Xml.TRAINICON);
element.setAttribute(Xml.TRAIN, p.getTrain().getId());
element.setAttribute(Xml.TRAIN_NAME, p.getTrain().getName());
storeCommonAttributes(p, element);
// include contents
if (p.getUnRotatedText() != null) {
element.setAttribute(Xml.TEXT, p.getUnRotatedText());
}
storeTextInfo(p, element);
element.setAttribute(Xml.ICON, Xml.YES);
element.setAttribute(Xml.DOCK_X, "" + p.getDockX());
element.setAttribute(Xml.DOCK_Y, "" + p.getDockY());
// element.setAttribute("iconId", p.getIconId());
element.addContent(storeIcon(Xml.ICON, (NamedIcon) p.getIcon()));
RosterEntry entry = p.getRosterEntry();
if (entry != null) {
element.setAttribute(Xml.ROSTERENTRY, entry.getId());
}
element.setAttribute(Xml.CLASS, this.getClass().getName());
return element;
}
use of jmri.jmrit.roster.RosterEntry in project JMRI by JMRI.
the class RosterGroup method setName.
/**
* Set the RosterGroup's name, changing it in every entry associated with
* the roster.
*
* @param newName the new name
*/
public void setName(String newName) {
if (Roster.getDefault().getRosterGroups().containsKey(newName)) {
return;
}
String oldName = this.name;
String oldGroup = Roster.getRosterGroupProperty(oldName);
String newGroup = Roster.getRosterGroupProperty(newName);
Roster.getDefault().remapRosterGroup(this, newName);
for (RosterEntry re : this.getEntries()) {
// NOI18N
re.putAttribute(newGroup, "yes");
re.deleteAttribute(oldGroup);
}
this.name = newName;
Roster.getDefault().rosterGroupRenamed(oldName, newName);
}
use of jmri.jmrit.roster.RosterEntry in project JMRI by JMRI.
the class RosterGroupTableModel method setValueAt.
@Override
public void setValueAt(Object value, int row, int col) {
RosterEntry re = Roster.getDefault().getEntry(row);
if ((col == ADDTOGROUPCOL) && (!group.equals("RosterGroup:"))) {
if (value.toString().equals("true")) {
re.putAttribute(group, "yes");
} else {
re.deleteAttribute(group);
}
re.updateFile();
Roster.getDefault().writeRoster();
}
//re.updateFile();
//Roster.getDefault().writeRosterFile();
}
use of jmri.jmrit.roster.RosterEntry in project JMRI by JMRI.
the class RosterTreeNode method initComponents.
/**
* Initialize the connection to the Roster.
* <p>
* Should be called before connecting the node to a JTree.
*/
public void initComponents() {
// title this node
setUserObject("Roster");
// add every roster entry
List<RosterEntry> list = Roster.getDefault().matchingList(null, null, null, null, null, null, null);
for (RosterEntry r : list) {
add(new DefaultMutableTreeNode(r.getId()));
}
}
use of jmri.jmrit.roster.RosterEntry in project JMRI by JMRI.
the class AttributeTableModel method getValueAt.
/**
* Provides the empty String if attribute doesn't exist.
*/
@Override
public Object getValueAt(int row, int col) {
// get column key
String key = getColumnName(col);
// get roster entry for row
RosterEntry re = Roster.getDefault().getEntry(row);
String retval = re.getAttribute(key);
if (retval != null) {
return retval;
}
return "";
}
Aggregations