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

The following are Jave code examples for showing how to use setData() of the org.eclipse.swt.widgets.Label class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: neoscada   File: MainPage.java   View Source Code Vote up 5 votes
@Override
public void createContent ( final Composite parent )
{
    parent.setLayout ( new GridLayout ( 1, false ) );

    final Label label = new Label ( parent, SWT.NONE );
    label.setText ( System.getProperty ( Properties.MAIN_PAGE_TEXT, "Administration Console" ) );
    label.setData ( RWT.CUSTOM_VARIANT, "mainLabel" );

    final GridData gd = new GridData ( SWT.CENTER, SWT.BEGINNING, true, true );
    gd.verticalIndent = 20;
    label.setLayoutData ( gd );
}
 
Example 2
Project: gw4e.project   File: GraphModelPropertyPage.java   View Source Code Vote up 5 votes
public Control createContents(Composite parent) {

		noDefaultAndApplyButton();
		Composite panel = createComposite(parent, 2);

		// PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),PROPERTY_PAGE_CONTEXT);

		IResource resource = (IResource) getElement();

		if (resource.getType() == IResource.FILE) {
			Label label = createLabel(panel, MessageUtil.getString("File_name")); //$NON-NLS-1$
			label = createLabel(panel, resource.getName());
			label.setData(GW4E_LABEL_ID,GW4E_LABEL_ID);
			fillExcessHorizontalSpace(label);

			//
			createLabel(panel, MessageUtil.getString("Path")); //$NON-NLS-1$
			label = createLabel(panel, resource.getFullPath().setDevice(null).toString());
			fillExcessHorizontalSpace(label);

			createLabel(panel, MessageUtil.getString("modified")); //$NON-NLS-1$
			IFile file = (IFile) resource;
			label = createLabel(panel, formatDate(new Date(file.getLocalTimeStamp())));
			fillExcessHorizontalSpace(label);

			createrequirementSection(panel, file);
			createMethodSection(panel, file);
		}
		return new Canvas(panel, 0);
	}
 
Example 3
Project: Hydrograph   File: HivePartitionKeyValueDialog.java   View Source Code Vote up 5 votes
/**
 * 	
 * @param container
 */
private void addErrorLabel(Composite container) {
		
	lblPropertyError = new Label(container, SWT.NONE);
	lblPropertyError.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,true,0,0));
	lblPropertyError.setForeground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 0, 0));
	lblPropertyError.setText(Messages.HIVE_FIELD_DIALOG_ERROR);
	lblPropertyError.setVisible(false);
	lblPropertyError.setData("Error", lblPropertyError);
	keyValueTableViewer.setData("Error", lblPropertyError);
}
 
Example 4
Project: Hydrograph   File: HiveInputExtractMetaStoreDialog.java   View Source Code Vote up 5 votes
private void addErrorLabel(Composite container) {
	
	lblPropertyError = new Label(container, SWT.NONE);
	lblPropertyError.setForeground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255, 0, 0));
	lblPropertyError.setText(CREDENTIAL_BLANK_ERROR);
	lblPropertyError.setVisible(false);
	lblPropertyError.setData("Error", lblPropertyError);
	
}
 
Example 5
Project: openaudible   File: BookInfoPanel.java   View Source Code Vote up 5 votes
private GridComposite createStatsView(GridComposite parent) {
    GridComposite c = null;
    if (true) {
        c = new GridComposite(parent, SWT.BORDER_DOT);

        c.initLayout(2, false, GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
        c.noMargins();


        c.getGridData().horizontalIndent = 0;
        c.getGridData().verticalIndent = 0;
        // c.debugLayout(SWT.COLOR_BLUE);

    } else {
        c = parent;
    }

    for (BookElement s : elems) {


        String labelName = getName(s);
        Label l = c.newLabel();
        l.setText(Translate.getInstance().labelName(labelName) + ": ");
        l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        l.setFont(FontShop.tableFontBold());
        l.setBackground(bgColor);

        Label d = c.newLabel();
        d.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        d.setFont(FontShop.tableFont());
        d.setBackground(bgColor);
        d.setData(s);
        stats[s.ordinal()] = d;
    }
    return c;
}
 
Example 6
Project: openaudible   File: StatusPanel.java   View Source Code Vote up 5 votes
StatusPanel(Composite c) {
    super(c, SWT.NONE);
    initLayout(2, false, GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);

    BookNotifier.getInstance().addListener(this);
    ConnectionNotifier.getInstance().addListener(this);

    Status elems[] = Status.values();
    stats = new Label[elems.length];


    for (int x = 0; x < elems.length; x++) {
        if (!elems[x].display())
            continue;
        String labelName = elems[x].displayName();
        Label l = newLabel();
        l.setText(Translate.getInstance().labelName(labelName) + ": ");
        l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        l.setFont(FontShop.tableFontBold());
        l.setBackground(bgColor);

        Label d = newLabel();
        GridData gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
        // gd.widthHint=120;
        d.setLayoutData(gd);

        d.setFont(FontShop.tableFont());
        d.setBackground(bgColor);
        d.setData(elems[x]);
        stats[x] = d;
    }

    _update();
}
 
Example 7
Project: gw4e.project   File: LabelizedTexts.java   View Source Code Vote up 4 votes
/**
 * Create the composite.
 * @param parent
 * @param style
 */
public LabelizedTexts(Composite parent, 
		int style,
		Property[]  properties,
		String id) {
	super(parent, style);
	
	
	this.properties = properties;
	
	setLayout(new GridLayout(10, false));
	
	texts = new Text [properties.length];
	for (int i = 0; i < texts.length; i++) {
		Label lblNewLabel = new Label(this, SWT.NONE);
		GridData gridData = new GridData();
		gridData.horizontalAlignment = GridData.FILL;
		gridData.horizontalSpan = 4;
		lblNewLabel.setLayoutData(gridData);
		lblNewLabel.setText(properties [i].getLabel() );
		lblNewLabel.setData(PROJECT_PROPERTY_PAGE_WIDGET_ID, LABEL + "." + id + "." + i );
		
		final int index = i;  
		ModifyListener listener = new ModifyListener() {
		    public void modifyText(ModifyEvent e) {
		    	properties[index].check(new String [] {texts [index].getText() });
		    }
		};
		
		if (properties [i].isMultitext()) {
			texts [i] = new Text(this, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
			texts [i] .setText(properties [i].getValue());
			texts [i] .setEnabled(properties [i].isEditable());
			texts [i] .setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 6, 1));
			texts [i].addModifyListener(listener);
		} else {
			texts [i] = new Text(this, SWT.BORDER);
			texts [i] .setText(properties [i].getValue());
			texts [i] .setEnabled(properties [i].isEditable());
			texts [i] .setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 6, 1));
			texts [i].addModifyListener(listener);
		}
		texts [i].setData(PROJECT_PROPERTY_PAGE_WIDGET_ID, TEXT + "." + id + "." + i );
	}
}
 
Example 8
Project: BiglyBT   File: LinkLabel.java   View Source Code Vote up 4 votes
public static void updateLinkedLabel(Label label, String hyperlink) {
	label.setData(hyperlink);
	label.setToolTipText(hyperlink);
}