Java Code Examples for org.eclipse.swt.widgets.Composite#setData()

The following examples show how to use org.eclipse.swt.widgets.Composite#setData() . 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: HintTextGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public Composite createControl(Composite parent) {
    fTopComposite= new Composite(parent, SWT.NONE);
    fTopComposite.setFont(parent.getFont());

    GridData gridData= new GridData(GridData.FILL_BOTH);
    PixelConverter converter= new PixelConverter(parent);
    gridData.heightHint= converter.convertHeightInCharsToPixels(12);
    gridData.widthHint= converter.convertWidthInCharsToPixels(25);
    GridLayout gridLayout= new GridLayout();
    gridLayout.marginWidth= 0;//-converter.convertWidthInCharsToPixels(2);
    gridLayout.marginHeight= 0;//= -4;
    fTopComposite.setLayout(gridLayout);
    fTopComposite.setLayoutData(gridData);
    fTopComposite.setData(null);
    fTopComposite.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            Collection<Image> collection= fImageMap.values();
            Iterator<Image> iterator= collection.iterator();
            while(iterator.hasNext()) {
                Image image= iterator.next();
                image.dispose();
            }
        }
    });
    return fTopComposite;
}
 
Example 2
Source File: MainEntryPoint.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private Composite createFooter ( final Composite parent )
{
    final Composite footer = new Composite ( parent, SWT.NONE );

    footer.setLayout ( new RowLayout () );

    footer.setData ( RWT.CUSTOM_VARIANT, "footer" );
    footer.setBackgroundMode ( SWT.INHERIT_DEFAULT );

    final Label label = new Label ( footer, SWT.NONE );
    label.setText ( System.getProperty ( Properties.FOOTER_TEXT, "Eclipse SCADA Admin Console" ) );

    return footer;
}
 
Example 3
Source File: ExportFilterComposite.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
public void handleEvent(Event event) {
	Composite parent = this.getParent();
	Composite topParent = parent.getParent();
	if (event.widget == addButton) { // add button
		ExportFilterComponentBean bean = new ExportFilterComponentBean(this.ruleType);
		bean.setOptionName(this.baseDataBean.getOptionName());
		bean.setCurrentExpression(this.baseDataBean.getCurrentExpression());

		addComponent(parent, bean);

	} else if (event.widget == deleteButton) { // delete button
		this.dispose();
		Integer number = (Integer) parent.getData("currentNumber") - 1;
		parent.setData("currentNumber", number);
		if (number == 1) {
			Control c = parent.getChildren()[0];
			if (c instanceof ExportFilterComposite) {
				ExportFilterComposite temp = (ExportFilterComposite) c;
				temp.setDeleteButtonEnabled(false);
			}
		}
	}

	if (topParent instanceof ScrolledComposite) {
		((ScrolledComposite) topParent).setMinSize(parent.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	}
	parent.layout(true);
}
 
Example 4
Source File: ExportFilterComposite.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 增加一个组件
 * @param parent
 *            组件容器
 * @param bean
 *            {@link ExportFilterComponentBean};
 */
public void addComponent(Composite parent, ExportFilterComponentBean bean) {
	Integer number = (Integer) parent.getData("currentNumber") + 1;
	parent.setData("currentNumber", number);
	if (number == 2) {
		Control c = parent.getChildren()[0];
		if (c instanceof ExportFilterComposite) {
			ExportFilterComposite temp = (ExportFilterComposite) c;
			temp.setDeleteButtonEnabled(true);
		}
	}

	ExportFilterComposite tempComponent = new ExportFilterComposite(parent, SWT.None, this.ruleType, bean);
	tempComponent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
}
 
Example 5
Source File: ExportFilterComposite.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public void handleEvent(Event event) {
	Composite parent = this.getParent();
	Composite topParent = parent.getParent();
	if (event.widget == addButton) { // add button
		ExportFilterComponentBean bean = new ExportFilterComponentBean(this.ruleType);
		bean.setOptionName(this.baseDataBean.getOptionName());
		bean.setCurrentExpression(this.baseDataBean.getCurrentExpression());

		addComponent(parent, bean);

	} else if (event.widget == deleteButton) { // delete button
		this.dispose();
		Integer number = (Integer) parent.getData("currentNumber") - 1;
		parent.setData("currentNumber", number);
		if (number == 1) {
			Control c = parent.getChildren()[0];
			if (c instanceof ExportFilterComposite) {
				ExportFilterComposite temp = (ExportFilterComposite) c;
				temp.setDeleteButtonEnabled(false);
			}
		}
	}

	if (topParent instanceof ScrolledComposite) {
		((ScrolledComposite) topParent).setMinSize(parent.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	}
	parent.layout(true);
}
 
Example 6
Source File: ExportFilterComposite.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 增加一个组件
 * @param parent
 *            组件容器
 * @param bean
 *            {@link ExportFilterComponentBean};
 */
public void addComponent(Composite parent, ExportFilterComponentBean bean) {
	Integer number = (Integer) parent.getData("currentNumber") + 1;
	parent.setData("currentNumber", number);
	if (number == 2) {
		Control c = parent.getChildren()[0];
		if (c instanceof ExportFilterComposite) {
			ExportFilterComposite temp = (ExportFilterComposite) c;
			temp.setDeleteButtonEnabled(true);
		}
	}

	ExportFilterComposite tempComponent = new ExportFilterComposite(parent, SWT.None, this.ruleType, bean);
	tempComponent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
}
 
Example 7
Source File: EigenLeistungDialog.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(final Composite parent){
	Composite ret = new Composite(parent, SWT.NONE);
	ret.setData("TEST_COMP_NAME", "EigenLeistungDialog_ret"); //$NON-NLS-1$
	ret.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
	ret.setLayout(new GridLayout(2, false));
	new Label(ret, SWT.NONE).setText(Messages.BlockDetailDisplay_shortname); //$NON-NLS-1$
	tKurz = new Text(ret, SWT.BORDER);
	tKurz.setData("TEST_COMP_NAME", "EigenLeistungDialog_tKurz"); //$NON-NLS-1$
	tKurz.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	new Label(ret, SWT.NONE).setText(Messages.BlockDetailDisplay_name); //$NON-NLS-1$
	tName = new Text(ret, SWT.BORDER);
	tName.setData("TEST_COMP_NAME", "EigenLeistungDialog_tName"); //$NON-NLS-1$
	tName.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	new Label(ret, SWT.NONE).setText(Messages.BlockDetailDisplay_costInCents); //$NON-NLS-1$
	tEK = new Text(ret, SWT.BORDER);
	tEK.setData("TEST_COMP_NAME", "EigenLeistungDialog_tEK"); //$NON-NLS-1$
	tEK.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	new Label(ret, SWT.NONE).setText(Messages.BlockDetailDisplay_priceInCents); //$NON-NLS-1$
	tVK = new Text(ret, SWT.BORDER);
	tVK.setData("TEST_COMP_NAME", "EigenLeistungDialog_tVK"); //$NON-NLS-1$
	tVK.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	new Label(ret, SWT.NONE).setText(Messages.BlockDetailDisplay_timeInMinutes); //$NON-NLS-1$
	tTime = new Text(ret, SWT.BORDER);
	tTime.setData("TEST_COMP_NAME", "EigenLeistungDialog_tTime"); //$NON-NLS-1$
	tTime.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	if (result instanceof Eigenleistung) {
		Eigenleistung el = (Eigenleistung) result;
		tName.setText(el.get(Messages.BlockDetailDisplay_title)); //$NON-NLS-1$
		tKurz.setText(el.get(Messages.BlockDetailDisplay_code)); //$NON-NLS-1$
		tEK.setText(el.getKosten(new TimeTool()).getCentsAsString());
		tVK.setText(el.getPreis(new TimeTool(), null).getCentsAsString());
		tTime.setText(el.get(Eigenleistung.TIME));
	}
	return ret;
}
 
Example 8
Source File: BaseMdiEntry.java    From BiglyBT with GNU General Public License v2.0 4 votes vote down vote up
public void show() {
	SelectedContentManager.clearCurrentlySelectedContent();

	UIFunctionsSWT uif = UIFunctionsManagerSWT.getUIFunctionsSWT();
	if (uif != null) {
		//uif.refreshIconBar(); // needed?
		uif.refreshTorrentMenu();
	}



	SWTSkinObject skinObject = getSkinObjectMaster();
	if (skinObject == null) {
		return;
	}
	skinObject.setVisible(true);
	if (skinObject instanceof SWTSkinObjectContainer) {
		SWTSkinObjectContainer container = (SWTSkinObjectContainer) skinObject;
		Composite composite = container.getComposite();
		if (composite != null && !composite.isDisposed()) {
			composite.setVisible(true);
			composite.moveAbove(null);
			//composite.setFocus();
			//container.getParent().relayout();
			composite.getParent().layout();
		}
		// This causes double show because createSkinObject already calls show
		//container.triggerListeners(SWTSkinObjectListener.EVENT_SHOW);
	}

	Composite c = getComposite();
	if (c != null && !c.isDisposed()) {
		c.setData("BaseMDIEntry", this);
		c.setVisible(true);
		c.getParent().layout();
	}

	try {
		// In theory, c.setVisible() will trigger TYPE_SHOWN, but let's
		// call it anyway (it will be ignored if focus is already gained)
		triggerEvent(UISWTViewEvent.TYPE_SHOWN, null);
	} catch (Exception e) {
		Debug.out(e);
	}
	setToolbarVisibility(hasToolbarEnableers());
}
 
Example 9
Source File: ExportFilterSettingDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	container.setLayout(new GridLayout(1, false));

	Composite composite = new Composite(container, SWT.NONE);
	composite.setLayout(new GridLayout(2, false));
	composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	Label filterNameLabel = new Label(composite, SWT.NONE);
	filterNameLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	filterNameLabel.setText(Messages.getString("dialog.ExportFilterSettingDialog.filterNameLabel"));

	filterNameText = new Text(composite, SWT.BORDER);
	filterNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	Composite optionComposite = new Composite(container, SWT.NONE);
	optionComposite.setLayout(new GridLayout(2, false));
	optionComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	isAllCbtn = new Button(optionComposite, SWT.RADIO);
	isAllCbtn.setSize(152, 26);
	isAllCbtn.setText(Messages.getString("dialog.ExportFilterSettingDialog.isAllCbtn"));
	isAllCbtn.setSelection(true);

	isAnyCbtn = new Button(optionComposite, SWT.RADIO);
	isAnyCbtn.setText(Messages.getString("dialog.ExportFilterSettingDialog.isAnyCbtn"));

	ScrolledComposite scrolledComposite = new ScrolledComposite(container, SWT.V_SCROLL | SWT.BORDER);
	scrolledComposite.setAlwaysShowScrollBars(false);
	scrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
	scrolledComposite.setExpandHorizontal(true);
	scrolledComposite.setExpandVertical(true);

	dynaComposite = new Composite(scrolledComposite, SWT.NONE);
	dynaComposite.setBackground(Display.getDefault().getSystemColor((SWT.COLOR_WHITE)));
	scrolledComposite.setContent(dynaComposite);
	scrolledComposite.setMinSize(dynaComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	GridLayout gl_dynaComposite = new GridLayout(1, false);
	dynaComposite.setLayout(gl_dynaComposite);

	ExportFilterComposite exportFilterComponent = new ExportFilterComposite(dynaComposite, SWT.None, ruleType);
	exportFilterComponent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	exportFilterComponent.setDeleteButtonEnabled(false);
	dynaComposite.setData("currentNumber", 1);

	scrolledComposite.setMinSize(dynaComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

	initData();

	return container;
}
 
Example 10
Source File: ExportFilterSettingDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	container.setLayout(new GridLayout(1, false));

	Composite composite = new Composite(container, SWT.NONE);
	composite.setLayout(new GridLayout(2, false));
	composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	Label filterNameLabel = new Label(composite, SWT.NONE);
	filterNameLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	filterNameLabel.setText(Messages.getString("dialog.ExportFilterSettingDialog.filterNameLabel"));

	filterNameText = new Text(composite, SWT.BORDER);
	filterNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	Composite optionComposite = new Composite(container, SWT.NONE);
	optionComposite.setLayout(new GridLayout(2, false));
	optionComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

	isAllCbtn = new Button(optionComposite, SWT.RADIO);
	isAllCbtn.setSize(152, 26);
	isAllCbtn.setText(Messages.getString("dialog.ExportFilterSettingDialog.isAllCbtn"));
	isAllCbtn.setSelection(true);

	isAnyCbtn = new Button(optionComposite, SWT.RADIO);
	isAnyCbtn.setText(Messages.getString("dialog.ExportFilterSettingDialog.isAnyCbtn"));

	ScrolledComposite scrolledComposite = new ScrolledComposite(container, SWT.V_SCROLL | SWT.BORDER);
	scrolledComposite.setAlwaysShowScrollBars(false);
	scrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
	scrolledComposite.setExpandHorizontal(true);
	scrolledComposite.setExpandVertical(true);

	dynaComposite = new Composite(scrolledComposite, SWT.NONE);
	dynaComposite.setBackground(Display.getDefault().getSystemColor((SWT.COLOR_WHITE)));
	scrolledComposite.setContent(dynaComposite);
	scrolledComposite.setMinSize(dynaComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	GridLayout gl_dynaComposite = new GridLayout(1, false);
	dynaComposite.setLayout(gl_dynaComposite);

	ExportFilterComposite exportFilterComponent = new ExportFilterComposite(dynaComposite, SWT.None, ruleType);
	exportFilterComponent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	exportFilterComponent.setDeleteButtonEnabled(false);
	dynaComposite.setData("currentNumber", 1);

	scrolledComposite.setMinSize(dynaComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

	initData();

	return container;
}