use of javax.swing.JViewport in project jgnash by ccavanaugh.
the class JideScrollPane method setViewport.
@Override
public void setViewport(JViewport viewport) {
JViewport old = getViewport();
super.setViewport(viewport);
if (old != null) {
if (rowHeader != null) {
JideSwingUtilities.unsynchronizeView(rowHeader, old);
}
if (_rowFooter != null) {
JideSwingUtilities.unsynchronizeView(_rowFooter, old);
JideSwingUtilities.unsynchronizeView(old, _rowFooter);
}
if (_columnFooter != null) {
JideSwingUtilities.unsynchronizeView(_columnFooter, old);
JideSwingUtilities.unsynchronizeView(old, _columnFooter);
}
if (columnHeader != null) {
JideSwingUtilities.unsynchronizeView(columnHeader, old);
}
}
if (viewport != null) {
if (rowHeader != null) {
JideSwingUtilities.synchronizeView(rowHeader, getViewport(), SwingConstants.VERTICAL);
}
if (_rowFooter != null) {
JideSwingUtilities.synchronizeView(_rowFooter, getViewport(), SwingConstants.VERTICAL);
JideSwingUtilities.synchronizeView(getViewport(), _rowFooter, SwingConstants.VERTICAL);
}
if (_columnFooter != null) {
JideSwingUtilities.synchronizeView(_columnFooter, getViewport(), SwingConstants.HORIZONTAL);
JideSwingUtilities.synchronizeView(getViewport(), _columnFooter, SwingConstants.HORIZONTAL);
}
if (columnHeader != null) {
JideSwingUtilities.synchronizeView(columnHeader, getViewport(), SwingConstants.HORIZONTAL);
}
}
}
use of javax.swing.JViewport in project jgnash by ccavanaugh.
the class JideScrollPane method setRowHeader.
/**
* Override setRowHeader method in JScrollPane and synchronize the view with the main viewport. Swing tried to
* implement this feature but it will break if the view position changes starts from rowHeader.
*
* @param rowHeader the new row header
*/
@Override
public void setRowHeader(JViewport rowHeader) {
JViewport old = getRowHeader();
super.setRowHeader(rowHeader);
if (old != null) {
JideSwingUtilities.unsynchronizeView(old, getViewport());
JideSwingUtilities.unsynchronizeView(getViewport(), old);
}
if (getRowHeader() != null) {
JideSwingUtilities.synchronizeView(getRowHeader(), getViewport(), SwingConstants.VERTICAL);
JideSwingUtilities.synchronizeView(getViewport(), getRowHeader(), SwingConstants.VERTICAL);
}
}
use of javax.swing.JViewport in project jgnash by ccavanaugh.
the class JideScrollPane method setColumnFooter.
/**
* Removes the old columnFooter, if it exists. If the new columnFooter isn't {@code null}, 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} the old column footer is still removed
* and the new columnFooter is set to {@code null}
* @see #getColumnFooter
* @see #setColumnFooterView(java.awt.Component)
*/
private void setColumnFooter(final 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);
}
}
Aggregations