protected JXTaskPane getOverviewPane() { if (overviewPane == null) { overviewPane = new JXTaskPane(STLConstants.K1060_OUTLINE.getValue()); overviewPane.setUI(new IntelTaskPaneUI()); Container content = overviewPane.getContentPane(); content.setLayout(new BorderLayout()); graphOutline = new TopologyOutlinePanel(updateService, Fit.WIDTH); graphOutline.setBackground(UIConstants.INTEL_WHITE); graphOutline.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(UIConstants.INTEL_GRAY), BorderFactory.createEmptyBorder(2, 2, 2, 2))); content.add(graphOutline, BorderLayout.CENTER); enlargeBtn = new JXHyperlink( new AbstractAction(STLConstants.K1061_ENLARGE.getValue()) { private static final long serialVersionUID = -4493041735258083928L; @Override public void actionPerformed(ActionEvent e) { if (graph != null) { showOutlineWindow(); } } }); enlargeBtn.setHorizontalAlignment(JButton.TRAILING); enlargeBtn.setUnclickedColor(UIConstants.INTEL_BLUE); content.add(enlargeBtn, BorderLayout.SOUTH); } return overviewPane; }
public void setGraph(TopGraph graph) { graphOutline.setGraph(graph); if (popupOutline != null) { popupOutline.setGraph(graph); dirtyPopup = false; } this.graph = graph; }
protected JFrame getPopupWindow() { if (popupWindow == null) { popupWindow = new JFrame(STLConstants.K1063_TOP_OUTLINE.getValue()); Image[] images = new Image[] { UIImages.LOGO_24.getImage(), UIImages.LOGO_32.getImage(), UIImages.LOGO_64.getImage(), UIImages.LOGO_128.getImage() }; popupWindow.setIconImages(Arrays.asList(images)); popupWindow.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); popupWindow.addComponentListener( new ComponentAdapter() { /* * (non-Javadoc) * * @see * java.awt.event.ComponentAdapter#componentResized(java.awt * .event.ComponentEvent) */ @Override public void componentResized(ComponentEvent e) { popupBound = popupWindow.getBounds(); popupState = popupWindow.getExtendedState(); } /* * (non-Javadoc) * * @see * java.awt.event.ComponentAdapter#componentMoved(java.awt.event * .ComponentEvent) */ @Override public void componentMoved(ComponentEvent e) { popupBound = popupWindow.getBounds(); popupState = popupWindow.getExtendedState(); } }); JPanel content = (JPanel) popupWindow.getContentPane(); content.setLayout(new BorderLayout()); content.setBackground(UIConstants.INTEL_WHITE); content.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); popupOutline = new TopologyOutlinePanel(updateService, Fit.WINDOW); popupOutline.setBackground(UIConstants.INTEL_WHITE); popupOutline.setPreferredSize(new Dimension(800, 600)); popupOutline.setMinimumSize(new Dimension(400, 300)); popupOutline.setToolTipText(""); popupOutline.setGraph(graph); content.add(popupOutline, BorderLayout.CENTER); popupWindow.pack(); } return popupWindow; }
/** <i>Description:</i> clear buffered image, so we will redraw it */ public void updateGraph() { graphOutline.updateImage(); if (popupOutline != null) { if (popupWindow.isVisible()) { popupOutline.updateImage(); dirtyPopup = false; } else { dirtyPopup = true; } } }
public void showOutlineWindow() { JFrame frame = getPopupWindow(); if (frame.isVisible()) { if (popupBound != null) { frame.setBounds(popupBound); } frame.setExtendedState(popupState); frame.toFront(); } else { frame.setLocationRelativeTo(SwingUtilities.getRoot(this)); frame.setVisible(true); } if (dirtyPopup) { popupOutline.setImage(graphOutline.getImage()); popupOutline.updateImage(); dirtyPopup = false; } }
public void initView() { graphOutline.initView(); }