Ejemplo n.º 1
0
  public void styleChanged(it.businesslogic.ireport.gui.event.StyleChangedEvent evt) {

    if (evt.getAction() == evt.ADDED) {
      this.addStyle(evt.getNewValue());
    } else {
      for (int i = 0; i < jTableParameters.getRowCount(); ++i) {
        if (jTableParameters.getModel().getValueAt(i, 0) == evt.getOldValue()) {
          if (evt.getAction() == evt.CHANGED) {
            jTableParameters.getModel().setValueAt(evt.getNewValue(), i, 0);
            jTableParameters
                .getModel()
                .setValueAt(
                    (evt.getNewValue().getAttributeBoolean(Style.ATTRIBUTE_isDefault, false)
                        ? "Yes"
                        : ""),
                    i,
                    1);
          } else {
            ((javax.swing.table.DefaultTableModel) jTableParameters.getModel()).removeRow(i);
          }
          jTableParameters.updateUI();
          break;
        }
      }
    }

    for (int i = 0; i < jTableParameters.getRowCount(); ++i) {
      Style s = (Style) jTableParameters.getModel().getValueAt(i, 0);
      jTableParameters.setValueAt(
          (s.getAttributeBoolean(Style.ATTRIBUTE_isDefault, false) ? "Yes" : ""), i, 1);
    }
  }
Ejemplo n.º 2
0
  private void jButtonDefaultActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButtonDefaultActionPerformed

    if (jTableParameters.getSelectedRow() < 0) return;
    Style irc = null;
    try {
      irc = (Style) jTableParameters.getModel().getValueAt(jTableParameters.getSelectedRow(), 0);
    } catch (Exception ex) {
      return;
    }

    if (irc == null) return;

    irc.getAttributes().put(irc.ATTRIBUTE_isDefault, "true");
    jTableParameters.setValueAt("Yes", jTableParameters.getSelectedRow(), 1);

    for (int i = 0; i < jTableParameters.getRowCount(); ++i) {
      if (i != jTableParameters.getSelectedRow()) {
        Style s = (Style) jTableParameters.getModel().getValueAt(i, 0);
        if (s != null) s.getAttributes().remove(s.ATTRIBUTE_isDefault);
        jTableParameters.setValueAt("", i, 1);
      }
    }

    MainFrame.getMainInstance()
        .getActiveReportFrame()
        .getReport()
        .fireStyleChangedListenerStyleChanged(
            new StyleChangedEvent(
                MainFrame.getMainInstance().getActiveReportFrame().getReport(),
                StyleChangedEvent.CHANGED,
                irc,
                irc));
  } // GEN-LAST:event_jButtonDefaultActionPerformed
Ejemplo n.º 3
0
 public void addStyle(Style s) {
   DefaultTableModel dtm = (DefaultTableModel) jTableParameters.getModel();
   dtm.addRow(
       new Object[] {s, (s.getAttributeBoolean(Style.ATTRIBUTE_isDefault, false) ? "Yes" : "")});
 }