wiki:TEXT_RESOURCE_HTML_R0
Last modified 3 years ago Last modified on 06/24/09 15:36:30

Pages linking to TEXT_RESOURCE_HTML_R0:
TASK_INDEX

Ticket Summary Owner Status Type Component Priority Effort Importance
#831 TEXT_RESOURCE_HTML_R0 diana closed planned_task TEXT_RESOURCES 3 1 0

Reported by Astea, 4 years ago.

Description

wiki page: TEXT_RESOURCE_HTML_R0 - effort: 1d

Analysis_owners

diana, dido

Analysis_reviewers

deyan

Analysis_score

3.5

Design_reviewers

meddle

Design_score

2

Imp._score

0

Test_score

0

Analysis

Overview

User should be able to import html as a resource. When inserted on the stage the resource should appear as text frame containing the information form the html file. Most of the html tags and styles should be applied to the resulting text. A message that warns the user for eventual data lost, should appear.

  • For example if there is a <b> tag - a corresponding bold style should be added for the resulting HotText. This style sholud be applied till

</b> tag is met in the html document.

  • The resulting text could have non-corresponding nesting of tags (example: <b><i></b></i>) due to the noncorresponding nesting in html.

As almost all resources this one should have origin(the origin url) and reload functionality(all edits should be lost when reloading - user should be notified for this).

Task requirements

  • Provide "HTML Document..." in the Insert menu.
  • Provide a chooser for the html files.
  • Provide a "plain" resulting HotText from the html file resource, meaning that no styles or tags will be applied yet.
  • Optional we may be able to create reload functionality and origin property.

Task result

The result should be source code.

Implementation idea

Use HTMLEditorKitfrom the javax.swing.text.html package to create HTMLDocument.

BOOK_HTML_EXPORT_R0

How to demo

  • Run the application
  • Create a new book
  • Go to insert menu and select insert html file
  • Chose simple html file to be imported on the stage

Design

Create a new class InsertHtmlItem that extends AppMenuItem class to provide the html item in the insert menu. Create a new class HtmlUtility that helps applying the styles from the html document to the resulting HotText.The following methods helps acheiving this:

  • applyStyles - applies the styles from a given view to the HotText attribute (recursively).
  • getCorrespondingVal - gets the corresponding CommonAttr for a given html attribute and value.

Create HtmlLogic.USER_ADD_HTML_FRAME - the logic for the adding of the html document. It uses the HTMLEditorKit to create a HTMLDocument. The result is a HotTextBookResource.

A test can be found here: [3678] [3698]

Implementation

Done according to the design. source: [3678] [3698]

Testing

(Place the testing results here.)

Comments

(Write comments for this or later revisions here.)