GrxBaseView.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  * GrxBaseView.java
12  *
13  * Copyright (C) 2007 GeneralRobotix, Inc.
14  * All Rights Reserved
15  *
16  * @author Yuichiro Kawasumi (General Robotix, Inc.)
17  */
18 package com.generalrobotix.ui;
19 
20 import java.awt.Dimension;
21 import java.util.Enumeration;
22 import java.util.List;
23 import java.util.Properties;
24 
25 import org.eclipse.swt.SWT;
26 import org.eclipse.swt.custom.ScrolledComposite;
27 import org.eclipse.swt.widgets.Composite;
28 import org.w3c.dom.Element;
29 import org.w3c.dom.Node;
30 
32 
37 @SuppressWarnings("serial")
39 
40  private static Dimension defaultButtonSize_ = new Dimension(27, 27);
41  public boolean isScrollable_ = true;
42 
43  public double min, max, now;
44 
46  private Composite parent_;
47  private ScrolledComposite scrollComposite_;
48  protected Composite composite_;
49 
57  public GrxBaseView( String name, GrxPluginManager manager_, GrxBaseViewPart vp, Composite parent ){
58  super( name, manager_ );
59  vp_ = vp;
60  parent_ = parent;
61 
62  scrollComposite_ = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
63  composite_ = new Composite(scrollComposite_, SWT.NONE);
64  composite_.setLayout(parent.getLayout());
65  scrollComposite_.setExpandHorizontal(true);
66  scrollComposite_.setExpandVertical(true);
67  scrollComposite_.setContent(composite_);
68  }
69 
74  public void setName(String name) {
75  super.setName(name);
76  }
77 
83  return vp_;
84  }
85 
90  public Composite getParent(){
91  return parent_;
92  }
93 
98  public Composite getComposite(){
99  return composite_;
100  }
101 
105  public void setScrollMinSize(int width, int height){
106  scrollComposite_.setMinSize(composite_.computeSize(width, height));
107  }
108 
113  public static Dimension getDefaultButtonSize() {
114  return defaultButtonSize_;
115  }
116 public boolean cleanup(List<GrxBaseItem> itemList){return true;}
122 
126  public void itemListChanged() {
127  }
128 
130  }
131 
135  public void propertyChanged() {
136  }
137 
138  public void registerItemChange(GrxBaseItem item, int event){
139  }
140 
141  public void update(GrxBasePlugin plugin, Object... arg) {
142  }
143 
144  public void updatePosition(GrxBasePlugin plugin, Integer pos){
145  }
146 
147  public void updateTableFont(){
148  }
149 
150  public void updateEditerFont(){
151  }
152 
153  public void restoreProperties() {
154  clear();
155  Properties properties = manager_.getViewProperties(getName());
156  if(properties!=null){
157  for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements(); ){
158  String key = (String) e.nextElement();
159  String val = properties.getProperty(key);
160  if (!propertyChanged(key, val)){
161  setProperty(key, val);
162  }
163  }
164  }
165  }
166 
167  public Element storeProperties() {
168  if (doc_ == null)
169  return null;
170 
171  String tag = VIEW_TAG;
172  element_ = doc_.createElement(tag);
173 
174  element_.setAttribute("class",getClass().getName()); //$NON-NLS-1$
175  element_.setAttribute("name", getName()); //$NON-NLS-1$
176  element_.appendChild(doc_.createTextNode("\n")); //$NON-NLS-1$
177 
178  Enumeration<?> keys = propertyNames();
179  boolean hasProperty=false;
180  while (keys.hasMoreElements()) {
181  String key = (String)keys.nextElement();
182  String val = getProperty(key);
183  if (key == null || val == null || key.equals("name"))
184  continue;
185 
186  hasProperty = true;
187  Element propEl = doc_.createElement(GrxProjectItem.PROPERTY_TAG);
188  propEl.setAttribute("name", key); //$NON-NLS-1$
189  propEl.setAttribute("value", val); //$NON-NLS-1$
190 
191  element_.appendChild(doc_.createTextNode(INDENT4+INDENT4+INDENT4));
192  element_.appendChild(propEl);
193  element_.appendChild(doc_.createTextNode("\n")); //$NON-NLS-1$
194  }
195  element_.appendChild(doc_.createTextNode(INDENT4+INDENT4));
196 
197  if(hasProperty)
198  return element_;
199  else
200  return null;
201  }
202 
203  public void setUp() {
204 
205  }
206 
207 }
list keys
GrxBaseViewPart getViewPart()
get view part
void updatePosition(GrxBasePlugin plugin, Integer pos)
void clear(CorbaSequence &seq)
#define null
our own NULL pointer
Definition: IceTypes.h:57
void setScrollMinSize(int width, int height)
set scroll minimum size
void focusedItemChanged(GrxBaseItem item)
png_infop png_charpp name
Definition: png.h:2382
void update(GrxBasePlugin plugin, Object...arg)
ScrolledComposite scrollComposite_
Composite getParent()
get parent composite
void itemListChanged()
this method is called by PluginManager when list of items is changed
png_infop png_uint_32 * width
Definition: png.h:2309
void registerItemChange(GrxBaseItem item, int event)
png_infop png_uint_32 png_uint_32 * height
Definition: png.h:2309
void propertyChanged()
This method is called when a property of plugin is changed.
Composite getComposite()
get composite. SWTのパーツはここで取得できるコンポジット上に設置する。
int val
Definition: jpeglib.h:956
GrxBaseView(String name, GrxPluginManager manager_, GrxBaseViewPart vp, Composite parent)
constructor
プラグイン管理クラス GrxUIの核になるクラス。プラグインのロード等の、初期化を実行する。 プラグインとそ...
org
char * arg
Definition: cdjpeg.h:136
static Dimension getDefaultButtonSize()
get default button size
static int max(int a, int b)


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat Apr 13 2019 02:14:21