All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.as.console.client.widgets.pages.LinkBar Maven / Gradle / Ivy

Go to download

Bundles the core AS7 console as a GWT module. Includes minor customizations to support extensions.

There is a newer version: 0.7.0.Final
Show newest version
package org.jboss.as.console.client.widgets.pages;

import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Widget;

import java.util.LinkedList;
import java.util.List;

/**
 * @author Heiko Braun
 * @date 12/6/11
 */
public class LinkBar {

    private HorizontalPanel bar;
    private int numLinks = 0;
    private List links = new LinkedList();

    public LinkBar() {
        this.bar = new HorizontalPanel();
    }

    public Widget asWidget() {

        // last element to the right
        HTML placeHolder = new HTML();
        this.bar.add(placeHolder);
        placeHolder.getElement().getParentElement().setAttribute("width", "100%");

        return bar;
    }

    public void addLink(String text, ClickHandler handler) {

        HTML html = new HTML();
        html.setHTML(""+text+"");

        html.addClickHandler(handler);
        html.addStyleName("link-bar");

        if(numLinks==0)
        {
            html.addStyleName("link-bar-first");
        }

        links.add(html);

        bar.add(html);

        numLinks++;

    }

    public void setActive(int index) {
        for(int i=0; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy