18 package com.generalrobotix.ui;
20 import java.awt.Dimension;
21 import java.util.Enumeration;
22 import java.util.List;
23 import java.util.Properties;
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;
37 @SuppressWarnings(
"serial")
40 private static Dimension defaultButtonSize_ =
new Dimension(27, 27);
41 public boolean isScrollable_ =
true;
58 super( name, manager_ );
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_);
106 scrollComposite_.setMinSize(composite_.computeSize(width, height));
114 return defaultButtonSize_;
116 public boolean cleanup(List<GrxBaseItem> itemList){
return true;}
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);
171 String tag = VIEW_TAG;
172 element_ = doc_.createElement(tag);
174 element_.setAttribute(
"class",getClass().getName());
175 element_.setAttribute(
"name", getName());
176 element_.appendChild(doc_.createTextNode(
"\n"));
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"))
188 propEl.setAttribute(
"name", key);
189 propEl.setAttribute(
"value", val);
191 element_.appendChild(doc_.createTextNode(INDENT4+INDENT4+INDENT4));
192 element_.appendChild(propEl);
193 element_.appendChild(doc_.createTextNode(
"\n"));
195 element_.appendChild(doc_.createTextNode(INDENT4+INDENT4));
static final String PROPERTY_TAG
GrxBaseViewPart getViewPart()
get view part
void setName(String name)
void updatePosition(GrxBasePlugin plugin, Integer pos)
void clear(CorbaSequence &seq)
#define null
our own NULL pointer
void setScrollMinSize(int width, int height)
set scroll minimum size
void focusedItemChanged(GrxBaseItem item)
png_infop png_charpp name
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
Element storeProperties()
png_infop png_uint_32 * width
void registerItemChange(GrxBaseItem item, int event)
png_infop png_uint_32 png_uint_32 * height
void propertyChanged()
This method is called when a property of plugin is changed.
Composite getComposite()
get composite. SWTのパーツはここで取得できるコンポジット上に設置する。
GrxBaseView(String name, GrxPluginManager manager_, GrxBaseViewPart vp, Composite parent)
constructor
プラグイン管理クラス GrxUIの核になるクラス。プラグインのロード等の、初期化を実行する。 プラグインとそ...
static Dimension getDefaultButtonSize()
get default button size
static int max(int a, int b)