0001: /*
0002: * Copyright (C) 2005 - 2008 JasperSoft Corporation. All rights reserved.
0003: * http://www.jaspersoft.com.
0004: *
0005: * Unless you have purchased a commercial license agreement from JasperSoft,
0006: * the following license terms apply:
0007: *
0008: * This program is free software; you can redistribute it and/or modify
0009: * it under the terms of the GNU General Public License version 2 as published by
0010: * the Free Software Foundation.
0011: *
0012: * This program is distributed WITHOUT ANY WARRANTY; and without the
0013: * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
0014: * See the GNU General Public License for more details.
0015: *
0016: * You should have received a copy of the GNU General Public License
0017: * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
0018: * or write to:
0019: *
0020: * Free Software Foundation, Inc.,
0021: * 59 Temple Place - Suite 330,
0022: * Boston, MA USA 02111-1307
0023: *
0024: *
0025: *
0026: *
0027: * SectionItemHyperlinkPanel.java
0028: *
0029: * Created on September 1, 2006, 1:44 PM
0030: *
0031: */
0032:
0033: package it.businesslogic.ireport.chart.gui;
0034:
0035: import it.businesslogic.ireport.JRLinkParameter;
0036: import it.businesslogic.ireport.SubDataset;
0037: import it.businesslogic.ireport.chart.SectionItemHyperlink;
0038: import it.businesslogic.ireport.gui.JRLinkParameterDialog;
0039: import it.businesslogic.ireport.util.Misc;
0040: import java.awt.event.ActionEvent;
0041: import java.util.Vector;
0042: import javax.swing.SwingUtilities;
0043: import it.businesslogic.ireport.util.I18n;
0044:
0045: /**
0046: *
0047: * @author gtoffoli
0048: */
0049: public class SectionItemHyperlinkPanel extends javax.swing.JPanel {
0050:
0051: private SectionItemHyperlink sectionItemHyperlink = null;
0052:
0053: private boolean init = false;
0054:
0055: /** Creates new form SectionItemHyperlink */
0056: public SectionItemHyperlinkPanel() {
0057: initComponents();
0058: sectionItemHyperlink = new SectionItemHyperlink();
0059:
0060: jComboBoxLinkType.addItem("None");
0061: jComboBoxLinkType.addItem("Reference");
0062: jComboBoxLinkType.addItem("LocalAnchor");
0063: jComboBoxLinkType.addItem("LocalPage");
0064: jComboBoxLinkType.addItem("RemoteAnchor");
0065: jComboBoxLinkType.addItem("RemotePage");
0066:
0067: // Barcode Evaluation Time...
0068: jComboBoxLinkTarget.addItem("Self");
0069: jComboBoxLinkTarget.addItem("Blank");
0070:
0071: this .jRTextExpressionAreaAnchor.getDocument()
0072: .addDocumentListener(
0073: new javax.swing.event.DocumentListener() {
0074: public void changedUpdate(
0075: javax.swing.event.DocumentEvent evt) {
0076: jRTextExpressionAreaAnchorTextChanged();
0077: }
0078:
0079: public void insertUpdate(
0080: javax.swing.event.DocumentEvent evt) {
0081: jRTextExpressionAreaAnchorTextChanged();
0082: }
0083:
0084: public void removeUpdate(
0085: javax.swing.event.DocumentEvent evt) {
0086: jRTextExpressionAreaAnchorTextChanged();
0087: }
0088: });
0089:
0090: this .jRTextExpressionAreaPage.getDocument()
0091: .addDocumentListener(
0092: new javax.swing.event.DocumentListener() {
0093: public void changedUpdate(
0094: javax.swing.event.DocumentEvent evt) {
0095: jRTextExpressionAreaPageTextChanged();
0096: }
0097:
0098: public void insertUpdate(
0099: javax.swing.event.DocumentEvent evt) {
0100: jRTextExpressionAreaPageTextChanged();
0101: }
0102:
0103: public void removeUpdate(
0104: javax.swing.event.DocumentEvent evt) {
0105: jRTextExpressionAreaPageTextChanged();
0106: }
0107: });
0108:
0109: this .jRTextExpressionAreaReference.getDocument()
0110: .addDocumentListener(
0111: new javax.swing.event.DocumentListener() {
0112: public void changedUpdate(
0113: javax.swing.event.DocumentEvent evt) {
0114: jRTextExpressionAreaReferenceTextChanged();
0115: }
0116:
0117: public void insertUpdate(
0118: javax.swing.event.DocumentEvent evt) {
0119: jRTextExpressionAreaReferenceTextChanged();
0120: }
0121:
0122: public void removeUpdate(
0123: javax.swing.event.DocumentEvent evt) {
0124: jRTextExpressionAreaReferenceTextChanged();
0125: }
0126: });
0127:
0128: this .jRTextExpressionAreaTooltip.getDocument()
0129: .addDocumentListener(
0130: new javax.swing.event.DocumentListener() {
0131: public void changedUpdate(
0132: javax.swing.event.DocumentEvent evt) {
0133: jRTextExpressionAreaTooltipTextChanged();
0134: }
0135:
0136: public void insertUpdate(
0137: javax.swing.event.DocumentEvent evt) {
0138: jRTextExpressionAreaTooltipTextChanged();
0139: }
0140:
0141: public void removeUpdate(
0142: javax.swing.event.DocumentEvent evt) {
0143: jRTextExpressionAreaTooltipTextChanged();
0144: }
0145: });
0146:
0147: javax.swing.DefaultListSelectionModel dlsm = (javax.swing.DefaultListSelectionModel) this .jTableLinkParameters
0148: .getSelectionModel();
0149: dlsm
0150: .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
0151: public void valueChanged(
0152: javax.swing.event.ListSelectionEvent e) {
0153: jTableLinkParametersListSelectionValueChanged(e);
0154: }
0155: });
0156:
0157: applyI18n();
0158: }
0159:
0160: public SectionItemHyperlink getSectionItemHyperlink() {
0161: return sectionItemHyperlink;
0162: }
0163:
0164: public void setSubDataset(SubDataset sds) {
0165: jRTextExpressionAreaReference.setSubDataset(sds);
0166: jRTextExpressionAreaAnchor.setSubDataset(sds);
0167: jRTextExpressionAreaPage.setSubDataset(sds);
0168: jRTextExpressionAreaTooltip.setSubDataset(sds);
0169: }
0170:
0171: public void setSectionItemHyperlink(
0172: SectionItemHyperlink sectionItemHyperlink) {
0173: try {
0174: setInit(true);
0175:
0176: this .sectionItemHyperlink = sectionItemHyperlink;
0177:
0178: // Fill the hyperlink panel...
0179: jComboBoxLinkTarget.setSelectedItem(sectionItemHyperlink
0180: .getHyperlinkTarget());
0181: jComboBoxLinkType.setSelectedItem(sectionItemHyperlink
0182: .getHyperlinkType());
0183: jRTextExpressionAreaReference.setText(sectionItemHyperlink
0184: .getHyperlinkReferenceExpression());
0185: jRTextExpressionAreaAnchor.setText(sectionItemHyperlink
0186: .getHyperlinkAnchorExpression());
0187: jRTextExpressionAreaPage.setText(sectionItemHyperlink
0188: .getHyperlinkPageExpression());
0189: jRTextExpressionAreaTooltip.setText(sectionItemHyperlink
0190: .getHyperlinkTooltipExpression());
0191:
0192: jTabbedPane2.removeAll();
0193:
0194: //Adjusting hyperlink combinations...
0195: if (((String) this .jComboBoxLinkType.getSelectedItem())
0196: .equals("None")) {
0197: this .jRTextExpressionAreaAnchor.setEnabled(false);
0198: this .jLabelAnchor.setEnabled(false);
0199: this .jRTextExpressionAreaPage.setEnabled(false);
0200: this .jLabelPage.setEnabled(false);
0201: this .jRTextExpressionAreaReference.setEnabled(false);
0202: this .jLabelReference.setEnabled(false);
0203: } else if (((String) this .jComboBoxLinkType
0204: .getSelectedItem()).equals("Reference")) {
0205: this .jRTextExpressionAreaAnchor.setEnabled(false);
0206: this .jLabelAnchor.setEnabled(false);
0207: this .jRTextExpressionAreaPage.setEnabled(false);
0208: this .jLabelPage.setEnabled(false);
0209: this .jRTextExpressionAreaReference.setEnabled(true);
0210: this .jLabelReference.setEnabled(true);
0211:
0212: jTabbedPane2.addTab(I18n.getString(
0213: "sectionItemHyperlinkPanel.tab.Reference",
0214: "Reference"), this .jPanelReference);
0215: jTabbedPane2.addTab(I18n.getString(
0216: "sectionItemHyperlinkPanel.tab.LinkParameters",
0217: "Link parameters"), this .jPanelLinkParams);
0218: } else if (((String) this .jComboBoxLinkType
0219: .getSelectedItem()).equals("LocalAnchor")) {
0220: this .jRTextExpressionAreaAnchor.setEnabled(true);
0221: this .jLabelAnchor.setEnabled(true);
0222: this .jRTextExpressionAreaPage.setEnabled(false);
0223: this .jLabelPage.setEnabled(false);
0224: this .jRTextExpressionAreaReference.setEnabled(false);
0225: this .jLabelReference.setEnabled(false);
0226:
0227: //jTabbedPane2.addTab(I18n.getString("sectionItemHyperlinkPanel.tab.Reference","Reference"),this.jPanelReference);
0228:
0229: jTabbedPane2.addTab(I18n.getString(
0230: "sectionItemHyperlinkPanel.tab.Anchor",
0231: "Anchor"), this .jPanelAnchor);
0232: //jTabbedPane2.addTab(I18n.getString("sectionItemHyperlinkPanel.tab.Page","Page"),this.jPanelPage);
0233: jTabbedPane2.addTab(I18n.getString(
0234: "sectionItemHyperlinkPanel.tab.LinkParameters",
0235: "Link parameters"), this .jPanelLinkParams);
0236: } else if (((String) this .jComboBoxLinkType
0237: .getSelectedItem()).equals("LocalPage")) {
0238: this .jRTextExpressionAreaAnchor.setEnabled(false);
0239: this .jLabelAnchor.setEnabled(false);
0240: this .jRTextExpressionAreaPage.setEnabled(true);
0241: this .jLabelPage.setEnabled(true);
0242: this .jRTextExpressionAreaReference.setEnabled(false);
0243: this .jLabelReference.setEnabled(false);
0244:
0245: //jTabbedPane2.addTab(I18n.getString("sectionItemHyperlinkPanel.tab.Reference","Reference"),this.jPanelReference);
0246: //jTabbedPane2.addTab(I18n.getString("sectionItemHyperlinkPanel.tab.Anchor","Anchor"), this.jPanelAnchor);
0247: jTabbedPane2.addTab(I18n.getString(
0248: "sectionItemHyperlinkPanel.tab.Page", "Page"),
0249: this .jPanelPage);
0250: jTabbedPane2.addTab(I18n.getString(
0251: "sectionItemHyperlinkPanel.tab.LinkParameters",
0252: "Link parameters"), this .jPanelLinkParams);
0253: } else if (((String) this .jComboBoxLinkType
0254: .getSelectedItem()).equals("RemoteAnchor")) {
0255: this .jRTextExpressionAreaAnchor.setEnabled(true);
0256: this .jLabelAnchor.setEnabled(true);
0257: this .jRTextExpressionAreaPage.setEnabled(false);
0258: this .jLabelPage.setEnabled(false);
0259: this .jRTextExpressionAreaReference.setEnabled(true);
0260: this .jLabelReference.setEnabled(true);
0261:
0262: jTabbedPane2.addTab(I18n.getString(
0263: "sectionItemHyperlinkPanel.tab.Reference",
0264: "Reference"), this .jPanelReference);
0265: jTabbedPane2.addTab(I18n.getString(
0266: "sectionItemHyperlinkPanel.tab.Anchor",
0267: "Anchor"), this .jPanelAnchor);
0268: //jTabbedPane2.addTab(I18n.getString("sectionItemHyperlinkPanel.tab.Page","Page"),this.jPanelPage);
0269: jTabbedPane2.addTab(I18n.getString(
0270: "sectionItemHyperlinkPanel.tab.LinkParameters",
0271: "Link parameters"), this .jPanelLinkParams);
0272: } else if (((String) this .jComboBoxLinkType
0273: .getSelectedItem()).equals("RemotePage")) {
0274: this .jRTextExpressionAreaAnchor.setEnabled(false);
0275: this .jLabelAnchor.setEnabled(false);
0276: this .jRTextExpressionAreaPage.setEnabled(true);
0277: this .jLabelPage.setEnabled(true);
0278: this .jRTextExpressionAreaReference.setEnabled(true);
0279: this .jLabelReference.setEnabled(true);
0280:
0281: jTabbedPane2.addTab(I18n.getString(
0282: "sectionItemHyperlinkPanel.tab.Reference",
0283: "Reference"), this .jPanelReference);
0284: //jTabbedPane2.addTab(I18n.getString("sectionItemHyperlinkPanel.tab.Anchor","Anchor"), this.jPanelAnchor);
0285:
0286: jTabbedPane2.addTab(I18n.getString(
0287: "sectionItemHyperlinkPanel.tab.Page", "Page"),
0288: this .jPanelPage);
0289: jTabbedPane2.addTab(I18n.getString(
0290: "sectionItemHyperlinkPanel.tab.LinkParameters",
0291: "Link parameters"), this .jPanelLinkParams);
0292: } else {
0293: this .jRTextExpressionAreaAnchor.setEnabled(true);
0294: this .jLabelAnchor.setEnabled(true);
0295: this .jRTextExpressionAreaPage.setEnabled(true);
0296: this .jLabelPage.setEnabled(true);
0297: this .jRTextExpressionAreaReference.setEnabled(true);
0298: this .jLabelReference.setEnabled(true);
0299:
0300: jTabbedPane2.addTab(I18n.getString(
0301: "sectionItemHyperlinkPanel.tab.Reference",
0302: "Reference"), this .jPanelReference);
0303: jTabbedPane2.addTab(I18n.getString(
0304: "sectionItemHyperlinkPanel.tab.Anchor",
0305: "Anchor"), this .jPanelAnchor);
0306: jTabbedPane2.addTab(I18n.getString(
0307: "sectionItemHyperlinkPanel.tab.Page", "Page"),
0308: this .jPanelPage);
0309: jTabbedPane2.addTab(I18n.getString(
0310: "sectionItemHyperlinkPanel.tab.LinkParameters",
0311: "Link parameters"), this .jPanelLinkParams);
0312: }
0313:
0314: jTabbedPane2.addTab(
0315: I18n.getString(
0316: "sectionItemHyperlinkPanel.tab.Tooltip",
0317: "Tooltip"), this .jPanelTooltip);
0318:
0319: // Adding parameters...
0320: java.util.Iterator enum_parameters = sectionItemHyperlink
0321: .getHyperlinkParameters().iterator();
0322:
0323: javax.swing.table.DefaultTableModel dtmLinkParams = (javax.swing.table.DefaultTableModel) jTableLinkParameters
0324: .getModel();
0325: dtmLinkParams.setRowCount(0);
0326:
0327: while (enum_parameters.hasNext()) {
0328: it.businesslogic.ireport.JRLinkParameter parameter = (it.businesslogic.ireport.JRLinkParameter) enum_parameters
0329: .next();
0330: Vector row = new Vector();
0331: row.addElement(parameter);
0332: row.addElement(parameter.getExpression());
0333: dtmLinkParams.addRow(row);
0334: }
0335: } finally {
0336:
0337: setInit(false);
0338: }
0339: }
0340:
0341: public void jTableLinkParametersListSelectionValueChanged(
0342: javax.swing.event.ListSelectionEvent e) {
0343: if (this .jTableLinkParameters.getSelectedRowCount() > 0) {
0344: this .jButtonModLinkParameter.setEnabled(true);
0345: this .jButtonRemLinkParameter.setEnabled(true);
0346: } else {
0347: this .jButtonModLinkParameter.setEnabled(false);
0348: this .jButtonRemLinkParameter.setEnabled(false);
0349: }
0350: }
0351:
0352: public boolean isInit() {
0353: return init;
0354: }
0355:
0356: public void setInit(boolean init) {
0357: this .init = init;
0358: }
0359:
0360: /** This method is called from within the constructor to
0361: * initialize the form.
0362: * WARNING: Do NOT modify this code. The content of this method is
0363: * always regenerated by the Form Editor.
0364: */
0365: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
0366: private void initComponents() {
0367: java.awt.GridBagConstraints gridBagConstraints;
0368:
0369: jLabelTarget = new javax.swing.JLabel();
0370: jComboBoxLinkTarget = new javax.swing.JComboBox();
0371: jLabel36 = new javax.swing.JLabel();
0372: jComboBoxLinkType = new javax.swing.JComboBox();
0373: jPanel1 = new javax.swing.JPanel();
0374: jTabbedPane2 = new javax.swing.JTabbedPane();
0375: jPanelReference = new javax.swing.JPanel();
0376: jLabelReference = new javax.swing.JLabel();
0377: jRTextExpressionAreaReference = new it.businesslogic.ireport.gui.JRTextExpressionArea();
0378: jPanelAnchor = new javax.swing.JPanel();
0379: jLabelAnchor = new javax.swing.JLabel();
0380: jRTextExpressionAreaAnchor = new it.businesslogic.ireport.gui.JRTextExpressionArea();
0381: jPanelPage = new javax.swing.JPanel();
0382: jLabelPage = new javax.swing.JLabel();
0383: jRTextExpressionAreaPage = new it.businesslogic.ireport.gui.JRTextExpressionArea();
0384: jPanelLinkParams = new javax.swing.JPanel();
0385: jScrollPane1 = new javax.swing.JScrollPane();
0386: jTableLinkParameters = new javax.swing.JTable();
0387: jPanel3 = new javax.swing.JPanel();
0388: jButtonAddLinkParameter = new javax.swing.JButton();
0389: jButtonModLinkParameter = new javax.swing.JButton();
0390: jButtonRemLinkParameter = new javax.swing.JButton();
0391: jPanelTooltip = new javax.swing.JPanel();
0392: jLabelReference1 = new javax.swing.JLabel();
0393: jRTextExpressionAreaTooltip = new it.businesslogic.ireport.gui.JRTextExpressionArea();
0394:
0395: setLayout(new java.awt.GridBagLayout());
0396:
0397: addComponentListener(new java.awt.event.ComponentAdapter() {
0398: public void componentShown(java.awt.event.ComponentEvent evt) {
0399: formComponentShown(evt);
0400: }
0401: });
0402:
0403: jLabelTarget
0404: .setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
0405: jLabelTarget.setText("Hyperlink target");
0406: jLabelTarget.setMaximumSize(new java.awt.Dimension(200, 25));
0407: jLabelTarget.setMinimumSize(new java.awt.Dimension(100, 20));
0408: jLabelTarget.setPreferredSize(new java.awt.Dimension(100, 20));
0409: gridBagConstraints = new java.awt.GridBagConstraints();
0410: gridBagConstraints.gridx = 0;
0411: gridBagConstraints.gridy = 7;
0412: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0413: gridBagConstraints.ipadx = 22;
0414: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0415: gridBagConstraints.insets = new java.awt.Insets(8, 8, 5, 0);
0416: add(jLabelTarget, gridBagConstraints);
0417:
0418: jComboBoxLinkTarget.setMinimumSize(new java.awt.Dimension(180,
0419: 20));
0420: jComboBoxLinkTarget.setPreferredSize(new java.awt.Dimension(
0421: 180, 20));
0422: jComboBoxLinkTarget
0423: .addActionListener(new java.awt.event.ActionListener() {
0424: public void actionPerformed(
0425: java.awt.event.ActionEvent evt) {
0426: jComboBoxLinkTargetActionPerformed1(evt);
0427: }
0428: });
0429:
0430: gridBagConstraints = new java.awt.GridBagConstraints();
0431: gridBagConstraints.gridx = 1;
0432: gridBagConstraints.gridy = 7;
0433: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0434: gridBagConstraints.weightx = 1.0;
0435: gridBagConstraints.insets = new java.awt.Insets(8, 6, 0, 2);
0436: add(jComboBoxLinkTarget, gridBagConstraints);
0437:
0438: jLabel36
0439: .setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
0440: jLabel36.setText("Hyperlink type");
0441: jLabel36.setMaximumSize(new java.awt.Dimension(200, 25));
0442: jLabel36.setMinimumSize(new java.awt.Dimension(100, 20));
0443: jLabel36.setPreferredSize(new java.awt.Dimension(100, 20));
0444: gridBagConstraints = new java.awt.GridBagConstraints();
0445: gridBagConstraints.gridx = 0;
0446: gridBagConstraints.gridy = 8;
0447: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0448: gridBagConstraints.ipadx = 22;
0449: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0450: gridBagConstraints.insets = new java.awt.Insets(0, 8, 5, 0);
0451: add(jLabel36, gridBagConstraints);
0452:
0453: jComboBoxLinkType.setEditable(true);
0454: jComboBoxLinkType
0455: .setMinimumSize(new java.awt.Dimension(180, 20));
0456: jComboBoxLinkType.setPreferredSize(new java.awt.Dimension(180,
0457: 20));
0458: jComboBoxLinkType
0459: .addActionListener(new java.awt.event.ActionListener() {
0460: public void actionPerformed(
0461: java.awt.event.ActionEvent evt) {
0462: jComboBoxLinkTypeActionPerformed1(evt);
0463: }
0464: });
0465:
0466: gridBagConstraints = new java.awt.GridBagConstraints();
0467: gridBagConstraints.gridx = 1;
0468: gridBagConstraints.gridy = 8;
0469: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0470: gridBagConstraints.weightx = 1.0;
0471: gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 6);
0472: add(jComboBoxLinkType, gridBagConstraints);
0473:
0474: jPanel1.setLayout(new java.awt.GridBagLayout());
0475:
0476: jPanelReference.setLayout(new java.awt.GridBagLayout());
0477:
0478: jLabelReference
0479: .setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
0480: jLabelReference.setText("Hyperlink Reference Expression");
0481: jLabelReference.setEnabled(false);
0482: gridBagConstraints = new java.awt.GridBagConstraints();
0483: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0484: gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
0485: jPanelReference.add(jLabelReference, gridBagConstraints);
0486:
0487: jRTextExpressionAreaReference
0488: .setBorder(javax.swing.BorderFactory
0489: .createEtchedBorder());
0490: jRTextExpressionAreaReference.setEnabled(false);
0491: jRTextExpressionAreaReference
0492: .setMinimumSize(new java.awt.Dimension(300, 50));
0493: jRTextExpressionAreaReference
0494: .setPreferredSize(new java.awt.Dimension(300, 50));
0495: jRTextExpressionAreaReference.setViewScrollbars(false);
0496: gridBagConstraints = new java.awt.GridBagConstraints();
0497: gridBagConstraints.gridx = 0;
0498: gridBagConstraints.gridy = 11;
0499: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0500: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0501: gridBagConstraints.weightx = 1.0;
0502: gridBagConstraints.weighty = 1.0;
0503: gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
0504: jPanelReference.add(jRTextExpressionAreaReference,
0505: gridBagConstraints);
0506:
0507: jTabbedPane2.addTab("Reference", jPanelReference);
0508:
0509: jPanelAnchor.setLayout(new java.awt.GridBagLayout());
0510:
0511: jLabelAnchor
0512: .setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
0513: jLabelAnchor.setText("Hyperlink Anchor Expression");
0514: jLabelAnchor.setEnabled(false);
0515: gridBagConstraints = new java.awt.GridBagConstraints();
0516: gridBagConstraints.gridx = 0;
0517: gridBagConstraints.gridy = 0;
0518: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0519: gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
0520: jPanelAnchor.add(jLabelAnchor, gridBagConstraints);
0521:
0522: jRTextExpressionAreaAnchor.setBorder(javax.swing.BorderFactory
0523: .createEtchedBorder());
0524: jRTextExpressionAreaAnchor.setEnabled(false);
0525: jRTextExpressionAreaAnchor
0526: .setMinimumSize(new java.awt.Dimension(300, 50));
0527: jRTextExpressionAreaAnchor
0528: .setPreferredSize(new java.awt.Dimension(300, 50));
0529: jRTextExpressionAreaAnchor.setViewScrollbars(false);
0530: gridBagConstraints = new java.awt.GridBagConstraints();
0531: gridBagConstraints.gridx = 0;
0532: gridBagConstraints.gridy = 1;
0533: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0534: gridBagConstraints.weightx = 1.0;
0535: gridBagConstraints.weighty = 1.0;
0536: gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
0537: jPanelAnchor
0538: .add(jRTextExpressionAreaAnchor, gridBagConstraints);
0539:
0540: jTabbedPane2.addTab("Anchor", jPanelAnchor);
0541:
0542: jPanelPage.setLayout(new java.awt.GridBagLayout());
0543:
0544: jLabelPage
0545: .setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
0546: jLabelPage.setText("Hyperlink Page Expression");
0547: jLabelPage.setEnabled(false);
0548: gridBagConstraints = new java.awt.GridBagConstraints();
0549: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0550: gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
0551: jPanelPage.add(jLabelPage, gridBagConstraints);
0552:
0553: jRTextExpressionAreaPage.setBorder(javax.swing.BorderFactory
0554: .createEtchedBorder());
0555: jRTextExpressionAreaPage.setEnabled(false);
0556: jRTextExpressionAreaPage.setMinimumSize(new java.awt.Dimension(
0557: 300, 50));
0558: jRTextExpressionAreaPage
0559: .setPreferredSize(new java.awt.Dimension(300, 50));
0560: jRTextExpressionAreaPage.setViewScrollbars(false);
0561: gridBagConstraints = new java.awt.GridBagConstraints();
0562: gridBagConstraints.gridx = 0;
0563: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0564: gridBagConstraints.weightx = 1.0;
0565: gridBagConstraints.weighty = 1.0;
0566: gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
0567: jPanelPage.add(jRTextExpressionAreaPage, gridBagConstraints);
0568:
0569: jTabbedPane2.addTab("Page", jPanelPage);
0570:
0571: jPanelLinkParams.setLayout(new java.awt.GridBagLayout());
0572:
0573: jTableLinkParameters
0574: .setModel(new javax.swing.table.DefaultTableModel(
0575: new Object[][] {
0576:
0577: }, new String[] { "Parameter name",
0578: "Expression" }) {
0579: boolean[] canEdit = new boolean[] { false, false };
0580:
0581: public boolean isCellEditable(int rowIndex,
0582: int columnIndex) {
0583: return canEdit[columnIndex];
0584: }
0585: });
0586: jTableLinkParameters
0587: .addMouseListener(new java.awt.event.MouseAdapter() {
0588: public void mouseClicked(
0589: java.awt.event.MouseEvent evt) {
0590: jTableLinkParametersMouseClicked(evt);
0591: }
0592: });
0593:
0594: jScrollPane1.setViewportView(jTableLinkParameters);
0595:
0596: gridBagConstraints = new java.awt.GridBagConstraints();
0597: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0598: gridBagConstraints.weightx = 1.0;
0599: gridBagConstraints.weighty = 1.0;
0600: jPanelLinkParams.add(jScrollPane1, gridBagConstraints);
0601:
0602: jPanel3.setLayout(new java.awt.GridBagLayout());
0603:
0604: jButtonAddLinkParameter.setText("Add");
0605: jButtonAddLinkParameter
0606: .addActionListener(new java.awt.event.ActionListener() {
0607: public void actionPerformed(
0608: java.awt.event.ActionEvent evt) {
0609: jButtonAddLinkParameterActionPerformed(evt);
0610: }
0611: });
0612:
0613: gridBagConstraints = new java.awt.GridBagConstraints();
0614: gridBagConstraints.gridx = 0;
0615: gridBagConstraints.gridy = 0;
0616: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0617: gridBagConstraints.insets = new java.awt.Insets(4, 0, 6, 0);
0618: jPanel3.add(jButtonAddLinkParameter, gridBagConstraints);
0619:
0620: jButtonModLinkParameter.setText("Modify");
0621: jButtonModLinkParameter.setEnabled(false);
0622: jButtonModLinkParameter
0623: .addActionListener(new java.awt.event.ActionListener() {
0624: public void actionPerformed(
0625: java.awt.event.ActionEvent evt) {
0626: jButtonModLinkParameterActionPerformed(evt);
0627: }
0628: });
0629:
0630: gridBagConstraints = new java.awt.GridBagConstraints();
0631: gridBagConstraints.gridx = 1;
0632: gridBagConstraints.gridy = 0;
0633: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0634: gridBagConstraints.insets = new java.awt.Insets(4, 6, 6, 0);
0635: jPanel3.add(jButtonModLinkParameter, gridBagConstraints);
0636:
0637: jButtonRemLinkParameter.setText("Remove");
0638: jButtonRemLinkParameter.setEnabled(false);
0639: jButtonRemLinkParameter
0640: .addActionListener(new java.awt.event.ActionListener() {
0641: public void actionPerformed(
0642: java.awt.event.ActionEvent evt) {
0643: jButtonRemLinkParameterActionPerformed(evt);
0644: }
0645: });
0646:
0647: gridBagConstraints = new java.awt.GridBagConstraints();
0648: gridBagConstraints.gridx = 2;
0649: gridBagConstraints.gridy = 0;
0650: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0651: gridBagConstraints.weightx = 1.0;
0652: gridBagConstraints.insets = new java.awt.Insets(4, 6, 6, 0);
0653: jPanel3.add(jButtonRemLinkParameter, gridBagConstraints);
0654:
0655: gridBagConstraints = new java.awt.GridBagConstraints();
0656: gridBagConstraints.gridx = 0;
0657: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0658: gridBagConstraints.weightx = 1.0;
0659: gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 6);
0660: jPanelLinkParams.add(jPanel3, gridBagConstraints);
0661:
0662: jTabbedPane2.addTab("Link parameters", jPanelLinkParams);
0663:
0664: jPanelTooltip.setLayout(new java.awt.GridBagLayout());
0665:
0666: jLabelReference1
0667: .setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
0668: jLabelReference1.setText("Tooltip Expression");
0669: gridBagConstraints = new java.awt.GridBagConstraints();
0670: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0671: gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
0672: jPanelTooltip.add(jLabelReference1, gridBagConstraints);
0673:
0674: jRTextExpressionAreaTooltip.setBorder(javax.swing.BorderFactory
0675: .createEtchedBorder());
0676: jRTextExpressionAreaTooltip
0677: .setMinimumSize(new java.awt.Dimension(300, 50));
0678: jRTextExpressionAreaTooltip
0679: .setPreferredSize(new java.awt.Dimension(300, 50));
0680: jRTextExpressionAreaTooltip.setViewScrollbars(false);
0681: gridBagConstraints = new java.awt.GridBagConstraints();
0682: gridBagConstraints.gridx = 0;
0683: gridBagConstraints.gridy = 11;
0684: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0685: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0686: gridBagConstraints.weightx = 1.0;
0687: gridBagConstraints.weighty = 1.0;
0688: gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
0689: jPanelTooltip.add(jRTextExpressionAreaTooltip,
0690: gridBagConstraints);
0691:
0692: jTabbedPane2.addTab("Tooltip", jPanelTooltip);
0693:
0694: gridBagConstraints = new java.awt.GridBagConstraints();
0695: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0696: gridBagConstraints.weightx = 1.0;
0697: gridBagConstraints.weighty = 1.0;
0698: jPanel1.add(jTabbedPane2, gridBagConstraints);
0699:
0700: gridBagConstraints = new java.awt.GridBagConstraints();
0701: gridBagConstraints.gridy = 9;
0702: gridBagConstraints.gridwidth = 2;
0703: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0704: gridBagConstraints.weightx = 1.0;
0705: gridBagConstraints.weighty = 1.0;
0706: gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0707: add(jPanel1, gridBagConstraints);
0708:
0709: }// </editor-fold>//GEN-END:initComponents
0710:
0711: private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
0712:
0713: }//GEN-LAST:event_formComponentShown
0714:
0715: private void jTableLinkParametersMouseClicked(
0716: java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableLinkParametersMouseClicked
0717:
0718: if (evt.getClickCount() == 2 && evt.getButton() == evt.BUTTON1
0719: && jTableLinkParameters.getSelectedRowCount() > 0) {
0720: jButtonModLinkParameterActionPerformed(null);
0721: }
0722:
0723: }//GEN-LAST:event_jTableLinkParametersMouseClicked
0724:
0725: private void jButtonRemLinkParameterActionPerformed(
0726: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRemLinkParameterActionPerformed
0727: if (this .isInit())
0728: return;
0729:
0730: javax.swing.table.DefaultTableModel dtm = (javax.swing.table.DefaultTableModel) jTableLinkParameters
0731: .getModel();
0732: int[] rows = jTableLinkParameters.getSelectedRows();
0733: for (int i = rows.length - 1; i >= 0; --i) {
0734: getSectionItemHyperlink().getHyperlinkParameters().remove(
0735: jTableLinkParameters.getValueAt(rows[i], 0));
0736: dtm.removeRow(rows[i]);
0737: }
0738: }//GEN-LAST:event_jButtonRemLinkParameterActionPerformed
0739:
0740: private void jButtonModLinkParameterActionPerformed(
0741: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonModLinkParameterActionPerformed
0742: if (this .isInit())
0743: return;
0744:
0745: if (jTableLinkParameters.getSelectedRowCount() <= 0)
0746: return;
0747:
0748: JRLinkParameter parameter = (JRLinkParameter) jTableLinkParameters
0749: .getValueAt(jTableLinkParameters.getSelectedRow(), 0);
0750:
0751: JRLinkParameterDialog jrpd = new JRLinkParameterDialog(
0752: (javax.swing.JDialog) SwingUtilities
0753: .getWindowAncestor(this ), true);
0754: jrpd.setParameter(parameter);
0755: if (evt != null && evt.getID() > 0) {
0756: jrpd.setFocusedExpression(evt.getID());
0757: }
0758:
0759: jrpd.setVisible(true);
0760:
0761: if (jrpd.getDialogResult() == javax.swing.JOptionPane.OK_OPTION) {
0762: parameter.setName(jrpd.getParameter().getName());
0763: parameter
0764: .setExpression(jrpd.getParameter().getExpression());
0765: javax.swing.table.DefaultTableModel dtm = (javax.swing.table.DefaultTableModel) jTableLinkParameters
0766: .getModel();
0767:
0768: dtm.setValueAt(parameter, jTableLinkParameters
0769: .getSelectedRow(), 0);
0770: dtm.setValueAt(parameter.getExpression(),
0771: jTableLinkParameters.getSelectedRow(), 1);
0772:
0773: jTableLinkParameters.updateUI();
0774: }
0775: }//GEN-LAST:event_jButtonModLinkParameterActionPerformed
0776:
0777: private void jButtonAddLinkParameterActionPerformed(
0778: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAddLinkParameterActionPerformed
0779: if (this .isInit())
0780: return;
0781:
0782: JRLinkParameterDialog jrpd = new JRLinkParameterDialog(
0783: (javax.swing.JDialog) SwingUtilities
0784: .getWindowAncestor(this ), true);
0785: jrpd.setVisible(true);
0786:
0787: if (jrpd.getDialogResult() == javax.swing.JOptionPane.OK_OPTION) {
0788: it.businesslogic.ireport.JRLinkParameter parameter = jrpd
0789: .getParameter();
0790:
0791: getSectionItemHyperlink().getHyperlinkParameters().add(
0792: parameter);
0793: javax.swing.table.DefaultTableModel dtm = (javax.swing.table.DefaultTableModel) jTableLinkParameters
0794: .getModel();
0795: dtm.addRow(new Object[] { parameter,
0796: parameter.getExpression() });
0797: }
0798: }//GEN-LAST:event_jButtonAddLinkParameterActionPerformed
0799:
0800: private void jComboBoxLinkTypeActionPerformed1(
0801: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxLinkTypeActionPerformed1
0802: if (this .isInit())
0803: return;
0804:
0805: jTabbedPane2.removeAll();
0806:
0807: if (((String) this .jComboBoxLinkType.getSelectedItem())
0808: .equals("None")) {
0809: // Set to blank all link fields...
0810: getSectionItemHyperlink().setHyperlinkType(
0811: "" + jComboBoxLinkType.getSelectedItem());
0812: getSectionItemHyperlink().setHyperlinkReferenceExpression(
0813: "");
0814: getSectionItemHyperlink().setHyperlinkAnchorExpression("");
0815: getSectionItemHyperlink().setHyperlinkPageExpression("");
0816: getSectionItemHyperlink().getHyperlinkParameters().clear();
0817: this .jRTextExpressionAreaAnchor.setText("");
0818: this .jRTextExpressionAreaAnchor.setEnabled(false);
0819: this .jLabelAnchor.setEnabled(false);
0820: this .jRTextExpressionAreaPage.setText("");
0821: this .jRTextExpressionAreaPage.setEnabled(false);
0822: this .jLabelPage.setEnabled(false);
0823: this .jRTextExpressionAreaReference.setText("");
0824: this .jRTextExpressionAreaReference.setEnabled(false);
0825: this .jLabelReference.setEnabled(false);
0826: //this.jPanelAnchor.setVisible(false);
0827: //this.jPanelPage.setVisible(false);
0828: //this.jPanelReference.setVisible(false);
0829: jTabbedPane2.addTab(I18n.getString(
0830: "sectionItemHyperlinkPanel.tab.LinkParameters",
0831: "Link parameters"), this .jPanelLinkParams);
0832: } else if (((String) this .jComboBoxLinkType.getSelectedItem())
0833: .equals("Reference")) {
0834: // Set to blank all link fields...
0835: getSectionItemHyperlink().setHyperlinkType(
0836: "" + jComboBoxLinkType.getSelectedItem());
0837: getSectionItemHyperlink().setHyperlinkReferenceExpression(
0838: "");
0839: getSectionItemHyperlink().setHyperlinkAnchorExpression("");
0840: getSectionItemHyperlink().setHyperlinkPageExpression("");
0841: this .jRTextExpressionAreaAnchor.setText("");
0842: this .jRTextExpressionAreaAnchor.setEnabled(false);
0843: this .jLabelAnchor.setEnabled(false);
0844: this .jRTextExpressionAreaPage.setText("");
0845: this .jRTextExpressionAreaPage.setEnabled(false);
0846: this .jLabelPage.setEnabled(false);
0847: this .jRTextExpressionAreaReference.setText("");
0848: this .jRTextExpressionAreaReference.setEnabled(true);
0849: this .jLabelReference.setEnabled(true);
0850:
0851: jTabbedPane2.addTab(I18n.getString(
0852: "sectionItemHyperlinkPanel.tab.Reference",
0853: "Reference"), this .jPanelReference);
0854: //this.jPanelAnchor.setVisible(false);
0855: //this.jPanelPage.setVisible(false);
0856: jTabbedPane2.addTab(I18n.getString(
0857: "sectionItemHyperlinkPanel.tab.LinkParameters",
0858: "Link parameters"), this .jPanelLinkParams);
0859:
0860: } else if (((String) this .jComboBoxLinkType.getSelectedItem())
0861: .equals("LocalAnchor")) {
0862: // Set to blank all link fields...
0863: getSectionItemHyperlink().setHyperlinkType(
0864: "" + jComboBoxLinkType.getSelectedItem());
0865: getSectionItemHyperlink().setHyperlinkReferenceExpression(
0866: "");
0867: getSectionItemHyperlink().setHyperlinkAnchorExpression("");
0868: getSectionItemHyperlink().setHyperlinkPageExpression("");
0869: this .jRTextExpressionAreaAnchor.setText("");
0870: this .jRTextExpressionAreaAnchor.setEnabled(true);
0871: this .jLabelAnchor.setEnabled(true);
0872: this .jRTextExpressionAreaPage.setText("");
0873: this .jRTextExpressionAreaPage.setEnabled(false);
0874: this .jLabelPage.setEnabled(false);
0875: this .jRTextExpressionAreaReference.setText("");
0876: this .jRTextExpressionAreaReference.setEnabled(false);
0877: this .jLabelReference.setEnabled(false);
0878:
0879: //jTabbedPane2.addTab(I18n.getString("sectionItemHyperlinkPanel.tab.Reference","Reference"),this.jPanelReference);
0880: jTabbedPane2.addTab(I18n.getString(
0881: "sectionItemHyperlinkPanel.tab.Anchor", "Anchor"),
0882: this .jPanelAnchor);
0883: //jTabbedPane2.addTab(I18n.getString("sectionItemHyperlinkPanel.tab.Page","Page"),this.jPanelPage);
0884: jTabbedPane2.addTab(I18n.getString(
0885: "sectionItemHyperlinkPanel.tab.LinkParameters",
0886: "Link parameters"), this .jPanelLinkParams);
0887:
0888: } else if (((String) this .jComboBoxLinkType.getSelectedItem())
0889: .equals("LocalPage")) {
0890: // Set to blank all link fields...
0891: getSectionItemHyperlink().setHyperlinkType(
0892: "" + jComboBoxLinkType.getSelectedItem());
0893: getSectionItemHyperlink().setHyperlinkReferenceExpression(
0894: "");
0895: getSectionItemHyperlink().setHyperlinkAnchorExpression("");
0896: getSectionItemHyperlink().setHyperlinkPageExpression("");
0897: this .jRTextExpressionAreaAnchor.setText("");
0898: this .jRTextExpressionAreaAnchor.setEnabled(false);
0899: this .jLabelAnchor.setEnabled(false);
0900: this .jRTextExpressionAreaPage.setText("");
0901: this .jRTextExpressionAreaPage.setEnabled(true);
0902: this .jLabelPage.setEnabled(true);
0903: this .jRTextExpressionAreaReference.setText("");
0904: this .jRTextExpressionAreaReference.setEnabled(false);
0905: this .jLabelReference.setEnabled(false);
0906:
0907: //jTabbedPane2.addTab(I18n.getString("sectionItemHyperlinkPanel.tab.Reference","Reference"),this.jPanelReference);
0908: //jTabbedPane2.addTab(I18n.getString("sectionItemHyperlinkPanel.tab.Anchor","Anchor"), this.jPanelAnchor);
0909: jTabbedPane2.addTab(I18n.getString(
0910: "sectionItemHyperlinkPanel.tab.Page", "Page"),
0911: this .jPanelPage);
0912: jTabbedPane2.addTab(I18n.getString(
0913: "sectionItemHyperlinkPanel.tab.LinkParameters",
0914: "Link parameters"), this .jPanelLinkParams);
0915: }
0916:
0917: else if (((String) this .jComboBoxLinkType.getSelectedItem())
0918: .equals("RemoteAnchor")) {
0919: // Set to blank all link fields...
0920: getSectionItemHyperlink().setHyperlinkType(
0921: "" + jComboBoxLinkType.getSelectedItem());
0922: getSectionItemHyperlink().setHyperlinkReferenceExpression(
0923: "");
0924: getSectionItemHyperlink().setHyperlinkAnchorExpression("");
0925: getSectionItemHyperlink().setHyperlinkPageExpression("");
0926: this .jRTextExpressionAreaAnchor.setText("");
0927: this .jRTextExpressionAreaAnchor.setEnabled(true);
0928: this .jLabelAnchor.setEnabled(true);
0929: this .jRTextExpressionAreaPage.setText("");
0930: this .jRTextExpressionAreaPage.setEnabled(false);
0931: this .jLabelPage.setEnabled(false);
0932: this .jRTextExpressionAreaReference.setText("");
0933: this .jRTextExpressionAreaReference.setEnabled(true);
0934: this .jLabelReference.setEnabled(true);
0935:
0936: jTabbedPane2.addTab(I18n.getString(
0937: "sectionItemHyperlinkPanel.tab.Reference",
0938: "Reference"), this .jPanelReference);
0939: jTabbedPane2.addTab(I18n.getString(
0940: "sectionItemHyperlinkPanel.tab.Anchor", "Anchor"),
0941: this .jPanelAnchor);
0942: //jTabbedPane2.addTab(I18n.getString("sectionItemHyperlinkPanel.tab.Page","Page"),this.jPanelPage);
0943: jTabbedPane2.addTab(I18n.getString(
0944: "sectionItemHyperlinkPanel.tab.LinkParameters",
0945: "Link parameters"), this .jPanelLinkParams);
0946: } else if (((String) this .jComboBoxLinkType.getSelectedItem())
0947: .equals("RemotePage")) {
0948: // Set to blank all link fields...
0949:
0950: getSectionItemHyperlink().setHyperlinkType(
0951: "" + jComboBoxLinkType.getSelectedItem());
0952: getSectionItemHyperlink().setHyperlinkReferenceExpression(
0953: "");
0954: getSectionItemHyperlink().setHyperlinkAnchorExpression("");
0955: getSectionItemHyperlink().setHyperlinkPageExpression("");
0956: this .jRTextExpressionAreaAnchor.setText("");
0957: this .jRTextExpressionAreaAnchor.setEnabled(false);
0958: this .jLabelAnchor.setEnabled(false);
0959: this .jRTextExpressionAreaPage.setText("");
0960: this .jRTextExpressionAreaPage.setEnabled(true);
0961: this .jLabelPage.setEnabled(true);
0962: this .jRTextExpressionAreaReference.setText("");
0963: this .jRTextExpressionAreaReference.setEnabled(true);
0964: this .jLabelReference.setEnabled(true);
0965:
0966: jTabbedPane2.addTab(I18n.getString(
0967: "sectionItemHyperlinkPanel.tab.Reference",
0968: "Reference"), this .jPanelReference);
0969: //jTabbedPane2.addTab(I18n.getString("sectionItemHyperlinkPanel.tab.Anchor","Anchor"), this.jPanelAnchor);
0970: jTabbedPane2.addTab(I18n.getString(
0971: "sectionItemHyperlinkPanel.tab.Page", "Page"),
0972: this .jPanelPage);
0973: jTabbedPane2.addTab(I18n.getString(
0974: "sectionItemHyperlinkPanel.tab.LinkParameters",
0975: "Link parameters"), this .jPanelLinkParams);
0976: } else {
0977: // Set to blank all link fields...
0978:
0979: getSectionItemHyperlink().setHyperlinkType(
0980: "" + jComboBoxLinkType.getSelectedItem());
0981: //element.setHyperlinkReferenceExpression("");
0982: //element.setHyperlinkAnchorExpression("");
0983: //element.setHyperlinkPageExpression("");
0984: //this.jRTextExpressionAreaAnchor.setText("");
0985: this .jRTextExpressionAreaAnchor.setEnabled(true);
0986: this .jLabelAnchor.setEnabled(true);
0987: //this.jRTextExpressionAreaPage.setText("");
0988: this .jRTextExpressionAreaPage.setEnabled(true);
0989: this .jLabelPage.setEnabled(true);
0990: //this.jRTextExpressionAreaReference.setText("");
0991: this .jRTextExpressionAreaReference.setEnabled(true);
0992: this .jLabelReference.setEnabled(true);
0993:
0994: jTabbedPane2.addTab(I18n.getString(
0995: "sectionItemHyperlinkPanel.tab.Reference",
0996: "Reference"), this .jPanelReference);
0997: jTabbedPane2.addTab(I18n.getString(
0998: "sectionItemHyperlinkPanel.tab.Anchor", "Anchor"),
0999: this .jPanelAnchor);
1000: jTabbedPane2.addTab(I18n.getString(
1001: "sectionItemHyperlinkPanel.tab.Page", "Page"),
1002: this .jPanelPage);
1003: jTabbedPane2.addTab(I18n.getString(
1004: "sectionItemHyperlinkPanel.tab.LinkParameters",
1005: "Link parameters"), this .jPanelLinkParams);
1006: }
1007:
1008: jTabbedPane2.addTab(I18n.getString(
1009: "sectionItemHyperlinkPanel.tab.Tooltip", "Tooltip"),
1010: this .jPanelTooltip);
1011: }//GEN-LAST:event_jComboBoxLinkTypeActionPerformed1
1012:
1013: private void jComboBoxLinkTargetActionPerformed1(
1014: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxLinkTargetActionPerformed1
1015: if (this .isInit())
1016: return;
1017:
1018: getSectionItemHyperlink().setHyperlinkTarget(
1019: "" + jComboBoxLinkTarget.getSelectedItem());
1020: }//GEN-LAST:event_jComboBoxLinkTargetActionPerformed1
1021:
1022: // Variables declaration - do not modify//GEN-BEGIN:variables
1023: private javax.swing.JButton jButtonAddLinkParameter;
1024: private javax.swing.JButton jButtonModLinkParameter;
1025: private javax.swing.JButton jButtonRemLinkParameter;
1026: private javax.swing.JComboBox jComboBoxLinkTarget;
1027: private javax.swing.JComboBox jComboBoxLinkType;
1028: private javax.swing.JLabel jLabel36;
1029: private javax.swing.JLabel jLabelAnchor;
1030: private javax.swing.JLabel jLabelPage;
1031: private javax.swing.JLabel jLabelReference;
1032: private javax.swing.JLabel jLabelReference1;
1033: private javax.swing.JLabel jLabelTarget;
1034: private javax.swing.JPanel jPanel1;
1035: private javax.swing.JPanel jPanel3;
1036: private javax.swing.JPanel jPanelAnchor;
1037: private javax.swing.JPanel jPanelLinkParams;
1038: private javax.swing.JPanel jPanelPage;
1039: private javax.swing.JPanel jPanelReference;
1040: private javax.swing.JPanel jPanelTooltip;
1041: private it.businesslogic.ireport.gui.JRTextExpressionArea jRTextExpressionAreaAnchor;
1042: private it.businesslogic.ireport.gui.JRTextExpressionArea jRTextExpressionAreaPage;
1043: private it.businesslogic.ireport.gui.JRTextExpressionArea jRTextExpressionAreaReference;
1044: private it.businesslogic.ireport.gui.JRTextExpressionArea jRTextExpressionAreaTooltip;
1045: private javax.swing.JScrollPane jScrollPane1;
1046: private javax.swing.JTabbedPane jTabbedPane2;
1047: private javax.swing.JTable jTableLinkParameters;
1048:
1049: // End of variables declaration//GEN-END:variables
1050:
1051: public void jRTextExpressionAreaTooltipTextChanged() {
1052: if (this .isInit())
1053: return;
1054: getSectionItemHyperlink().setHyperlinkTooltipExpression(
1055: "" + jRTextExpressionAreaTooltip.getText());
1056: }
1057:
1058: public void jRTextExpressionAreaReferenceTextChanged() {
1059: if (this .isInit())
1060: return;
1061: getSectionItemHyperlink().setHyperlinkReferenceExpression(
1062: "" + jRTextExpressionAreaReference.getText());
1063: }
1064:
1065: public void jRTextExpressionAreaAnchorTextChanged() {
1066: if (this .isInit())
1067: return;
1068: getSectionItemHyperlink().setHyperlinkAnchorExpression(
1069: "" + jRTextExpressionAreaAnchor.getText());
1070: }
1071:
1072: public void jRTextExpressionAreaPageTextChanged() {
1073: if (this .isInit())
1074: return;
1075: getSectionItemHyperlink().setHyperlinkPageExpression(
1076: "" + jRTextExpressionAreaPage.getText());
1077: }
1078:
1079: public void applyI18n() {
1080:
1081: // Start autogenerated code ----------------------
1082: jButtonAddLinkParameter.setText(I18n.getString(
1083: "sectionItemHyperlinkPanel.buttonAddLinkParameter",
1084: "Add"));
1085: jButtonModLinkParameter.setText(I18n.getString(
1086: "sectionItemHyperlinkPanel.buttonModLinkParameter",
1087: "Modify"));
1088: jButtonRemLinkParameter.setText(I18n.getString(
1089: "sectionItemHyperlinkPanel.buttonRemLinkParameter",
1090: "Remove"));
1091: jLabel36.setText(I18n.getString(
1092: "sectionItemHyperlinkPanel.label36", "Hyperlink type"));
1093: jLabelAnchor.setText(I18n.getString(
1094: "sectionItemHyperlinkPanel.labelAnchor",
1095: "Hyperlink Anchor Expression"));
1096: jLabelPage.setText(I18n.getString(
1097: "sectionItemHyperlinkPanel.labelPage",
1098: "Hyperlink Page Expression"));
1099: jLabelReference.setText(I18n.getString(
1100: "sectionItemHyperlinkPanel.labelReference",
1101: "Hyperlink Reference Expression"));
1102: jLabelReference1.setText(I18n.getString(
1103: "sectionItemHyperlinkPanel.labelReference1",
1104: "Tooltip Expression"));
1105: jLabelTarget.setText(I18n.getString(
1106: "sectionItemHyperlinkPanel.labelTarget",
1107: "Hyperlink target"));
1108: // End autogenerated code ----------------------
1109:
1110: jTableLinkParameters
1111: .getColumnModel()
1112: .getColumn(0)
1113: .setHeaderValue(
1114: I18n
1115: .getString(
1116: "sectionItemHyperlinkPanel.tablecolumn.parameterName",
1117: "Parameter name"));
1118: jTableLinkParameters
1119: .getColumnModel()
1120: .getColumn(1)
1121: .setHeaderValue(
1122: I18n
1123: .getString(
1124: "sectionItemHyperlinkPanel.tablecolumn.expression",
1125: "Expression"));
1126:
1127: }
1128:
1129: public static final int COMPONENT_NONE = 0;
1130: //public static final int COMPONENT_ANCHORNAME_EXPRESSION=1;
1131: public static final int COMPONENT_HYPERLINK_REFERENCE_EXPRESSION = 2;
1132: public static final int COMPONENT_HYPERLINK_ANCHOR_EXPRESSION = 3;
1133: public static final int COMPONENT_HYPERLINK_PAGE_EXPRESSION = 4;
1134: public static final int COMPONENT_HYPERLINK_TOOLTIP_EXPRESSION = 5;
1135: public static final int COMPONENT_HYPERLINK_PARAMETERS = 6;
1136:
1137: public int openParameterWithThisExpression = -1;
1138:
1139: /**
1140: * This method set the focus on a specific component.
1141: *
1142: * For this kind of datasource otherInfo must be in the format suitable for sectionItemHyperlinkPanel1
1143: * expressionInfo[0] must be an Integer holding the expression ID<br>
1144: * if (expressionInfo[0] == COMPONENT_HYPERLINK_PARAMETERS) then expressionInfo[1] must contain an Integer
1145: * with the index of the parameter, and expressionInfo[2] the index of the expression to highlight for
1146: * that parameter. The window will open as soon this component will become "shown".
1147: */
1148: public void setFocusedExpression(Object[] expressionInfo) {
1149: int expID = ((Integer) expressionInfo[0]).intValue();
1150:
1151: try {
1152: switch (expID) {
1153: case COMPONENT_HYPERLINK_REFERENCE_EXPRESSION:
1154: this .jTabbedPane2.setSelectedComponent(jPanelReference);
1155: Misc
1156: .selectTextAndFocusArea(jRTextExpressionAreaReference);
1157: break;
1158: case COMPONENT_HYPERLINK_ANCHOR_EXPRESSION:
1159: this .jTabbedPane2.setSelectedComponent(jPanelAnchor);
1160: Misc.selectTextAndFocusArea(jRTextExpressionAreaAnchor);
1161: break;
1162: case COMPONENT_HYPERLINK_PAGE_EXPRESSION:
1163: this .jTabbedPane2.setSelectedComponent(jPanelPage);
1164: Misc.selectTextAndFocusArea(jRTextExpressionAreaPage);
1165: break;
1166: case COMPONENT_HYPERLINK_TOOLTIP_EXPRESSION:
1167: this .jTabbedPane2.setSelectedComponent(jPanelTooltip);
1168: Misc
1169: .selectTextAndFocusArea(jRTextExpressionAreaTooltip);
1170: break;
1171: case COMPONENT_HYPERLINK_PARAMETERS:
1172: this .jTabbedPane2
1173: .setSelectedComponent(jPanelLinkParams);
1174: int paramIdex = ((Integer) expressionInfo[1])
1175: .intValue();
1176: int paramExpId = ((Integer) expressionInfo[2])
1177: .intValue();
1178: if (paramIdex >= 0
1179: && jTableLinkParameters.getRowCount() > paramIdex) {
1180: jTableLinkParameters.setRowSelectionInterval(
1181: paramIdex, paramIdex);
1182: openParameterWithThisExpression = paramExpId;
1183: }
1184: break;
1185: }
1186: } catch (Exception ex) {
1187: }
1188: }
1189:
1190: public void openExtraWindows() {
1191: if (openParameterWithThisExpression >= 0) {
1192: jButtonModLinkParameterActionPerformed(new ActionEvent(
1193: jButtonModLinkParameter,
1194: openParameterWithThisExpression, ""));
1195: }
1196: openParameterWithThisExpression = -1;
1197: }
1198: }
|