incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liu...@apache.org
Subject svn commit: r1359486 - in /incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test: ./ common/ vcl/ vcl/client/ vcl/widgets/
Date Tue, 10 Jul 2012 06:32:09 GMT
Author: liuzhe
Date: Tue Jul 10 06:32:08 2012
New Revision: 1359486

URL: http://svn.apache.org/viewvc?rev=1359486&view=rev
Log:
#120234# - testcommon enhancement: uno api test support, multiple instances support.

Added:
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/OpenOffice.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/WinInfoReceiver.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclWidget.java
Removed:
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/VclInspector.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/VclHook.java
Modified:
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/common/SystemUtil.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/IDList.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/CommandCaller.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/Constant.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/Handshaker.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/SmartId.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclApp.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclButton.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclComboBox.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclControl.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclDialog.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclDockingWin.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclEditBox.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclField.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclListBox.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclMenu.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclMenuItem.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclMessageBox.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclStatusBar.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclTabControl.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclTabPage.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclToolBox.java
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclWindow.java

Added: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/OpenOffice.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/OpenOffice.java?rev=1359486&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/OpenOffice.java (added)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/OpenOffice.java Tue Jul 10 06:32:08 2012
@@ -0,0 +1,318 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+package org.openoffice.test;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+import org.openoffice.test.common.FileUtil;
+import org.openoffice.test.common.SystemUtil;
+
+/**
+ * It represents one OpenOffice instance.
+ * By default, the instance will be started with automation and socket UNO connection enabled.
+ *
+ */
+public class OpenOffice {
+	
+	private static Logger LOG = Logger.getLogger(OpenOffice.class.getName());
+	
+	private static OpenOffice defaultInstance = null;
+	
+	private File userInstallation = null;
+
+	private File defaultUserInstallation = null;
+	
+	private File home = null;
+
+	private ArrayList<String> args = new ArrayList<String>();
+
+	private ArrayList<String> registryModifications = new ArrayList<String>();
+	
+	private int automationPort = 12479;
+
+	private Process process = null;
+	
+	private String unoUrl = "socket,host=localhost,port=2002;urp";
+	
+	private Properties versionProps = null;
+	
+	public OpenOffice() {
+		this(null);
+	}
+	
+	/**
+	 * Construct Process with the home path of OpenOffice. The home is the
+	 * directory which contains soffice.bin.
+	 * 
+	 * @param appHome
+	 */
+	public OpenOffice(String appHome) {
+		if (appHome == null)
+			appHome = System.getProperty("openoffice.home");
+		if (appHome == null)
+			appHome = System.getenv("OPENOFFICE_HOME");
+		if (appHome == null) {
+			if (SystemUtil.isWindows()) {
+				appHome = "C:/Program Files/OpenOffice.org 3/program";
+			} else if (SystemUtil.isMac()) {
+				appHome = "/Applications/OpenOffice.org/Contents/MacOS";
+			} else {
+				appHome = "/opt/openoffice.org3/program";
+			}
+		}
+
+		home = new File(appHome);
+		
+		File bootstrapFile = new File(home, "bootstraprc");
+		if (!bootstrapFile.exists())
+			bootstrapFile = new File(home, "bootstrap.ini");
+		if (!bootstrapFile.exists())
+			throw new Error("OpenOffice can not be found or it's broken. Testing can not be performed. " +
+					"Use system property openoffice.home to specify the correct location of OpenOffice.");
+
+		Properties props = FileUtil.loadProperties(bootstrapFile);
+		String defaultUserInstallationPath = props.getProperty("UserInstallation");
+		String sysUserConfig = null;
+		if (SystemUtil.isWindows()) {
+			sysUserConfig = System.getenv("APPDATA");
+		} else if (SystemUtil.isMac()) {
+			sysUserConfig = System.getProperty("user.home") + "/Library/Application Support";
+		} else {
+			sysUserConfig = System.getProperty("user.home");
+		}
+
+		defaultUserInstallationPath = defaultUserInstallationPath.replace("$ORIGIN", home.getAbsolutePath()).replace("$SYSUSERCONFIG", sysUserConfig);
+		defaultUserInstallation = new File(defaultUserInstallationPath);
+		
+		File versionFile = new File(home, "versionrc");
+		if (!versionFile.exists())
+			versionFile = new File(home, "version.ini");
+		if (!versionFile.exists())
+			throw new Error("OpenOffice can not be found or it's broken. Testing can not be performed. " +
+					"Use system property openoffice.home to specify the correct location of OpenOffice.");
+		
+		versionProps = FileUtil.loadProperties(versionFile);
+		addArgs("-nofirststartwizard", "-norestore", "-quickstart=no");
+		addRegistryModifications("<item oor:path=\"/org.openoffice.Office.Common/Misc\"><prop oor:name=\"UseSystemFileDialog\" oor:op=\"fuse\"><value>false</value></prop></item>",
+				"<item oor:path=\"/org.openoffice.Office.Common/Security/Scripting\"><prop oor:name=\"MacroSecurityLevel\" oor:op=\"fuse\"><value>0</value></prop></item>");
+	}
+
+	public static OpenOffice getDefault() {
+		if (defaultInstance == null) {
+			defaultInstance = new OpenOffice();
+		}
+
+		return defaultInstance;
+	}
+
+
+	public Properties getVersionProps() {
+		return versionProps;
+	}
+
+	/**
+	 * Set UserInstallation directory. When openoffice is launched, the argument
+	 * "-env:UserInstallation" will be enabled.
+	 * 
+	 * @param dir
+	 *            user installation directory. If null is given, the default
+	 *            will be used.
+	 */
+	public void setUserInstallation(File dir) {
+		userInstallation = dir;
+	}
+
+	/**
+	 * Get UserInstallation directory
+	 * 
+	 * @return
+	 */
+	public File getUserInstallation() {
+		return userInstallation == null ? defaultUserInstallation : userInstallation;
+	}
+
+	/**
+	 * Get default UserInstallation directory
+	 * 
+	 * @return
+	 */
+	public File getDefaultUserInstallation() {
+		return defaultUserInstallation;
+	}
+	
+	/**
+	 * Clean the user installation
+	 */
+	public void cleanUserInstallation() {
+		FileUtil.deleteFile(getUserInstallation());
+	}
+	
+	/**
+	 * Get installation directory of OpenOffice.
+	 * 
+	 * @return
+	 */
+	public File getHome() {
+		return home;
+	}
+
+	/**
+	 * Set other command line arguments
+	 * 
+	 * @param args
+	 */
+	public void addArgs(String... arguments) {
+		for (String a : arguments)
+			args.add(a);
+	}
+	
+	public void addRegistryModifications(String... items) {
+		for (String i : items)
+			registryModifications.add(i);
+	}
+	
+	public int getAutomationPort() {
+		return automationPort;
+	}
+
+	/**
+	 * Set automation server listening port
+	 * @param automationPort If 0, automation server will be disabled.
+	 */
+	public void setAutomationPort(int automationPort) {
+		this.automationPort = automationPort;
+	}
+
+	public String getUnoUrl() {
+		return unoUrl;
+	}
+
+	/**
+	 * Set UNO connection listening url
+	 * @param unoUrl If null, UNO connection will be disabled.
+	 */
+	public void setUnoUrl(String unoUrl) {
+		this.unoUrl = unoUrl;
+	}
+
+	/**
+	 * destroy OpenOffice
+	 */
+	public void kill() {
+		if (process != null) {
+			process.destroy();
+			try {
+				process.waitFor();
+			} catch (InterruptedException e) {
+			}
+			process = null;
+		}
+	}
+
+	/**
+	 * Kill all openoffice instances
+	 */
+	public static void killAll() {
+		if (SystemUtil.isWindows()) {
+			SystemUtil.execScript("taskkill /F /IM soffice.bin /IM soffice.exe");
+		} else {
+			SystemUtil.execScript("killall -9 soffice soffice.bin");
+		}
+	}
+	
+	
+	
+	/**
+	 * Start OpenOffice
+	 * 
+	 * @return
+	 */
+	@SuppressWarnings("all")
+	public void start() {
+		try {
+			if (process != null) {
+				process.exitValue();
+				process = null;
+			}
+		} catch (Exception e1) {
+			return;
+		}
+		
+		String bin = home.getAbsolutePath() + File.separatorChar + "soffice.bin";
+//		if (SystemUtil.isWindows()) {
+//			bin = "\"" + home + "\\soffice.exe\"";
+//		} else {
+//			bin = "cd \"" + home + "\" ; ./soffice.bin";
+//		}
+		
+		ArrayList<String> cmds = new ArrayList<String>();
+		cmds.add(bin);
+		if (automationPort > 0) {
+			cmds.add("-automationport=" + automationPort);
+			cmds.add("-enableautomation");
+		}
+
+		if (unoUrl != null)
+			cmds.add("-accept=" + unoUrl);
+		
+		if (userInstallation != null) {
+			try {
+				String url = userInstallation.toURL().toString();
+				url = url.replace("file:/", "file:///");
+				cmds.add("-env:UserInstallation=" + url);
+			} catch (MalformedURLException e) {
+				// ignore never to occur
+			}
+		}
+
+		if (args != null)
+			cmds.addAll(args);
+
+		File registry = new File(getUserInstallation(), "user/registrymodifications.xcu");
+		String content = FileUtil.readFileAsString(registry);
+		String newContent = "";
+		for (String item : registryModifications) {
+			if (!content.contains(item)) {
+				newContent += item;
+			}
+		}
+		content.replace("</oor:items>", "");
+		if (content.length() == 0)
+			content += "<?xml version=\"1.0\" encoding=\"UTF-8\"?><oor:items xmlns:oor=\"http://openoffice.org/2001/registry\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">";
+		content += newContent + "</oor:items>";
+		FileUtil.writeStringToFile(registry.getAbsolutePath(), content);
+		
+		process = SystemUtil.backgroundExec(cmds.toArray(new String[]{}), null, null, null, null);
+		
+		String cmdLine="";
+		for (String s : cmds)
+			cmdLine += "\""+ s + "\" ";
+	
+		LOG.info(cmdLine);
+		if (process == null)
+			throw new RuntimeException("OpenOffice can't be started!");
+	}
+}

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/common/SystemUtil.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/common/SystemUtil.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/common/SystemUtil.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/common/SystemUtil.java Tue Jul 10 06:32:08 2012
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 package org.openoffice.test.common;
 
 import java.awt.Toolkit;
@@ -75,11 +73,6 @@ public class SystemUtil {
 		return OSNAME.startsWith("Mac");
 	}
 
-	public static String getEnv(String name, String defaultValue) {
-		String value = System.getenv(name);
-		return value == null ? defaultValue : value;
-	}
-
 	/**
 	 * Set the contents of the clipboard to the provided text
 	 */
@@ -116,8 +109,7 @@ public class SystemUtil {
 	 */
 	public static String getClipboardText() {
 		Transferable contents = getTransferable();
-		if (contents == null
-				|| !contents.isDataFlavorSupported(DataFlavor.stringFlavor))
+		if (contents == null || !contents.isDataFlavorSupported(DataFlavor.stringFlavor))
 			return "";
 		try {
 			return (String) contents.getTransferData(DataFlavor.stringFlavor);
@@ -143,77 +135,100 @@ public class SystemUtil {
 
 	/**
 	 * Execute a script and waiting it for finishing
+	 * 
 	 * @param content
 	 * @return
 	 */
 	public static int execScript(String content) {
-		return execScript(content, false);
+		StringBuffer output = new StringBuffer();
+		int code = execScript(content, output, output);
+		LOG.info(content + "\n" + "Exit Code: " + code + "\n" + output);
+		return code;
 	}
 	
 	/**
-	 * Execute a script. bat on Windows, bash on Linux
+	 * Execute a script and waiting it for finishing
 	 * @param content
-	 * @param spawn
+	 * @param output
+	 * @param error
 	 * @return
 	 */
-	public static int execScript(String content, boolean spawn) {
+	public static int execScript(String content, StringBuffer output, StringBuffer error) {
 		File file = null;
 		try {
-			file = FileUtil
-					.getUniqueFile(SCRIPT_TEMP_DIR, "tempscript", ".bat");
+			file = FileUtil.getUniqueFile(SCRIPT_TEMP_DIR, "tempscript", ".bat");
 			FileUtil.writeStringToFile(file.getAbsolutePath(), content);
 			String[] cmd;
 			if (isWindows())
 				cmd = new String[] { file.getAbsolutePath() };
 			else
 				cmd = new String[] { "sh", file.getAbsolutePath() };
-			StringBuffer output = new StringBuffer();
-			int code = exec(cmd, null, spawn, output, output);
-			LOG.info(content + "\n" + "Exit Code: " + code + "\n" + output);
-			return code;
+			return exec(cmd, null, null, output, error);
 		} catch (Exception e) {
 			return -1;
 		} finally {
-			if (file != null) {
-				try {
-					file.deleteOnExit();
-				} catch (Exception e) {
-					// ignore
-				}
-			}
+			if (file != null && !file.delete()) 
+				file.deleteOnExit();
+		}
+	}
+	
+	/**
+	 * Start a background process
+	 * @param cmd
+	 * @param env
+	 * @param dir
+	 * @param output
+	 * @param error
+	 * @return
+	 */
+	public static Process backgroundExec(String[] cmd, String[] env, File dir, StringBuffer output, StringBuffer error) {
+		try {
+			Process process = Runtime.getRuntime().exec(cmd, env, dir);
+			StreamPump inputPump = new StreamPump(output, process.getInputStream());
+			StreamPump errorPump = new StreamPump(error, process.getErrorStream());
+			inputPump.start();
+			errorPump.start();
+			return process;
+		} catch (Exception e) {
+			return null;
 		}
 	}
 
-	public static int exec(String[] command, String workingDir, boolean spawn,
-			StringBuffer output, StringBuffer error) {
+	/**
+	 * Execute the command and wait for its finishing
+	 * @param cmd
+	 * @param env
+	 * @param dir
+	 * @param output
+	 * @param error
+	 * @return
+	 */
+	public static int exec(String[] cmd, String[] env, File dir, StringBuffer output, StringBuffer error) {
 		Process process = null;
-		File dir = workingDir == null ? null : new File(workingDir);
-		int code = 0;
 		try {
-			process = Runtime.getRuntime().exec(command, null, dir);
+			process = Runtime.getRuntime().exec(cmd, env, dir);
 		} catch (Exception e) {
-			e.printStackTrace();
 			return -1;
 		}
+		
 		StreamPump inputPump = new StreamPump(output, process.getInputStream());
 		StreamPump errorPump = new StreamPump(error, process.getErrorStream());
 		inputPump.start();
 		errorPump.start();
+		
 		try {
-			if (!spawn) {
-				code = process.waitFor();
-				inputPump.join();
-				errorPump.join();
-			}
+			int code = process.waitFor();
+			inputPump.join();
+			errorPump.join();
 			return code;
 		} catch (InterruptedException e) {
-			e.printStackTrace();
-			return -1;
+			return -2;
 		}
 	}
 
 	/**
 	 * Make the current thread sleep some seconds.
+	 * 
 	 * @param second
 	 */
 	public static void sleep(double second) {
@@ -243,8 +258,7 @@ public class SystemUtil {
 			} else {
 				// exec("ps -x -eo command", output, output);
 			}
-			BufferedReader reader = new BufferedReader(new StringReader(
-					output.toString()));
+			BufferedReader reader = new BufferedReader(new StringReader(output.toString()));
 			String line = null;
 			while ((line = reader.readLine()) != null) {
 				ret.add(line);

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/IDList.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/IDList.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/IDList.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/IDList.java Tue Jul 10 06:32:08 2012
@@ -32,8 +32,6 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
 
-import org.openoffice.test.vcl.client.SmartId;
-
 /**
  * 
  * The class is used to read an from external files to replace the id in the code. 
@@ -104,7 +102,7 @@ public class IDList {
 		}
 	}
 	
-	public SmartId getId(String id) {
+	public String getId(String id) {
 		String value = map.get(id);
 		if (value == null) {
 			int i = id.indexOf("_");
@@ -114,15 +112,8 @@ public class IDList {
 		}
 		if (value != null)
 			//The external definition overwrites the id.
-			id = value; 
+			id = value;
 		
-		try {
-			//Try to convert ID to number ID for old build.
-			//From OO3.4 all IDs should be string.
-			return new SmartId(Long.parseLong(id));
-		} catch (NumberFormatException e) {
-			
-		}
-		return new SmartId(id);
+		return id;
 	}
 }

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/CommandCaller.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/CommandCaller.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/CommandCaller.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/CommandCaller.java Tue Jul 10 06:32:08 2012
@@ -37,13 +37,6 @@ import java.util.List;
  */
 public class CommandCaller implements CommunicationListener, Constant {
 	
-	public static interface WinInfoReceiver {
-		void onStartReceiving();
-		void addWinInfo(SmartId id, long type, String t1);
-		void onFinishReceiving();
-		
-	}
-	
 	private ByteArrayOutputStream dataOutput = new ByteArrayOutputStream(1024);
 	
 	private ByteArrayInputStream dataInput = null;
@@ -68,6 +61,7 @@ public class CommandCaller implements Co
 		
 	public CommandCaller(CommunicationManager communicationManager) {
 		this.communicationManager = communicationManager;
+		communicationManager.addListener(this);
 	}
 
 	private void write(byte[] bytes) {
@@ -457,7 +451,7 @@ public class CommandCaller implements Co
 	 * @param args the arguments. The arguments can be Integer, Long, Boolean and String.
 	 * @return The return can be Integer, Long, String and Boolean or an Object[] includes these types of object.
 	 */
-	public synchronized Object callCommand(int methodId, Object[] args) {
+	public synchronized Object callCommand(int methodId, Object... args) {
 		beginBlock();
 		writeUShort(SICommand);
 		writeUShort(methodId);
@@ -471,23 +465,27 @@ public class CommandCaller implements Co
 		return null;
 	}
 	
+	public synchronized Object callCommand(int methodId) {
+		return callCommand(methodId, (Object)null);
+	}
+	
 	/**
 	 *  Tell automation server to execute a 'StatementControl'
-	 * @param uid the control ID
+	 * @param id the control ID
 	 * @param methodId the method ID defined Constant class
 	 * @param args the arguments. The arguments can be Integer, Long, Boolean and String.
 	 * @return The return can be Integer, Long, String and Boolean or an Object[] includes these types of object.
 	 */
-	public synchronized Object callControl(SmartId uid, int methodId, Object[] args){
+	public synchronized Object callControl(String id, int methodId, Object... args){
 		beginBlock();
-		if (uid.getSid() != null) {
-			writeUShort(SIStringControl);
-			writeString(uid.getSid());
-		} else {
+		try {
+			long noId = Long.parseLong(id);
 			writeUShort(SIControl);
-			writeULong(uid.getId());
-		}
-		
+			writeULong(noId);
+		} catch (NumberFormatException e) {
+			writeUShort(SIStringControl);
+			writeString(id);
+		}		
 		writeUShort(methodId);
 		writeParams(args);
 		endBlock();
@@ -515,7 +513,7 @@ public class CommandCaller implements Co
 	 * @param id the slot ID
 	 * @param args the slot args
 	 */
-	public synchronized void callSlot(int id, Object[] args) {
+	public synchronized void callSlot(int id, Object... args) {
 		beginBlock();
 		writeUShort(SISlot);
 		writeUShort(id);

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/Constant.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/Constant.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/Constant.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/Constant.java Tue Jul 10 06:32:08 2012
@@ -510,4 +510,173 @@ public interface Constant {
 
 	public static final char RC_WaitSlot = (M_SOFFICE | M_WITH_RETURN | 44);
 
+	
+	public final static int WINDOW_BASE = 0x0100;
+
+	public final static int WINDOW_FIRST = (WINDOW_BASE + 0x30);
+
+	public final static int WINDOW_MESSBOX = (WINDOW_FIRST);
+
+	public final static int WINDOW_INFOBOX = (WINDOW_FIRST + 0x01);
+
+	public final static int WINDOW_WARNINGBOX = (WINDOW_FIRST + 0x02);
+
+	public final static int WINDOW_ERRORBOX = (WINDOW_FIRST + 0x03);
+
+	public final static int WINDOW_QUERYBOX = (WINDOW_FIRST + 0x04);
+
+	public final static int WINDOW_WINDOW = (WINDOW_FIRST + 0x05);
+
+	public final static int WINDOW_SYSWINDOW = (WINDOW_FIRST + 0x06);
+
+	public final static int WINDOW_WORKWINDOW = (WINDOW_FIRST + 0x07);
+
+	// public final static int WINDOW_MDIWINDOW = (WINDOW_FIRST + 0x08);
+	public final static int WINDOW_FLOATINGWINDOW = (WINDOW_FIRST + 0x09);
+
+	public final static int WINDOW_DIALOG = (WINDOW_FIRST + 0x0a);
+
+	public final static int WINDOW_MODELESSDIALOG = (WINDOW_FIRST + 0x0b);
+
+	public final static int WINDOW_MODALDIALOG = (WINDOW_FIRST + 0x0c);
+
+	public final static int WINDOW_SYSTEMDIALOG = (WINDOW_FIRST + 0x0d);
+
+	public final static int WINDOW_PATHDIALOG = (WINDOW_FIRST + 0x0e);
+
+	public final static int WINDOW_FILEDIALOG = (WINDOW_FIRST + 0x0f);
+
+	public final static int WINDOW_PRINTERSETUPDIALOG = (WINDOW_FIRST + 0x10);
+
+	public final static int WINDOW_PRINTDIALOG = (WINDOW_FIRST + 0x11);
+
+	public final static int WINDOW_COLORDIALOG = (WINDOW_FIRST + 0x12);
+
+	public final static int WINDOW_FONTDIALOG = (WINDOW_FIRST + 0x13);
+
+	public final static int WINDOW_CONTROL = (WINDOW_FIRST + 0x14);
+
+	public final static int WINDOW_BUTTON = (WINDOW_FIRST + 0x15);
+
+	public final static int WINDOW_PUSHBUTTON = (WINDOW_FIRST + 0x16);
+
+	public final static int WINDOW_OKBUTTON = (WINDOW_FIRST + 0x17);
+
+	public final static int WINDOW_CANCELBUTTON = (WINDOW_FIRST + 0x18);
+
+	public final static int WINDOW_HELPBUTTON = (WINDOW_FIRST + 0x19);
+
+	public final static int WINDOW_IMAGEBUTTON = (WINDOW_FIRST + 0x1a);
+
+	public final static int WINDOW_MENUBUTTON = (WINDOW_FIRST + 0x1b);
+
+	public final static int WINDOW_MOREBUTTON = (WINDOW_FIRST + 0x1c);
+
+	public final static int WINDOW_SPINBUTTON = (WINDOW_FIRST + 0x1d);
+
+	public final static int WINDOW_RADIOBUTTON = (WINDOW_FIRST + 0x1e);
+
+	public final static int WINDOW_IMAGERADIOBUTTON = (WINDOW_FIRST + 0x1f);
+
+	public final static int WINDOW_CHECKBOX = (WINDOW_FIRST + 0x20);
+
+	public final static int WINDOW_TRISTATEBOX = (WINDOW_FIRST + 0x21);
+
+	public final static int WINDOW_EDIT = (WINDOW_FIRST + 0x22);
+
+	public final static int WINDOW_MULTILINEEDIT = (WINDOW_FIRST + 0x23);
+
+	public final static int WINDOW_COMBOBOX = (WINDOW_FIRST + 0x24);
+
+	public final static int WINDOW_LISTBOX = (WINDOW_FIRST + 0x25);
+
+	public final static int WINDOW_MULTILISTBOX = (WINDOW_FIRST + 0x26);
+
+	public final static int WINDOW_FIXEDTEXT = (WINDOW_FIRST + 0x27);
+
+	public final static int WINDOW_FIXEDLINE = (WINDOW_FIRST + 0x28);
+
+	public final static int WINDOW_FIXEDBITMAP = (WINDOW_FIRST + 0x29);
+
+	public final static int WINDOW_FIXEDIMAGE = (WINDOW_FIRST + 0x2a);
+
+	public final static int WINDOW_GROUPBOX = (WINDOW_FIRST + 0x2c);
+
+	public final static int WINDOW_SCROLLBAR = (WINDOW_FIRST + 0x2d);
+
+	public final static int WINDOW_SCROLLBARBOX = (WINDOW_FIRST + 0x2e);
+
+	public final static int WINDOW_SPLITTER = (WINDOW_FIRST + 0x2f);
+
+	public final static int WINDOW_SPLITWINDOW = (WINDOW_FIRST + 0x30);
+
+	public final static int WINDOW_SPINFIELD = (WINDOW_FIRST + 0x31);
+
+	public final static int WINDOW_PATTERNFIELD = (WINDOW_FIRST + 0x32);
+
+	public final static int WINDOW_NUMERICFIELD = (WINDOW_FIRST + 0x33);
+
+	public final static int WINDOW_METRICFIELD = (WINDOW_FIRST + 0x34);
+
+	public final static int WINDOW_CURRENCYFIELD = (WINDOW_FIRST + 0x35);
+
+	public final static int WINDOW_DATEFIELD = (WINDOW_FIRST + 0x36);
+
+	public final static int WINDOW_TIMEFIELD = (WINDOW_FIRST + 0x37);
+
+	public final static int WINDOW_PATTERNBOX = (WINDOW_FIRST + 0x38);
+
+	public final static int WINDOW_NUMERICBOX = (WINDOW_FIRST + 0x39);
+
+	public final static int WINDOW_METRICBOX = (WINDOW_FIRST + 0x3a);
+
+	public final static int WINDOW_CURRENCYBOX = (WINDOW_FIRST + 0x3b);
+
+	public final static int WINDOW_DATEBOX = (WINDOW_FIRST + 0x3c);
+
+	public final static int WINDOW_TIMEBOX = (WINDOW_FIRST + 0x3d);
+
+	public final static int WINDOW_LONGCURRENCYFIELD = (WINDOW_FIRST + 0x3e);
+
+	public final static int WINDOW_LONGCURRENCYBOX = (WINDOW_FIRST + 0x3f);
+
+	public final static int WINDOW_TOOLBOX = (WINDOW_FIRST + 0x41);
+
+	public final static int WINDOW_DOCKINGWINDOW = (WINDOW_FIRST + 0x42);
+
+	public final static int WINDOW_STATUSBAR = (WINDOW_FIRST + 0x43);
+
+	public final static int WINDOW_TABPAGE = (WINDOW_FIRST + 0x44);
+
+	public final static int WINDOW_TABCONTROL = (WINDOW_FIRST + 0x45);
+
+	public final static int WINDOW_TABDIALOG = (WINDOW_FIRST + 0x46);
+
+	public final static int WINDOW_BORDERWINDOW = (WINDOW_FIRST + 0x47);
+
+	public final static int WINDOW_BUTTONDIALOG = (WINDOW_FIRST + 0x48);
+
+	public final static int WINDOW_SYSTEMCHILDWINDOW = (WINDOW_FIRST + 0x49);
+
+	public final static int WINDOW_FIXEDBORDER = (WINDOW_FIRST + 0x4a);
+
+	public final static int WINDOW_SLIDER = (WINDOW_FIRST + 0x4b);
+
+	public final static int WINDOW_MENUBARWINDOW = (WINDOW_FIRST + 0x4c);
+
+	public final static int WINDOW_TREELISTBOX = (WINDOW_FIRST + 0x4d);
+
+	public final static int WINDOW_HELPTEXTWINDOW = (WINDOW_FIRST + 0x4e);
+
+	public final static int WINDOW_INTROWINDOW = (WINDOW_FIRST + 0x4f);
+
+	public final static int WINDOW_LISTBOXWINDOW = (WINDOW_FIRST + 0x50);
+
+	public final static int WINDOW_DOCKINGAREA = (WINDOW_FIRST + 0x51);
+
+	public final static int WINDOW_VALUESETLISTBOX = (WINDOW_FIRST + 0x55);
+
+	public final static int WINDOW_LAST = (WINDOW_DOCKINGAREA);
+	
+	public final static String UID_ACTIVE = "UID_ACTIVE";
 }

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/Handshaker.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/Handshaker.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/Handshaker.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/Handshaker.java Tue Jul 10 06:32:08 2012
@@ -34,7 +34,7 @@ import java.util.logging.Logger;
  */
 public class Handshaker implements CommunicationListener, Constant {
 
-	private static Logger logger = Logger.getLogger("com.ibm.vclhook");
+	private static Logger logger = Logger.getLogger("Handshaker");
 	
 	private CommunicationManager communicationManager = null;
 	

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/SmartId.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/SmartId.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/SmartId.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/SmartId.java Tue Jul 10 06:32:08 2012
@@ -26,7 +26,7 @@ package org.openoffice.test.vcl.client;
 
 /**
  * ID of GUI controls may have two types: number or string.
- * From AOO3.4, all IDs should be string.
+ * @deprecated From AOO3.4, all IDs should be string
  */
 public class SmartId {
 	

Added: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/WinInfoReceiver.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/WinInfoReceiver.java?rev=1359486&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/WinInfoReceiver.java (added)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/client/WinInfoReceiver.java Tue Jul 10 06:32:08 2012
@@ -0,0 +1,30 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+package org.openoffice.test.vcl.client;
+
+public interface WinInfoReceiver {
+	void onStartReceiving();
+
+	void addWinInfo(SmartId id, long type, String t1);
+
+	void onFinishReceiving();
+
+}
\ No newline at end of file

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclApp.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclApp.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclApp.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclApp.java Tue Jul 10 06:32:08 2012
@@ -21,182 +21,83 @@
 
 package org.openoffice.test.vcl.widgets;
 
-import java.io.File;
-import java.net.MalformedURLException;
-import java.util.Properties;
+import java.io.IOException;
 
-import org.openoffice.test.common.FileUtil;
+import org.openoffice.test.OpenOffice;
 import org.openoffice.test.common.SystemUtil;
 import org.openoffice.test.vcl.Tester;
+import org.openoffice.test.vcl.client.CommandCaller;
+import org.openoffice.test.vcl.client.CommunicationManager;
 import org.openoffice.test.vcl.client.Constant;
-import org.openoffice.test.vcl.client.VclHook;
+import org.openoffice.test.vcl.client.Handshaker;
+import org.openoffice.test.vcl.client.WinInfoReceiver;
 
 /**
  * This class provides a proxy to interact with OpenOffice application.
  * 
  */
 public class VclApp {
-
-	private String port = System.getProperty("openoffice.automation.port", "12479");
-
-	private File userInstallation = null;
-
-	private File defaultUserInstallation = null;
 	
-	private File home = null;
-
-	private String args = null;
-
-	private boolean automationEnabled = true;
-
-	/**
-	 * Construct VclApp with the home path of OpenOffice. The home is the
-	 * directory which contains soffice.bin.
-	 * 
-	 * @param appHome
-	 */
-	public VclApp(String appHome) {
-		if (appHome == null)
-			appHome = System.getProperty("openoffice.home");
-		if (appHome == null)
-			appHome = System.getenv("OPENOFFICE_HOME");
-		if (appHome == null) {
-			if (SystemUtil.isWindows()) {
-				appHome = "C:/Program Files/OpenOffice.org 3/program";
-				if (!new File(appHome).exists())
-					appHome = "C:/Program Files (x86)/OpenOffice.org 3/program";
-			} else if (SystemUtil.isMac()) {
-				appHome = "/Applications/OpenOffice.org.app/Contents/MacOS";
-			} else {
-				appHome = "/opt/openoffice.org3/program";
-			}
-		}
+	private static VclApp defaultInstance = null;
 
-		home = new File(appHome);
-		
-		File bootstrapFile = new File(home, "bootstraprc");
-		if (!bootstrapFile.exists())
-			bootstrapFile = new File(home, "bootstrap.ini");
-		if (!bootstrapFile.exists())
-			throw new RuntimeException("OpenOffice can not be found or it's broken.");
-
-		Properties props = FileUtil.loadProperties(bootstrapFile);
-		String defaultUserInstallationPath = props.getProperty("UserInstallation");
-		String sysUserConfig = null;
-		if (SystemUtil.isWindows()) {
-			sysUserConfig = System.getenv("APPDATA");
-		} else if (SystemUtil.isMac()) {
-			sysUserConfig = System.getProperty("user.home") + "/Library/Application Support";
-		} else {
-			sysUserConfig = System.getProperty("user.home");
-		}
+	protected CommunicationManager communicationManager = null;
 
-		defaultUserInstallationPath = defaultUserInstallationPath.replace("$ORIGIN", home.getAbsolutePath()).replace("$SYSUSERCONFIG", sysUserConfig);
-		defaultUserInstallation = new File(defaultUserInstallationPath);
-	}
-
-	/**
-	 * Set UserInstallation directory. When openoffice is launched, the argument
-	 * "-env:UserInstallation" will be enabled.
-	 * 
-	 * @param dir
-	 *            user installation directory. If null is given, the default
-	 *            will be used.
-	 */
-	public void setUserInstallation(File dir) {
-		userInstallation = dir;
-	}
-
-	/**
-	 * Get UserInstallation directory
-	 * 
-	 * @return
-	 */
-	public File getUserInstallation() {
-		return userInstallation == null ? defaultUserInstallation : userInstallation;
-	}
-
-	/**
-	 * Get default UserInstallation directory
-	 * 
-	 * @return
-	 */
-	public File getDefaultUserInstallation() {
-		return defaultUserInstallation;
+	protected CommandCaller caller = null;
+	
+	protected OpenOffice openOffice = null;
+	
+	public VclApp() {
+		this(OpenOffice.getDefault());
 	}
 	
-	/**
-	 * Get installation directory of OpenOffice.
-	 * 
-	 * @return
-	 */
-	public File getHome() {
-		return home;
+	public VclApp(OpenOffice openOffice) {
+		this("localhost", openOffice.getAutomationPort());
+		this.openOffice = openOffice;
 	}
-
-	/**
-	 * Set other command line arguments
-	 * 
-	 * @param args
-	 */
-	public void setArgs(String args) {
-		this.args = args;
+	
+	public VclApp(String host, int port) {
+		communicationManager = new CommunicationManager(host, port);
+		caller = new CommandCaller(communicationManager);
+		new Handshaker(communicationManager);
 	}
-
-	public boolean isAutomationEnabled() {
-		return automationEnabled;
+	
+	public static VclApp getDefault() {
+		if (defaultInstance == null) {
+			defaultInstance = new VclApp();
+		}
+			
+		return defaultInstance;
 	}
 
-	public void setAutomationEnabled(boolean automationEnabled) {
-		this.automationEnabled = automationEnabled;
+	public void setWinInfoReceiver(WinInfoReceiver receiver) {
+		caller.setWinInfoReceiver(receiver);
 	}
-
-	/**
-	 * Kill OpenOffice
-	 */
-	public void kill() {
-		if (SystemUtil.isWindows()) {
-			SystemUtil.execScript("taskkill /F /IM soffice.bin /IM soffice.exe", false);
-		} else {
-			SystemUtil.execScript("killall -9 soffice soffice.bin", false);
+	
+	public void start() {
+		if (openOffice != null) {
+			openOffice.start();
 		}
-
+		
+		communicationManager.start();
 	}
-
-	/**
-	 * Start OpenOffice
-	 * 
-	 * @return
-	 */
-	public int start() {
-		String cmd = null;
-
-		if (SystemUtil.isWindows()) {
-			cmd = "\"" + home + "\\soffice.exe\"";
-		} else {
-			cmd = "cd \"" + home + "\" ; ./soffice";
-		}
-
-		if (automationEnabled) {
-			cmd += " -norestore -quickstart=no -nofirststartwizard -enableautomation -automationport=" + port;
-		}
-
-		if (userInstallation != null) {
-			try {
-				String url = userInstallation.toURL().toString();
-				url = url.replace("file:/", "file:///");
-				cmd += " -env:UserInstallation=" + url;
-			} catch (MalformedURLException e) {
-				// ignore never to occur
+	
+	public OpenOffice getOpenOffice() {
+		return this.openOffice;
+	}
+	
+	public void close() {
+		try {
+			dispatch(".uno:Quit");
+			SystemUtil.sleep(3);
+		} finally {
+			communicationManager.stop();
+			if (openOffice != null) {
+				openOffice.kill();
 			}
 		}
-
-		if (args != null)
-			cmd += " " + args;
-
-		return SystemUtil.execScript(cmd, true);
 	}
-
+	
+	
 	/**
 	 * Activate the document window at the given index
 	 * Note: this method requires automation enabled.
@@ -204,7 +105,7 @@ public class VclApp {
 	 * @return
 	 */
 	public void activateDoc(int i) {
-		VclHook.invokeCommand(Constant.RC_ActivateDocument, new Object[] { i + 1 });
+		caller.callCommand(Constant.RC_ActivateDocument, new Object[] { i + 1 });
 	}
 
 	/**
@@ -213,7 +114,7 @@ public class VclApp {
 	 * Note: this method requires automation enabled.
 	 */
 	public void reset() {
-		VclHook.invokeCommand(Constant.RC_ResetApplication);
+		caller.callCommand(Constant.RC_ResetApplication);
 	}
 
 	/**
@@ -221,14 +122,14 @@ public class VclApp {
 	 * @return
 	 */
 	public boolean existsSysDialog() {
-		return (Boolean) VclHook.invokeCommand(Constant.RC_ExistsSysDialog);
+		return (Boolean) caller.callCommand(Constant.RC_ExistsSysDialog);
 	}
 
 	/**
 	 * Note: this method requires automation enabled.
 	 */
 	public void closeSysDialog() {
-		VclHook.invokeCommand(Constant.RC_CloseSysDialog);
+		caller.callCommand(Constant.RC_CloseSysDialog);
 	}
 
 	/**
@@ -236,7 +137,7 @@ public class VclApp {
 	 * @return
 	 */
 	public String getClipboard() {
-		return (String) VclHook.invokeCommand(Constant.RC_GetClipboard);
+		return (String) caller.callCommand(Constant.RC_GetClipboard);
 	}
 
 	/**
@@ -244,7 +145,7 @@ public class VclApp {
 	 * @param content
 	 */
 	public void setClipboard(String content) {
-		VclHook.invokeCommand(Constant.RC_SetClipboard, content);
+		caller.callCommand(Constant.RC_SetClipboard, content);
 	}
 
 	/**
@@ -253,7 +154,12 @@ public class VclApp {
 	 * @return
 	 */
 	public boolean exists() {
-		return VclHook.available();
+		try {
+			communicationManager.connect();
+			return true;
+		} catch (IOException e) {
+			return false;
+		}
 	}
 
 	/**
@@ -297,7 +203,7 @@ public class VclApp {
 	 * @return
 	 */
 	public int getDocCount() {
-		return (Integer) VclHook.invokeCommand(Constant.RC_GetDocumentCount);
+		return (Integer) caller.callCommand(Constant.RC_GetDocumentCount);
 	}
 
 	/**
@@ -306,7 +212,7 @@ public class VclApp {
 	 * @param url
 	 */
 	public void dispatch(String url) {
-		VclHook.invokeUNOSlot(url);
+		caller.callUNOSlot(url);
 	}
 
 	private static final int CONST_WSTimeout = 701;
@@ -322,8 +228,8 @@ public class VclApp {
 	 * @param time timeout
 	 */
 	public void dispatch(String url, double time) {
-		VclHook.invokeUNOSlot(url);
-		int result = (Integer) VclHook.invokeCommand(Constant.RC_WaitSlot, (int) time * 1000);
+		caller.callUNOSlot(url);
+		int result = (Integer) caller.callCommand(Constant.RC_WaitSlot, (int) time * 1000);
 		if (result == CONST_WSTimeout)
 			throw new RuntimeException("Timeout to execute the dispatch!");
 	}

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclButton.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclButton.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclButton.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclButton.java Tue Jul 10 06:32:08 2012
@@ -24,7 +24,6 @@
 package org.openoffice.test.vcl.widgets;
 
 import org.openoffice.test.vcl.client.Constant;
-import org.openoffice.test.vcl.client.SmartId;
 
 
 /**
@@ -34,17 +33,12 @@ import org.openoffice.test.vcl.client.Sm
  */
 public class VclButton extends VclControl {
 	
-	/**
-	 * Construct the control with its String id
-	 * @param uid
-	 */
-	public VclButton(String uid) {
-		super(uid);
+	public VclButton(String id) {
+		super(id);
 	}
 
-
-	public VclButton(SmartId id) {
-		super(id);
+	public VclButton(VclApp app, String id) {
+		super(app, id);
 	}
 
 	/**

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclComboBox.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclComboBox.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclComboBox.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclComboBox.java Tue Jul 10 06:32:08 2012
@@ -24,7 +24,6 @@
 package org.openoffice.test.vcl.widgets;
 
 import org.openoffice.test.vcl.client.Constant;
-import org.openoffice.test.vcl.client.SmartId;
 
 /**
  * Proxy used to access Vcl Combo Box
@@ -32,17 +31,12 @@ import org.openoffice.test.vcl.client.Sm
  */
 public class VclComboBox extends VclControl {
 
-	public VclComboBox(SmartId id) {
+	public VclComboBox(String id) {
 		super(id);
 	}
 
-	/**
-	 * Define VclComboBox with String id
-	 * 
-	 * @param uid
-	 */
-	public VclComboBox(String uid) {
-		super(uid);
+	public VclComboBox(VclApp app, String id) {
+		super(app, id);
 	}
 
 	/**

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclControl.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclControl.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclControl.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclControl.java Tue Jul 10 06:32:08 2012
@@ -24,228 +24,46 @@
 package org.openoffice.test.vcl.widgets;
 
 import java.awt.Rectangle;
-import java.io.IOException;
 
 import org.openoffice.test.common.Condition;
 import org.openoffice.test.vcl.Tester;
 import org.openoffice.test.vcl.client.Constant;
-import org.openoffice.test.vcl.client.SmartId;
-import org.openoffice.test.vcl.client.VclHook;
 
 /**
  * VCL control proxy
  */
-public class VclControl {
-
-	public final static long ACTIVE = 0;
-
-	public final static int WINDOW_BASE = 0x0100;
-
-	public final static int WINDOW_FIRST = (WINDOW_BASE + 0x30);
-
-	public final static int WINDOW_MESSBOX = (WINDOW_FIRST);
-
-	public final static int WINDOW_INFOBOX = (WINDOW_FIRST + 0x01);
-
-	public final static int WINDOW_WARNINGBOX = (WINDOW_FIRST + 0x02);
-
-	public final static int WINDOW_ERRORBOX = (WINDOW_FIRST + 0x03);
-
-	public final static int WINDOW_QUERYBOX = (WINDOW_FIRST + 0x04);
-
-	public final static int WINDOW_WINDOW = (WINDOW_FIRST + 0x05);
-
-	public final static int WINDOW_SYSWINDOW = (WINDOW_FIRST + 0x06);
-
-	public final static int WINDOW_WORKWINDOW = (WINDOW_FIRST + 0x07);
-
-	// public final static int WINDOW_MDIWINDOW = (WINDOW_FIRST + 0x08);
-	public final static int WINDOW_FLOATINGWINDOW = (WINDOW_FIRST + 0x09);
-
-	public final static int WINDOW_DIALOG = (WINDOW_FIRST + 0x0a);
-
-	public final static int WINDOW_MODELESSDIALOG = (WINDOW_FIRST + 0x0b);
-
-	public final static int WINDOW_MODALDIALOG = (WINDOW_FIRST + 0x0c);
-
-	public final static int WINDOW_SYSTEMDIALOG = (WINDOW_FIRST + 0x0d);
-
-	public final static int WINDOW_PATHDIALOG = (WINDOW_FIRST + 0x0e);
-
-	public final static int WINDOW_FILEDIALOG = (WINDOW_FIRST + 0x0f);
-
-	public final static int WINDOW_PRINTERSETUPDIALOG = (WINDOW_FIRST + 0x10);
-
-	public final static int WINDOW_PRINTDIALOG = (WINDOW_FIRST + 0x11);
-
-	public final static int WINDOW_COLORDIALOG = (WINDOW_FIRST + 0x12);
-
-	public final static int WINDOW_FONTDIALOG = (WINDOW_FIRST + 0x13);
-
-	public final static int WINDOW_CONTROL = (WINDOW_FIRST + 0x14);
-
-	public final static int WINDOW_BUTTON = (WINDOW_FIRST + 0x15);
-
-	public final static int WINDOW_PUSHBUTTON = (WINDOW_FIRST + 0x16);
-
-	public final static int WINDOW_OKBUTTON = (WINDOW_FIRST + 0x17);
-
-	public final static int WINDOW_CANCELBUTTON = (WINDOW_FIRST + 0x18);
-
-	public final static int WINDOW_HELPBUTTON = (WINDOW_FIRST + 0x19);
-
-	public final static int WINDOW_IMAGEBUTTON = (WINDOW_FIRST + 0x1a);
-
-	public final static int WINDOW_MENUBUTTON = (WINDOW_FIRST + 0x1b);
-
-	public final static int WINDOW_MOREBUTTON = (WINDOW_FIRST + 0x1c);
-
-	public final static int WINDOW_SPINBUTTON = (WINDOW_FIRST + 0x1d);
-
-	public final static int WINDOW_RADIOBUTTON = (WINDOW_FIRST + 0x1e);
-
-	public final static int WINDOW_IMAGERADIOBUTTON = (WINDOW_FIRST + 0x1f);
-
-	public final static int WINDOW_CHECKBOX = (WINDOW_FIRST + 0x20);
-
-	public final static int WINDOW_TRISTATEBOX = (WINDOW_FIRST + 0x21);
-
-	public final static int WINDOW_EDIT = (WINDOW_FIRST + 0x22);
-
-	public final static int WINDOW_MULTILINEEDIT = (WINDOW_FIRST + 0x23);
-
-	public final static int WINDOW_COMBOBOX = (WINDOW_FIRST + 0x24);
-
-	public final static int WINDOW_LISTBOX = (WINDOW_FIRST + 0x25);
-
-	public final static int WINDOW_MULTILISTBOX = (WINDOW_FIRST + 0x26);
-
-	public final static int WINDOW_FIXEDTEXT = (WINDOW_FIRST + 0x27);
-
-	public final static int WINDOW_FIXEDLINE = (WINDOW_FIRST + 0x28);
-
-	public final static int WINDOW_FIXEDBITMAP = (WINDOW_FIRST + 0x29);
-
-	public final static int WINDOW_FIXEDIMAGE = (WINDOW_FIRST + 0x2a);
-
-	public final static int WINDOW_GROUPBOX = (WINDOW_FIRST + 0x2c);
-
-	public final static int WINDOW_SCROLLBAR = (WINDOW_FIRST + 0x2d);
-
-	public final static int WINDOW_SCROLLBARBOX = (WINDOW_FIRST + 0x2e);
-
-	public final static int WINDOW_SPLITTER = (WINDOW_FIRST + 0x2f);
-
-	public final static int WINDOW_SPLITWINDOW = (WINDOW_FIRST + 0x30);
-
-	public final static int WINDOW_SPINFIELD = (WINDOW_FIRST + 0x31);
-
-	public final static int WINDOW_PATTERNFIELD = (WINDOW_FIRST + 0x32);
-
-	public final static int WINDOW_NUMERICFIELD = (WINDOW_FIRST + 0x33);
-
-	public final static int WINDOW_METRICFIELD = (WINDOW_FIRST + 0x34);
-
-	public final static int WINDOW_CURRENCYFIELD = (WINDOW_FIRST + 0x35);
-
-	public final static int WINDOW_DATEFIELD = (WINDOW_FIRST + 0x36);
-
-	public final static int WINDOW_TIMEFIELD = (WINDOW_FIRST + 0x37);
-
-	public final static int WINDOW_PATTERNBOX = (WINDOW_FIRST + 0x38);
-
-	public final static int WINDOW_NUMERICBOX = (WINDOW_FIRST + 0x39);
-
-	public final static int WINDOW_METRICBOX = (WINDOW_FIRST + 0x3a);
-
-	public final static int WINDOW_CURRENCYBOX = (WINDOW_FIRST + 0x3b);
-
-	public final static int WINDOW_DATEBOX = (WINDOW_FIRST + 0x3c);
-
-	public final static int WINDOW_TIMEBOX = (WINDOW_FIRST + 0x3d);
-
-	public final static int WINDOW_LONGCURRENCYFIELD = (WINDOW_FIRST + 0x3e);
-
-	public final static int WINDOW_LONGCURRENCYBOX = (WINDOW_FIRST + 0x3f);
-
-	public final static int WINDOW_TOOLBOX = (WINDOW_FIRST + 0x41);
-
-	public final static int WINDOW_DOCKINGWINDOW = (WINDOW_FIRST + 0x42);
-
-	public final static int WINDOW_STATUSBAR = (WINDOW_FIRST + 0x43);
-
-	public final static int WINDOW_TABPAGE = (WINDOW_FIRST + 0x44);
-
-	public final static int WINDOW_TABCONTROL = (WINDOW_FIRST + 0x45);
-
-	public final static int WINDOW_TABDIALOG = (WINDOW_FIRST + 0x46);
-
-	public final static int WINDOW_BORDERWINDOW = (WINDOW_FIRST + 0x47);
-
-	public final static int WINDOW_BUTTONDIALOG = (WINDOW_FIRST + 0x48);
-
-	public final static int WINDOW_SYSTEMCHILDWINDOW = (WINDOW_FIRST + 0x49);
-
-	public final static int WINDOW_FIXEDBORDER = (WINDOW_FIRST + 0x4a);
-
-	public final static int WINDOW_SLIDER = (WINDOW_FIRST + 0x4b);
-
-	public final static int WINDOW_MENUBARWINDOW = (WINDOW_FIRST + 0x4c);
-
-	public final static int WINDOW_TREELISTBOX = (WINDOW_FIRST + 0x4d);
-
-	public final static int WINDOW_HELPTEXTWINDOW = (WINDOW_FIRST + 0x4e);
-
-	public final static int WINDOW_INTROWINDOW = (WINDOW_FIRST + 0x4f);
-
-	public final static int WINDOW_LISTBOXWINDOW = (WINDOW_FIRST + 0x50);
-
-	public final static int WINDOW_DOCKINGAREA = (WINDOW_FIRST + 0x51);
-
-	public final static int WINDOW_VALUESETLISTBOX = (WINDOW_FIRST + 0x55);
-
-	public final static int WINDOW_LAST = (WINDOW_DOCKINGAREA);
-
-	protected SmartId uid = null;
-
+public class VclControl extends VclWidget {
+	
+	protected String id = null;
+	
 	protected int type = -1;
-
+	
 	/**
-	 * Construct using smart ID
+	 * Construct an instance with id in the default VclApp
 	 * @param id
 	 */
-	public VclControl(SmartId id) {
-		this.uid = id;
+	public VclControl(String id) {
+		super();
+		this.id = id;
 	}
-	
+
 	/**
-	 * Construct using string ID or a
-	 * string indicating to dynamically find a control with the following
-	 * pattern: <br>
-	 * .find:ContainerControlID ControlType ControlIndex<br>
-	 * A space is needed to separate ContainerControlID ControlType and
-	 * ControlIndex.<br>
-	 * ".find:" is fixed prefix to tell automation server to dynamically find a
-	 * control.<br>
-	 * ContainerControlID is container control ID which is searched in<br>
-	 * ControlType gives the target control type <br>
-	 * ControlIndex is the index of target control<br>
-	 * e.g.<br>
-	 * new VclControl(".find:52821 326 2")
-	 * 
-	 * @param uid
+	 * Construct an instance with the given VclApp and ID
+	 * @param app
+	 * @param id
 	 */
-	public VclControl(String uid) {
-		this.uid = new SmartId(uid);
+	public VclControl(VclApp app, String id) {
+		super(app);
+		this.id = id;
 	}
-
+	
 	/**
 	 * Get the ID of the control
 	 * 
 	 * @return
 	 */
-	public SmartId getUID() {
-		return this.uid;
+	public String getId() {
+		return this.id;
 	}
 
 	public void click() {
@@ -347,7 +165,7 @@ public class VclControl {
 	 * @return
 	 */
 	public Object invoke(int methodId, Object... args) {
-		return VclHook.invokeControl(getUID(), methodId, args);
+		return app.caller.callControl(getId(), methodId, args);
 	}
 
 	/**
@@ -356,7 +174,7 @@ public class VclControl {
 	 * @return
 	 */
 	public Object invoke(int methodId) {
-		return VclHook.invokeControl(getUID(), methodId, null);
+		return app.caller.callControl(getId(), methodId);
 	}
 	
 	/**
@@ -460,12 +278,9 @@ public class VclControl {
 	 * 
 	 */
 	public boolean exists() {
-		// If the communication is not established. return false
-		try {
-			VclHook.getCommunicationManager().connect();
-		} catch (IOException e) {
+		if (!app.exists())
 			return false;
-		}
+		
 		return (Boolean) invoke(Constant.M_Exists);
 	}
 
@@ -512,9 +327,6 @@ public class VclControl {
 	
 	
 	public String toString() {
-		if (uid != null)
-			return uid.toString();
-		else
-			return null;
+		return id;
 	}
 }

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclDialog.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclDialog.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclDialog.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclDialog.java Tue Jul 10 06:32:08 2012
@@ -24,7 +24,6 @@
 package org.openoffice.test.vcl.widgets;
 
 import org.openoffice.test.vcl.client.Constant;
-import org.openoffice.test.vcl.client.SmartId;
 
 
 
@@ -33,20 +32,19 @@ import org.openoffice.test.vcl.client.Sm
  */
 public class VclDialog extends VclWindow {
 	
-	/**
-	 * Define the dialog with its string ID
-	 * @param id
-	 */
-	public VclDialog(String uid) {
-		super(uid);
+
+	public VclDialog(String id) {
+		super(id);
 	}
 
 
-	public VclDialog(SmartId id) {
-		super(id);
+
+	public VclDialog(VclApp app, String id) {
+		super(app, id);
 	}
 
 
+
 	/**
 	 * Closes a dialog by pressing the Cancel button.
 	 */

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclDockingWin.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclDockingWin.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclDockingWin.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclDockingWin.java Tue Jul 10 06:32:08 2012
@@ -24,7 +24,6 @@
 package org.openoffice.test.vcl.widgets;
 
 import org.openoffice.test.vcl.client.Constant;
-import org.openoffice.test.vcl.client.SmartId;
 
 
 
@@ -41,10 +40,14 @@ public class VclDockingWin extends VclWi
 		super(uid);
 	}
 
-	public VclDockingWin(SmartId id) {
-		super(id);
+
+
+	public VclDockingWin(VclApp app, String id) {
+		super(app, id);
 	}
 
+
+
 	/**
 	 * Docks a window on one edge of the desktop.
 	 */

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclEditBox.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclEditBox.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclEditBox.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclEditBox.java Tue Jul 10 06:32:08 2012
@@ -24,7 +24,6 @@
 package org.openoffice.test.vcl.widgets;
 
 import org.openoffice.test.vcl.client.Constant;
-import org.openoffice.test.vcl.client.SmartId;
 
 /**
  * Proxy used to access VCL EditField/MultiLineEditField
@@ -32,18 +31,17 @@ import org.openoffice.test.vcl.client.Sm
  */
 public class VclEditBox extends VclControl {
 
-	/**
-	 * Construct the control with its string ID
-	 * @param uid
-	 */
-	public VclEditBox(String uid) {
-		super(uid);
+	
+	public VclEditBox(String id) {
+		super(id);
 	}
 
-	public VclEditBox(SmartId smartId) {
-		super(smartId);
+	
+	public VclEditBox(VclApp app, String id) {
+		super(app, id);
 	}
 
+
 	/**
 	 * Set the text of edit box
 	 * @param str

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclField.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclField.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclField.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclField.java Tue Jul 10 06:32:08 2012
@@ -24,26 +24,24 @@
 package org.openoffice.test.vcl.widgets;
 
 import org.openoffice.test.vcl.client.Constant;
-import org.openoffice.test.vcl.client.SmartId;
 
 /**
  * Proxy used to access all VCL field controls
  *
  */
 public class VclField extends VclEditBox{
-	
-	public VclField(SmartId smartId) {
-		super(smartId);
+
+
+	public VclField(String id) {
+		super(id);
 	}
 
-	/**
-	 * Construct the field control with its string ID
-	 * @param uid
-	 */
-	public VclField(String uid) {
-		super(uid);
+	
+	public VclField(VclApp app, String id) {
+		super(app, id);
 	}
 
+
 	/**
 	 * Move one entry higher of Field
 	 * 

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclListBox.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclListBox.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclListBox.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclListBox.java Tue Jul 10 06:32:08 2012
@@ -24,23 +24,21 @@
 package org.openoffice.test.vcl.widgets;
 
 import org.openoffice.test.vcl.client.Constant;
-import org.openoffice.test.vcl.client.SmartId;
 
 
 public class VclListBox extends VclControl  {
 
-	/**
-	 * Construct the list box with its string ID
-	 * @param uid
-	 */
-	public VclListBox(String uid) {
-		super(uid);
+	
+	public VclListBox(String id) {
+		super(id);
 	}
 
-	public VclListBox(SmartId id) {
-		super(id);
+	
+	public VclListBox(VclApp app, String id) {
+		super(app, id);
 	}
 
+
 	/**
 	 * Returns the number of entries in a TreeListBox.
 	 * 

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclMenu.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclMenu.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclMenu.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclMenu.java Tue Jul 10 06:32:08 2012
@@ -24,13 +24,12 @@
 package org.openoffice.test.vcl.widgets;
 
 import org.openoffice.test.vcl.client.Constant;
-import org.openoffice.test.vcl.client.VclHook;
 
 /**
  * Define VCL menu on a window
  * 
  */
-public class VclMenu {
+public class VclMenu extends VclWidget {
 
 	private VclControl window = null;
 
@@ -39,9 +38,15 @@ public class VclMenu {
 	 * 
 	 */
 	public VclMenu() {
+		super();
+	}
 
+	
+	public VclMenu(VclApp app) {
+		super(app);
 	}
 
+
 	/**
 	 * Construct the menu on the given window
 	 * 
@@ -49,6 +54,7 @@ public class VclMenu {
 	 */
 	public VclMenu(VclControl window) {
 		this.window = window;
+		this.app = window.app;
 	}
 
 	/**
@@ -59,7 +65,7 @@ public class VclMenu {
 	 */
 	public int getItemCount() {
 		use();
-		return ((Long) VclHook.invokeCommand(Constant.RC_MenuGetItemCount)).intValue();
+		return ((Long) app.caller.callCommand(Constant.RC_MenuGetItemCount)).intValue();
 	}
 
 	/**
@@ -70,7 +76,7 @@ public class VclMenu {
 	 */
 	public VclMenuItem getItem(int index) {
 		use();
-		long id = ((Long) VclHook.invokeCommand(Constant.RC_MenuGetItemId, new Object[] { new Integer(index + 1) })).intValue();
+		long id = ((Long) app.caller.callCommand(Constant.RC_MenuGetItemId, new Object[] { new Integer(index + 1) })).intValue();
 		if (id == 0)
 			return null;
 		return new VclMenuItem(this, (int) id);

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclMenuItem.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclMenuItem.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclMenuItem.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclMenuItem.java Tue Jul 10 06:32:08 2012
@@ -26,12 +26,11 @@ package org.openoffice.test.vcl.widgets;
 import org.openoffice.test.common.SystemUtil;
 import org.openoffice.test.vcl.Tester;
 import org.openoffice.test.vcl.client.Constant;
-import org.openoffice.test.vcl.client.VclHook;
 
 /**
  *
  */
-public class VclMenuItem {
+public class VclMenuItem extends VclWidget {
 
 	private int id = -1;
 
@@ -45,6 +44,7 @@ public class VclMenuItem {
 	 * @param id
 	 */
 	public VclMenuItem(int id) {
+		super();
 		this.id = id;
 	}
 
@@ -55,6 +55,7 @@ public class VclMenuItem {
 	 * @param path
 	 */
 	public VclMenuItem(String path) {
+		super();
 		this.path = path.split("->");
 	}
 
@@ -65,8 +66,10 @@ public class VclMenuItem {
 	 * @param id
 	 */
 	public VclMenuItem(VclMenu menu, int id) {
+		super();
 		this.id = id;
 		this.menu = menu;
+		this.app = menu.app;
 	}
 
 	/**
@@ -76,15 +79,17 @@ public class VclMenuItem {
 	 * @param path
 	 */
 	public VclMenuItem(VclMenu menu, String path) {
+		super();
 		this.path = path.split("->");
 		this.menu = menu;
+		this.app = menu.app;
 	}
 
 	private Object invoke(int methodId) {
 		int id = getId();
 		if (id == -1)
 			throw new RuntimeException("Menu item '" + path[path.length - 1] + "' can be found!");
-		return VclHook.invokeCommand(methodId, new Object[] { id });
+		return app.caller.callCommand(methodId, new Object[] { id });
 	}
 
 	/**

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclMessageBox.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclMessageBox.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclMessageBox.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclMessageBox.java Tue Jul 10 06:32:08 2012
@@ -24,7 +24,6 @@
 package org.openoffice.test.vcl.widgets;
 
 import org.openoffice.test.vcl.client.Constant;
-import org.openoffice.test.vcl.client.SmartId;
 import org.openoffice.test.vcl.client.VclHookException;
 
 /**
@@ -35,26 +34,29 @@ public class VclMessageBox extends VclCo
 
 	private String message = null;
 	
+	public VclMessageBox() {
+		super(Constant.UID_ACTIVE);
+	}
 	
-	public VclMessageBox(SmartId id) {
+	public VclMessageBox(String id) {
 		super(id);
 	}
 
-	/**
-	 * Construct the active message box with a given message.
-	 * The message can be used to distinguish message boxes. 
-	 * @param msg
-	 */
-	public VclMessageBox(SmartId id, String msg) {
+	public VclMessageBox(String id, String msg) {
 		super(id);
 		this.message = msg;
 	}
 	
-	public VclMessageBox(String id, String msg) {
-		super(id);
+	public VclMessageBox(VclApp app, String id) {
+		super(app, id);
+	}
+
+	public VclMessageBox(VclApp app, String id, String msg) {
+		super(app, id);
 		this.message = msg;
 	}
 	
+
 	/**
 	 * Get the message on the message box
 	 * @return
@@ -69,7 +71,7 @@ public class VclMessageBox extends VclCo
 			if (!exists)
 				return false;
 
-			if (WINDOW_MESSBOX != getType())
+			if (Constant.WINDOW_MESSBOX != getType())
 				return false;
 
 			if (message != null) {

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclStatusBar.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclStatusBar.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclStatusBar.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclStatusBar.java Tue Jul 10 06:32:08 2012
@@ -24,7 +24,6 @@
 package org.openoffice.test.vcl.widgets;
 
 import org.openoffice.test.vcl.client.Constant;
-import org.openoffice.test.vcl.client.SmartId;
 
 /**
  * VCL status bar proxy
@@ -32,12 +31,12 @@ import org.openoffice.test.vcl.client.Sm
  */
 public class VclStatusBar extends VclControl {
 
-	public VclStatusBar(SmartId id) {
+	public VclStatusBar(String id) {
 		super(id);
 	}
 
-	public VclStatusBar(String uid) {
-		super(uid);
+	public VclStatusBar(VclApp app, String id) {
+		super(app, id);
 	}
 
 	/**

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclTabControl.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclTabControl.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclTabControl.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclTabControl.java Tue Jul 10 06:32:08 2012
@@ -24,7 +24,6 @@
 package org.openoffice.test.vcl.widgets;
 
 import org.openoffice.test.vcl.client.Constant;
-import org.openoffice.test.vcl.client.SmartId;
 
 /**
  * Proxy to access VCL tab control
@@ -32,18 +31,18 @@ import org.openoffice.test.vcl.client.Sm
  */
 public class VclTabControl extends VclControl {
 	
-	/**
-	 * Construct the tab folder with its string ID
-	 * @param uid
-	 */
-	public VclTabControl(String uid) {
-		super(uid);
+	public VclTabControl() {
+		super(Constant.UID_ACTIVE);
 	}
-
-	public VclTabControl(SmartId id) {
+	
+	public VclTabControl(String id) {
 		super(id);
 	}
 
+	public VclTabControl(VclApp app, String id) {
+		super(app, id);
+	}
+
 	/**
 	 * Get the current page
 	 * @return
@@ -110,16 +109,7 @@ public class VclTabControl extends VclCo
 	 * @param nTabResID
 	 *            The resource ID of the specified Tab page in Tab Dialog
 	 */
-	public void setPage(SmartId nTabResID) {
-		invoke(Constant.M_SetPage, new Object[] { nTabResID.getSid() == null ? nTabResID.getId() : nTabResID.getSid()});
-	}
-
-	/**
-	 * Change to the specified tab page
-	 * @param widget the TabPage widget (Type: 372)
-	 * @throws Exception
-	 */
-	public void setPage(VclControl widget) {
-		setPage(widget.getUID());
+	public void setPage(String id) {
+		invoke(Constant.M_SetPage, new Object[] {id});
 	}
 }

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclTabPage.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclTabPage.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclTabPage.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclTabPage.java Tue Jul 10 06:32:08 2012
@@ -23,30 +23,25 @@
 
 package org.openoffice.test.vcl.widgets;
 
-import org.openoffice.test.vcl.client.SmartId;
+import org.openoffice.test.vcl.client.Constant;
 
 
 public class VclTabPage extends VclDialog {
-
-	private VclTabControl tabControl = null;
 	
-	public VclTabPage(SmartId id, VclTabControl tabControl) {
+	public VclTabPage(String id) {
 		super(id);
-		this.tabControl = tabControl;
 	}
+
 	
-	public VclTabPage(String uid, VclTabControl tabControl) {
-		super(uid);
-		this.tabControl = tabControl;
+	public VclTabPage(VclApp app, String id) {
+		super(app, id);
 	}
 
-
 	/**
 	 * Selects the tab page to be active.
 	 *
 	 */
 	public void select() {
-		if (tabControl != null)
-			tabControl.setPage(this.getUID());
+		app.caller.callControl(Constant.UID_ACTIVE, Constant.M_SetPage, new Object[] {getId()});
 	}
 }

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclToolBox.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclToolBox.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclToolBox.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclToolBox.java Tue Jul 10 06:32:08 2012
@@ -24,7 +24,6 @@
 package org.openoffice.test.vcl.widgets;
 
 import org.openoffice.test.vcl.client.Constant;
-import org.openoffice.test.vcl.client.SmartId;
 
 
 /**
@@ -35,18 +34,16 @@ import org.openoffice.test.vcl.client.Sm
  */
 public class VclToolBox extends VclDockingWin {
 
-	public VclToolBox(SmartId id) {
-		super(id);
-	}
-
-	/**
-	 * Define a vcl tool bar
-	 * @param uid the string id
-	 */
+	
 	public VclToolBox(String uid) {
 		super(uid);
 	}
 
+	
+	public VclToolBox(VclApp app, String id) {
+		super(app, id);
+	}
+
 	/**
 	 * Click the down arrow of tool bar to show the menu
 	 *

Added: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclWidget.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclWidget.java?rev=1359486&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclWidget.java (added)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclWidget.java Tue Jul 10 06:32:08 2012
@@ -0,0 +1,37 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+package org.openoffice.test.vcl.widgets;
+
+
+public class VclWidget {
+
+	protected VclApp app = null;
+
+	public VclWidget() {
+		super();
+		this.app = VclApp.getDefault();
+	}
+	
+	public VclWidget(VclApp app) {
+		super();
+		this.app = app;
+	}
+}

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclWindow.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclWindow.java?rev=1359486&r1=1359485&r2=1359486&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclWindow.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclWindow.java Tue Jul 10 06:32:08 2012
@@ -34,18 +34,17 @@ import org.openoffice.test.vcl.client.Sm
  */
 public class VclWindow extends VclControl {
 	
-	/**
-	 * Define a VCL window
-	 * @param uid the string id
-	 */
+	
 	public VclWindow(String uid) {
 		super(uid);
 	}
 
-	public VclWindow(SmartId id) {
-		super(id);
+
+	public VclWindow(VclApp app, String id) {
+		super(app, id);
 	}
 
+
 	/**
 	 * Get the title of the window
 	 * @return



Mime
View raw message