Package org.pentaho.reporting.designer.core.model.selection

Examples of org.pentaho.reporting.designer.core.model.selection.ReportSelectionModel


  /**
   * Invoked when an action occurs.
   */
  public void actionPerformed(final ActionEvent e)
  {
    final ReportSelectionModel selectionModel = getSelectionModel();
    if (selectionModel == null)
    {
      return;
    }
    final Element[] visualElements = selectionModel.getSelectedVisualElements();
    if (visualElements.length == 0)
    {
      return;
    }
    final ReportRenderContext activeContext = getActiveContext();
View Full Code Here


      setEnabled(false);
      return;
    }

    Object selectedElement = null;
    final ReportSelectionModel selectionModel1 = getSelectionModel();
    if (selectionModel1 == null)
    {
      setEnabled(false);
      return;
    }

    if (selectionModel1.getSelectionCount() > 0)
    {
      selectedElement = selectionModel1.getSelectedElement(0);
    }
    if (selectedElement instanceof Band)
    {
      if ("sub-report".equals(metaData.getName())) // NON-NLS
      {
View Full Code Here

  }

  public void actionPerformed(final ActionEvent e)
  {
    Object selectedElement = null;
    final ReportSelectionModel selectionModel1 = getSelectionModel();
    if (selectionModel1 == null)
    {
      return;
    }

    if (selectionModel1.getSelectionCount() > 0)
    {
      selectedElement = selectionModel1.getSelectedElement(0);
    }
    final Band band;
    if (selectedElement instanceof Band)
    {
      band = (Band) selectedElement;
View Full Code Here

  protected void updateSelection()
  {
    super.updateSelection();

    final ReportSelectionModel selectionModel = getSelectionModel();
    if (selectionModel == null)
    {
      return;
    }
    final Element[] visualElements = selectionModel.getSelectedVisualElements();
    if (visualElements.length < 1 || visualElements.length > 1)
    {
      setSelected(false);
      return;
    }
View Full Code Here

  /**
   * Invoked when an action occurs.
   */
  public void actionPerformed(final ActionEvent e)
  {
    final ReportSelectionModel selectionModel = getSelectionModel();
    if (selectionModel == null)
    {
      return;
    }
    final Element[] visualElements = selectionModel.getSelectedVisualElements();
    if (visualElements.length == 0)
    {
      return;
    }
    final ReportRenderContext activeContext = getActiveContext();
View Full Code Here

  protected void updateSelection()
  {
    super.updateSelection();

    final ReportSelectionModel selectionModel = getSelectionModel();
    if (selectionModel == null)
    {
      return;
    }
    final Element[] visualElements = selectionModel.getSelectedVisualElements();

    boolean selected;
    if (visualElements.length == 0)
    {
      selected = false;
View Full Code Here

  /**
   * Invoked when an action occurs.
   */
  public void actionPerformed(final ActionEvent e)
  {
    final ReportSelectionModel selectionModel = getSelectionModel();
    if (selectionModel == null)
    {
      return;
    }
    final Element[] visualElements = selectionModel.getSelectedVisualElements();
    if (visualElements.length == 0)
    {
      return;
    }
    final ReportRenderContext activeContext = getActiveContext();
View Full Code Here

      final RootBandRenderer rendererRoot = getRendererRoot();
      final ReportRenderContext renderContext = getRenderContext();

      if (clearSelectionOnDrag)
      {
        final ReportSelectionModel selectionModel = renderContext.getSelectionModel();
        selectionModel.clearSelection();
        clearSelectionOnDrag = false;
      }

      selectionRectangleTarget = e.getPoint();

      final DesignerPageDrawable pageDrawable = rendererRoot.getLogicalPageDrawable();
      final double y1 = Math.min(normalizedSelectionRectangleOrigin.getY(), normalizedSelectionRectangleTarget.getY());
      final double x1 = Math.min(normalizedSelectionRectangleOrigin.getX(), normalizedSelectionRectangleTarget.getX());
      final double y2 = Math.max(normalizedSelectionRectangleOrigin.getY(), normalizedSelectionRectangleTarget.getY());
      final double x2 = Math.max(normalizedSelectionRectangleOrigin.getX(), normalizedSelectionRectangleTarget.getX());

      final RenderNode[] allNodes = pageDrawable.getNodesAt(x1, y1, x2 - x1, y2 - y1, null, null);
      final ReportSelectionModel selectionModel = renderContext.getSelectionModel();
      final HashMap<InstanceID, Element> id = rendererRoot.getElementsById();
      final StrictBounds rect1 = StrictGeomUtility.createBounds(x1, y1, x2 - x1, y2 - y1);
      final StrictBounds rect2 = new StrictBounds();

      for (int i = allNodes.length - 1; i >= 0; i -= 1)
      {
        final RenderNode node = allNodes[i];
        final InstanceID instanceId = node.getInstanceId();

        final Element element = id.get(instanceId);
        if (element == null || element instanceof RootLevelBand)
        {
          continue;
        }
        final CachedLayoutData data = ModelUtility.getCachedLayoutData(element);
        rect2.setRect(data.getX(), data.getY(), data.getWidth(), data.getHeight());
        if (StrictBounds.intersects(rect1, rect2))
        {
          if (selectionModel.add(element))
          {
            newlySelectedElements.add(element);
          }
        }
      }

      // second step, check which previously added elements are no longer selected by the rectangle.
      for (Iterator<Element> visualReportElementIterator = newlySelectedElements.iterator(); visualReportElementIterator.hasNext();)
      {
        final Element element = visualReportElementIterator.next();
        final CachedLayoutData data = ModelUtility.getCachedLayoutData(element);
        rect2.setRect(data.getX(), data.getY(), data.getWidth(), data.getHeight());
        if (StrictBounds.intersects(rect1, rect2) == false)
        {
          selectionModel.remove(element);
          visualReportElementIterator.remove();
        }

      }
      RootBandRenderComponent.this.repaint();
View Full Code Here

      }

      final ReportRenderContext renderContext = getRenderContext();
      final RootBandRenderer rendererRoot = getRendererRoot();

      final ReportSelectionModel selectionModel = renderContext.getSelectionModel();
      final HashMap<InstanceID, Element> id = rendererRoot.getElementsById();
      final DesignerPageDrawable pageDrawable = rendererRoot.getLogicalPageDrawable();
      final RenderNode[] allNodes = pageDrawable.getNodesAt(normalizedSelectionRectangleOrigin.getX(), normalizedSelectionRectangleOrigin.getY(), null, null);
      for (int i = allNodes.length - 1; i >= 0; i -= 1)
      {
        final RenderNode node = allNodes[i];
        final InstanceID instanceId = node.getInstanceId();

        final Element element = id.get(instanceId);
        if (element == null || element instanceof RootLevelBand)
        {
          continue;
        }

        if (!e.isShiftDown())
        {
          if (!selectionModel.isSelected(element))
          {
            selectionModel.clearSelection();
            selectionModel.add(element);
            return;
          }
        }
      }
    }
View Full Code Here

      if (point.getX() < 0 || point.getY() < 0)
      {
        return; // we do not handle that one ..
      }

      final ReportSelectionModel selectionModel = getRenderContext().getSelectionModel();
      final RootBandRenderer rendererRoot = getRendererRoot();
      final HashMap<InstanceID, Element> id = rendererRoot.getElementsById();
      final DesignerPageDrawable pageDrawable = rendererRoot.getLogicalPageDrawable();
      final RenderNode[] allNodes = pageDrawable.getNodesAt(point.getX(), point.getY(), null, null);
      for (int i = allNodes.length - 1; i >= 0; i -= 1)
      {
        final RenderNode node = allNodes[i];
        final InstanceID instanceId = node.getInstanceId();

        final Element element = id.get(instanceId);
        if (element == null || element instanceof RootLevelBand)
        {
          continue;
        }

        if (e.isShiftDown())
        {
          // toggle selection ..
          if (selectionModel.isSelected(element))
          {
            selectionModel.remove(element);
          }
          else
          {
            selectionModel.add(element);
          }
        }
        else
        {
          if (!selectionModel.isSelected(element))
          {
            selectionModel.clearSelection();
            selectionModel.add(element);
          }
        }

        return;
      }

      // No element found, clear the selection.
      if (e.isShiftDown() == false)
      {
        selectionModel.clearSelection();
      }
    }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.designer.core.model.selection.ReportSelectionModel

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.