Package org.pentaho.reporting.tools.configeditor.model

Examples of org.pentaho.reporting.tools.configeditor.model.ConfigDescriptionEntry


    }
  }

  public String getDescriptionForKey(final String key)
  {
    final ConfigDescriptionEntry entry = treeModel.getEntryForKey(key);
    if (entry != null)
    {
      return entry.getDescription();
    }
    return null;
  }
View Full Code Here


  {
  }

  public int compare(final Object o1, final Object o2)
  {
    final ConfigDescriptionEntry e1 = (ConfigDescriptionEntry) o1;
    final ConfigDescriptionEntry e2 = (ConfigDescriptionEntry) o2;
    if (e1 == null)
    {
      return 1;
    }
    if (e2 == null)
    {
      return -1;
    }
    if (e1 == e2)
    {
      return 0;
    }
    return e1.getKeyName().compareTo(e2.getKeyName());
  }
View Full Code Here

  /**
   * Updates the currently selected entry from the values found in the detail editor.
   */
  protected void writeSelectedEntry()
  {
    final ConfigDescriptionEntry entry;
    switch (getEntryType())
    {
      case ConfigDescriptionEditor.TYPE_CLASS:
      {
        final ClassConfigDescriptionEntry ce = new ClassConfigDescriptionEntry(keyNameField.getText());
        ce.setDescription(descriptionField.getText());
        ce.setGlobal(globalField.isSelected());
        ce.setHidden(hiddenField.isSelected());
        try
        {
          final String className = baseClassField.getText();
          if (className == null)
          {
            ce.setBaseClass(Object.class);
          }
          else
          {
            final ClassLoader classLoader = ObjectUtilities.getClassLoader(getClass());
            final Class c = Class.forName(className, false, classLoader);
            ce.setBaseClass(c);
          }
        }
        catch (Exception e)
        {
          // invalid
          ConfigDescriptionEditor.logger.debug("Class is invalid; defaulting to Object.class"); //$NON-NLS-1$
          ce.setBaseClass(Object.class);
        }
        entry = ce;
        break;
      }
      case ConfigDescriptionEditor.TYPE_ENUM:
      {
        final EnumConfigDescriptionEntry ece = new EnumConfigDescriptionEntry(keyNameField.getText());
        ece.setDescription(descriptionField.getText());
        ece.setGlobal(globalField.isSelected());
        ece.setHidden(hiddenField.isSelected());
        final String[] enumEntries = new String[enumEntryListModel.getSize()];
        for (int i = 0; i < enumEntryListModel.getSize(); i++)
        {
          enumEntries[i] = String.valueOf(enumEntryListModel.get(i));
        }
        ece.setOptions(enumEntries);
        entry = ece;
        break;
      }
      default:
      {
        final TextConfigDescriptionEntry te = new TextConfigDescriptionEntry(keyNameField.getText());
        te.setDescription(descriptionField.getText());
        te.setGlobal(globalField.isSelected());
        te.setHidden(hiddenField.isSelected());
        entry = te;
        break;
      }
    }

    final ConfigDescriptionEntry selectedEntry = getSelectedEntry();
    if (selectedEntry == null)
    {
      model.add(entry);
      return;
    }

    if (ObjectUtilities.equal(selectedEntry.getKeyName(), entry.getKeyName()) == false)
    {
      model.remove(selectedEntry);
    }

    model.add(entry);
View Full Code Here

     *
     * @param e not used.
     */
    public void actionPerformed(final ActionEvent e)
    {
      final ConfigDescriptionEntry ce = getSelectedEntry();
      setSelectedEntry(null);
      setSelectedEntry(ce);
    }
View Full Code Here

      }

      inUpdate = true;
      try
      {
        final ConfigDescriptionEntry newEntry;
        final int selectedIndex = getEntryList().getSelectedIndex();
        if (selectedIndex == -1)
        {
          newEntry = null;
        }
        else
        {
          newEntry = getModel().get(selectedIndex);
        }

        final ConfigDescriptionEntry oldEntry = getSelectedEntry();
        if (oldEntry != null)
        {
          writeSelectedEntry();
        }
View Full Code Here

    }
  }

  public String getDescriptionForKey(final String key)
  {
    final ConfigDescriptionEntry entry = treeModel.getEntryForKey(key);
    if (entry != null)
    {
      return entry.getDescription();
    }
    return null;
  }
View Full Code Here

  /**
   * Updates the currently selected entry from the values found in the detail editor.
   */
  protected void writeSelectedEntry()
  {
    final ConfigDescriptionEntry entry;
    switch (getEntryType())
    {
      case ConfigDescriptionEditor.TYPE_CLASS:
      {
        final ClassConfigDescriptionEntry ce = new ClassConfigDescriptionEntry(keyNameField.getText());
        ce.setDescription(descriptionField.getText());
        ce.setGlobal(globalField.isSelected());
        ce.setHidden(hiddenField.isSelected());
        try
        {
          final String className = baseClassField.getText();
          if (className == null)
          {
            ce.setBaseClass(Object.class);
          }
          else
          {
            final ClassLoader classLoader = ObjectUtilities.getClassLoader(getClass());
            final Class c = Class.forName(className, false, classLoader);
            ce.setBaseClass(c);
          }
        }
        catch (Exception e)
        {
          // invalid
          ConfigDescriptionEditor.logger.debug("Class is invalid; defaulting to Object.class"); //$NON-NLS-1$
          ce.setBaseClass(Object.class);
        }
        entry = ce;
        break;
      }
      case ConfigDescriptionEditor.TYPE_ENUM:
      {
        final EnumConfigDescriptionEntry ece = new EnumConfigDescriptionEntry(keyNameField.getText());
        ece.setDescription(descriptionField.getText());
        ece.setGlobal(globalField.isSelected());
        ece.setHidden(hiddenField.isSelected());
        final String[] enumEntries = new String[enumEntryListModel.getSize()];
        for (int i = 0; i < enumEntryListModel.getSize(); i++)
        {
          enumEntries[i] = String.valueOf(enumEntryListModel.get(i));
        }
        ece.setOptions(enumEntries);
        entry = ece;
        break;
      }
      default:
      {
        final TextConfigDescriptionEntry te = new TextConfigDescriptionEntry(keyNameField.getText());
        te.setDescription(descriptionField.getText());
        te.setGlobal(globalField.isSelected());
        te.setHidden(hiddenField.isSelected());
        entry = te;
        break;
      }
    }

    final ConfigDescriptionEntry selectedEntry = getSelectedEntry();
    if (selectedEntry == null)
    {
      model.add(entry);
      return;
    }

    if (ObjectUtilities.equal(selectedEntry.getKeyName(), entry.getKeyName()) == false)
    {
      model.remove(selectedEntry);
    }

    model.add(entry);
View Full Code Here

     *
     * @param e not used.
     */
    public void actionPerformed(final ActionEvent e)
    {
      final ConfigDescriptionEntry ce = getSelectedEntry();
      setSelectedEntry(null);
      setSelectedEntry(ce);
    }
View Full Code Here

      }

      inUpdate = true;
      try
      {
        final ConfigDescriptionEntry newEntry;
        final int selectedIndex = getEntryList().getSelectedIndex();
        if (selectedIndex == -1)
        {
          newEntry = null;
        }
        else
        {
          newEntry = getModel().get(selectedIndex);
        }

        final ConfigDescriptionEntry oldEntry = getSelectedEntry();
        if (oldEntry != null)
        {
          writeSelectedEntry();
        }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.tools.configeditor.model.ConfigDescriptionEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.