/*
 * JBoss, Home of Professional Open Source
 * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
 * as indicated by the @author tags. All rights reserved.
 * See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This copyrighted material is made available to anyone wishing to use,
 * modify, copy, or redistribute it subject to the terms and conditions
 * of the GNU Lesser General Public License, v. 2.1.
 * This program is distributed in the hope that it will be useful, but WITHOUT A
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public License,
 * v.2.1 along with this distribution; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA  02110-1301, USA.
 */
package org.jboss.as.console.client.core;

import com.google.inject.Inject;
import org.jboss.as.console.client.Console;

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

/**
 * Configuration for the top level tabs.
 *
 * @author Harald Pehl
 */
public class ToplevelTabs implements Iterable<ToplevelTabs.Config> {

    public static class Config {

        private final String token;
        private final String title;
        private final boolean updateToken;

        public Config(final String token, final String title, final boolean updateToken) {
            this.token = token;
            this.title = title;
            this.updateToken = updateToken;
        }

        @Override
        public boolean equals(final Object o) {
            if (this == o) { return true; }
            if (!(o instanceof Config)) { return false; }

            Config that = (Config) o;

            if (!token.equals(that.token)) { return false; }

            return true;
        }

        @Override
        public int hashCode() {
            return token.hashCode();
        }

        @Override
        public String toString() {
            return "ToplevelTab{token='" + token + '\'' + '}';
        }

        public String getToken() {
            return token;
        }

        public String getTitle() {
            return title;
        }

        public boolean isUpdateToken() {
            return updateToken;
        }
    }


    private final List<Config> tabs;

    @Inject
    public ToplevelTabs(final BootstrapContext bootstrapContext) {
        tabs = new LinkedList<Config>();
        tabs.add(new Config(NameTokens.HomepagePresenter, "<i class='icon-home'></i> Home", true));
        if (bootstrapContext.isStandalone()) {
            tabs.add(new Config(NameTokens.DeploymentBrowserPresenter, "<i class='icon-suitcase'></i> Deployments", false));
            tabs.add(new Config(NameTokens.serverConfig, "<i class='icon-gears'></i> Configuration", false));
            tabs.add(new Config(NameTokens.StandaloneRuntimePresenter, "<i class='icon-bar-chart'></i> Runtime", false));
        } else {
            tabs.add(new Config(NameTokens.DeploymentsPresenter, "<i class='icon-suitcase'></i> Deployments", false));
            tabs.add(new Config(NameTokens.ProfileMgmtPresenter, "<i class='icon-gears'></i> Configuration", false));
            tabs.add(new Config(NameTokens.HostMgmtPresenter, "<i class='icon-sitemap'></i> Domain", false));
            tabs.add(new Config(NameTokens.DomainRuntimePresenter, "<i class='icon-bar-chart'></i> Runtime", false));
        }
        tabs.add(new Config(NameTokens.AdministrationPresenter, "<i class='icon-shield'></i> Administration", false));
    }

    @Override
    public Iterator<Config> iterator() {
        return tabs.iterator();
    }

    public boolean isEmpty() {return tabs.isEmpty();}

    public boolean add(final Config config) {return tabs.add(config);}
}

@@ -2651,34 +2651,8 @@
 r, %22
-%3Ci class='icon-home'%3E%3C/i%3E 
 Home
@@ -2785,38 +2785,8 @@
 r, %22
-%3Ci class='icon-suitcase'%3E%3C/i%3E 
 Depl
@@ -2866,35 +2866,8 @@
 g, %22
-%3Ci class='icon-gears'%3E%3C/i%3E 
 Conf
@@ -2963,39 +2963,8 @@
 r, %22
-%3Ci class='icon-bar-chart'%3E%3C/i%3E 
 Runt
@@ -3065,38 +3065,8 @@
 r, %22
-%3Ci class='icon-suitcase'%3E%3C/i%3E 
 Depl
@@ -3154,35 +3154,8 @@
 r, %22
-%3Ci class='icon-gears'%3E%3C/i%3E 
 Conf
@@ -3242,37 +3242,8 @@
 r, %22
-%3Ci class='icon-sitemap'%3E%3C/i%3E 
 Doma
@@ -3328,39 +3328,8 @@
 r, %22
-%3Ci class='icon-bar-chart'%3E%3C/i%3E 
 Runt
@@ -3422,36 +3422,8 @@
 r, %22
-%3Ci class='icon-shield'%3E%3C/i%3E 
 Admi

Remove icons form top level navigation