On 12 December 2014 at 22:36, Martin Grigorov <[email protected]> wrote:
> Dan,
>
> WDYT about the Icon thingy I've explained earlier ?
>
Hi Martin,
sorry not to reply sooner on this, just catching up.
> I think I can see how to rework cssClassFa to icon for annotations.
I like what you've sketched.
> But I
> cannot imagine it yet with .layout.json.
>
>
Perhaps the Icon implementations should be JavaBeans with getters and
setters, so that they could be constructed by parsing the .json file.
That is, rather than:
new FAIcon("fa-xyz", Icon.Position.RIGHT))
it would be:
FAIcon i = new FAIcon();
i.setCssClass("fa-xyz");
i.setPosition(Icon.Position.RIGHT);
that way it could be serialized in .layout.json as:
icon={
"class": "com.mycompany.fonticons.FAIcon",
"properties": {
"cssClass": "fa-xyz",
"position": "RIGHT"
}
}
where all the properties are set reflectively.
~~~
Do you want to raise a ticket for this?
Cheers
Dan
I imagine something like:
> public interface Icon {
> enum Position {LEFT, RIGHT}
>
> String toHtml();
> Position getPosition();
> }
>
> usage:
> @ActionLayout(..., icon = new FAIcon("fa-xyz")) // renders <span class="fa
> fa-xyz"> on the left of the title
>
> @ActionLayout(..., icon = new FAIcon("fa-xyz", Icon.Position.RIGHT)) //
> renders <span class="fa fa-xyz"> on the right of the title
>
> @ActionLayout(..., icon = new StackedFAIcon(Large, "fa-square-o
> fa-stack-2x", "fa-twitter fa-stack-1x")) // renders <span class="fa-stack
> fa-lg"><i class="fa fa-square-o fa-stack-2x"></i><i class="fa fa-twitter
> fa-stack-1x"></i></span> on the left of the title
>
> @ActionLayout(..., icon = new Icon8("Android-L", 24, "Diploma 1")) //
> renders <img class="icon icons8-Diploma-1"
> src="data:image/png;base64,iVBO..." width="50" height="50">
>
> @ActionLayout(..., icon = new GlyphIcon("glyphicon-xyz")) // renders <i
> class="glyphicon glyphicon-xyz"></i>
>
> The applications themselves can provide impls of Icon for whatever they
> need.
>
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Sat, Dec 13, 2014 at 12:23 AM, Martin Grigorov <[email protected]>
> wrote:
>
> > I find them a bit distracting but you may find them useful for something
> > someday - http://l-lin.github.io/font-awesome-animation/
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Fri, Dec 12, 2014 at 1:49 PM, Martin Grigorov <[email protected]>
> > wrote:
> >
> >> Hi,
> >>
> >> I have also thought about this before.
> >> The main issue that I see is that some font/svg icons prescribe usage of
> >> specific HTML elements. For example some say you should use <i
> >> class="...">, others <span class="...">, FontAwesome also has more
> complex
> >> HTML structure for stacked icons (see http://fontawesome.io/examples/).
> >>
> >> At the moment we use <span> and there is no support for complex HTML
> >> structure.
> >>
> >> We can rename 'cssClassFa' in annotations to 'fontIcon' to make it more
> >> generic.
> >> Its value though will have to be an Icon interface that knows how to
> >> render itself.
> >> E.g. FAIcon will render as <span> with predefined CSS class "fa":
> >>
> >> fontIcon = new FAIcon("circle")
> >>
> >> will produce: <span class="fa fa-circle"></span>
> >>
> >> Just thinking out load.
> >>
> >> On Fri, Dec 12, 2014 at 1:34 PM, GESCONSULTOR <[email protected]>
> >> wrote:
> >>
> >>> Is not this too concrete?
> >>>
> >>> Could it be specified by means of a more generic mechanism?
> >>>
> >>> I find too specific to have an annotation property for a concrete set
> of
> >>> icons. There are others currently also used (like icons8, etc) that
> could
> >>> be also referred.
> >>>
> >>> Perhaps a mechanism a bit more generic could instead be used? Or at
> >>> least an annotation field name not referring on its name the "font
> awesome"
> >>> initials?
> >>>
> >>> HTH,
> >>>
> >>> Oscar
> >>>
> >>>
> >>> > El 12/12/2014, a las 11:13, Dan Haywood (JIRA) <[email protected]>
> >>> escribió:
> >>> >
> >>> > Dan Haywood created ISIS-974:
> >>> > --------------------------------
> >>> >
> >>> > Summary: Provide the ability to associate font-awesome
> >>> icons with properties
> >>> > Key: ISIS-974
> >>> > URL: https://issues.apache.org/jira/browse/ISIS-974
> >>> > Project: Isis
> >>> > Issue Type: Improvement
> >>> > Components: Core, Viewer: Wicket
> >>> > Affects Versions: core-1.7.0, viewer-wicket-1.7.0
> >>> > Reporter: Dan Haywood
> >>> > Assignee: Dan Haywood
> >>> > Priority: Minor
> >>> > Fix For: viewer-wicket-1.9.0, core-1.9.0
> >>> >
> >>> >
> >>> > ie as per
> >>> http://fortawesome.github.io/Font-Awesome/examples/#bootstrap
> >>> >
> >>> > using:
> >>> >
> >>> > @PropertyLayout(
> >>> > cssClassFa="fa fa-fw fa-envelope-o"
> >>> > )
> >>> > public String getEmailAddress() { ... }
> >>> >
> >>> > etc.
> >>> >
> >>> >
> >>> >
> >>> > --
> >>> > This message was sent by Atlassian JIRA
> >>> > (v6.3.4#6332)
> >>>
> >>
> >>
> >
>