Larry, As the list of styles on a layer is not thread safe you should disable firing events if you are changing the list of styles for a layer in any other thread than the rendering thread, otherwise you could get concurrent modification execptions when reading the list of styles.
Paul Larry Becker wrote: >> But why should I turn off firing events for a CTS and not for a >> BasicStyle ? >> > > You're right. You shouldn't have to do that. Apparently the Layer > Tree needs a ColorThemingStyle, and the code was structured so that if > one is not present, it is always added. We should probably add this > issue to the bug tracker. The fix would be to simply always add a CTS > when BasicStyle and LabelStyle are added and to add support in Layer > via a getColorThemingStyle() method. There are getBasicStyle(), > getLabelStyle(), and getVertexSTyle() methods, but no getCTS method. > Why??? > > regards, > Larry Becker > > > On 9/12/07, Malte Weller <[EMAIL PROTECTED]> wrote: > >> Hello Paul, hello Larry, >> >> sorry for my late response, but I'm working from 9 to 7 in Germany ..... >> :-) >> >> But it is good to know that I get a response in the early evening on the >> same day if I have a question in the morning. :-D >> >> Paul, >> after I tried it with turned off firing events on the layer manager I >> could remove the first CTS without any problems. >> So thank's for that. >> But why should I turn off firing events for a CTS and not for a >> BasicStyle ? >> >> Greetings from Hannover, Germany on a fresh but not rainy wednesday, >> Malte >> >> Paul Austin schrieb: >> >>> Malte, >>> >>> Did you turn off firing events on the layer manager before starting to >>> make your changes? >>> >>> Paul >>> >>> Larry Becker wrote: >>> >>> >>>> Oh, I figured the first answer was a little too obvious. 8-) >>>> >>>> As to where the CTS object is coming from, I think it is >>>> LayerTreeModel.getChildren(): >>>> >>>> if (parent instanceof Layer >>>> && ColorThemingStyle.get((Layer) parent).isEnabled()) { >>>> ... >>>> >>>> ColorThemingStyle.get() is: >>>> >>>> public static ColorThemingStyle get(Layer layer) { >>>> if ((ColorThemingStyle) >>>> layer.getStyle(ColorThemingStyle.class) == null) { >>>> ColorThemingStyle colorThemingStyle = new >>>> ColorThemingStyle( >>>> pickNonSpatialAttributeName(layer >>>> >>>> .getFeatureCollectionWrapper().getFeatureSchema()), >>>> new HashMap(), new >>>> BasicStyle(Color.lightGray)); >>>> layer.addStyle(colorThemingStyle); >>>> } >>>> return (ColorThemingStyle) >>>> layer.getStyle(ColorThemingStyle.class); >>>> } >>>> >>>> It seems to always add a CTS if one is not found. A very strange side >>>> effect. >>>> >>>> regards, >>>> Larry >>>> On 9/11/07, Malte Weller <[EMAIL PROTECTED]> wrote: >>>> >>>> >>>> >>>>> Hi Larry, >>>>> >>>>> thanks for your reply. >>>>> >>>>> I know that the CTS added first should be removed first. ;-) >>>>> But I was only able to remove that after I added the second one. >>>>> >>>>> In my Thread I look at the Style-List of my new Layer if it holds a CTS >>>>> Object. >>>>> If so, I try to remove it because my new CTS Object should be used. >>>>> Surprisingly I could not remove it. It will added immediately at the >>>>> end of the List again. >>>>> For example at the beginning it was in the middle of the List and now I >>>>> find it at the end. >>>>> I can remove a BasicStyle Object without any problems. >>>>> It is only possible to remove the first CTS Object from the List after I >>>>> added my new one. >>>>> >>>>> I think, I should be able to remove the first CTS from the list without >>>>> any trouble like the BasicStyle and not only after I added a second one. >>>>> Maybe, the use of a Thread causes this problem ? >>>>> >>>>> Greetings from Hannover, >>>>> Malte >>>>> >>>>> Larry Becker schrieb: >>>>> >>>>> >>>>> >>>>>> Hi Malte, >>>>>> >>>>>> If I understand you correctly, I guess I'm not surprised at the >>>>>> fact that a Style added first would be removed first since the >>>>>> underlying data structure is an ArrayList. The javadoc for ArrayList >>>>>> says that list.remove(o) will delete the first occurance of o in list. >>>>>> >>>>>> regards, >>>>>> Larry Becker >>>>>> >>>>>> On 9/10/07, Malte Weller <[EMAIL PROTECTED]> wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>> Hello List, >>>>>>> >>>>>>> I use a Thread to create several Layers from a Database. >>>>>>> My run-Method calls two other Methods. >>>>>>> First one to create and add the layers. >>>>>>> Second one to create a ColorThemingStyle-Object to add this to the >>>>>>> created Layer. >>>>>>> >>>>>>> If the Layer holds a ColorThemingStyle-Object it should be removed and >>>>>>> the new one should be added. >>>>>>> By default my new Layers are holding a ColorThemingStyle-Object (Does >>>>>>> anybody know where this one will be added to the Layers Style List ?). >>>>>>> >>>>>>> Immediately after I removed the "default" CTS-Object from the List it >>>>>>> will be added again at the end. >>>>>>> So I cannot remove this "default" CTS-Object. >>>>>>> After I added my new CTS-Object it looks like that the "default" >>>>>>> CTS-Object is still be used instead. >>>>>>> >>>>>>> I found a workaround for that. >>>>>>> I add my new CTS-Object first and then I remove a CTS-Object with >>>>>>> >>>>>>> "layer.removeStyle(ColorThemingStyle.get(layer)); >>>>>>> >>>>>>> Surprisingly the "default" CTS-Object has been removed and the new CTS >>>>>>> is shown. >>>>>>> >>>>>>> Can anybody varify this behaviour and has a explanation for it ? >>>>>>> >>>>>>> Greetings from Hannover, >>>>>>> Malte >>>>>>> >>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------------- >>>>>>> This SF.net email is sponsored by: Microsoft >>>>>>> Defy all challenges. Microsoft(R) Visual Studio 2005. >>>>>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >>>>>>> _______________________________________________ >>>>>>> Jump-pilot-devel mailing list >>>>>>> Jump-pilot-devel@lists.sourceforge.net >>>>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>> ------------------------------------------------------------------------- >>>>> This SF.net email is sponsored by: Microsoft >>>>> Defy all challenges. Microsoft(R) Visual Studio 2005. >>>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >>>>> _______________________________________________ >>>>> Jump-pilot-devel mailing list >>>>> Jump-pilot-devel@lists.sourceforge.net >>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>> ------------------------------------------------------------------------- >>> This SF.net email is sponsored by: Microsoft >>> Defy all challenges. Microsoft(R) Visual Studio 2005. >>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >>> _______________________________________________ >>> Jump-pilot-devel mailing list >>> Jump-pilot-devel@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >>> >>> >>> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2005. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >> _______________________________________________ >> Jump-pilot-devel mailing list >> Jump-pilot-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >> >> >> >> > > > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel