[isidorus-cvs] r676 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets src/us/isidor/gdl/anaToMia/Widgets/base src/us/isidor/gdl/anaToMia/Widgets/button src/us/isidor/gdl/anaToMia/Widgets/complexData src/us/isidor/gdl/anaToMia/Widgets/container src/us/isidor/gdl/anaToMia/Widgets/text src/us/isidor/gdl/anaToMia/Widgets/view war/gdl_widgets

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Wed Jul 27 11:07:49 UTC 2011


Author: lgiessmann
Date: Wed Jul 27 04:07:48 2011
New Revision: 676

Log:
gdl-frontend: Widgets: fixed a bug in getAssociationsOfTopic; implemented the gdl:button-positioning of GdlActionButton(s)

Modified:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/ButtonableObject.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlActionButton.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlCheckBox.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlDeleteButton.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlRadioButton.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/complexData/GdlDatePicker.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlUnit.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlListBox.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlReference.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlView.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt	Wed Jul 27 02:57:44 2011	(r675)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt	Wed Jul 27 04:07:48 2011	(r676)
@@ -1,3 +1,4 @@
+* Fix GdlActionButton => Text-Attributes
 * Implement GdlInfo
 * Implement GdlButton(s)
 * Implement TopicMaps data consumption

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/ButtonableObject.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/ButtonableObject.java	Wed Jul 27 02:57:44 2011	(r675)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/ButtonableObject.java	Wed Jul 27 04:07:48 2011	(r676)
@@ -8,7 +8,6 @@
 import com.google.gwt.user.client.ui.Composite;
 import com.google.gwt.user.client.ui.HorizontalPanel;
 import com.google.gwt.user.client.ui.Widget;
-import com.sun.corba.se.spi.orbutil.fsm.ActionBase;
 
 
 public class ButtonableObject extends Composite {
@@ -27,6 +26,12 @@
 	}
 	
 	
+	public Widget getMainObject(){
+		if(this.mainPanel.getWidgetCount() != 0) return this.mainPanel.getWidget(0);
+		else return null;
+	}
+	
+	
 	public void addButton(GdlActionButton button){
 		this.mainPanel.add(button);
 	}
@@ -45,7 +50,7 @@
 	
 	
 	public boolean containsButton(Topic tmRepresentative){
-		for(int i = 0; i != this.mainPanel.getWidgetCount(); ++i)
+		for(int i = 1; i < this.mainPanel.getWidgetCount(); ++i)
 			if(((GdlActionButton)this.mainPanel.getWidget(i)).getTmRepresentative().equals(tmRepresentative)) return true;
 		
 		return false;
@@ -53,7 +58,7 @@
 	
 	
 	public boolean containsButton(GdlActionButton button){
-		for(int i = 0; i != this.mainPanel.getWidgetCount(); ++i)
+		for(int i = 1; i < this.mainPanel.getWidgetCount(); ++i)
 			if(this.mainPanel.getWidget(i).equals(button)) return true;
 		
 		return false;
@@ -64,7 +69,7 @@
 		if(activeButtons == null) return;
 		
 		ArrayList<GdlActionButton> buttonsToRemove = new ArrayList<GdlActionButton>();
-		for(int i = 0; i != this.mainPanel.getWidgetCount(); ++i)
+		for(int i = 1; i < this.mainPanel.getWidgetCount(); ++i)
 			if(!activeButtons.contains(this.mainPanel.getWidget(i))) buttonsToRemove.add((GdlActionButton)this.mainPanel.getWidget(i));
 		
 		for (GdlActionButton buttonToRemove : buttonsToRemove)

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Wed Jul 27 02:57:44 2011	(r675)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Wed Jul 27 04:07:48 2011	(r676)
@@ -97,10 +97,9 @@
 		
 	// this method should be invoked if a new sub-element is added to this instance
 	protected ButtonableObject addToContainerPanel(Widget widget) throws ExecutionException, InvalidGdlSchemaException{
-		this.setContentOrientation(this.getContentOrientation());
-		this.subElements.add(widget);
-		
+		this.setContentOrientation(this.getContentOrientation());		
 		ButtonableObject btn = new ButtonableObject(widget);
+		this.subElements.add(btn);
 		this.containerPanel.add(btn);
 		return btn;
 	}
@@ -109,23 +108,20 @@
 	// sets all buttons in the sub-elements that are specified by a
 	// gdl:button-position association
 	protected void setNthButtons() throws InvalidGdlSchemaException, ExecutionException {
-		if(this.actionButtonsAndPositions == null) this.actionButtonsAndPositions = TmHelper.topicContainsActionButtons(this.tmRepresentative);
+		if(this.actionButtonsAndPositions == null) this.actionButtonsAndPositions = TmHelper.topicContainsNthButtons(this.tmRepresentative);
 		
-		// walk though all sub elements
 		for(int i = 0; i != this.subElements.size(); ++i){
-			ButtonableObject parent = (ButtonableObject)this.subElements.get(i).getParent();
-			
 			// search all buttons for the current sub element
 			ArrayList<Topic> currentButtons = new ArrayList<Topic>();
 			for (Pair<Topic, Integer> pair : this.actionButtonsAndPositions)
 				if(pair.getSecond() == i || (i == this.subElements.size() -1 && pair.getSecond() == -1)) currentButtons.add(pair.getFirst());
 			
 			// remove buttons that do not belong to the current sub element anymore
-			parent.removeObsoleteButtons(currentButtons);
+			((ButtonableObject)this.subElements.get(i)).removeObsoleteButtons(currentButtons);
 			
 			// add buttons that are not bound to the current sub element, but belong to it
 			for (Topic currentButton : currentButtons)
-				if(!parent.containsButton(currentButton)) parent.addButton((GdlActionButton)GdlInstantiator.instantiate(currentButton));
+				if(!((ButtonableObject)this.subElements.get(i)).containsButton(currentButton)) ((ButtonableObject)this.subElements.get(i)).addButton((GdlActionButton)GdlInstantiator.instantiate(currentButton));
 		}
 	}
 	
@@ -1551,7 +1547,7 @@
 	public MultipleHandlerRegistration addClickHandler(ClickHandler handler) {
 		MultipleHandlerRegistration regs = new MultipleHandlerRegistration();
 		for (Widget item : this.subElements) {
-			regs.addHandlerRegistration(item.addHandler(handler, ClickEvent.getType()));
+			regs.addHandlerRegistration(((ButtonableObject)item).getMainObject().addHandler(handler, ClickEvent.getType()));
 		}
 		return regs;
 	}
@@ -1562,7 +1558,7 @@
 	public MultipleHandlerRegistration addMouseOutHandler(MouseOutHandler handler){
 		MultipleHandlerRegistration regs = new MultipleHandlerRegistration();
 		for (Widget item : this.subElements) {
-			regs.addHandlerRegistration(item.addHandler(handler, MouseOutEvent.getType()));
+			regs.addHandlerRegistration(((ButtonableObject)item).getMainObject().addHandler(handler, MouseOutEvent.getType()));
 		}
 		return regs;
 	}
@@ -1573,7 +1569,7 @@
 	public MultipleHandlerRegistration addMouseOverHandler(MouseOverHandler handler){
 		MultipleHandlerRegistration regs = new MultipleHandlerRegistration();
 		for (Widget item : this.subElements) {
-			regs.addHandlerRegistration(item.addHandler(handler, MouseOverEvent.getType()));
+			regs.addHandlerRegistration(((ButtonableObject)item).getMainObject().addHandler(handler, MouseOverEvent.getType()));
 		}
 		return regs;
 	}
@@ -1584,7 +1580,7 @@
 	public MultipleHandlerRegistration addFocusHandler(FocusHandler handler){
 		MultipleHandlerRegistration regs = new MultipleHandlerRegistration();
 		for (Widget item : this.subElements) {
-			regs.addHandlerRegistration(item.addHandler(handler, FocusEvent.getType()));
+			regs.addHandlerRegistration(((ButtonableObject)item).getMainObject().addHandler(handler, FocusEvent.getType()));
 		}
 		return regs;
 	}
@@ -1595,7 +1591,7 @@
 	public MultipleHandlerRegistration addMouseDownHandler(MouseDownHandler handler){
 		MultipleHandlerRegistration regs = new MultipleHandlerRegistration();
 		for (Widget item : this.subElements) {
-			regs.addHandlerRegistration(item.addHandler(handler, MouseDownEvent.getType()));
+			regs.addHandlerRegistration(((ButtonableObject)item).getMainObject().addHandler(handler, MouseDownEvent.getType()));
 		}
 		return regs;
 	}
@@ -1606,7 +1602,7 @@
 	public MultipleHandlerRegistration addMouseUpHandler(MouseUpHandler handler){
 		MultipleHandlerRegistration regs = new MultipleHandlerRegistration();
 		for (Widget item : this.subElements) {
-			regs.addHandlerRegistration(item.addHandler(handler, MouseUpEvent.getType()));
+			regs.addHandlerRegistration(((ButtonableObject)item).getMainObject().addHandler(handler, MouseUpEvent.getType()));
 		}
 		return regs;
 	}
@@ -1618,7 +1614,7 @@
 	public MultipleHandlerRegistration addBlurHandler(BlurHandler handler){
 		MultipleHandlerRegistration regs = new MultipleHandlerRegistration();
 		for (Widget item : this.subElements) {
-			regs.addHandlerRegistration(item.addHandler(handler, BlurEvent.getType()));
+			regs.addHandlerRegistration(((ButtonableObject)item).getMainObject().addHandler(handler, BlurEvent.getType()));
 		}
 		return regs;
 	}

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java	Wed Jul 27 02:57:44 2011	(r675)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java	Wed Jul 27 04:07:48 2011	(r676)
@@ -18,6 +18,7 @@
 import us.isidor.gdl.anaToMia.Widgets.environment.Pair;
 import us.isidor.gdl.anaToMia.Widgets.environment.TopicIdentifierTypes;
 import com.google.gwt.core.client.JsArray;
+import com.google.gwt.user.client.Window;
 
 
 public class TmHelper {
@@ -302,14 +303,14 @@
 		for(int i = 0; i != topic.getRolesPlayed(roleType, assocType).length(); ++i) allPotentialAssocs.add(topic.getRolesPlayed(roleType, assocType).get(i).getParent());
 		
 		ArrayList<Association> assocsWoScope = new ArrayList<Association>();
-		ArrayList<Pair<Topic, Topic>> localRolePlayertypesAndTypes = rolePlayertypesAndTypes;
+		@SuppressWarnings("unchecked")
+		ArrayList<Pair<Topic, Topic>> localRolePlayertypesAndTypes = (ArrayList<Pair<Topic, Topic>>)rolePlayertypesAndTypes.clone();
 		Topic typeOfTopic = topic.getTypes().length() != 0 ? topic.getTypes().get(0) : null;
 		localRolePlayertypesAndTypes.add(new Pair<Topic, Topic>(typeOfTopic, roleType));
 			
-		for (Association assoc : allPotentialAssocs){
+		for (Association assoc : allPotentialAssocs)
 			if(hasRoles(assoc, localRolePlayertypesAndTypes)) assocsWoScope.add(assoc);
-		}
-			
+		
 		for (Association assoc : assocsWoScope) if(hasThemes(assoc, scope)) result.add(assoc);
 		
 		return result;
@@ -335,7 +336,7 @@
 	// instance of gdl:Nth-Element.
 	// The integer contains the index specified by the nth-value occurrence, a -1 indicates
 	// the value last.
-	public static ArrayList<Pair<Topic, Integer>> topicContainsActionButtons(Topic container) throws InvalidGdlSchemaException{
+	public static ArrayList<Pair<Topic, Integer>> topicContainsNthButtons(Topic container) throws InvalidGdlSchemaException{
 		ArrayList<Pair<Topic, Integer>> result = new ArrayList<Pair<Topic,Integer>>();
 		if(container == null) return result;
 		
@@ -345,7 +346,7 @@
 		Topic actionButtonType = getTopicByPsi(GdlPsis.TopicType.gdlActionButton, tm);
 		Topic containeeRoleType = getTopicByPsi(GdlPsis.RoleType.gdlContainee, tm);
 		ArrayList<Topic> actionButtons = getOtherPlayerOfBinaryAssociation(container, containerRoleType, containsAssocType, null, actionButtonType, containeeRoleType);
-				
+		
 		Topic actionButtonRoleType = getTopicByPsi(GdlPsis.RoleType.gdlActionButton, tm);
 		Topic buttonPosition = getTopicByPsi(GdlPsis.AssociationType.gdlButtonPosition, tm);
 		Topic nthElementType = getTopicByPsi(GdlPsis.TopicType.gdlNthElement, tm);

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlActionButton.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlActionButton.java	Wed Jul 27 02:57:44 2011	(r675)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlActionButton.java	Wed Jul 27 04:07:48 2011	(r676)
@@ -33,11 +33,10 @@
 	protected Button createButton() throws InvalidGdlSchemaException, ExecutionException{
 		if(this.subElements.size() != 0) return (Button)this.subElements.get(0);
 		Button btn = new Button();
-		this.setGdlStyle(btn);
 		this.subElements.add(btn);
 		this.mainPanel.add(btn);
 		this.setId(this.getId());
-		
+		this.setGdlStyle(btn);
 		return btn;
 	}
 	

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlCheckBox.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlCheckBox.java	Wed Jul 27 02:57:44 2011	(r675)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlCheckBox.java	Wed Jul 27 04:07:48 2011	(r676)
@@ -17,6 +17,7 @@
 		this.createcheckBox().setText("Check Box 1");
 		this.createcheckBox().setText("Check Box 2");
 		this.createcheckBox().setText("Check Box 3");
+		this.setNthButtons();
 	}
 	
 	

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlDeleteButton.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlDeleteButton.java	Wed Jul 27 02:57:44 2011	(r675)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlDeleteButton.java	Wed Jul 27 04:07:48 2011	(r676)
@@ -1,5 +1,6 @@
 package us.isidor.gdl.anaToMia.Widgets.button;
 
+
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
 import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
 import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlRadioButton.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlRadioButton.java	Wed Jul 27 02:57:44 2011	(r675)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlRadioButton.java	Wed Jul 27 04:07:48 2011	(r676)
@@ -18,6 +18,7 @@
 		this.createRadioButton().setText("Radio Button 1");
 		this.createRadioButton().setText("Radio Button 2");
 		this.createRadioButton().setText("Radio Button 3");
+		this.setNthButtons();
 	}
 	
 	

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/complexData/GdlDatePicker.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/complexData/GdlDatePicker.java	Wed Jul 27 02:57:44 2011	(r675)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/complexData/GdlDatePicker.java	Wed Jul 27 04:07:48 2011	(r676)
@@ -47,6 +47,7 @@
 		super(tmRepresentative);
 		// create a date widget for each tm-construct
 		this.createDateWidget();
+		this.setNthButtons();
 	}
 	
 	

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java	Wed Jul 27 02:57:44 2011	(r675)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java	Wed Jul 27 04:07:48 2011	(r676)
@@ -28,6 +28,7 @@
 import com.google.gwt.event.shared.HandlerRegistration;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
+import us.isidor.gdl.anaToMia.Widgets.base.ButtonableObject;
 import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis;
 import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
 import us.isidor.gdl.anaToMia.Widgets.base.IGdlContainer;
@@ -51,6 +52,7 @@
 	protected GdlList() throws InvalidGdlSchemaException, ExecutionException {
 		super();
 		this.createList();
+		this.setNthButtons();
 	}
 	
 	
@@ -174,7 +176,7 @@
 	protected void setGdlStyle() throws InvalidGdlSchemaException, ExecutionException{
 		if(this.subElements != null){
 			for (Widget item : this.subElements) {
-				this.setGdlStyle(item);
+				this.setGdlStyle(((ButtonableObject)item).getMainObject());
 			}
 		}
 	}
@@ -197,7 +199,7 @@
 	// inserts the passed item on the given index
 	public void insert(GdlVisibleObject item, int position){
 		if(this.subElements != null && this.subElements.size() != 0){
-			((ListWidget)this.subElements.get(0)).insertWidget(item, position);
+			((ListWidget)((ButtonableObject)this.subElements.get(0)).getMainObject()).insertWidget(item, position);
 		}
 	}
 	
@@ -404,7 +406,7 @@
 		int idx = -1;
 		for (Pair<Topic, Integer> pair : this.storedItems) if(pair.getFirst().equals(current)) idx = pair.getSecond();
 		
-		ListWidget list = (ListWidget)this.subElements.get(0);
+		ListWidget list = (ListWidget)((ButtonableObject)this.subElements.get(0)).getMainObject();
 		GdlVisibleObject newObj = GdlInstantiator.instantiate(current);
 		list.insertWidget(newObj, idx);
 		

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlUnit.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlUnit.java	Wed Jul 27 02:57:44 2011	(r675)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlUnit.java	Wed Jul 27 04:07:48 2011	(r676)
@@ -56,6 +56,7 @@
 		super(tmRepresentative);
 		// create a unit for each tm-element
 		this.createUnit();
+		this.setNthButtons();
 	}
 	
 	

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlListBox.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlListBox.java	Wed Jul 27 02:57:44 2011	(r675)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlListBox.java	Wed Jul 27 04:07:48 2011	(r676)
@@ -10,6 +10,7 @@
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
+import us.isidor.gdl.anaToMia.Widgets.base.ButtonableObject;
 import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis;
 import us.isidor.gdl.anaToMia.Widgets.base.IGdlHasValue;
 import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler;
@@ -30,6 +31,7 @@
 		super(tmRepresentative);
 		// TODO: create a ListBox element for each TM-elem
 		this.createNewListBox().addItem("List-Box");
+		this.setNthButtons();
 	}
 	
 	
@@ -61,7 +63,15 @@
 				break;
 			}
 		}
-		this.subElements.remove(elem);
+		
+		ButtonableObject toRemove = null;
+		for (Widget widget: this.subElements){
+			if(((ButtonableObject)widget).getMainObject().equals(widget)){
+				toRemove = (ButtonableObject)widget;
+			}
+		}
+		
+		this.subElements.remove(toRemove);
 		elem.removeFromParent();
 	}
 	
@@ -158,7 +168,7 @@
 	public ArrayList<String> getStringValue() {
 		ArrayList<String> results = new ArrayList<String>();
 		for (Widget elem : super.subElements) {
-			ListBox lb = ((ListBox)elem);
+			ListBox lb = (ListBox)((ButtonableObject)elem).getMainObject();
 			if(lb.getSelectedIndex() != -1)	results.add(lb.getValue(lb.getSelectedIndex()));
 		}
 		return results;

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlReference.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlReference.java	Wed Jul 27 02:57:44 2011	(r675)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlReference.java	Wed Jul 27 04:07:48 2011	(r676)
@@ -18,6 +18,7 @@
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
+import us.isidor.gdl.anaToMia.Widgets.base.ButtonableObject;
 import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis;
 import us.isidor.gdl.anaToMia.Widgets.base.IGdlHasValue;
 import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler;
@@ -43,6 +44,7 @@
 		Reference ref = this.createReference(); // TODO: remove
 		ref.setText("Reference"); // TODO: remove
 		ref.setHref("http://www.google.de"); // TODO: remove
+		this.setNthButtons();
 	}
 	
 	
@@ -146,7 +148,7 @@
 	public ArrayList<String> getStringValue() {
 		ArrayList<String> result = new ArrayList<String>();
 		for (Widget widget : this.subElements) {
-			result.add(((Reference)widget).getText());
+			result.add(((Reference)((ButtonableObject)widget).getMainObject()).getText());
 		}
 		return result;
 	}

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java	Wed Jul 27 02:57:44 2011	(r675)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java	Wed Jul 27 04:07:48 2011	(r676)
@@ -1,7 +1,6 @@
 package us.isidor.gdl.anaToMia.Widgets.text;
 
 import java.util.ArrayList;
-
 import com.google.gwt.event.dom.client.BlurEvent;
 import com.google.gwt.event.dom.client.KeyPressEvent;
 import com.google.gwt.event.dom.client.KeyPressHandler;
@@ -16,6 +15,7 @@
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
+import us.isidor.gdl.anaToMia.Widgets.base.ButtonableObject;
 import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis;
 import us.isidor.gdl.anaToMia.Widgets.base.IGdlHasValue;
 import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler;
@@ -48,6 +48,7 @@
 		super(tmRepresentative);
 		// TODO: create a text element for each TM-elem
 		this.createNewTextArea().setText("Text"); // TODO: remove only for debugging
+		this.setNthButtons();
 	}
 	
 	
@@ -79,8 +80,17 @@
 				break;
 			}
 		}
-		this.subElements.remove(elem);
-		elem.removeFromParent();
+		
+		ButtonableObject toRemove = null;
+		for (Widget elemIter : this.subElements){
+			if(((ButtonableObject)elemIter).getMainObject().equals(elem)){
+				toRemove = (ButtonableObject)elemIter;
+				break;				
+			}
+		}
+		
+		this.subElements.remove(toRemove);
+		toRemove.removeFromParent();
 	}
 	
 	
@@ -530,8 +540,9 @@
 				this.passwordKeyPressRegistrations = new ArrayList<HandlerRegistration>();
 				
 				for (Widget item : this.subElements) {
+					TextArea elem = (TextArea)((ButtonableObject)item).getMainObject();
 					PasswordKeyPressHandler handler = new PasswordKeyPressHandler();
-					this.passwordKeyPressRegistrations.add(((TextArea)item).addKeyPressHandler(handler));
+					this.passwordKeyPressRegistrations.add(elem.addKeyPressHandler(handler));
 				}
 			}
 		}else {
@@ -572,7 +583,7 @@
 	protected void setGdlStyle() throws InvalidGdlSchemaException, ExecutionException{
 		if(this.subElements != null){
 			for (Widget item : this.subElements) {
-				this.setGdlStyle(item);
+				this.setGdlStyle(((ButtonableObject)item).getMainObject());
 			}
 		}
 	}
@@ -582,7 +593,7 @@
 	public ArrayList<String> getStringValue() {
 		ArrayList<String> results = new ArrayList<String>();
 		for (Widget item : this.subElements) {
-			results.add(((TextArea)item).getValue());
+			results.add(((TextArea)((ButtonableObject)item).getMainObject()).getValue());
 		}
 		return results;
 	}

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java	Wed Jul 27 02:57:44 2011	(r675)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java	Wed Jul 27 04:07:48 2011	(r676)
@@ -4,6 +4,7 @@
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
+import us.isidor.gdl.anaToMia.Widgets.base.ButtonableObject;
 import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis;
 import us.isidor.gdl.anaToMia.Widgets.base.IGdlHasValue;
 import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler;
@@ -61,6 +62,7 @@
 		super(tmRepresentative);
 		// TODO: create a Title element for each TM-elem
 		this.createTitle().setText("Title");
+		this.setNthButtons();
 	}
 	
 	
@@ -423,7 +425,7 @@
 	public ArrayList<String> getStringValue() {
 		ArrayList<String> result = new ArrayList<String>();
 		for (Widget title : this.subElements) {
-			result.add(((TitleWidget)title).titleElement.getInnerText());
+			result.add(((TitleWidget)((ButtonableObject)title).getMainObject()).titleElement.getInnerText());
 		}
 		return result;
 	}

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlView.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlView.java	Wed Jul 27 02:57:44 2011	(r675)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlView.java	Wed Jul 27 04:07:48 2011	(r676)
@@ -2,7 +2,6 @@
 
 import java.util.ArrayList;
 import com.google.gwt.core.client.JsArray;
-import com.google.gwt.event.dom.client.ClickHandler;
 import com.google.gwt.user.client.ui.Widget;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Name;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm	Wed Jul 27 02:57:44 2011	(r675)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm	Wed Jul 27 04:07:48 2011	(r676)
@@ -75,8 +75,8 @@
            {"subject_identifiers":["[doc:title-1]"], "instance_of":["si:[gdl:Title]"], "occurrences":[{"type":"si:[gdl:id]", "value":"title_1_id", "datatype":"[xsd:ID]"}, {"type":"si:[gdl:text-decoration]", "value":"underline"}, {"type":"si:[gdl:background-color]", "value":"#ccc"}, {"type":"si:[gdl:font-weight]", "value":"bold"}]},
     	   {"subject_identifiers":["[doc:unit-1-reference]"], "instance_of":["si:[gdl:Reference]"], "occurrences":[{"type":"si:[gdl:id]", "value":"unit_1_reference_id"},{"type":"si:[gdl:float]", "value":"left"}]},
     	   {"subject_identifiers":["[doc:unit-1-text]"], "instance_of":["si:[gdl:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"unit_1_text_id"}, {"type":"si:[gdl:clear]","value":"right"}]},
-    	   {"subject_identifiers":["[doc:unit-1-text-delete-button]"], "instance_of":["si:[gdl:Delete-Button]"], "occurrences":[{"type":"si:[gdl:id]","value":"unit_1_text_delete_button"}]},
-    	   {"subject_identifiers":["[doc:unit-1-text-create-button]"], "instance_of":["si:[gdl:Create-Button]"], "occurrences":[{"type":"si:[gdl:id]","value":"unit_1_text_delete_button"}]},
+    	   {"subject_identifiers":["[doc:unit-1-text-delete-button]"], "instance_of":["si:[gdl:Delete-Button]"], "occurrences":[{"type":"si:[gdl:id]","value":"unit_1_text_delete_button"}, {"type":"si:[gdl:font-size]", "value":"8px"}]},
+    	   {"subject_identifiers":["[doc:unit-1-text-create-button]"], "instance_of":["si:[gdl:Create-Button]"], "occurrences":[{"type":"si:[gdl:id]","value":"unit_1_text_create_button"}, {"type":"si:[gdl:font-size]", "value":"8px"}]},
     	   {"subject_identifiers":["[doc:pos-of-unit-1-reference]"], "instance_of":["si:[gdl:Position]"]},
     	   {"subject_identifiers":["[doc:pos-of-unit-1-radio-button]"], "instance_of":["si:[gdl:Position]"]},
     	   {"subject_identifiers":["[doc:pos-of-unit-1-check-box]"], "instance_of":["si:[gdl:Position]"]},
@@ -122,7 +122,7 @@
            {"subject_identifiers":["[doc:multi-type-value-3]"], "instance_of":["si:[gdl:TM-Multiple-Type-Value]"]},
            {"subject_identifiers":["[gdl:Topic-View]"]},
            {"subject_identifiers":["[doc:nth-elem-del-btn]"], "instance_of":["si:[gdl:Nth-Element]"], "occurrences":[{"type":"si:[gdl:nth-value]", "value":"0"}]},
-           {"subject_identifiers":["[doc:nth-elem-crt-btn]"], "instance_of":["si:[gdl:Nth-Element]"], "occurrences":[{"type":"si:[gdl:nth-value]", "value":"0"}]},
+           {"subject_identifiers":["[doc:nth-elem-crt-btn]"], "instance_of":["si:[gdl:Nth-Element]"], "occurrences":[{"type":"si:[gdl:nth-value]", "value":"last"}]},
            {"subject_identifiers":["[gdl:Default-Topic-View]"]},
            {"subject_identifiers":["[gdl:Special-Topic-View]"]},
            {"subject_identifiers":["[gdl:Default-Creator-Topic-View]"]},




More information about the Isidorus-cvs mailing list