[geotk] Error in "Display swing widgets" StylePanel dialog ?

Westgård Trond trondwe at IMR.no
Mon Dec 10 04:59:51 PST 2012


Hi Johann,
I am now back in office and I have tried to retest the latest version (snapshot) of geotoolkit-pending.

I get the same error as before, the cartography will not take effect and the variable "activepanel" is null when I press the "Apply-button".

The code fragment where I have the breakpoint is shown below:

Best Regards

Trond

/**
* Property panel
*
 * @author Johann Sorel
* @module pending
*/
public class JPropertyDialog extends JDialog{

    private JButton apply = new JButton(MessageBundle.getString("property_apply"));
    private JButton revert = new JButton(MessageBundle.getString("property_revert"));
    private JButton close = new JButton(MessageBundle.getString("property_close"));

    private JTabbedPane tabs = new JTabbedPane();
    private PropertyPane activePanel = null;
    private ArrayList<PropertyPane> panels = new ArrayList<PropertyPane>();

    /** Creates a new instance of ASDialog */
    private JPropertyDialog(final boolean modal,final boolean app, final boolean rev, final boolean clo) {
        super();
        setModal(modal);
        setTitle(MessageBundle.getString("property_properties"));

        JToolBar bas = new JToolBar();
        bas.setFloatable(false);
        bas.setLayout(new FlowLayout(FlowLayout.RIGHT));

        if(app)bas.add(apply);
        if(rev)bas.add(revert);
        if(clo)bas.add(close);

        apply.setIcon(IconBundle.getIcon("16_apply"));
        revert.setIcon(IconBundle.getIcon("16_reload"));
        close.setIcon(IconBundle.getIcon("16_close"));


        tabs.addChangeListener(new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
                activePanel = (PropertyPane)tabs.getSelectedComponent();
            }
        });

        apply.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) { // HERE THE activePanel is null ???????????????
                if(activePanel != null){
                   activePanel.apply();
                }
            }
        });

From: geotoolkit-bounces at lists.osgeo.org [mailto:geotoolkit-bounces at lists.osgeo.org] On Behalf Of johann sorel
Sent: 26. november 2012 14:12
To: geotoolkit at lists.osgeo.org
Subject: Re: [geotk] Error in "Display swing widgets" StylePanel dialog ?

Hello Trond,

I will have a look at it, I don't think it will be long.

johann


On 26/11/2012 12:40, Westgård Trond wrote:
In our application "MapHandler" that heavily relies on the geotoolkit "Display swing widgets"-module we get an error that did not occur in earlier versions of geotoolkit.

It could be caused by error in our own code since we have done some rewriting, but I have a suspicion to the JPropertyDialog class.

In our example we want to change the colors of the polygons in a FeatureMapLayer. We opens the JSimpleStylePanel dialog and change the color (to red in this case) - see below.

The problem comes when the "Apply"-button is pressed. The action is trigged but the variable activePanel is null. The peculiar thing is that at first the activePanel is set to a correct value and then to null and of course when activePanel is not referening a JSimpleStylePanel then the "apply" method in that class is not performed and then nothing happens in the MapLayer.

Any hints would be appreciated !!

Best Regards

Trond



[cid:image001.jpg at 01CDD6DE.9F841650]


[cid:image002.jpg at 01CDD6DE.9F841650]
Trond Westgård
Senior Engineer
Institute of Marine Research
Bergen, Norway
trondwe at imr.no<mailto:trondwe at imr.no>





_______________________________________________

Geotoolkit mailing list

Geotoolkit at lists.osgeo.org<mailto:Geotoolkit at lists.osgeo.org>

http://lists.osgeo.org/mailman/listinfo/geotoolkit

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geotoolkit/attachments/20121210/e6bb27fb/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 13895 bytes
Desc: image001.jpg
URL: <http://lists.osgeo.org/pipermail/geotoolkit/attachments/20121210/e6bb27fb/attachment-0002.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 55602 bytes
Desc: image002.jpg
URL: <http://lists.osgeo.org/pipermail/geotoolkit/attachments/20121210/e6bb27fb/attachment-0003.jpg>


More information about the Geotoolkit mailing list