[ https://issues.apache.org/jira/browse/PIVOT-559?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13236515#comment-13236515 ]
Sandro Martini commented on PIVOT-559: -------------------------------------- Generally speaking, I like the idea to add other Pivot-related annotations, but in this case I agree with Noel. Maybe we could do something to work like in the ComponentStyleInspectorSkin, to extract styles and report to users, could be generated documentation or even a graphical utility. So I think it's safe to mark this as Won't fix, right ? > use a PivotStyle annotation to help identify style properties on objects > ------------------------------------------------------------------------ > > Key: PIVOT-559 > URL: https://issues.apache.org/jira/browse/PIVOT-559 > Project: Pivot > Issue Type: Improvement > Components: wtk > Reporter: Appddevvv > Priority: Minor > > Benefits: > a) You can write a scanner to find styles and list them. This helps you avoid > having to filter direct bean properties on skins to list styles and identify > the canonical style. > b) Helps both clients as well as developers understand the impact of this > style on layout and painting. > c) Helps you implement style stacks and preferences so you can pull styles > from a skin and save them in preferences without pulling extraneous > information from the skin or having to do clever property filtering. > I can include an annotation scanner that returns a list of style annotations > from a class if that helps although its quite trivial. > Prototype is below: > /* > * Licensed to the Apache Software Foundation (ASF) under one or more > * contributor license agreements. See the NOTICE file distributed with > * this work for additional information regarding copyright ownership. > * The ASF licenses this file to you 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.apache.pivot.wtk; > import java.lang.annotation.ElementType; > import java.lang.annotation.Inherited; > import java.lang.annotation.Retention; > import java.lang.annotation.RetentionPolicy; > import java.lang.annotation.Target; > /** > * Indicates that a property is a pivot style and provides > * useful information for drawing optimization and discovery. > * > * > * <p>By convention, the annotation should annotate the setter and not > * a field or the getter. Java bean conventions suggests that the > * setter takes one parameter. If more than one method with a similar name > * exists in a class, but has a different setter parameter, > * choose the setter with the most specific parameter and that > * does not require a conversion internal to the class to use > * e.g. choose the setter with the {@code Paint} parameter instead > * of the setter with the string parameter that has to be parsed > * to create a {@code Paint} object. Or if the same method name > * can also take a {@code Color} object but you use a {@code Paint} > * object in the implementation, still select the {@code Paint} > * object. It would be up to an external processor to decide > * if other methods with the same name but different parameters > * should be used instead. > * > */ > @Inherited > @Retention(RetentionPolicy.RUNTIME) > @Target(ElementType.METHOD) > public @interface PivotStyle { > /** > * When true, indicates this style requires a component invalidation > * to force layout because the style affects the layout e.g. the size > * of something. > */ > boolean affectsLayout() default true; > /** > * When true, indicates this style requires a repaint > * if it is set because it affects painting. > */ > boolean affectsPainting() default true; > /** > * A description of the style. > */ > String description() default ""; > /** > * The category of the style such as "Colors" or "Animation". > * A category groups similar style properties together for > * browsing convenience. > */ > String category() default ""; > } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira