JideSplitPane splitPane = new JideSplitPane(); splitPane.add(diffUtil.getLeftEditor())); splitPane.add(diffUtil.getRightEditor())); yourEditorPane.add(splitPane);
public void showDockablePanel(DockablePaneKey key, boolean show) { final DockablePane dockablePane = dockablePaneMap.get(key); if (multiSplitPane.indexOfPane(dockablePane) < 0 && show) { multiSplitPane.addPane(dockablePane); multiSplitPane.invalidate(); } dockablePane.setShown(show); }
private JComponent createAggregatorsAndVariablesPanel() { JideSplitPane splitPane = new JideSplitPane(JideSplitPane.VERTICAL_SPLIT); splitPane.add(createAggregatorsPanel()); splitPane.add(createVariablesPanel()); splitPane.setShowGripper(true); splitPane.setProportionalLayout(true); splitPane.setProportions(new double[]{0.6}); return splitPane; }
/** * Removes the pane, specified by <code>index</code>, from this container. * * @param pane the pane to be removed. */ public void removePane(Component pane) { removePane(indexOfPane(pane)); }
/** * Sets the size of the divider. * * @param newSize an integer giving the size of the divider in pixels */ public void setDividerSize(int newSize) { int oldSize = _dividerSize; if (oldSize != newSize) { _dividerSize = newSize; firePropertyChange(DIVIDER_SIZE_PROPERTY, oldSize, newSize); invalidate(); } }
public void reorderPanels(java.util.List<String> names) { int h = centerSplitPane.getHeight(); int[] dividerLocations = centerSplitPane.getDividerLocations(); Map<String, Integer> panelHeights = new HashMap(); int idx = 0; for (Component c : centerSplitPane.getComponents()) { if (c instanceof TrackPanelScrollPane) { TrackPanelScrollPane tsp = (TrackPanelScrollPane) c; centerSplitPane.removeAll(); idx = 0; int divLoc = 0; for (String name : names) { centerSplitPane.add(panes.get(name)); if (idx < dividerLocations.length) { divLoc += panelHeights.get(name); centerSplitPane.setDividerLocations(dividerLocations); centerSplitPane.invalidate();
/** * Add divider if there are two panes side by side without a divider in between. */ protected void addExtraDividers() { int extra = 0; for (int i = 0; i < getComponentCount(); i++) { Component comp = getComponent(i); if (!(comp instanceof JideSplitPaneDivider)) { extra++; if (extra == 2) { add(createSplitPaneDivider(), JideSplitPaneLayout.FIX, i); if (_proportions != null && getPaneCount() == _proportions.length + 2) addProportion((i + 1) / 2); extra = 0; } } else extra = 0; } }
textArea1 = new SimpleTextEditor(); myActionPanel = new javax.swing.JPanel(); myBottomSplitPane = new com.jidesoft.swing.JideSplitPane(); myTableScrollPane = new javax.swing.JScrollPane(); myBottomSplitPane.setOrientation(0); myBottomSplitPane.setLayout(new java.awt.BorderLayout()); myBottomSplitPane.add(myTableScrollPane, java.awt.BorderLayout.CENTER);
/** * Add a new data panel set */ public synchronized TrackPanelScrollPane addDataPanel(String name) { final TrackPanel trackPanel = new TrackPanel(name, this); final TrackPanelScrollPane sp = new TrackPanelScrollPane(); Runnable runnable = () -> { sp.setViewportView(trackPanel); for (TrackPanel tp : getTrackPanels()) { tp.getScrollPane().minimizeHeight(); } // Insert the new panel just before the feature panel, or at the end if there is no feature panel. int featurePaneIdx = centerSplitPane.indexOfPane(featureTrackScrollPane); if (featurePaneIdx > 0) { centerSplitPane.insertPane(sp, featurePaneIdx); } else { centerSplitPane.add(sp); } if (!PreferencesManager.getPreferences().getAsBoolean(SHOW_SINGLE_TRACK_PANE_KEY)) { if (sp.getTrackPanel().getTracks().size() == 0) { //If the igv window is too small the divider won't exist and this causes an exception //We solved by setting a minimum size centerSplitPane.setDividerLocation(0, 3); } } }; UIUtilities.invokeAndWaitOnEventThread(runnable); return sp; }
if (getComponentCount() == 0) { if (_proportions != null) setProportions(null); return false; if (getComponent(0) instanceof JideSplitPaneDivider) { ((JideSplitPaneDivider) getComponent(0)).setJideSplitPane(null); remove(0); removeProportion(0); changed = true; for (int i = 0; i < getComponentCount(); i++) { Component comp = getComponent(i); if (comp instanceof JideSplitPaneDivider) { extra++; if (extra == 2) { comp = getComponent(i - 1); // remove the first one which was newly added ((JideSplitPaneDivider) comp).setJideSplitPane(null); remove(comp); if (_proportions != null && getPaneCount() == _proportions.length) removeProportion(i / 2); changed = true; extra--; if (extra == 1 && getComponent(getComponentCount() - 1) instanceof JideSplitPaneDivider) { // remove last one if it's a divider ((JideSplitPaneDivider) getComponent(getComponentCount() - 1)).setJideSplitPane(null); remove(getComponentCount() - 1); removeProportion((getComponentCount() + 1) / 2); changed = true;
centerSplitPane.setDividerSize(3); centerSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); centerSplitPane.add(dataTrackScrollPane, JSplitPane.TOP); if (!PreferencesManager.getPreferences().getAsBoolean(SHOW_SINGLE_TRACK_PANE_KEY)) { centerSplitPane.add(featureTrackScrollPane, JSplitPane.BOTTOM);
dockablePaneMap.put(DockablePaneKey.FLAGS, flagPixelInfoPane); multiSplitPane = new JideSplitPane(); multiSplitPane.setOrientation(JideSplitPane.VERTICAL_SPLIT); multiSplitPane.addPane(geolocInfoPane); multiSplitPane.addPane(scanLineInfoPane); multiSplitPane.addPane(tiePointGridPixelInfoPane); multiSplitPane.addPane(bandPixelInfoPane);
layoutManager = new JideSplitPaneLayout(this, JideSplitPaneLayout.Y_AXIS); Component[] components = getComponents(); LayoutManager oldManager = getLayout(); Map<Component,Object> constraintMap = null; if (oldManager instanceof JideSplitPaneLayout) { doLayout(); firePropertyChange(ORIENTATION_PROPERTY, oldOrientation, orientation);
/** * Sets this split pane to lay its constituents out proportionally if the given flag is true, or by preferred sizes * otherwise. * * @param proportionalLayout true or false. */ public void setProportionalLayout(boolean proportionalLayout) { if (proportionalLayout == _proportionalLayout) return; _proportionalLayout = proportionalLayout; revalidate(); firePropertyChange(PROPORTIONAL_LAYOUT_PROPERTY, !proportionalLayout, proportionalLayout); if (!proportionalLayout) setProportions(null); }
int htotal = centerSplitPane.getHeight(); int y = 0; int i = 0; for (Component c : centerSplitPane.getComponents()) { if (c instanceof TrackPanelScrollPane) { final TrackPanel trackPanel = ((TrackPanelScrollPane) c).getTrackPanel(); y += dh; centerSplitPane.setDividerLocation(i, y); i++;
/** * Lays out the <code>JideSplitPane</code> layout based on the preferred size children components, or based on the * proportions if proportional layout is on. This will likely result in changing the divider location. */ public void resetToPreferredSizes() { if (getLayout() instanceof JideBoxLayout) { boolean old = ((JideBoxLayout) getLayout()).isResetWhenInvalidate(); try { ((JideBoxLayout) getLayout()).setResetWhenInvalidate(true); ((JideBoxLayout) getLayout()).invalidateLayout(this); } finally { ((JideBoxLayout) getLayout()).setResetWhenInvalidate(old); } } doLayout(); }
/** * Adds a proportion at the given pane index, taking a proportional amount from each of the existing proportions. * * @param paneIndex the pane index. */ protected void addProportion(int paneIndex) { double[] oldProportions = _proportions; if (oldProportions == null) return; double[] newProportions = new double[oldProportions.length + 1]; double p = 1.0 / (newProportions.length + 1); double total = 1.0 - p; for (int i = 0; i < newProportions.length; ++i) { if (i == paneIndex) newProportions[i] = p; else { int j = (i < paneIndex) ? i : i - 1; if (j < oldProportions.length) newProportions[i] = oldProportions[j] * total; else newProportions[i] = p; } } setProportions(newProportions); }
/** * Return the image height required to paint this component with current options. This is used to size bitmap * images for offscreen drawing. * * @return */ public int getOffscreenImageHeight() { int height = centerSplitPane.getBounds().y; for (Component c : centerSplitPane.getComponents()) { if (c instanceof TrackPanelScrollPane) { TrackPanelScrollPane tsp = (TrackPanelScrollPane) c; //Skip if panel has no tracks if (tsp.getTrackPanel().getTracks().size() == 0) { continue; } int panelHeight = getOffscreenImagePanelHeight(tsp); Rectangle tspRect = new Rectangle(tsp.getBounds()); tspRect.height = panelHeight; height += tspRect.height; } else { height += c.getHeight(); } } // TODO Not sure why this is neccessary height += 35; return height; }
@Override public void doLayout() { if (log.isTraceEnabled()) { log.trace("Layout"); } super.doLayout(); //To change body of overridden methods use File | Settings | File Templates. } }
/** * Return an ordered list of TrackPanels. This method is provided primarily for storing sessions, where * TrackPanels need to be stored in proper order * * @return */ public java.util.List<TrackPanel> getTrackPanels() { ArrayList<TrackPanel> panels = new ArrayList<TrackPanel>(); for (Component c : centerSplitPane.getComponents()) { if (c instanceof TrackPanelScrollPane) { panels.add(((TrackPanelScrollPane) c).getTrackPanel()); } } return panels; }