gt:             data[1] = "OWNERSHIP";
context: /*
   *                         Vortex OpenSplice
   *
   *   This software and documentation are Copyright 2006 to TO_YEAR ADLINK
   *   Technology Limited, its affiliated companies and licensors. All rights
   *   reserved.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   *
   */
  package org.opensplice.common.model.table.qos;
  
  import javax.swing.event.TableModelEvent;
  import javax.swing.event.TableModelListener;
  import javax.swing.table.TableModel;
  
  import org.opensplice.cm.CMException;
  import org.opensplice.cm.Writer;
  import org.opensplice.cm.qos.DeadlinePolicy;
  import org.opensplice.cm.qos.DurabilityPolicy;
  import org.opensplice.cm.qos.HistoryPolicy;
  import org.opensplice.cm.qos.LatencyPolicy;
  import org.opensplice.cm.qos.LifespanPolicy;
  import org.opensplice.cm.qos.LivelinessPolicy;
  import org.opensplice.cm.qos.OrderbyPolicy;
  import org.opensplice.cm.qos.OwnershipPolicy;
  import org.opensplice.cm.qos.ReliabilityPolicy;
  import org.opensplice.cm.qos.ResourcePolicy;
  import org.opensplice.cm.qos.StrengthPolicy;
  import org.opensplice.cm.qos.TopicQoS;
  import org.opensplice.cm.qos.TransportPolicy;
  import org.opensplice.cm.qos.UserDataPolicy;
  import org.opensplice.cm.qos.WriterLifecyclePolicy;
  import org.opensplice.cm.qos.WriterQoS;
  import org.opensplice.common.CommonException;
  
  /**
   * Concrete implementation of the EntityQoSTableModel that is capable of
   * resolving and administrating the QoS of a Writer (WriterQoS).
   * 
   * @date Jan 10, 2005 
   */
  public class WriterQoSTableModel extends EntityQoSTableModel {
  
      private static final long serialVersionUID   = -4016075833458925954L;
      private TopicQoS topicQos = null;
      private boolean noUpdate = false;
      private WriterQoS selectedDefaultQos = null;
      
      /**
       * Constructs a new table model that holds the QoS of the supplied
       * Writer.
       *
       * @param _entity The Writer, which QoS must be administrated.
       * @throws CommonException Thrown when the Entity is not available (anymore)
       */
      public WriterQoSTableModel(Writer _entity) throws CommonException {
          super(_entity);
  
      }
      
      public WriterQoSTableModel(TopicQoS topicQos) {
          super(topicQos);
          this.topicQos = topicQos;
          this.update();
      }
      
      public WriterQoSTableModel(WriterQoS writerQos) {
          super(writerQos);
          noUpdate = true;
          this.update();
      }
  
      public WriterQoSTableModel(WriterQoS writerQos, boolean editable) {
          super(writerQos, editable);
          selectedDefaultQos = writerQos;
          noUpdate = true;
          this.addTableModelListener(new TableModelListener() {
  
              @Override
              public void tableChanged(TableModelEvent e) {
                  if (e.getColumn() == 0) {
                      TableModel source = (TableModel) e.getSource();
                      if (source instanceof WriterQoSTableModel) {
                          if (((Boolean) ((WriterQoSTableModel) source).getValueAt(e.getFirstRow(), e.getColumn())) == true) {
                              ((WriterQoSTableModel) source).updateDefaultValues(selectedDefaultQos);
                          } else {
                              ((WriterQoSTableModel) source).updateDefaultValues((WriterQoS) currentQos);
                          }
                      }
                  }
              }
          });
          this.update();
      }
  
      @Override
      protected void init() {
          if (this.getColumnCount() > 3) {
              Object[] data = new Object[4];
              int row;
  
              row = 0;
              data[0] = true;
              data[1] = "DURABILITY";
              data[2] = "kind";
              this.addRow(data);
              nonEditRows.add(new Integer(row));
  
              row++;
              data[1] = "DEADLINE";
              data[2] = "period";
              this.addRow(data);
  
              row++;
              data[1] = "LATENCY_BUDGET";
              data[2] = "duration";
              this.addRow(data);
  
              row++;
              data[1] = "LIVELINESS";
              data[2] = "kind";
              this.addRow(data);
              nonEditRows.add(new Integer(row));
  
              row++;
              data[2] = "lease_duration";
              this.addRow(data);
              nonEditRows.add(new Integer(row));
  
              row++;
              data[1] = "RELIABILITY";
              data[2] = "kind";
              this.addRow(data);
              nonEditRows.add(new Integer(row));
  
              row++;
              data[2] = "max_blocking_time";
              this.addRow(data);
              nonEditRows.add(new Integer(row));
  
              row++;
              data[2] = "synchronous";
              this.addRow(data);
              nonEditRows.add(new Integer(row));
  
              row++;
              data[1] = "DESTINATION_ORDER";
              data[2] = "kind";
              this.addRow(data);
              nonEditRows.add(new Integer(row));
  
              row++;
              data[1] = "HISTORY";
              data[2] = "kind";
              this.addRow(data);
              nonEditRows.add(new Integer(row));
  
              row++;
              data[2] = "depth";
              this.addRow(data);
              nonEditRows.add(new Integer(row));
  
              row++;
              data[1] = "RESOURCE_LIMITS";
              data[2] = "max_samples";
              this.addRow(data);
              nonEditRows.add(new Integer(row));
  
              row++;
              data[2] = "max_instances";
              this.addRow(data);
              nonEditRows.add(new Integer(row));
  
              row++;
              data[2] = "max_samples_per_instance";
              this.addRow(data);
              nonEditRows.add(new Integer(row));
  
              row++;
              data[1] = "TRANSPORT_PRIORITY";
              data[2] = "value";
              this.addRow(data);
  
              row++;
              data[1] = "LIFESPAN";
              data[2] = "duration";
              this.addRow(data);
  
              row++;
              data[1] = "USER_DATA";
              data[2] = "value";
              this.addRow(data);
  
              row++;
  