Package org.cafesip.jiplet.console.client

Source Code of org.cafesip.jiplet.console.client.ContextPropertiesView

/*
* Created on Dec 14, 2008
*
* Copyright 2005 CafeSip.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.cafesip.jiplet.console.client;

import java.util.ArrayList;
import java.util.HashMap;

import org.cafesip.gwtcomp.client.utils.HTMLHelper;
import org.cafesip.jiplet.console.client.rpc.ContextElement;

import com.google.gwt.user.client.ui.SourcesTabEvents;
import com.google.gwt.user.client.ui.TabListener;

/**
* @author Becky McElroy
*
*/
public class ContextPropertiesView extends DetailsView
{
    ContextElement context;
   
    private boolean first = true;

    public ContextPropertiesView(ContextElement context)
    {
        super("Context Details", "Jiplets", new ContextJipletListView(context
                .getName()));
       
        this.context = context;
       
        initListeners();
    }

    /**
     *
     */
    private void initListeners()
    {
        getPanel().addTabListener(new TabListener() {

            public boolean onBeforeTabSelected(SourcesTabEvents sender,
                    int tabIndex)
            {
                return true;
            }

            public void onTabSelected(SourcesTabEvents sender, int tabIndex)
            {
                if (tabIndex == 1)
                {
                    redraw();
                }
               
            }});
    }

    public void display()
    {
        ContextJipletListView v = (ContextJipletListView) detail;
        HashMap<String, String> map = new HashMap<String, String>();

        map.put("Context Name", format(context.getName()));
        map.put("Description", format(context.getDisplayName()));
        map.put("Path", format(context.getPath()));
        map.put("Type", format(context.getTypeDescription()));
        ArrayList<String> list = context.getSelectionCriteriaStringList();
        map.put("Selection Criteria", HTMLHelper.orderedList(list
                .toArray(new String[list.size()])));

        displayGeneral(map);

        v.displayList(context.getJiplets());
    }
   
    private void redraw()
    {
        if (first)
        {
            ContextJipletListView v = (ContextJipletListView) detail;
            v.getTable().redraw();           
            first = false;
        }

    }
}
TOP

Related Classes of org.cafesip.jiplet.console.client.ContextPropertiesView

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.