• R/O
  • SSH
  • HTTPS

maskat: Commit


Commit MetaInfo

Révision119 (tree)
l'heure2009-03-03 12:41:30
Auteurkazatoh

Message de Log

マスカットIDE 2.0.0 のソースフォルダに合わせてリソースを移動

Change Summary

Modification

--- maskat-ide/trunk/org.maskat.ui/src/org/maskat/ui/views/properties/LayoutPropertySource.java (nonexistent)
+++ maskat-ide/trunk/org.maskat.ui/src/org/maskat/ui/views/properties/LayoutPropertySource.java (revision 119)
@@ -0,0 +1,150 @@
1+/*
2+ * Copyright 2006 Maskat Project.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+package org.maskat.ui.views.properties;
17+
18+import org.eclipse.ui.views.properties.IPropertyDescriptor;
19+import org.eclipse.ui.views.properties.IPropertySource;
20+import org.eclipse.ui.views.properties.PropertyDescriptor;
21+import org.maskat.core.event.Event;
22+import org.maskat.core.event.EventDef;
23+import org.maskat.core.layout.Layout;
24+import org.maskat.ui.views.properties.descriptor.EventPropertyDescriptor;
25+import org.maskat.ui.views.properties.descriptor.MaskatTextPropertyDescriptor;
26+
27+public class LayoutPropertySource extends EventDef implements IPropertySource {
28+
29+ private static final String PROP_ID = "_prop_id_";
30+
31+ private static final String PROP_NAME = "_prop_name_";
32+
33+ private static final String PROP_REMOTEURL = "_prop_remoteurl_";
34+
35+ private static final String PROP_ONLOAD = "_prop_onload_";
36+
37+ private static final String PROP_REFPARENTHTML = "_prop_refparenthtml_";
38+
39+ private static final IPropertyDescriptor[] descriptor = new PropertyDescriptor[] {
40+ new MaskatTextPropertyDescriptor(PROP_ID, "id"),
41+ new MaskatTextPropertyDescriptor(PROP_NAME, "name"),
42+ new MaskatTextPropertyDescriptor(PROP_REMOTEURL, "remoteUrl"),
43+ new MaskatTextPropertyDescriptor(PROP_REFPARENTHTML, "refParentHTML") };
44+
45+ private EventDef layoutDef;
46+
47+ public EventDef getLayoutDef() {
48+ return layoutDef;
49+ }
50+
51+ public void setLayoutDef(EventDef layoutDef) {
52+ this.layoutDef = layoutDef;
53+ }
54+
55+ public Object getEditableValue() {
56+ return this;
57+ }
58+
59+ public IPropertyDescriptor[] getPropertyDescriptors() {
60+ return descriptor;
61+ }
62+
63+ public Object getPropertyValue(Object id) {
64+ Object result = doGetPropertyValue(id);
65+ if (result == null)
66+ return "";
67+ return result;
68+ }
69+
70+ public Object doGetPropertyValue(Object id) {
71+ if (PROP_ID.equals(id)) {
72+ return getId();
73+ }
74+ if (PROP_REMOTEURL.equals(id)) {
75+ return getRemoteUrl();
76+ }
77+ if (PROP_ONLOAD.equals(id)) {
78+ this.findEvent("onload");
79+ }
80+ if (PROP_REFPARENTHTML.equals(id)) {
81+ return this.getLayoutDef().getRefParentHTML();
82+ }
83+ if (PROP_NAME.equals(id)) {
84+ return this.getLayoutDef().getName();
85+ }
86+ if (PROP_ONLOAD.equals(id)) {
87+ Event event = (Event) findEvent("onload");
88+ if (event != null) {
89+ if (event.isEnable())
90+ return event;
91+ return String.valueOf(event);
92+ }
93+ return EventPropertyDescriptor.EVENT_OFF_DISP;
94+ }
95+ return null;
96+ }
97+
98+ public boolean isPropertySet(Object id) {
99+ return false;
100+ }
101+
102+ public void resetPropertyValue(Object id) {
103+ }
104+
105+ public void setPropertyValue(Object id, Object value) {
106+ if ("".equals(value)) {
107+ value = null;
108+ // PropertySource�ɋ󔒕������n���Ȃ��悤��
109+ // xml�� name="" �̂悤��attribute���o�͂��Ȃ��悤��
110+ }
111+ doSetPropertyValue(id, value);
112+ }
113+
114+ public void doSetPropertyValue(Object id, Object value) {
115+ if (PROP_ID.equals(id)) {
116+ setId((String) value);
117+ }
118+ if (PROP_REMOTEURL.equals(id)) {
119+ setRemoteUrl((String) value);
120+ }
121+ if (PROP_REFPARENTHTML.equals(id)) {
122+ this.getLayoutDef().setRefParentHTML((String) value);
123+ }
124+ if (PROP_NAME.equals(id)) {
125+ this.getLayoutDef().setName((String) value);
126+ }
127+ if (value instanceof String && PROP_ONLOAD.equals(id)) {
128+ String eventId = "onload";
129+ Event event = findEvent(eventId);
130+ if (event != null && !(event instanceof EventProperty)) {
131+ throw new IllegalArgumentException("event�̃^�C�v��EventProperty�ł͂���܂���B");
132+ }
133+ EventProperty evtProperty = (EventProperty) event;
134+ if (evtProperty == null) {
135+ evtProperty = new EventProperty();
136+ evtProperty.setId(eventId);
137+ evtProperty.addChild(new ParamProperty());
138+ evtProperty.addChild(new ResultProperty());
139+
140+ addChild(evtProperty);
141+ }
142+ if (EventPropertyDescriptor.EVENT_ON_DISP.equals(value)) {
143+ evtProperty.setEnable(true);
144+ } else {
145+ evtProperty.setEnable(false);
146+ }
147+ }
148+ }
149+
150+}
Afficher sur ancien navigateur de dépôt.