Java 类com.intellij.uiDesigner.XmlWriter 实例源码

项目:intellij-ce-playground    文件:SnapShooterDaemon.java   
@NonNls
private String doSnapshotCommand(final String command) {
  int id = Integer.parseInt(command.substring(1));
  Component component = myIdMap.get(id);
  XmlWriter xmlWriter = new XmlWriter();
  RadRootContainer rootContainer = null;
  try {
    rootContainer = createFormSnapshot((JComponent) component);
  }
  catch (Exception ex) {
    ex.printStackTrace();
    return "E:" + ex.getMessage() + "\n";
  }
  rootContainer.write(xmlWriter);
  return xmlWriter.getText();
}
项目:intellij-ce-playground    文件:RadFormLayoutManager.java   
@Override
public void writeLayout(final XmlWriter writer, final RadContainer radContainer) {
  FormLayout layout = (FormLayout) radContainer.getLayout();
  for(int i=1; i<=layout.getRowCount(); i++) {
    RowSpec rowSpec = layout.getRowSpec(i);
    writer.startElement(UIFormXmlConstants.ELEMENT_ROWSPEC);
    try {
      writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_VALUE, FormLayoutUtils.getEncodedSpec(rowSpec));
    }
    finally {
      writer.endElement();
    }
  }
  for(int i=1; i<=layout.getColumnCount(); i++) {
    ColumnSpec columnSpec = layout.getColumnSpec(i);
    writer.startElement(UIFormXmlConstants.ELEMENT_COLSPEC);
    try {
      writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_VALUE, FormLayoutUtils.getEncodedSpec(columnSpec));
    }
    finally {
      writer.endElement();
    }
  }
  writeGroups(writer, UIFormXmlConstants.ELEMENT_ROWGROUP, layout.getRowGroups());
  writeGroups(writer, UIFormXmlConstants.ELEMENT_COLGROUP, layout.getColumnGroups());
}
项目:intellij-ce-playground    文件:RadFormLayoutManager.java   
@Override
public void writeChildConstraints(final XmlWriter writer, final RadComponent child) {
  writeGridConstraints(writer, child);
  if (child.getCustomLayoutConstraints() instanceof CellConstraints) {
    CellConstraints cc = (CellConstraints) child.getCustomLayoutConstraints();
    writer.startElement(UIFormXmlConstants.ELEMENT_FORMS);
    try {
      if (!cc.insets.equals(new Insets(0, 0, 0, 0))) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_TOP, cc.insets.top);
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_LEFT, cc.insets.left);
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_BOTTOM, cc.insets.bottom);
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_RIGHT, cc.insets.right);
      }
      if (cc.hAlign != CellConstraints.DEFAULT) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_DEFAULTALIGN_HORZ, false);
      }
      if (cc.vAlign != CellConstraints.DEFAULT) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_DEFAULTALIGN_VERT, false);
      }
    }
    finally {
      writer.endElement();
    }
  }
}
项目:intellij-ce-playground    文件:RadGridBagLayoutManager.java   
public void writeChildConstraints(final XmlWriter writer, final RadComponent child) {
  writeGridConstraints(writer, child);
  if (child.getCustomLayoutConstraints() instanceof GridBagConstraints) {
    GridBagConstraints gbc = (GridBagConstraints)child.getCustomLayoutConstraints();
    writer.startElement(UIFormXmlConstants.ELEMENT_GRIDBAG);
    try {
      if (!gbc.insets.equals(new Insets(0, 0, 0, 0))) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_TOP, gbc.insets.top);
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_LEFT, gbc.insets.left);
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_BOTTOM, gbc.insets.bottom);
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_RIGHT, gbc.insets.right);
      }
      writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_WEIGHTX, gbc.weightx);
      writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_WEIGHTY, gbc.weighty);
      if (gbc.ipadx != 0) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_IPADX, gbc.ipadx);
      }
      if (gbc.ipady != 0) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_IPADY, gbc.ipady);
      }
    }
    finally {
      writer.endElement();
    }
  }
}
项目:intellij-ce-playground    文件:RadErrorComponent.java   
public void write(final XmlWriter writer) {
  writer.startElement("component");
  try {
    writeId(writer);

    // write class
    writer.addAttribute("class", myComponentClassName);

    writeBinding(writer);
    writeConstraints(writer);

    // write properties (if any)
    if (myProperties != null) {
      writer.writeElement(myProperties);
    }
  }
  finally {
    writer.endElement(); // component
  }
}
项目:intellij-ce-playground    文件:RadSplitPane.java   
public void write(final XmlWriter writer) {
  writer.startElement(UIFormXmlConstants.ELEMENT_SPLITPANE);
  try {
    writeId(writer);
    writeClassIfDifferent(writer, JSplitPane.class.getName());
    writeBinding(writer);

    // Constraints and properties
    writeConstraints(writer);
    writeProperties(writer);

    // Margin and border
    writeBorder(writer);
    writeChildren(writer);
  }
  finally {
    writer.endElement(); // scrollpane
  }
}
项目:intellij-ce-playground    文件:RadRootContainer.java   
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
  }
}
项目:intellij-ce-playground    文件:RadXYLayoutManager.java   
public void writeLayout(final XmlWriter writer, final RadContainer radContainer) {
  final AbstractLayout layout = (AbstractLayout)radContainer.getLayout();
  // It has sense to save hpap and vgap even for XY layout. The reason is
  // that XY was previously GRID with non default gaps, so when the user
  // compose XY into the grid again then he will get the same non default gaps.
  writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_HGAP, layout.getHGap());
  writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_VGAP, layout.getVGap());

  // Margins
  final Insets margin = layout.getMargin();
  writer.startElement("margin");
  try {
    writer.writeInsets(margin);
  }
  finally {
    writer.endElement(); // margin
  }
}
项目:intellij-ce-playground    文件:RadAbstractGridLayoutManager.java   
protected static void writeGridConstraints(final XmlWriter writer, final RadComponent child) {
  // Constraints in Grid layout
  writer.startElement("grid");
  try {
    final GridConstraints constraints = child.getConstraints();
    writer.addAttribute("row",constraints.getRow());
    writer.addAttribute("column",constraints.getColumn());
    writer.addAttribute("row-span",constraints.getRowSpan());
    writer.addAttribute("col-span",constraints.getColSpan());
    writer.addAttribute("vsize-policy",constraints.getVSizePolicy());
    writer.addAttribute("hsize-policy",constraints.getHSizePolicy());
    writer.addAttribute("anchor",constraints.getAnchor());
    writer.addAttribute("fill",constraints.getFill());
    writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_INDENT, constraints.getIndent());
    writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_USE_PARENT_LAYOUT, constraints.isUseParentLayout());

    // preferred size
    writer.writeDimension(constraints.myMinimumSize,"minimum-size");
    writer.writeDimension(constraints.myPreferredSize,"preferred-size");
    writer.writeDimension(constraints.myMaximumSize,"maximum-size");
  } finally {
    writer.endElement(); // grid
  }
}
项目:tools-idea    文件:SnapShooterDaemon.java   
@NonNls
private String doSnapshotCommand(final String command) {
  int id = Integer.parseInt(command.substring(1));
  Component component = myIdMap.get(id);
  XmlWriter xmlWriter = new XmlWriter();
  RadRootContainer rootContainer = null;
  try {
    rootContainer = createFormSnapshot((JComponent) component);
  }
  catch (Exception ex) {
    ex.printStackTrace();
    return "E:" + ex.getMessage() + "\n";
  }
  rootContainer.write(xmlWriter);
  return xmlWriter.getText();
}
项目:tools-idea    文件:RadFormLayoutManager.java   
@Override
public void writeLayout(final XmlWriter writer, final RadContainer radContainer) {
  FormLayout layout = (FormLayout) radContainer.getLayout();
  for(int i=1; i<=layout.getRowCount(); i++) {
    RowSpec rowSpec = layout.getRowSpec(i);
    writer.startElement(UIFormXmlConstants.ELEMENT_ROWSPEC);
    try {
      writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_VALUE, FormLayoutUtils.getEncodedSpec(rowSpec));
    }
    finally {
      writer.endElement();
    }
  }
  for(int i=1; i<=layout.getColumnCount(); i++) {
    ColumnSpec columnSpec = layout.getColumnSpec(i);
    writer.startElement(UIFormXmlConstants.ELEMENT_COLSPEC);
    try {
      writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_VALUE, FormLayoutUtils.getEncodedSpec(columnSpec));
    }
    finally {
      writer.endElement();
    }
  }
  writeGroups(writer, UIFormXmlConstants.ELEMENT_ROWGROUP, layout.getRowGroups());
  writeGroups(writer, UIFormXmlConstants.ELEMENT_COLGROUP, layout.getColumnGroups());
}
项目:tools-idea    文件:RadFormLayoutManager.java   
@Override
public void writeChildConstraints(final XmlWriter writer, final RadComponent child) {
  writeGridConstraints(writer, child);
  if (child.getCustomLayoutConstraints() instanceof CellConstraints) {
    CellConstraints cc = (CellConstraints) child.getCustomLayoutConstraints();
    writer.startElement(UIFormXmlConstants.ELEMENT_FORMS);
    try {
      if (!cc.insets.equals(new Insets(0, 0, 0, 0))) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_TOP, cc.insets.top);
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_LEFT, cc.insets.left);
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_BOTTOM, cc.insets.bottom);
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_RIGHT, cc.insets.right);
      }
      if (cc.hAlign != CellConstraints.DEFAULT) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_DEFAULTALIGN_HORZ, false);
      }
      if (cc.vAlign != CellConstraints.DEFAULT) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_DEFAULTALIGN_VERT, false);
      }
    }
    finally {
      writer.endElement();
    }
  }
}
项目:tools-idea    文件:RadGridBagLayoutManager.java   
public void writeChildConstraints(final XmlWriter writer, final RadComponent child) {
  writeGridConstraints(writer, child);
  if (child.getCustomLayoutConstraints() instanceof GridBagConstraints) {
    GridBagConstraints gbc = (GridBagConstraints)child.getCustomLayoutConstraints();
    writer.startElement(UIFormXmlConstants.ELEMENT_GRIDBAG);
    try {
      if (!gbc.insets.equals(new Insets(0, 0, 0, 0))) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_TOP, gbc.insets.top);
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_LEFT, gbc.insets.left);
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_BOTTOM, gbc.insets.bottom);
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_RIGHT, gbc.insets.right);
      }
      writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_WEIGHTX, gbc.weightx);
      writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_WEIGHTY, gbc.weighty);
      if (gbc.ipadx != 0) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_IPADX, gbc.ipadx);
      }
      if (gbc.ipady != 0) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_IPADY, gbc.ipady);
      }
    }
    finally {
      writer.endElement();
    }
  }
}
项目:tools-idea    文件:RadErrorComponent.java   
public void write(final XmlWriter writer) {
  writer.startElement("component");
  try {
    writeId(writer);

    // write class
    writer.addAttribute("class", myComponentClassName);

    writeBinding(writer);
    writeConstraints(writer);

    // write properties (if any)
    if (myProperties != null) {
      writer.writeElement(myProperties);
    }
  }
  finally {
    writer.endElement(); // component
  }
}
项目:tools-idea    文件:RadSplitPane.java   
public void write(final XmlWriter writer) {
  writer.startElement(UIFormXmlConstants.ELEMENT_SPLITPANE);
  try {
    writeId(writer);
    writeClassIfDifferent(writer, JSplitPane.class.getName());
    writeBinding(writer);

    // Constraints and properties
    writeConstraints(writer);
    writeProperties(writer);

    // Margin and border
    writeBorder(writer);
    writeChildren(writer);
  }
  finally {
    writer.endElement(); // scrollpane
  }
}
项目:tools-idea    文件:RadRootContainer.java   
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
  }
}
项目:tools-idea    文件:RadXYLayoutManager.java   
public void writeLayout(final XmlWriter writer, final RadContainer radContainer) {
  final AbstractLayout layout = (AbstractLayout)radContainer.getLayout();
  // It has sense to save hpap and vgap even for XY layout. The reason is
  // that XY was previously GRID with non default gaps, so when the user
  // compose XY into the grid again then he will get the same non default gaps.
  writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_HGAP, layout.getHGap());
  writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_VGAP, layout.getVGap());

  // Margins
  final Insets margin = layout.getMargin();
  writer.startElement("margin");
  try {
    writer.writeInsets(margin);
  }
  finally {
    writer.endElement(); // margin
  }
}
项目:tools-idea    文件:RadAbstractGridLayoutManager.java   
protected static void writeGridConstraints(final XmlWriter writer, final RadComponent child) {
  // Constraints in Grid layout
  writer.startElement("grid");
  try {
    final GridConstraints constraints = child.getConstraints();
    writer.addAttribute("row",constraints.getRow());
    writer.addAttribute("column",constraints.getColumn());
    writer.addAttribute("row-span",constraints.getRowSpan());
    writer.addAttribute("col-span",constraints.getColSpan());
    writer.addAttribute("vsize-policy",constraints.getVSizePolicy());
    writer.addAttribute("hsize-policy",constraints.getHSizePolicy());
    writer.addAttribute("anchor",constraints.getAnchor());
    writer.addAttribute("fill",constraints.getFill());
    writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_INDENT, constraints.getIndent());
    writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_USE_PARENT_LAYOUT, constraints.isUseParentLayout());

    // preferred size
    writer.writeDimension(constraints.myMinimumSize,"minimum-size");
    writer.writeDimension(constraints.myPreferredSize,"preferred-size");
    writer.writeDimension(constraints.myMaximumSize,"maximum-size");
  } finally {
    writer.endElement(); // grid
  }
}
项目:consulo-ui-designer    文件:SnapShooterDaemon.java   
@NonNls
private String doSnapshotCommand(final String command) {
  int id = Integer.parseInt(command.substring(1));
  Component component = myIdMap.get(id);
  XmlWriter xmlWriter = new XmlWriter();
  RadRootContainer rootContainer = null;
  try {
    rootContainer = createFormSnapshot((JComponent) component);
  }
  catch (Exception ex) {
    ex.printStackTrace();
    return "E:" + ex.getMessage() + "\n";
  }
  rootContainer.write(xmlWriter);
  return xmlWriter.getText();
}
项目:consulo-ui-designer    文件:RadFormLayoutManager.java   
@Override
public void writeLayout(final XmlWriter writer, final RadContainer radContainer) {
  FormLayout layout = (FormLayout) radContainer.getLayout();
  for(int i=1; i<=layout.getRowCount(); i++) {
    RowSpec rowSpec = layout.getRowSpec(i);
    writer.startElement(UIFormXmlConstants.ELEMENT_ROWSPEC);
    try {
      writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_VALUE, FormLayoutUtils.getEncodedSpec(rowSpec));
    }
    finally {
      writer.endElement();
    }
  }
  for(int i=1; i<=layout.getColumnCount(); i++) {
    ColumnSpec columnSpec = layout.getColumnSpec(i);
    writer.startElement(UIFormXmlConstants.ELEMENT_COLSPEC);
    try {
      writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_VALUE, FormLayoutUtils.getEncodedSpec(columnSpec));
    }
    finally {
      writer.endElement();
    }
  }
  writeGroups(writer, UIFormXmlConstants.ELEMENT_ROWGROUP, layout.getRowGroups());
  writeGroups(writer, UIFormXmlConstants.ELEMENT_COLGROUP, layout.getColumnGroups());
}
项目:consulo-ui-designer    文件:RadFormLayoutManager.java   
@Override
public void writeChildConstraints(final XmlWriter writer, final RadComponent child) {
  writeGridConstraints(writer, child);
  if (child.getCustomLayoutConstraints() instanceof CellConstraints) {
    CellConstraints cc = (CellConstraints) child.getCustomLayoutConstraints();
    writer.startElement(UIFormXmlConstants.ELEMENT_FORMS);
    try {
      if (!cc.insets.equals(new Insets(0, 0, 0, 0))) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_TOP, cc.insets.top);
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_LEFT, cc.insets.left);
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_BOTTOM, cc.insets.bottom);
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_RIGHT, cc.insets.right);
      }
      if (cc.hAlign != CellConstraints.DEFAULT) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_DEFAULTALIGN_HORZ, false);
      }
      if (cc.vAlign != CellConstraints.DEFAULT) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_DEFAULTALIGN_VERT, false);
      }
    }
    finally {
      writer.endElement();
    }
  }
}
项目:consulo-ui-designer    文件:RadGridBagLayoutManager.java   
public void writeChildConstraints(final XmlWriter writer, final RadComponent child) {
  writeGridConstraints(writer, child);
  if (child.getCustomLayoutConstraints() instanceof GridBagConstraints) {
    GridBagConstraints gbc = (GridBagConstraints)child.getCustomLayoutConstraints();
    writer.startElement(UIFormXmlConstants.ELEMENT_GRIDBAG);
    try {
      if (!gbc.insets.equals(new Insets(0, 0, 0, 0))) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_TOP, gbc.insets.top);
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_LEFT, gbc.insets.left);
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_BOTTOM, gbc.insets.bottom);
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_RIGHT, gbc.insets.right);
      }
      writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_WEIGHTX, gbc.weightx);
      writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_WEIGHTY, gbc.weighty);
      if (gbc.ipadx != 0) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_IPADX, gbc.ipadx);
      }
      if (gbc.ipady != 0) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_IPADY, gbc.ipady);
      }
    }
    finally {
      writer.endElement();
    }
  }
}
项目:consulo-ui-designer    文件:RadErrorComponent.java   
public void write(final XmlWriter writer) {
  writer.startElement("component");
  try {
    writeId(writer);

    // write class
    writer.addAttribute("class", myComponentClassName);

    writeBinding(writer);
    writeConstraints(writer);

    // write properties (if any)
    if (myProperties != null) {
      writer.writeElement(myProperties);
    }
  }
  finally {
    writer.endElement(); // component
  }
}
项目:consulo-ui-designer    文件:RadSplitPane.java   
public void write(final XmlWriter writer) {
  writer.startElement(UIFormXmlConstants.ELEMENT_SPLITPANE);
  try {
    writeId(writer);
    writeClassIfDifferent(writer, JSplitPane.class.getName());
    writeBinding(writer);

    // Constraints and properties
    writeConstraints(writer);
    writeProperties(writer);

    // Margin and border
    writeBorder(writer);
    writeChildren(writer);
  }
  finally {
    writer.endElement(); // scrollpane
  }
}
项目:consulo-ui-designer    文件:RadRootContainer.java   
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
  }
}
项目:consulo-ui-designer    文件:RadXYLayoutManager.java   
public void writeLayout(final XmlWriter writer, final RadContainer radContainer) {
  final AbstractLayout layout = (AbstractLayout)radContainer.getLayout();
  // It has sense to save hpap and vgap even for XY layout. The reason is
  // that XY was previously GRID with non default gaps, so when the user
  // compose XY into the grid again then he will get the same non default gaps.
  writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_HGAP, layout.getHGap());
  writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_VGAP, layout.getVGap());

  // Margins
  final Insets margin = layout.getMargin();
  writer.startElement("margin");
  try {
    writer.writeInsets(margin);
  }
  finally {
    writer.endElement(); // margin
  }
}
项目:consulo-ui-designer    文件:RadAbstractGridLayoutManager.java   
protected static void writeGridConstraints(final XmlWriter writer, final RadComponent child) {
  // Constraints in Grid layout
  writer.startElement("grid");
  try {
    final GridConstraints constraints = child.getConstraints();
    writer.addAttribute("row",constraints.getRow());
    writer.addAttribute("column",constraints.getColumn());
    writer.addAttribute("row-span",constraints.getRowSpan());
    writer.addAttribute("col-span",constraints.getColSpan());
    writer.addAttribute("vsize-policy",constraints.getVSizePolicy());
    writer.addAttribute("hsize-policy",constraints.getHSizePolicy());
    writer.addAttribute("anchor",constraints.getAnchor());
    writer.addAttribute("fill",constraints.getFill());
    writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_INDENT, constraints.getIndent());
    writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_USE_PARENT_LAYOUT, constraints.isUseParentLayout());

    // preferred size
    writer.writeDimension(constraints.myMinimumSize,"minimum-size");
    writer.writeDimension(constraints.myPreferredSize,"preferred-size");
    writer.writeDimension(constraints.myMaximumSize,"maximum-size");
  } finally {
    writer.endElement(); // grid
  }
}
项目:intellij-ce-playground    文件:IntroListModelProperty.java   
public void write(final String[] value, final XmlWriter writer) {
  for(String s: value) {
    writer.startElement(UIFormXmlConstants.ELEMENT_ITEM);
    writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_VALUE, s);
    writer.endElement();
  }
}
项目:intellij-ce-playground    文件:RadFormLayoutManager.java   
private static void writeGroups(final XmlWriter writer, final String elementName, final int[][] groups) {
  for(int[] group: groups) {
    writer.startElement(elementName);
    try {
      for(int member: group) {
        writer.startElement(UIFormXmlConstants.ELEMENT_MEMBER);
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_INDEX, member);
        writer.endElement();
      }
    }
    finally {
      writer.endElement();
    }
  }
}
项目:intellij-ce-playground    文件:RadVSpacer.java   
public void write(final XmlWriter writer) {
  writer.startElement("vspacer");
  try {
    writeId(writer);
    writeConstraints(writer);
  }
  finally {
    writer.endElement(); // vspacer
  }
}
项目:intellij-ce-playground    文件:RadCardLayoutManager.java   
public void writeChildConstraints(final XmlWriter writer, final RadComponent child) {
  writer.startElement(UIFormXmlConstants.ELEMENT_CARD);
  try {
    writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_NAME, (String) child.getCustomLayoutConstraints());
  }
  finally {
    writer.endElement();
  }
}
项目:intellij-ce-playground    文件:RadCardLayoutManager.java   
@Override
public void writeLayout(final XmlWriter writer, final RadContainer radContainer) {
  CardLayout layout = (CardLayout) radContainer.getLayout();

  writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_HGAP, layout.getHgap());
  writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_VGAP, layout.getVgap());

  String defaultCard = DefaultCardProperty.INSTANCE.getValue(radContainer);
  if (!StringUtil.isEmpty(defaultCard)) {
    writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_SHOW, defaultCard);
  }
}
项目:intellij-ce-playground    文件:RadButtonGroup.java   
public void write(final XmlWriter writer) {
  writer.startElement(UIFormXmlConstants.ELEMENT_GROUP);
  writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_NAME, myName);
  if (myBound) {
    writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_BOUND, true);
  }
  for(String id: myComponentIds) {
    writer.startElement(UIFormXmlConstants.ELEMENT_MEMBER);
    writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_ID, id);
    writer.endElement();
  }
  writer.endElement();
}
项目:intellij-ce-playground    文件:RadToolBar.java   
public void write(final XmlWriter writer) {
  writer.startElement(UIFormXmlConstants.ELEMENT_TOOLBAR);
  try {
    writeNoLayout(writer, JToolBar.class.getName());
  } finally {
    writer.endElement();
  }
}
项目:intellij-ce-playground    文件:RadSplitPane.java   
public void writeChildConstraints(final XmlWriter writer, final RadComponent child) {
  writer.startElement("splitpane");
  try {
    final String position = (String)child.getCustomLayoutConstraints();
    if (!LwSplitPane.POSITION_LEFT.equals(position) && !LwSplitPane.POSITION_RIGHT.equals(position)) {
      throw new IllegalStateException("invalid position: " + position);
    }
    writer.addAttribute("position", position);
  }
  finally {
    writer.endElement();
  }
}
项目:intellij-ce-playground    文件:RadAtomicComponent.java   
public void write(final XmlWriter writer) {
  writer.startElement("component");
  try{
    writeId(writer);
    writeClass(writer);
    writeBinding(writer);
    writeConstraints(writer);
    writeProperties(writer);
  }finally{
    writer.endElement(); // component
  }
}
项目:intellij-ce-playground    文件:RadRootContainer.java   
private void writeInspectionSuppressions(final XmlWriter writer) {
  if (myInspectionSuppressions.size() > 0) {
    writer.startElement(UIFormXmlConstants.ELEMENT_INSPECTION_SUPPRESSIONS);
    for(LwInspectionSuppression suppression: myInspectionSuppressions) {
      writer.startElement(UIFormXmlConstants.ELEMENT_SUPPRESS);
      writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_INSPECTION, suppression.getInspectionId());
      if (suppression.getComponentId() != null) {
        writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_ID, suppression.getComponentId());
      }
      writer.endElement();
    }
    writer.endElement();
  }
}
项目:intellij-ce-playground    文件:RadRootContainer.java   
@Override public void writeConstraints(final XmlWriter writer) {
  writer.startElement("constraints");
  try {
    myLayoutManager.writeChildConstraints(writer, this);
  } finally {
    writer.endElement(); // constraints
  }
}
项目:intellij-ce-playground    文件:RadXYLayoutManager.java   
public void writeChildConstraints(final XmlWriter writer, final RadComponent child) {
  // Constraints of XY layout
  writer.startElement("xy");
  try{
    writer.addAttribute("x", child.getX());
    writer.addAttribute("y", child.getY());
    writer.addAttribute("width", child.getWidth());
    writer.addAttribute("height", child.getHeight());
  }finally{
    writer.endElement(); // xy
  }
}
项目:intellij-ce-playground    文件:RadGridLayoutManager.java   
public void writeLayout(final XmlWriter writer, final RadContainer radContainer) {
  GridLayoutManager layout = (GridLayoutManager) radContainer.getLayout();

  writer.addAttribute("row-count", layout.getRowCount());
  writer.addAttribute("column-count", layout.getColumnCount());

  writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_SAME_SIZE_HORIZONTALLY, layout.isSameSizeHorizontally());
  writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_SAME_SIZE_VERTICALLY, layout.isSameSizeVertically());

  RadXYLayoutManager.INSTANCE.writeLayout(writer, radContainer);
}