FileDocCategorySizeDatePackage
BufferedTruncatedLabel.javaAPI DocAzureus 3.0.3.42891Thu Feb 09 19:42:56 GMT 2006org.gudy.azureus2.ui.swt.components

BufferedTruncatedLabel

public class BufferedTruncatedLabel extends BufferedWidget
author
parg

Fields Summary
protected org.eclipse.swt.widgets.Label
label
protected int
width
protected String
value
Constructors Summary
public BufferedTruncatedLabel(org.eclipse.swt.widgets.Composite composite, int attrs, int _width)

	
	
	
				
						
						
	
		super( new Label( composite, attrs ));
		
		label 	= (Label)getWidget();
		width	= _width;
	
Methods Summary
public voidaddMouseListener(org.eclipse.swt.events.MouseListener listener)

    label.addMouseListener(listener);
  
public java.lang.StringgetText()

    return value==null?"":value;
  
public booleanisDisposed()

		return( label.isDisposed());
	
public voidsetCursor(org.eclipse.swt.graphics.Cursor cursor)

    label.setCursor(cursor);
  
public voidsetForeground(org.eclipse.swt.graphics.Color color)

    label.setForeground(color);
  
public voidsetLayoutData(org.eclipse.swt.layout.GridData gd)

		label.setLayoutData( gd );
	
public voidsetText(java.lang.String new_value)

		if ( label.isDisposed()){
			return;
		}
				
		if ( new_value == value ){
			
			return;
		}
		
		if (	new_value != null && 
				value != null &&
				new_value.equals( value )){
					
			return;
		}
		
		value = new_value;
		
			// '&' chars that occur in the text are treated as accelerators and, for example,
			// cause the nect character to be underlined on Windows. This is generally NOT
			// the desired behaviour of a label in Azureus so by default we escape them
		
		label.setText( value==null?"":DisplayFormatters.truncateString( value.replaceAll("&", "&&" ), width ));	
	
public voidsetToolTipText(java.lang.String toolTipText)

    label.setToolTipText(toolTipText);