Search in sources :

Example 1 with TargetPane

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);
            }
        }
    }
}
Also used : TargetPane(jmri.jmrit.display.Editor.TargetPane)

Example 2 with TargetPane

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);
        }
    }
}
Also used : PortalManager(jmri.jmrit.logix.PortalManager) Portal(jmri.jmrit.logix.Portal) TargetPane(jmri.jmrit.display.Editor.TargetPane) OBlock(jmri.jmrit.logix.OBlock)

Example 3 with TargetPane

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);
        }
    }
}
Also used : TargetPane(jmri.jmrit.display.Editor.TargetPane)

Example 4 with TargetPane

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);
    }
}
Also used : IndicatorTrack(jmri.jmrit.display.IndicatorTrack) ArrayList(java.util.ArrayList) TargetPane(jmri.jmrit.display.Editor.TargetPane) Positionable(jmri.jmrit.display.Positionable)

Example 5 with TargetPane

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);
        }
    }
}
Also used : TargetPane(jmri.jmrit.display.Editor.TargetPane)

Aggregations

TargetPane (jmri.jmrit.display.Editor.TargetPane)8 BasicStroke (java.awt.BasicStroke)1 Stroke (java.awt.Stroke)1 ArrayList (java.util.ArrayList)1 IndicatorTrack (jmri.jmrit.display.IndicatorTrack)1 Positionable (jmri.jmrit.display.Positionable)1 OBlock (jmri.jmrit.logix.OBlock)1 Portal (jmri.jmrit.logix.Portal)1 PortalManager (jmri.jmrit.logix.PortalManager)1