/** * Set the flag indicating if JideScrollPane should keep the corner visible when it has corner components defined * even when the scroll bar is not visible. * * @param keepCornerVisible the flag */ public void setKeepCornerVisible(boolean keepCornerVisible) { if (_keepCornerVisible != keepCornerVisible) { boolean old = _keepCornerVisible; _keepCornerVisible = keepCornerVisible; firePropertyChange(PROPERTY_KEEP_CORNER_VISIBLE, old, _keepCornerVisible); invalidate(); doLayout(); } }
@Override public void setViewportView(Component trackSetView) { if (!(trackSetView instanceof TrackPanel)) { throw new IllegalArgumentException("Class TrackPanelScrollPane can only contain a TrackPanel"); } super.setViewportView(trackSetView); this.trackPanel = (TrackPanel) trackSetView; }
/** * Creates a sub-column-header viewport if necessary, sets its view, and then adds the sub-column-header viewport to * the scrollpane. * * @param view the component to display as the sub column header * @see #setSubColumnHeader(javax.swing.JViewport) * @see JViewport#setView(java.awt.Component) */ public void setSubColumnHeaderView(Component view) { if (null == getSubColumnHeader()) { setSubColumnHeader(createViewport()); } getSubColumnHeader().setView(view); }
public void setHorizontalScrollBarCoversWholeWidth(boolean horizontalScrollBarCoversWholeWidth) { boolean old = _horizontalScrollBarCoversWholeWidth; if (old != horizontalScrollBarCoversWholeWidth) { _horizontalScrollBarCoversWholeWidth = horizontalScrollBarCoversWholeWidth; firePropertyChange(PROPERTY_HORIZONTAL_SCROLL_BAR_COVERS_WHOLE_WIDTH, old, _horizontalScrollBarCoversWholeWidth); invalidate(); doLayout(); if (getHorizontalScrollBar() != null) { getHorizontalScrollBar().doLayout(); } } }
public void setVerticalScrollBarCoversWholeHeight(boolean verticalScrollBarCoversWholeHeight) { boolean old = _verticalScrollBarCoversWholeHeight; if (old != verticalScrollBarCoversWholeHeight) { _verticalScrollBarCoversWholeHeight = verticalScrollBarCoversWholeHeight; firePropertyChange(PROPERTY_VERTICAL_SCROLL_BAR_COVERS_WHOLE_HEIGHT, old, _verticalScrollBarCoversWholeHeight); invalidate(); doLayout(); if (getVerticalScrollBar() != null) { getVerticalScrollBar().doLayout(); } } }
/** * Creates a <code>JideScrollPane</code> that displays the view component in a viewport whose view position can be * controlled with a pair of scrollbars. The scrollbar policies specify when the scrollbars are displayed, For * example, if <code>vsbPolicy</code> is <code>VERTICAL_SCROLLBAR_AS_NEEDED</code> then the vertical scrollbar only * appears if the view doesn't fit vertically. The available policy settings are listed at {@link * #setVerticalScrollBarPolicy(int)} and {@link #setHorizontalScrollBarPolicy(int)}. * * @param view the component to display in the scrollpanes viewport * @param vsbPolicy an integer that specifies the vertical scrollbar policy * @param hsbPolicy an integer that specifies the horizontal scrollbar policy * @see #setViewportView(java.awt.Component) */ public JideScrollPane(Component view, int vsbPolicy, int hsbPolicy) { setLayout(new JideScrollPaneLayout.UIResource()); setVerticalScrollBarPolicy(vsbPolicy); setHorizontalScrollBarPolicy(hsbPolicy); setViewport(createViewport()); setVerticalScrollBar(createVerticalScrollBar()); setHorizontalScrollBar(createHorizontalScrollBar()); if (null != view) { setViewportView(view); } setOpaque(true); updateUI(); if (!getComponentOrientation().isLeftToRight()) { viewport.setViewPosition(new Point(Integer.MAX_VALUE, 0)); } }
/** * Removes the old sub column header, if it exists. If the new sub column header isn't <code>null</code>, sync the * x coordinate of the its viewPosition with the viewport (if there is one) and then add it to the scroll pane. * * @param subColumnHeader the new sub column header to be used; if <code>null</code> the old sub column header is * still removed and the new sub column header is set to <code>null</code> * @see #getSubColumnHeader() */ public void setSubColumnHeader(JViewport subColumnHeader) { JViewport old = getSubColumnHeader(); _subColumnHeader = subColumnHeader; if (null != subColumnHeader) { add(subColumnHeader, SUB_COLUMN_HEADER); } else if (null != old) { remove(old); } firePropertyChange("subColumnHeader", old, subColumnHeader); revalidate(); repaint(); if (old != null) { JideSwingUtilities.unsynchronizeView(old, getViewport()); JideSwingUtilities.unsynchronizeView(getViewport(), old); } if (_subColumnHeader != null) { JideSwingUtilities.synchronizeView(_subColumnHeader, getViewport(), SwingConstants.HORIZONTAL); JideSwingUtilities.synchronizeView(getViewport(), _subColumnHeader, SwingConstants.HORIZONTAL); } }
/** * Removes the old columnFooter, if it exists. If the new columnFooter isn't <code>null</code>, sync the x * coordinate of the its viewPosition with the viewport (if there is one) and then add it to the scrollpane. * * @param columnFooter the new column footer to be used; if <code>null</code> the old column footer is still removed * and the new columnFooter is set to <code>null</code> * @see #getColumnFooter * @see #setColumnFooterView(java.awt.Component) */ public void setColumnFooter(JViewport columnFooter) { JViewport old = getColumnFooter(); _columnFooter = columnFooter; if (null != columnFooter) { add(columnFooter, COLUMN_FOOTER); } else if (null != old) { remove(old); } firePropertyChange("columnFooter", old, columnFooter); revalidate(); repaint(); if (old != null) { JideSwingUtilities.unsynchronizeView(old, getViewport()); JideSwingUtilities.unsynchronizeView(getViewport(), old); } if (_columnFooter != null) { JideSwingUtilities.synchronizeView(_columnFooter, getViewport(), SwingConstants.HORIZONTAL); JideSwingUtilities.synchronizeView(getViewport(), _columnFooter, SwingConstants.HORIZONTAL); } }
/** * Removes the old rowFooter, if it exists. If the new rowFooter isn't <code>null</code>, syncs the y coordinate of * its viewPosition with the viewport (if there is one) and then adds it to the scrollpane. * * @param rowFooter the new row footer to be used; if <code>null</code> the old row footer is still removed and the * new rowFooter is set to <code>null</code> * @see #getRowFooter * @see #setRowFooterView(java.awt.Component) */ public void setRowFooter(JViewport rowFooter) { JViewport old = getRowFooter(); _rowFooter = rowFooter; if (null != rowFooter) { add(rowFooter, ROW_FOOTER); } else if (null != old) { remove(old); } firePropertyChange("rowFooter", old, rowFooter); revalidate(); repaint(); if (old != null) { JideSwingUtilities.unsynchronizeView(old, getViewport()); JideSwingUtilities.unsynchronizeView(getViewport(), old); } if (rowFooter != null) { JideSwingUtilities.synchronizeView(rowFooter, getViewport(), SwingConstants.VERTICAL); JideSwingUtilities.synchronizeView(getViewport(), rowFooter, SwingConstants.VERTICAL); } }
@Override public void setCorner(String key, Component corner) { if (key == null) { return; } if (key.equals(SUB_UPPER_LEFT) || key.equals(SUB_UPPER_RIGHT)) { Component old; if (key.equals(SUB_UPPER_LEFT)) { old = _subUpperLeft; _subUpperLeft = corner; } else { old = _subUpperRight; _subUpperRight = corner; } if (old != null) { remove(old); } if (corner != null) { add(corner, key); } firePropertyChange(key, old, corner); revalidate(); repaint(); return; } super.setCorner(key, corner); }
public JComponent createHintsComponent() { JPanel panel = new JPanel(new BorderLayout()); _list = createList(); new Sticky(_list); _scroll = new JideScrollPane(getList()); getList().setFocusable(false); _scroll.setHorizontalScrollBarPolicy(JideScrollPane.HORIZONTAL_SCROLLBAR_NEVER); _scroll.setBorder(BorderFactory.createEmptyBorder()); _scroll.getVerticalScrollBar().setFocusable(false); _scroll.getHorizontalScrollBar().setFocusable(false); panel.add(_scroll, BorderLayout.CENTER); return panel; }
@Override public void syncWithScrollPane(JScrollPane sp) { super.syncWithScrollPane(sp); if (sp instanceof JideScrollPane) { _rowFoot = ((JideScrollPane) sp).getRowFooter(); _colFoot = ((JideScrollPane) sp).getColumnFooter(); _subColHead = ((JideScrollPane) sp).getSubColumnHeader(); _hLeft = ((JideScrollPane) sp).getScrollBarCorner(HORIZONTAL_LEFT); _hRight = ((JideScrollPane) sp).getScrollBarCorner(HORIZONTAL_RIGHT); _vTop = ((JideScrollPane) sp).getScrollBarCorner(VERTICAL_TOP); _vBottom = ((JideScrollPane) sp).getScrollBarCorner(VERTICAL_BOTTOM); _subUpperLeft = sp.getCorner(SUB_UPPER_LEFT); _subUpperRight = sp.getCorner(SUB_UPPER_RIGHT); } }
/** * Creates a row-footer viewport if necessary, sets its view and then adds the row-footer viewport to the * scrollpane. For example: * <pre> * JScrollPane scrollpane = new JideScrollPane(); * scrollpane.setViewportView(myBigComponentToScroll); * scrollpane.setRowFooterView(myBigComponentsRowFooter); * </pre> * * @param view the component to display as the row footer * @see #setRowFooter(javax.swing.JViewport) * @see JViewport#setView(java.awt.Component) */ public void setRowFooterView(Component view) { if (null == getRowFooter()) { setRowFooter(createViewport()); } getRowFooter().setView(view); }
/** * Creates a column-footer viewport if necessary, sets its view, and then adds the column-footer viewport to the * scrollpane. For example: * <pre> * JScrollPane scrollpane = new JideScrollPane(); * scrollpane.setViewportView(myBigComponentToScroll); * scrollpane.setColumnFooterView(myBigComponentsColumnFooter); * </pre> * * @param view the component to display as the column footer * @see #setColumnFooter(javax.swing.JViewport) * @see JViewport#setView(java.awt.Component) */ public void setColumnFooterView(Component view) { if (null == getColumnFooter()) { setColumnFooter(createViewport()); } getColumnFooter().setView(view); }
@Override public JComponent createControl() { final JScrollPane productTreeScrollPane = new JideScrollPane(productTree); // <JIDE> productTreeScrollPane.setPreferredSize(new Dimension(320, 480)); productTreeScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); productTreeScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); productTreeScrollPane.setBorder(null); productTreeScrollPane.setViewportBorder(null); return productTreeScrollPane; }
@Override public void doLayout() { log.trace("Layout"); super.doLayout(); trackPanel.revalidate(); //trackPanel.doLayout(); }
boolean isLeftToRight = getComponentOrientation().isLeftToRight(); if (key.equals(HORIZONTAL_LEADING)) { key = isLeftToRight ? HORIZONTAL_LEFT : HORIZONTAL_RIGHT; remove(old); add(corner, key); if (corner != null) corner.setComponentOrientation(getComponentOrientation()); firePropertyChange(key, old, corner); revalidate(); repaint();
indexPanel.add(new JideScrollPane(list), BorderLayout.CENTER); indexPanel.setOpaque(false); return indexPanel;
/** * Sets the flag if the bottom-right, bottom-left corner and the column footer will have the same height or * different heights. * * @param columnFootersHeightUnified true or false. */ public void setColumnFootersHeightUnified(boolean columnFootersHeightUnified) { boolean old = _columnFootersHeightUnified; if (old != columnFootersHeightUnified) { _columnFootersHeightUnified = columnFootersHeightUnified; firePropertyChange(PROPERTY_COLUMN_FOOTERS_HEIGHT_UNIFIED, old, _horizontalScrollBarCoversWholeWidth); invalidate(); doLayout(); } }