Java 类org.eclipse.swt.widgets.Sash 实例源码

项目:http4e    文件:LiveSashForm.java   
private Control[] getControls(boolean onlyVisible)
{
  Control[] children = getChildren();
  Control[] result = new Control[0];
  for (int i = 0; i < children.length; i++)
  {
    if (children[i] instanceof Sash)
      continue;
    if (onlyVisible && !children[i].getVisible())
      continue;

    Control[] newResult = new Control[result.length + 1];
    System.arraycopy(result, 0, newResult, 0, result.length);
    newResult[result.length] = children[i];
    result = newResult;
  }
  return result;
}
项目:http4e    文件:UrbanSashForm.java   
Control[] getControls( boolean onlyVisible){
    Control[] children = getChildren();
    Control[] result = new Control[0];
    for (int i = 0; i < children.length; i++) {
        if (children[i] instanceof Sash)
            continue;
        if (onlyVisible && !children[i].getVisible())
            continue;

        Control[] newResult = new Control[result.length + 1];
        System.arraycopy(result, 0, newResult, 0, result.length);
        newResult[result.length] = children[i];
        result = newResult;
    }
    return result;
}
项目:http4e    文件:UrbanSashForm.java   
/**
 * If orientation is SWT.HORIZONTAL, lay the controls in the SashForm out
 * side by side. If orientation is SWT.VERTICAL, lay the controls in the
 * SashForm out top to bottom.
 * 
 * @param orientation
 *            SWT.HORIZONTAL or SWT.VERTICAL
 * 
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been
 *                disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the receiver</li>
 *                <li>ERROR_INVALID_ARGUMENT - if the value of orientation
 *                is not SWT.HORIZONTAL or SWT.VERTICAL
 *                </ul>
 */
public void setOrientation( int orientation){
    checkWidget();
    if (getOrientation() == orientation)
        return;
    if (orientation != SWT.HORIZONTAL && orientation != SWT.VERTICAL) {
        SWT.error(SWT.ERROR_INVALID_ARGUMENT);
    }
    sashStyle &= ~(SWT.HORIZONTAL | SWT.VERTICAL);
    sashStyle |= orientation == SWT.VERTICAL ? SWT.HORIZONTAL
            : SWT.VERTICAL;
    for (int i = 0; i < sashes.length; i++) {
        sashes[i].dispose();
        sashes[i] = new Sash(this, sashStyle);
        sashes[i].setBackground(background);
        sashes[i].setForeground(foreground);
        sashes[i].addListener(SWT.Selection, sashListener);
    }
    layout(false);
}
项目:mytourbook    文件:DialogMPWms.java   
private void createUIContainer(final Composite parent) {

        final Composite container = new Composite(parent, SWT.NONE);
        container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
        // dlgContainer.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
        {
            // left part (layer selection)
            _leftContainer = new Composite(container, SWT.NONE);
            GridLayoutFactory.fillDefaults().extendedMargins(0, 5, 0, 0).applyTo(_leftContainer);
            createUILayer(_leftContainer);

            // sash
            final Sash sash = new Sash(container, SWT.VERTICAL);
            net.tourbook.common.UI.addSashColorHandler(sash);

            // right part (map)
            final Composite mapContainer = new Composite(container, SWT.NONE);
            GridLayoutFactory.fillDefaults().extendedMargins(5, 0, 0, 0).spacing(0, 0).applyTo(mapContainer);
            createUIMap(mapContainer);

            _detailForm = new ViewerDetailForm(container, _leftContainer, sash, mapContainer, 30);
        }
    }
项目:mytourbook    文件:DialogMPProfile.java   
private void createUI100Container(final Composite parent) {

        final Composite container = new Composite(parent, SWT.NONE);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(container);
        container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
        {
            // left part (layer selection)
            _leftContainer = new Composite(container, SWT.NONE);
            GridLayoutFactory.fillDefaults().extendedMargins(0, 5, 0, 0).applyTo(_leftContainer);
            createUI110LeftContainer(_leftContainer);

            // sash
            final Sash sash = new Sash(container, SWT.VERTICAL);
            net.tourbook.common.UI.addSashColorHandler(sash);

            // right part (map)
            final Composite mapContainer = new Composite(container, SWT.NONE);
            GridLayoutFactory.fillDefaults().extendedMargins(5, 0, 0, 0).spacing(0, 0).applyTo(mapContainer);
            createUI180Map(mapContainer);

            _detailForm = new ViewerDetailForm(container, _leftContainer, sash, mapContainer, 30);
        }
    }
项目:mytourbook    文件:DialogMPCustom.java   
private void createUI100Container(final Composite parent) {

        final Composite container = new Composite(parent, SWT.NONE);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(container);
        container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
        {
            // left part (layer selection)
            _leftContainer = new Composite(container, SWT.NONE);
            GridLayoutFactory.fillDefaults().extendedMargins(0, 5, 0, 0).applyTo(_leftContainer);
            createUI200LeftPart(_leftContainer);

            // sash
            final Sash sash = new Sash(container, SWT.VERTICAL);
            net.tourbook.common.UI.addSashColorHandler(sash);

            // right part (map)
            final Composite mapContainer = new Composite(container, SWT.NONE);
            GridLayoutFactory.fillDefaults().extendedMargins(5, 0, 0, 0).spacing(0, 0).applyTo(mapContainer);
            createUI300Map(mapContainer);

            _detailForm = new ViewerDetailForm(container, _leftContainer, sash, mapContainer, 30);
        }
    }
项目:mytourbook    文件:DialogMPWms.java   
private void createUIContainer(final Composite parent, final PixelConverter pixelConverter) {

        final Composite container = new Composite(parent, SWT.NONE);
        container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
        // dlgContainer.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
        {
            // left part (layer selection)
            _leftContainer = new Composite(container, SWT.NONE);
            GridLayoutFactory.fillDefaults().extendedMargins(0, 5, 0, 0).applyTo(_leftContainer);
            createUILayer(_leftContainer, pixelConverter);

            // sash
            final Sash sash = new Sash(container, SWT.VERTICAL);
            net.tourbook.util.UI.addSashColorHandler(sash);

            // right part (map)
            final Composite mapContainer = new Composite(container, SWT.NONE);
            GridLayoutFactory.fillDefaults().extendedMargins(5, 0, 0, 0).spacing(0, 0).applyTo(mapContainer);
            createUIMap(mapContainer, pixelConverter);

            _detailForm = new ViewerDetailForm(container, _leftContainer, sash, mapContainer, 30);
        }
    }
项目:mytourbook    文件:DialogMPProfile.java   
private void createUI100Container(final Composite parent, final PixelConverter pixelConverter) {

        final Composite container = new Composite(parent, SWT.NONE);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(container);
        container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
        {
            // left part (layer selection)
            _leftContainer = new Composite(container, SWT.NONE);
            GridLayoutFactory.fillDefaults().extendedMargins(0, 5, 0, 0).applyTo(_leftContainer);
            createUI110LeftContainer(_leftContainer, pixelConverter);

            // sash
            final Sash sash = new Sash(container, SWT.VERTICAL);
            net.tourbook.util.UI.addSashColorHandler(sash);

            // right part (map)
            final Composite mapContainer = new Composite(container, SWT.NONE);
            GridLayoutFactory.fillDefaults().extendedMargins(5, 0, 0, 0).spacing(0, 0).applyTo(mapContainer);
            createUI180Map(mapContainer, pixelConverter);

            _detailForm = new ViewerDetailForm(container, _leftContainer, sash, mapContainer, 30);
        }
    }
项目:mytourbook    文件:DialogMPCustom.java   
private void createUI100Container(final Composite parent, final PixelConverter pixelConverter) {

        final Composite container = new Composite(parent, SWT.NONE);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(container);
        container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
        {
            // left part (layer selection)
            _leftContainer = new Composite(container, SWT.NONE);
            GridLayoutFactory.fillDefaults().extendedMargins(0, 5, 0, 0).applyTo(_leftContainer);
            createUI200LeftPart(_leftContainer, pixelConverter);

            // sash
            final Sash sash = new Sash(container, SWT.VERTICAL);
            net.tourbook.util.UI.addSashColorHandler(sash);

            // right part (map)
            final Composite mapContainer = new Composite(container, SWT.NONE);
            GridLayoutFactory.fillDefaults().extendedMargins(5, 0, 0, 0).spacing(0, 0).applyTo(mapContainer);
            createUI300Map(mapContainer, pixelConverter);

            _detailForm = new ViewerDetailForm(container, _leftContainer, sash, mapContainer, 30);
        }
    }
项目:jo-widgets    文件:JoSashForm.java   
public JoSashForm(final Composite parent, final ISplitCompositeSetupSpi setup) {
    super(parent, getSashFormStyle(setup));
    resizePolicy = setup.getResizePolicy();
    sashUtil = getSashUtil(setup);
    layout = new JoSashFormLayout(this, sashUtil);
    setLayout(layout);

    sash = new Sash(this, getSashStyle(setup));
    sash.setToolTipText(getToolTipText());
    sash.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(final Event event) {
            if (event.detail == SWT.DRAG) {
                return;
            }
            onDragSash(event);
        }
    });

    firstMinSize = new Point(SPLIT_MINIMUM, SPLIT_MINIMUM);
    secondMinSize = new Point(SPLIT_MINIMUM, SPLIT_MINIMUM);
}
项目:gef-gwt    文件:Splitter.java   
private Control[] getControls(boolean onlyVisible) {
    Control[] children = getChildren();
    Control[] controls = new Control[0];
    for (int i = 0; i < children.length; i++) {
        if (children[i] instanceof Sash)
            continue;
        if (onlyVisible && !children[i].getVisible())
            continue;

        Control[] newControls = new Control[controls.length + 1];
        System.arraycopy(controls, 0, newControls, 0, controls.length);
        newControls[controls.length] = children[i];
        controls = newControls;
    }
    return controls;
}
项目:gef-gwt    文件:Splitter.java   
void paint(Sash sash, GC gc) {
    if (getSashWidth() == 0)
        return;
    Point size = sash.getSize();
    if (getOrientation() == SWT.HORIZONTAL) {
        gc.setForeground(ColorConstants.buttonDarker);
        gc.drawLine(getSashWidth() - 1, 0, getSashWidth() - 1, size.y);
        gc.setForeground(ColorConstants.buttonLightest);
        gc.drawLine(0, 0, 0, size.y);
    } else {
        gc.setForeground(ColorConstants.buttonDarker);
        gc.drawLine(0, 0, size.x, 0);
        gc.drawLine(0, getSashWidth() - 1, size.x, getSashWidth() - 1);
        gc.setForeground(ColorConstants.buttonLightest);
        gc.drawLine(0, 1, size.x, 1);
    }
}
项目:gef-gwt    文件:Splitter.java   
/**
 * If orientation is SWT.HORIZONTAL, lay the controls in the SashForm out
 * side by side. If orientation is SWT.VERTICAL, lay the controls in the
 * SashForm out top to bottom.
 */
public void setOrientation(int orientation) {
    if (this.orientation == orientation)
        return;
    if (orientation != SWT.HORIZONTAL && orientation != SWT.VERTICAL) {
        SWT.error(SWT.ERROR_INVALID_ARGUMENT);
    }
    this.orientation = orientation;

    int sashOrientation = (orientation == SWT.HORIZONTAL) ? SWT.VERTICAL
            : SWT.HORIZONTAL;
    for (int i = 0; i < sashes.length; i++) {
        sashes[i].dispose();
        sashes[i] = new Sash(this, sashOrientation);
        sashes[i].setBackground(ColorConstants.buttonLightest);
        sashes[i].addListener(SWT.Selection, sashListener);
    }
    layout();
}
项目:SPELL    文件:SplitPanel.java   
/***************************************************************************
 * Create the main parts of the control
 **************************************************************************/
private void createSections()
{
    m_presentationSection = new Composite(this, SWT.NONE);
    m_presentationSection.setLayoutData(new GridData(GridData.FILL_BOTH));

    m_sash = new Sash(this, SWT.BORDER | SWT.HORIZONTAL );

    m_controlSection = new Composite(this, SWT.BORDER);
    m_controlSection.setLayoutData(new GridData(GridData.FILL_BOTH));

}
项目:PDFReporter-Studio    文件:CSashForm.java   
private void saveChildControlSizes() {
    // Save control sizes
    Control[] children = getChildren();
    int iChildToSave = 0;
    for (int i = 0; i < children.length && iChildToSave < 2; i++) {
        Control child = children[i];
        if (!(child instanceof Sash)) {
            currentSashInfo.savedSizes[iChildToSave] = child.getSize();
            iChildToSave++;
        }
    }
}
项目:PDFReporter-Studio    文件:CSashForm.java   
protected Sash getSash() {
    Control[] kids = getChildren();
    for (int i = 0; i < kids.length; i++) {
        if (kids[i] instanceof Sash)
            return (Sash) kids[i];
    }
    return null;
}
项目:mytourbook    文件:DialogMarker.java   
private Composite createUI_10_LeftPart(final Composite parent) {

        final Composite container = new Composite(parent, SWT.NONE);
        GridDataFactory.fillDefaults()//
                .grab(true, true)
                .applyTo(container);
        GridLayoutFactory.fillDefaults()//
                .extendedMargins(5, 5, 0, 0)
                .applyTo(container);
        {
            final Composite sashContainer = new Composite(container, SWT.NONE);
            GridDataFactory.fillDefaults()//
                    .grab(true, true)
                    .applyTo(sashContainer);

            {
                // top part
                final Composite flexiblePart = createUI_40_MarkerList(sashContainer);

                // sash
                final Sash sash = new Sash(sashContainer, SWT.HORIZONTAL);
                UI.addSashColorHandler(sash);

                // bottom part
                _innerFixedPart = createUI_50_MarkerDetails(sashContainer);

                _sashInnerForm = new SashBottomFixedForm(//
                        sashContainer,
                        flexiblePart,
                        sash,
                        _innerFixedPart);
            }
        }

        return container;
    }
项目:mytourbook    文件:WizardPage_10_CompareTour.java   
private Composite createUI(final Composite parent) {

        final Composite container = new Composite(parent, SWT.NONE);
        GridLayoutFactory.fillDefaults().applyTo(container);
//      container.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW));
        {
            /*
             * create master detail layout
             */
            final Composite detailContainer = new Composite(container, SWT.NONE);
            GridDataFactory.fillDefaults().grab(true, true).applyTo(detailContainer);
//          detailContainer.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_GREEN));
            {
                final Control viewer = createUI_10_TourViewer(detailContainer);
                final Sash sash = new Sash(detailContainer, SWT.VERTICAL);
                final Composite tourChart = createUI_50_TourChart(parent, detailContainer);

                _viewerDetailForm = new SashLeftFixedForm(detailContainer, viewer, sash, tourChart);
            }
            {
                _chkSelectAll = new Button(container, SWT.CHECK);
                _chkSelectAll.setText(Messages.tourCatalog_wizard_Action_select_all_tours);
                _chkSelectAll.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent e) {
                        enableTours(_chkSelectAll.getSelection());
                        validatePage();
                    }
                });
            }
        }

        return container;
    }
项目:mytourbook    文件:PicDirView.java   
private void createUI(final Composite parent) {

        _picDirImages = new PicDirImages(this, _state);
        _picDirFolder = new PicDirFolder(this, _picDirImages, _state);

        final Composite masterDetailContainer = new Composite(parent, SWT.NONE);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(masterDetailContainer);
        GridLayoutFactory.fillDefaults().applyTo(masterDetailContainer);
        {
            // file folder
            _containerFolder = new Composite(masterDetailContainer, SWT.NONE);
            GridDataFactory.fillDefaults().applyTo(_containerFolder);
            GridLayoutFactory.fillDefaults().spacing(0, 0).applyTo(_containerFolder);
            {
                _picDirFolder.createUI(_containerFolder);
            }

            // sash
            final Sash sash = new Sash(masterDetailContainer, SWT.VERTICAL);

            // photos
            _containerImages = new Composite(masterDetailContainer, SWT.NONE);
            GridDataFactory.fillDefaults().applyTo(_containerImages);
            GridLayoutFactory.fillDefaults().applyTo(_containerImages);
//          _containerImages.setLayout(new FillLayout());
            {
                _picDirImages.createUI(_containerImages, _picDirFolder);
            }

            // master/detail form
            _containerMasterDetail = new SashLeftFixedForm(
                    masterDetailContainer,
                    _containerFolder,
                    sash,
                    _containerImages);
        }
    }
项目:birt    文件:AbstractPropertyDialog.java   
protected Control createDialogArea( Composite parent )
{
    Composite composite = new Composite( parent, SWT.NONE );
    composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
    GridLayout layout = new GridLayout( );
    layout.numColumns = 1;
    layout.marginWidth = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_MARGIN );
    layout.marginHeight = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_MARGIN );
    layout.verticalSpacing = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_SPACING );
    composite.setLayout( layout );

    container = new Composite( composite, SWT.NONE );
    layout = new GridLayout( );
    layout.numColumns = 3;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.horizontalSpacing = 2;
    container.setLayout( layout );
    container.setLayoutData( new GridData( GridData.FILL_BOTH ) );

    treeViewer = createTreeViewer( container );
    treeViewer.setLayoutData( new GridData( GridData.FILL_VERTICAL ) );
    Sash sash = createSash( container );
    pageContainer = createPropertyPane( container );
    pageContainer.setLayoutData( new GridData( GridData.FILL_BOTH ) );
    addDragListerner( sash, container, treeViewer, pageContainer );

    Label label = new Label( composite, SWT.HORIZONTAL | SWT.SEPARATOR );
    label.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );

    initTreeSelection( );

    return composite;
}
项目:Mailster    文件:ConfigurationDialog.java   
/**
 * Create the <code>Sash</code>with left control on the left. Note that
 * this method assumes <code>GridData</code> for the layout data of the
 * leftControl.
 * 
 * @param composite the <code>Composite</code> to embed the
 *            <code>Sash</code> into
 * @param leftControl the <code>Control</code> at the left side of the
 *            <code>Sash</code>
 * @return Sash the created <code>Sash</code>
 */
protected Sash createSash(final Composite composite,
        final Control leftControl)
{
    final Sash sash = new Sash(composite, SWT.VERTICAL);
    sash.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    sash.setBackground(composite.getDisplay().getSystemColor(
            SWT.COLOR_LIST_BACKGROUND));
    sash.addListener(SWT.Selection, new Listener() 
    {
        public void handleEvent(Event event)
        {
            if (event.detail == SWT.DRAG)
                return;

            int shift = event.x - sash.getBounds().x;
            GridData data = (GridData) leftControl.getLayoutData();
            int newWidthHint = data.widthHint + shift;
            int maxSize = getPageContainer().getSize().x / 2;
            if (newWidthHint > maxSize || newWidthHint < 70)
            {
                event.doit = false;
                return;
            }
            data.widthHint = newWidthHint;
            composite.layout(true);
        }
    });
    return (sash);
}
项目:cogtool    文件:SashUtility.java   
public SashAdjustment(Composite p,
                      int leftMin,
                      int rightMin,
                      Sash s,
                      FormData sashFormData,
                      int sashPct)
{
    parent = p;
    leftMinSize = leftMin;
    rightMinSize = rightMin;
    sash = s;
    sashData = sashFormData;
    sashPercentage = sashPct;
}
项目:RxSWT    文件:SelectionAdapter.java   
static SelectionAdapter create(Widget widget) {
    if (widget instanceof Button) {
        return create((Button) widget);
    } else if (widget instanceof CCombo) {
        return create((CCombo) widget);
    } else if (widget instanceof Combo) {
        return create((Combo) widget);
    } else if (widget instanceof CoolItem) {
        return create((CoolItem) widget);
    } else if (widget instanceof CTabFolder) {
        return create((CTabFolder) widget);
    } else if (widget instanceof DateTime) {
        return create((DateTime) widget);
    } else if (widget instanceof Link) {
        return create((Link) widget);
    } else if (widget instanceof List) {
        return create((List) widget);
    } else if (widget instanceof MenuItem) {
        return create((MenuItem) widget);
    } else if (widget instanceof Sash) {
        return create((Sash) widget);
    } else if (widget instanceof Scale) {
        return create((Scale) widget);
    } else if (widget instanceof Slider) {
        return create((Slider) widget);
    } else if (widget instanceof Spinner) {
        return create((Spinner) widget);
    } else if (widget instanceof StyledText) {
        return create((StyledText) widget);
    } else if (widget instanceof TabFolder) {
        return create((TabFolder) widget);
    } else if (widget instanceof Table) {
        return create((Table) widget);
    } else if (widget instanceof TableColumn) {
        return create((TableColumn) widget);
    } else if (widget instanceof TableCursor) {
        return create((TableCursor) widget);
    } else if (widget instanceof Text) {
        return create((Text) widget);
    } else if (widget instanceof ToolItem) {
        return create((ToolItem) widget);
    } else if (widget instanceof ToolTip) {
        return create((ToolTip) widget);
    } else if (widget instanceof TrayItem) {
        return create((TrayItem) widget);
    } else if (widget instanceof Tree) {
        return create((Tree) widget);
    } else if (widget instanceof TreeColumn) {
        return create((TreeColumn) widget);
    } else if (widget instanceof TreeCursor) {
        return create((TreeCursor) widget);
    }

    throw new IllegalArgumentException("The given widget (" + widget.getClass().getName() + ") is not supported.");
}
项目:depan    文件:Sasher.java   
/**
 * Initialize the sasher, with the two given contained controls, the style,
 * {@link SWT#VERTICAL} or {@link SWT#HORIZONTAL}, and the percentage of
 * space initially used by the first Control.
 *
 * @param first first control (top or left)
 * @param second second control (down or right)
 * @param sasherStyle {@link SWT#VERTICAL} or {@link SWT#HORIZONTAL}.
 * @param percent percentage of space initially used by the first Control
 */
public void init(Control first, Control second,
    int sasherStyle, int percent) {
  this.sashStyle = sasherStyle;

  sash = new Sash(this, sashStyle);

  // create position instructions
  FormData firstData = new FormData();
  final FormData sashData = new FormData();
  FormData secondData = new FormData();

  // setup constant positions
  firstData.left = new FormAttachment(0);
  firstData.top = new FormAttachment(0);
  sashData.left = new FormAttachment(0);
  sashData.top = new FormAttachment(percent);
  secondData.right = new FormAttachment(100);
  secondData.bottom = new FormAttachment(100);

  // setup direction dependent positions
  if (isVertical()) { // horizontal == top/down
    firstData.right = new FormAttachment(sash);
    firstData.bottom = new FormAttachment(100);
    sashData.bottom = new FormAttachment(100);
    secondData.left = new FormAttachment(sash);
    secondData.top = new FormAttachment(0);
  } else {
    firstData.right = new FormAttachment(100);
    firstData.bottom = new FormAttachment(sash);
    sashData.right = new FormAttachment(100);
    secondData.left = new FormAttachment(0);
    secondData.top = new FormAttachment(sash);
  }

  // set the layouts
  first.setLayoutData(firstData);
  sash.setLayoutData(sashData);
  second.setLayoutData(secondData);

  // move event / constraints:
  sash.addListener(SWT.Selection, new Listener() {

    @Override
    public void handleEvent(Event e) {
      if (isVertical()) {
        resizeVertical(e, sashData);
      } else {
        resizeHorizontal(e, sashData);
      }
    }
  });
}
项目:PDFReporter-Studio    文件:CSashForm.java   
public SashInfo(Sash sash) {
    this.sash = sash;
}
项目:mytourbook    文件:DialogMarker.java   
private void createUI(final Composite parent) {

        _pc = new PixelConverter(parent);

        final Composite shellContainer = new Composite(parent, SWT.NONE);
        GridDataFactory.fillDefaults()//
                .grab(true, true)
//              .hint(_pc.convertWidthInCharsToPixels(150), _pc.convertHeightInCharsToPixels(40))
                .applyTo(shellContainer);
        GridLayoutFactory.swtDefaults().applyTo(shellContainer);
        {
            final Composite sashContainer = new Composite(shellContainer, SWT.NONE);
            GridDataFactory.fillDefaults()//
                    .grab(true, true)
                    .applyTo(sashContainer);
            GridLayoutFactory.swtDefaults().applyTo(sashContainer);
            {
                // left part
                _outerFixedPart = createUI_10_LeftPart(sashContainer);

                // sash
                final Sash sash = new Sash(sashContainer, SWT.VERTICAL);
                UI.addSashColorHandler(sash);

                // right part
                final Composite chartContainer = createUI_20_RightPart(sashContainer);

                _sashOuterForm = new SashLeftFixedForm(//
                        sashContainer,
                        _outerFixedPart,
                        sash,
                        chartContainer,
                        50);
            }

            createUI_90_MarkerActions(shellContainer);

            /*
             * !!! UI must be restored and column image size must be set before columns are
             * equalized, otherwise the column height is wrong !!!
             */
            restoreState();

//          // set column image (row) height
//          onResizeImageColumn();

            // compute width for all controls and equalize column width for the different sections
            sashContainer.layout(true, true);
            UI.setEqualizeColumWidths(_firstColumnControls, _pc.convertWidthInCharsToPixels(2));
        }
    }
项目:mytourbook    文件:SlideoutTourFilter.java   
private void createUI(final Composite parent) {

        final Composite shellContainer = new Composite(parent, SWT.NONE);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(shellContainer);
        GridLayoutFactory.fillDefaults().applyTo(shellContainer);
        {
            final Composite container = new Composite(shellContainer, SWT.NONE);
            GridDataFactory
                    .fillDefaults()//
                    .grab(true, true)
                    .applyTo(container);
            GridLayoutFactory.swtDefaults().applyTo(container);
            {
                // left part
                _containerProfiles = createUI_200_Profiles(container);

                // sash
                final Sash sash = new Sash(container, SWT.VERTICAL);
                {
                    UI.addSashColorHandler(sash);

                    // save sash width
                    sash.addMouseListener(new MouseAdapter() {
                        @Override
                        public void mouseUp(final MouseEvent e) {
                            _state.put(STATE_SASH_WIDTH, _containerProfiles.getSize().x);
                        }
                    });
                }

                // right part
                _containerFilter = createUI_300_Filter(container);

                _sashForm = new SashLeftFixedForm(//
                        container,
                        _containerProfiles,
                        sash,
                        _containerFilter,
                        30);
            }
        }
    }
项目:mytourbook    文件:WizardPage_20_ReferenceTour.java   
private Composite createUI(final Composite parent) {

        final Composite container = new Composite(parent, SWT.NONE);
        GridLayoutFactory.fillDefaults().applyTo(container);
        {
//          final Label label = new Label(container, SWT.NONE);
//          label.setText(Messages.tourCatalog_wizard_Label_reference_tour);

            final Composite masterDetailContainer = new Composite(container, SWT.NONE);
            GridDataFactory.fillDefaults().grab(true, true).applyTo(masterDetailContainer);

            /*
             * Reference tours
             */
            {
                _refContainer = new Composite(masterDetailContainer, SWT.NONE);
                GridLayoutFactory.fillDefaults().numColumns(1).applyTo(_refContainer);
                {
                    createUI_10_RefTourTableViewer(_refContainer);
                    createUI_20_Actions(_refContainer);
                }
            }

            /*
             * Sash
             */
            final Sash sash = new Sash(masterDetailContainer, SWT.VERTICAL);

            /*
             * Chart
             */
            {
                _groupChart = new Group(masterDetailContainer, SWT.NONE);
                _groupChart.setLayout(new GridLayout());
                _groupChart.setEnabled(false);
                {
                    /*
                     * create pagebook with the chart and the no-chart page
                     */
                    _pageBook = new PageBook(_groupChart, SWT.NONE);
                    _pageBook.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
                    {
                        _refTourChart = new Chart(_pageBook, SWT.NONE);
                        _refTourChart.setBackgroundColor(parent
                                .getDisplay()
                                .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));

                        _pageTourIsNotSelected = new Label(_pageBook, SWT.NONE);
                        _pageTourIsNotSelected.setText(Messages.tourCatalog_wizard_Label_a_tour_is_not_selected);
                        _pageTourIsNotSelected.setEnabled(false);
                    }
                }
            }

            _viewerDetailForm = new SashLeftFixedForm(masterDetailContainer, _refContainer, sash, _groupChart);
        }

        return container;
    }
项目:jo-widgets    文件:JoSashForm.java   
public Sash getSash() {
    return sash;
}
项目:translationstudio8    文件:TermDbManagerDialog.java   
/**
 * Create the sash with right control on the right. Note that this method assumes GridData for the layout data of
 * the rightControl.
 * @param composite
 * @param rightControl
 * @return Sash
 */
protected Sash createSash(final Composite composite, final Control rightControl) {
    final Sash sash = new Sash(composite, SWT.VERTICAL);
    sash.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    sash.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    // the following listener resizes the tree control based on sash deltas.
    // If necessary, it will also grow/shrink the dialog.
    sash.addListener(SWT.Selection, new Listener() {
        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt. widgets.Event)
         */
        public void handleEvent(Event event) {
            if (event.detail == SWT.DRAG) {
                return;
            }
            int shift = event.x - sash.getBounds().x;
            GridData data = (GridData) rightControl.getLayoutData();
            int newWidthHint = data.widthHint + shift;
            if (newWidthHint < 20) {
                return;
            }
            Point computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
            Point currentSize = getShell().getSize();
            // if the dialog wasn't of a custom size we know we can shrink
            // it if necessary based on sash movement.
            boolean customSize = !computedSize.equals(currentSize);
            data.widthHint = newWidthHint;
            setLastTreeWidth(newWidthHint);
            composite.layout(true);
            // recompute based on new widget size
            computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
            // if the dialog was of a custom size then increase it only if
            // necessary.
            if (customSize) {
                computedSize.x = Math.max(computedSize.x, currentSize.x);
            }
            computedSize.y = Math.max(computedSize.y, currentSize.y);
            if (computedSize.equals(currentSize)) {
                return;
            }
            setShellSize(computedSize.x, computedSize.y);
            lastShellSize = getShell().getSize();
        }
    });
    return sash;
}
项目:translationstudio8    文件:TmDbManagerDialog.java   
/**
 * Create the sash with right control on the right. Note that this method assumes GridData for the layout data of
 * the rightControl.
 * @param composite
 * @param rightControl
 * @return Sash
 */
protected Sash createSash(final Composite composite, final Control rightControl) {
    final Sash sash = new Sash(composite, SWT.VERTICAL);
    sash.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    sash.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    // the following listener resizes the tree control based on sash deltas.
    // If necessary, it will also grow/shrink the dialog.
    sash.addListener(SWT.Selection, new Listener() {
        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt. widgets.Event)
         */
        public void handleEvent(Event event) {
            if (event.detail == SWT.DRAG) {
                return;
            }
            int shift = event.x - sash.getBounds().x;
            GridData data = (GridData) rightControl.getLayoutData();
            int newWidthHint = data.widthHint + shift;
            if (newWidthHint < 20) {
                return;
            }
            Point computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
            Point currentSize = getShell().getSize();
            // if the dialog wasn't of a custom size we know we can shrink
            // it if necessary based on sash movement.
            boolean customSize = !computedSize.equals(currentSize);
            data.widthHint = newWidthHint;
            setLastTreeWidth(newWidthHint);
            composite.layout(true);
            // recompute based on new widget size
            computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
            // if the dialog was of a custom size then increase it only if
            // necessary.
            if (customSize) {
                computedSize.x = Math.max(computedSize.x, currentSize.x);
            }
            computedSize.y = Math.max(computedSize.y, currentSize.y);
            if (computedSize.equals(currentSize)) {
                return;
            }
            setShellSize(computedSize.x, computedSize.y);
            lastShellSize = getShell().getSize();
        }
    });
    return sash;
}
项目:gef-gwt    文件:Splitter.java   
public void handleEvent(Event e) {
    paint((Sash) e.widget, e.gc);
}
项目:gef-gwt    文件:PreferenceDialog.java   
/**
 * Create the sash with right control on the right. Note
 * that this method assumes GridData for the layout data
 * of the rightControl.
 * @param composite
 * @param rightControl
 * @return Sash
 * 
 * @since 3.1
 */
protected Sash createSash(final Composite composite, final Control rightControl) {
    final Sash sash = new Sash(composite, SWT.VERTICAL);
    sash.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    sash.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    // the following listener resizes the tree control based on sash deltas.
    // If necessary, it will also grow/shrink the dialog.
    sash.addListener(SWT.Selection, new Listener() {
        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
         */
        public void handleEvent(Event event) {
            if (event.detail == SWT.DRAG) {
                return;
            }
            int shift = event.x - sash.getBounds().x;
            GridData data = (GridData) rightControl.getLayoutData();
            int newWidthHint = data.widthHint + shift;
            if (newWidthHint < 20) {
                return;
            }
            Point computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
            Point currentSize = getShell().getSize();
            // if the dialog wasn't of a custom size we know we can shrink
            // it if necessary based on sash movement.
            boolean customSize = !computedSize.equals(currentSize);
            data.widthHint = newWidthHint;
            setLastTreeWidth(newWidthHint);
            composite.layout(true);
            // recompute based on new widget size
            computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
            // if the dialog was of a custom size then increase it only if
            // necessary.
            if (customSize) {
                computedSize.x = Math.max(computedSize.x, currentSize.x);
            }
            computedSize.y = Math.max(computedSize.y, currentSize.y);
            if (computedSize.equals(currentSize)) {
                return;
            }
            setShellSize(computedSize.x, computedSize.y);
            lastShellSize = getShell().getSize();
        }
    });
    return sash;
}
项目:geokettle-2.0    文件:Spoon.java   
private void addTabs() {

        if (tabComp != null) {
            tabComp.dispose();
        }

        tabComp = new Composite(sashform, SWT.BORDER);
        props.setLook(tabComp);
        tabComp.setLayout(new FillLayout());

        tabfolder = new TabSet(tabComp);
        tabfolder.setChangedFont(GUIResource.getInstance().getFontBold());
        tabfolder.setUnchangedFont(GUIResource.getInstance().getFontGraph());
        props.setLook(tabfolder.getSwtTabset(), Props.WIDGET_STYLE_TAB);

        tabfolder.addKeyListener(defKeys);

        sashform.addKeyListener(defKeys);

        int weights[] = props.getSashWeights();
        sashform.setWeights(weights);
        sashform.setVisible(true);

        // Set a minimum width on the sash so that the view and design buttons on the left panel are always visible.
        //
        Control[] comps = sashform.getChildren();
        for (int i = 0; i < comps.length; i++) {

            if (comps[i] instanceof Sash) {
                int limit = 10;
                for (ToolItem item : view.getParent().getItems()) {
                    limit += item.getWidth();
                }

                final int SASH_LIMIT = Const.isOSX() ? 150 : limit;
                final Sash sash = (Sash) comps[i];

                sash.addSelectionListener(new SelectionAdapter() {
                    public void widgetSelected(SelectionEvent event) {
                        Rectangle rect = sash.getParent().getClientArea();
                        event.x = Math.min(Math.max(event.x, SASH_LIMIT), rect.width - SASH_LIMIT);
                        if (event.detail != SWT.DRAG) {
                            sash.setBounds(event.x, event.y, event.width, event.height);
                            sashform.layout();
                        }
                    }
                });
            }
        }

        tabfolder.addListener(this); // methods: tabDeselected, tabClose, tabSelected

    }
项目:tmxeditor8    文件:TmDbManagerDialog.java   
/**
 * Create the sash with right control on the right. Note that this method assumes GridData for the layout data of
 * the rightControl.
 * @param composite
 * @param rightControl
 * @return Sash
 */
protected Sash createSash(final Composite composite, final Control rightControl) {
    final Sash sash = new Sash(composite, SWT.VERTICAL);
    sash.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    sash.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    // the following listener resizes the tree control based on sash deltas.
    // If necessary, it will also grow/shrink the dialog.
    sash.addListener(SWT.Selection, new Listener() {
        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt. widgets.Event)
         */
        public void handleEvent(Event event) {
            if (event.detail == SWT.DRAG) {
                return;
            }
            int shift = event.x - sash.getBounds().x;
            GridData data = (GridData) rightControl.getLayoutData();
            int newWidthHint = data.widthHint + shift;
            if (newWidthHint < 20) {
                return;
            }
            Point computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
            Point currentSize = getShell().getSize();
            // if the dialog wasn't of a custom size we know we can shrink
            // it if necessary based on sash movement.
            boolean customSize = !computedSize.equals(currentSize);
            data.widthHint = newWidthHint;
            setLastTreeWidth(newWidthHint);
            composite.layout(true);
            // recompute based on new widget size
            computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
            // if the dialog was of a custom size then increase it only if
            // necessary.
            if (customSize) {
                computedSize.x = Math.max(computedSize.x, currentSize.x);
            }
            computedSize.y = Math.max(computedSize.y, currentSize.y);
            if (computedSize.equals(currentSize)) {
                return;
            }
            setShellSize(computedSize.x, computedSize.y);
            lastShellSize = getShell().getSize();
        }
    });
    return sash;
}
项目:tmxeditor8    文件:TermDbManagerDialog.java   
/**
 * Create the sash with right control on the right. Note that this method assumes GridData for the layout data of
 * the rightControl.
 * @param composite
 * @param rightControl
 * @return Sash
 */
protected Sash createSash(final Composite composite, final Control rightControl) {
    final Sash sash = new Sash(composite, SWT.VERTICAL);
    sash.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    sash.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    // the following listener resizes the tree control based on sash deltas.
    // If necessary, it will also grow/shrink the dialog.
    sash.addListener(SWT.Selection, new Listener() {
        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt. widgets.Event)
         */
        public void handleEvent(Event event) {
            if (event.detail == SWT.DRAG) {
                return;
            }
            int shift = event.x - sash.getBounds().x;
            GridData data = (GridData) rightControl.getLayoutData();
            int newWidthHint = data.widthHint + shift;
            if (newWidthHint < 20) {
                return;
            }
            Point computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
            Point currentSize = getShell().getSize();
            // if the dialog wasn't of a custom size we know we can shrink
            // it if necessary based on sash movement.
            boolean customSize = !computedSize.equals(currentSize);
            data.widthHint = newWidthHint;
            setLastTreeWidth(newWidthHint);
            composite.layout(true);
            // recompute based on new widget size
            computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
            // if the dialog was of a custom size then increase it only if
            // necessary.
            if (customSize) {
                computedSize.x = Math.max(computedSize.x, currentSize.x);
            }
            computedSize.y = Math.max(computedSize.y, currentSize.y);
            if (computedSize.equals(currentSize)) {
                return;
            }
            setShellSize(computedSize.x, computedSize.y);
            lastShellSize = getShell().getSize();
        }
    });
    return sash;
}
项目:tmxeditor8    文件:TmDbManagerDialog.java   
/**
 * Create the sash with right control on the right. Note that this method assumes GridData for the layout data of
 * the rightControl.
 * @param composite
 * @param rightControl
 * @return Sash
 */
protected Sash createSash(final Composite composite, final Control rightControl) {
    final Sash sash = new Sash(composite, SWT.VERTICAL);
    sash.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    sash.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    // the following listener resizes the tree control based on sash deltas.
    // If necessary, it will also grow/shrink the dialog.
    sash.addListener(SWT.Selection, new Listener() {
        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt. widgets.Event)
         */
        public void handleEvent(Event event) {
            if (event.detail == SWT.DRAG) {
                return;
            }
            int shift = event.x - sash.getBounds().x;
            GridData data = (GridData) rightControl.getLayoutData();
            int newWidthHint = data.widthHint + shift;
            if (newWidthHint < 20) {
                return;
            }
            Point computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
            Point currentSize = getShell().getSize();
            // if the dialog wasn't of a custom size we know we can shrink
            // it if necessary based on sash movement.
            boolean customSize = !computedSize.equals(currentSize);
            data.widthHint = newWidthHint;
            setLastTreeWidth(newWidthHint);
            composite.layout(true);
            // recompute based on new widget size
            computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
            // if the dialog was of a custom size then increase it only if
            // necessary.
            if (customSize) {
                computedSize.x = Math.max(computedSize.x, currentSize.x);
            }
            computedSize.y = Math.max(computedSize.y, currentSize.y);
            if (computedSize.equals(currentSize)) {
                return;
            }
            setShellSize(computedSize.x, computedSize.y);
            lastShellSize = getShell().getSize();
        }
    });
    return sash;
}
项目:birt    文件:AbstractPropertyDialog.java   
private Sash createSash( final Composite composite )
{
    final Sash sash = new Sash( composite, SWT.VERTICAL );
    sash.setLayoutData( new GridData( GridData.FILL_VERTICAL ) );
    return sash;
}
项目:read-open-source-code    文件:Spoon.java   
private void addTabs() {

    if (tabComp != null) {
      tabComp.dispose();
    }

    tabComp = new Composite(sashform, SWT.BORDER);
    props.setLook(tabComp);
    tabComp.setLayout(new FillLayout());

    tabfolder = new TabSet(tabComp);
    tabfolder.setChangedFont(GUIResource.getInstance().getFontBold());
    tabfolder.setUnchangedFont(GUIResource.getInstance().getFontGraph());
    props.setLook(tabfolder.getSwtTabset(), Props.WIDGET_STYLE_TAB);

    int weights[] = props.getSashWeights();
    sashform.setWeights(weights);
    sashform.setVisible(true);

    // Set a minimum width on the sash so that the view and design buttons
    // on the left panel are always visible.
    //
    Control[] comps = sashform.getChildren();
    for (int i = 0; i < comps.length; i++) {

      if (comps[i] instanceof Sash) {
        int limit = 10;

        final int SASH_LIMIT = Const.isOSX() ? 150 : limit;
        final Sash sash = (Sash) comps[i];

        sash.addSelectionListener(new SelectionAdapter() {
          public void widgetSelected(SelectionEvent event) {
            Rectangle rect = sash.getParent().getClientArea();
            event.x = Math.min(Math.max(event.x, SASH_LIMIT), rect.width - SASH_LIMIT);
            if (event.detail != SWT.DRAG) {
              sash.setBounds(event.x, event.y, event.width, event.height);
              sashform.layout();
            }
          }
        });
      }
    }

    tabfolder.addListener(this); // methods: tabDeselected, tabClose,
    // tabSelected

  }
项目:kettle-4.4.0-stable    文件:Spoon.java   
private void addTabs() {

    if (tabComp != null) {
      tabComp.dispose();
    }

    tabComp = new Composite(sashform, SWT.BORDER);
    props.setLook(tabComp);
    tabComp.setLayout(new FillLayout());

    tabfolder = new TabSet(tabComp);
    tabfolder.setChangedFont(GUIResource.getInstance().getFontBold());
    tabfolder.setUnchangedFont(GUIResource.getInstance().getFontGraph());
    props.setLook(tabfolder.getSwtTabset(), Props.WIDGET_STYLE_TAB);

    int weights[] = props.getSashWeights();
    sashform.setWeights(weights);
    sashform.setVisible(true);

    // Set a minimum width on the sash so that the view and design buttons
    // on the left panel are always visible.
    //
    Control[] comps = sashform.getChildren();
    for (int i = 0; i < comps.length; i++) {

      if (comps[i] instanceof Sash) {
        int limit = 10;

        final int SASH_LIMIT = Const.isOSX() ? 150 : limit;
        final Sash sash = (Sash) comps[i];

        sash.addSelectionListener(new SelectionAdapter() {
          public void widgetSelected(SelectionEvent event) {
            Rectangle rect = sash.getParent().getClientArea();
            event.x = Math.min(Math.max(event.x, SASH_LIMIT), rect.width - SASH_LIMIT);
            if (event.detail != SWT.DRAG) {
              sash.setBounds(event.x, event.y, event.width, event.height);
              sashform.layout();
            }
          }
        });
      }
    }

    tabfolder.addListener(this); // methods: tabDeselected, tabClose,
    // tabSelected

  }