cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Java HTML Formatter

SKumar
Super Contributor

I am creating a custom Java HTML formatter to list Application Inventory.

 

I would like to create a tree like structure inside HTML tables (or CSS Lists) with expandable children so that the user can expand and collapse them.

 

This html formatter will be used when generating a website, are there any mega CSS classes that can help me do this? I can use JQuery to do all this, but one of my colleagues mentioned that Mega has some CSS that already does this - so I was thinking that I can reuse whats been provided already!

 

BTW, can i use whatever Jquery or other Javascript in a custom HTML formatter? I was told that custom descriptos cannot have javascript so I am curious if I am allowed to on a formatter!

 

 

Another question for mega Java API Gurus:

 

Is there a way to create a Unittest with out having debug from inside mega? Like say write a little driver that can query mega to retrieve a certian Object, instantiate a certain type of MegaCOMObject (I see tons of Types implementing this in Eclipse) and let me test my generated HTML quickly? I am hoping that one of the Mega Java gurus can help me here quickly!

 

public class MyCUstomFormatterMacro {
  public void Generate(final MegaObject object, final MegaCOMObject context, final String data, final StringBuffer response) {
    // TODO Auto-generated method stub
        
      String s = null;
      
      s = "abcdef";
  }

 

I tried to debug this code in Eclipse but couldnt understand how to proceed further -

1. What does MegaObject represent? It is showing up as JNI object, so how do I find more information about it?

2. What does MegaCOMObject represent?

 

I am finding it difficult without any information to proceed further....

 

 

1 Reply

jftrianda
MEGA
MEGA

Hi

 

I am not a java guru … HTML Formatter have the same interface in VB Script or java

 

As Describe in the VB template of macro implementing HTML formatter the 4th parameter return a valid HTML Page, from the first <, to the last >, then you can add any  javascript you want inside since they are reachable to the page when it is “running”.

 

' used to generate a HTML page
' sOut must return a valid HTML Page


Sub Generate (Obj As MegaObject, Ctx As MegaWebSite,sIn As String,sOut As String)

End Sub

 

The 1st  parameter Object is the object to describe in case of Object html formatter (otherwise it is an access point to the MegaRoot.)

The 2nd parameter is the GenerationContext to retrieve info about the current generation to get the hyperlinks to an object and so on (“documented L” in the java doc)

The 3rd parameter is a string for “user data”

 

Check as samples in the macro ~7CZObN6pBzW0[Available Analyses Formator.Macro] with the support macro ~gu3rWUjw4D70[Html Complete Analysis] in VB Script inside MEGA just the change the language to java…