Java 类com.intellij.uiDesigner.compiler.UnexpectedFormElementException 实例源码

项目:intellij-ce-playground    文件:BorderType.java   
public static BorderType valueOf(final String name){
  BorderType[] allTypes = getAllTypes();
  for(int i=0; i<allTypes.length; i++) {
    if (allTypes [i].getId().equals(name)) return allTypes [i];
  }
  throw new UnexpectedFormElementException("unknown type: "+name);
}
项目:intellij-ce-playground    文件:LwRootContainer.java   
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");
}
项目:intellij-ce-playground    文件:LwContainer.java   
/**
 * 'xy' or 'grid'
 */
protected final void readLayout(final Element element){
  myLayoutManager = element.getAttributeValue("layout-manager");
  if("xy".equals(element.getName())){
    myLayoutSerializer = XYLayoutSerializer.INSTANCE;
  }
  else if("grid".equals(element.getName())){
    createLayoutSerializer();
  }
  else{
    throw new UnexpectedFormElementException("unexpected element: "+element);
  }
  myLayoutSerializer.readLayout(element, this);
}
项目:intellij-ce-playground    文件:LwSplitPane.java   
protected void readConstraintsForChild(final Element element, final LwComponent component) {
  final Element constraintsElement = LwXmlReader.getRequiredChild(element, "constraints");
  final Element splitterChild = LwXmlReader.getRequiredChild(constraintsElement, "splitpane");
  final String position = LwXmlReader.getRequiredString(splitterChild, "position");
  if ("left".equals(position)) {
    component.setCustomLayoutConstraints(POSITION_LEFT);
  }
  else if ("right".equals(position)) {
    component.setCustomLayoutConstraints(POSITION_RIGHT);
  }
  else {
    throw new UnexpectedFormElementException("unexpected position: " + position);
  }
}
项目:tools-idea    文件:BorderType.java   
public static BorderType valueOf(final String name){
  BorderType[] allTypes = getAllTypes();
  for(int i=0; i<allTypes.length; i++) {
    if (allTypes [i].getId().equals(name)) return allTypes [i];
  }
  throw new UnexpectedFormElementException("unknown type: "+name);
}
项目:tools-idea    文件:LwRootContainer.java   
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");
}
项目:tools-idea    文件:LwContainer.java   
/**
 * 'xy' or 'grid'
 */
protected final void readLayout(final Element element){
  myLayoutManager = element.getAttributeValue("layout-manager");
  if("xy".equals(element.getName())){
    myLayoutSerializer = XYLayoutSerializer.INSTANCE;
  }
  else if("grid".equals(element.getName())){
    createLayoutSerializer();
  }
  else{
    throw new UnexpectedFormElementException("unexpected element: "+element);
  }
  myLayoutSerializer.readLayout(element, this);
}
项目:tools-idea    文件:LwSplitPane.java   
protected void readConstraintsForChild(final Element element, final LwComponent component) {
  final Element constraintsElement = LwXmlReader.getRequiredChild(element, "constraints");
  final Element splitterChild = LwXmlReader.getRequiredChild(constraintsElement, "splitpane");
  final String position = LwXmlReader.getRequiredString(splitterChild, "position");
  if ("left".equals(position)) {
    component.setCustomLayoutConstraints(POSITION_LEFT);
  }
  else if ("right".equals(position)) {
    component.setCustomLayoutConstraints(POSITION_RIGHT);
  }
  else {
    throw new UnexpectedFormElementException("unexpected position: " + position);
  }
}