void hide() { if (!isShowing) return; tablePanel.remove(currentComponent); if (split != null) { splitPos = split.getDividerLocation(); currentComponent = (JComponent) split.getLeftComponent(); tablePanel.add(currentComponent, BorderLayout.CENTER); } tablePanel.revalidate(); isShowing = false; }
/** * Reset import screen. This can be used while creating totally new instance of import screen or * just resetting the default. * * @param setVisibleAfterReset set import screen frame visible after it has been reseted */ public void resetImportScreen(boolean setVisibleAfterReset) { application = Session.getSession().getApplication(); // If frame exists, set visibility to false while resetting if (frame != null) { frame.setVisible(false); } // Create new instances of conversion model, column type manager and trimmers conversionModel = new ConversionModel(this); columnTypeManager = new ColumnTypeManager(0); dataTrimmer = new DataTrimmer(); // Ignore first dataTrimmer.addIgnoreColumnNumber(0); flagTrimmer = new DataTrimmer(); flagTrimmer.addIgnoreColumnNumber(0); // Table has to be first to get references right tableFrame = new TableInternalFrame(this); toolsFrame = new ToolsInternalFrame(this); conversionModel.addConversionChangeListener(tableFrame); columnTypeManager.addColumnTypeChangeListener(tableFrame); columnTypeManager.addColumnTypeChangeListener(toolsFrame); frame = new JFrame("Import tool"); mainSplit = new JSplitPane(); frame.setLayout(new BorderLayout()); frame.setSize(IMPORT_SCREEN_SIZE); mainSplit.setOrientation(JSplitPane.HORIZONTAL_SPLIT); mainSplit.setDividerLocation(TOOLS_FRAME_WIDTH); mainSplit.setLeftComponent(toolsFrame); mainSplit.setRightComponent(tableFrame); mainSplit.getLeftComponent().setMinimumSize(new Dimension(150, 0)); mainSplit.setResizeWeight(0); frame.add(mainSplit, BorderLayout.CENTER); // Reset buttons changeStepPanel = null; frame.add(getChangeStepButtonsPanel(), BorderLayout.SOUTH); if (setVisibleAfterReset) { frame.setVisible(true); } }
public void testSplitPane() throws Exception { JSplitPane splitPane = (JSplitPane) getInstrumentedRootComponent("TestSplitPane.form", "BindingTest"); assertTrue(splitPane.getLeftComponent() instanceof JLabel); assertTrue(splitPane.getRightComponent() instanceof JCheckBox); }
public FigTreePanel( JFrame frame, final ExtendedTreeViewer treeViewer, ControlPalette controlPalette) { this.treeViewer = treeViewer; this.controlPalette = controlPalette; // the scrollpane below now has this border // controlPalette.getPanel().setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, // Color.GRAY)); controlPalette.getPanel().setBackground(new Color(231, 237, 246)); controlPalette.getPanel().setOpaque(true); treeViewerController = new TreeViewerController(treeViewer); controlPalette.addController(treeViewerController); controlPalette.addController(new MultipleTreesController(treeViewer)); // This controller handles reading/writing of attribute colour schemes but doesn't presently // show any UI AttributeColourController attributeColourController = new AttributeColourController(treeViewer, frame); controlPalette.addController(attributeColourController); controlPalette.addController( new TreeAppearanceController(treeViewer, frame, attributeColourController)); treesController = new TreesController(treeViewer); controlPalette.addController(treesController); controlPalette.addController(new TimeScaleController(treeViewer)); // Create a tip label painter and its controller final BasicLabelPainter tipLabelPainter = new BasicLabelPainter(BasicLabelPainter.PainterIntent.TIP); controlPalette.addController( new LabelPainterController( "Tip Labels", "tipLabels", tipLabelPainter, frame, attributeColourController, treeViewer)); treeViewer.setTipLabelPainter(tipLabelPainter); // Create a node label painter and its controller final BasicLabelPainter nodeLabelPainter = new BasicLabelPainter(BasicLabelPainter.PainterIntent.NODE); nodeLabelPainter.setVisible(false); controlPalette.addController( new LabelPainterController( "Node Labels", "nodeLabels", nodeLabelPainter, frame, attributeColourController, treeViewer)); treeViewer.setNodeLabelPainter(nodeLabelPainter); // Create a node bar painter and its controller final NodeBarPainter nodeBarPainter = new NodeBarPainter(); nodeBarPainter.setForeground(new Color(24, 32, 228, 128)); nodeBarPainter.setVisible(false); controlPalette.addController(new NodeBarController("Node Bars", nodeBarPainter, treeViewer)); treeViewer.setNodeBarPainter(nodeBarPainter); // Create a node shape painter and its controller final NodeShapePainter nodeShapePainter = new NodeShapePainter(); nodeShapePainter.setVisible(false); controlPalette.addController( new NodeShapeController( "Node Shapes", nodeShapePainter, attributeColourController, treeViewer)); treeViewer.setNodeShapePainter(nodeShapePainter); // Create a branch label painter and its controller final BasicLabelPainter branchLabelPainter = new BasicLabelPainter(BasicLabelPainter.PainterIntent.BRANCH); branchLabelPainter.setVisible(false); controlPalette.addController( new LabelPainterController( "Branch Labels", "branchLabels", branchLabelPainter, frame, attributeColourController, treeViewer)); treeViewer.setBranchLabelPainter(branchLabelPainter); // Create a scale controller final ScaleBarPainter scaleBarPainter = new ScaleBarPainter(); scaleBarPainter.setVisible(true); controlPalette.addController(new ScaleBarPainterController(scaleBarPainter, treeViewer)); treeViewer.addScalePainter(scaleBarPainter); // Create a scale axis controller final ScaleAxisPainter scaleAxisPainter = new ScaleAxisPainter(); final ScaleGridPainter scaleGridPainter = new ScaleGridPainter(); scaleAxisPainter.setVisible(false); scaleGridPainter.setVisible(false); controlPalette.addController( new ScaleAxisPainterController(scaleAxisPainter, scaleGridPainter, treeViewer)); treeViewer.addScalePainter(scaleAxisPainter); treeViewer.setScaleGridPainter(scaleGridPainter); // Create a legend controller final LegendPainter legendPainter = new LegendPainter(attributeColourController); legendPainter.setVisible(false); controlPalette.addController( new LegendPainterController(legendPainter, attributeColourController, treeViewer)); treeViewer.setLegendPainter(legendPainter); slideOpenPanel = new SlideOpenPanel(treeViewer); setLayout(new BorderLayout()); // add(slideOpenPanel, BorderLayout.CENTER); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, Color.GRAY)); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); int scrollBarWidth = scrollPane.getVerticalScrollBar().getWidth(); int controlPanelWidth = CONTROL_PALETTE_WIDTH + scrollBarWidth; controlPalette.setPreferredWidth(controlPanelWidth); scrollPane.setViewportView(controlPalette.getPanel()); // add(scrollPane, BorderLayout.WEST); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scrollPane, slideOpenPanel); splitPane.putClientProperty("Quaqua.SplitPane.style", "bar"); splitPane.setOneTouchExpandable(true); add(splitPane, BorderLayout.CENTER); int w = splitPane.getLeftComponent().getPreferredSize().width; splitPane.getLeftComponent().setMinimumSize(new Dimension(w, 0)); // splitPane.getLeftComponent().setMaximumSize(new Dimension(2 * w, 0)); // Might be possible to improve the action of the oneTouchExpandable button. Ideally would not // allow // maximization of control panel, only its collapse. // BasicSplitPaneDivider bspd = ((BasicSplitPaneUI)splitPane.getUI()).getDivider(); // try { // Field rightButtonField = // BasicSplitPaneDivider.class.getDeclaredField("rightButton"); // rightButtonField.setAccessible(true); // JButton rightButton = (JButton) // rightButtonField.get(((BasicSplitPaneUI)splitPane.getUI()).getDivider()); // // Field leftButtonField = // BasicSplitPaneDivider.class.getDeclaredField("leftButton"); // leftButtonField.setAccessible(true); // JButton leftButton = (JButton) // leftButtonField.get(((BasicSplitPaneUI)splitPane.getUI()).getDivider()); // // // } catch (Exception e) { // e.printStackTrace(); // } // treeViewer.addAnnotationsListener(new AnnotationsListener() { // public void annotationsChanged() { // // tipLabelPainter.setupAttributes(treeViewer.getTrees()); // nodeLabelPainter.setupAttributes(treeViewer.getTrees()); // nodeBarPainter.setupAttributes(treeViewer.getTrees()); // branchLabelPainter.setupAttributes(treeViewer.getTrees()); // legendPainter.setupAttributes(treeViewer.getTrees()); // } // }); }