Skip to content
Permalink
Browse files

multiple portal and signal icons in progress

  • Loading branch information
pete_ pete_
pete_ authored and pete_ committed Jun 10, 2019
1 parent 8e49bae commit cf87b9026bf9ba123eb7a0fdbc10fe42316cf7be
@@ -496,7 +496,7 @@ SignalMastLogic = Signal Mast Logic

DragOccupancyName = Drag name of device (OBlock or Sensor) to the "{0}" field.
DetectionSensor = Detection Sensor
DragErrorName = Drag name of sensor to show an error condition to the "{0}" field.
DragErrorName = Drag name of a sensor to show an error condition to the "{0}" field.
ClosePicklist = Close Picklist
noRowSelected = Select a row in the table to provide a device for this icon.

Large diffs are not rendered by default.

@@ -97,7 +97,7 @@ buttonClearSelection = Clear Selection
buttonChangeName = Change Name
buttonDeletePortal= Delete Portal
ButtonNextCircuit = Next Circuit
OpenSensorPicklist= Open Sensor Picklist
OpenPicklist = Open {0} Picklist

#labels
createOBlock = Create an OBlock track circuit
@@ -112,9 +112,11 @@ blockState = Circuit (OBlock) State:
AddRemoveIcons = Select (or deselect) all the track icons that display this OBlock track circuit
blockName = Circuit Name:
portalName = Portal Name
mastName = Signal Mast Name
makePortal = Make Portal
PortalTitle = Portals into and out of circuit {0}
SignalTitle = Signal masts protecting block {0}
SignalTitle = Edit Signal masts protecting block {0}
selectPortalProtection= Select a portal for protection of {0}
selectPortal = To make an icon for a Portal in the list, select it from the list,
dragIcon = then drag the icon below to its position between the circuits on the panel.
portalIconPosition=A portal icon must touch both Blocks of the Portal\nDrag the highlighted icon to a position straddling the two block circuits.
@@ -131,7 +133,8 @@ editPathIcons = then select or deselect the portal and track icons.
throwPathTO = To get the correct turnout position for a path,
holdShiftDown = Select, then click the turnout with the Shift key down.
makePath = Make Path
#DragOccupancyName = Drag name of Sensor that can detect occupancy to the {0} field.
DragOccupancySensor = Drag name of a sensor that can detect occupancy to the "{0}" field.
DragMast = Drag name of a Signal Mast to the {0} field.
editCiruit = Edit Circuit
PortalDirection1= Set the icons that indicate entry into block "{0}".
PortalDirection2= The icon shows the direction of movement
@@ -161,7 +164,7 @@ TooltipPathName = Enter the name of the Path through this Track Circuit.
TooltipPortalName= Enter a name to create a new Portal to OBlock "{0}".
ToolTipChangeName= Enter another name to change the name of a selection in the above list.
ToolTipDeletePortal= Delete the selected portal and its icon.
ToolTipPickLists = The pick list table displays a choice of sensors to do the detection.
ToolTipPickLists = Click on either the system or user name, then drag it and drop it into the entry field.

# error/warning messages
NeedDataTitle = Please enter Data
@@ -192,8 +195,9 @@ needPortalName = Enter the name for a new portal or select a portal from the ab
needPathName = Enter the name for a new path or select a path from the above list.
iconNotOnBlock = Portal icon "{1}" does not connect to circuit "{0}".\nPlease reposition to connect blocks.
repositionPortal= Do you want to change Portal "{0}" connections to be between circuits "{1}" and "{2}"?
portalIconExists= Portal "{0}" is defined. See highlighted icon.
portalIconExists= Portal "{0}" is defined. See highlighted icon(s).
portalExists = Portal named "{0}" already exits between OBlocks "{1}" and "{2}".
portalWant2Icons=Portal "{0}" has an icon. Do you want to add another to connect to a non-contiguous block?
changeBlockName = Enter a user name for the circuit OBlock.
changePortalName= Select a Portal from the above list. Enter the name change and press "{0}".
changePathName = Select a path from the above list. Enter the name change and press "{0}".
@@ -23,11 +23,11 @@
import jmri.jmrit.display.Positionable;
import jmri.jmrit.display.ToolTip;
import jmri.jmrit.display.TurnoutIcon;
import jmri.jmrit.display.palette.ItemPalette;
//import jmri.jmrit.display.palette.ItemPalette;
import jmri.jmrit.logix.OBlock;
import jmri.jmrit.logix.Portal;
import jmri.jmrit.picker.PickListModel;
import jmri.jmrit.picker.PickPanel;
//import jmri.jmrit.picker.PickPanel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@@ -49,8 +49,9 @@
private JToggleButton _units;

// Sensor list
private JFrame _pickFrame;
private JButton _openPicklistButton;
// private JFrame _pickFrame;
OpenPickListButton<Sensor> _pickTable;
// private JButton _openPicklistButton;

static int STRUT_SIZE = 10;
static Point _loc = new Point(-1, -1);
@@ -133,7 +134,11 @@ public void windowClosing(java.awt.event.WindowEvent e) {
_errorSensorName.setToolTipText(Bundle.getMessage("detectorErrorName"));
contentPane.add(panel);

contentPane.add(makePickListPanel());
String[] blurbLines = { Bundle.getMessage("DragOccupancySensor", Bundle.getMessage("DetectionSensor")),
Bundle.getMessage("DragErrorName", Bundle.getMessage("ErrorSensor"))};
_pickTable = new OpenPickListButton<Sensor>(blurbLines, PickListModel.sensorPickModelInstance(), this);
contentPane.add(_pickTable.getButtonPanel());
// contentPane.add(makePickListPanel());
contentPane.add(Box.createVerticalStrut(STRUT_SIZE));

JPanel pp = new JPanel();
@@ -175,68 +180,6 @@ public void windowClosing(java.awt.event.WindowEvent e) {
}
changeUnits();
}

private JPanel makePickListPanel() {
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS));
JPanel panel = new JPanel();
panel.setLayout(new FlowLayout());

_openPicklistButton = new JButton(Bundle.getMessage("OpenSensorPicklist"));
_openPicklistButton.addActionListener((ActionEvent a) -> {
if (_pickFrame == null) {
openPickList();
} else {
closePickList();
}
});
_openPicklistButton.setToolTipText(Bundle.getMessage("ToolTipPickLists"));
panel.add(_openPicklistButton);
panel.setToolTipText(Bundle.getMessage("ToolTipPickLists"));

buttonPanel.add(panel);
return buttonPanel;
}

void openPickList() {
_pickFrame = new JFrame();
JPanel content = new JPanel();
content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));

JPanel blurb = new JPanel();
blurb.setLayout(new BoxLayout(blurb, BoxLayout.Y_AXIS));
blurb.add(Box.createVerticalStrut(ItemPalette.STRUT_SIZE));
blurb.add(new JLabel(Bundle.getMessage("DragOccupancyName", Bundle.getMessage("DetectionSensor"))));
blurb.add(new JLabel(Bundle.getMessage("DragErrorName", Bundle.getMessage("ErrorSensor"))));
blurb.add(Box.createVerticalStrut(ItemPalette.STRUT_SIZE));
JPanel panel = new JPanel();
panel.add(blurb);
content.add(panel);
PickListModel[] models = {PickListModel.sensorPickModelInstance()};
content.add(new PickPanel(models));

_pickFrame.setContentPane(content);
_pickFrame.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
closePickList();
}
});
_pickFrame.setLocationRelativeTo(this);
_pickFrame.toFront();
_pickFrame.setVisible(true);
_pickFrame.pack();
_openPicklistButton.setText(Bundle.getMessage("ClosePicklist"));
}

void closePickList() {
if (_pickFrame != null) {
_pickFrame.dispose();
_pickFrame = null;
_openPicklistButton.setText(Bundle.getMessage("OpenSensorPicklist"));
}
}

private JPanel makeButtonPanel() {
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS));
@@ -437,7 +380,7 @@ protected void closingEvent(boolean close) {
}
}
}
closePickList();
_pickTable.closePickList();
getLocation(_loc);
getSize(_dim);
_parent.closeCircuitFrame();
@@ -5,6 +5,8 @@
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;

import javax.swing.AbstractButton;
import javax.swing.BorderFactory;
import javax.swing.Box;
@@ -185,8 +187,10 @@ protected void clearListSelection() {
public void valueChanged(ListSelectionEvent e) {
Portal portal = _portalList.getSelectedValue();
if (portal != null) {
PortalIcon icon = _parent.getPortalIconMap().get(portal.getName());
setPortalIcon(icon, false);
java.util.List<PortalIcon> piArray = _parent.getPortalIconMap(portal);
for (PortalIcon icon : piArray) {
setPortalIcon(icon, false);
}
}
}

0 comments on commit cf87b90

Please sign in to comment.
You can’t perform that action at this time.