gpt4 book ai didi

bibliothek.util.xml.XElement.addString()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 06:20:40 27 4
gpt4 key购买 nike

本文整理了Java中bibliothek.util.xml.XElement.addString()方法的一些代码示例,展示了XElement.addString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XElement.addString()方法的具体详情如下:
包路径:bibliothek.util.xml.XElement
类名称:XElement
方法名:addString

XElement.addString介绍

[英]Adds a new attribute to this entry.
[中]将新属性添加到此条目。

代码示例

代码示例来源:origin: org.orbisgis/orbisgis-view

@Override
public XElement addString(String name, String value) {
    return new XElementImpl(intern.addString(name,value));
}

代码示例来源:origin: org.opentcs.thirdparty.dockingframes/docking-frames-common

/**
 * Writes the content of this manager in xml format.
 * @param element the element to write into, the attributes of this
 * element will not be changed.
 */
public void writeXML( XElement element ){
  for( Map.Entry<String, ApplicationResource> resource : resources.entrySet() ){
    XElement xresource = element.addElement( "resource" );
    xresource.addString( "name", resource.getKey() );
    resource.getValue().writeXML( xresource );
  }
}

代码示例来源:origin: xyz.cofe/docking-frames-core

/**
 * Writes the contents of <code>station</code> into <code>element</code>.
 * @param stations the items to write
 * @param element the element to write into, the attributes of <code>element</code>
 * will not be changed
 */
public void writeCompositionsXML( Map<String, DockLayoutComposition> stations, XElement element ) {
  for( Map.Entry<String, DockLayoutComposition> entry : stations.entrySet() ){
    XElement xchild = element.addElement( "element" );
    xchild.addString( "name", entry.getKey() );
    writeCompositionXML( entry.getValue(), xchild );
  }
}

代码示例来源:origin: xyz.cofe/docking-frames-common

/**
 * Writes the content of this manager in xml format.
 * @param element the element to write into, the attributes of this
 * element will not be changed.
 */
public void writeXML( XElement element ){
  for( Map.Entry<String, ApplicationResource> resource : resources.entrySet() ){
    XElement xresource = element.addElement( "resource" );
    xresource.addString( "name", resource.getKey() );
    resource.getValue().writeXML( xresource );
  }
  
  for( Map.Entry<String, Object> unknownResource : buffer.entrySet() ){
    Object value = unknownResource.getValue();
    if( value instanceof XElement ){
      XElement xvalue = (XElement)value;
      element.addElement( xvalue );
    }
  }
}

代码示例来源:origin: xyz.cofe/docking-frames-common

public <B> void write( XElement element, ModeSettingsConverter<Location, B> converter ) {
  Set<String> keys = new HashSet<String>();
  if( lastMaximizedLocation != null ){
    keys.addAll( lastMaximizedLocation.keySet() );
  }
  if( lastMaximizedMode != null ){
    keys.addAll( lastMaximizedMode.keySet() );
  }
  if( !keys.isEmpty() ){
    XElement xmaximized = element.addElement( "maximized" );
    for( String key : keys ){
      Path mode = lastMaximizedMode.get( key );
      Location location = lastMaximizedLocation.get( key );
      if( mode != null || location != null ){
        XElement xitem = xmaximized.addElement( "item" );
        xitem.addString( "id", key );
        if( mode != null ){
          xitem.addElement( "mode" ).setString( mode.toString() );
        }
        if( location != null ){
          converter.writePropertyXML( converter.convertToSetting( location ), xitem.addElement( "location" ) );
        }
      }
    }
  }
}

代码示例来源:origin: org.opentcs.thirdparty.dockingframes/docking-frames-common

public <B> void write( XElement element, ModeSettingsConverter<Location, B> converter ) {
  Set<String> keys = new HashSet<String>();
  if( lastMaximizedLocation != null ){
    keys.addAll( lastMaximizedLocation.keySet() );
  }
  if( lastMaximizedMode != null ){
    keys.addAll( lastMaximizedMode.keySet() );
  }
  if( !keys.isEmpty() ){
    XElement xmaximized = element.addElement( "maximized" );
    for( String key : keys ){
      Path mode = lastMaximizedMode.get( key );
      Location location = lastMaximizedLocation.get( key );
      if( mode != null || location != null ){
        XElement xitem = xmaximized.addElement( "item" );
        xitem.addString( "id", key );
        if( mode != null ){
          xitem.addElement( "mode" ).setString( mode.toString() );
        }
        if( location != null ){
          converter.writePropertyXML( converter.convertToSetting( location ), xitem.addElement( "location" ) );
        }
      }
    }
  }
}

代码示例来源:origin: xyz.cofe/docking-frames-core

/**
 * Writes the contents of this map into <code>out</code>.
 * @param out the element to fill, its attributes will not be modified
 */
public void write( XElement out ){
  out.addElement( "version" ).setInt( version );
  out.addElement( "format" ).setString( format.toString() );
  
  for( Map.Entry<Key, Map<String, Object>> entry : data.entrySet() ){
    XElement xplaceholder = out.addElement( "entry" );
    ((PlaceholderKey)entry.getKey()).write( xplaceholder.addElement( "key" ) );
    Map<String, Object> map = entry.getValue();
    for( Map.Entry<String, Object> mapEntry : map.entrySet() ){
      XElement xitem = xplaceholder.addElement( "item" );
      xitem.addString( "key", mapEntry.getKey() );
      write( mapEntry.getValue(), xitem );
    }
  }
}

代码示例来源:origin: org.opentcs.thirdparty.dockingframes/docking-frames-core

/**
 * Writes <code>property</code> and all its successors into
 * <code>element</code>.
 * @param property the property to write
 * @param element an xml element to which this method will add some children
 */
public void writeXML( DockableProperty property, XElement element ){
  while( property != null ) {
    XElement xnode = element.addElement( "property" );
    xnode.addString( "factory", property.getFactoryID() );
    property.store( xnode );
    property = property.getSuccessor();
  }
}

代码示例来源:origin: org.opentcs.thirdparty.dockingframes/docking-frames-common

for( DockableEntry entry : dockables ){
  XElement xentry = delement.addElement( "entry" );
  xentry.addString( "id", entry.id );
  if( entry.current != null )
    xentry.addString( "current", entry.current.toString() );
  for( Map.Entry<Path, B> next : entry.properties.entrySet() ){
    XElement xproperty = xproperties.addElement( "property" );
    xproperty.addString( "id", next.getKey().toString() );
    converter.writePropertyXML( next.getValue(), xproperty );
for( ModeSetting<A> mode : modes.values() ){
  XElement xmode = melement.addElement( "entry" );
  xmode.addString( "id", mode.getModeId().toString() );
  mode.write( xmode, converter );

代码示例来源:origin: xyz.cofe/docking-frames-core

/**
 * Writes <code>property</code> and all its successors into
 * <code>element</code>.
 * @param property the property to write
 * @param element an xml element to which this method will add some children
 */
public void writeXML( DockableProperty property, XElement element ){
  while( property != null ) {
    XElement xnode = element.addElement( "property" );
    xnode.addString( "factory", property.getFactoryID() );
    property.store( xnode );
    property = property.getSuccessor();
  }
}

代码示例来源:origin: xyz.cofe/docking-frames-common

for( DockableEntry entry : dockables ){
  XElement xentry = delement.addElement( "entry" );
  xentry.addString( "id", entry.id );
  if( entry.current != null )
    xentry.addString( "current", entry.current.toString() );
  for( Map.Entry<Path, B> next : entry.properties.entrySet() ){
    XElement xproperty = xproperties.addElement( "property" );
    xproperty.addString( "id", next.getKey().toString() );
    converter.writePropertyXML( next.getValue(), xproperty );
for( ModeSetting<A> mode : modes.values() ){
  XElement xmode = melement.addElement( "entry" );
  xmode.addString( "id", mode.getModeId().toString() );
  mode.write( xmode, converter );

代码示例来源:origin: xyz.cofe/docking-frames-core

@SuppressWarnings("unchecked")
private void writeXML( Node node, XElement element ){
  Path type = node.getType();
  Object value = node.getValue();
  if( type != null && value != null ){
    PreferenceFactory factory = factories.get( type );
    if( factory != null ){
      XElement xvalue = element.addElement( "value" );
      xvalue.addString( "type", type.toString() );
      factory.writeXML( value, xvalue );
    }
  }
  
  int size = node.getChildrenCount();
  for( int i = 0; i < size; i++ ){
    Node child = node.getChild( i );
    XElement xchild = element.addElement( "child" );
    
    xchild.addString( "name", child.getName() );
    writeXML( child, xchild );
  }
}

代码示例来源:origin: xyz.cofe/docking-frames-core

/**
 * Writes all the {@link Setting}s of <code>blop</code> into <code>element</code>, this
 * method does use the factories installed on this {@link DockFrontend}, but does not
 * change any properties of the frontend.
 * @param blop the settings to write
 * @param element the element to write into, this method will not
 * change the attributes of <code>element</code>
 */
public void writeBlopXML( SettingsBlop blop, XElement element ){
  String[] names = blop.getNames();
  
  if( names.length > 0 ){
    XElement xsettings = element.addElement( "settings" );
    for( String name : names ){
      XElement xsetting = xsettings.addElement( "setting" );
      xsetting.addString( "name", name );
      writeXML( blop.getSetting( name ), true, xsetting );
    }
  }
  
  XElement xcurrent = element.addElement( "current" );
  String current = blop.getCurrentName();
  if( current != null )
    xcurrent.addString( "name", current );
  
  writeXML( blop.getCurrentSetting(), false, xcurrent );
}

代码示例来源:origin: org.opentcs.thirdparty.dockingframes/docking-frames-core

@SuppressWarnings("unchecked")
public void write( PredefinedLayout layout, XElement element ) {
  element.addElement( "replacement" ).addString( "id", layout.getPredefined() );
  DockLayoutInfo info = layout.getDelegate();
  if( info.getKind() == DockLayoutInfo.Data.XML ){
    element.addElement( info.getDataXML() );
  }
  else if( info.getKind() == DockLayoutInfo.Data.DOCK_LAYOUT ){
    DockLayout<?> delegate = layout.getDelegate().getDataLayout();
    String factoryId = delegate.getFactoryID();
    DockFactory<DockElement,?,Object> factory = (DockFactory<DockElement,?,Object>)getFactory( factoryId );
    if( factory == null )
      throw new XException( "Missing factory: " + factoryId );
    XElement xdelegate = element.addElement( "delegate" );
    xdelegate.addString( "id", factoryId );
    factory.write( delegate.getData(), xdelegate );    
  }
  else if( info.getKind() == DockLayoutInfo.Data.NULL ){
    // nothing to store
  }
  else{
    throw new IllegalArgumentException( "Cannot store information as xml, it is neither present as raw xml nor in an understandable format" );
  }
}

代码示例来源:origin: xyz.cofe/docking-frames-core

@SuppressWarnings("unchecked")
public void write( PredefinedLayout layout, XElement element ) {
  element.addElement( "replacement" ).addString( "id", layout.getPredefined() );
  DockLayoutInfo info = layout.getDelegate();
  if( info.getKind() == DockLayoutInfo.Data.XML ){
    element.addElement( info.getDataXML() );
  }
  else if( info.getKind() == DockLayoutInfo.Data.DOCK_LAYOUT ){
    DockLayout<?> delegate = layout.getDelegate().getDataLayout();
    String factoryId = delegate.getFactoryID();
    DockFactory<DockElement,?,Object> factory = (DockFactory<DockElement,?,Object>)getFactory( factoryId );
    if( factory == null )
      throw new XException( "Missing factory: " + factoryId );
    XElement xdelegate = element.addElement( "delegate" );
    xdelegate.addString( "id", factoryId );
    factory.write( delegate.getData(), xdelegate );    
  }
  else if( info.getKind() == DockLayoutInfo.Data.NULL ){
    // nothing to store
  }
  else{
    throw new IllegalArgumentException( "Cannot store information as xml, it is neither present as raw xml nor in an understandable format" );
  }
}

代码示例来源:origin: xyz.cofe/docking-frames-core

public void store( XElement element ) {
  for( Node node : nodes ){
    XElement xnode = element.addElement( "node" );
    xnode.addString( "location", node.getLocation().name() );
    xnode.addDouble( "size", node.getSize() );
    if( node.getId() >= 0 ){
      xnode.addLong( "id", node.getId() );
    }
  }
  element.addElement( "leaf" ).addLong( "id", leafId );
}

代码示例来源:origin: xyz.cofe/docking-frames-core

public void write( FlapDockStationLayout layout, XElement element ) {
  if( layout instanceof RetroFlapDockStationLayout ){
    RetroFlapDockStationLayout retroLayout = (RetroFlapDockStationLayout)layout;
    XElement window = element.addElement( "window" );
    window.addBoolean( "auto", layout.isAutoDirection() );
    window.addString( "direction", layout.getDirection().name() );
    XElement children = element.addElement( "children" );
    for( int i = 0, n = retroLayout.getChildren().length; i<n; i++ ){
      XElement child = children.addElement( "child" );
      child.addInt( "id", retroLayout.getChildren()[i] );
      child.addBoolean( "hold", retroLayout.getHolds()[i] );
      child.addInt( "size", retroLayout.getSizes()[i] );
    }
  }
  else{
    XElement window = element.addElement( "window" );
    window.addBoolean( "auto", layout.isAutoDirection() );
    window.addString( "direction", layout.getDirection().name() );
    XElement children = element.addElement( "placeholders" );
    layout.getPlaceholders().write( children );
  }
}

代码示例来源:origin: xyz.cofe/docking-frames-common

@SuppressWarnings("unchecked")
public void write( CommonDockStationLayout layout, XElement element ){
  String factoryId = layout.getFactoryId();
  DockFactory<DockElement, ?, Object> factory = (DockFactory<DockElement, ?, Object>)control.intern().getDockFactory( factoryId );
  XElement content = layout.getLayoutXML();
  if( content == null ){
    layout.updateLayout( factory, null );
    DockLayout<?> data = layout.getLayout();
    if( data == null ){
      throw new XException( "data are null, but data were just updated" );
    }
    content = new XElement("content");
    factory.write( data.getData(), content );
  }
  
  String id = layout.getId();
  if( id != null ){
    element.addElement( "id" ).setString( id );
  }
  element.addElement( "root" ).setBoolean( layout.isRoot() );
  
  content.addString( "delegate", factoryId );
  element.addElement( content );
}

代码示例来源:origin: org.opentcs.thirdparty.dockingframes/docking-frames-common

@SuppressWarnings("unchecked")
public void write( CommonDockStationLayout layout, XElement element ){
  String factoryId = layout.getFactoryId();
  DockFactory<DockElement, ?, Object> factory = (DockFactory<DockElement, ?, Object>)control.intern().getDockFactory( factoryId );
  XElement content = layout.getLayoutXML();
  if( content == null ){
    layout.updateLayout( factory, null );
    DockLayout<?> data = layout.getLayout();
    if( data == null ){
      throw new XException( "data are null, but data were just updated" );
    }
    content = new XElement("content");
    factory.write( data.getData(), content );
  }
  
  String id = layout.getId();
  if( id != null ){
    element.addElement( "id" ).setString( id );
  }
  element.addElement( "root" ).setBoolean( layout.isRoot() );
  
  content.addString( "delegate", factoryId );
  element.addElement( content );
}

代码示例来源:origin: xyz.cofe/docking-frames-core

xchild = parent.addElement( "node" );
xchild.addLong( "nodeId", entry.getNodeId() );
xchild.addString( "orientation", entry.asNode().getOrientation().name() );
xchild.addDouble( "divider", entry.asNode().getDivider() );
writeEntry( entry.asNode().getChildA(), xchild );

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com