- private int getTimeAxisOffset() {
- return fTreeViewer.getControl().getSize().x + fSashForm.getSashWidth() + fXYViewer.getPointAreaOffset();
- }
-
- /**
- * @since 1.0
- */
- @Override
- public int getAvailableWidth(int requestedOffset) {
- int pointAreaWidth = fXYViewer.getPointAreaWidth();
- int curTimeAxisOffset = getTimeAxisOffset();
- if (pointAreaWidth <= 0) {
- pointAreaWidth = fSashForm.getBounds().width - curTimeAxisOffset;
- }
- int endOffset = curTimeAxisOffset + pointAreaWidth;
- GridLayout layout = (GridLayout) fXYViewerContainer.getLayout();
- int endOffsetWithoutMargin = endOffset + layout.marginRight;
- int availableWidth = endOffsetWithoutMargin - requestedOffset;
- availableWidth = Math.min(fSashForm.getBounds().width, Math.max(0, availableWidth));
- return availableWidth;
- }
-
- /**
- * @since 1.0
- */
- @Override
- public void performAlign(int offset, int width) {
- int total = fSashForm.getBounds().width;
- int plotAreaOffset = fXYViewer.getPointAreaOffset();
- int width1 = Math.max(0, offset - plotAreaOffset - fSashForm.getSashWidth());
- int width2 = Math.max(0, total - width1 - fSashForm.getSashWidth());
- if (width1 >= 0 && width2 > 0 || width1 > 0 && width2 >= 0) {
- fSashForm.setWeights(new int[] { width1, width2 });
- fSashForm.layout();
- }
-
- Composite composite = fXYViewerContainer;
- GridLayout layout = (GridLayout) composite.getLayout();
- int timeAxisWidth = getAvailableWidth(offset);
- int marginSize = timeAxisWidth - width;
- layout.marginRight = Math.max(0, marginSize);
- composite.layout();
- }