[[BackLinksMenu]] [[TicketQuery(summary=TEXT_PARAGRAPH_SPACING_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 == A paragraph is a self-contained unit of a discourse in writing dealing with a particular point or idea. The start of a paragraph is indicated by beginning on a new line. Sometimes the first line is indented; sometimes it is indented without beginning a new line. At various times the beginning of a paragraph has been indicated by the pilcrow: ΒΆ. User should be able to specify spacing setting for specific paragraph via paragraph settings hud.[[BR]] Identation defines where does the text begin in the frame.Following settings should present: * Right indent - defines the space after the text, for now in points. * Left indent - defines the space before the text, for now in points. * First line indent - defines the space before the first line in the text, for now in points. * Space above - defines the space above the paragraph, for now in points. * Space below - defines the space below the paragraph, for now in points. * Line spacing - defines spacing between the lines in the paragraph, in lines. The default is 1. [[Image(source:trunk/sophie2-platform/doc/spec-diagrams/Paragraph.png, 50%)]] == Task requirements == * Implement indent functionalities for the paragraph * Create a paragraph hud(OPTIONAL IF NOT FINISHED WILL BE INCLUDED IN THE NEXT REVISION) * Should contain controls for align, character style and indents. (add only indent controls) == Task result == * The result should be code. == Implementation idea == * Review [[wiki:TEXT_PARAGPRAPH_FORMAT_COMMONS_R0]] and don't get in to a conflict with implementation of this task. * Also review what is implemented at this point. * If there is a need review http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/text/StyleConstants.html * See [[Image(source:trunk/sophie2-platform/doc/spec-diagrams/ParagraphHaloAndHud.png, 50%)]] == Related == [[wiki:TEXT_PARAGPRAPH_FORMAT_COMMONS_R0]][[BR]] [[wiki:TEXT_PARAGRAPH_ALIGN_R0]][[BR]] [[wiki:TEXT_PARAGRAPH_STYLE_TEMPLATES_R0]][[BR]] [[wiki:TEXT_PARAGRAPH_CHAR_STYLE_R0]][[BR]] [[wiki:TEXT_PARAGRAPH_NEXT_STYLE_R0]][[BR]][[BR]] [[wiki:DETACHED_TEXT_FRAME_EDITOR_R0]] http://en.wikipedia.org/wiki/Paragraph == How to demo == * Run the application * Create a new book and place text frame inside * Populate some lorem ipsum text inside with a number of paragraphs(lorem ipsum generator --> http://www.lipsum.com/) * Open the paragraph settings hud and manipulate spacing controls. = Design = * Add CommonAttr.BEGIN_PARAGRAPH and CommonAttr.END_PARAGRAPH attributes to represent existence of baragraph breaks in the style. * Create classes extending HotStyleValue: * HotBeginParagraphAttr - style value for begin paragraph * HotEndParagraphAttr - style value for end paragraph * Add HotTextLogic.INSERT_PARAGRAPH_BREAKS operation to define behavior for specifying a paragraph in HotText * Create utility class ParagraphUtils with: * static method checkCorrectness(HotText) - checks if BEGIN_PARAGRAPH and END_PARAGRAPH are nested correctly. * static method existsBeginParagraph(HotStyleDef) - checks if there is BEGIN_PARAGRAPH in the specified style. * static method existsEndParagraph(HotStyleDef) - checks if there is END_PARAGRAPH in the specified style. * Layout * Extend Atom class functionality with paragraph related attributes: * Add Atom.isParaBegin to check for BEGIN_PARAGRAPH attribute. * Modify Atom.isParaEnd to check for END_PARAGRAPH attribute. * Methods for indentation, top and bottom spacing, etc. * Add VertexFields values for the needed paragraph properties: * Alignment * Top spacing * Bottom spacing * Line spacing * First line indent * Left indent * right indent * Modify the layout algorithm: * EdgeKind.OPEN_LINE to check for BEGIN_PARAGRAPH. * EdgeKind.CLOSE_LINE to check for END_PARAGRAPH. * EdgeKind.SEGMENT to check for BEGIN_PARAGRAPH and END_PARAGRAPH. * To apply the paragraph visualization properties as follows: * EdgeKind.OPEN_LINE - top spacing, line spacing, first line indent, left indent, right indent. * EdgeKind.CLOSE_LINE - bottom spacing. * '''Note''': Alignment will be handled in the layout algorithm in a next revision. * Testing * TextParagraphDemo added for checking the correct behavior of paragraph functionality. [3424] * Unit testing: [http://www.sophie2.org/trac/browser/branches/private/nenko/nenko2/modules/org.sophie2.base.model.text/src/test/java/org/sophie2/base/model/text/layout/LayoutBuilderTest.java LayoutBuilderTest] - updated in [3386] = Implementation = ^(Describe and link the implementation results here (from the wiki or the repository).)^ = Testing = ^(Place the testing results here.)^ = Comments = ^(Write comments for this or later revisions here.)