use of jmri.jmrit.display.Editor.TargetPane in project JMRI by JMRI.
the class CircuitBuilder method newCircuit.
/**
* ************** Set up editing Frames ****************
*/
protected void newCircuit() {
if (editingOK()) {
addCircuitDialog();
if (_currentBlock != null) {
if (_editCircuitFrame == null) {
checkCircuits();
_editor.setSelectionGroup(makeSelectionGroup(_currentBlock, false));
_editor.disableMenus();
TargetPane targetPane = (TargetPane) _editor.getTargetPanel();
targetPane.setSelectGroupColor(_editGroupColor);
targetPane.setHighlightColor(_editGroupColor);
_editCircuitFrame = new EditCircuitFrame(Bundle.getMessage("newCircuitItem"), this, _currentBlock);
}
}
}
}
use of jmri.jmrit.display.Editor.TargetPane in project JMRI by JMRI.
the class CircuitBuilder method portalCircuitError.
private void portalCircuitError(String portalName) {
if (editingOK()) {
PortalManager portalMgr = InstanceManager.getDefault(jmri.jmrit.logix.PortalManager.class);
Portal portal = portalMgr.getByUserName(portalName);
if (portal == null) {
JOptionPane.showMessageDialog(_editor, Bundle.getMessage("noSuchPortal", portalName), Bundle.getMessage("ErrorPortal"), JOptionPane.INFORMATION_MESSAGE);
return;
}
_currentBlock = portal.getToBlock();
OBlock adjacentBlock = null;
if (_currentBlock == null) {
_currentBlock = portal.getFromBlock();
} else {
adjacentBlock = portal.getFromBlock();
}
if (adjacentBlock == null) {
JOptionPane.showMessageDialog(_editor, Bundle.getMessage("invalidPortal", portalName, _currentBlock), Bundle.getMessage("ErrorPortal"), JOptionPane.INFORMATION_MESSAGE);
return;
}
if (_currentBlock != null) {
// check icons to be indicator type
_circuitIcons = _circuitMap.get(_currentBlock);
if (!iconsConverted(_currentBlock)) {
queryConvertIcons(_currentBlock);
}
_editor.setSelectionGroup(makeSelectionGroup(_currentBlock, false));
_editor.setSecondSelectionGroup(makeSelectionGroup(adjacentBlock, false));
_editor.disableMenus();
TargetPane targetPane = (TargetPane) _editor.getTargetPanel();
targetPane.setSelectGroupColor(_editGroupColor);
targetPane.setHighlightColor(_highlightColor);
PortalIcon icon = _portalIconMap.get(portalName);
if (icon != null) {
icon.setStatus(PortalIcon.VISIBLE);
}
setPortalsPositionable(_currentBlock, true);
_editPortalFrame = new EditPortalFrame(Bundle.getMessage("OpenPortalTitle"), this, _currentBlock, portal, adjacentBlock);
}
}
}
use of jmri.jmrit.display.Editor.TargetPane in project JMRI by JMRI.
the class CircuitBuilder method editPortalDirection.
protected void editPortalDirection(String title) {
if (editingOK()) {
editCircuitDialog(title);
if (_currentBlock != null) {
checkCircuits();
_circuitIcons = _circuitMap.get(_currentBlock);
// check icons to be indicator type
if (!iconsConverted(_currentBlock)) {
queryConvertIcons(_currentBlock);
}
_editor.setSelectionGroup(makeSelectionGroup(_currentBlock, true));
_editor.disableMenus();
TargetPane targetPane = (TargetPane) _editor.getTargetPanel();
targetPane.setSelectGroupColor(_editGroupColor);
targetPane.setHighlightColor(_highlightColor);
setPortalsPositionable(_currentBlock, true);
_editDirectionFrame = new EditPortalDirection(Bundle.getMessage("OpenDirectionTitle"), this, _currentBlock);
}
}
}
use of jmri.jmrit.display.Editor.TargetPane in project JMRI by JMRI.
the class CircuitBuilder method convertIcons.
protected void convertIcons(ArrayList<Positionable> iconList) {
if (iconList == null || iconList.size() == 0) {
return;
}
// use global member for finishConvert to remove and add converted icons,
_circuitIcons = iconList;
// since iconList will be modified, use a copy to find unconverted icons
ArrayList<Positionable> list = new ArrayList<Positionable>();
for (int i = 0; i < iconList.size(); i++) {
list.add(iconList.get(i));
}
if (list.size() > 0) {
TargetPane targetPane = (TargetPane) _editor.getTargetPanel();
targetPane.setHighlightColor(_highlightColor);
for (int i = 0; i < list.size(); i++) {
Positionable pos = list.get(i);
if (!(pos instanceof IndicatorTrack) && !(pos instanceof PortalIcon)) {
if (log.isDebugEnabled()) {
log.debug("convertIcons: #" + i + " pos= " + pos.getClass().getName());
}
convertIcon(pos);
}
}
targetPane.setHighlightColor(_editGroupColor);
_editor.highlight(null);
}
}
use of jmri.jmrit.display.Editor.TargetPane in project JMRI by JMRI.
the class CircuitBuilder method editCircuit.
protected void editCircuit(String title) {
if (editingOK()) {
editCircuitDialog(title);
if (_currentBlock != null) {
checkCircuits();
_editor.setSelectionGroup(makeSelectionGroup(_currentBlock, false));
_editor.disableMenus();
TargetPane targetPane = (TargetPane) _editor.getTargetPanel();
targetPane.setSelectGroupColor(_editGroupColor);
targetPane.setHighlightColor(_editGroupColor);
_editCircuitFrame = new EditCircuitFrame(Bundle.getMessage("OpenCircuitItem"), this, _currentBlock);
}
}
}
Aggregations