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

nl.cloudfarming.client.geoviewer.jxmap.layerlist.LayerListPanel Maven / Gradle / Ivy

Go to download

AgroSense geoviewer JXMap implementation. Contains a map/geoviewer TopComponent based on the JXMap classes from swingx.

There is a newer version: 13.03-beta
Show newest version
/**
 * Copyright (C) 2010-2012 Agrosense [email protected]
 *
 * Licensed under the Eclipse Public License - v 1.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.eclipse.org/legal/epl-v10.html
 *
 * 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 nl.cloudfarming.client.geoviewer.jxmap.layerlist;

import java.awt.Color;
import java.awt.Dimension;
import javax.swing.ListSelectionModel;
import javax.swing.border.BevelBorder;
import net.miginfocom.swing.MigLayout;
import org.jdesktop.swingx.JXPanel;
import org.jdesktop.swingx.painter.CompoundPainter;
import org.jdesktop.swingx.painter.MattePainter;
import org.jdesktop.swingx.painter.PinstripePainter;
import org.openide.explorer.ExplorerManager;
import org.openide.explorer.view.BeanTreeView;
import org.openide.explorer.view.ListView;

/**
 *
 * @author Timon Veenstra
 */
public class LayerListPanel extends JXPanel implements ExplorerManager.Provider {

    //TODO retrieve colors from a branded color scheme
    //private static final Color COLOR_1 = new Color(191, 148, 6);
    private static final Color COLOR_BASE = new Color(225, 225, 225);
    private static final Color COLOR_SHADOW = new Color(150, 150, 150);
    private static final Color COLOR_HIGH = new Color(210, 210, 210);
//    private final ListView listView = new ListView();
    private final ListView listView = new ListView();
    private final ExplorerManager explorerManager;

    public LayerListPanel(final ExplorerManager explorerManager) {
//        listView.setRootVisible(false);
        this.explorerManager = explorerManager;
                
        listView.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        listView.setPreferredSize(new Dimension(200, 200));
        setPreferredSize(new Dimension(200, 600));
        setLayout(new MigLayout("wrap 1"));
        setupPainters();
        setBorder(new BevelBorder(BevelBorder.RAISED, COLOR_HIGH, COLOR_SHADOW));
        setDoubleBuffered(true);
        add(listView, "dock north");
        setAlpha(.8f);
    }

    private void setupPainters() {
        //Tom doesnt like the gloss :)
//        GlossPainter gloss = new GlossPainter(new Color(1.0f, 1.0f, 1.0f, 0.2f),
//                GlossPainter.GlossPosition.TOP);
        
        PinstripePainter stripes = new PinstripePainter();
        stripes.setPaint(new Color(1.0f, 1.0f, 1.0f, 0.17f));
        stripes.setSpacing(5.0);
        
        MattePainter matte = new MattePainter(COLOR_BASE);

        setBackgroundPainter(new CompoundPainter(matte,stripes)); 
    }
    
    @Override
    public void addNotify() {
        super.addNotify();
        listView.addNotify();
    }

    @Override
    public ExplorerManager getExplorerManager() {
        return explorerManager;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy