JTextPane/HTMLEditorKit - Custom Comment View

Hello.
Here's what I want to do... I want to be able to make hidden COMMENT tags visible in an uneditable JTextPane using an HTMLEditorKit. I went as far as installing my own ViewFactory, but comment elements are treated a little differently (noted by viewing HTMLDocument.dump(System.out)).
If anyone has a decent way to make comments like <!--this--> visible at will in the JTextPane using custom Views, or whatever, you have yourself 10 Duke Dollars. By the way... I'm advanced in Swing development, but the text package is very complex and intimidating.
- John

this is an example of using ViewFactory... it creates JEditorPane with line numbering.
You can see how ViewFactory works. Document represents tree structure of Elements ViewFactory produces appropriate Views for each Element. You have to specify required Element and generate View for it.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.text.rtf.*;
class Test extends JFrame
public Test()
super("Test");
JEditorPane edit = new JEditorPane();
edit.setEditorKit(new MyRTFEditorKit());
edit.setEditable(true);
JScrollPane scroll=new JScrollPane(edit);
getContentPane().add(scroll);
setSize(300,300);
setVisible(true);
public static void main(String a[])
new Test();
class MyRTFEditorKit extends RTFEditorKit
public ViewFactory getViewFactory()
return new MyRTFViewFactory();
class MyRTFViewFactory implements ViewFactory
public View create(Element elem)
String kind = elem.getName();
if (kind != null)
if (kind.equals(AbstractDocument.ContentElementName)) {
return new LabelView(elem);
} else if (kind.equals(AbstractDocument.ParagraphElementName)) {
// return new ParagraphView(elem);
return new MyParagraphView(elem);
} else if (kind.equals(AbstractDocument.SectionElementName)) {
// return new BoxView(elem, View.Y_AXIS);
return new MySectionView(elem, View.Y_AXIS);
} else if (kind.equals(StyleConstants.ComponentElementName)) {
return new ComponentView(elem);
} else if (kind.equals(StyleConstants.IconElementName)) {
return new IconView(elem);
// default to text display
return new LabelView(elem);
class MySectionView extends BoxView {
public MySectionView(Element e, int axis)
super(e,axis);
public void paintChild(Graphics g,Rectangle r,int n) {
if (n>0) {
MyParagraphView child=(MyParagraphView)this.getView(n-1);
int shift=child.shift+child.childCount;
MyParagraphView current=(MyParagraphView)this.getView(n);
current.shift=shift;
super.paintChild(g,r,n);
class MyParagraphView extends javax.swing.text.ParagraphView
public int childCount;
public int shift=0;
public MyParagraphView(Element e)
super(e);
short top=0;
short left=20;
short bottom=0;
short right=0;
this.setInsets(top,left,bottom,right);
public void paint(Graphics g, Shape a)
childCount=this.getViewCount();
super.paint (g,a);
int rowCountInThisParagraph=this.getViewCount(); //<----- YOU HAVE REAL ROW COUNT FOR ONE PARAGRAPH}
System.err.println(rowCountInThisParagraph);
public void paintChild(Graphics g,Rectangle r,int n) {
super.paintChild(g,r,n);
g.drawString(Integer.toString(shift+n+1),r.x-20,r.y+r.height-3);
best regards
Stas

Similar Messages

  • How to test and develop the HTML/Backbone custom content viewer on IPad?

    Hi
    I have been tasked with developing and amending the HTML/Backbone custom content viewer as nicely detailed and explained by Derek Lu here:
    https://www.adobe.com/devnet/digitalpublishingsuite/articles/html-default-library.html#
    I can see that by removing the reference to libs/AdobeLibraryAPI.js in Index.html i am able to "test" on the desktop.
    <!--
        The DPS library/store API.
        The include below should be commented out when testing on the desktop.
    <script src="libs/AdobeLibraryAPI.js"></script>-->
    and that data is bought in via the fulfilment XML feed and the parse method is called on Librarycollection.
    I have made the changes to hook up the viewer to bring in some folios that we are developing.
    However, although this provides the ability to test and develop on the desktop in one form since we are using JS and Backbone, there are various checks within the provided code to see if ADOBE.isAPIAvailable.
    If it is, then the behaviour is different than on the desktop, so once the viewer is packaged up and put on the IPad there is disparity between what you were able to check and test on the desktop version against what is shown on the IPad.
    The question therefore is... is there a quick way to develop and test on the Ipad ... it doesnt seem like a viable option to develop blindly on the desktop and then package up the content viewer within Adobe DPS to check how those changes behave on the IPad?
    To re-iterate the viewer is to make use of backbone / js example to provide greater functionality and options for customisation.
    Thanks in anticipation.
    Dave

    Thankyou for taking the time to respond and for providing such detailed articles on adobe dps development, it is much appreciated.
    I had completely missed that article and was struggling to find anything useful from googling!
    Dave

  • In A3, How Do I Apply One Of My (many) Custom Metadata Views To The Viewer?

    In A3, it appears that both the Viewer and Browser are limited to just 2 views: Basic and Expanded.
    In A2, I had many custom metadata views that I could easily change via the Metadata-pane (now gone) in Prefs. depending on the type of workflow, customer needs, etc.
    Now, if I'm limited to just 2, I'll have to go in and manually change the composition of A3's 2 views for each workflow. If this is the case, I see it as a big step backwards. This is the type of limitation that iPhoto often has, and flexibility is what I expect from a Pro-App.
    I spent a great deal of time developing custom metadata views for various workflows so that I could align the various displays in Aperture to each workflow. What do I do now?

    Just stumbled over this thread:
    Yes, its the truth. There is no way to quickly change the display of Metadata in Browser or List View.
    You can tell from the form of the Settings - Window (Command - J) that there is no way anymore. You have one Standard View, and one Extended.
    Strange. I did not use it a lot, I always display pictures to customers with no metadata, except when we do a selection on site (and then its standard with only rating).
    wok4

  • No accessory view in custom table view cells.

    Hello Everyone,
    I have been having problems with my accessory views in my custom cell views. I am expecting that the accessory views will show up by only setting the accessoryType property correctly. Below is a link to my class for the custom cell view. I am setting the accessoryView to UITableViewCellAccessoryDetailDisclosureButton.
    I didn't know how to paste code in here, so I have pasted my code here: http://pastebin.com/m3ba5d9de
    Thanks again,
    Uday

    Hi
    View is always a better option..using a view you can avoid the naming convention problems associated with fields or Table names.
    Thanks
    -Rajesh

  • How to create wizard for a custom mainenance view/view cluster

    Hi Experts,
    I have created 5 custom maintenance view and have maintained all the views sequencially and have made the first mainenance view as the start view & header entry and all other views are child or subview of the header view in a custom view cluster. But I want a wizard to help the user / end user successfully enter all the required values for all child views, it will help  the user to navigate  from the start view to all the child views where the fields of the wizard will be associated to the child maintenance views.
    Please suggest how to create wizard for view cluster.
    I'll give max reward point for the helpful answer.
    Thanks in advance
    koustav

    Hello Pasapula
    When you are in the View Cluster maintenance dialog (SE54) click on dialog "Events".
    Below the field for the view cluster you have an additional field <b>FORM routines main program</b>. There you have to add the main program containing the FORM routines called by the VC events.
    For example: I had defined a normal report containing an include with all the FORM routines. The report contains only the following lines of coding:
    report zus_0120_u1.
    * Common Data und access routines for user exits in VC maintenance
    include LSVCMCOD.
    include  zus_0120_f1. "FORM routines for VC events
    Now in the "Events" dialog of the view cluster maintenance you assign your FORM routines to the events.
    Regards
      Uwe

  • Custom secure views report is not restricting the data

    Hi,
    I have created few custom secure views reports and in which I have used the per_people_f , per_assignments_f secure views but when I am running this report from different responsibilities like (US Resp, UK Resp) it is producing the same number of records. From US resp it should produce the US employees and from UK it should produce the UK employees but this is not happening currently.it is a simple sql script which I registered as sql*plus executable.
    Can any one suggest if I am missing some thing? Urgent help would be appreciated.
    Thanks,
    Ashish

    Pl post details of OS, database and EBS versions. How have you implemented security ? What kind of concurrent program are you using ? Pl provide details. Also see these MOS Docs
    How To Enable Hr Security on Custom Reports?          (Doc ID 369345.1)
    Understanding and Using HRMS Security in Oracle HRMS          (Doc ID 394083.1)
    Need Custom Security Profile To Restrict Based On Employees Organization          (Doc ID 445142.1)
    HTH
    Srini

  • Infopath to design WYSIWYG Custom List Views on 2013

    We are migrating to SPO 2013.  Playing with InfoPath 2013.
    I know it's dieing, but InfoPath has always frustrated me.  Some much potential yet so out of touch with what users seem to need IMO.  Far from user friendly enough to let users maintain their own forms too IMO.
    But really my biggest gripe with SharePoint in general is that it misses the mark with Custom lists and Views.
    Why doesn't SharePoint and/or InfoPath address the need for more flexibility and Design options in the Custom List View. My users are constantly looking to build View pages that to reflect paper forms they use to have.  They always seem to
    have to settle for the way the list view looks.  InfoPath does not seem to address Read Only Views of List Data ??
    - No List Mode (View vs Edit)
    - No Label control
    - Field Names do not display unless you hover over the control. 
    - No WYSIWYG drag and drop designer - only grid cells.
    - No easy or clear way to get URL Query string values
    - No way to build complex expression fields, say I want to build a URL Link using some list field data and the ID from the URL query string on the form? Possible?
    - Better/easier way to join and bind in multiple Lists and multiple data sources?
    One other challenge we have is that SSRS can't be integrated into SPO and is being dropped from Azure.  The SSRS designer is leaps and bounds better than InfoPaths IMO.
    Considering SPO 2013, might there be another product or IDE coming in (maybe FoSL) that will address all of these? How about Visio, Excel, PDF
    Thank You.

    Thank You for your response.
    A little of both :)   ... But am very interested in hearing about practical development options.  But the catch is that we are waiting to see if something shows up that will enable users to build these views without development.
    I have been seeing new Apps show up on the o365 store that look promising, but none of them are quite there yet IMO ...  like Ninetex forms, Lightning Data Viewer, BlackCompass Data Viewer, List Designer, OData query Builder.  We've
    actually demoed every single one of them.
    We have also been playing with oData Connections from Excel and Visio web Access Web parts.  We can't get Data connections to refresh from Excel apparently unless we buy Power BI and we are still trying to figure out Visio on SPO.
    I know we can create a SharePoint 2013 App that binds in SPO List data and use .NET controls to arrange them on a page.  But that would put a developer and a deployment process in front of that View.  We can also use SSRS and create a one row report
    - but SPO does not support integrated SSRS and we would have to authenticate  on-Prem SSRS against  ADFS which we have not yet configured here.

  • Custom Split views don't work like the use to pre- Project 2010

    Hi
    Either we've lost some functionality along the way, or there must be another way of doing the following...
    Up until and including version 2007, I was able to create multiple custom split views in a file (or global.mpt) where the I could specify a different Task Form (e.g., "Predecessors & Successors" or the "Work") depending on which custom
    split view I selected.
    In 2010 and 2013, you have to manually select the Task From you want; the custom split view won't can help you get the specific Task Form you want ((e.g., "Predecessors & Successors", "Work").  At least that has been my experience...
    does anyone have a solution apart from needing to write a VBA event handler?
    Thanks in advance,
    \Spiro Theopoulos PMP, MCITP. Montreal, QC (Canada)

    I agree with Dale. Project remembers the last set of details applied in form views such as Task Form. Using VBA event handlers you can change this behavior.
    1. Open the project file on which this change should be applied.
    2. In the View ribbon, click Macro command and select Visual Basic
    3. If you want the details displayed in the Task Form to be applied to the current file, double click "ThisProject" node under the VBAProject(your file name) or else double click "ThisProject" node under ProjectGlobal (Global.MPT)
    4. Paste below lines in the Project_Open event handler. Save the code.
    Private Sub Project_Open(ByVal pj As Project)
        ViewApplyEx ApplyTo:=1, BuiltInView:=pjViewTaskForm
        WindowActivate TopPane:=False
        ViewShowPredecessorsSuccessors
    End Sub
    5. You can replace the last statement ViewShowPredecessorsSuccessors with another statement that is compatible with Task Form view
    Sai PMP, PMI-SP, MCTS Project, MVP Project

  • Print too small when Comments viewed

    I have Pages 08 files, converted from Word 2007 (.docx). When I try to print, regardless of printer (two different HP Laserjets), the result is a neat little patch of print in the middle of the sheet of paper, perhaps 20% of intended size. Each time I try again, the patch of print is again reduced on and on to (presumably) a single pixel.
    This happens only when Comments are viewed. Otherwise, the pages print normally.
    I've messed with font sizes, page layout and everything else can think of. Did I miss something? Is the converted xml in some way mishandled by Pages? Any clues?
    Thanks in advance to all you expert helpers.

    Yvan,
    Do you mean that you were able to print a Pages 08 file, with Comments viewed, and it filled the sheet properly (text slightly smaller to accommodate the Comments on the left)?
    My own print-outs, on both an HP LaserJet P2015 and an HP LaserJet 1200 will not print properly. The Print Preview shows a slightly down-sized page. But it will print - at most - a rectangle about 80mm X 45mm (4" X 2" for our American friends). Woe if I click anything above the Layout drop-box! The Print Preview image and the subsequent print reduce by half with each click.
    Dennis says this is a bug in Pages... it certainly behaves like one.
    Thanks.

  • Oracle Apps EUL with Custom Discoverer Views

    Disco Environment:
    OracleBI Discoverer 10g (10.1.2.2)
    Oracle Business Intelligence Discoverer Plus 10g (10.1.2.54.25)
    Discoverer Model - 10.1.2.54.25
    Discoverer Server - 10.1.2.54.25
    End User Layer - 5.1.1.0.0.0
    End User Layer Library - 10.1.2.54.25
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    Oracle Applications R12 EUL
    All,
    Up until now, we have been placing our Discoverer custom views in our apps schema. From a "keeping track" perspective and from a "keep Disco views separate from apps" perspective, we are inclined to create a custom schema to place all of our custom Discoverer views. I have heard that Noetix does this as well.
    To accomplish this, we were planning to provide a grant select to all tables, views and synonyms (with a limited execute rights to some packages).
    The easiest thing to do is to keep on doing what we are presently doing. We have a naming schema in place that enables us to quickly identify all custom Disco views.
    Can I have people whom have implemented a custom schema for their Disco views in apps let me know how this has worked for them? This type of Disco environment appears to require a lot of communication between the Disco staff and the DBA to make sure these grants are set-up correctly.
    Thanks,
    Patrick

    Hi,
    All the eBS sites I have worked on have created the majority of their custom views in the APPS schema using a naming convention to separate them from the seeded views. The reason being is that the SQL in the view (including all the function calls) is run with the privileges of the owner of the view. If the view is defined in another schema, then this schema must have access to the APPS database objects which can be a lot of work to set up because it is very hard to identify the dependencies and unnecessarily opens up the security on the APPS schema.
    Where the data is held in custom tables and there are views on these custom tables, then both the tables and the views are held in a separate schema.
    Rod West

  • SQL query for custom alert view

    I have created a custom alert view and scoped to show alerts related to group of servers.
    Alert view Criteria: Resolution State - New, Severity - Warning and Critical, Group - "Group 1"
    I am trying to query the Operations Manager database to show the alerts with same criteria using below query.
    select MonitoringObjectName, ResolutionState, Priority, Severity, TimeRaised, TimeAdded, TimeResolved, AlertStringName, AlertStringDescription from AlertView where ResolutionState = '0' AND (Severity = '2' or Severity = '1')
    AND
    MonitoringObjectId IN (select TargetObjectId from RelationshipGenericView
    where SourceObjectDisplayName = 'Group 1')
    in Console i see both warning and critical alerts where as in SQL query output i see only critical alerts.  Could you please correct if I am using wrong query. also please share your suggessions if i am completely wrong on this.
    Kind Regards,
    Bommi
    ~Bommi

    your query looks perfectly fine. Are you sure if the alerts you see in the console are of the 'Resolution State =0' (New). It might be the case where the alert have moved to a fidderent resolution state.
    Also, take a sample warming alert from console, query for the same in DB and check the Severity value. If it is '2'.
    Regards,
    Saravanan

  • Purchase req: allow a customer to view purchase req info via portal

    I would like to know what is the best way to setup a view to allow a customer to view their purchase reqs. Is their a webservice to push info to their portal page or should we setup an ivew and allow them to view PR information.
    Should I use webservices or BAPIs?
    Thanks
    Mikie

    Hi,
    we managed to solve this by implementing BADI /SAPAPO/DM_PO_CHANG2.  Problem solved.
    Best Regards,
    Sam

  • Custom Folder View w/ Movable Columns

    Question1:
    =======
    I created very simple custom folder view. How can I make my custome folder view to display Movable Columns?
    When adding elements into Folder View, the section Standard Form Elements does contain only the element Discussion Folder (Standard View), no movable columns
    I need in my custom folder view movable columns, Heeeeeeeeelp!!
    Question2:
    =======
    In Folder Options in Configure Columns, one can choose what columns of an entry to display.
    I found the order of chosen columns inconsistent.
    Is there a way how to specify the order of the chosen columns?

    1. When in the folder, click on Manage > Configure. Do you not see an option for selecting the default folder view?
    2. No, currently there is no way to specify the column order.
    -- Khurram

  • How can i put FPM Buttons in custom FPM Views.

    Hi,
      How can i put FPM Buttons in custom FPM Views.
      Couldn't locate them in web dynpro layout or FPM Views and application in Portal Content.
    Thanks,

    Hi,
    you should describe a little bit more what you want to do (e.g. navigation buttons or buttons in containers like e.g. in ESS Address). FPM usually has a quite high reusability so button components are often reused. In case there is already a button component that has everything you need you can just use the self-service administrator to add this view to the right perspective in your FPM application. In case you talk about those buttons that are in the Overview screens than those buttons are dynamically generated.
    In case you just want to have your own button then create this button and fire an FPM event from it. You need to add this event to the FPM view configuration in the self-service administrator. Alternatively you can create a button component and reuse it later.

  • Custom Table View

    Hi,
    I want to provide more than three component in the table view.
    Two images/Icons (Left Side), Text with Subtitle, Text (Date and Time at right-hand side)and Detail Disclosure button.
    How can i create this with the custom table view?

    This is an end-user forum. You need
    http://devforums.apple.com

Maybe you are looking for

  • Since I installed FF4 each time I start up internet FF doesn't open and gives the report that it cannot find the proxyserver.

    Already I have changed the settings to no proxy, but it doesn't work. Each time I want to open internet again I get the same report and I have to change the setting to no proxy again! Also I noticed that FF has changed the proxy adjustment himself to

  • Report does not refresh when link to page

    I have a report on page 1 with a column link to a report on page 2. The link sets items on page 2. If I use the 'Page in this Application' from the column link, the items on page 2 are set and the report is automatically refreshed. If I use the 'URL'

  • Error while deploying EJB

    Hey Folks I am getting following error while deploying my ear file Auto-deploying sample-ejb.jar (No previous deployment found)... Error compiling D:\J2EE\SAMPLE\bin\SAMPLE/SAMPLE-ejb.jar: Syntax error in source can anybody plz tell me why it is comi

  • Problem with User Data Entry Into a Control

    I'm writing some code where the user must correctly enter numeric data for a number of parameters (eg wavelength, time, energy etc) before the program continues (eg via a 'click button when done' type command). I'm using a while loop to lock the done

  • PHP MySQL 2 column list

    I am building at site in dreamweaver using PHP/MySQL. I have a page that will list a bunch of categories. I would like to have them in a two column list instead of one. It will look better as far as the design goes. How can I do this. I would like ea