Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

writing macros in Java - what is the parent macro?

iamgoingtosneeze September 18, 2018

I have written a java macro that creates a drop down list.

It is used on a page within a page properties macro. All is fine.

When i use a page properties report (which will show up the macro) I would like to render the output differently - i want it just to show the selected value rather than the combo box. 

I've been scouring the variables in my debugger but i cannot see how I know whether I am being rendered inside a page property macro, within a the page property report macro. 

Please can somebody point me towards how I can do this?

Thanks in advance.

1 answer

0 votes
Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 18, 2018

I went through something similar, where i created a user macro that generated the page property table with pulldowns, etc. Didn't work with the report macro. If seems to be very selective at looking at the page source and not the rendered page. So I backtracked, and used a separate table, creating individual user macros for pulldowns (VTL not java). That worked.

iamgoingtosneeze September 19, 2018

Thanks for your input. That's what i've been doing -  I have a macro for the drop down within the page property macro. The key to getting them to work seems to be making sure that i had a unique id for the content metadata what was used to recording their selection.

I was hoping for my macro to know whether it was being rendered on the original page or on the report page. 

A better example is maybe my checkbox macro. I have a macro that supplies a list of values that can be checked. There are quite a lot of checkboxes. I would like to be to display all of the checkboxes when they are on the source page, but when that info is displayed on the property report page, i just want to show the values selected. Basically it is keywords (i want to be very strict about the keywords that people use for pages so you can search more effectively).

Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 22, 2018

Are you macros each in individual table cells? And not clear, but sounds like you have a custom GUI for your checkbox, rather than editing the macro and setting parameters there?

Here is code of something similar to what you are doing that does work with the report macro.

## Macro title: Priority
## Developed by: Bill Bailey, MarketCom, LLC
## Date created: 2018.09.06
## Version: 1.0


## @param Priority:title=Priority|type=enum|enumValues=Critical,High,Medium,Low

## Set value pairs for status macro instances
#set($priorityvalues = {"Critical" : "Red", "High" : "Yellow", "Medium" : "Green", "Low" : "Blue"})
#set($priorityorder = {"Critical" : "1", "High" : "2", "Medium" : "3", "Low" : "4"})


    <div class="content-wrapper">
          <p style="white-space: nowrap;"><span style="color:#FFFFFF;font-size:10px;margin-right:-5px;">$!priorityorder.get($paramPriority)
            <ac:structured-macro ac:name="status" ac:schema-version="1">
              <ac:parameter ac:name="colour">$!priorityvalues.get($paramPriority)</ac:parameter>
              <ac:parameter ac:name="title">$!paramPriority</ac:parameter>                
              <ac:parameter ac:name=""/>
            </ac:structured-macro>
            </span>
          </p>
    </div>

 An

iamgoingtosneeze September 25, 2018

Yes - that's right. I have a macro with a custom UI that displays a series of checkbox. when the box is checked it sets a property on the context. i think what i'll do is move the checkbox to outside the page properties and have another macro that reads back the values and displays within the page properties.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events