当前位置: 首页>>代码示例>>Java>>正文


Java Utils类代码示例

本文整理汇总了Java中com.intellij.uiDesigner.compiler.Utils的典型用法代码示例。如果您正苦于以下问题:Java Utils类的具体用法?Java Utils怎么用?Java Utils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Utils类属于com.intellij.uiDesigner.compiler包,在下文中一共展示了Utils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readChildConstraints

import com.intellij.uiDesigner.compiler.Utils; //导入依赖的package包/类
void readChildConstraints(final Element constraintsElement, final LwComponent component) {
  super.readChildConstraints(constraintsElement, component);
  CellConstraints cc = new CellConstraints();
  final Element formsElement = LwXmlReader.getChild(constraintsElement, UIFormXmlConstants.ELEMENT_FORMS);
  if (formsElement != null) {
    if (formsElement.getAttributeValue(UIFormXmlConstants.ATTRIBUTE_TOP) != null) {
      cc.insets = LwXmlReader.readInsets(formsElement);
    }
    if (!LwXmlReader.getOptionalBoolean(formsElement, UIFormXmlConstants.ATTRIBUTE_DEFAULTALIGN_HORZ, true)) {
      cc.hAlign = ourHorizontalAlignments [Utils.alignFromConstraints(component.getConstraints(), true)];
    }
    if (!LwXmlReader.getOptionalBoolean(formsElement, UIFormXmlConstants.ATTRIBUTE_DEFAULTALIGN_VERT, true)) {
      cc.vAlign = ourVerticalAlignments [Utils.alignFromConstraints(component.getConstraints(), false)];
    }
  }
  component.setCustomLayoutConstraints(cc);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:FormLayoutSerializer.java

示例2: RadNestedForm

import com.intellij.uiDesigner.compiler.Utils; //导入依赖的package包/类
public RadNestedForm(final ModuleProvider module, final String formFileName, final String id) throws Exception {
  super(module, JPanel.class, id);
  myFormFileName = formFileName;
  LOG.debug("Loading nested form " + formFileName);
  VirtualFile formFile = ResourceFileUtil.findResourceFileInDependents(getModule(), formFileName);
  if (formFile == null) {
    throw new IllegalArgumentException("Couldn't find virtual file for nested form " + formFileName);
  }
  Document doc = FileDocumentManager.getInstance().getDocument(formFile);
  final ClassLoader classLoader = LoaderFactory.getInstance(getProject()).getLoader(formFile);
  final LwRootContainer rootContainer = Utils.getRootContainer(doc.getText(), new CompiledClassPropertiesProvider(classLoader));
  myRootContainer = XmlReader.createRoot(module, rootContainer, classLoader, null);
  if (myRootContainer.getComponentCount() > 0) {
    getDelegee().setLayout(new BorderLayout());
    JComponent nestedFormDelegee = myRootContainer.getComponent(0).getDelegee();
    getDelegee().add(nestedFormDelegee, BorderLayout.CENTER);

    setRadComponentRecursive(nestedFormDelegee);
  }

  if (isCustomCreateRequired()) {
    setCustomCreate(true);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:RadNestedForm.java

示例3: getAlignment

import com.intellij.uiDesigner.compiler.Utils; //导入依赖的package包/类
public int getAlignment(RadComponent component, boolean horizontal) {
  CellConstraints cc = (CellConstraints) component.getCustomLayoutConstraints();
  CellConstraints.Alignment al = horizontal ? cc.hAlign : cc.vAlign;
  if (al == CellConstraints.DEFAULT) {
    FormLayout formLayout = (FormLayout) component.getParent().getLayout();
    FormSpec formSpec = horizontal
                        ? formLayout.getColumnSpec(component.getConstraints().getColumn()+1)
                        : formLayout.getRowSpec(component.getConstraints().getRow()+1);
    final FormSpec.DefaultAlignment defaultAlignment = formSpec.getDefaultAlignment();
    if (defaultAlignment.equals(RowSpec.FILL)) {
      return GridConstraints.ALIGN_FILL;
    }
    if (defaultAlignment.equals(RowSpec.TOP) || defaultAlignment.equals(ColumnSpec.LEFT)) {
      return GridConstraints.ALIGN_LEFT;
    }
    if (defaultAlignment.equals(RowSpec.CENTER)) {
      return GridConstraints.ALIGN_CENTER;
    }
    return GridConstraints.ALIGN_RIGHT;
  }
  return Utils.alignFromConstraints(component.getConstraints(), horizontal);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:RadFormLayoutManager.java

示例4: write

import com.intellij.uiDesigner.compiler.Utils; //导入依赖的package包/类
public void write(final XmlWriter writer) {
  writer.startElement("form", Utils.FORM_NAMESPACE);
  try{
    writer.addAttribute("version", 1);
    final String classToBind = getClassToBind();
    if (classToBind != null){
      writer.addAttribute("bind-to-class", classToBind);
    }
    final String mainComponentBinding = getMainComponentBinding();
    if (mainComponentBinding != null) {
      writer.addAttribute("stored-main-component-binding", mainComponentBinding);
    }
    writeChildrenImpl(writer);
    if (myButtonGroups.size() > 0) {
      writer.startElement(UIFormXmlConstants.ELEMENT_BUTTON_GROUPS);
      for(RadButtonGroup group: myButtonGroups) {
        group.write(writer);
      }
      writer.endElement();
    }
    writeInspectionSuppressions(writer);
  }
  finally{
    writer.endElement(); // form
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:RadRootContainer.java

示例5: validateNestedFormInsert

import com.intellij.uiDesigner.compiler.Utils; //导入依赖的package包/类
private boolean validateNestedFormInsert(final ComponentItem item)
{
	PsiFile boundForm = item.getBoundForm();
	if(boundForm != null)
	{
		try
		{
			final String formName = FormEditingUtil.buildResourceName(boundForm);
			final String targetForm = FormEditingUtil.buildResourceName(myEditor.getPsiFile());
			Utils.validateNestedFormLoop(formName, new PsiNestedFormLoader(myEditor.getModule()), targetForm);
		}
		catch(Exception ex)
		{
			Messages.showErrorDialog(myEditor, ex.getMessage(), CommonBundle.getErrorTitle());
			return false;
		}
	}
	return true;
}
 
开发者ID:consulo,项目名称:consulo-ui-designer,代码行数:20,代码来源:InsertComponentProcessor.java

示例6: getBoundClassName

import com.intellij.uiDesigner.compiler.Utils; //导入依赖的package包/类
public String getBoundClassName(final VirtualFile formFile) throws Exception
{
	File file = VfsUtil.virtualToIoFile(formFile);
	String classToBind = getSavedBinding(file);
	if(classToBind == null)
	{
		final Document doc = FileDocumentManager.getInstance().getDocument(formFile);
		final LwRootContainer rootContainer = Utils.getRootContainer(doc.getText(), null);
		classToBind = rootContainer.getClassToBind();
	}
	if(classToBind != null)
	{
		updateCache(file, classToBind);
	}
	return classToBind;
}
 
开发者ID:consulo,项目名称:consulo-ui-designer,代码行数:17,代码来源:BindingsCache.java

示例7: read

import com.intellij.uiDesigner.compiler.Utils; //导入依赖的package包/类
public void read(final Element element, final PropertiesProvider provider) throws Exception {
  if (element == null) {
    throw new IllegalArgumentException("element cannot be null");
  }
  if (!Utils.FORM_NAMESPACE.equals(element.getNamespace().getURI())) {
    throw new AlienFormFileException();
  }
  if(!"form".equals(element.getName())){
    throw new UnexpectedFormElementException("unexpected element: "+element);
  }

  setId("root");

  myClassToBind = element.getAttributeValue(UIFormXmlConstants.ATTRIBUTE_BIND_TO_CLASS);

  // Constraints and properties
  for(Iterator i=element.getChildren().iterator(); i.hasNext();){
    final Element child = (Element)i.next();
    if (child.getName().equals(UIFormXmlConstants.ELEMENT_BUTTON_GROUPS)) {
      readButtonGroups(child);
    }
    else if (child.getName().equals(UIFormXmlConstants.ELEMENT_INSPECTION_SUPPRESSIONS)) {
      readInspectionSuppressions(child);
    }
    else {
      final LwComponent component = createComponentFromTag(child);
      addComponent(component);
      component.read(child, provider);
    }
  }

  myMainComponentBinding = element.getAttributeValue("stored-main-component-binding");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:LwRootContainer.java

示例8: createErrorComponent

import com.intellij.uiDesigner.compiler.Utils; //导入依赖的package包/类
private static RadErrorComponent createErrorComponent(final ModuleProvider module, final String id, final LwComponent lwComponent, final ClassLoader loader) {
  final String componentClassName = lwComponent.getComponentClassName();
  final String errorDescription = Utils.validateJComponentClass(loader, componentClassName, true);
  return RadErrorComponent.create(
    module,
    id,
    lwComponent.getComponentClassName(),
    lwComponent.getErrorComponentProperties(),
    errorDescription != null? errorDescription : UIDesignerBundle.message("error.cannot.load.class", componentClassName)
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:XmlReader.java

示例9: saveNestedForm

import com.intellij.uiDesigner.compiler.Utils; //导入依赖的package包/类
private boolean saveNestedForm() {
  VirtualFile formFile = ResourceFileUtil.findResourceFileInProject(myProject, myTfNestedForm.getText());
  if (formFile == null) {
    Messages.showErrorDialog(getWindow(), UIDesignerBundle.message("add.component.cannot.load.form", myTfNestedForm.getText()), CommonBundle.getErrorTitle());
    return false;
  }
  LwRootContainer lwRootContainer;
  try {
    lwRootContainer = Utils.getRootContainer(formFile.getInputStream(), null);
  }
  catch (Exception e) {
    Messages.showErrorDialog(getWindow(), e.getMessage(), CommonBundle.getErrorTitle());
    return false;
  }
  if (lwRootContainer.getClassToBind() == null) {
    Messages.showErrorDialog(getWindow(), UIDesignerBundle.message("add.component.form.not.bound"), CommonBundle.getErrorTitle());
    return false;
  }
  if (lwRootContainer.getComponent(0).getBinding() == null) {
    Messages.showErrorDialog(getWindow(), UIDesignerBundle.message("add.component.root.not.bound"),
                             CommonBundle.getErrorTitle());
    return false;
  }
  PsiClass psiClass =
    JavaPsiFacade.getInstance(myProject).findClass(lwRootContainer.getClassToBind(), GlobalSearchScope.projectScope(myProject));
  if (psiClass != null) {
    myItemToBeEdited.setClassName(getClassOrInnerName(psiClass));
  }
  else {
    myItemToBeEdited.setClassName(lwRootContainer.getClassToBind());
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:ComponentItemDialog.java

示例10: getItems

import com.intellij.uiDesigner.compiler.Utils; //导入依赖的package包/类
@NotNull
@Override
public List<? extends GotoRelatedItem> getItems(@NotNull PsiElement context) {
  PsiClass psiClass = PsiTreeUtil.getParentOfType(context, PsiClass.class, false);
  if (psiClass != null) {
    while (psiClass != null) {
      List<PsiFile> forms = FormClassIndex.findFormsBoundToClass(psiClass.getProject(), psiClass);
      if (!forms.isEmpty()) {
        return GotoRelatedItem.createItems(forms, "UI Forms");
      }
      psiClass = PsiTreeUtil.getParentOfType(psiClass, PsiClass.class);
    }
  }
  else {
    PsiFile file = context.getContainingFile();
    if (file != null && file.getFileType() == GuiFormFileType.INSTANCE) {
      try {
        String className = Utils.getBoundClassName(file.getText());
        if (className != null) {
          Project project = file.getProject();
          PsiClass aClass = JavaPsiFacade.getInstance(project).findClass(className, GlobalSearchScope.allScope(project));
          if (aClass != null) {
            return Collections.singletonList(new GotoRelatedItem(aClass, "Java"));
          }
        }
      }
      catch (Exception ignore) {

      }
    }
  }
  return Collections.emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:FormRelatedFilesProvider.java

示例11: map

import com.intellij.uiDesigner.compiler.Utils; //导入依赖的package包/类
@Override
@NotNull
public Map<String, Void> map(@NotNull final FileContent inputData) {
  String className = null;
  try {
    className = Utils.getBoundClassName(inputData.getContentAsText().toString());
  }
  catch (Exception e) {
    // ignore
  }
  if (className != null) {
    return Collections.singletonMap(className, null);
  }
  return Collections.emptyMap();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:FormClassIndex.java

示例12: setValueImpl

import com.intellij.uiDesigner.compiler.Utils; //导入依赖的package包/类
protected void setValueImpl(final RadComponent component, final Boolean value) throws Exception {
  if (value.booleanValue() && component.getBinding() == null) {
    String initialBinding = BindingProperty.getDefaultBinding(component);
    String binding = Messages.showInputDialog(
      component.getProject(),
      UIDesignerBundle.message("custom.create.field.name.prompt"),
      UIDesignerBundle.message("custom.create.title"), Messages.getQuestionIcon(),
      initialBinding, new IdentifierValidator(component.getProject()));
    if (binding == null) {
      return;
    }
    try {
      new BindingProperty(component.getProject()).setValue(component, binding);
    }
    catch (Exception e1) {
      LOG.error(e1);
    }
  }
  component.setCustomCreate(value.booleanValue());
  if (value.booleanValue()) {
    final IRootContainer root = FormEditingUtil.getRoot(component);
    if (root.getClassToBind() != null && Utils.getCustomCreateComponentCount(root) == 1) {
      final PsiClass aClass = FormEditingUtil.findClassToBind(component.getModule(), root.getClassToBind());
      if (aClass != null && FormEditingUtil.findCreateComponentsMethod(aClass) == null) {
        generateCreateComponentsMethod(aClass);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:CustomCreateProperty.java

示例13: getValue

import com.intellij.uiDesigner.compiler.Utils; //导入依赖的package包/类
public Integer getValue(final RadComponent component) {
  AlignPropertyProvider provider = getAlignPropertyProvider(component);
  if (provider != null) {
    return provider.getAlignment(component, myHorizontal);
  }
  return Utils.alignFromConstraints(component.getConstraints(), myHorizontal);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:AlignProperty.java

示例14: isModified

import com.intellij.uiDesigner.compiler.Utils; //导入依赖的package包/类
@Override
public boolean isModified(final RadComponent component) {
  AlignPropertyProvider provider = getAlignPropertyProvider(component);
  if (provider != null) {
    return provider.isAlignmentModified(component, myHorizontal);
  }
  final ComponentItem item = component.getPalette().getItem(component.getComponentClassName());
  if (item == null) return false;
  return Utils.alignFromConstraints(component.getConstraints(), myHorizontal) !=
         Utils.alignFromConstraints(item.getDefaultConstraints(), myHorizontal);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:AlignProperty.java

示例15: resetValue

import com.intellij.uiDesigner.compiler.Utils; //导入依赖的package包/类
@Override
public void resetValue(final RadComponent component) throws Exception {
  AlignPropertyProvider provider = getAlignPropertyProvider(component);
  if (provider != null) {
    provider.resetAlignment(component, myHorizontal);
  }
  else {
    final ComponentItem item = component.getPalette().getItem(component.getComponentClassName());
    if (item != null) {
      setValueEx(component, Utils.alignFromConstraints(item.getDefaultConstraints(), myHorizontal));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:AlignProperty.java


注:本文中的com.intellij.uiDesigner.compiler.Utils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。