Java 类com.intellij.uiDesigner.designSurface.Painter 实例源码

项目:intellij-ce-playground    文件:FormEditingUtil.java   
/**
 * @param x in editor pane coordinates
 * @param y in editor pane coordinates
 */
public static RadComponent getRadComponentAt(final RadRootContainer rootContainer, final int x, final int y) {
  Point location = new Point(x, y);
  SwingUtilities.convertPointToScreen(location, rootContainer.getDelegee());
  Component c = getDeepestEmptyComponentAt(rootContainer.getDelegee(), location);

  if (c == null) {
    c = SwingUtilities.getDeepestComponentAt(rootContainer.getDelegee(), x, y);
  }

  RadComponent result = null;

  while (c != null) {
    if (c instanceof JComponent) {
      final RadComponent component = (RadComponent)((JComponent)c).getClientProperty(RadComponent.CLIENT_PROP_RAD_COMPONENT);
      if (component != null) {

        if (result == null) {
          result = component;
        }
        else {
          final Point p = SwingUtilities.convertPoint(rootContainer.getDelegee(), x, y, c);
          if (Painter.getResizeMask(component, p.x, p.y) != 0) {
            result = component;
          }
        }
      }
    }
    c = c.getParent();
  }

  return result;
}
项目:tools-idea    文件:FormEditingUtil.java   
/**
 * @param x in editor pane coordinates
 * @param y in editor pane coordinates
 */
public static RadComponent getRadComponentAt(final RadRootContainer rootContainer, final int x, final int y) {
  Point location = new Point(x, y);
  SwingUtilities.convertPointToScreen(location, rootContainer.getDelegee());
  Component c = getDeepestEmptyComponentAt(rootContainer.getDelegee(), location);

  if (c == null) {
    c = SwingUtilities.getDeepestComponentAt(rootContainer.getDelegee(), x, y);
  }

  RadComponent result = null;

  while (c != null) {
    if (c instanceof JComponent) {
      final RadComponent component = (RadComponent)((JComponent)c).getClientProperty(RadComponent.CLIENT_PROP_RAD_COMPONENT);
      if (component != null) {

        if (result == null) {
          result = component;
        }
        else {
          final Point p = SwingUtilities.convertPoint(rootContainer.getDelegee(), x, y, c);
          if (Painter.getResizeMask(component, p.x, p.y) != 0) {
            result = component;
          }
        }
      }
    }
    c = c.getParent();
  }

  return result;
}
项目:consulo-ui-designer    文件:FormEditingUtil.java   
/**
 * @param x in editor pane coordinates
 * @param y in editor pane coordinates
 */
public static RadComponent getRadComponentAt(final RadRootContainer rootContainer, final int x, final int y)
{
    Point location = new Point(x, y);
    SwingUtilities.convertPointToScreen(location, rootContainer.getDelegee());
    Component c = getDeepestEmptyComponentAt(rootContainer.getDelegee(), location);

    if(c == null)
    {
        c = SwingUtilities.getDeepestComponentAt(rootContainer.getDelegee(), x, y);
    }

    RadComponent result = null;

    while(c != null)
    {
        if(c instanceof JComponent)
        {
            final RadComponent component = (RadComponent) ((JComponent) c).getClientProperty(RadComponent.CLIENT_PROP_RAD_COMPONENT);
            if(component != null)
            {

                if(result == null)
                {
                    result = component;
                }
                else
                {
                    final Point p = SwingUtilities.convertPoint(rootContainer.getDelegee(), x, y, c);
                    if(Painter.getResizeMask(component, p.x, p.y) != 0)
                    {
                        result = component;
                    }
                }
            }
        }
        c = c.getParent();
    }

    return result;
}