ch.heftix.mailxel.client.AddressLabel.java Source code

Java tutorial

Introduction

Here is the source code for ch.heftix.mailxel.client.AddressLabel.java

Source

/*
 * Copyright (C) 2008-2011 by Simon Hefti. All rights reserved.
 * Licensed under the EPL 1.0 (Eclipse Public License).
 * (see http://www.eclipse.org/legal/epl-v10.html)
 * 
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
 * 
 * Initial Developer: Simon Hefti
 */
package ch.heftix.mailxel.client;

import com.google.gwt.user.client.ui.Label;

import ch.heftix.mailxel.client.to.AddressTO;

public class AddressLabel extends Label {

    private String displayText = null;

    public AddressLabel(final AddressTO addressTO) {
        super();
        displayText = AddressTOUtil.getDisplayText(addressTO, AddressTOUtil.DISPLAY_SHORTNAME);
        setText(displayText);
        setStylePrimaryName("addresslabel");
        setTitle(addressTO.address);
    }

    public String getDisplayText() {
        return displayText;
    }

    public int getDisplayTextLength() {
        if (null == displayText) {
            return 0;
        }
        return displayText.length();
    }
}