[[BackLinksMenu]] [[TicketQuery(summary=TEXT_LINK_MANIPULATION_R0, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|)]] = Analysis = == Overview == This task is focused on delivering link functionality inside text frames. == Task requirements == * Create a halo for text links which evokes a HUD * The halo should appear when text is selected. * When pressed it should evoke a HUD (sample design for the HUD is added in the implementation idea below) * Since the text's link functionality is so similar to the frame's link functionality, the HUDs could be almost identical with some minor differences. * There must be a possibility to change the coloring of the link (see the implementation idea). * When text is converted to link, there must be a visual marker for that (at least changing the text color) * The triggers for the links are almost the same as the ones for the links we now have * Mouse enter * Mouse leave * Mouse double click * Mouse pressed * Mouse released * The actions are also similar to the events for regular links. However some new must be added: * [Optional for this task] Open URL == Task result == The result of this task must be code. == Implementation idea == * Sample HUDs and their layout * By default the link color for the ''over'', ''pressed'', ''visited'' and ''normal'' is the same, but the user can change that accessing additional subhud (as shown on the picture)[[BR]] [[Image(textlinks.png)]] * Keep the links as attachment in ImmHotText ot the text resource. * Use the existing links hud and the logics connected with it for the UI. * Use highlights to distinguish between the different states of a links. == Related == GROUP_LINKS_R0 == How to demo == * Insert text frame. * Add some text in it and create link. * Use different coloring options. * Try if the link works in preview mode or reader. = Design = * Model * ImmHotText will keep text links as attachments. * create a marker interface for text attachmens in org.sophie2.base.model.text package - {{{ Attachment }}} * add a private field in ImmHotText that contains all attachments of this text - {{{ private ImmMap links }}} * add it as an argument to the private contructor * make sure that all producer methods (such as applyStyle) keep this map * create a new class {{{ LinkAttachment }}} implementing in org.sophie2.main.func.text.model package * it will implement {{{ Attachment }}} and have a {{{ Link }}} as private field. * in addition, it will have 4 ImmColor private fields that are used for highlighting the link in its 4 different states - normal, hover, visited, pressed. * it will have producer methods that change a specific color. * TODO: persistence * Highlights * Highlights will be added in {{{HeadTextFrameView}}}. * add a new property that contains a list of all hovered links - {{{ ListProp hoveredLinks() }}} * use this property to create the appropriate highlights in {{{ HeadTextFrameView.textView()...textFlow().getExtraHighlights() }}} * override {{{ void touch() }}} in {{{ HotTextElementHelper }}} to depend on the highlights, so that the scene gets repainted when the highlights change. * A new logic will handle switching between the different states and firing InputR3Events related to text links. * create a new class {{{ TextFrameLogic }}} in org.sophie2.main.func.text.view package with the following operations: * ON_MOUSE_MOVED - takes care of highlighting hovered text links and firing an MOUSE_ENTERED and MOUSE_EXITED events. This operation does not cover the case when there are some hovered links and the mouse leaves the frame. * ON_MOUSE_EXITED_FRAME - removes all text links highlights and if necessary fires MOUSE_EXITED events. * ON_MOUSE_PRESSED, ON_MOUSE_RELEASED and ON_MOUSE_DOUBLE_CLICKED take care to fire MOUSE_PRESSED, MOUSE_RELEASED and MOUSE_CLICKED events connected with text links. * Executing links * {{{ LinkProcessorLogic }}} will take care to fire LINK_ACTION_TRIGGERED events if appropriately. The following operations should be added: * ON_TEXT_LINK_ENTERED * ON_TEXT_LINK_EXITED * ON_TEXT_LINK_PRESSED * ON_TEXT_LINK_RELEASED * ON_TEXT_LINK_DOUBLE_CLICKED * All of them have TextFrameView as source and TextLink as context. * Executing link actions should be done by already existing logics. * If a link contains a resource ref, it will be relative to the text frame. * Therefore, the ResourceView these logics use to open an access to the target will be TextFrameView. * Huds - general * The existing {{{ LinksHud }}} should be used for creating links for both elements (frames and pages) and for text attachments. * The holder property's type will be changed from ElementH to LinkHolder. * Create a new interface {{{ LinkHolder }}} in org.sophie2.main.app.commons.links with the following methods: * Link getLink() - gets the link model of this holder. * ResourceRefR4 getRef() - gets a reference to the owner of this holder. * List getTriggers() - gets a list of all possible triggers for this holder's link. * A nested class {{{ SimpleLinkHolder }}} exdending LinkHolder will be added in {{{ ElementView }}}. * It will need one additional method - ResourceAccess getAccess(). * A new property will be added in ElementView - public Prop linkHolder() * A nested class {{{ TextLinkHolder }}} exdending LinkHolder will be added in {{{ HeadTextFrameView }}}. * It will need one additional method - public TextLink getTextLink(). * A new property will be added in HeadTextFrameView - public Prop textLinkHolder() * Two subclasses of LinksHud will be created: * ElementLinksHud with a SimpleLinkHolder * TextLinksHud with a TextLinkHolder and additional controls for selecting link colours in {{{ org.sophie2.main.func.text.view package }}}. * The operations in {{{ LinksHudLogic }}} should be modified to make the new link and to throw a new SET_LINK event instead of setting the link in the model. * A new operation ON_SET_ELEMENT_LINK in {{{ LinksHudLogic }}} will register an autoaction to set the link of ElementLinksHud's model. * A new operation ON_SET_TEXT_LINK in {{{ TextLinksHudLogic }}} will create a new ImmHotText object with the changed link and fire a SET_TEXT event. * TextLinksHud's hierarchy: * {{{ ColorTitleBar }}} extending HudTitleBar * {{{ ColorSubHudButton }}} extending SubHudButton - shows TextLinkColorHud * {{{ TextLinkColorHud }}} - a hud with 4 color picker fields (see the picture in the analysis) * {{{ NormalColorField }}} extends ColorPickerHudField - a color picker field that changes the link's normal color. * {{{ HoverColorField }}} extends ColorPickerHudField - a color picker field that changes the link's hover color. * {{{ VisitedColorField }}} extends ColorPickerHudField - a color picker field that changes the link's visited color. * {{{ PressedColorField }}} extends ColorPickerHudField - a color picker field that changes the link's pressed color. * {{{ TextLinkColorHudLogic }}} with 4 operation, each one changing the color for a different state. * {{{ ColorField }}} extends ColorPickerHudField - a color picker field that changes all links colors simultaneously. * {{{ TextLinksHudLogic }}} with 2 operations: * ON_SET_TEXT_LINK described above * ON_COLOR_SUBMIT changes the color of all link's states simultaneously * Source code: [7801], [7874] = Implementation = = Testing = ^(Place the testing results here.)^ = Comments = ^(Write comments for this or later revisions here.)