gpt4 book ai didi

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

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

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

XElement.getElements介绍

[英]Gets all children with a given name.
[中]获取具有给定名称的所有子级。

代码示例

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

@Override
    public XElement[] getElements(String name) {
        return getArray(intern.getElements(name));
    }
}

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

/**
 * Reads the contents of this manager from a xml element.
 * @param element the element to read
 */
public void readXML( XElement element ){
  for( XElement xresource : element.getElements( "resource" )){
    String name = xresource.getString( "name" );
    ApplicationResource resource = resources.get( name );
    if( resource != null ){
      resource.readXML( xresource );
    }
    else
      buffer.put( name, xresource );
  }
}

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

/**
 * Reads the contents of this manager from a xml element.
 * @param element the element to read
 */
public void readXML( XElement element ){
  for( XElement xresource : element.getElements( "resource" )){
    String name = xresource.getString( "name" );
    ApplicationResource resource = resources.get( name );
    if( resource != null ){
      resource.readXML( xresource );
    }
    else
      buffer.put( name, xresource );
  }
}

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

/**
 * Reads a set of {@link DockLayoutComposition}s that were stored earlier.
 * @param root the xml element from which to read
 * @return the set of compositions
 */
public Map<String, DockLayoutComposition> readCompositionsXML( XElement root ){
  Map<String, DockLayoutComposition> result = new HashMap<String, DockLayoutComposition>();
  for( XElement xelement : root.getElements( "element" )){
    String name = xelement.getString( "name" );
    DockLayoutComposition composition = readCompositionXML( xelement );
    if( composition != null ){
      result.put( name, composition );
    }
  }
  return result;
}

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

/**
 * Reads a set of {@link DockStation}s that were stored earlier.
 * @param root the xml element from which to read
 * @return the set of station
 */
public Map<String, DockStation> readXML( XElement root ){
  Map<String, DockStation> result = new HashMap<String, DockStation>();
  for( XElement xelement : root.getElements( "element" )){
    String name = xelement.getString( "name" );
    DockLayoutComposition composition = readCompositionXML( xelement );
    DockElement element = composition == null ? null : convert( composition );
    DockStation station = element == null ? null : element.asDockStation();
    if( station != null )
      result.put( name, station );
  }
  return result;
}

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

/**
   * Reads a {@link DockableProperty} and its successors from an xml element.
   * @param element the element to read from
   * @return the property or <code>null</code> if <code>element</code> is empty
   * @throws IllegalArgumentException if a {@link DockablePropertyFactory} is missing.
   */
  public DockableProperty readXML( XElement element ){
    DockableProperty base = null;
    DockableProperty property = null;

    for (XElement xnode : element.getElements( "property" )) {
      DockablePropertyFactory factory = factories.get( xnode.getString( "factory" ) );
      if (factory == null)
        throw new IllegalArgumentException( "Missing factory: " + xnode.getString( "factory" ) );

      DockableProperty next = factory.createProperty();
      next.load( xnode );

      if (property == null) {
        property = next;
        base = next;
      } else {
        property.setSuccessor( next );
        property = next;
      }
    }

    return base;
  }
}

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

public <B> void read( XElement element, ModeSettingsConverter<Location, B> converter ) {
    lastMaximizedLocation = new HashMap<String, Location>();
    lastMaximizedMode = new HashMap<String, Path>();

    XElement xmaximized = element.getElement( "maximized" );

    if( xmaximized != null ){
      for( XElement xitem : xmaximized.getElements( "item" )){
        String key = xitem.getString( "id" );

        XElement xmode = xitem.getElement( "mode" );
        if( xmode != null ){
          lastMaximizedMode.put( key, new Path( xmode.getString() ));
        }

        XElement xlocation = xitem.getElement( "location" );
        if( xlocation != null ){
          lastMaximizedLocation.put( key, converter.convertToWorld( converter.readPropertyXML( xlocation ) ) );
        }
      }
    }
  }
}

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

public <B> void read( XElement element, ModeSettingsConverter<Location, B> converter ) {
    lastMaximizedLocation = new HashMap<String, Location>();
    lastMaximizedMode = new HashMap<String, Path>();

    XElement xmaximized = element.getElement( "maximized" );

    if( xmaximized != null ){
      for( XElement xitem : xmaximized.getElements( "item" )){
        String key = xitem.getString( "id" );

        XElement xmode = xitem.getElement( "mode" );
        if( xmode != null ){
          lastMaximizedMode.put( key, new Path( xmode.getString() ));
        }

        XElement xlocation = xitem.getElement( "location" );
        if( xlocation != null ){
          lastMaximizedLocation.put( key, converter.convertToWorld( converter.readPropertyXML( xlocation ) ) );
        }
      }
    }
  }
}

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

/**
   * Reads a {@link DockableProperty} and its successors from an xml element.
   * @param element the element to read from
   * @return the property or <code>null</code> if <code>element</code> is empty
   * @throws IllegalArgumentException if a {@link DockablePropertyFactory} is missing.
   */
  public DockableProperty readXML( XElement element ){
    DockableProperty base = null;
    DockableProperty property = null;

    for (XElement xnode : element.getElements( "property" )) {
      DockablePropertyFactory factory = factories.get( xnode.getString( "factory" ) );
      if (factory == null)
        throw new IllegalArgumentException( "Missing factory: " + xnode.getString( "factory" ) );

      DockableProperty next = factory.createProperty();
      next.load( xnode );

      if (property == null) {
        property = next;
        base = next;
      } else {
        property.setSuccessor( next );
        property = next;
      }
    }

    return base;
  }
}

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

public PlaceholderKey( XElement in ){
  shared = in.getBoolean( "shared" );
  
  XElement xanchor = in.getElement( "anchor" );
  if( xanchor != null ){
    anchor = xanchor.getString();
  }
  
  XElement[] xplaceholders = in.getElements( "placeholder" );
  placeholders = new Path[ xplaceholders.length ];
  for( int i = 0; i < xplaceholders.length; i++ ){
    placeholders[i] = new Path( xplaceholders[i].getString() );
  }
}

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

XElement[] xitems = in.getElements( "item" );
Object[] result = new Object[xitems.length];
for( int i = 0; i < xitems.length; i++ ){

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

public SplitDockStationLayout read( XElement element, PlaceholderStrategy placeholders ){
    SplitDockStationLayout layout = super.read( element.getElement( "split" ), placeholders );
    element = element.getElement( "wizard" );
    
    XElement[] xcolumns = element.getElements( "column" );
    Column[] columns = new Column[ xcolumns.length ];
    for( int i = 0; i < columns.length; i++ ){
      XElement xcolumn = xcolumns[i];
      int size = xcolumn.getInt("size");
      XElement[] xcells = xcolumn.getElements( "cell" );
      int[] keys = new int[ xcells.length ];
      int[] sizes = new int[ xcells.length ];
      
      for( int j = 0; j < xcells.length; j++ ){
        keys[j] = xcells[j].getInt( "key" );
        sizes[j] = xcells[j].getInt( "size" );
      }
      
      columns[i] = new Column( size, keys, sizes );
    }
    ((WizardSplitDockStationLayout)layout).setColumns( columns );
    return layout;
  }
}

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

public void load( XElement element ) {
  nodes.clear();
  for( XElement xnode : element.getElements( "node" )){
    Location location = Location.valueOf( xnode.getString( "location" ));
    double size = xnode.getDouble( "size" );
    long id = -1;
    if( xnode.attributeExists( "id" )){
      id = xnode.getLong( "id" );
    }
    
    nodes.add( new Node( location, size, id ) );
  }
  XElement xleaf = element.getElement( "leaf" );
  if( xleaf != null ){
    leafId = xleaf.getLong( "id" );
  }
  else{
    leafId = -1;
  }
}

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

@Override
  protected void rescueSettings( XElement element ){
    XElement states = element.getElement( "states" );
    if( states != null ){
      lastMaximizedLocation = new HashMap<String, B>();
      lastMaximizedMode = new HashMap<String, String>();

      XElement xmaximized = element.getElement( "maximized" );

      if( xmaximized != null ){
        for( XElement xitem : xmaximized.getElements( "item" )){
          String key = xitem.getString( "id" );

          XElement xmode = xitem.getElement( "mode" );
          if( xmode != null ){
            lastMaximizedMode.put( key, xmode.getString() );
          }

          XElement xlocation = xitem.getElement( "location" );
          if( xlocation != null ){
            XElement xcopy = xlocation.copy();
            xcopy.addElement( "mode" ).setString( MaximizedMode.IDENTIFIER.toString() );
            lastMaximizedLocation.put( key, getConverter().readPropertyXML( xcopy ) );
          }
        }
      }
    }
  }
}

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

@Override
  protected void rescueSettings( XElement element ){
    XElement states = element.getElement( "states" );
    if( states != null ){
      lastMaximizedLocation = new HashMap<String, B>();
      lastMaximizedMode = new HashMap<String, String>();

      XElement xmaximized = element.getElement( "maximized" );

      if( xmaximized != null ){
        for( XElement xitem : xmaximized.getElements( "item" )){
          String key = xitem.getString( "id" );

          XElement xmode = xitem.getElement( "mode" );
          if( xmode != null ){
            lastMaximizedMode.put( key, xmode.getString() );
          }

          XElement xlocation = xitem.getElement( "location" );
          if( xlocation != null ){
            XElement xcopy = xlocation.copy();
            xcopy.addElement( "mode" ).setString( MaximizedMode.IDENTIFIER.toString() );
            lastMaximizedLocation.put( key, getConverter().readPropertyXML( xcopy ) );
          }
        }
      }
    }
  }
}

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

@SuppressWarnings("unchecked")
private void readXML( Node node, XElement element ){
  Path type = null;
  Object value = null;
  
  XElement xvalue = element.getElement( "value" );
  if( xvalue != null ){
    String typeName = xvalue.getString( "type" );
    type = new Path( typeName );
    PreferenceFactory factory = factories.get( type );
    if( factory != null ){
      value = factory.readXML( xvalue );
    }
  }
  
  node.put( type, value );
  
  XElement[] xchildren = element.getElements( "child" );
  for( XElement xchild : xchildren ){
    String name = xchild.getString( "name" );
    Node child = node.getNode( new Path( name ), true );
    readXML( child, xchild );
  }
}

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

public StackDockStationLayout read( XElement element, PlaceholderStrategy placeholders ){
  XElement xselected = element.getElement( "selected" );
  int selected = -1;
  if (xselected != null)
    selected = xselected.getInt();
  XElement xplaceholders = element.getElement( "placeholders" );
  if( xplaceholders == null ){
    XElement xchildren = element.getElement( "children" );
    int[] ids;

    if (xchildren != null) {
      XElement[] children = xchildren.getElements( "child" );
      ids = new int[children.length];
      for (int i = 0, n = children.length; i < n; i++)
        ids[i] = children[i].getInt( "id" );
    } else {
      ids = new int[] {};
    }

    return new RetroStackDockStationLayout( selected, ids );
  }
  else{
    PlaceholderMap map = new PlaceholderMap( xplaceholders, placeholders );
    return new StackDockStationLayout( selected, map );
  }
}

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

public StackDockStationLayout read( XElement element, PlaceholderStrategy placeholders ){
  XElement xselected = element.getElement( "selected" );
  int selected = -1;
  if (xselected != null)
    selected = xselected.getInt();
  XElement xplaceholders = element.getElement( "placeholders" );
  if( xplaceholders == null ){
    XElement xchildren = element.getElement( "children" );
    int[] ids;

    if (xchildren != null) {
      XElement[] children = xchildren.getElements( "child" );
      ids = new int[children.length];
      for (int i = 0, n = children.length; i < n; i++)
        ids[i] = children[i].getInt( "id" );
    } else {
      ids = new int[] {};
    }

    return new RetroStackDockStationLayout( selected, ids );
  }
  else{
    PlaceholderMap map = new PlaceholderMap( xplaceholders, placeholders );
    return new StackDockStationLayout( selected, map );
  }
}

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

public ScreenDockStationLayout read( XElement element, PlaceholderStrategy placeholders ){
  XElement xplaceholders = element.getElement( "placeholders" );
  if( xplaceholders != null ){
    return new ScreenDockStationLayout( new PlaceholderMap( xplaceholders, placeholders ) );
  }
  else{
    RetroScreenDockStationLayout layout = new RetroScreenDockStationLayout();
    for( XElement child : element.getElements( "child" )){
      layout.add( 
          child.getInt( "id" ),
          child.getInt( "x" ),
          child.getInt( "y" ),
          child.getInt( "width" ),
          child.getInt( "height" ) );
    }
    return layout;
  }
}

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

for( XElement xsetting : xsettings.getElements( "setting" )){
  String key = xsetting.getString( "name" );
  Setting setting = readXML( true, xsetting );

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