StepNavigatorButtonContent.java :  » Ajax » aribaweb » ariba » ui » widgets » Java Open Source

Java Open Source » Ajax » aribaweb 
aribaweb » ariba » ui » widgets » StepNavigatorButtonContent.java
package ariba.ui.widgets;

import ariba.ui.aribaweb.core.AWComponent;
import ariba.util.core.MapUtil;
import ariba.util.core.StringUtil;
import java.util.Map;

public class StepNavigatorButtonContent extends AWComponent
{
    private static Map ImagesForString = MapUtil.map(2);

    static {
        ImagesForString.put("<", "navPrevious.gif");
        ImagesForString.put(">", "navNext.gif");
    }

    public String[] _tokens;
    public String _currentToken;
    public int _index;

    protected void awake ()
    {
        super.awake();
        String value  = stringValueForBinding(BindingNames.value);
        if (value.indexOf(' ') > -1) {
            _tokens = StringUtil.delimitedStringToArray(value, ' ');
        }
        else {
            _tokens = new String[1];
            _tokens[0] = value;
        }
    }

    protected void sleep ()
    {
        _tokens = null;
        _currentToken = null;
        super.sleep();
    }

    public String currentImage ()
    {
        return (String)ImagesForString.get(_currentToken);   
    }

    public String spaceIfAny ()
    {
        return (_index < _tokens.length-1) ? " ": null;
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.