org.eclipse.swt.custom.SashForm Java Examples

The following examples show how to use org.eclipse.swt.custom.SashForm. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArtikelView.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
MasterDetailsPage(Composite parent, CodeSelectorFactory master, IDetailDisplay detail){
	super(parent, SWT.NONE);
	if (PersistentObject.class.isAssignableFrom(detail.getElementClass())) {
		eeli_div = new ElexisUiEventListenerImpl(detail.getElementClass(),
			ElexisEvent.EVENT_SELECTED) {
			@Override
			public void runInUi(ElexisEvent ev){
				detailDisplay.display(ev.getObject());
			}
		};
		ElexisEventDispatcher.getInstance().addListeners(eeli_div);
	}
	setLayout(new FillLayout());
	sash = new SashForm(this, SWT.NONE);
	cv = new CommonViewer();
	cv.create(master.createViewerConfigurer(cv), sash, SWT.NONE, getViewSite());
	// cv.getViewerWidget().addSelectionChangedListener(
	// GlobalEventDispatcher.getInstance().getDefaultListener());
	/* Composite page= */detail.createDisplay(sash, getViewSite());
	cv.getConfigurer().getContentProvider().startListening();
	detailDisplay = detail;
}
 
Example #2
Source File: ERDiagramOutlinePage.java    From erflute with Apache License 2.0 6 votes vote down vote up
@Override
public void createControl(Composite parent) {
    this.sash = new SashForm(parent, SWT.VERTICAL);
    viewer.createControl(sash);
    editPartFactory = new ERDiagramOutlineEditPartFactory();
    editPartFactory.setQuickMode(quickMode);
    viewer.setEditPartFactory(editPartFactory);
    viewer.setContents(diagram);
    if (!quickMode) {
        final Canvas canvas = new Canvas(sash, SWT.BORDER);
        lws = new LightweightSystem(canvas);
    }
    resetView(registry);
    final AbstractTransferDragSourceListener dragSourceListener =
            new ERDiagramTransferDragSourceListener(viewer, TemplateTransfer.getInstance());
    viewer.addDragSourceListener(dragSourceListener);

    expandVirturalDiagramTree();
}
 
Example #3
Source File: ExpandableSpaceReclaimer.java    From tlaplus with MIT License 6 votes vote down vote up
/**
 * An instance should be constructed only after all children have been added to the sash form.
 * 
 * @param s the section which we will listen for collapse and expansion on
 * @param sf the sash form in which the section sits
 * @throws IllegalArgumentException if the section is not one of the sash form's children
 */
public ExpandableSpaceReclaimer(final Section s, final SashForm sf) {
	m_section = s;
	m_sashForm = sf;
	
	final Control[] children = m_sashForm.getChildren();
	int index = -1;
	for (int i = 0; i < children.length; i++) {
		if (s == children[i]) {
			index = i;
			
			break;
		}
	}
	
	if (index == -1) {
		throw new IllegalArgumentException("Section could not be found in the sash form.");
	}
	
	m_sectionIndex = index;
	m_otherChildrenCount = children.length - 1;
	m_section.addExpansionListener(this);
	
	m_lastSectionSizeOnCollapse = null;
}
 
Example #4
Source File: RenameTypeWizardSimilarElementsPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createTreeAndSourceViewer(Composite superComposite) {
	SashForm composite= new SashForm(superComposite, SWT.HORIZONTAL);
	initializeDialogUnits(superComposite);
	GridData gd= new GridData(GridData.FILL_BOTH);
	gd.heightHint= convertHeightInCharsToPixels(20);
	gd.widthHint= convertWidthInCharsToPixels(10);
	composite.setLayoutData(gd);
	GridLayout layout= new GridLayout();
	layout.numColumns= 2;
	layout.marginWidth= 0;
	layout.marginHeight= 0;
	composite.setLayout(layout);

	createSimilarElementTreeComposite(composite);
	createSourceViewerComposite(composite);
	composite.setWeights(new int[] { 50, 50 });
}
 
Example #5
Source File: ERDiagramOutlinePage.java    From ermasterr with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void createControl(final Composite parent) {
    sash = new SashForm(parent, SWT.VERTICAL);

    // コンストラクタで指定したビューワの作成
    viewer.createControl(sash);

    // EditPartFactory の設定
    final ERDiagramOutlineEditPartFactory editPartFactory = new ERDiagramOutlineEditPartFactory();
    viewer.setEditPartFactory(editPartFactory);

    // グラフィカル・エディタのルート・モデルをツリー・ビューワにも設定
    viewer.setContents(diagram);

    final Canvas canvas = new Canvas(sash, SWT.BORDER);
    // サムネイル・フィギュアを配置する為の LightweightSystem
    lws = new LightweightSystem(canvas);

    resetView(registry);

    final AbstractTransferDragSourceListener dragSourceListener = new ERDiagramTransferDragSourceListener(viewer, TemplateTransfer.getInstance());
    viewer.addDragSourceListener(dragSourceListener);

    diagram.refreshOutline();
}
 
Example #6
Source File: AbstractSegmentStoreDensityView.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void createPartControl(@Nullable Composite parent) {
    super.createPartControl(parent);
    final SashForm sashForm = new SashForm(parent, SWT.NONE);

    fTableViewer = createSegmentStoreTableViewer(sashForm);
    fDensityViewer = createSegmentStoreDensityViewer(sashForm);
    fDensityViewer.addDataListener(new DataChangedListener());

    sashForm.setWeights(DEFAULT_WEIGHTS);

    Action zoomOut = new ZoomOutAction(this);
    IToolBarManager toolBar = getViewSite().getActionBars().getToolBarManager();
    toolBar.add(zoomOut);
    ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
    if (trace != null) {
        TmfTraceSelectedSignal signal = new TmfTraceSelectedSignal(this, trace);
        if (fDensityViewer != null) {
            fDensityViewer.traceSelected(signal);
        }
        if (fTableViewer != null) {
            fTableViewer.traceSelected(signal);
        }
    }
}
 
Example #7
Source File: PullUpMethodPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createTreeAndSourceViewer(final Composite superComposite) {
	final SashForm composite= new SashForm(superComposite, SWT.HORIZONTAL);
	initializeDialogUnits(superComposite);
	final GridData gd= new GridData(GridData.FILL_BOTH);
	gd.heightHint= convertHeightInCharsToPixels(20);
	gd.widthHint= convertWidthInCharsToPixels(10);
	composite.setLayoutData(gd);
	final GridLayout layout= new GridLayout();
	layout.numColumns= 2;
	layout.marginWidth= 0;
	layout.marginHeight= 0;
	layout.horizontalSpacing= 1;
	layout.verticalSpacing= 1;
	composite.setLayout(layout);

	createHierarchyTreeComposite(composite);
	createSourceViewerComposite(composite);
	composite.setWeights(new int[] { 50, 50});
}
 
Example #8
Source File: AbstractSegmentStoreDensityView.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void createPartControl(@Nullable Composite parent) {
    super.createPartControl(parent);
    final SashForm sashForm = new SashForm(parent, SWT.NONE);

    fTableViewer = createSegmentStoreTableViewer(sashForm);
    fDensityViewer = createSegmentStoreDensityViewer(sashForm);
    fDensityViewer.addDataListener(new DataChangedListener());

    sashForm.setWeights(DEFAULT_WEIGHTS);

    Action zoomOut = new ZoomOutAction(this);
    IToolBarManager toolBar = getViewSite().getActionBars().getToolBarManager();
    toolBar.add(zoomOut);
    ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
    if (trace != null) {
        TmfTraceSelectedSignal signal = new TmfTraceSelectedSignal(this, trace);
        if (fDensityViewer != null) {
            fDensityViewer.traceSelected(signal);
        }
        if (fTableViewer != null) {
            fTableViewer.traceSelected(signal);
        }
    }
}
 
Example #9
Source File: ProcessExchangePage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	form = UI.formHeader(this);
	toolkit = mform.getToolkit();
	Composite body = UI.formBody(form, toolkit);
	SashForm sash = new SashForm(body, SWT.VERTICAL);
	UI.gridData(sash, true, true);
	toolkit.adapt(sash);
	inputTable = createTable(sash, true);
	outputTable = createTable(sash, false);
	body.setFocus();
	form.reflow(true);
	sortExchanges();
	inputTable.setInput(getModel());
	outputTable.setInput(getModel());
	editor.onSaved(() -> {
		inputTable.setInput(getModel());
		outputTable.setInput(getModel());
	});
}
 
Example #10
Source File: TaskSelectType.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void placeComponents( )
{
	foSashForm = new SashForm( topControl, SWT.VERTICAL );
	{
		GridLayout layout = new GridLayout( );
		foSashForm.setLayout( layout );
		GridData gridData = new GridData( GridData.FILL_BOTH );
		// TODO verify Bug 194391 in Linux
		gridData.heightHint = 680;
		foSashForm.setLayoutData( gridData );
	}
	createTopPreviewArea( foSashForm );
	createBottomTypeArea( foSashForm );
	
	initUIPropertiesAndData( );
}
 
Example #11
Source File: SQLDataSetEditorPage.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * create page control for sql edit page
 * 
 * @param parent
 * @return
 */
private Control createPageControl( Composite parent )
{
	SashForm pageContainer = new SashForm( parent, SWT.NONE );

	GridLayout layout = new GridLayout( );
	layout.numColumns = 3;
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	layout.horizontalSpacing = 2;
	pageContainer.setLayout( layout );
	pageContainer.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	pageContainer.setSashWidth( 3 );

	Control left = createDBMetaDataSelectionComposite( pageContainer );
	Control right = createTextualQueryComposite( pageContainer );
	setWidthHints( pageContainer, left, right );
	
	return pageContainer;
}
 
Example #12
Source File: ColumnMappingWizardPage.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void createPageCustomControl( Composite parent )
{
	Composite pageComposite = new Composite( parent, SWT.NONE );
	pageComposite.setLayout( new FillLayout( ) );

	SashForm sf = new SashForm( pageComposite, SWT.HORIZONTAL );
	createLeftComposite( pageComposite, sf );

	createRightComposite( sf );
	
	setControl( pageComposite );
	refreshColumnMappingTable( );
	
	this.design = this.getInitializationDesign( );		
	initPageControls( );
	updateButtonStatus( );
	
	HelpUtil.setSystemHelp( pageComposite,
			HelpUtil.CONEXT_ID_DATASET_POJO_COLUMN_MAPPING );		

}
 
Example #13
Source File: DashboardComposite.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/** {@code key} defines which data source will be used for display. */
public DashboardComposite(String key, Composite parent, int style) {
	super(parent, style);
	this.key = key;

	this.setLayout(new FillLayout());

	final SashForm sf = new SashForm(this, SWT.HORIZONTAL);
	sf.setLayout(new FillLayout());

	this.canvas = new VisualisationCanvas(sf, SWT.NONE);

	this.text = new Text(sf, SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI);
	text.setText("");

	createVisualisationControls(sf);
	sf.setWeights(new int[] { 45, 45, 10 });
}
 
Example #14
Source File: ImpactNwPage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@Override
protected void createFormContent(IManagedForm managedForm) {
	form = UI.formHeader(this);
	toolkit = managedForm.getToolkit();
	Composite body = UI.formBody(form, toolkit);
	Section section = UI.section(body, toolkit,
			M.NormalizationWeightingSets);
	UI.gridData(section, true, true);
	Composite client = toolkit.createComposite(section);
	section.setClient(client);
	UI.gridLayout(client, 1);
	SashForm sashForm = createSash(client);
	setViewer = createNwSetViewer(section, sashForm);
	factorViewer = new NwFactorViewer(sashForm, editor);
	sashForm.setWeights(new int[] { 25, 75 });
	setViewer.selectFirst();
	body.setFocus();
	form.reflow(true);
	editor.getEventBus().register(this);
	editor.onSaved(() -> updateInput());
}
 
Example #15
Source File: GroovyEditorDocumentationDialogTray.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Control createContents(final Composite parent) {

    final Composite mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).create());

    createFunctionCategories(mainComposite);

    final SashForm sashForm = new SashForm(mainComposite, SWT.VERTICAL);
    sashForm.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(250, 250).minSize(100, SWT.DEFAULT).create());
    final GridLayout gridLaout = GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 2).create();
    sashForm.setLayout(gridLaout);
    createFunctionsList(sashForm);
    createFunctionDocumentaion(sashForm);

    sashForm.setWeights(new int[] { 1, 1 });

    return mainComposite;
}
 
Example #16
Source File: SWTUtil.java    From arx with Apache License 2.0 6 votes vote down vote up
/**
 * Tries to fix a bug when resizing sash forms in OSX
 * @param sash
 */
public static void fixOSXSashBug(final SashForm sash) {
    
    // Only if on OSX
    if (isMac()) {
        
        // Listen for resize event in first composite
        for (Control c : sash.getChildren()) {
            if (c instanceof Composite) {
                
                // In case of resize, redraw the sash form
                c.addControlListener(new ControlAdapter(){
                    @Override
                    public void controlResized(ControlEvent arg0) {
                        sash.redraw();
                    }
                });
                return;
            }
        }
    }
}
 
Example #17
Source File: LayeredDisplayView.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void ownCreatePartControl(final Composite c) {
	if (getOutput() == null) { return; }
	c.setLayout(emptyLayout());

	// First create the sashform

	form = new SashForm(c, SWT.HORIZONTAL);
	form.setLayoutData(fullData());
	form.setBackground(IGamaColors.WHITE.color());
	form.setSashWidth(8);
	decorator.createSidePanel(form);
	final Composite centralPanel = new Composite(form, CORE_DISPLAY_BORDER.getValue() ? SWT.BORDER : SWT.NONE);

	centralPanel.setLayout(emptyLayout());
	setParentComposite(new Composite(centralPanel, SWT.NONE) {

		@Override
		public boolean setFocus() {
			// decorator.keyAndMouseListener.focusGained(null);
			return forceFocus();
		}

	});

	getParentComposite().setLayoutData(fullData());
	getParentComposite().setLayout(emptyLayout());
	createSurfaceComposite(getParentComposite());
	surfaceComposite.setLayoutData(fullData());
	getOutput().setSynchronized(getOutput().isSynchronized() || CORE_SYNC.getValue());
	form.setMaximizedControl(centralPanel);
	decorator.createDecorations(form);
	c.layout();

}
 
Example #18
Source File: CmdPanel.java    From Rel with Apache License 2.0 5 votes vote down vote up
private void setZoomedParent(Composite parent, Composite setTo) {
	Composite parentparent = parent.getParent();
	if (parentparent instanceof SashForm) {
		SashForm parentSash = (SashForm) parentparent;
		parentSash.setMaximizedControl(setTo);
	}
}
 
Example #19
Source File: ColumnMappingWizardPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void createRightComposite( SashForm sf )
{
	Composite right = new Composite( sf, SWT.NONE );
	right.setLayout( new GridLayout( 1, false ) );
	
	Group classStructureGroup = new Group( right, SWT.NONE );
	classStructureGroup.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	classStructureGroup.setText( Messages.getString( "DataSet.ColumnMapping" ) ); //$NON-NLS-1$
	classStructureGroup.setLayout( new GridLayout( 2, false ) );

	createRightTableViewer( classStructureGroup );

	createRightButtonArea( classStructureGroup );

}
 
Example #20
Source File: CmdPanelOutput.java    From Rel with Apache License 2.0 5 votes vote down vote up
protected void zoom() {
	if (getParent() instanceof SashForm) {
		SashForm form = ((SashForm) getParent());
		if (form.getMaximizedControl() != this)
			form.setMaximizedControl(this);
		else
			form.setMaximizedControl(null);
	}
}
 
Example #21
Source File: Rev.java    From Rel with Apache License 2.0 5 votes vote down vote up
private void setZoomedParent(Composite parent, Composite setTo) {
	Composite parentparent = parent.getParent();
	if (parentparent instanceof SashForm) {
		SashForm parentSash = (SashForm) parentparent;
		parentSash.setMaximizedControl(setTo);
	}
}
 
Example #22
Source File: ColumnMappingWizardPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void createLeftComposite( Composite topComposite, SashForm sf )
{
	Composite left = new Composite( sf, SWT.NONE );
	left.setLayout( new GridLayout( 2, false ) );
	
	Group classStructureGroup = new Group( left, SWT.NONE );
	classStructureGroup.setText( Messages.getString( "DataSet.ClassStructure" ) ); //$NON-NLS-1$
	classStructureGroup.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	classStructureGroup.setLayout( new GridLayout( 1, false ) );

	createClassNameComposite( classStructureGroup );
	
	createClassStructureComposite( left, classStructureGroup );
}
 
Example #23
Source File: LayeredDisplayDecorator.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
public void createSidePanel(final SashForm form) {

		sidePanel = new Composite(form, SWT.BORDER);
		final GridLayout layout = new GridLayout(1, true);
		layout.horizontalSpacing = 0;
		layout.verticalSpacing = 0;
		layout.marginHeight = 0;
		layout.marginWidth = 0;
		sidePanel.setLayout(layout);
		sidePanel.setBackground(IGamaColors.WHITE.color());
	}
 
Example #24
Source File: ImpactNwPage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private NwSetViewer createNwSetViewer(Section section, SashForm sashForm) {
	NwSetViewer viewer = new NwSetViewer(sashForm, editor);
	CommentAction.bindTo(section, viewer, "nwSets", editor.getComments());
	viewer.addSelectionChangedListener((selection) -> factorViewer.setInput(selection));
	viewer.setInput(getModel());
	return viewer;
}
 
Example #25
Source File: OSMFileViewer.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void createPartControl(final Composite composite) {
	final Composite parent = GamaToolbarFactory.createToolbars(this, composite);
	final SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL | SWT.NULL);
	displayInfoString();
	mapLayerTable = new MapLayerComposite(sashForm, SWT.BORDER);
	pane = new SwtMapPane(sashForm, SWT.BORDER | SWT.NO_BACKGROUND, new StreamingRenderer(), content);
	pane.setBackground(GamaColors.system(SWT.COLOR_WHITE));
	mapLayerTable.setMapPane(pane);
	sashForm.setWeights(new int[] { 1, 4 });
	pane.redraw();

}
 
Example #26
Source File: ExpandedContentManagerTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Test
public void testHideExpandedContentManager() throws Exception {
  TransGraph transGraph = mock( TransGraph.class );
  Browser browser = mock( Browser.class );
  SashForm sashForm = mock( SashForm.class );

  Composite parent = setupExpandedContentMocks( transGraph, browser, sashForm );
  ExpandedContentManager.hideExpandedContent( transGraph );
  verify( browser ).moveBelow( null );
  verify( parent ).layout( true, true );
  verify( parent ).redraw();
  verify( sashForm ).setWeights( new int[] { 3, 2, 1 } );
}
 
Example #27
Source File: Composite3DModifier.java    From ldparteditor with MIT License 5 votes vote down vote up
/**
 * Spins the {@link SashForm} content clockwise
 */
public void spinView() {
    NLogger.debug(Composite3DModifier.class, "[Spin view]"); //$NON-NLS-1$
    // Spin only, if it is not the last opened view
    if (isSashFormChild(c3d.getSashForm())) {
        int newStyle = SWT.NONE;
        if ((c3d.getSashForm().getStyle() & SWT.HORIZONTAL) != 0) {
            newStyle = SWT.VERTICAL;
        } else {
            newStyle = SWT.HORIZONTAL;
        }
        int[] sashWeights = c3d.getSashForm().getWeights();
        int[] mainSashWeights = Editor3DWindow.getSashForm().getWeights();
        int[] superSashWeights = ((SashForm) c3d.getSashForm().getParent()).getWeights();
        Composite oldParentSashForm = c3d.getSashForm();
        Composite oldGrandpaSashForm = oldParentSashForm.getParent();
        boolean isUpperComposite = oldParentSashForm.getChildren()[0].equals(c3d.getCompositeContainer());

        if (isUpperComposite) {
            if (newStyle == SWT.HORIZONTAL) {
                reverseChilds(c3d.getSashForm());
            }
        } else {
            if (newStyle == SWT.HORIZONTAL) {
                reverseChilds(c3d.getSashForm());
            }
        }

        oldParentSashForm.setOrientation(newStyle);
        oldGrandpaSashForm.layout();
        ((SashForm) oldParentSashForm).setWeights(sashWeights);
        ((SashForm) oldGrandpaSashForm).setWeights(superSashWeights);
        Editor3DWindow.getSashForm().setWeights(mainSashWeights);
    }
}
 
Example #28
Source File: Translator2.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void open() {
  shell = new Shell( display );
  shell.setLayout( new FillLayout() );
  shell.setText( APP_NAME );
  shell.setImage( GUIResource.getInstance().getImageLogoSmall() );

  try {
    readFiles();
  } catch ( Exception e ) {
    new ErrorDialog(
      shell, "Error reading translations", "There was an unexpected error reading the translations", e );
  }

  // Put something on the screen
  sashform = new SashForm( shell, SWT.HORIZONTAL );
  sashform.setLayout( new FormLayout() );

  addLists();
  addGrid();
  addListeners();

  sashform.setWeights( new int[] { 40, 60 } );
  sashform.setVisible( true );

  shell.pack();

  refresh();

  shell.setSize( 1024, 768 );

  shell.open();
}
 
Example #29
Source File: CodeDetailView.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public MasterDetailsPage(Composite parent, CodeSelectorFactory codeSelectorFactory,
	IDetailDisplay displayDetail){
	super(parent, SWT.NONE);
	
	this.detail = displayDetail;
	this.master = codeSelectorFactory;
	cv = new CommonViewer();
	eeli_div = new ElexisUiEventListenerImpl(detail.getElementClass(),
		ElexisEvent.EVENT_SELECTED) {
		@Override
		public void runInUi(ElexisEvent ev){
			detail.display(ev.getObject());
		}
	};
	eeli_mod = new ElexisUiEventListenerImpl(detail.getElementClass(),
		ElexisEvent.EVENT_UPDATE) {
		@Override
		public void runInUi(ElexisEvent ev){
			cv.notify(CommonViewer.Message.updateSingle, ev.getObject());
		}
	};
	setLayout(new FillLayout());
	sash = new SashForm(this, SWT.NONE);
	cv.setViewName(master.getCodeSystemName());
	cv.create(master.createViewerConfigurer(cv), sash, SWT.NONE, getViewSite());
	detail.createDisplay(sash, getViewSite());
	cv.getConfigurer().getContentProvider().startListening();
	ElexisEventDispatcher.getInstance().addListeners(eeli_div, eeli_mod);
}
 
Example #30
Source File: HeaderPage.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Setup 2 column layout.
 *
 * @param managedForm the managed form
 * @param w1 the w 1
 * @param w2 the w 2
 * @return the form 2 panel
 */
public Form2Panel setup2ColumnLayout(IManagedForm managedForm, int w1, int w2) {
  final ScrolledForm sform = managedForm.getForm();
  final Composite form = sform.getBody();
  form.setLayout(new GridLayout(1, false)); // this is required !
  Composite xtra = toolkit.createComposite(form);
  xtra.setLayout(new GridLayout(1, false));
  xtra.setLayoutData(new GridData(GridData.FILL_BOTH));
  Control c = xtra.getParent();
  while (!(c instanceof ScrolledComposite))
    c = c.getParent();
  ((GridData) xtra.getLayoutData()).widthHint = c.getSize().x;
  ((GridData) xtra.getLayoutData()).heightHint = c.getSize().y;
  sashForm = new SashForm(xtra, SWT.HORIZONTAL);

  sashForm.setLayoutData(new GridData(GridData.FILL_BOTH)); // needed

  leftPanel = newComposite(sashForm);
  ((GridLayout) leftPanel.getLayout()).marginHeight = 5;
  ((GridLayout) leftPanel.getLayout()).marginWidth = 5;
  rightPanel = newComposite(sashForm);
  ((GridLayout) rightPanel.getLayout()).marginHeight = 5;
  ((GridLayout) rightPanel.getLayout()).marginWidth = 5;
  sashForm.setWeights(new int[] { w1, w2 });
  leftPanelPercent = (float) w1 / (float) (w1 + w2);
  rightPanelPercent = (float) w2 / (float) (w1 + w2);

  rightPanel.addControlListener(new ControlAdapter() {
    @Override
    public void controlResized(ControlEvent e) {
      setSashFormWidths();
    }
  });

  return new Form2Panel(form, leftPanel, rightPanel);
}