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

项目:intellij-ce-playground    文件:VSizePolicyProperty.java   
@Override public boolean appliesTo(final RadComponent component) {
  return !(component instanceof RadHSpacer);
}
项目:intellij-ce-playground    文件:BindingEditor.java   
private static String[] getFieldNames(final RadComponent component, final String currentName) {
  final ArrayList<String> result = new ArrayList<String>();
  if (currentName != null){
    result.add(currentName);
  }

  final IRootContainer root = FormEditingUtil.getRoot(component);
  final String className = root.getClassToBind();
  if (className == null) {
    return ArrayUtil.toStringArray(result);
  }

  final PsiClass aClass = FormEditingUtil.findClassToBind(component.getModule(), className);
  if (aClass == null) {
    return ArrayUtil.toStringArray(result);
  }

  final PsiField[] fields = aClass.getFields();

  for (final PsiField field : fields) {
    if (field.hasModifierProperty(PsiModifier.STATIC)) {
      continue;
    }

    final String fieldName = field.getName();

    if (Comparing.equal(currentName, fieldName)) {
      continue;
    }

    if (!FormEditingUtil.isBindingUnique(component, fieldName, root)) {
      continue;
    }

    final String componentClassName;
    if (component instanceof RadErrorComponent) {
      componentClassName = component.getComponentClassName();
    }
    else if (component instanceof RadHSpacer || component instanceof RadVSpacer) {
      componentClassName = Spacer.class.getName();
    }
    else {
      componentClassName = component.getComponentClass().getName();
    }

    final PsiType componentType;
    try {
      componentType =
        JavaPsiFacade.getInstance(component.getProject()).getElementFactory().createTypeFromText(componentClassName, null);
    }
    catch (IncorrectOperationException e) {
      continue;
    }

    final PsiType fieldType = field.getType();
    if (!fieldType.isAssignableFrom(componentType)) {
      continue;
    }

    result.add(fieldName);
  }

  String text = FormInspectionUtil.getText(component.getModule(), component);
  if (text != null) {
    String binding = BindingProperty.suggestBindingFromText(component, text);
    if (binding != null && !result.contains(binding)) {
      result.add(binding);        
    }
  }

  final String[] names = ArrayUtil.toStringArray(result);
  Arrays.sort(names);
  return names;
}
项目:intellij-ce-playground    文件:GridChangeUtilTest.java   
private static void addComponent(final int idx, final int cell, final int span, final RadContainer grid) {
  final RadHSpacer component = new RadHSpacer(null, Integer.toString(idx));
  component.getConstraints().restore(new GridConstraints(idx, cell, 1, span, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, 0,0,null,null,null,
                                                         0));
  grid.addComponent(component);
}
项目:tools-idea    文件:VSizePolicyProperty.java   
@Override public boolean appliesTo(final RadComponent component) {
  return !(component instanceof RadHSpacer);
}
项目:tools-idea    文件:BindingEditor.java   
private static String[] getFieldNames(final RadComponent component, final String currentName) {
  final ArrayList<String> result = new ArrayList<String>();
  if (currentName != null){
    result.add(currentName);
  }

  final IRootContainer root = FormEditingUtil.getRoot(component);
  final String className = root.getClassToBind();
  if (className == null) {
    return ArrayUtil.toStringArray(result);
  }

  final PsiClass aClass = FormEditingUtil.findClassToBind(component.getModule(), className);
  if (aClass == null) {
    return ArrayUtil.toStringArray(result);
  }

  final PsiField[] fields = aClass.getFields();

  for (final PsiField field : fields) {
    if (field.hasModifierProperty(PsiModifier.STATIC)) {
      continue;
    }

    final String fieldName = field.getName();

    if (Comparing.equal(currentName, fieldName)) {
      continue;
    }

    if (!FormEditingUtil.isBindingUnique(component, fieldName, root)) {
      continue;
    }

    final String componentClassName;
    if (component instanceof RadErrorComponent) {
      componentClassName = component.getComponentClassName();
    }
    else if (component instanceof RadHSpacer || component instanceof RadVSpacer) {
      componentClassName = Spacer.class.getName();
    }
    else {
      componentClassName = component.getComponentClass().getName();
    }

    final PsiType componentType;
    try {
      componentType =
        JavaPsiFacade.getInstance(component.getProject()).getElementFactory().createTypeFromText(componentClassName, null);
    }
    catch (IncorrectOperationException e) {
      continue;
    }

    final PsiType fieldType = field.getType();
    if (!fieldType.isAssignableFrom(componentType)) {
      continue;
    }

    result.add(fieldName);
  }

  String text = FormInspectionUtil.getText(component.getModule(), component);
  if (text != null) {
    String binding = BindingProperty.suggestBindingFromText(component, text);
    if (binding != null && !result.contains(binding)) {
      result.add(binding);        
    }
  }

  final String[] names = ArrayUtil.toStringArray(result);
  Arrays.sort(names);
  return names;
}
项目:tools-idea    文件:GridChangeUtilTest.java   
private static void addComponent(final int idx, final int cell, final int span, final RadContainer grid) {
  final RadHSpacer component = new RadHSpacer(null, Integer.toString(idx));
  component.getConstraints().restore(new GridConstraints(idx, cell, 1, span, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, 0,0,null,null,null,
                                                         0));
  grid.addComponent(component);
}
项目:consulo-ui-designer    文件:VSizePolicyProperty.java   
@Override public boolean appliesTo(final RadComponent component) {
  return !(component instanceof RadHSpacer);
}
项目:consulo-ui-designer    文件:GridChangeUtilTest.java   
private static void addComponent(final int idx, final int cell, final int span, final RadContainer grid) {
  final RadHSpacer component = new RadHSpacer(null, Integer.toString(idx));
  component.getConstraints().restore(new GridConstraints(idx, cell, 1, span, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, 0,0,null,null,null,
                                                         0));
  grid.addComponent(component);
}