GrxModeInfoItem.java
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3  * All rights reserved. This program is made available under the terms of the
4  * Eclipse Public License v1.0 which accompanies this distribution, and is
5  * available at http://www.eclipse.org/legal/epl-v10.html
6  * Contributors:
7  * General Robotix Inc.
8  * National Institute of Advanced Industrial Science and Technology (AIST)
9  */
10 /*
11  * GrxModeInfoItem.java
12  *
13  * Copyright (C) 2007 GeneralRobotix, Inc.
14  * All Rights Reserved
15  *
16  * @author Yuichiro Kawasumi (General Robotix, Inc.)
17  */
18 
19 package com.generalrobotix.ui.item;
20 
21 import java.util.ArrayList;
22 
23 import org.w3c.dom.Element;
24 import org.w3c.dom.NodeList;
25 
32 
33 @SuppressWarnings("serial")
37 public class GrxModeInfoItem extends GrxBaseItem {
38  public static final String TITLE = "Mode Info";
39 
40  public ArrayList<Class<? extends GrxBaseItem>> activeItemClassList_ = new ArrayList<Class<? extends GrxBaseItem>>();
41  public ArrayList<Class<? extends GrxBaseView>> activeViewClassList_ = new ArrayList<Class<? extends GrxBaseView>>();
42 
43  public GrxModeInfoItem(String name, GrxPluginManager manager) {
44  super(name, manager);
45  setExclusive(true);
46  }
47 
48  public void addItemClassList(Class<? extends GrxBasePlugin> item){
49  if ( GrxBaseItem.class.isAssignableFrom(item) && !activeItemClassList_.contains(item)) {
50  activeItemClassList_.add((Class<? extends GrxBaseItem>)item);
51  }
52  }
53 
54  @SuppressWarnings("unchecked")
55  public void restoreProperties() {
56  super.restoreProperties();
57  // アイテムプラグインの追加
58  NodeList list = element_.getElementsByTagName("item");
59  for (int i = 0; i < list.getLength(); i++) {
60  Element el = (Element) list.item(i);
61  manager_.pluginLoader_.addURL(GrxXmlUtil.expandEnvVal(el.getAttribute("lib")));
62  Class<?> cls = manager_.registerPlugin(el);
63  if ( cls != null && GrxBaseItem.class.isAssignableFrom(cls) &&
64  !activeItemClassList_.contains(cls)) {
65  activeItemClassList_.add((Class<? extends GrxBaseItem>)cls);
66  GrxDebugUtil.println( "[MODEITEM] load "+cls.getName() );
67  }
68  }
69  // ビュープラグインの追加
70  list = element_.getElementsByTagName("view");
71  for (int i = 0; i < list.getLength(); i++) {
72  Element el = (Element) list.item(i);
73  manager_.pluginLoader_.addURL(GrxXmlUtil.expandEnvVal(el.getAttribute("lib")));
74  Class cls = manager_.registerPlugin(el.getAttribute("class"));
75  if (cls != null &&
76  GrxBaseView.class.isAssignableFrom(cls) &&
77  !activeViewClassList_.contains(cls)) {
78  activeViewClassList_.add((Class<? extends GrxBaseView>)cls);
79  String name = el.getAttribute("name");
80  name = name.length()>0 ? name:null;
81  // TODO:ビューはEclipseで管理しているので、このあたりの処理はざっくり削ってもよさそう。
82  // ビューを1つしか出さない、などの設定もEclipseで可能。
83  manager_.createView((Class<? extends GrxBaseView>)cls, name);
84  }
85  }
86  }
87 
88  public boolean create() {
89  return true;
90  }
91 }
#define null
our own NULL pointer
Definition: IceTypes.h:57
png_infop png_charpp name
Definition: png.h:2382
png_uint_32 i
Definition: png.h:2735
GrxModeInfoItem(String name, GrxPluginManager manager)
void addItemClassList(Class<?extends GrxBasePlugin > item)
static String expandEnvVal(String str)
プラグイン管理クラス GrxUIの核になるクラス。プラグインのロード等の、初期化を実行する。 プラグインとそ...
org


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat May 8 2021 02:42:38