/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NewJPanel.java
 *
 * Created on Oct 24, 2008, 10:26:03 AM
 */

package com.jaspersoft.ireport.designer.pdf508;

import com.jaspersoft.ireport.designer.IReportManager;
import javax.swing.JMenu;
import net.sf.jasperreports.engine.design.JRDesignElement;
import org.openide.util.Mutex;

/**
 *
 * @author gtoffoli
 */
public class Pdf508TagMenuUtility extends javax.swing.JPanel {

    private JRDesignElement element = null;
    /** Creates new form NewJPanel */
    public Pdf508TagMenuUtility() {
        initComponents();
    }

    public JMenu getMenu()
    {
        return jMenu1;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenu1 = new javax.swing.JMenu();
        jMenuHeading = new javax.swing.JMenu();
        jMenuHeading1 = new javax.swing.JMenu();
        jRadioButtonMenuItemHeadingFull1 = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemHeadingStart1 = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemHeadingEnd1 = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemHeadingNone1 = new javax.swing.JRadioButtonMenuItem();
        jMenuHeading2 = new javax.swing.JMenu();
        jRadioButtonMenuItemHeadingFull2 = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemHeadingStart2 = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemHeadingEnd2 = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemHeadingNone2 = new javax.swing.JRadioButtonMenuItem();
        jMenuHeading3 = new javax.swing.JMenu();
        jRadioButtonMenuItemHeadingFull3 = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemHeadingStart3 = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemHeadingEnd3 = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemHeadingNone3 = new javax.swing.JRadioButtonMenuItem();
        jMenuTable = new javax.swing.JMenu();
        jRadioButtonMenuItemTableFull = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemTableStart = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemTableEnd = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemTableNone = new javax.swing.JRadioButtonMenuItem();
        jMenuTableRow = new javax.swing.JMenu();
        jRadioButtonMenuItemTableRowFull = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemTableRowStart = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemTableRowEnd = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemTableRowNone = new javax.swing.JRadioButtonMenuItem();
        jMenuTableHeader = new javax.swing.JMenu();
        jRadioButtonMenuItemTableHeaderFull = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemTableHeaderStart = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemTableHeaderEnd = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemTableHeaderNone = new javax.swing.JRadioButtonMenuItem();
        jMenuTableDetail = new javax.swing.JMenu();
        jRadioButtonMenuItemTableDetailFull = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemTableDetailStart = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemTableDetailEnd = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItemTableDetailNone = new javax.swing.JRadioButtonMenuItem();
        buttonGroupHeading1 = new javax.swing.ButtonGroup();
        buttonGroupHeading2 = new javax.swing.ButtonGroup();
        buttonGroupHeading3 = new javax.swing.ButtonGroup();
        buttonGroupTable = new javax.swing.ButtonGroup();
        buttonGroupTableHeader = new javax.swing.ButtonGroup();
        buttonGroupTableDetail = new javax.swing.ButtonGroup();
        buttonGroupTableRow = new javax.swing.ButtonGroup();

        jMenu1.setText("PDF 508 Tags");

        jMenuHeading.setText("Heading");

        jMenuHeading1.setText("Heading 1");

        buttonGroupHeading1.add(jRadioButtonMenuItemHeadingFull1);
        jRadioButtonMenuItemHeadingFull1.setText("Full");
        jRadioButtonMenuItemHeadingFull1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemHeadingFull1ActionPerformed(evt);
            }
        });
        jMenuHeading1.add(jRadioButtonMenuItemHeadingFull1);

        buttonGroupHeading1.add(jRadioButtonMenuItemHeadingStart1);
        jRadioButtonMenuItemHeadingStart1.setText("Start");
        jRadioButtonMenuItemHeadingStart1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemHeadingStart1ActionPerformed(evt);
            }
        });
        jMenuHeading1.add(jRadioButtonMenuItemHeadingStart1);

        buttonGroupHeading1.add(jRadioButtonMenuItemHeadingEnd1);
        jRadioButtonMenuItemHeadingEnd1.setText("End");
        jRadioButtonMenuItemHeadingEnd1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemHeadingEnd1ActionPerformed(evt);
            }
        });
        jMenuHeading1.add(jRadioButtonMenuItemHeadingEnd1);

        buttonGroupHeading1.add(jRadioButtonMenuItemHeadingNone1);
        jRadioButtonMenuItemHeadingNone1.setText("None");
        jRadioButtonMenuItemHeadingNone1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemHeadingNone1ActionPerformed(evt);
            }
        });
        jMenuHeading1.add(jRadioButtonMenuItemHeadingNone1);

        jMenuHeading.add(jMenuHeading1);

        jMenuHeading2.setText("Heading 2");

        buttonGroupHeading2.add(jRadioButtonMenuItemHeadingFull2);
        jRadioButtonMenuItemHeadingFull2.setText("Full");
        jRadioButtonMenuItemHeadingFull2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemHeadingFull2ActionPerformed(evt);
            }
        });
        jMenuHeading2.add(jRadioButtonMenuItemHeadingFull2);

        buttonGroupHeading2.add(jRadioButtonMenuItemHeadingStart2);
        jRadioButtonMenuItemHeadingStart2.setText("Start");
        jRadioButtonMenuItemHeadingStart2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemHeadingStart2ActionPerformed(evt);
            }
        });
        jMenuHeading2.add(jRadioButtonMenuItemHeadingStart2);

        buttonGroupHeading2.add(jRadioButtonMenuItemHeadingEnd2);
        jRadioButtonMenuItemHeadingEnd2.setText("End");
        jRadioButtonMenuItemHeadingEnd2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemHeadingEnd2ActionPerformed(evt);
            }
        });
        jMenuHeading2.add(jRadioButtonMenuItemHeadingEnd2);

        buttonGroupHeading2.add(jRadioButtonMenuItemHeadingNone2);
        jRadioButtonMenuItemHeadingNone2.setText("None");
        jRadioButtonMenuItemHeadingNone2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemHeadingNone2ActionPerformed(evt);
            }
        });
        jMenuHeading2.add(jRadioButtonMenuItemHeadingNone2);

        jMenuHeading.add(jMenuHeading2);

        jMenuHeading3.setText("Heading 3");

        buttonGroupHeading3.add(jRadioButtonMenuItemHeadingFull3);
        jRadioButtonMenuItemHeadingFull3.setText("Full");
        jRadioButtonMenuItemHeadingFull3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemHeadingFull3ActionPerformed(evt);
            }
        });
        jMenuHeading3.add(jRadioButtonMenuItemHeadingFull3);

        buttonGroupHeading3.add(jRadioButtonMenuItemHeadingStart3);
        jRadioButtonMenuItemHeadingStart3.setText("Start");
        jRadioButtonMenuItemHeadingStart3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemHeadingStart3ActionPerformed(evt);
            }
        });
        jMenuHeading3.add(jRadioButtonMenuItemHeadingStart3);

        buttonGroupHeading3.add(jRadioButtonMenuItemHeadingEnd3);
        jRadioButtonMenuItemHeadingEnd3.setText("End");
        jRadioButtonMenuItemHeadingEnd3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemHeadingEnd3ActionPerformed(evt);
            }
        });
        jMenuHeading3.add(jRadioButtonMenuItemHeadingEnd3);

        buttonGroupHeading3.add(jRadioButtonMenuItemHeadingNone3);
        jRadioButtonMenuItemHeadingNone3.setText("None");
        jRadioButtonMenuItemHeadingNone3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemHeadingNone3ActionPerformed(evt);
            }
        });
        jMenuHeading3.add(jRadioButtonMenuItemHeadingNone3);

        jMenuHeading.add(jMenuHeading3);

        jMenu1.add(jMenuHeading);

        jMenuTable.setText("Table");

        buttonGroupTable.add(jRadioButtonMenuItemTableFull);
        jRadioButtonMenuItemTableFull.setText("Full");
        jRadioButtonMenuItemTableFull.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemTableFullActionPerformed(evt);
            }
        });
        jMenuTable.add(jRadioButtonMenuItemTableFull);

        buttonGroupTable.add(jRadioButtonMenuItemTableStart);
        jRadioButtonMenuItemTableStart.setText("Start");
        jRadioButtonMenuItemTableStart.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemTableStartActionPerformed(evt);
            }
        });
        jMenuTable.add(jRadioButtonMenuItemTableStart);

        buttonGroupTable.add(jRadioButtonMenuItemTableEnd);
        jRadioButtonMenuItemTableEnd.setText("End");
        jRadioButtonMenuItemTableEnd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemTableEndActionPerformed(evt);
            }
        });
        jMenuTable.add(jRadioButtonMenuItemTableEnd);

        buttonGroupTable.add(jRadioButtonMenuItemTableNone);
        jRadioButtonMenuItemTableNone.setText("None");
        jRadioButtonMenuItemTableNone.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemTableNoneActionPerformed(evt);
            }
        });
        jMenuTable.add(jRadioButtonMenuItemTableNone);

        jMenu1.add(jMenuTable);

        jMenuTableRow.setText("Table Row");

        buttonGroupTableRow.add(jRadioButtonMenuItemTableRowFull);
        jRadioButtonMenuItemTableRowFull.setText("Full");
        jRadioButtonMenuItemTableRowFull.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemTableRowFullActionPerformed(evt);
            }
        });
        jMenuTableRow.add(jRadioButtonMenuItemTableRowFull);

        buttonGroupTableRow.add(jRadioButtonMenuItemTableRowStart);
        jRadioButtonMenuItemTableRowStart.setText("Start");
        jRadioButtonMenuItemTableRowStart.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemTableRowStartActionPerformed(evt);
            }
        });
        jMenuTableRow.add(jRadioButtonMenuItemTableRowStart);

        buttonGroupTableRow.add(jRadioButtonMenuItemTableRowEnd);
        jRadioButtonMenuItemTableRowEnd.setText("End");
        jRadioButtonMenuItemTableRowEnd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemTableRowEndActionPerformed(evt);
            }
        });
        jMenuTableRow.add(jRadioButtonMenuItemTableRowEnd);

        buttonGroupTableRow.add(jRadioButtonMenuItemTableRowNone);
        jRadioButtonMenuItemTableRowNone.setText("None");
        jRadioButtonMenuItemTableRowNone.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemTableRowNoneActionPerformed(evt);
            }
        });
        jMenuTableRow.add(jRadioButtonMenuItemTableRowNone);

        jMenu1.add(jMenuTableRow);

        jMenuTableHeader.setText("Table Header");

        buttonGroupTableHeader.add(jRadioButtonMenuItemTableHeaderFull);
        jRadioButtonMenuItemTableHeaderFull.setText("Full");
        jRadioButtonMenuItemTableHeaderFull.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemTableHeaderFullActionPerformed(evt);
            }
        });
        jMenuTableHeader.add(jRadioButtonMenuItemTableHeaderFull);

        buttonGroupTableHeader.add(jRadioButtonMenuItemTableHeaderStart);
        jRadioButtonMenuItemTableHeaderStart.setText("Start");
        jRadioButtonMenuItemTableHeaderStart.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemTableHeaderStartActionPerformed(evt);
            }
        });
        jMenuTableHeader.add(jRadioButtonMenuItemTableHeaderStart);

        buttonGroupTableHeader.add(jRadioButtonMenuItemTableHeaderEnd);
        jRadioButtonMenuItemTableHeaderEnd.setText("End");
        jRadioButtonMenuItemTableHeaderEnd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemTableHeaderEndActionPerformed(evt);
            }
        });
        jMenuTableHeader.add(jRadioButtonMenuItemTableHeaderEnd);

        buttonGroupTableHeader.add(jRadioButtonMenuItemTableHeaderNone);
        jRadioButtonMenuItemTableHeaderNone.setSelected(true);
        jRadioButtonMenuItemTableHeaderNone.setText("None");
        jRadioButtonMenuItemTableHeaderNone.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemTableHeaderNoneActionPerformed(evt);
            }
        });
        jMenuTableHeader.add(jRadioButtonMenuItemTableHeaderNone);

        jMenu1.add(jMenuTableHeader);

        jMenuTableDetail.setText("Table Detail");

        buttonGroupTableDetail.add(jRadioButtonMenuItemTableDetailFull);
        jRadioButtonMenuItemTableDetailFull.setText("Full");
        jRadioButtonMenuItemTableDetailFull.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemTableDetailFullActionPerformed(evt);
            }
        });
        jMenuTableDetail.add(jRadioButtonMenuItemTableDetailFull);

        buttonGroupTableDetail.add(jRadioButtonMenuItemTableDetailStart);
        jRadioButtonMenuItemTableDetailStart.setText("Start");
        jRadioButtonMenuItemTableDetailStart.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemTableDetailStartActionPerformed(evt);
            }
        });
        jMenuTableDetail.add(jRadioButtonMenuItemTableDetailStart);

        buttonGroupTableDetail.add(jRadioButtonMenuItemTableDetailEnd);
        jRadioButtonMenuItemTableDetailEnd.setText("End");
        jRadioButtonMenuItemTableDetailEnd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemTableDetailEndActionPerformed(evt);
            }
        });
        jMenuTableDetail.add(jRadioButtonMenuItemTableDetailEnd);

        buttonGroupTableDetail.add(jRadioButtonMenuItemTableDetailNone);
        jRadioButtonMenuItemTableDetailNone.setText("None");
        jRadioButtonMenuItemTableDetailNone.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItemTableDetailNoneActionPerformed(evt);
            }
        });
        jMenuTableDetail.add(jRadioButtonMenuItemTableDetailNone);

        jMenu1.add(jMenuTableDetail);

        setLayout(new java.awt.BorderLayout());
    }// </editor-fold>//GEN-END:initComponents

    private void jRadioButtonMenuItemHeadingFull1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemHeadingFull1ActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.h1","full");
    }//GEN-LAST:event_jRadioButtonMenuItemHeadingFull1ActionPerformed

    private void jRadioButtonMenuItemHeadingStart1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemHeadingStart1ActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.h1","start");
    }//GEN-LAST:event_jRadioButtonMenuItemHeadingStart1ActionPerformed

    private void jRadioButtonMenuItemHeadingEnd1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemHeadingEnd1ActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.h1","end");
    }//GEN-LAST:event_jRadioButtonMenuItemHeadingEnd1ActionPerformed

    private void jRadioButtonMenuItemHeadingNone1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemHeadingNone1ActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.h1",null);
    }//GEN-LAST:event_jRadioButtonMenuItemHeadingNone1ActionPerformed

    private void jRadioButtonMenuItemHeadingFull2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemHeadingFull2ActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.h2","full");
    }//GEN-LAST:event_jRadioButtonMenuItemHeadingFull2ActionPerformed

    private void jRadioButtonMenuItemHeadingStart2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemHeadingStart2ActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.h2","start");
    }//GEN-LAST:event_jRadioButtonMenuItemHeadingStart2ActionPerformed

    private void jRadioButtonMenuItemHeadingEnd2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemHeadingEnd2ActionPerformed
       setPropertyValue("net.sf.jasperreports.export.pdf.tag.h2","end");
    }//GEN-LAST:event_jRadioButtonMenuItemHeadingEnd2ActionPerformed

    private void jRadioButtonMenuItemHeadingNone2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemHeadingNone2ActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.h2",null);
    }//GEN-LAST:event_jRadioButtonMenuItemHeadingNone2ActionPerformed

    private void jRadioButtonMenuItemHeadingFull3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemHeadingFull3ActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.h3","full");
    }//GEN-LAST:event_jRadioButtonMenuItemHeadingFull3ActionPerformed

    private void jRadioButtonMenuItemHeadingStart3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemHeadingStart3ActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.h3","start");
    }//GEN-LAST:event_jRadioButtonMenuItemHeadingStart3ActionPerformed

    private void jRadioButtonMenuItemHeadingEnd3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemHeadingEnd3ActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.h3","end");
    }//GEN-LAST:event_jRadioButtonMenuItemHeadingEnd3ActionPerformed

    private void jRadioButtonMenuItemHeadingNone3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemHeadingNone3ActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.h3",null);
    }//GEN-LAST:event_jRadioButtonMenuItemHeadingNone3ActionPerformed

    private void jRadioButtonMenuItemTableFullActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemTableFullActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.table","full");
}//GEN-LAST:event_jRadioButtonMenuItemTableFullActionPerformed

    private void jRadioButtonMenuItemTableStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemTableStartActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.table","start");
}//GEN-LAST:event_jRadioButtonMenuItemTableStartActionPerformed

    private void jRadioButtonMenuItemTableEndActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemTableEndActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.table","end");
}//GEN-LAST:event_jRadioButtonMenuItemTableEndActionPerformed

    private void jRadioButtonMenuItemTableNoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemTableNoneActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.table",null);
}//GEN-LAST:event_jRadioButtonMenuItemTableNoneActionPerformed

    private void jRadioButtonMenuItemTableHeaderFullActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemTableHeaderFullActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.th","full");
}//GEN-LAST:event_jRadioButtonMenuItemTableHeaderFullActionPerformed

    private void jRadioButtonMenuItemTableHeaderStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemTableHeaderStartActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.th","start");
}//GEN-LAST:event_jRadioButtonMenuItemTableHeaderStartActionPerformed

    private void jRadioButtonMenuItemTableHeaderEndActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemTableHeaderEndActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.th","end");
}//GEN-LAST:event_jRadioButtonMenuItemTableHeaderEndActionPerformed

    private void jRadioButtonMenuItemTableHeaderNoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemTableHeaderNoneActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.th",null);
}//GEN-LAST:event_jRadioButtonMenuItemTableHeaderNoneActionPerformed

    private void jRadioButtonMenuItemTableDetailFullActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemTableDetailFullActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.td","full");
}//GEN-LAST:event_jRadioButtonMenuItemTableDetailFullActionPerformed

    private void jRadioButtonMenuItemTableDetailStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemTableDetailStartActionPerformed
       setPropertyValue("net.sf.jasperreports.export.pdf.tag.td","start");
}//GEN-LAST:event_jRadioButtonMenuItemTableDetailStartActionPerformed

    private void jRadioButtonMenuItemTableDetailEndActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemTableDetailEndActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.td","end");
}//GEN-LAST:event_jRadioButtonMenuItemTableDetailEndActionPerformed

    private void jRadioButtonMenuItemTableDetailNoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemTableDetailNoneActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.td",null);
}//GEN-LAST:event_jRadioButtonMenuItemTableDetailNoneActionPerformed

    private void jRadioButtonMenuItemTableRowFullActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemTableRowFullActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.tr","full");
}//GEN-LAST:event_jRadioButtonMenuItemTableRowFullActionPerformed

    private void jRadioButtonMenuItemTableRowStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemTableRowStartActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.tr","start");
}//GEN-LAST:event_jRadioButtonMenuItemTableRowStartActionPerformed

    private void jRadioButtonMenuItemTableRowEndActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemTableRowEndActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.tr","end");
}//GEN-LAST:event_jRadioButtonMenuItemTableRowEndActionPerformed

    private void jRadioButtonMenuItemTableRowNoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItemTableRowNoneActionPerformed
        setPropertyValue("net.sf.jasperreports.export.pdf.tag.tr",null);
}//GEN-LAST:event_jRadioButtonMenuItemTableRowNoneActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroupHeading1;
    private javax.swing.ButtonGroup buttonGroupHeading2;
    private javax.swing.ButtonGroup buttonGroupHeading3;
    private javax.swing.ButtonGroup buttonGroupTable;
    private javax.swing.ButtonGroup buttonGroupTableDetail;
    private javax.swing.ButtonGroup buttonGroupTableHeader;
    private javax.swing.ButtonGroup buttonGroupTableRow;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenuHeading;
    private javax.swing.JMenu jMenuHeading1;
    private javax.swing.JMenu jMenuHeading2;
    private javax.swing.JMenu jMenuHeading3;
    private javax.swing.JMenu jMenuTable;
    private javax.swing.JMenu jMenuTableDetail;
    private javax.swing.JMenu jMenuTableHeader;
    private javax.swing.JMenu jMenuTableRow;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemHeadingEnd1;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemHeadingEnd2;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemHeadingEnd3;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemHeadingFull1;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemHeadingFull2;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemHeadingFull3;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemHeadingNone1;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemHeadingNone2;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemHeadingNone3;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemHeadingStart1;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemHeadingStart2;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemHeadingStart3;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemTableDetailEnd;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemTableDetailFull;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemTableDetailNone;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemTableDetailStart;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemTableEnd;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemTableFull;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemTableHeaderEnd;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemTableHeaderFull;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemTableHeaderNone;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemTableHeaderStart;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemTableNone;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemTableRowEnd;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemTableRowFull;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemTableRowNone;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemTableRowStart;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItemTableStart;
    // End of variables declaration//GEN-END:variables

    private void setPropertyValue(String propName, String val) {
        setPropertyValue(getElement(), propName, val);
    }

    private String getPropertyValue(String propName) {
        return getPropertyValue(getElement(), propName);
    }


    public static void setPropertyValue(JRDesignElement element, String propName, String val) {
        if (element != null)
        {
            element.getPropertiesMap().setProperty(propName, val);
            Mutex.EVENT.readAccess(new Runnable() {

                public void run() {
                    IReportManager.getInstance().notifyReportChange();
            IReportManager.getInstance().getActiveVisualView().getReportDesignerPanel().getActiveScene().repaint();
                }
            });
        }
    }

    public static String getPropertyValue(JRDesignElement element, String propName) {
        String val =  "";
        if (element != null)
        {
            val = element.getPropertiesMap().getProperty(propName);
            if (val == null) val ="";
        }
        return val;
    }

    /**
     * @return the element
     */
    public

    JRDesignElement getElement() {
        return element;
    }

    /**
     * @param element the element to set
     */
    public void setElement(JRDesignElement element) {
        this.element = element;
        // Update the menu status...
        String val = getPropertyValue("net.sf.jasperreports.export.pdf.tag.h1");
        jRadioButtonMenuItemHeadingNone1.setSelected(val.equals(""));
        jRadioButtonMenuItemHeadingFull1.setSelected(val.equals("full"));
        jRadioButtonMenuItemHeadingStart1.setSelected(val.equals("start"));
        jRadioButtonMenuItemHeadingEnd1.setSelected(val.equals("end"));

        val = getPropertyValue("net.sf.jasperreports.export.pdf.tag.h2");
        jRadioButtonMenuItemHeadingNone2.setSelected(val.equals(""));
        jRadioButtonMenuItemHeadingFull2.setSelected(val.equals("full"));
        jRadioButtonMenuItemHeadingStart2.setSelected(val.equals("start"));
        jRadioButtonMenuItemHeadingEnd2.setSelected(val.equals("end"));

        val = getPropertyValue("net.sf.jasperreports.export.pdf.tag.h3");
        jRadioButtonMenuItemHeadingNone3.setSelected(val.equals(""));
        jRadioButtonMenuItemHeadingFull3.setSelected(val.equals("full"));
        jRadioButtonMenuItemHeadingStart3.setSelected(val.equals("start"));
        jRadioButtonMenuItemHeadingEnd3.setSelected(val.equals("end"));

        val = getPropertyValue("net.sf.jasperreports.export.pdf.tag.table");
        jRadioButtonMenuItemTableNone.setSelected(val.equals(""));
        jRadioButtonMenuItemTableFull.setSelected(val.equals("full"));
        jRadioButtonMenuItemTableStart.setSelected(val.equals("start"));
        jRadioButtonMenuItemTableEnd.setSelected(val.equals("end"));

        val = getPropertyValue("net.sf.jasperreports.export.pdf.tag.tr");
        jRadioButtonMenuItemTableRowNone.setSelected(val.equals(""));
        jRadioButtonMenuItemTableRowFull.setSelected(val.equals("full"));
        jRadioButtonMenuItemTableRowStart.setSelected(val.equals("start"));
        jRadioButtonMenuItemTableRowEnd.setSelected(val.equals("end"));

        val = getPropertyValue("net.sf.jasperreports.export.pdf.tag.th");
        jRadioButtonMenuItemTableHeaderNone.setSelected(val.equals(""));
        jRadioButtonMenuItemTableHeaderFull.setSelected(val.equals("full"));
        jRadioButtonMenuItemTableHeaderStart.setSelected(val.equals("start"));
        jRadioButtonMenuItemTableHeaderEnd.setSelected(val.equals("end"));

        val = getPropertyValue("net.sf.jasperreports.export.pdf.tag.td");
        jRadioButtonMenuItemTableDetailNone.setSelected(val.equals(""));
        jRadioButtonMenuItemTableDetailFull.setSelected(val.equals("full"));
        jRadioButtonMenuItemTableDetailStart.setSelected(val.equals("start"));
        jRadioButtonMenuItemTableDetailEnd.setSelected(val.equals("end"));
    }


}
