use of javax.swing.JInternalFrame in project JMRI by JMRI.
the class TableFrames method internalFrameIconified.
@Override
public void internalFrameIconified(InternalFrameEvent e) {
JInternalFrame frame = (JInternalFrame) e.getSource();
String name = frame.getName();
if (log.isDebugEnabled()) {
log.debug("Internal frame Iconified: " + frame.getTitle() + ", name= " + name + " size (" + frame.getSize().getWidth() + ", " + frame.getSize().getHeight() + ")");
}
if (name != null && name.startsWith("OB")) {
WarrantTableAction.initPathPortalCheck();
WarrantTableAction.checkPathPortals(((BlockPathFrame) frame).getModel().getBlock());
if (_showWarnings) {
WarrantTableAction.showPathPortalErrors();
}
}
}
use of javax.swing.JInternalFrame in project JMRI by JMRI.
the class ThrottleFrame method setXml.
/**
* Set the preferences based on the XML Element.
* <ul>
* <li> Window prefs
* <li> Frame title
* <li> ControlPanel
* <li> FunctionPanel
* <li> AddressPanel
* </ul>
*
*
* @param e The Element for this object.
*/
@SuppressWarnings("unchecked")
public void setXml(Element e) {
if (e == null) {
return;
}
String sfile = e.getAttributeValue("ThrottleXMLFile");
if (sfile != null) {
loadThrottle(FileUtil.getExternalFilename(sfile));
return;
}
boolean switchAfter = false;
if (!isEditMode) {
switchMode();
switchAfter = true;
}
int bSize = 23;
// Get InternalFrame border size
if (e.getAttribute("border") != null) {
bSize = Integer.parseInt((e.getAttribute("border").getValue()));
}
if (// Old format
e.getChild("window") != null) {
throttleWindow.setXml(e);
}
Element controlPanelElement = e.getChild("ControlPanel");
controlPanel.setXml(controlPanelElement);
if (((javax.swing.plaf.basic.BasicInternalFrameUI) controlPanel.getUI()).getNorthPane() != null) {
((javax.swing.plaf.basic.BasicInternalFrameUI) controlPanel.getUI()).getNorthPane().setPreferredSize(new Dimension(0, bSize));
}
Element functionPanelElement = e.getChild("FunctionPanel");
functionPanel.setXml(functionPanelElement);
if (((javax.swing.plaf.basic.BasicInternalFrameUI) controlPanel.getUI()).getNorthPane() != null) {
((javax.swing.plaf.basic.BasicInternalFrameUI) functionPanel.getUI()).getNorthPane().setPreferredSize(new Dimension(0, bSize));
}
Element addressPanelElement = e.getChild("AddressPanel");
addressPanel.setXml(addressPanelElement);
if (((javax.swing.plaf.basic.BasicInternalFrameUI) controlPanel.getUI()).getNorthPane() != null) {
((javax.swing.plaf.basic.BasicInternalFrameUI) addressPanel.getUI()).getNorthPane().setPreferredSize(new Dimension(0, bSize));
}
List<Element> jinsts = e.getChildren("Jynstrument");
if ((jinsts != null) && (jinsts.size() > 0)) {
for (int i = 0; i < jinsts.size(); i++) {
JInternalFrame jif = ynstrument(FileUtil.getExternalFilename(jinsts.get(i).getAttributeValue("JynstrumentFolder")));
Element window = jinsts.get(i).getChild("window");
if (jif != null) {
if (window != null) {
WindowPreferences.setPreferences(jif, window);
}
Component[] cmps2 = jif.getContentPane().getComponents();
int j = 0;
while ((j < cmps2.length) && (!(cmps2[j] instanceof Jynstrument))) {
j++;
}
if ((j < cmps2.length) && (cmps2[j] instanceof Jynstrument) && (jinsts.get(i) != null)) {
((Jynstrument) cmps2[j]).setXml(jinsts.get(i));
}
jif.repaint();
}
}
}
setFrameTitle();
if (switchAfter) {
switchMode();
}
}
use of javax.swing.JInternalFrame in project JMRI by JMRI.
the class ThrottleFrame method editRendering.
private void editRendering() {
Component[] cmps = getComponentsInLayer(PANEL_LAYER_PANEL);
for (int i = 0; i < cmps.length; i++) {
if (cmps[i] instanceof JPanel) {
JPanel pane = (JPanel) cmps[i];
JInternalFrame jif = contentPanes.get(pane);
jif.setContentPane((Container) pane.getComponent(0));
setTransparent(jif, false);
jif.setVisible(true);
remove(pane);
}
}
}
use of javax.swing.JInternalFrame in project JMRI by JMRI.
the class ThrottleFrame method playRendering.
private void playRendering() {
Component[] cmps = getComponentsInLayer(PANEL_LAYER_FRAME);
contentPanes = new HashMap<Container, JInternalFrame>();
for (int i = 0; i < cmps.length; i++) {
if ((cmps[i] instanceof JInternalFrame) && (cmps[i].isVisible())) {
JInternalFrame jif = (JInternalFrame) cmps[i];
Dimension cpSize = jif.getContentPane().getSize();
Point cpLoc = jif.getContentPane().getLocationOnScreen();
TranslucentJPanel pane = new TranslucentJPanel();
pane.setLayout(new BorderLayout());
contentPanes.put(pane, jif);
pane.add(jif.getContentPane(), BorderLayout.CENTER);
setTransparent(pane, true);
jif.setContentPane(new JPanel());
jif.setVisible(false);
Point loc = new Point(cpLoc.x - this.getLocationOnScreen().x, cpLoc.y - this.getLocationOnScreen().y);
add(pane, PANEL_LAYER_PANEL);
pane.setLocation(loc);
pane.setSize(cpSize);
}
}
}
use of javax.swing.JInternalFrame in project JMRI by JMRI.
the class ThrottleFramePropertyEditor method saveProperties.
/**
* Save the user-modified properties back to the ThrottleFrame.
*/
private void saveProperties() {
if (isDataValid()) {
int bSize = Integer.parseInt(Bundle.getMessage("FrameSize"));
JInternalFrame myFrame;
frame.setTitleText(titleField.getText());
frame.setTitleTextType(titleTextTypes[titleType.getSelectedIndex()]);
frame.getCurrentThrottleFrame().setFrameTitle();
if (((javax.swing.plaf.basic.BasicInternalFrameUI) frame.getCurrentThrottleFrame().getControlPanel().getUI()).getNorthPane() != null) {
if (borderOff.isSelected()) {
bSize = 0;
}
myFrame = frame.getCurrentThrottleFrame().getControlPanel();
((javax.swing.plaf.basic.BasicInternalFrameUI) myFrame.getUI()).getNorthPane().setPreferredSize(new Dimension(0, bSize));
if (myFrame.isVisible()) {
myFrame.setVisible(false);
myFrame.setVisible(true);
}
myFrame = frame.getCurrentThrottleFrame().getFunctionPanel();
((javax.swing.plaf.basic.BasicInternalFrameUI) myFrame.getUI()).getNorthPane().setPreferredSize(new Dimension(0, bSize));
if (myFrame.isVisible()) {
myFrame.setVisible(false);
myFrame.setVisible(true);
}
myFrame = frame.getCurrentThrottleFrame().getAddressPanel();
((javax.swing.plaf.basic.BasicInternalFrameUI) myFrame.getUI()).getNorthPane().setPreferredSize(new Dimension(0, bSize));
if (myFrame.isVisible()) {
myFrame.setVisible(false);
myFrame.setVisible(true);
}
}
finishEdit();
}
}
Aggregations