diff --git a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/plotter/PlotSlot.java b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/plotter/PlotSlot.java index 0a87abc1e6d53af0ed0157dc65f06aed77c116d4..dd8ad696921f48cae69f55ca5300699e4d86e594 100644 --- a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/plotter/PlotSlot.java +++ b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/plotter/PlotSlot.java @@ -50,6 +50,7 @@ public class PlotSlot extends JPanel{ private PlotPanel itsPlot; private String slotLabel; private boolean hasLegend; + private boolean isViewedExternally; private JLabel rightClickFacade; private LinkedList<PlotSlotListener> listenerList = null; private MouseAdapter plotMouseListener; @@ -92,6 +93,13 @@ public class PlotSlot extends JPanel{ public String getLabel(){ return slotLabel; } + protected void setViewedExternally(boolean viewedExternally){ + this.isViewedExternally = viewedExternally; + } + + protected boolean isViewedExternally(){ + return isViewedExternally; + } public PlotPanel getPlot(){ return itsPlot; } diff --git a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/plotter/PlotSlotViewFrame.java b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/plotter/PlotSlotViewFrame.java index 20773049153a2edc62f498082be229c059860e9c..79eef7b4411ae1927c81875ced965c424066d864 100644 --- a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/plotter/PlotSlotViewFrame.java +++ b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/plotter/PlotSlotViewFrame.java @@ -34,7 +34,7 @@ import nl.astron.lofar.java.gui.plotter.exceptions.PlotterException; */ public class PlotSlotViewFrame extends JDialog{ - int plotIndex; + protected int plotIndex; /** Creates a new instance of PlotSlotViewFrame */ public PlotSlotViewFrame(PlotSlotManager parent, int index, String title, boolean showLegendOnly) { diff --git a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/plotter/PlotSlotsPanel.java b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/plotter/PlotSlotsPanel.java index 9239c15d8a3a7b90ea7c518c8c1b2723a1954fe6..146b80183ed93e490495fde4a7dfe127c9a80297 100644 --- a/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/plotter/PlotSlotsPanel.java +++ b/SAS/OTB/OTB/src/nl/astron/lofar/sas/otb/util/plotter/PlotSlotsPanel.java @@ -23,6 +23,8 @@ package nl.astron.lofar.sas.otb.util.plotter; +import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -31,10 +33,10 @@ import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; -import javax.swing.JComponent; +import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuItem; -import javax.swing.JOptionPane; +import javax.swing.JPanel; import javax.swing.JPopupMenu; import org.apache.log4j.Logger; @@ -139,12 +141,32 @@ public class PlotSlotsPanel extends javax.swing.JPanel { gridBagConstraints.weighty = 1.0; gridBagConstraints.anchor = java.awt.GridBagConstraints.CENTER; PlotSlot newSlot = itsSlotManager.getSlot(i); - newSlot.addSlotListener(new SlotMouseAdapter()); - //newSlot.setSize(new Dimension(getWidth()/columnsAndRows,getHeight()/columnsAndRows)); - // - newSlot.setMinimumSize(new Dimension(getWidth()/columnsAndRows,getHeight()/columnsAndRows)); - newSlot.setPreferredSize(new Dimension(getWidth()/columnsAndRows,getHeight()/columnsAndRows)); - slotsPanel.add(newSlot,gridBagConstraints); + if(!newSlot.isViewedExternally()){ + newSlot.addSlotListener(new SlotMouseAdapter()); + //newSlot.setSize(new Dimension(getWidth()/columnsAndRows,getHeight()/columnsAndRows)); + // + newSlot.setMinimumSize(new Dimension(getWidth()/columnsAndRows,getHeight()/columnsAndRows)); + newSlot.setPreferredSize(new Dimension(getWidth()/columnsAndRows,getHeight()/columnsAndRows)); + slotsPanel.add(newSlot,gridBagConstraints); + }else{ + JPanel tempPanel = new JPanel(); + tempPanel.setBackground(Color.WHITE); + tempPanel.setLayout(new BorderLayout()); + tempPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + tempPanel.setMinimumSize(new Dimension(getWidth()/columnsAndRows,getHeight()/columnsAndRows)); + tempPanel.setPreferredSize(new Dimension(getWidth()/columnsAndRows,getHeight()/columnsAndRows)); + tempPanel.add(new JLabel("External viewer active"),BorderLayout.CENTER); + JPanel northPanel = new JPanel(); + northPanel.setLayout(new BorderLayout()); + northPanel.setBackground(Color.LIGHT_GRAY); + JLabel slotNumber = new JLabel(""+i); + slotNumber.setForeground(Color.WHITE); + northPanel.add(slotNumber,BorderLayout.CENTER); + tempPanel.add(northPanel,BorderLayout.NORTH); + + slotsPanel.add(tempPanel,gridBagConstraints); + } + x++; if (x == columnsAndRows){ y++; @@ -267,12 +289,12 @@ public class PlotSlotsPanel extends javax.swing.JPanel { dialog.addWindowListener(new WindowListener(){ public void windowDeactivated(WindowEvent e){} public void windowActivated(WindowEvent e){} - public void windowClosed(WindowEvent e){ - rearrangeSlotGrid(); - externalLegendActive = false;} + public void windowClosed(WindowEvent e){} public void windowDeiconified(WindowEvent e){} public void windowIconified(WindowEvent e){} - public void windowClosing(WindowEvent e){} + public void windowClosing(WindowEvent e){ + externalLegendActive = false; + } public void windowOpened(WindowEvent e){} }); dialog.setVisible(true); @@ -329,10 +351,15 @@ public class PlotSlotsPanel extends javax.swing.JPanel { PlotSlotViewFrame dialog = new PlotSlotViewFrame(itsSlotManager,Integer.parseInt(selectedSlot.getLabel()),"Viewer for Plot "+selectedSlot.getLabel(),false); dialog.addWindowListener(new WindowListener(){ public void windowDeactivated(WindowEvent e){} - public void windowActivated(WindowEvent e){} + public void windowActivated(WindowEvent e){ + PlotSlotViewFrame sourceFrame = (PlotSlotViewFrame)e.getSource(); + itsSlotManager.getSlot(sourceFrame.plotIndex).setViewedExternally(true); + rearrangeSlotGrid();} public void windowClosed(WindowEvent e){ + PlotSlotViewFrame sourceFrame = (PlotSlotViewFrame)e.getSource(); + itsSlotManager.getSlot(sourceFrame.plotIndex).setViewedExternally(false); rearrangeSlotGrid(); - externalViewerActive = false;} + externalLegendActive = false;} public void windowDeiconified(WindowEvent e){} public void windowIconified(WindowEvent e){} public void windowClosing(WindowEvent e){}