Package org.pentaho.reporting.engine.classic.core.modules.gui.commonswing

Examples of org.pentaho.reporting.engine.classic.core.modules.gui.commonswing.KeyedComboBoxModel


  }

  private KeyedComboBoxModel createLocalesModel()
  {
    final KeyedComboBoxModel cn = new KeyedComboBoxModel();
    final Locale[] locales = Locale.getAvailableLocales();
    for (int i = 0; i < locales.length; i++)
    {
      final Locale locale = locales[i];
      cn.add(locale, locale.getDisplayName());
    }
    cn.setSelectedKey(Locale.getDefault());
    return cn;
  }
View Full Code Here


  public void initialize() throws ReportDataFactoryException
  {
    adjustingToExternalInput = true;
    try
    {
      final KeyedComboBoxModel keyedComboBoxModel =
          DefaultParameterComponentFactory.createModel(listParameter, parameterContext);
      final Object value = updateContext.getParameterValue(listParameter.getName());
      setSelectedValue(value, keyedComboBoxModel);

      setModel(keyedComboBoxModel);
View Full Code Here

      final Object theSource = e.getSource();
      if (theSource instanceof JComboBox)
      {
        final JComboBox theComboBox = (JComboBox) theSource;
        final KeyedComboBoxModel theModel = (KeyedComboBoxModel) theComboBox.getModel();
        updateContext.setParameterValue(key, theModel.getSelectedKey());
      }
    }
View Full Code Here

    zoomActions = new HashMap();

    this.menus = PreviewPane.EMPTY_MENU;
    setLayout(new BorderLayout());

    zoomModel = new KeyedComboBoxModel();
    zoomModel.setAllowOtherValue(true);
    zoom = PreviewPane.ZOOM_FACTORS[PreviewPane.DEFAULT_ZOOM_INDEX];

    final Configuration configuration = ClassicEngineBoot.getInstance().getGlobalConfig();
    minZoom = getMinimumZoom(configuration);
View Full Code Here

        return;
      }

      final double zoom = getZoom();
      pageDrawable.setZoom(zoom);
      final KeyedComboBoxModel zoomModel = PreviewPane.this.getZoomModel();
      zoomModel.setSelectedKey(new Double(zoom));
      if (zoomModel.getSelectedKey() == null)
      {
        zoomModel.setSelectedItem(formatZoomText(zoom));
      }
      drawablePanel.revalidate();
    }
View Full Code Here

  public void initialize() throws ReportDataFactoryException
  {
    adjustingToExternalInput = true;
    try
    {
      final KeyedComboBoxModel keyedComboBoxModel =
          DefaultParameterComponentFactory.createModel(listParameter, parameterContext);
      list.setModel(keyedComboBoxModel);

      final ListSelectionModel selectionModel = list.getSelectionModel();
      final Object value = updateContext.getParameterValue(listParameter.getName());
      final HashSet keylist = getNormalizedSet(value);
      selectionModel.setValueIsAdjusting(true);
      list.clearSelection();

      final int size = keyedComboBoxModel.getSize();
      for (int i = 0; i < size; i++)
      {
        final Object key = keyedComboBoxModel.getKeyAt(i);
        if (isSafeMatch(key, keylist))
        {
          selectionModel.addSelectionInterval(i, i);
        }
      }
View Full Code Here

      }
      try
      {
        adjustingToUserInput = true;

        final KeyedComboBoxModel theModel = (KeyedComboBoxModel) list.getModel();
        final int index = list.getSelectedIndex();
        if (index == -1)
        {
          updateContext.setParameterValue(key, null);
        }
        else
        {
          updateContext.setParameterValue(key, theModel.getKeyAt(index));
        }
      }
      finally
      {
        adjustingToUserInput = false;
View Full Code Here

      try
      {
        adjustingToUserInput = true;

        final KeyedComboBoxModel listModel = (KeyedComboBoxModel) list.getModel();
        final ListSelectionModel selectionModel = list.getSelectionModel();
        selectionModel.setValueIsAdjusting(true);

        // Determine if this selection has added or removed items
        final HashSet<Integer> newSelections = new HashSet<Integer>();
        final int size = listModel.getSize();
        for (int i = 0; i < size; i++)
        {
          if (selectionModel.isSelectedIndex(i))
          {
            newSelections.add(IntegerCache.getInteger(i));
          }
        }

        // Turn on everything that was selected previously
        Iterator it = selectionCache.iterator();
        while (it.hasNext())
        {
          final Integer integer = (Integer) it.next();
          final int index = integer.intValue();
          selectionModel.addSelectionInterval(index, index);
        }

        // Add or remove the delta

        if (newSelections.containsAll(selectionCache) == false)
        {
          it = newSelections.iterator();
          while (it.hasNext())
          {
            final Integer nextInt = (Integer) it.next();
            final int index = nextInt.intValue();
            if (selectionCache.contains(nextInt))
            {
              selectionModel.removeSelectionInterval(index, index);
            }
            else
            {
              selectionModel.addSelectionInterval(index, index);
            }
          }

          // Save selections for next time
          selectionCache.clear();
          for (int i = 0; i < size; i++)
          {
            if (selectionModel.isSelectedIndex(i))
            {
              selectionCache.add(IntegerCache.getInteger(i));
            }
          }
        }

        selectionModel.setValueIsAdjusting(false);

        final int[] indices = list.getSelectedIndices();
        final Object[] keys = new Object[indices.length];
        for (int i = 0; i < keys.length; i++)
        {
          final int index = indices[i];
          keys[i] = listModel.getKeyAt(index);
        }
        updateContext.setParameterValue(key, keys);
      }
      finally
      {
View Full Code Here

      final Object key = paramValues.getKeyValue(i);
      keys[i] = key;
      values[i] = paramValues.getTextValue(i);
    }

    final KeyedComboBoxModel model = new KeyedComboBoxModel();
    model.setData(keys, values);
    return model;
  }
View Full Code Here

    clear();
  }

  private KeyedComboBoxModel loadEpson24Printers()
  {
    final KeyedComboBoxModel epsonPrinters = new KeyedComboBoxModel();
    final PrinterSpecificationManager spec24Manager =
        Epson24PinPrinterDriver.loadSpecificationManager();
    final String[] printer24Names =
        spec24Manager.getPrinterNames();
    Arrays.sort(printer24Names);
    for (int i = 0; i < printer24Names.length; i++)
    {
      final PrinterSpecification pspec = spec24Manager.getPrinter(
          printer24Names[i]);
      epsonPrinters.add(pspec, pspec.getDisplayName());
    }
    return epsonPrinters;
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.modules.gui.commonswing.KeyedComboBoxModel

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.