Java 类com.intellij.uiDesigner.radComponents.RadAtomicComponent 实例源码

项目:intellij-ce-playground    文件:ComponentItem.java   
@NotNull
public Dimension getInitialSize(final JComponent parent, final ClassLoader loader) {
  if (myInitialSize != null) {
    return myInitialSize;
  }
  myInitialSize = new Dimension(myDefaultConstraints.myPreferredSize);
  if (myInitialSize.width <= 0 || myInitialSize.height <= 0) {
    try {
      Class aClass = Class.forName(getClassName(), true, loader);
      RadAtomicComponent component = new RadAtomicComponent(aClass, "", Palette.getInstance(myProject));
      component.initDefaultProperties(this);
      final JComponent delegee = component.getDelegee();
      if (parent != null) {
        final Font font = parent.getFont();
        delegee.setFont(font);
      }
      Dimension prefSize = delegee.getPreferredSize();
      Dimension minSize = delegee.getMinimumSize();
      if (myInitialSize.width <= 0) {
        myInitialSize.width = prefSize.width;
      }
      if (myInitialSize.height <= 0) {
        myInitialSize.height = prefSize.height;
      }
      myInitialSize.width = Math.max(myInitialSize.width, minSize.width);
      myInitialSize.height = Math.max(myInitialSize.height, minSize.height);
    }
    catch (Exception e) {
      LOG.debug(e);
    }
  }
  return myInitialSize;
}
项目:intellij-ce-playground    文件:MorphAction.java   
@Override
protected void update(@NotNull GuiEditor editor, final ArrayList<RadComponent> selection, final AnActionEvent e) {
  if (selection.size() == 0) {
    e.getPresentation().setEnabled(false);
    return;
  }
  for(RadComponent c: selection) {
    if (!(c instanceof RadAtomicComponent)) {
      e.getPresentation().setEnabled(false);
      return;
    }
  }
}
项目:intellij-ce-playground    文件:AbstractMoveSelectionAction.java   
private void moveToFirstComponent(final JComponent rootContainerDelegee) {
  final int[] minX = new int[]{Integer.MAX_VALUE};
  final int[] minY = new int[]{Integer.MAX_VALUE};
  final Ref<RadComponent> componentToBeSelected = new Ref<RadComponent>();
  FormEditingUtil.iterate(
    myEditor.getRootContainer(),
    new FormEditingUtil.ComponentVisitor<RadComponent>() {
      public boolean visit(final RadComponent component) {
        if (component instanceof RadAtomicComponent) {
          final JComponent _delegee = component.getDelegee();
          final Point p = SwingUtilities.convertPoint(
            _delegee,
            new Point(0, 0),
            rootContainerDelegee
          );
          if(minX[0] > p.x || minY[0] > p.y){
            minX[0] = p.x;
            minY[0] = p.y;
            componentToBeSelected.set(component);
          }
        }
        return true;
      }
    }
  );
  if(!componentToBeSelected.isNull()){
    FormEditingUtil.selectComponent(myEditor, componentToBeSelected.get());
  }
}
项目:tools-idea    文件:ComponentItem.java   
@NotNull
public Dimension getInitialSize(final JComponent parent, final ClassLoader loader) {
  if (myInitialSize != null) {
    return myInitialSize;
  }
  myInitialSize = new Dimension(myDefaultConstraints.myPreferredSize);
  if (myInitialSize.width <= 0 || myInitialSize.height <= 0) {
    try {
      Class aClass = Class.forName(getClassName(), true, loader);
      RadAtomicComponent component = new RadAtomicComponent(aClass, "", Palette.getInstance(myProject));
      component.initDefaultProperties(this);
      final JComponent delegee = component.getDelegee();
      if (parent != null) {
        final Font font = parent.getFont();
        delegee.setFont(font);
      }
      Dimension prefSize = delegee.getPreferredSize();
      Dimension minSize = delegee.getMinimumSize();
      if (myInitialSize.width <= 0) {
        myInitialSize.width = prefSize.width;
      }
      if (myInitialSize.height <= 0) {
        myInitialSize.height = prefSize.height;
      }
      myInitialSize.width = Math.max(myInitialSize.width, minSize.width);
      myInitialSize.height = Math.max(myInitialSize.height, minSize.height);
    }
    catch (Exception e) {
      LOG.debug(e);
    }
  }
  return myInitialSize;
}
项目:tools-idea    文件:MorphAction.java   
@Override
protected void update(@NotNull GuiEditor editor, final ArrayList<RadComponent> selection, final AnActionEvent e) {
  if (selection.size() == 0) {
    e.getPresentation().setEnabled(false);
    return;
  }
  for(RadComponent c: selection) {
    if (!(c instanceof RadAtomicComponent)) {
      e.getPresentation().setEnabled(false);
      return;
    }
  }
}
项目:tools-idea    文件:AbstractMoveSelectionAction.java   
private void moveToFirstComponent(final JComponent rootContainerDelegee) {
  final int[] minX = new int[]{Integer.MAX_VALUE};
  final int[] minY = new int[]{Integer.MAX_VALUE};
  final Ref<RadComponent> componentToBeSelected = new Ref<RadComponent>();
  FormEditingUtil.iterate(
    myEditor.getRootContainer(),
    new FormEditingUtil.ComponentVisitor<RadComponent>() {
      public boolean visit(final RadComponent component) {
        if (component instanceof RadAtomicComponent) {
          final JComponent _delegee = component.getDelegee();
          final Point p = SwingUtilities.convertPoint(
            _delegee,
            new Point(0, 0),
            rootContainerDelegee
          );
          if(minX[0] > p.x || minY[0] > p.y){
            minX[0] = p.x;
            minY[0] = p.y;
            componentToBeSelected.set(component);
          }
        }
        return true;
      }
    }
  );
  if(!componentToBeSelected.isNull()){
    FormEditingUtil.selectComponent(myEditor, componentToBeSelected.get());
  }
}
项目:consulo-ui-designer    文件:ComponentItem.java   
@NotNull
public Dimension getInitialSize(final JComponent parent, final ClassLoader loader) {
  if (myInitialSize != null) {
    return myInitialSize;
  }
  myInitialSize = new Dimension(myDefaultConstraints.myPreferredSize);
  if (myInitialSize.width <= 0 || myInitialSize.height <= 0) {
    try {
      Class aClass = Class.forName(getClassName(), true, loader);
      RadAtomicComponent component = new RadAtomicComponent(aClass, "", Palette.getInstance(myProject));
      component.initDefaultProperties(this);
      final JComponent delegee = component.getDelegee();
      if (parent != null) {
        final Font font = parent.getFont();
        delegee.setFont(font);
      }
      Dimension prefSize = delegee.getPreferredSize();
      Dimension minSize = delegee.getMinimumSize();
      if (myInitialSize.width <= 0) {
        myInitialSize.width = prefSize.width;
      }
      if (myInitialSize.height <= 0) {
        myInitialSize.height = prefSize.height;
      }
      myInitialSize.width = Math.max(myInitialSize.width, minSize.width);
      myInitialSize.height = Math.max(myInitialSize.height, minSize.height);
    }
    catch (Exception e) {
      LOG.debug(e);
    }
  }
  return myInitialSize;
}
项目:consulo-ui-designer    文件:MorphAction.java   
@Override
protected void update(@NotNull GuiEditor editor, final ArrayList<RadComponent> selection, final AnActionEvent e) {
  if (selection.size() == 0) {
    e.getPresentation().setEnabled(false);
    return;
  }
  for(RadComponent c: selection) {
    if (!(c instanceof RadAtomicComponent)) {
      e.getPresentation().setEnabled(false);
      return;
    }
  }
}
项目:consulo-ui-designer    文件:AbstractMoveSelectionAction.java   
private void moveToFirstComponent(final JComponent rootContainerDelegee) {
  final int[] minX = new int[]{Integer.MAX_VALUE};
  final int[] minY = new int[]{Integer.MAX_VALUE};
  final Ref<RadComponent> componentToBeSelected = new Ref<RadComponent>();
  FormEditingUtil.iterate(
    myEditor.getRootContainer(),
    new FormEditingUtil.ComponentVisitor<RadComponent>() {
      public boolean visit(final RadComponent component) {
        if (component instanceof RadAtomicComponent) {
          final JComponent _delegee = component.getDelegee();
          final Point p = SwingUtilities.convertPoint(
            _delegee,
            new Point(0, 0),
            rootContainerDelegee
          );
          if(minX[0] > p.x || minY[0] > p.y){
            minX[0] = p.x;
            minY[0] = p.y;
            componentToBeSelected.set(component);
          }
        }
        return true;
      }
    }
  );
  if(!componentToBeSelected.isNull()){
    FormEditingUtil.selectComponent(myEditor, componentToBeSelected.get());
  }
}