Package jsynoptic.builtin.ui

Source Code of jsynoptic.builtin.ui.ConnectionPropertiesPanel

/* ========================
* JSynoptic : a free Synoptic editor
* ========================
*
* Project Info:  http://jsynoptic.sourceforge.net/index.html
*
* This program is free software; you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY 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 along with this
* program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* (C) Copyright 2001-2005, by :
*     Corporate:
*         EADS Astrium SAS
*         EADS CRC
*     Individual:
*         Claude Cazenave
*
* $Id: ConnectionPropertiesPanel.java,v 1.8 2008/10/10 11:17:38 ogor Exp $
*
* Changes
* -------
* 23 ao�t 2006  : Initial public release (CC);
*
*/
package jsynoptic.builtin.ui;

import java.util.ResourceBundle;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import jsynoptic.builtin.ConnectionShape;

import simtools.ui.GridBagPanel;
import simtools.ui.ResourceFinder;

/**
* @author zxpletran007
*
*/
public class ConnectionPropertiesPanel extends PropertiesPanel1D {
    protected JCheckBox displayFirstArrow, displayLastArrow;

    public static ResourceBundle resources = ResourceFinder.get(ConnectionShape.class);

    public ConnectionPropertiesPanel(String shapeName) {
        super(false, false, true, false, shapeName);
        addOnCurrentRow(createContent());
    }

    /*
     * (non-Javadoc)
     *
     * @see jsynoptic.builtin.SimpleShape.PropertiesPanel#createContent()
     */
    public JComponent createContent() {
        displayFirstArrow = new JCheckBox(resources.getString("displayFirstArrow"));
        displayLastArrow = new JCheckBox(resources.getString("displayLastArrow"));
        GridBagPanel connectionPanel = new GridBagPanel(resources.getString("Connection"));
        connectionPanel.addOnCurrentRow(displayFirstArrow);
        connectionPanel.addOnCurrentRow(displayLastArrow);
        return connectionPanel;
    }

    public String[] getPropertyNames() {
        if (_propertyNames == null) {
            _propertyNames = new ConnectionShape.ConnectionShapePropertiesNames().getPropertyNames();
        }
        return _propertyNames;
    }

    /*
     * (non-Javadoc)
     *
     * @see simtools.ui.JPropertiesPanel#getPropertyValue(java.lang.String)
     */
    public Object getPropertyValue(String name) {
        Object res = super.getPropertyValue(name);
        if (name.equalsIgnoreCase("DISPLAY_FIRST_ARROW")) {
            return new Boolean(displayFirstArrow.isSelected());
        } else if (name.equalsIgnoreCase("DISPLAY_LAST_ARROW")) {
            return new Boolean(displayLastArrow.isSelected());
        }
        return res;
    }

    /*
     * (non-Javadoc)
     *
     * @see simtools.ui.JPropertiesPanel#setPropertyValue(java.lang.String,
     *      java.lang.Object)
     */
    public void setPropertyValue(String name, Object value) {
        super.setPropertyValue(name, value);
        if (name.equalsIgnoreCase("DISPLAY_FIRST_ARROW")) {
            if (value instanceof Boolean) {
                displayFirstArrow.setSelected(((Boolean) value).booleanValue());
            }
        } else if (name.equalsIgnoreCase("DISPLAY_LAST_ARROW")) {
            if (value instanceof Boolean) {
                displayLastArrow.setSelected(((Boolean) value).booleanValue());
            }
        }
    }
}
TOP

Related Classes of jsynoptic.builtin.ui.ConnectionPropertiesPanel

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.